[ARM] GlobalISel: Support SP in regbankselect

We used to hit an unreachable in getRegBankFromRegClass when dealing with the
stack pointer. This commit adds support for the GPRsp reg class.

llvm-svn: 297621
This commit is contained in:
Diana Picus 2017-03-13 14:28:34 +00:00
parent 9f96347488
commit 94db2e288b
2 changed files with 36 additions and 0 deletions

View File

@ -180,6 +180,7 @@ const RegisterBank &ARMRegisterBankInfo::getRegBankFromRegClass(
switch (RC.getID()) {
case GPRRegClassID:
case GPRnopcRegClassID:
case GPRspRegClassID:
case tGPR_and_tcGPRRegClassID:
case tGPRRegClassID:
return getRegBank(ARM::GPRRegBankID);

View File

@ -8,6 +8,8 @@
define void @test_loads() #0 { ret void }
define void @test_stores() #0 { ret void }
define void @test_stack() { ret void }
define void @test_gep() { ret void }
define void @test_constants() { ret void }
@ -200,6 +202,39 @@ body: |
G_STORE %6(s64), %0 :: (store 8)
BX_RET 14, _, implicit %r0
...
---
name: test_stack
# CHECK-LABEL: name: test_stack
legalized: true
regBankSelected: false
selected: false
# CHECK: registers:
# CHECK: - { id: 0, class: gprb }
# CHECK: - { id: 1, class: gprb }
# CHECK: - { id: 2, class: gprb }
# CHECK: - { id: 3, class: gprb }
# CHECK: - { id: 4, class: gprb }
registers:
- { id: 0, class: _ }
- { id: 1, class: _ }
- { id: 2, class: _ }
- { id: 3, class: _ }
- { id: 4, class: _ }
fixedStack:
- { id: 0, offset: 0, size: 4, alignment: 4, isImmutable: true, isAliased: false }
body: |
bb.0:
%0(p0) = G_FRAME_INDEX %fixed-stack.0
%1(s32) = G_LOAD %0(p0) :: (load 4 from %fixed-stack.0, align 0)
%2(p0) = COPY %sp
%3(s32) = G_CONSTANT i32 8
%4(p0) = G_GEP %2, %3(s32)
G_STORE %1(s32), %4(p0) :: (store 4)
BX_RET 14, _
...
---
name: test_gep