[llvm-commits] [llvm] r81688 - in /llvm/trunk: lib/Target/X86/AsmPrinter/X86MCInstLower.cpp test/CodeGen/X86/pic-cpool.ll test/CodeGen/X86/pic-jtbl.ll test/CodeGen/X86/pic.ll
Chris Lattner
sabre at nondot.org
Sun Sep 13 11:46:38 PDT 2009
Author: lattner
Date: Sun Sep 13 13:46:37 2009
New Revision: 81688
URL: http://llvm.org/viewvc/llvm-project?rev=81688&view=rev
Log:
merge the linux cpool/jtbl pic tests into pic.ll and convert to filecheck.
Change the picbase symbol on non-darwin systems from ".Lllvm$4.$piclabel" to
".L4$pb". The actual name doesn't matter and the darwin name is shorter.
Removed:
llvm/trunk/test/CodeGen/X86/pic-cpool.ll
llvm/trunk/test/CodeGen/X86/pic-jtbl.ll
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
llvm/trunk/test/CodeGen/X86/pic.ll
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=81688&r1=81687&r2=81688&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Sun Sep 13 13:46:37 2009
@@ -34,14 +34,8 @@
// FIXME: the actual label generated doesn't matter here! Just mangle in
// something unique (the function number) with Private prefix.
SmallString<60> Name;
-
- if (getSubtarget().isTargetDarwin()) {
- raw_svector_ostream(Name) << 'L' << AsmPrinter.getFunctionNumber() << "$pb";
- } else {
- assert(getSubtarget().isTargetELF() && "Don't know how to print PIC label!");
- raw_svector_ostream(Name) << ".Lllvm$" << AsmPrinter.getFunctionNumber()
- << ".$piclabel";
- }
+ raw_svector_ostream(Name) << AsmPrinter.MAI->getPrivateGlobalPrefix()
+ << AsmPrinter.getFunctionNumber() << "$pb";
return Ctx.GetOrCreateSymbol(Name.str());
}
Removed: llvm/trunk/test/CodeGen/X86/pic-cpool.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pic-cpool.ll?rev=81687&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pic-cpool.ll (original)
+++ llvm/trunk/test/CodeGen/X86/pic-cpool.ll (removed)
@@ -1,14 +0,0 @@
-; RUN: llc < %s -mtriple=i686-pc-linux-gnu -relocation-model=pic \
-; RUN: -o %t
-; RUN: grep _GLOBAL_OFFSET_TABLE_ %t
-; RUN: grep piclabel %t | count 3
-; RUN: grep GOTOFF %t | count 1
-; RUN: grep CPI %t | count 2
-
-define double @foo(i32 %a.u) nounwind {
-entry:
- %tmp = icmp eq i32 %a.u,0
- %retval = select i1 %tmp, double 4.561230e+02, double 1.234560e+02
- ret double %retval
-}
-
Removed: llvm/trunk/test/CodeGen/X86/pic-jtbl.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pic-jtbl.ll?rev=81687&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pic-jtbl.ll (original)
+++ llvm/trunk/test/CodeGen/X86/pic-jtbl.ll (removed)
@@ -1,61 +0,0 @@
-; RUN: llc < %s -mtriple=i686-pc-linux-gnu -relocation-model=pic \
-; RUN: -o %t
-; RUN: grep _GLOBAL_OFFSET_TABLE_ %t
-; RUN: grep piclabel %t | count 3
-; RUN: grep PLT %t | count 6
-; RUN: grep GOTOFF %t | count 14
-; RUN: grep JTI %t | count 2
-
-; X86-64:
-; RUN: llc < %s -mtriple=x86_64-pc-linux-gnu -relocation-model=pic > %t
-; RUN: grep {LJTI1_0(%rip)} %t
-define void @bar(i32 %n.u) nounwind {
-entry:
- switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ]
-bb:
- tail call void(...)* @foo1()
- ret void
-bb1:
- tail call void(...)* @foo2()
- ret void
-bb2:
- tail call void(...)* @foo6()
- ret void
-bb3:
- tail call void(...)* @foo3()
- ret void
-bb4:
- tail call void(...)* @foo4()
- ret void
-bb5:
- tail call void(...)* @foo5()
- ret void
-bb6:
- tail call void(...)* @foo1()
- ret void
-bb7:
- tail call void(...)* @foo2()
- ret void
-bb8:
- tail call void(...)* @foo6()
- ret void
-bb9:
- tail call void(...)* @foo3()
- ret void
-bb10:
- tail call void(...)* @foo4()
- ret void
-bb11:
- tail call void(...)* @foo5()
- ret void
-bb12:
- tail call void(...)* @foo6()
- ret void
-}
-
-declare void @foo1(...)
-declare void @foo2(...)
-declare void @foo6(...)
-declare void @foo3(...)
-declare void @foo4(...)
-declare void @foo5(...)
Modified: llvm/trunk/test/CodeGen/X86/pic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pic.ll?rev=81688&r1=81687&r2=81688&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pic.ll (original)
+++ llvm/trunk/test/CodeGen/X86/pic.ll Sun Sep 13 13:46:37 2009
@@ -13,10 +13,10 @@
; LINUX: test1:
; LINUX: .LBB1_0:
-; LINUX: call .Lllvm$1.$piclabel
-; LINUX-NEXT: .Lllvm$1.$piclabel:
+; LINUX: call .L1$pb
+; LINUX-NEXT: .L1$pb:
; LINUX-NEXT: popl
-; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref1-.Lllvm$1.$piclabel),
+; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref1-.L1$pb),
; LINUX: movl dst at GOT(%eax),
; LINUX: movl ptr at GOT(%eax),
; LINUX: movl src at GOT(%eax),
@@ -35,10 +35,10 @@
ret void
; LINUX: test2:
-; LINUX: call .Lllvm$2.$piclabel
-; LINUX-NEXT: .Lllvm$2.$piclabel:
+; LINUX: call .L2$pb
+; LINUX-NEXT: .L2$pb:
; LINUX-NEXT: popl
-; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref2-.Lllvm$2.$piclabel), %eax
+; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref2-.L2$pb), %eax
; LINUX: movl dst2 at GOT(%eax),
; LINUX: movl ptr2 at GOT(%eax),
; LINUX: movl src2 at GOT(%eax),
@@ -55,10 +55,10 @@
; LINUX: test3:
; LINUX: pushl %ebx
; LINUX-NEXT: subl $8, %esp
-; LINUX-NEXT: call .Lllvm$3.$piclabel
-; LINUX-NEXT: .Lllvm$3.$piclabel:
+; LINUX-NEXT: call .L3$pb
+; LINUX-NEXT: .L3$pb:
; LINUX-NEXT: popl %ebx
-; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref3-.Lllvm$3.$piclabel), %ebx
+; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref3-.L3$pb), %ebx
; LINUX: movl $40, (%esp)
; LINUX: call malloc at PLT
; LINUX: addl $8, %esp
@@ -76,10 +76,10 @@
call void(...)* %tmp1()
ret void
; LINUX: test4:
-; LINUX: call .Lllvm$4.$piclabel
-; LINUX-NEXT: .Lllvm$4.$piclabel:
+; LINUX: call .L4$pb
+; LINUX-NEXT: .L4$pb:
; LINUX: popl
-; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref4-.Lllvm$4.$piclabel),
+; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref4-.L4$pb),
; LINUX: movl pfoo at GOT(%esi),
; LINUX: call afoo at PLT
; LINUX: call *
@@ -92,9 +92,9 @@
call void(...)* @foo()
ret void
; LINUX: test5:
-; LINUX: call .Lllvm$5.$piclabel
+; LINUX: call .L5$pb
; LINUX: popl %ebx
-; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref5-.Lllvm$5.$piclabel), %ebx
+; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref5-.L5$pb), %ebx
; LINUX: call foo at PLT
}
@@ -113,10 +113,10 @@
ret void
; LINUX: test6:
-; LINUX: call .Lllvm$6.$piclabel
-; LINUX-NEXT: .Lllvm$6.$piclabel:
+; LINUX: call .L6$pb
+; LINUX-NEXT: .L6$pb:
; LINUX-NEXT: popl %eax
-; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref6-.Lllvm$6.$piclabel), %eax
+; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref6-.L6$pb), %eax
; LINUX: leal dst6 at GOTOFF(%eax), %ecx
; LINUX: movl %ecx, ptr6 at GOTOFF(%eax)
; LINUX: movl src6 at GOTOFF(%eax), %ecx
@@ -124,3 +124,86 @@
; LINUX: ret
}
+
+;; Test constant pool references.
+define double @test7(i32 %a.u) nounwind {
+entry:
+ %tmp = icmp eq i32 %a.u,0
+ %retval = select i1 %tmp, double 4.561230e+02, double 1.234560e+02
+ ret double %retval
+
+; LINUX: .LCPI7_0:
+
+; LINUX: test7:
+; LINUX: call .L7$pb
+; LINUX: .L7$pb:
+; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref7-.L7$pb),
+; LINUX: fldl .LCPI7_0 at GOTOFF(
+}
+
+
+;; Test jump table references.
+define void @test8(i32 %n.u) nounwind {
+entry:
+ switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ]
+bb:
+ tail call void(...)* @foo1()
+ ret void
+bb1:
+ tail call void(...)* @foo2()
+ ret void
+bb2:
+ tail call void(...)* @foo6()
+ ret void
+bb3:
+ tail call void(...)* @foo3()
+ ret void
+bb4:
+ tail call void(...)* @foo4()
+ ret void
+bb5:
+ tail call void(...)* @foo5()
+ ret void
+bb6:
+ tail call void(...)* @foo1()
+ ret void
+bb7:
+ tail call void(...)* @foo2()
+ ret void
+bb8:
+ tail call void(...)* @foo6()
+ ret void
+bb9:
+ tail call void(...)* @foo3()
+ ret void
+bb10:
+ tail call void(...)* @foo4()
+ ret void
+bb11:
+ tail call void(...)* @foo5()
+ ret void
+bb12:
+ tail call void(...)* @foo6()
+ ret void
+
+; LINUX: test8:
+; LINUX: call .L8$pb
+; LINUX: .L8$pb:
+; LINUX: addl $_GLOBAL_OFFSET_TABLE_+(.Lpicbaseref8-.L8$pb),
+; LINUX: addl .LJTI8_0 at GOTOFF(
+; LINUX: jmpl *%ecx
+
+; LINUX: .LJTI8_0:
+; LINUX: .long .LBB8_2 at GOTOFF
+; LINUX: .long .LBB8_2 at GOTOFF
+; LINUX: .long .LBB8_7 at GOTOFF
+; LINUX: .long .LBB8_3 at GOTOFF
+; LINUX: .long .LBB8_7 at GOTOFF
+}
+
+declare void @foo1(...)
+declare void @foo2(...)
+declare void @foo6(...)
+declare void @foo3(...)
+declare void @foo4(...)
+declare void @foo5(...)
More information about the llvm-commits
mailing list