[llvm-commits] CVS: llvm/lib/Target/Alpha/Readme.txt
Changes in directory llvm/lib/Target/Alpha: Readme.txt updated: 1.4 - 1.5 --- Log message: jump table note --- Diffs of the changes: (+150 -0) Readme.txt | 150 + 1 files changed, 150 insertions(+) Index: llvm/lib/Target/Alpha/Readme.txt diff -u llvm/lib/Target/Alpha/Readme.txt:1.4 llvm/lib/Target/Alpha/Readme.txt:1.5 --- llvm/lib/Target/Alpha/Readme.txt:1.4Wed Sep 20 10:05:49 2006 +++ llvm/lib/Target/Alpha/Readme.txtSun Sep 24 08:13:10 2006 @@ -1,3 +1,153 @@ +Fix jump table support. currently it uses 64bit absolute address. +gcc uses gprel32. This way I won't keep fighting Evan as he keeps +breaking 64bit entries in jump tables... + +#include string.h +#include setjmp.h + +int main(int x, char** y) +{ +char* foo; +switch(x) { +case 1: +foo = 1; +break; +case 2: +foo = 2; +break; +case 3: +foo = 3; +break; +case 4: +foo = 4; +break; +case 5: +foo = 5; +break; +case 6: +foo = 6; +break; +case 7: +foo = 7; +break; +case 8: +foo = 8; +break; +}; +print(foo); +return 0; + +} + + +.set noreorder +.set volatile +.set noat +.set nomacro +.section.rodata.str1.1,aMS,@progbits,1 +$LC6: +.ascii 7\0 +$LC7: +.ascii 8\0 +$LC0: +.ascii 1\0 +$LC1: +.ascii 2\0 +$LC2: +.ascii 3\0 +$LC3: +.ascii 4\0 +$LC4: +.ascii 5\0 +$LC5: +.ascii 6\0 +.text +.align 2 +.align 4 +.globl main +.ent main +main: +.frame $30,16,$26,0 +.mask 0x400,-16 +ldah $29,0($27) !gpdisp!1 +lda $29,0($29) !gpdisp!1 +$main..ng: +zapnot $16,15,$16 +lda $30,-16($30) +cmpule $16,8,$1 +stq $26,0($30) +.prologue 1 +beq $1,$L2 +ldah $6,$L11($29) !gprelhigh +lda $5,$L11($6) !gprellow +s4addq $16,$5,$0 +ldl $2,0($0) +addq $29,$2,$3 +jmp $31,($3),$L2 +.section.rodata +.align 2 +.align 2 +$L11: +.gprel32 $L2 +.gprel32 $L3 +.gprel32 $L4 +.gprel32 $L5 +.gprel32 $L6 +.gprel32 $L7 +.gprel32 $L8 +.gprel32 $L9 +.gprel32 $L10 +.text +$L9: +ldah $20,$LC6($29) !gprelhigh +lda $4,$LC6($20)!gprellow +.align 4 +$L2: +mov $4,$16 +ldq $27,print($29) !literal!2 +jsr $26,($27),print !lituse_jsr!2 +ldah $29,0($26) !gpdisp!3 +mov $31,$0 +bis $31,$31,$31 +lda $29,0($29) !gpdisp!3 +ldq $26,0($30) +lda $30,16($30) +ret $31,($26),1 +$L10: +ldah $21,$LC7($29) !gprelhigh +lda $4,$LC7($21)!gprellow +br $31,$L2 +$L3: +ldah $7,$LC0($29) !gprelhigh +lda $4,$LC0($7) !gprellow +br $31,$L2 +$L4: +ldah $8,$LC1($29) !gprelhigh +lda $4,$LC1($8) !gprellow +br $31,$L2 +$L5: +ldah $16,$LC2($29) !gprelhigh +lda $4,$LC2($16)!gprellow +br $31,$L2 +$L6: +ldah $17,$LC3($29) !gprelhigh +lda $4,$LC3($17)!gprellow +br $31,$L2 +$L7: +ldah $18,$LC4($29) !gprelhigh +lda $4,$LC4($18)!gprellow +br $31,$L2 +$L8: +ldah $19,$LC5($29) !gprelhigh +lda $4,$LC5($19)!gprellow +br $31,$L2 +.end main +.section.note.GNU-stack,,@progbits +.ident GCC: (GNU) 3.4.4 20050314 (prerelease) (Debian 3.4.3-13) + + + + %% Fix Ordered/Unordered FP stuff ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/jmp_table.ll
Changes in directory llvm/test/Regression/CodeGen/Alpha: jmp_table.ll added (r1.1) --- Log message: basic jump table test --- Diffs of the changes: (+98 -0) jmp_table.ll | 98 +++ 1 files changed, 98 insertions(+) Index: llvm/test/Regression/CodeGen/Alpha/jmp_table.ll diff -c /dev/null llvm/test/Regression/CodeGen/Alpha/jmp_table.ll:1.1 *** /dev/null Sun Sep 24 14:42:12 2006 --- llvm/test/Regression/CodeGen/Alpha/jmp_table.ll Sun Sep 24 14:42:02 2006 *** *** 0 --- 1,98 + ; try to check that we have the most important instructions, which shouldn't appear otherwise + ; RUN: llvm-as %s | llc -march=alpha | grep 'jmp' + ; RUN: llvm-as %s | llc -march=alpha | grep 'gprel32' + ; RUN: llvm-as %s | llc -march=alpha | grep 'ldl' + + target endian = little + target pointersize = 64 + target triple = alphaev67-unknown-linux-gnu + %str = internal constant [2 x sbyte] c1\00 ; [2 x sbyte]* [#uses=1] + %str1 = internal constant [2 x sbyte] c2\00 ; [2 x sbyte]* [#uses=1] + %str2 = internal constant [2 x sbyte] c3\00 ; [2 x sbyte]* [#uses=1] + %str3 = internal constant [2 x sbyte] c4\00 ; [2 x sbyte]* [#uses=1] + %str4 = internal constant [2 x sbyte] c5\00 ; [2 x sbyte]* [#uses=1] + %str5 = internal constant [2 x sbyte] c6\00 ; [2 x sbyte]* [#uses=1] + %str6 = internal constant [2 x sbyte] c7\00 ; [2 x sbyte]* [#uses=1] + %str7 = internal constant [2 x sbyte] c8\00 ; [2 x sbyte]* [#uses=1] + + implementation ; Functions: + + int %main(int %x, sbyte** %y) { + entry: + %x_addr = alloca int; int* [#uses=2] + %y_addr = alloca sbyte**; sbyte*** [#uses=1] + %retval = alloca int, align 4 ; int* [#uses=2] + %tmp = alloca int, align 4 ; int* [#uses=2] + %foo = alloca sbyte*, align 8 ; sbyte** [#uses=9] + alloca point = cast int 0 to int ; int [#uses=0] + store int %x, int* %x_addr + store sbyte** %y, sbyte*** %y_addr + %tmp = load int* %x_addr; int [#uses=1] + switch int %tmp, label %bb15 [ +int 1, label %bb +int 2, label %bb1 +int 3, label %bb3 +int 4, label %bb5 +int 5, label %bb7 +int 6, label %bb9 +int 7, label %bb11 +int 8, label %bb13 + ] + + bb: ; preds = %entry + %tmp = getelementptr [2 x sbyte]* %str, int 0, ulong 0 ; sbyte* [#uses=1] + store sbyte* %tmp, sbyte** %foo + br label %bb16 + + bb1: ; preds = %entry + %tmp2 = getelementptr [2 x sbyte]* %str1, int 0, ulong 0 ; sbyte* [#uses=1] + store sbyte* %tmp2, sbyte** %foo + br label %bb16 + + bb3: ; preds = %entry + %tmp4 = getelementptr [2 x sbyte]* %str2, int 0, ulong 0 ; sbyte* [#uses=1] + store sbyte* %tmp4, sbyte** %foo + br label %bb16 + + bb5: ; preds = %entry + %tmp6 = getelementptr [2 x sbyte]* %str3, int 0, ulong 0 ; sbyte* [#uses=1] + store sbyte* %tmp6, sbyte** %foo + br label %bb16 + + bb7: ; preds = %entry + %tmp8 = getelementptr [2 x sbyte]* %str4, int 0, ulong 0 ; sbyte* [#uses=1] + store sbyte* %tmp8, sbyte** %foo + br label %bb16 + + bb9: ; preds = %entry + %tmp10 = getelementptr [2 x sbyte]* %str5, int 0, ulong 0 ; sbyte* [#uses=1] + store sbyte* %tmp10, sbyte** %foo + br label %bb16 + + bb11: ; preds = %entry + %tmp12 = getelementptr [2 x sbyte]* %str6, int 0, ulong 0 ; sbyte* [#uses=1] + store sbyte* %tmp12, sbyte** %foo + br label %bb16 + + bb13: ; preds = %entry + %tmp14 = getelementptr [2 x sbyte]* %str7, int 0, ulong 0 ; sbyte* [#uses=1] + store sbyte* %tmp14, sbyte** %foo + br label %bb16 + + bb15: ; preds = %entry + br label %bb16 + + bb16: ; preds = %bb15, %bb13, %bb11, %bb9, %bb7, %bb5, %bb3, %bb1, %bb + %tmp17 = load sbyte** %foo ; sbyte* [#uses=1] + %tmp18 = call int (...)* %print( sbyte* %tmp17 ); int [#uses=0] + store int 0, int* %tmp + %tmp19 = load int* %tmp ; int [#uses=1] + store int %tmp19, int* %retval + br label %return + + return: ; preds = %bb16 + %retval = load int* %retval ; int [#uses=1] + ret int %retval + } + + declare int %print(...) ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h
Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.2 - 1.3 --- Log message: Add support for other relocation bases to jump tables, as well as custom asm directives --- Diffs of the changes: (+4 -0) TargetAsmInfo.h |4 1 files changed, 4 insertions(+) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.2 llvm/include/llvm/Target/TargetAsmInfo.h:1.3 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.2Thu Sep 7 17:06:40 2006 +++ llvm/include/llvm/Target/TargetAsmInfo.hSun Sep 24 14:43:29 2006 @@ -108,6 +108,7 @@ const char *Data16bitsDirective; // Defaults to \t.short\t const char *Data32bitsDirective; // Defaults to \t.long\t const char *Data64bitsDirective; // Defaults to \t.quad\t +const char *JumpTableDirective; // if used, the jump table reloc flag //===--- Alignment Information ===// @@ -323,6 +324,9 @@ const char *getData64bitsDirective() const { return Data64bitsDirective; } +const char *getJumpTableDirective() const { + return JumpTableDirective; +} const char *getAlignDirective() const { return AlignDirective; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.147 - 1.148 --- Log message: Add support for other relocation bases to jump tables, as well as custom asm directives --- Diffs of the changes: (+3 -0) SelectionDAGNodes.h |3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.147 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.148 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.147 Thu Sep 14 02:30:48 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Sun Sep 24 14:43:29 2006 @@ -82,6 +82,9 @@ Constant, ConstantFP, GlobalAddress, FrameIndex, JumpTable, ConstantPool, ExternalSymbol, +// The relocation value to add to the value loaded from a jump table +JumpTableRelocBase, + // TargetConstant* - Like Constant*, but the DAG does not do any folding or // simplification of the constant. TargetConstant, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp
Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.97 - 1.98 --- Log message: Add support for other relocation bases to jump tables, as well as custom asm directives --- Diffs of the changes: (+8 -3) AsmPrinter.cpp | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.97 llvm/lib/CodeGen/AsmPrinter.cpp:1.98 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.97Mon Sep 18 13:00:18 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Sun Sep 24 14:44:59 2006 @@ -187,7 +187,10 @@ // JTEntryDirective is a string to print sizeof(ptr) for non-PIC jump tables, // and 32 bits for PIC since PIC jump table entries are differences, not // pointers to blocks. - const char *JTEntryDirective = TAI-getData32bitsDirective(); + // Use the architecture specific relocation directive, if it is set + const char *JTEntryDirective = TAI-getJumpTableDirective(); + if (!JTEntryDirective) +JTEntryDirective = TAI-getData32bitsDirective(); // Pick the directive to use to print the jump table entries, and switch to // the appropriate section. @@ -227,8 +230,10 @@ '_' i _set_ JTBBs[ii]-getNumber(); } else if (TM.getRelocationModel() == Reloc::PIC_) { printBasicBlockLabel(JTBBs[ii], false, false); -O '-' TAI-getPrivateGlobalPrefix() JTI - getFunctionNumber() '_' i; + //If the arch uses custom Jump Table directives, don't calc relative to JT + if (!TAI-getJumpTableDirective()) + O '-' TAI-getPrivateGlobalPrefix() JTI +getFunctionNumber() '_' i; } else { printBasicBlockLabel(JTBBs[ii], false, false); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAGISel.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.399 - 1.400 SelectionDAGISel.cpp updated: 1.278 - 1.279 --- Log message: Add support for other relocation bases to jump tables, as well as custom asm directives --- Diffs of the changes: (+13 -1) LegalizeDAG.cpp | 11 +++ SelectionDAGISel.cpp |3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.399 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.400 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.399 Tue Sep 19 22:38:48 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Sep 24 14:44:59 2006 @@ -558,6 +558,17 @@ #endif assert(0 Do not know how to legalize this operator!); abort(); + case ISD::JumpTableRelocBase: +switch (TLI.getOperationAction(Node-getOpcode(), Node-getValueType(0))) { +case TargetLowering::Custom: + Tmp1 = TLI.LowerOperation(Op, DAG); + if (Tmp1.Val) Result = Tmp1; + break; +default: + Result = LegalizeOp(Node-getOperand(0)); + break; +} +break; case ISD::GlobalAddress: case ISD::ExternalSymbol: case ISD::ConstantPool: Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.278 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.279 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.278Sun Sep 24 00:22:38 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sun Sep 24 14:44:59 2006 @@ -868,8 +868,9 @@ SDOperand LD = DAG.getLoad(isPIC ? MVT::i32 : PTy, Copy.getValue(1), ADD, DAG.getSrcValue(0)); if (isPIC) { +SDOperand Reloc = DAG.getNode(ISD::JumpTableRelocBase, PTy, TAB); ADD = DAG.getNode(ISD::ADD, PTy, -((PTy != MVT::i32) ? DAG.getNode(ISD::SIGN_EXTEND, PTy, LD) : LD), TAB); +((PTy != MVT::i32) ? DAG.getNode(ISD::SIGN_EXTEND, PTy, LD) : LD), Reloc); DAG.setRoot(DAG.getNode(ISD::BRIND, MVT::Other, LD.getValue(1), ADD)); } else { DAG.setRoot(DAG.getNode(ISD::BRIND, MVT::Other, LD.getValue(1), LD)); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelLowering.cpp AlphaTargetAsmInfo.cpp AlphaTargetMachine.cpp
Changes in directory llvm/lib/Target/Alpha: AlphaISelLowering.cpp updated: 1.61 - 1.62 AlphaTargetAsmInfo.cpp updated: 1.1 - 1.2 AlphaTargetMachine.cpp updated: 1.32 - 1.33 --- Log message: Fix jump tables to match gcc (and the ABI and whatnot) --- Diffs of the changes: (+7 -0) AlphaISelLowering.cpp |4 AlphaTargetAsmInfo.cpp |2 ++ AlphaTargetMachine.cpp |1 + 3 files changed, 7 insertions(+) Index: llvm/lib/Target/Alpha/AlphaISelLowering.cpp diff -u llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.61 llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.62 --- llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.61Mon Sep 18 13:01:03 2006 +++ llvm/lib/Target/Alpha/AlphaISelLowering.cpp Sun Sep 24 14:46:56 2006 @@ -129,6 +129,8 @@ setOperationAction(ISD::RET, MVT::Other, Custom); setOperationAction(ISD::JumpTable, MVT::i64, Custom); + setOperationAction(ISD::JumpTable, MVT::i32, Custom); + setOperationAction(ISD::JumpTableRelocBase, MVT::i64, Custom); setStackPointerRegisterToSaveRestore(Alpha::R30); @@ -412,6 +414,8 @@ GP, RA); case ISD::RET: return LowerRET(Op,DAG, getVRegRA()); case ISD::JumpTable: return LowerJumpTable(Op, DAG); + case ISD::JumpTableRelocBase: +return DAG.getNode(AlphaISD::GlobalBaseReg, MVT::i64); case ISD::SINT_TO_FP: { assert(MVT::i64 == Op.getOperand(0).getValueType() Index: llvm/lib/Target/Alpha/AlphaTargetAsmInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaTargetAsmInfo.cpp:1.1 llvm/lib/Target/Alpha/AlphaTargetAsmInfo.cpp:1.2 --- llvm/lib/Target/Alpha/AlphaTargetAsmInfo.cpp:1.1Thu Sep 7 17:05:02 2006 +++ llvm/lib/Target/Alpha/AlphaTargetAsmInfo.cppSun Sep 24 14:46:56 2006 @@ -18,4 +18,6 @@ AlphaTargetAsmInfo::AlphaTargetAsmInfo(const AlphaTargetMachine TM) { AlignmentIsInBytes = false; PrivateGlobalPrefix = $; + JumpTableDirective = .gprel32; + JumpTableTextSection = \t.section .rodata\n; } Index: llvm/lib/Target/Alpha/AlphaTargetMachine.cpp diff -u llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.32 llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.33 --- llvm/lib/Target/Alpha/AlphaTargetMachine.cpp:1.32 Mon Sep 18 14:44:29 2006 +++ llvm/lib/Target/Alpha/AlphaTargetMachine.cppSun Sep 24 14:46:56 2006 @@ -59,6 +59,7 @@ FrameInfo(TargetFrameInfo::StackGrowsDown, 16, 0), JITInfo(*this), Subtarget(M, FS) { + setRelocationModel(Reloc::PIC_); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp
Changes in directory llvm-poolalloc/runtime/FL2Allocator: PoolAllocator.cpp updated: 1.54 - 1.55 --- Log message: Add a trace statement --- Diffs of the changes: (+1 -0) PoolAllocator.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp diff -u llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.54 llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.55 --- llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.54 Thu Jun 29 16:47:25 2006 +++ llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp Sun Sep 24 14:49:54 2006 @@ -666,6 +666,7 @@ // If we are not allowed to grow this pool, don't. if (!PoolTraits::CanGrowPool) { + DO_IF_TRACE(fprintf(stderr, Pool Overflow, not growable\n)); abort(); return 0; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits