From cc41586b9d79532172b37e1f44a9077da4b73fc9 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 9 Nov 2007 01:32:10 +0000 Subject: Much improved pic jumptable codegen: Then: call "L1$pb" "L1$pb": popl %eax ... LBB1_1: # entry imull $4, %ecx, %ecx leal LJTI1_0-"L1$pb"(%eax), %edx addl LJTI1_0-"L1$pb"(%ecx,%eax), %edx jmpl *%edx .align 2 .set L1_0_set_3,LBB1_3-LJTI1_0 .set L1_0_set_2,LBB1_2-LJTI1_0 .set L1_0_set_5,LBB1_5-LJTI1_0 .set L1_0_set_4,LBB1_4-LJTI1_0 LJTI1_0: .long L1_0_set_3 .long L1_0_set_2 Now: call "L1$pb" "L1$pb": popl %eax ... LBB1_1: # entry addl LJTI1_0-"L1$pb"(%eax,%ecx,4), %eax jmpl *%eax .align 2 .set L1_0_set_3,LBB1_3-"L1$pb" .set L1_0_set_2,LBB1_2-"L1$pb" .set L1_0_set_5,LBB1_5-"L1$pb" .set L1_0_set_4,LBB1_4-"L1$pb" LJTI1_0: .long L1_0_set_3 .long L1_0_set_2 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43924 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/AsmPrinter.h | 11 ++++++----- include/llvm/Target/TargetLowering.h | 7 ++++++- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h index 607aa70..937e9ed 100644 --- a/include/llvm/CodeGen/AsmPrinter.h +++ b/include/llvm/CodeGen/AsmPrinter.h @@ -305,11 +305,12 @@ namespace llvm { bool printColon = false, bool printComment = true) const; - /// printSetLabel - This method prints a set label for the specified - /// MachineBasicBlock - void printSetLabel(unsigned uid, const MachineBasicBlock *MBB) const; - void printSetLabel(unsigned uid, unsigned uid2, - const MachineBasicBlock *MBB) const; + /// printPICJumpTableSetLabel - This method prints a set label for the + /// specified MachineBasicBlock for a jumptable entry. + virtual void printPICJumpTableSetLabel(unsigned uid, + const MachineBasicBlock *MBB) const; + virtual void printPICJumpTableSetLabel(unsigned uid, unsigned uid2, + const MachineBasicBlock *MBB) const; /// printDataDirective - This method prints the asm directive for the /// specified type. diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 79af960..ee26579 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -93,7 +93,7 @@ public: /// usesGlobalOffsetTable - Return true if this target uses a GOT for PIC /// codegen. bool usesGlobalOffsetTable() const { return UsesGlobalOffsetTable; } - + /// isSelectExpensive - Return true if the select operation is expensive for /// this target. bool isSelectExpensive() const { return SelectIsExpensive; } @@ -543,6 +543,11 @@ public: return false; } + /// getPICJumpTableRelocaBase - Returns relocation base for the given PIC + /// jumptable. + virtual SDOperand getPICJumpTableRelocBase(SDOperand Table, + SelectionDAG &DAG) const; + //===--------------------------------------------------------------------===// // TargetLowering Optimization Methods // -- cgit v1.1