[llvm-branch-commits] [llvm-branch] r101087 - in /llvm/branches/Apple/Morbo: lib/Target/X86/AsmPrinter/X86MCInstLower.cpp test/CodeGen/X86/pic_jumptable.ll
Evan Cheng
evan.cheng at apple.com
Mon Apr 12 16:11:13 PDT 2010
Author: evancheng
Date: Mon Apr 12 18:11:13 2010
New Revision: 101087
URL: http://llvm.org/viewvc/llvm-project?rev=101087&view=rev
Log:
Merge 101085.
Modified:
llvm/branches/Apple/Morbo/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
llvm/branches/Apple/Morbo/test/CodeGen/X86/pic_jumptable.ll
Modified: llvm/branches/Apple/Morbo/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=101087&r1=101086&r2=101087&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original)
+++ llvm/branches/Apple/Morbo/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Mon Apr 12 18:11:13 2010
@@ -169,6 +169,15 @@
Expr = MCBinaryExpr::CreateSub(Expr,
MCSymbolRefExpr::Create(GetPICBaseSymbol(), Ctx),
Ctx);
+ if (MO.isJTI() && AsmPrinter.MAI->hasSetDirective()) {
+ // If .set directive is supported, use it to reduce the number of
+ // relocations the assembler will generate for differences between
+ // local labels. This is only safe when the symbols are in the same
+ // section so we are restricting it to jumptable references.
+ MCSymbol *Label = Ctx.CreateTempSymbol();
+ AsmPrinter.OutStreamer.EmitAssignment(Label, Expr);
+ Expr = MCSymbolRefExpr::Create(Label, Ctx);
+ }
break;
}
Modified: llvm/branches/Apple/Morbo/test/CodeGen/X86/pic_jumptable.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Morbo/test/CodeGen/X86/pic_jumptable.ll?rev=101087&r1=101086&r2=101087&view=diff
==============================================================================
--- llvm/branches/Apple/Morbo/test/CodeGen/X86/pic_jumptable.ll (original)
+++ llvm/branches/Apple/Morbo/test/CodeGen/X86/pic_jumptable.ll Mon Apr 12 18:11:13 2010
@@ -1,13 +1,18 @@
; RUN: llc < %s -relocation-model=pic -mtriple=i386-linux-gnu -asm-verbose=false | not grep -F .text
-; RUN: llc < %s -relocation-model=pic -mtriple=i686-apple-darwin -asm-verbose=false | not grep lea
-; RUN: llc < %s -relocation-model=pic -mtriple=i686-apple-darwin -asm-verbose=false | grep add | count 2
+; RUN: llc < %s -relocation-model=pic -mtriple=i686-apple-darwin -asm-verbose=false | FileCheck %s
; RUN: llc < %s -mtriple=x86_64-apple-darwin | not grep 'lJTI'
; rdar://6971437
+; rdar://7738756
declare void @_Z3bari(i32)
define linkonce void @_Z3fooILi1EEvi(i32 %Y) nounwind {
entry:
+; CHECK: L1$pb
+; CHECK-NOT: leal
+; CHECK: Ltmp0 = LJTI1_0-L1$pb
+; CHECK-NEXT: addl Ltmp0(%eax,%ecx,4)
+; CHECK-NEXT: jmpl *%eax
%Y_addr = alloca i32 ; <i32*> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store i32 %Y, i32* %Y_addr
More information about the llvm-branch-commits
mailing list