]> granicus.if.org Git - llvm/commitdiff
[ARM] GlobalISel: Legalize G_GEP with 32-bit offsets
authorDiana Picus <diana.picus@linaro.org>
Tue, 28 Feb 2017 09:02:42 +0000 (09:02 +0000)
committerDiana Picus <diana.picus@linaro.org>
Tue, 28 Feb 2017 09:02:42 +0000 (09:02 +0000)
At the moment we're only interested in GEPs for putting call parameters on the
stack, so we'll stick to 32-bit offsets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296452 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMLegalizerInfo.cpp
test/CodeGen/ARM/GlobalISel/arm-legalizer.mir

index 631d2b85e8c91846d8aff3823f60900881cf639c..32604811ab98347465c97a1d21983e711449af4e 100644 (file)
@@ -52,6 +52,9 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) {
       setAction({Op, 1, Ty}, Legal);
   }
 
+  setAction({G_GEP, p0}, Legal);
+  setAction({G_GEP, 1, s32}, Legal);
+
   if (ST.hasVFP2()) {
     setAction({G_FADD, s32}, Legal);
     setAction({G_FADD, s64}, Legal);
index 49cf9f8227164373886e3995396cebf72ce37c19..edd8c3ac8f4db2755d60ceaf20cd99ceea1604c8 100644 (file)
@@ -11,6 +11,8 @@
   define void @test_legal_loads() #0 { ret void }
   define void @test_legal_stores() #0 { ret void }
 
+  define void @test_gep() { ret void }
+
   define void @test_fadd_s32() #0 { ret void }
   define void @test_fadd_s64() #0 { ret void }
 
@@ -242,6 +244,31 @@ body:             |
     BX_RET 14, _
 ...
 ---
+name:            test_gep
+# CHECK-LABEL: name: test_gep
+legalized:       false
+# CHECK: legalized: true
+regBankSelected: false
+selected:        false
+tracksRegLiveness: true
+registers:
+  - { id: 0, class: _ }
+  - { id: 1, class: _ }
+  - { id: 2, class: _ }
+body:             |
+  bb.0:
+    liveins: %r0, %r1
+
+    %0(p0) = COPY %r0
+    %1(s32) = COPY %r1
+
+    ; CHECK: {{%[0-9]+}}(p0) = G_GEP {{%[0-9]+}}, {{%[0-9]+}}(s32)
+    %2(p0) = G_GEP %0, %1(s32)
+
+    %r0 = COPY %2(p0)
+    BX_RET 14, _, implicit %r0
+...
+---
 name:            test_fadd_s32
 # CHECK-LABEL: name: test_fadd_s32
 legalized:       false