From duraid at octopus.com.au Mon Dec 26 02:35:19 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Mon, 26 Dec 2005 02:35:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp Message-ID: <200512260835.CAA24839@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Dominators.cpp updated: 1.64 -> 1.65 --- Log message: more HP-UX cleanliness --- Diffs of the changes: (+1 -0) Dominators.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/VMCore/Dominators.cpp diff -u llvm/lib/VMCore/Dominators.cpp:1.64 llvm/lib/VMCore/Dominators.cpp:1.65 --- llvm/lib/VMCore/Dominators.cpp:1.64 Fri Nov 18 01:27:53 2005 +++ llvm/lib/VMCore/Dominators.cpp Mon Dec 26 02:35:06 2005 @@ -20,6 +20,7 @@ #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SetOperations.h" #include +#include using namespace llvm; //===----------------------------------------------------------------------===// From duraid at octopus.com.au Mon Dec 26 02:37:04 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Mon, 26 Dec 2005 02:37:04 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Type.h Message-ID: <200512260837.CAA24854@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Type.h updated: 1.81 -> 1.82 --- Log message: i love xmas!!!! *;D* --- Diffs of the changes: (+1 -0) Type.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.81 llvm/include/llvm/Type.h:1.82 --- llvm/include/llvm/Type.h:1.81 Sat Nov 12 21:26:12 2005 +++ llvm/include/llvm/Type.h Mon Dec 26 02:36:53 2005 @@ -38,6 +38,7 @@ #include "llvm/Support/Casting.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator" +#include #include namespace llvm { From evan.cheng at apple.com Mon Dec 26 03:12:00 2005 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 26 Dec 2005 03:12:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaInstrInfo.td Message-ID: <200512260912.DAA14887@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaInstrInfo.td updated: 1.90 -> 1.91 --- Log message: Added field noResults to Instruction. Currently tblgen cannot tell which operands in the operand list are results so it assumes the first one is a result. This is bad. Ideally we would fix this by separating results from inputs, e.g. (res R32:$dst), (ops R32:$src1, R32:$src2). But that's a more distruptive change. Adding 'let noResults = 1' is the workaround to tell tblgen that the instruction does not produces a result. It works for now since tblgen does not support instructions which produce multiple results. --- Diffs of the changes: (+5 -5) AlphaInstrInfo.td | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.90 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.91 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.90 Sun Dec 25 11:36:48 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Mon Dec 26 03:11:44 2005 @@ -404,14 +404,14 @@ def : Pat<(setune GPRC:$X, immUExt8:$Y), (CMPEQi (CMPEQ GPRC:$X, immUExt8:$Y), 0)>; -let isReturn = 1, isTerminator = 1 in +let isReturn = 1, isTerminator = 1, noResults = 1 in def RET : MbrForm< 0x1A, 0x02, (ops GPRC:$RD, GPRC:$RS, s64imm:$DISP), "ret $RD,($RS),$DISP">; //Return from subroutine //DAG Version: -let isReturn = 1, isTerminator = 1, Ra = 31, Rb = 26, disp = 1, Uses = [R26] in +let isReturn = 1, isTerminator = 1, noResults = 1, Ra = 31, Rb = 26, disp = 1, Uses = [R26] in def RETDAG : MbrForm< 0x1A, 0x02, (ops), "ret $$31,($$26),1">; //Return from subroutine def JMP : MbrForm< 0x1A, 0x00, (ops GPRC:$RD, GPRC:$RS, GPRC:$DISP), "jmp $RD,($RS),$DISP">; //Jump -let isCall = 1, Ra = 26, +let isCall = 1, noResults = 1, Ra = 26, Defs = [R0, R1, R2, R3, R4, R5, R6, R7, R8, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, F0, F1, @@ -419,7 +419,7 @@ F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30], Uses = [R29] in { def BSR : BFormD<0x34, "bsr $$26,$$$DISP..ng", []>; //Branch to subroutine } -let isCall = 1, +let isCall = 1, noResults = 1, Defs = [R0, R1, R2, R3, R4, R5, R6, R7, R8, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, F0, F1, @@ -428,7 +428,7 @@ def JSR : MbrForm< 0x1A, 0x01, (ops ), "jsr $$26,($$27),0">; //Jump to subroutine } -let isCall = 1, Defs = [R23, R24, R25, R27, R28], Uses = [R24, R25, R27] in +let isCall = 1, noResults = 1, Defs = [R23, R24, R25, R27, R28], Uses = [R24, R25, R27] in def JSRs : MbrForm< 0x1A, 0x01, (ops ), "jsr $$23,($$27),0">; //Jump to div or rem From evan.cheng at apple.com Mon Dec 26 03:12:01 2005 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 26 Dec 2005 03:12:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64InstrInfo.td Message-ID: <200512260912.DAA14891@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/IA64: IA64InstrInfo.td updated: 1.34 -> 1.35 --- Log message: Added field noResults to Instruction. Currently tblgen cannot tell which operands in the operand list are results so it assumes the first one is a result. This is bad. Ideally we would fix this by separating results from inputs, e.g. (res R32:$dst), (ops R32:$src1, R32:$src2). But that's a more distruptive change. Adding 'let noResults = 1' is the workaround to tell tblgen that the instruction does not produces a result. It works for now since tblgen does not support instructions which produce multiple results. --- Diffs of the changes: (+4 -4) IA64InstrInfo.td | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/Target/IA64/IA64InstrInfo.td diff -u llvm/lib/Target/IA64/IA64InstrInfo.td:1.34 llvm/lib/Target/IA64/IA64InstrInfo.td:1.35 --- llvm/lib/Target/IA64/IA64InstrInfo.td:1.34 Sun Dec 25 08:07:01 2005 +++ llvm/lib/Target/IA64/IA64InstrInfo.td Mon Dec 26 03:11:45 2005 @@ -520,7 +520,7 @@ def SUBIMM8 : AForm<0x03, 0x0b, (ops GR:$dst, s8imm:$imm, GR:$src2), "sub $dst = $imm, $src2;;">; -let isStore = 1 in { +let isStore = 1, noResults = 1 in { def ST1 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value), "st1 [$dstPtr] = $value;;">; def ST2 : AForm<0x03, 0x0b, (ops GR:$dstPtr, GR:$value), @@ -643,7 +643,7 @@ (GETFSIG (FCVTFXUTRUNC FP:$src))>; -let isTerminator = 1, isBranch = 1 in { +let isTerminator = 1, isBranch = 1, noResults = 1 in { def BRL_NOTCALL : RawForm<0x03, 0xb0, (ops i64imm:$dst), "(p0) brl.cond.sptk $dst;;">; def BRLCOND_NOTCALL : RawForm<0x03, 0xb0, (ops PR:$qp, i64imm:$dst), @@ -652,7 +652,7 @@ "($qp) br.cond.sptk $dst;;">; } -let isCall = 1, /* isTerminator = 1, isBranch = 1, */ +let isCall = 1, noResults = 1, /* isTerminator = 1, isBranch = 1, */ Uses = [out0,out1,out2,out3,out4,out5,out6,out7], // all calls clobber non-callee-saved registers, and for now, they are these: Defs = [r2,r3,r8,r9,r10,r11,r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,r24, @@ -688,7 +688,7 @@ "($qp) br.cond.call.sptk $dst;;">; } -let isTerminator = 1, isReturn = 1 in +let isTerminator = 1, isReturn = 1, noResults = 1 in def RET : RawForm<0x03, 0xb0, (ops), "br.ret.sptk.many rp;;">; // return From evan.cheng at apple.com Mon Dec 26 03:12:01 2005 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 26 Dec 2005 03:12:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Target.td Message-ID: <200512260912.DAA14903@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: Target.td updated: 1.66 -> 1.67 --- Log message: Added field noResults to Instruction. Currently tblgen cannot tell which operands in the operand list are results so it assumes the first one is a result. This is bad. Ideally we would fix this by separating results from inputs, e.g. (res R32:$dst), (ops R32:$src1, R32:$src2). But that's a more distruptive change. Adding 'let noResults = 1' is the workaround to tell tblgen that the instruction does not produces a result. It works for now since tblgen does not support instructions which produce multiple results. --- Diffs of the changes: (+1 -0) Target.td | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/Target.td diff -u llvm/lib/Target/Target.td:1.66 llvm/lib/Target/Target.td:1.67 --- llvm/lib/Target/Target.td:1.66 Fri Dec 23 16:14:32 2005 +++ llvm/lib/Target/Target.td Mon Dec 26 03:11:44 2005 @@ -171,6 +171,7 @@ bit hasCtrlDep = 0; // Does this instruction r/w ctrl-flow chains? bit hasInFlag = 0; // Does this instruction read a flag operand? bit hasOutFlag = 0; // Does this instruction write a flag operand? + bit noResults = 0; // Does this instruction produce no results? InstrItinClass Itinerary; // Execution steps used for scheduling. } From evan.cheng at apple.com Mon Dec 26 03:12:01 2005 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 26 Dec 2005 03:12:01 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/CodeGenInstruction.h CodeGenTarget.cpp DAGISelEmitter.cpp Message-ID: <200512260912.DAA14899@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: CodeGenInstruction.h updated: 1.17 -> 1.18 CodeGenTarget.cpp updated: 1.51 -> 1.52 DAGISelEmitter.cpp updated: 1.116 -> 1.117 --- Log message: Added field noResults to Instruction. Currently tblgen cannot tell which operands in the operand list are results so it assumes the first one is a result. This is bad. Ideally we would fix this by separating results from inputs, e.g. (res R32:$dst), (ops R32:$src1, R32:$src2). But that's a more distruptive change. Adding 'let noResults = 1' is the workaround to tell tblgen that the instruction does not produces a result. It works for now since tblgen does not support instructions which produce multiple results. --- Diffs of the changes: (+3 -4) CodeGenInstruction.h | 1 + CodeGenTarget.cpp | 1 + DAGISelEmitter.cpp | 5 +---- 3 files changed, 3 insertions(+), 4 deletions(-) Index: llvm/utils/TableGen/CodeGenInstruction.h diff -u llvm/utils/TableGen/CodeGenInstruction.h:1.17 llvm/utils/TableGen/CodeGenInstruction.h:1.18 --- llvm/utils/TableGen/CodeGenInstruction.h:1.17 Fri Dec 23 16:11:47 2005 +++ llvm/utils/TableGen/CodeGenInstruction.h Mon Dec 26 03:11:45 2005 @@ -87,6 +87,7 @@ bool hasCtrlDep; bool hasInFlag; bool hasOutFlag; + bool noResults; CodeGenInstruction(Record *R, const std::string &AsmStr); Index: llvm/utils/TableGen/CodeGenTarget.cpp diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.51 llvm/utils/TableGen/CodeGenTarget.cpp:1.52 --- llvm/utils/TableGen/CodeGenTarget.cpp:1.51 Fri Dec 23 16:11:47 2005 +++ llvm/utils/TableGen/CodeGenTarget.cpp Mon Dec 26 03:11:45 2005 @@ -273,6 +273,7 @@ hasCtrlDep = R->getValueAsBit("hasCtrlDep"); hasInFlag = R->getValueAsBit("hasInFlag"); hasOutFlag = R->getValueAsBit("hasOutFlag"); + noResults = R->getValueAsBit("noResults"); hasVariableNumberOfOperands = false; DagInit *DI; Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.116 llvm/utils/TableGen/DAGISelEmitter.cpp:1.117 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.116 Sat Dec 24 17:36:59 2005 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Mon Dec 26 03:11:45 2005 @@ -1097,11 +1097,8 @@ CodeGenInstruction &InstInfo =Target.getInstruction(Instrs[i]->getName()); if (InstInfo.OperandList.size() != 0) { - // It's possible for some instruction, e.g. RET for X86 that only has an - // implicit flag operand. // FIXME: temporary hack... - if (InstInfo.isReturn || InstInfo.isBranch || InstInfo.isCall || - InstInfo.isStore) { + if (InstInfo.noResults) { // These produce no results for (unsigned j = 0, e = InstInfo.OperandList.size(); j < e; ++j) Operands.push_back(InstInfo.OperandList[j].Rec); From evan.cheng at apple.com Mon Dec 26 03:12:01 2005 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 26 Dec 2005 03:12:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/SparcV8/SparcV8InstrInfo.td Message-ID: <200512260912.DAA14907@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/SparcV8: SparcV8InstrInfo.td updated: 1.96 -> 1.97 --- Log message: Added field noResults to Instruction. Currently tblgen cannot tell which operands in the operand list are results so it assumes the first one is a result. This is bad. Ideally we would fix this by separating results from inputs, e.g. (res R32:$dst), (ops R32:$src1, R32:$src2). But that's a more distruptive change. Adding 'let noResults = 1' is the workaround to tell tblgen that the instruction does not produces a result. It works for now since tblgen does not support instructions which produce multiple results. --- Diffs of the changes: (+4 -2) SparcV8InstrInfo.td | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Target/SparcV8/SparcV8InstrInfo.td diff -u llvm/lib/Target/SparcV8/SparcV8InstrInfo.td:1.96 llvm/lib/Target/SparcV8/SparcV8InstrInfo.td:1.97 --- llvm/lib/Target/SparcV8/SparcV8InstrInfo.td:1.96 Fri Dec 23 16:14:32 2005 +++ llvm/lib/Target/SparcV8/SparcV8InstrInfo.td Mon Dec 26 03:11:45 2005 @@ -171,7 +171,7 @@ // Section A.3 - Synthetic Instructions, p. 85 // special cases of JMPL: -let isReturn = 1, isTerminator = 1, hasDelaySlot = 1 in { +let isReturn = 1, isTerminator = 1, hasDelaySlot = 1, noResults = 1 in { let rd = O7.Num, rs1 = G0.Num, simm13 = 8 in // FIXME: temporary workaround for return without an incoming flag. def RETVOID: F3_2<2, 0b111000, (ops), "retl", [(ret)]>; @@ -466,6 +466,7 @@ let isBranch = 1; let isTerminator = 1; let hasDelaySlot = 1; + let noResults = 1; } let isBarrier = 1 in @@ -511,6 +512,7 @@ let isBranch = 1; let isTerminator = 1; let hasDelaySlot = 1; + let noResults = 1; } def FBU : FPBranchV8<0b0111, (ops brtarget:$dst), @@ -561,7 +563,7 @@ // Section B.24 - Call and Link Instruction, p. 125 // This is the only Format 1 instruction let Uses = [O0, O1, O2, O3, O4, O5], - hasDelaySlot = 1, isCall = 1, hasInFlag = 1, hasOutFlag = 1, + hasDelaySlot = 1, isCall = 1, hasInFlag = 1, hasOutFlag = 1, noResults = 1, Defs = [O0, O1, O2, O3, O4, O5, O7, G1, G2, G3, G4, G5, G6, G7, D0, D1, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11, D12, D13, D14, D15] in { def CALL : InstV8<(ops calltarget:$dst), From evan.cheng at apple.com Mon Dec 26 03:12:02 2005 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 26 Dec 2005 03:12:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrInfo.td Message-ID: <200512260912.DAA14909@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstrInfo.td updated: 1.165 -> 1.166 --- Log message: Added field noResults to Instruction. Currently tblgen cannot tell which operands in the operand list are results so it assumes the first one is a result. This is bad. Ideally we would fix this by separating results from inputs, e.g. (res R32:$dst), (ops R32:$src1, R32:$src2). But that's a more distruptive change. Adding 'let noResults = 1' is the workaround to tell tblgen that the instruction does not produces a result. It works for now since tblgen does not support instructions which produce multiple results. --- Diffs of the changes: (+10 -9) PPCInstrInfo.td | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.165 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.166 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.165 Fri Dec 23 16:14:32 2005 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Mon Dec 26 03:11:45 2005 @@ -224,17 +224,18 @@ let isTerminator = 1 in { // FIXME: temporary workaround for return without an incoming flag. - let isReturn = 1 in + let isReturn = 1, noResults = 1 in def BLRVOID : XLForm_2_ext<19, 16, 20, 0, 0, (ops), "blr", BrB, [(ret)]>; - let isReturn = 1, hasInFlag = 1 in + let isReturn = 1, noResults = 1, hasInFlag = 1 in def BLR : XLForm_2_ext<19, 16, 20, 0, 0, (ops), "blr", BrB, []>; + let noResults = 1 in def BCTR : XLForm_2_ext<19, 528, 20, 0, 0, (ops), "bctr", BrB, []>; } let Defs = [LR] in def MovePCtoLR : Pseudo<(ops piclabel:$label), "bl $label", []>; -let isBranch = 1, isTerminator = 1, hasCtrlDep = 1 in { +let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, noResults = 1 in { def COND_BRANCH : Pseudo<(ops CRRC:$crS, u16imm:$opc, target:$true, target:$false), "; COND_BRANCH", []>; @@ -262,7 +263,7 @@ "bnu $crS, $block", BrB>; } -let isCall = 1, +let isCall = 1, noResults = 1, // All calls clobber the non-callee saved registers... Defs = [R0,R2,R3,R4,R5,R6,R7,R8,R9,R10,R11,R12, F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13, @@ -328,7 +329,7 @@ def LIS : DForm_2_r0<15, (ops GPRC:$rD, symbolHi:$imm), "lis $rD, $imm", IntGeneral, [(set GPRC:$rD, imm16Shifted:$imm)]>; -let isStore = 1 in { +let isStore = 1, noResults = 1 in { def STMW : DForm_3<47, (ops GPRC:$rS, s16imm:$disp, GPRC:$rA), "stmw $rS, $disp($rA)", LdStLMW, []>; @@ -385,7 +386,7 @@ "lfd $rD, $src", LdStLFD, [(set F8RC:$rD, (load iaddr:$src))]>; } -let isStore = 1 in { +let isStore = 1, noResults = 1 in { def STFS : DForm_9<52, (ops F4RC:$rS, memri:$dst), "stfs $rS, $dst", LdStUX, [(store F4RC:$rS, iaddr:$dst)]>; @@ -404,7 +405,7 @@ "ld $rT, $DS($rA)", LdStLD, []>, isPPC64; } -let isStore = 1 in { +let isStore = 1, noResults = 1 in { def STD : DSForm_2<62, 0, (ops GPRC:$rT, s16immX4:$DS, GPRC:$rA), "std $rT, $DS($rA)", LdStSTD, []>, isPPC64; @@ -511,7 +512,7 @@ def SRAW : XForm_6<31, 792, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB), "sraw $rA, $rS, $rB", IntShift, [(set GPRC:$rA, (PPCsra GPRC:$rS, GPRC:$rB))]>; -let isStore = 1 in { +let isStore = 1, noResults = 1 in { def STBX : XForm_8<31, 215, (ops GPRC:$rS, memrr:$dst), "stbx $rS, $dst", LdStGeneral, [(truncstore GPRC:$rS, xaddr:$dst, i8)]>; @@ -636,7 +637,7 @@ [(set F8RC:$frD, (fneg F8RC:$frB))]>; -let isStore = 1 in { +let isStore = 1, noResults = 1 in { def STFIWX: XForm_28<31, 983, (ops F4RC:$frS, memrr:$dst), "stfiwx $frS, $dst", LdStUX, []>; From evan.cheng at apple.com Mon Dec 26 03:12:02 2005 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 26 Dec 2005 03:12:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td Message-ID: <200512260912.DAA14911@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.td updated: 1.185 -> 1.186 --- Log message: Added field noResults to Instruction. Currently tblgen cannot tell which operands in the operand list are results so it assumes the first one is a result. This is bad. Ideally we would fix this by separating results from inputs, e.g. (res R32:$dst), (ops R32:$src1, R32:$src2). But that's a more distruptive change. Adding 'let noResults = 1' is the workaround to tell tblgen that the instruction does not produces a result. It works for now since tblgen does not support instructions which produce multiple results. --- Diffs of the changes: (+17 -21) X86InstrInfo.td | 38 +++++++++++++++++--------------------- 1 files changed, 17 insertions(+), 21 deletions(-) Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.185 llvm/lib/Target/X86/X86InstrInfo.td:1.186 --- llvm/lib/Target/X86/X86InstrInfo.td:1.185 Fri Dec 23 16:14:32 2005 +++ llvm/lib/Target/X86/X86InstrInfo.td Mon Dec 26 03:11:45 2005 @@ -289,12 +289,15 @@ // // Return instructions. -let isTerminator = 1, isReturn = 1, isBarrier = 1, hasCtrlDep = 1 in { +let isTerminator = 1, isReturn = 1, isBarrier = 1, + hasCtrlDep = 1, noResults = 1 in { // FIXME: temporary workaround for return without an incoming flag. def RETVOID : I<0xC3, RawFrm, (ops), "ret", [(ret)]>; let hasInFlag = 1 in { - def RET : I<0xC3, RawFrm, (ops), "ret", []>; - def RETI : Ii16<0xC2, RawFrm, (ops i16imm:$amt), "ret $amt", []>; + def RET : I<0xC3, RawFrm, (ops), "ret", + [(X86retflag 0)]>; + def RETI : Ii16<0xC2, RawFrm, (ops i16imm:$amt), "ret $amt", + [(X86retflag imm:$amt)]>; } } @@ -302,7 +305,7 @@ def : Pat<(X86retflag imm:$amt), (RETI imm:$amt)>; // All branches are RawFrm, Void, Branch, and Terminators -let isBranch = 1, isTerminator = 1 in +let isBranch = 1, isTerminator = 1, noResults = 1 in class IBr opcode, dag ops, string asm, list pattern> : I; @@ -339,7 +342,7 @@ //===----------------------------------------------------------------------===// // Call Instructions... // -let isCall = 1 in +let isCall = 1, noResults = 1 in // All calls clobber the non-callee saved registers... let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP5, FP6, ST0, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7] in { @@ -349,11 +352,11 @@ } // Tail call stuff. -let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in +let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in def TAILJMPd : IBr<0xE9, (ops calltarget:$dst), "jmp $dst # TAIL CALL", []>; -let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in +let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in def TAILJMPr : I<0xFF, MRM4r, (ops R32:$dst), "jmp {*}$dst # TAIL CALL", []>; -let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1 in +let isCall = 1, isTerminator = 1, isReturn = 1, isBarrier = 1, noResults = 1 in def TAILJMPm : I<0xFF, MRM4m, (ops i32mem:$dst), "jmp {*}$dst # TAIL CALL", []>; @@ -2305,20 +2308,13 @@ let Pattern = pattern; } -// FpI - Floating Point Psuedo Instruction template. -// TEMPORARY: for FpGETRESULT and FpSETRESULT only. Since -// they must match regardless of X86Vector. -class FpPseudoI pattern> - : X86Inst<0, Pseudo, NoImm, ops, ""> { - let FPForm = fp; let FPFormBits = FPForm.Value; - let Pattern = pattern; -} - // Random Pseudo Instructions. -def FpGETRESULT : FpPseudoI<(ops RFP:$dst), SpecialFP, []>; // FPR = ST(0) -let hasOutFlag = 1 in - def FpSETRESULT : FpPseudoI<(ops RFP:$src), SpecialFP, - [(X86fpset RFP:$src)]>, Imp<[], [ST0]>; // ST(0) = FPR +def FpGETRESULT : FpI<(ops RFP:$dst), SpecialFP, []>; // FPR = ST(0) +let noResults = 1, hasOutFlag = 1 in + def FpSETRESULT : FpI<(ops RFP:$src), SpecialFP, + []>, Imp<[], [ST0]>; // ST(0) = FPR + +def : Pat<(X86fpset RFP:$src), (FpSETRESULT RFP:$src)>; def FpMOV : FpI<(ops RFP:$dst, RFP:$src), SpecialFP, []>; // f1 = fmov f2 From duraid at octopus.com.au Mon Dec 26 04:24:27 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Mon, 26 Dec 2005 04:24:27 -0600 Subject: [llvm-commits] CVS: llvm/lib/Debugger/Debugger.cpp Message-ID: <200512261024.EAA22561@zion.cs.uiuc.edu> Changes in directory llvm/lib/Debugger: Debugger.cpp updated: 1.4 -> 1.5 --- Log message: dum de dum --- Diffs of the changes: (+1 -0) Debugger.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Debugger/Debugger.cpp diff -u llvm/lib/Debugger/Debugger.cpp:1.4 llvm/lib/Debugger/Debugger.cpp:1.5 --- llvm/lib/Debugger/Debugger.cpp:1.4 Thu Apr 21 17:36:21 2005 +++ llvm/lib/Debugger/Debugger.cpp Mon Dec 26 04:24:15 2005 @@ -17,6 +17,7 @@ #include "llvm/Bytecode/Reader.h" #include "llvm/Debugger/InferiorProcess.h" #include "llvm/ADT/StringExtras.h" +#include using namespace llvm; /// Debugger constructor - Initialize the debugger to its initial, empty, state. From duraid at octopus.com.au Mon Dec 26 04:34:50 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Mon, 26 Dec 2005 04:34:50 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineConstantPool.h Message-ID: <200512261034.EAA26261@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineConstantPool.h updated: 1.6 -> 1.7 --- Log message: I laugh at your dual-core G5s! Fear my precompiled headers. --- Diffs of the changes: (+1 -0) MachineConstantPool.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/CodeGen/MachineConstantPool.h diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.6 llvm/include/llvm/CodeGen/MachineConstantPool.h:1.7 --- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.6 Sun Jul 10 23:49:33 2005 +++ llvm/include/llvm/CodeGen/MachineConstantPool.h Mon Dec 26 04:34:38 2005 @@ -22,6 +22,7 @@ #ifndef LLVM_CODEGEN_MACHINECONSTANTPOOL_H #define LLVM_CODEGEN_MACHINECONSTANTPOOL_H +#include #include namespace llvm { From duraid at octopus.com.au Mon Dec 26 07:34:30 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Mon, 26 Dec 2005 07:34:30 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Linker.h Message-ID: <200512261334.HAA24759@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Linker.h updated: 1.16 -> 1.17 --- Log message: more standards compliance (damn, I can't wait for unordered_set (tee hee) and unordered_map to make it into the standard) Hurry up, JTC1 SC22 WG21 Library Working Group! --- Diffs of the changes: (+1 -0) Linker.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/Linker.h diff -u llvm/include/llvm/Linker.h:1.16 llvm/include/llvm/Linker.h:1.17 --- llvm/include/llvm/Linker.h:1.16 Tue Dec 13 14:00:37 2005 +++ llvm/include/llvm/Linker.h Mon Dec 26 07:34:00 2005 @@ -16,6 +16,7 @@ #include "llvm/System/Path.h" #include +#include namespace llvm { From duraid at octopus.com.au Mon Dec 26 07:48:56 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Mon, 26 Dec 2005 07:48:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LowerPacked.cpp Message-ID: <200512261348.HAA24837@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LowerPacked.cpp updated: 1.5 -> 1.6 --- Log message: getting there... --- Diffs of the changes: (+1 -0) LowerPacked.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Transforms/Scalar/LowerPacked.cpp diff -u llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.5 llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.6 --- llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.5 Thu Apr 21 18:45:12 2005 +++ llvm/lib/Transforms/Scalar/LowerPacked.cpp Mon Dec 26 07:48:44 2005 @@ -24,6 +24,7 @@ #include #include #include +#include using namespace llvm; From duraid at octopus.com.au Mon Dec 26 08:23:33 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Mon, 26 Dec 2005 08:23:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Analyzer.cpp ReaderWrappers.cpp Message-ID: <200512261423.IAA25021@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Analyzer.cpp updated: 1.20 -> 1.21 ReaderWrappers.cpp updated: 1.52 -> 1.53 --- Log message: I bet pinski knows why g++ accepts this stuff --- Diffs of the changes: (+3 -0) Analyzer.cpp | 1 + ReaderWrappers.cpp | 2 ++ 2 files changed, 3 insertions(+) Index: llvm/lib/Bytecode/Reader/Analyzer.cpp diff -u llvm/lib/Bytecode/Reader/Analyzer.cpp:1.20 llvm/lib/Bytecode/Reader/Analyzer.cpp:1.21 --- llvm/lib/Bytecode/Reader/Analyzer.cpp:1.20 Thu May 5 17:32:13 2005 +++ llvm/lib/Bytecode/Reader/Analyzer.cpp Mon Dec 26 08:23:22 2005 @@ -25,6 +25,7 @@ #include "llvm/Assembly/Writer.h" #include #include +#include using namespace llvm; Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.52 llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.53 --- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.52 Sat Oct 22 23:37:20 2005 +++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Mon Dec 26 08:23:22 2005 @@ -21,6 +21,8 @@ #include "llvm/System/MappedFile.h" #include #include +#include + using namespace llvm; //===----------------------------------------------------------------------===// From duraid at octopus.com.au Mon Dec 26 08:31:37 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Mon, 26 Dec 2005 08:31:37 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/ArchiveReader.cpp Message-ID: <200512261431.IAA25061@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: ArchiveReader.cpp updated: 1.42 -> 1.43 --- Log message: more C++ daintiness --- Diffs of the changes: (+1 -0) ArchiveReader.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.42 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.43 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.42 Fri Sep 23 01:22:58 2005 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Mon Dec 26 08:31:26 2005 @@ -13,6 +13,7 @@ #include "ArchiveInternals.h" #include "llvm/Bytecode/Reader.h" +#include using namespace llvm; From alenhar2 at cs.uiuc.edu Mon Dec 26 19:54:45 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 26 Dec 2005 18:54:45 -0700 Subject: [llvm-commits] Re: llvm-commits Digest, Vol 18, Issue 43 In-Reply-To: <200512261800.jBQI0Q91004170@dcs-maillist.cs.uiuc.edu> References: <200512261800.jBQI0Q91004170@dcs-maillist.cs.uiuc.edu> Message-ID: <200512261854.45738.alenhar2@cs.uiuc.edu> > Changes in directory llvm/lib/Target/Alpha: > > AlphaInstrInfo.td updated: 1.90 -> 1.91 > --- > Log message: > > Added field noResults to Instruction. > Currently tblgen cannot tell which operands in the operand list are results > so it assumes the first one is a result. This is bad. Ideally we would fix > this by separating results from inputs, e.g. (res R32:$dst), > (ops R32:$src1, R32:$src2). But that's a more distruptive change. Adding > 'let noResults = 1' is the workaround to tell tblgen that the instruction > does not produces a result. It works for now since tblgen does not support > instructions which produce multiple results. > > > --- > Diffs of the changes: (+5 -5) > > AlphaInstrInfo.td | 10 +++++----- > 1 files changed, 5 insertions(+), 5 deletions(-) > > > Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td > diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.90 > llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.91 --- > llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.90 Sun Dec 25 11:36:48 2005 +++ > llvm/lib/Target/Alpha/AlphaInstrInfo.td Mon Dec 26 03:11:44 2005 @@ -404,14 > +404,14 @@ > def : Pat<(setune GPRC:$X, immUExt8:$Y), (CMPEQi (CMPEQ GPRC:$X, > immUExt8:$Y), 0)>; > > > -let isReturn = 1, isTerminator = 1 in > +let isReturn = 1, isTerminator = 1, noResults = 1 in > def RET : MbrForm< 0x1A, 0x02, (ops GPRC:$RD, GPRC:$RS, s64imm:$DISP), > "ret $RD,($RS),$DISP">; //Return from subroutine //DAG Version: > -let isReturn = 1, isTerminator = 1, Ra = 31, Rb = 26, disp = 1, Uses = > [R26] in +let isReturn = 1, isTerminator = 1, noResults = 1, Ra = 31, Rb = > 26, disp = 1, Uses = [R26] in def RETDAG : MbrForm< 0x1A, 0x02, (ops), "ret > $$31,($$26),1">; //Return from subroutine > > def JMP : MbrForm< 0x1A, 0x00, (ops GPRC:$RD, GPRC:$RS, GPRC:$DISP), "jmp > $RD,($RS),$DISP">; //Jump -let isCall = 1, Ra = 26, > +let isCall = 1, noResults = 1, Ra = 26, > Defs = [R0, R1, R2, R3, R4, R5, R6, R7, R8, R16, R17, R18, R19, > R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, > F0, F1, > @@ -419,7 +419,7 @@ > F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30], Uses = > [R29] in { def BSR : BFormD<0x34, "bsr $$26,$$$DISP..ng", []>; //Branch to > subroutine } > -let isCall = 1, > +let isCall = 1, noResults = 1, > Defs = [R0, R1, R2, R3, R4, R5, R6, R7, R8, R16, R17, R18, R19, > R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, > F0, F1, > @@ -428,7 +428,7 @@ > def JSR : MbrForm< 0x1A, 0x01, (ops ), "jsr $$26,($$27),0">; //Jump to > subroutine } > > -let isCall = 1, Defs = [R23, R24, R25, R27, R28], Uses = [R24, R25, R27] > in +let isCall = 1, noResults = 1, Defs = [R23, R24, R25, R27, R28], Uses = > [R24, R25, R27] in def JSRs : MbrForm< 0x1A, 0x01, (ops ), "jsr > $$23,($$27),0">; //Jump to div or rem things like JSR and BSR and BR and reg do return results, but I guess the only uses can be hidden with the use of flags. What I really need to remove hacks is a way to force a results to be in a certain register that doesn't depend on the register allocator optionally doing the right thing. This is easy in the PatternISel, but not in the DAG. maybe like (ops GPRC:$RD = R27, GPRC:$RS) or let constraints = (constrain GPRC:$RD = 27) in ... not that there are enough hacks around this to be worth it. From sabre at nondot.org Mon Dec 26 20:24:08 2005 From: sabre at nondot.org (Chris Lattner) Date: Mon, 26 Dec 2005 20:24:08 -0600 (CST) Subject: [llvm-commits] Re: llvm-commits Digest, Vol 18, Issue 43 In-Reply-To: <200512261854.45738.alenhar2@cs.uiuc.edu> References: <200512261800.jBQI0Q91004170@dcs-maillist.cs.uiuc.edu> <200512261854.45738.alenhar2@cs.uiuc.edu> Message-ID: On Mon, 26 Dec 2005, Andrew Lenharth wrote: >> -let isCall = 1, Defs = [R23, R24, R25, R27, R28], Uses = [R24, R25, R27] >> in +let isCall = 1, noResults = 1, Defs = [R23, R24, R25, R27, R28], Uses = >> [R24, R25, R27] in def JSRs : MbrForm< 0x1A, 0x01, (ops ), "jsr >> $$23,($$27),0">; //Jump to div or rem > > things like JSR and BSR and BR and reg do return results, but I guess the only > uses can be hidden with the use of flags. What I really need to remove hacks > is a way to force a results to be in a certain register that doesn't depend > on the register allocator optionally doing the right thing. This is easy in > the PatternISel, but not in the DAG. maybe like > (ops GPRC:$RD = R27, GPRC:$RS) > or > let constraints = (constrain GPRC:$RD = 27) in ... > not that there are enough hacks around this to be worth it. I'm not sure I follow. If this is fixed by the architecture (seems unlikely for alpha but...) you should be able to do something like this: (set R27, (fooop GPRC:$in1, GPRC:$in2)) it it is not fixed by the ISA, but fixed by the architecture, you should handle this in the lowering code, and emit copyto/from regs. -Chris -- http://nondot.org/sabre/ http://llvm.org/ From lattner at cs.uiuc.edu Mon Dec 26 21:02:30 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 26 Dec 2005 21:02:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200512270302.VAA04681@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.17 -> 1.18 --- Log message: Fix a problem duraid pointed out to me compiling kc++ with -enable-x86-fastcc --- Diffs of the changes: (+5 -0) X86ISelLowering.cpp | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.17 llvm/lib/Target/X86/X86ISelLowering.cpp:1.18 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.17 Fri Dec 23 01:31:11 2005 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Mon Dec 26 21:02:18 2005 @@ -591,6 +591,9 @@ X86::R8RegisterClass); ArgValue = DAG.getCopyFromReg(DAG.getRoot(), VReg, MVT::i8); DAG.setRoot(ArgValue.getValue(1)); + if (ObjectVT == MVT::i1) + // FIXME: Should insert a assertzext here. + ArgValue = DAG.getNode(ISD::TRUNCATE, MVT::i1, ArgValue); } ++NumIntRegs; break; @@ -780,6 +783,8 @@ switch (getValueType(Args[i].second)) { default: assert(0 && "Unexpected ValueType for argument!"); case MVT::i1: + Args[i].first = DAG.getNode(ISD::ANY_EXTEND, MVT::i8, Args[i].first); + // Fall through. case MVT::i8: case MVT::i16: case MVT::i32: From sabre at nondot.org Mon Dec 26 21:09:15 2005 From: sabre at nondot.org (Chris Lattner) Date: Mon, 26 Dec 2005 21:09:15 -0600 (CST) Subject: [llvm-commits] Re: llvm-commits Digest, Vol 18, Issue 43 In-Reply-To: <200512261950.15868.alenhar2@cs.uiuc.edu> References: <200512261800.jBQI0Q91004170@dcs-maillist.cs.uiuc.edu> <200512261854.45738.alenhar2@cs.uiuc.edu> <200512261950.15868.alenhar2@cs.uiuc.edu> Message-ID: On Mon, 26 Dec 2005, Andrew Lenharth wrote: >> I'm not sure I follow. If this is fixed by the architecture (seems >> unlikely for alpha but...) you should be able to do something like this: >> >> (set R27, (fooop GPRC:$in1, GPRC:$in2)) > > This works? That is about what I need. Yes, assuming foo-op is an operation with one result, this will emit the logical equivalent of: (set GPRC:$tmp, (fooop GPRC:$in1, GPRC:$in2)) (copytoreg R27, $tmp) ... and flag them together. >> it it is not fixed by the ISA, but fixed by the architecture, you should >> handle this in the lowering code, and emit copyto/from regs. > > The problem is that because they are jumps and calls, the results of the > operation must be in certain registers (and is visible in the called code). > The dest reg is not fixed in the instruction, but in the calling conventions. Yeah, I figured... it's not like alpha to hard code that stuff in :) > Thus (Rd = BSR ...) has a calling convention specified reg for Rd, which is > not specified in the architecture. The hack is to fix it in the instruction > used and issue a copyfromreg. I'd suggest handling this in the lower code then. > the closest I can get without that hack is (copyfromreg (copytoreg > (bsr ...))), but that cannot be emitted as > t = bsr > Rd = t > it must be > Rd = bsr > This requirement doesn't seem to be specified because I cannot specify the > output regs for an instruction. In practice, this will always be copy coallesced away. I agree though that this feels hacky and shouldn't be done. > I must encode the calling convention in the instruction descriptions. > If I wanted any other calling convention than linux alpha (which is the > same as Digital UNIX), I would have to have clones of those > instructions. Probably not something worth worrying about because of > the alpha, but I could see it affecting other archs. Yup, for alpha, coming back around to where we started, I guess it currently DOES make sense to encode the return reg into the instruction... -Chris -- http://nondot.org/sabre/ http://llvm.org/ From alenhar2 at cs.uiuc.edu Mon Dec 26 21:54:10 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 26 Dec 2005 21:54:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaInstrInfo.td Message-ID: <200512270354.VAA04864@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaInstrInfo.td updated: 1.91 -> 1.92 --- Log message: Fix alpha regressions. --- Diffs of the changes: (+1 -1) AlphaInstrInfo.td | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.91 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.92 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.91 Mon Dec 26 03:11:44 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Mon Dec 26 21:53:58 2005 @@ -119,7 +119,7 @@ def ADJUSTSTACKDOWN : PseudoInstAlpha<(ops s64imm:$amt), "; ADJDOWN $amt", [(callseq_end imm:$amt)]>; } -def ALTENT : PseudoInstAlpha<(ops s64imm:$TARGET), "$TARGET:\n", []>; +def ALTENT : PseudoInstAlpha<(ops s64imm:$TARGET), "$$$TARGET..ng:\n", []>; def PCLABEL : PseudoInstAlpha<(ops s64imm:$num), "PCMARKER_$num:\n",[]>; def MEMLABEL : PseudoInstAlpha<(ops s64imm:$i, s64imm:$j, s64imm:$k, s64imm:$m), "LSMARKER$$$i$$$j$$$k$$$m:\n",[]>; From alenhar2 at cs.uiuc.edu Tue Dec 27 00:26:02 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 27 Dec 2005 00:26:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaInstrInfo.td Message-ID: <200512270626.AAA20192@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaInstrInfo.td updated: 1.92 -> 1.93 --- Log message: Restore some happiness to the JIT --- Diffs of the changes: (+3 -2) AlphaInstrInfo.td | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.92 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.93 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.92 Mon Dec 26 21:53:58 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Tue Dec 27 00:25:50 2005 @@ -419,7 +419,7 @@ F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30], Uses = [R29] in { def BSR : BFormD<0x34, "bsr $$26,$$$DISP..ng", []>; //Branch to subroutine } -let isCall = 1, noResults = 1, +let isCall = 1, noResults = 1, Ra = 26, Rb = 27, disp = 0, Defs = [R0, R1, R2, R3, R4, R5, R6, R7, R8, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, F0, F1, @@ -428,7 +428,8 @@ def JSR : MbrForm< 0x1A, 0x01, (ops ), "jsr $$26,($$27),0">; //Jump to subroutine } -let isCall = 1, noResults = 1, Defs = [R23, R24, R25, R27, R28], Uses = [R24, R25, R27] in +let isCall = 1, noResults = 1, Ra = 23, Rb = 27, disp = 0, + Defs = [R23, R24, R25, R27, R28], Uses = [R24, R25, R27] in def JSRs : MbrForm< 0x1A, 0x01, (ops ), "jsr $$23,($$27),0">; //Jump to div or rem From duraid at octopus.com.au Tue Dec 27 04:17:23 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 27 Dec 2005 04:17:23 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64ISelLowering.cpp Message-ID: <200512271017.EAA27856@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/IA64: IA64ISelLowering.cpp updated: 1.8 -> 1.9 --- Log message: nasty paste-o, calls passing more than 8 arguments along were having args >8 put into the wrong place --- Diffs of the changes: (+2 -2) IA64ISelLowering.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/IA64/IA64ISelLowering.cpp diff -u llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.8 llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.9 --- llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.8 Thu Dec 22 07:29:14 2005 +++ llvm/lib/Target/IA64/IA64ISelLowering.cpp Tue Dec 27 04:17:03 2005 @@ -347,12 +347,12 @@ PtrOff = DAG.getNode(ISD::ADD, MVT::i64, StackPtr, PtrOff); Stores.push_back(DAG.getNode(ISD::STORE, MVT::Other, Chain, ValToStore, PtrOff, NullSV)); + ArgOffset += ObjSize; } if(ValToConvert.Val) { Converts.push_back(DAG.getNode(IA64ISD::GETFD, MVT::i64, ValToConvert)); } - ArgOffset += ObjSize; } // Emit all stores, make sure they occur before any copies into physregs. @@ -397,7 +397,7 @@ } } - // next copy args into the usual places + // next copy args into the usual places, these are flagged unsigned usedFPArgs = 0; for (unsigned i = 0, e = RegValuesToPass.size(); i != e; ++i) { Chain = DAG.getCopyToReg(Chain, From duraid at octopus.com.au Tue Dec 27 04:40:47 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 27 Dec 2005 04:40:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200512271040.EAA32135@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.249 -> 1.250 --- Log message: yet more C++ standards-compliance stuff. --- Diffs of the changes: (+1 -0) Writer.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.249 llvm/lib/Target/CBackend/Writer.cpp:1.250 --- llvm/lib/Target/CBackend/Writer.cpp:1.249 Thu Nov 10 15:39:29 2005 +++ llvm/lib/Target/CBackend/Writer.cpp Tue Dec 27 04:40:34 2005 @@ -39,6 +39,7 @@ #include "llvm/Config/config.h" #include #include +#include #include using namespace llvm; From duraid at octopus.com.au Tue Dec 27 04:56:34 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 27 Dec 2005 04:56:34 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/RegisterInfoEmitter.cpp Message-ID: <200512271056.EAA04754@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: RegisterInfoEmitter.cpp updated: 1.38 -> 1.39 --- Log message: This gets most of the backends building with HP HappyC++. --- Diffs of the changes: (+2 -1) RegisterInfoEmitter.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/utils/TableGen/RegisterInfoEmitter.cpp diff -u llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.38 llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.39 --- llvm/utils/TableGen/RegisterInfoEmitter.cpp:1.38 Wed Nov 30 22:51:06 2005 +++ llvm/utils/TableGen/RegisterInfoEmitter.cpp Tue Dec 27 04:56:22 2005 @@ -51,7 +51,8 @@ const std::string &TargetName = Target.getName(); std::string ClassName = TargetName + "GenRegisterInfo"; - OS << "#include \"llvm/Target/MRegisterInfo.h\"\n\n"; + OS << "#include \"llvm/Target/MRegisterInfo.h\"\n"; + OS << "#include \n\n"; OS << "namespace llvm {\n\n"; From duraid at octopus.com.au Tue Dec 27 20:44:46 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 27 Dec 2005 20:44:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineCodeEmitter.cpp Message-ID: <200512280244.UAA02143@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineCodeEmitter.cpp updated: 1.24 -> 1.25 --- Log message: mixed-STL programs are big and nasty :( --- Diffs of the changes: (+1 -0) MachineCodeEmitter.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/MachineCodeEmitter.cpp diff -u llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.24 llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.25 --- llvm/lib/CodeGen/MachineCodeEmitter.cpp:1.24 Thu Jul 28 13:13:59 2005 +++ llvm/lib/CodeGen/MachineCodeEmitter.cpp Tue Dec 27 20:44:35 2005 @@ -16,6 +16,7 @@ #include "llvm/Function.h" #include #include +#include using namespace llvm; From duraid at octopus.com.au Tue Dec 27 22:55:54 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 27 Dec 2005 22:55:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegAllocLinearScan.cpp Message-ID: <200512280455.WAA02693@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegAllocLinearScan.cpp updated: 1.116 -> 1.117 --- Log message: HB is *the* code janitor. --- Diffs of the changes: (+1 -0) RegAllocLinearScan.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.116 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.117 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.116 Mon Nov 21 08:09:40 2005 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Tue Dec 27 22:55:42 2005 @@ -30,6 +30,7 @@ #include #include #include +#include using namespace llvm; namespace { From duraid at octopus.com.au Tue Dec 27 23:49:07 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 27 Dec 2005 23:49:07 -0600 Subject: [llvm-commits] CVS: llvm/tools/llc/llc.cpp Message-ID: <200512280549.XAA02845@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: llc.cpp updated: 1.119 -> 1.120 --- Log message: WAKEY WAKEY --- Diffs of the changes: (+1 -1) llc.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.119 llvm/tools/llc/llc.cpp:1.120 --- llvm/tools/llc/llc.cpp:1.119 Thu Dec 15 23:19:55 2005 +++ llvm/tools/llc/llc.cpp Tue Dec 27 23:48:55 2005 @@ -243,7 +243,7 @@ << "' does not support generation of this file type!\n"; if (Out != &std::cout) delete Out; // And the Out file is empty and useless, so remove it now. - std::remove(OutputFilename.c_str()); + remove(OutputFilename.c_str()); return 1; } else { // Run our queue of passes all at once now, efficiently. From duraid at octopus.com.au Tue Dec 27 23:56:49 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 27 Dec 2005 23:56:49 -0600 Subject: [llvm-commits] CVS: llvm/tools/llc/llc.cpp Message-ID: <200512280556.XAA02929@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: llc.cpp updated: 1.120 -> 1.121 --- Log message: behold my standards-compliant humps! --- Diffs of the changes: (+2 -1) llc.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.120 llvm/tools/llc/llc.cpp:1.121 --- llvm/tools/llc/llc.cpp:1.120 Tue Dec 27 23:48:55 2005 +++ llvm/tools/llc/llc.cpp Tue Dec 27 23:56:36 2005 @@ -30,6 +30,7 @@ #include #include #include +#include using namespace llvm; @@ -243,7 +244,7 @@ << "' does not support generation of this file type!\n"; if (Out != &std::cout) delete Out; // And the Out file is empty and useless, so remove it now. - remove(OutputFilename.c_str()); + std::remove(OutputFilename.c_str()); return 1; } else { // Run our queue of passes all at once now, efficiently. From duraid at octopus.com.au Wed Dec 28 00:29:14 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Wed, 28 Dec 2005 00:29:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp ELFWriter.cpp Message-ID: <200512280629.AAA03119@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.33 -> 1.34 ELFWriter.cpp updated: 1.16 -> 1.17 --- Log message: add these so I can be less naughty --- Diffs of the changes: (+2 -0) AsmPrinter.cpp | 1 + ELFWriter.cpp | 1 + 2 files changed, 2 insertions(+) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.33 llvm/lib/CodeGen/AsmPrinter.cpp:1.34 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.33 Tue Dec 20 19:17:37 2005 +++ llvm/lib/CodeGen/AsmPrinter.cpp Wed Dec 28 00:29:02 2005 @@ -19,6 +19,7 @@ #include "llvm/Support/Mangler.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetMachine.h" +#include using namespace llvm; AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm) Index: llvm/lib/CodeGen/ELFWriter.cpp diff -u llvm/lib/CodeGen/ELFWriter.cpp:1.16 llvm/lib/CodeGen/ELFWriter.cpp:1.17 --- llvm/lib/CodeGen/ELFWriter.cpp:1.16 Thu Nov 10 12:49:46 2005 +++ llvm/lib/CodeGen/ELFWriter.cpp Wed Dec 28 00:29:02 2005 @@ -37,6 +37,7 @@ #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/Mangler.h" +#include using namespace llvm; //===----------------------------------------------------------------------===// From duraid at octopus.com.au Wed Dec 28 00:29:50 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Wed, 28 Dec 2005 00:29:50 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineConstantPool.h Message-ID: <200512280629.AAA03133@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineConstantPool.h updated: 1.7 -> 1.8 --- Log message: undo yuletide naughtyness(tm) --- Diffs of the changes: (+0 -1) MachineConstantPool.h | 1 - 1 files changed, 1 deletion(-) Index: llvm/include/llvm/CodeGen/MachineConstantPool.h diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.7 llvm/include/llvm/CodeGen/MachineConstantPool.h:1.8 --- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.7 Mon Dec 26 04:34:38 2005 +++ llvm/include/llvm/CodeGen/MachineConstantPool.h Wed Dec 28 00:29:38 2005 @@ -22,7 +22,6 @@ #ifndef LLVM_CODEGEN_MACHINECONSTANTPOOL_H #define LLVM_CODEGEN_MACHINECONSTANTPOOL_H -#include #include namespace llvm { From duraid at octopus.com.au Wed Dec 28 00:47:45 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Wed, 28 Dec 2005 00:47:45 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineConstantPool.h Message-ID: <200512280647.AAA03179@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineConstantPool.h updated: 1.8 -> 1.9 --- Log message: be more polite in public headers --- Diffs of the changes: (+1 -0) MachineConstantPool.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/CodeGen/MachineConstantPool.h diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.8 llvm/include/llvm/CodeGen/MachineConstantPool.h:1.9 --- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.8 Wed Dec 28 00:29:38 2005 +++ llvm/include/llvm/CodeGen/MachineConstantPool.h Wed Dec 28 00:47:33 2005 @@ -23,6 +23,7 @@ #define LLVM_CODEGEN_MACHINECONSTANTPOOL_H #include +#include namespace llvm { From duraid at octopus.com.au Wed Dec 28 00:56:21 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Wed, 28 Dec 2005 00:56:21 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-ar/llvm-ar.cpp Message-ID: <200512280656.AAA03202@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ar: llvm-ar.cpp updated: 1.29 -> 1.30 --- Log message: more compliance stufff --- Diffs of the changes: (+1 -0) llvm-ar.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-ar/llvm-ar.cpp diff -u llvm/tools/llvm-ar/llvm-ar.cpp:1.29 llvm/tools/llvm-ar/llvm-ar.cpp:1.30 --- llvm/tools/llvm-ar/llvm-ar.cpp:1.29 Thu Jul 7 22:08:58 2005 +++ llvm/tools/llvm-ar/llvm-ar.cpp Wed Dec 28 00:56:09 2005 @@ -20,6 +20,7 @@ #include #include #include +#include using namespace llvm; From duraid at octopus.com.au Wed Dec 28 00:58:25 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Wed, 28 Dec 2005 00:58:25 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-ranlib/llvm-ranlib.cpp Message-ID: <200512280658.AAA03214@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ranlib: llvm-ranlib.cpp updated: 1.7 -> 1.8 --- Log message: ditto --- Diffs of the changes: (+1 -0) llvm-ranlib.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-ranlib/llvm-ranlib.cpp diff -u llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.7 llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.8 --- llvm/tools/llvm-ranlib/llvm-ranlib.cpp:1.7 Thu Jul 7 18:21:43 2005 +++ llvm/tools/llvm-ranlib/llvm-ranlib.cpp Wed Dec 28 00:58:12 2005 @@ -17,6 +17,7 @@ #include "llvm/System/Signals.h" #include #include +#include using namespace llvm; From alenhar2 at cs.uiuc.edu Wed Dec 28 18:50:20 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 28 Dec 2005 18:50:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaInstrInfo.td Message-ID: <200512290050.SAA16003@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaInstrInfo.td updated: 1.93 -> 1.94 --- Log message: Fix up immediate handling --- Diffs of the changes: (+1 -1) AlphaInstrInfo.td | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.93 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.94 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.93 Tue Dec 27 00:25:50 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Wed Dec 28 18:50:08 2005 @@ -54,7 +54,7 @@ def immSExt16 : PatLeaf<(imm), [{ // immSExt16 predicate - True if the immediate fits in a 16-bit sign extended // field. Used by instructions like 'lda'. - return (int)N->getValue() == (short)N->getValue(); + return (int64_t)N->getValue() == (int16_t)N->getValue(); }]>; def iZAPX : SDNodeXForm Changes in directory llvm/lib/Target/Alpha: AlphaInstrInfo.td updated: 1.94 -> 1.95 --- Log message: let us get some do what I meant not what I said stuff checked in. You would think the alpha backend would be 64bit clean --- Diffs of the changes: (+2 -2) AlphaInstrInfo.td | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.94 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.95 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.94 Wed Dec 28 18:50:08 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Wed Dec 28 19:06:12 2005 @@ -44,12 +44,12 @@ def immUExt8 : PatLeaf<(imm), [{ // immUExt8 predicate - True if the immediate fits in a 8-bit zero extended // field. Used by instructions like 'addi'. - return (unsigned long)N->getValue() == (unsigned char)N->getValue(); + return (uint64_t)N->getValue() == (uint8_t)N->getValue(); }]>; def immUExt8inv : PatLeaf<(imm), [{ // immUExt8inv predicate - True if the inverted immediate fits in a 8-bit zero extended // field. Used by instructions like 'ornoti'. - return (unsigned long)~N->getValue() == (unsigned char)~N->getValue(); + return (uint64_t)~N->getValue() == (uint8_t)~N->getValue(); }], invX>; def immSExt16 : PatLeaf<(imm), [{ // immSExt16 predicate - True if the immediate fits in a 16-bit sign extended From duraid at octopus.com.au Wed Dec 28 23:59:30 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Wed, 28 Dec 2005 23:59:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Message-ID: <200512290559.XAA17187@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: ScheduleDAG.cpp updated: 1.54 -> 1.55 --- Log message: purity++ --- Diffs of the changes: (+1 -0) ScheduleDAG.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.54 llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.55 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.54 Wed Dec 21 14:51:36 2005 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Wed Dec 28 23:59:19 2005 @@ -26,6 +26,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include +#include #include using namespace llvm; From reid at x10sys.com Thu Dec 29 15:13:58 2005 From: reid at x10sys.com (Reid Spencer) Date: Thu, 29 Dec 2005 15:13:58 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-prof/llvm-prof.cpp Message-ID: <200512292113.PAA28761@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-prof: llvm-prof.cpp updated: 1.25 -> 1.26 --- Log message: General cleanup: 1. Don't mix C++ and C standard I/O, convert to C++ iostreams 2. Wrap long lines 3. use the std namespace to simplify/shorten the code --- Diffs of the changes: (+66 -61) llvm-prof.cpp | 127 ++++++++++++++++++++++++++++++---------------------------- 1 files changed, 66 insertions(+), 61 deletions(-) Index: llvm/tools/llvm-prof/llvm-prof.cpp diff -u llvm/tools/llvm-prof/llvm-prof.cpp:1.25 llvm/tools/llvm-prof/llvm-prof.cpp:1.26 --- llvm/tools/llvm-prof/llvm-prof.cpp:1.25 Thu Apr 21 18:59:42 2005 +++ llvm/tools/llvm-prof/llvm-prof.cpp Thu Dec 29 15:13:45 2005 @@ -20,19 +20,20 @@ #include "llvm/Bytecode/Reader.h" #include "llvm/Support/CommandLine.h" #include "llvm/System/Signals.h" -#include #include +#include #include #include using namespace llvm; +using namespace std; namespace { - cl::opt + cl::opt BytecodeFile(cl::Positional, cl::desc(""), cl::Required); - cl::opt + cl::opt ProfileDataFile(cl::Positional, cl::desc(""), cl::Optional, cl::init("llvmprof.out")); @@ -49,31 +50,31 @@ // PairSecondSort - A sorting predicate to sort by the second element of a pair. template struct PairSecondSortReverse - : public std::binary_function, - std::pair, bool> { - bool operator()(const std::pair &LHS, - const std::pair &RHS) const { + : public binary_function, + pair, bool> { + bool operator()(const pair &LHS, + const pair &RHS) const { return LHS.second > RHS.second; } }; namespace { class ProfileAnnotator : public AssemblyAnnotationWriter { - std::map &FuncFreqs; - std::map &BlockFreqs; - std::map &EdgeFreqs; + map &FuncFreqs; + map &BlockFreqs; + map &EdgeFreqs; public: - ProfileAnnotator(std::map &FF, - std::map &BF, - std::map &EF) + ProfileAnnotator(map &FF, + map &BF, + map &EF) : FuncFreqs(FF), BlockFreqs(BF), EdgeFreqs(EF) {} - virtual void emitFunctionAnnot(const Function *F, std::ostream &OS) { + virtual void emitFunctionAnnot(const Function *F, ostream &OS) { OS << ";;; %" << F->getName() << " called " << FuncFreqs[F] << " times.\n;;;\n"; } virtual void emitBasicBlockStartAnnot(const BasicBlock *BB, - std::ostream &OS) { + ostream &OS) { if (BlockFreqs.empty()) return; if (unsigned Count = BlockFreqs[BB]) OS << "\t;;; Basic block executed " << Count << " times.\n"; @@ -81,18 +82,18 @@ OS << "\t;;; Never executed!\n"; } - virtual void emitBasicBlockEndAnnot(const BasicBlock *BB, std::ostream &OS){ + virtual void emitBasicBlockEndAnnot(const BasicBlock *BB, ostream &OS){ if (EdgeFreqs.empty()) return; // Figure out how many times each successor executed. - std::vector > SuccCounts; + vector > SuccCounts; const TerminatorInst *TI = BB->getTerminator(); - std::map::iterator I = - EdgeFreqs.lower_bound(std::make_pair(const_cast(BB), 0U)); + map::iterator I = + EdgeFreqs.lower_bound(make_pair(const_cast(BB), 0U)); for (; I != EdgeFreqs.end() && I->first.first == BB; ++I) if (I->second) - SuccCounts.push_back(std::make_pair(TI->getSuccessor(I->first.second), + SuccCounts.push_back(make_pair(TI->getSuccessor(I->first.second), I->second)); if (!SuccCounts.empty()) { OS << "\t;;; Out-edge counts:"; @@ -112,70 +113,71 @@ sys::PrintStackTraceOnErrorSignal(); // Read in the bytecode file... - std::string ErrorMessage; + string ErrorMessage; Module *M = ParseBytecodeFile(BytecodeFile, &ErrorMessage); if (M == 0) { - std::cerr << argv[0] << ": " << BytecodeFile << ": " << ErrorMessage - << "\n"; + cerr << argv[0] << ": " << BytecodeFile << ": " << ErrorMessage << "\n"; return 1; } // Read the profiling information ProfileInfoLoader PI(argv[0], ProfileDataFile, *M); - std::map FuncFreqs; - std::map BlockFreqs; - std::map EdgeFreqs; + map FuncFreqs; + map BlockFreqs; + map EdgeFreqs; - // Output a report. Eventually, there will be multiple reports selectable on + // Output a report. Eventually, there will be multiple reports selectable on // the command line, for now, just keep things simple. // Emit the most frequent function table... - std::vector > FunctionCounts; + vector > FunctionCounts; PI.getFunctionCounts(FunctionCounts); FuncFreqs.insert(FunctionCounts.begin(), FunctionCounts.end()); // Sort by the frequency, backwards. - std::sort(FunctionCounts.begin(), FunctionCounts.end(), + sort(FunctionCounts.begin(), FunctionCounts.end(), PairSecondSortReverse()); unsigned long long TotalExecutions = 0; for (unsigned i = 0, e = FunctionCounts.size(); i != e; ++i) TotalExecutions += FunctionCounts[i].second; - std::cout << "===" << std::string(73, '-') << "===\n" + cout << "===" << string(73, '-') << "===\n" << "LLVM profiling output for execution"; - if (PI.getNumExecutions() != 1) std::cout << "s"; - std::cout << ":\n"; + if (PI.getNumExecutions() != 1) cout << "s"; + cout << ":\n"; for (unsigned i = 0, e = PI.getNumExecutions(); i != e; ++i) { - std::cout << " "; - if (e != 1) std::cout << i+1 << ". "; - std::cout << PI.getExecution(i) << "\n"; + cout << " "; + if (e != 1) cout << i+1 << ". "; + cout << PI.getExecution(i) << "\n"; } - std::cout << "\n===" << std::string(73, '-') << "===\n"; - std::cout << "Function execution frequencies:\n\n"; + cout << "\n===" << string(73, '-') << "===\n"; + cout << "Function execution frequencies:\n\n"; // Print out the function frequencies... - printf(" ## Frequency\n"); + cout << " ## Frequency\n"; for (unsigned i = 0, e = FunctionCounts.size(); i != e; ++i) { if (FunctionCounts[i].second == 0) { - printf("\n NOTE: %d function%s never executed!\n", - e-i, e-i-1 ? "s were" : " was"); + cout << "\n NOTE: " << e-i << " function" << + (e-i-1 ? "s were" : " was") << " never executed!\n"; break; } - printf("%3d. %5u/%llu %s\n", i+1, FunctionCounts[i].second, TotalExecutions, - FunctionCounts[i].first->getName().c_str()); + cout << setw(3) << i+1 << ". " + << setw(5) << FunctionCounts[i].second << "/" + << TotalExecutions << " " + << FunctionCounts[i].first->getName().c_str() << "\n"; } - std::set FunctionsToPrint; + set FunctionsToPrint; // If we have block count information, print out the LLVM module with // frequency annotations. if (PI.hasAccurateBlockCounts()) { - std::vector > Counts; + vector > Counts; PI.getBlockCounts(Counts); TotalExecutions = 0; @@ -183,23 +185,26 @@ TotalExecutions += Counts[i].second; // Sort by the frequency, backwards. - std::sort(Counts.begin(), Counts.end(), + sort(Counts.begin(), Counts.end(), PairSecondSortReverse()); - std::cout << "\n===" << std::string(73, '-') << "===\n"; - std::cout << "Top 20 most frequently executed basic blocks:\n\n"; + cout << "\n===" << string(73, '-') << "===\n"; + cout << "Top 20 most frequently executed basic blocks:\n\n"; // Print out the function frequencies... - printf(" ## %%%% \tFrequency\n"); + cout <<" ## %% \tFrequency\n"; unsigned BlocksToPrint = Counts.size(); if (BlocksToPrint > 20) BlocksToPrint = 20; for (unsigned i = 0; i != BlocksToPrint; ++i) { if (Counts[i].second == 0) break; Function *F = Counts[i].first->getParent(); - printf("%3d. %5.2f%% %5u/%llu\t%s() - %s\n", i+1, - Counts[i].second/(double)TotalExecutions*100, - Counts[i].second, TotalExecutions, - F->getName().c_str(), Counts[i].first->getName().c_str()); + cout << setw(3) << i+1 << ". " + << setw(5) << setprecision(2) + << Counts[i].second/(double)TotalExecutions*100 << "% " + << setw(5) << Counts[i].second << "/" + << TotalExecutions << "\t" + << F->getName().c_str() << "() - " + << Counts[i].first->getName().c_str() << "\n"; FunctionsToPrint.insert(F); } @@ -207,31 +212,31 @@ } if (PI.hasAccurateEdgeCounts()) { - std::vector > Counts; + vector > Counts; PI.getEdgeCounts(Counts); EdgeFreqs.insert(Counts.begin(), Counts.end()); } if (PrintAnnotatedLLVM || PrintAllCode) { - std::cout << "\n===" << std::string(73, '-') << "===\n"; - std::cout << "Annotated LLVM code for the module:\n\n"; + cout << "\n===" << string(73, '-') << "===\n"; + cout << "Annotated LLVM code for the module:\n\n"; ProfileAnnotator PA(FuncFreqs, BlockFreqs, EdgeFreqs); if (FunctionsToPrint.empty() || PrintAllCode) - M->print(std::cout, &PA); + M->print(cout, &PA); else // Print just a subset of the functions... - for (std::set::iterator I = FunctionsToPrint.begin(), + for (set::iterator I = FunctionsToPrint.begin(), E = FunctionsToPrint.end(); I != E; ++I) - (*I)->print(std::cout, &PA); + (*I)->print(cout, &PA); } return 0; - } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; + } catch (const string& msg) { + cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } From natebegeman at mac.com Thu Dec 29 18:10:08 2005 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 29 Dec 2005 18:10:08 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/ValueTypes.h Message-ID: <200512300010.SAA29694@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: ValueTypes.h updated: 1.15 -> 1.16 --- Log message: add support for generating v4i32 code --- Diffs of the changes: (+3 -0) ValueTypes.h | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/CodeGen/ValueTypes.h diff -u llvm/include/llvm/CodeGen/ValueTypes.h:1.15 llvm/include/llvm/CodeGen/ValueTypes.h:1.16 --- llvm/include/llvm/CodeGen/ValueTypes.h:1.15 Wed Nov 30 02:22:02 2005 +++ llvm/include/llvm/CodeGen/ValueTypes.h Thu Dec 29 18:09:56 2005 @@ -76,6 +76,9 @@ switch (VT) { default: break; + case MVT::i32: + if (NumElements == 4) return MVT::v4i32; + break; case MVT::f32: if (NumElements == 4) return MVT::v4f32; break; From natebegeman at mac.com Thu Dec 29 18:10:49 2005 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 29 Dec 2005 18:10:49 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200512300010.SAA29706@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.232 -> 1.233 --- Log message: Make sure to pass the offset into the new node, so that we don't silently drop it on the floor. --- Diffs of the changes: (+1 -1) SelectionDAG.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.232 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.233 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.232 Thu Dec 22 23:37:50 2005 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Dec 29 18:10:38 2005 @@ -511,7 +511,7 @@ MVT::ValueType VT, int offset) { SDNode *&N = GlobalValues[std::make_pair(GV, offset)]; if (N) return SDOperand(N, 0); - N = new GlobalAddressSDNode(false, GV, VT); + N = new GlobalAddressSDNode(false, GV, VT, offset); AllNodes.push_back(N); return SDOperand(N, 0); } From natebegeman at mac.com Thu Dec 29 18:11:18 2005 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 29 Dec 2005 18:11:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200512300011.SAA29718@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.55 -> 1.56 --- Log message: Remove a fixme --- Diffs of the changes: (+0 -2) PPCISelLowering.cpp | 2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.55 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.56 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.55 Fri Dec 23 19:00:15 2005 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Thu Dec 29 18:11:07 2005 @@ -126,8 +126,6 @@ } if (TM.getSubtarget().hasAltivec()) { - // FIXME: AltiVec supports a wide variety of packed types. For now, we're - // bringing up support with just v4f32. addRegisterClass(MVT::v4f32, PPC::VRRCRegisterClass); addRegisterClass(MVT::v4i32, PPC::VRRCRegisterClass); } From natebegeman at mac.com Thu Dec 29 18:13:08 2005 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 29 Dec 2005 18:13:08 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/CodeGenRegisters.h DAGISelEmitter.cpp DAGISelEmitter.h Message-ID: <200512300013.SAA29739@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: CodeGenRegisters.h updated: 1.10 -> 1.11 DAGISelEmitter.cpp updated: 1.117 -> 1.118 DAGISelEmitter.h updated: 1.48 -> 1.49 --- Log message: Add support for generating v4i32 altivec code --- Diffs of the changes: (+180 -97) CodeGenRegisters.h | 2 DAGISelEmitter.cpp | 239 ++++++++++++++++++++++++++++++++++------------------- DAGISelEmitter.h | 36 +++++-- 3 files changed, 180 insertions(+), 97 deletions(-) Index: llvm/utils/TableGen/CodeGenRegisters.h diff -u llvm/utils/TableGen/CodeGenRegisters.h:1.10 llvm/utils/TableGen/CodeGenRegisters.h:1.11 --- llvm/utils/TableGen/CodeGenRegisters.h:1.10 Sun Dec 4 20:35:08 2005 +++ llvm/utils/TableGen/CodeGenRegisters.h Thu Dec 29 18:12:56 2005 @@ -41,7 +41,7 @@ std::string MethodProtos, MethodBodies; const std::string &getName() const; - + const std::vector &getValueTypes() const { return VTs; } unsigned getNumValueTypes() const { return VTs.size(); } const MVT::ValueType getValueTypeNum(unsigned VTNum) const { Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.117 llvm/utils/TableGen/DAGISelEmitter.cpp:1.118 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.117 Mon Dec 26 03:11:45 2005 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Thu Dec 29 18:12:56 2005 @@ -34,18 +34,45 @@ return Result; } -/// isExtIntegerVT - Return true if the specified extended value type is -/// integer, or isInt. -static bool isExtIntegerVT(unsigned char VT) { - return VT == MVT::isInt || - (VT < MVT::LAST_VALUETYPE && MVT::isInteger((MVT::ValueType)VT)); +template +static std::vector +FilterEVTs(const std::vector &InVTs, T Filter) { + std::vector Result; + for (unsigned i = 0, e = InVTs.size(); i != e; ++i) + if (Filter((MVT::ValueType)InVTs[i])) + Result.push_back(InVTs[i]); + return Result; +} + +static std::vector +ConvertVTs(const std::vector &InVTs) { + std::vector Result; + for (unsigned i = 0, e = InVTs.size(); i != e; ++i) + Result.push_back(InVTs[i]); + return Result; +} + +static bool LHSIsSubsetOfRHS(const std::vector &LHS, + const std::vector &RHS) { + if (LHS.size() > RHS.size()) return false; + for (unsigned i = 0, e = LHS.size(); i != e; ++i) + if (find(RHS.begin(), RHS.end(), LHS[i]) == RHS.end()) + return false; + return true; } -/// isExtFloatingPointVT - Return true if the specified extended value type is -/// floating point, or isFP. -static bool isExtFloatingPointVT(unsigned char VT) { - return VT == MVT::isFP || - (VT < MVT::LAST_VALUETYPE && MVT::isFloatingPoint((MVT::ValueType)VT)); +/// isExtIntegerVT - Return true if the specified extended value type vector +/// contains isInt or an integer value type. +static bool isExtIntegerInVTs(std::vector EVTs) { + assert(!EVTs.empty() && "Cannot check for integer in empty ExtVT list!"); + return EVTs[0] == MVT::isInt || !(FilterEVTs(EVTs, MVT::isInteger).empty()); +} + +/// isExtFloatingPointVT - Return true if the specified extended value type +/// vector contains isFP or a FP value type. +static bool isExtFloatingPointInVTs(std::vector EVTs) { + assert(!EVTs.empty() && "Cannot check for integer in empty ExtVT list!"); + return EVTs[0] == MVT::isFP || !(FilterEVTs(EVTs, MVT::isFloatingPoint).empty()); } //===----------------------------------------------------------------------===// @@ -149,8 +176,8 @@ case SDTCisSameAs: { TreePatternNode *OtherNode = getOperandNum(x.SDTCisSameAs_Info.OtherOperandNum, N, NumResults); - return NodeToApply->UpdateNodeType(OtherNode->getExtType(), TP) | - OtherNode->UpdateNodeType(NodeToApply->getExtType(), TP); + return NodeToApply->UpdateNodeType(OtherNode->getExtTypes(), TP) | + OtherNode->UpdateNodeType(NodeToApply->getExtTypes(), TP); } case SDTCisVTSmallerThanOp: { // The NodeToApply must be a leaf node that is a VT. OtherOperandNum must @@ -172,7 +199,11 @@ bool MadeChange = false; MadeChange |= OtherNode->UpdateNodeType(MVT::isInt, TP); - if (OtherNode->hasTypeSet() && OtherNode->getType() <= VT) + // This code only handles nodes that have one type set. Assert here so + // that we can change this if we ever need to deal with multiple value + // types at this point. + assert(OtherNode->getExtTypes().size() == 1 && "Node has too many types!"); + if (OtherNode->hasTypeSet() && OtherNode->getTypeNum(0) <= VT) OtherNode->UpdateNodeType(MVT::Other, TP); // Throw an error. return false; } @@ -183,20 +214,28 @@ // Both operands must be integer or FP, but we don't care which. bool MadeChange = false; - if (isExtIntegerVT(NodeToApply->getExtType())) + // This code does not currently handle nodes which have multiple types, + // where some types are integer, and some are fp. Assert that this is not + // the case. + assert(!(isExtIntegerInVTs(NodeToApply->getExtTypes()) && + isExtFloatingPointInVTs(NodeToApply->getExtTypes())) && + !(isExtIntegerInVTs(BigOperand->getExtTypes()) && + isExtFloatingPointInVTs(BigOperand->getExtTypes())) && + "SDTCisOpSmallerThanOp does not handle mixed int/fp types!"); + if (isExtIntegerInVTs(NodeToApply->getExtTypes())) MadeChange |= BigOperand->UpdateNodeType(MVT::isInt, TP); - else if (isExtFloatingPointVT(NodeToApply->getExtType())) + else if (isExtFloatingPointInVTs(NodeToApply->getExtTypes())) MadeChange |= BigOperand->UpdateNodeType(MVT::isFP, TP); - if (isExtIntegerVT(BigOperand->getExtType())) + if (isExtIntegerInVTs(BigOperand->getExtTypes())) MadeChange |= NodeToApply->UpdateNodeType(MVT::isInt, TP); - else if (isExtFloatingPointVT(BigOperand->getExtType())) + else if (isExtFloatingPointInVTs(BigOperand->getExtTypes())) MadeChange |= NodeToApply->UpdateNodeType(MVT::isFP, TP); std::vector VTs = CGT.getLegalValueTypes(); - if (isExtIntegerVT(NodeToApply->getExtType())) { + if (isExtIntegerInVTs(NodeToApply->getExtTypes())) { VTs = FilterVTs(VTs, MVT::isInteger); - } else if (isExtFloatingPointVT(NodeToApply->getExtType())) { + } else if (isExtFloatingPointInVTs(NodeToApply->getExtTypes())) { VTs = FilterVTs(VTs, MVT::isFloatingPoint); } else { VTs.clear(); @@ -273,24 +312,42 @@ /// information. If N already contains a conflicting type, then throw an /// exception. This returns true if any information was updated. /// -bool TreePatternNode::UpdateNodeType(unsigned char VT, TreePattern &TP) { - if (VT == MVT::isUnknown || getExtType() == VT) return false; - if (getExtType() == MVT::isUnknown) { - setType(VT); +bool TreePatternNode::UpdateNodeType(const std::vector &ExtVTs, + TreePattern &TP) { + assert(!ExtVTs.empty() && "Cannot update node type with empty type vector!"); + + if (ExtVTs[0] == MVT::isUnknown || LHSIsSubsetOfRHS(getExtTypes(), ExtVTs)) + return false; + if (isTypeCompletelyUnknown() || LHSIsSubsetOfRHS(ExtVTs, getExtTypes())) { + setTypes(ExtVTs); return true; } - // If we are told this is to be an int or FP type, and it already is, ignore - // the advice. - if ((VT == MVT::isInt && isExtIntegerVT(getExtType())) || - (VT == MVT::isFP && isExtFloatingPointVT(getExtType()))) - return false; + if (ExtVTs[0] == MVT::isInt && isExtIntegerInVTs(getExtTypes())) { + assert(hasTypeSet() && "should be handled above!"); + std::vector FVTs = FilterEVTs(getExtTypes(), MVT::isInteger); + if (getExtTypes() == FVTs) + return false; + setTypes(FVTs); + return true; + } + if (ExtVTs[0] == MVT::isFP && isExtFloatingPointInVTs(getExtTypes())) { + assert(hasTypeSet() && "should be handled above!"); + std::vector FVTs = FilterEVTs(getExtTypes(), MVT::isFloatingPoint); + if (getExtTypes() == FVTs) + return false; + setTypes(FVTs); + return true; + } // If we know this is an int or fp type, and we are told it is a specific one, // take the advice. - if ((getExtType() == MVT::isInt && isExtIntegerVT(VT)) || - (getExtType() == MVT::isFP && isExtFloatingPointVT(VT))) { - setType(VT); + // + // Similarly, we should probably set the type here to the intersection of + // {isInt|isFP} and ExtVTs + if ((getExtTypeNum(0) == MVT::isInt && isExtIntegerInVTs(ExtVTs)) || + (getExtTypeNum(0) == MVT::isFP && isExtFloatingPointInVTs(ExtVTs))) { + setTypes(ExtVTs); return true; } @@ -313,12 +370,14 @@ OS << "(" << getOperator()->getName(); } - switch (getExtType()) { + // FIXME: At some point we should handle printing all the value types for + // nodes that are multiply typed. + switch (getExtTypeNum(0)) { case MVT::Other: OS << ":Other"; break; case MVT::isInt: OS << ":isInt"; break; case MVT::isFP : OS << ":isFP"; break; case MVT::isUnknown: ; /*OS << ":?";*/ break; - default: OS << ":" << getType(); break; + default: OS << ":" << getTypeNum(0); break; } if (!isLeaf()) { @@ -351,7 +410,7 @@ /// that are otherwise identical are considered isomorphic. bool TreePatternNode::isIsomorphicTo(const TreePatternNode *N) const { if (N == this) return true; - if (N->isLeaf() != isLeaf() || getExtType() != N->getExtType() || + if (N->isLeaf() != isLeaf() || getExtTypes() != N->getExtTypes() || getPredicateFn() != N->getPredicateFn() || getTransformFn() != N->getTransformFn()) return false; @@ -385,7 +444,7 @@ New = new TreePatternNode(getOperator(), CChildren); } New->setName(getName()); - New->setType(getExtType()); + New->setTypes(getExtTypes()); New->setPredicateFn(getPredicateFn()); New->setTransformFn(getTransformFn()); return New; @@ -451,7 +510,7 @@ } FragTree->setName(getName()); - FragTree->UpdateNodeType(getExtType(), TP); + FragTree->UpdateNodeType(getExtTypes(), TP); // Get a new copy of this fragment to stitch into here. //delete this; // FIXME: implement refcounting! @@ -462,37 +521,43 @@ /// type which should be applied to it. This infer the type of register /// references from the register file information, for example. /// -static unsigned char getIntrinsicType(Record *R, bool NotRegisters, +static std::vector getIntrinsicType(Record *R, bool NotRegisters, TreePattern &TP) { + // Some common return values + std::vector Unknown(1, MVT::isUnknown); + std::vector Other(1, MVT::Other); + // Check to see if this is a register or a register class... if (R->isSubClassOf("RegisterClass")) { - if (NotRegisters) return MVT::isUnknown; + if (NotRegisters) + return Unknown; const CodeGenRegisterClass &RC = TP.getDAGISelEmitter().getTargetInfo().getRegisterClass(R); - return RC.getValueTypeNum(0); + return ConvertVTs(RC.getValueTypes()); } else if (R->isSubClassOf("PatFrag")) { // Pattern fragment types will be resolved when they are inlined. - return MVT::isUnknown; + return Unknown; } else if (R->isSubClassOf("Register")) { // If the register appears in exactly one regclass, and the regclass has one // value type, use it as the known type. const CodeGenTarget &T = TP.getDAGISelEmitter().getTargetInfo(); if (const CodeGenRegisterClass *RC = T.getRegisterClassForRegister(R)) - if (RC->getNumValueTypes() == 1) - return RC->getValueTypeNum(0); - return MVT::isUnknown; + return ConvertVTs(RC->getValueTypes()); + return Unknown; } else if (R->isSubClassOf("ValueType") || R->isSubClassOf("CondCode")) { // Using a VTSDNode or CondCodeSDNode. - return MVT::Other; + return Other; } else if (R->isSubClassOf("ComplexPattern")) { - return TP.getDAGISelEmitter().getComplexPattern(R).getValueType(); + std::vector + ComplexPat(1, TP.getDAGISelEmitter().getComplexPattern(R).getValueType()); + return ComplexPat; } else if (R->getName() == "node" || R->getName() == "srcvalue") { // Placeholder. - return MVT::isUnknown; + return Unknown; } TP.error("Unknown node flavor used in pattern: " + R->getName()); - return MVT::Other; + return Other; } /// ApplyTypeConstraints - Apply all of the type constraints relevent to @@ -510,14 +575,19 @@ bool MadeChange = UpdateNodeType(MVT::isInt, TP); if (hasTypeSet()) { - unsigned Size = MVT::getSizeInBits(getType()); + // At some point, it may make sense for this tree pattern to have + // multiple types. Assert here that it does not, so we revisit this + // code when appropriate. + assert(getExtTypes().size() == 1 && "TreePattern has too many types!"); + + unsigned Size = MVT::getSizeInBits(getTypeNum(0)); // Make sure that the value is representable for this type. if (Size < 32) { int Val = (II->getValue() << (32-Size)) >> (32-Size); if (Val != II->getValue()) TP.error("Sign-extended integer value '" + itostr(II->getValue()) + "' is out of range for type 'MVT::" + - getEnumName(getType()) + "'!"); + getEnumName(getTypeNum(0)) + "'!"); } } @@ -533,8 +603,8 @@ MadeChange |= getChild(1)->ApplyTypeConstraints(TP, NotRegisters); // Types of operands must match. - MadeChange |= getChild(0)->UpdateNodeType(getChild(1)->getExtType(), TP); - MadeChange |= getChild(1)->UpdateNodeType(getChild(0)->getExtType(), TP); + MadeChange |= getChild(0)->UpdateNodeType(getChild(1)->getExtTypes(), TP); + MadeChange |= getChild(1)->UpdateNodeType(getChild(0)->getExtTypes(), TP); MadeChange |= UpdateNodeType(MVT::isVoid, TP); return MadeChange; } else if (getOperator()->isSubClassOf("SDNode")) { @@ -566,9 +636,7 @@ const CodeGenRegisterClass &RC = TP.getDAGISelEmitter().getTargetInfo().getRegisterClass(ResultNode); - - // Get the first ValueType in the RegClass, it's as good as any. - MadeChange = UpdateNodeType(RC.getValueTypeNum(0), TP); + MadeChange = UpdateNodeType(ConvertVTs(RC.getValueTypes()), TP); } if (getNumChildren() != Inst.getNumOperands()) @@ -581,15 +649,16 @@ if (OperandNode->isSubClassOf("RegisterClass")) { const CodeGenRegisterClass &RC = TP.getDAGISelEmitter().getTargetInfo().getRegisterClass(OperandNode); - VT = RC.getValueTypeNum(0); + //VT = RC.getValueTypeNum(0); + MadeChange |=getChild(i)->UpdateNodeType(ConvertVTs(RC.getValueTypes()), + TP); } else if (OperandNode->isSubClassOf("Operand")) { VT = getValueType(OperandNode->getValueAsDef("Type")); + MadeChange |= getChild(i)->UpdateNodeType(VT, TP); } else { assert(0 && "Unknown operand type!"); abort(); } - - MadeChange |= getChild(i)->UpdateNodeType(VT, TP); MadeChange |= getChild(i)->ApplyTypeConstraints(TP, NotRegisters); } return MadeChange; @@ -601,8 +670,8 @@ if (getNumChildren() != 1) TP.error("Node transform '" + getOperator()->getName() + "' requires one operand!"); - bool MadeChange = UpdateNodeType(getChild(0)->getExtType(), TP); - MadeChange |= getChild(0)->UpdateNodeType(getExtType(), TP); + bool MadeChange = UpdateNodeType(getChild(0)->getExtTypes(), TP); + MadeChange |= getChild(0)->UpdateNodeType(getExtTypes(), TP); return MadeChange; } } @@ -995,7 +1064,7 @@ // Ensure that the inputs agree if we've already seen this input. if (Rec != SlotRec) I->error("All $" + Pat->getName() + " inputs must agree with each other"); - if (Slot->getExtType() != Pat->getExtType()) + if (Slot->getExtTypes() != Pat->getExtTypes()) I->error("All $" + Pat->getName() + " inputs must agree with each other"); } return true; @@ -1019,7 +1088,7 @@ // If this is not a set, verify that the children nodes are not void typed, // and recurse. for (unsigned i = 0, e = Pat->getNumChildren(); i != e; ++i) { - if (Pat->getChild(i)->getExtType() == MVT::isVoid) + if (Pat->getChild(i)->getExtTypeNum(0) == MVT::isVoid) I->error("Cannot have void nodes inside of patterns!"); FindPatternInputsAndOutputs(I, Pat->getChild(i), InstInputs, InstResults, InstImpInputs, InstImpResults); @@ -1146,7 +1215,7 @@ // fill in the InstResults map. for (unsigned j = 0, e = I->getNumTrees(); j != e; ++j) { TreePatternNode *Pat = I->getTree(j); - if (Pat->getExtType() != MVT::isVoid) + if (Pat->getExtTypeNum(0) != MVT::isVoid) I->error("Top-level forms in instruction pattern should have" " void types"); @@ -1372,7 +1441,7 @@ R->setName(Orig->getName()); R->setPredicateFn(Orig->getPredicateFn()); R->setTransformFn(Orig->getTransformFn()); - R->setType(Orig->getExtType()); + R->setTypes(Orig->getExtTypes()); // If this pattern cannot every match, do not include it as a variant. std::string ErrString; @@ -1622,10 +1691,11 @@ /// patterns before small ones. This is used to determine the size of a /// pattern. static unsigned getPatternSize(TreePatternNode *P, DAGISelEmitter &ISE) { - assert(isExtIntegerVT(P->getExtType()) || - isExtFloatingPointVT(P->getExtType()) || - P->getExtType() == MVT::isVoid || - P->getExtType() == MVT::Flag && "Not a valid pattern node to size!"); + assert(isExtIntegerInVTs(P->getExtTypes()) || + isExtFloatingPointInVTs(P->getExtTypes()) || + P->getExtTypeNum(0) == MVT::isVoid || + P->getExtTypeNum(0) == MVT::Flag && + "Not a valid pattern node to size!"); unsigned Size = 1; // The node itself. // FIXME: This is a hack to statically increase the priority of patterns @@ -1640,7 +1710,7 @@ // Count children in the count if they are also nodes. for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i) { TreePatternNode *Child = P->getChild(i); - if (!Child->isLeaf() && Child->getExtType() != MVT::Other) + if (!Child->isLeaf() && Child->getExtTypeNum(0) != MVT::Other) Size += getPatternSize(Child, ISE); else if (Child->isLeaf()) { if (dynamic_cast(Child->getLeafValue())) @@ -1697,7 +1767,7 @@ /// RemoveAllTypes - A quick recursive walk over a pattern which removes all /// type information from it. static void RemoveAllTypes(TreePatternNode *N) { - N->setType(MVT::isUnknown); + N->removeTypes(); if (!N->isLeaf()) for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) RemoveAllTypes(N->getChild(i)); @@ -1959,7 +2029,8 @@ unsigned ResNo = TmpNo++; unsigned NumRes = 1; if (!N->isLeaf() && N->getOperator()->getName() == "imm") { - switch (N->getType()) { + assert(N->getExtTypes().size() == 1 && "Multiple types not handled!"); + switch (N->getTypeNum(0)) { default: assert(0 && "Unknown type for constant node!"); case MVT::i1: OS << " bool Tmp"; break; case MVT::i8: OS << " unsigned char Tmp"; break; @@ -1971,7 +2042,7 @@ OS << " "; DeclareSDOperand("Tmp"+utostr(ResNo)); OS << " = CurDAG->getTargetConstant(Tmp" - << ResNo << "C, MVT::" << getEnumName(N->getType()) << ");\n"; + << ResNo << "C, MVT::" << getEnumName(N->getTypeNum(0)) << ");\n"; } else if (!N->isLeaf() && N->getOperator()->getName() == "tglobaladdr") { OS << " "; DeclareSDOperand("Tmp"+utostr(ResNo)); @@ -2019,7 +2090,7 @@ DeclareSDOperand("Tmp"+utostr(ResNo)); OS << " = CurDAG->getRegister(" << ISE.getQualifiedName(DI->getDef()) << ", MVT::" - << getEnumName(N->getType()) + << getEnumName(N->getTypeNum(0)) << ");\n"; return std::make_pair(1, ResNo); } @@ -2027,9 +2098,10 @@ unsigned ResNo = TmpNo++; OS << " "; DeclareSDOperand("Tmp"+utostr(ResNo)); + assert(N->getExtTypes().size() == 1 && "Multiple types not handled!"); OS << " = CurDAG->getTargetConstant(" << II->getValue() << ", MVT::" - << getEnumName(N->getType()) + << getEnumName(N->getTypeNum(0)) << ");\n"; return std::make_pair(1, ResNo); } @@ -2099,8 +2171,8 @@ DeclareSDOperand("Tmp"+utostr(ResNo)); OS << " = CurDAG->getTargetNode(" << II.Namespace << "::" << II.TheDef->getName(); - if (N->getType() != MVT::isVoid) - OS << ", MVT::" << getEnumName(N->getType()); + if (N->getTypeNum(0) != MVT::isVoid) + OS << ", MVT::" << getEnumName(N->getTypeNum(0)); if (HasOutFlag) OS << ", MVT::Flag"; @@ -2122,9 +2194,8 @@ // Output order: results, chain, flags // Result types. if (NumResults > 0) { - // TODO: multiple results? - if (N->getType() != MVT::isVoid) - OS << ", MVT::" << getEnumName(N->getType()); + if (N->getTypeNum(0) != MVT::isVoid) + OS << ", MVT::" << getEnumName(N->getTypeNum(0)); } if (HasChain) OS << ", MVT::Other"; @@ -2195,8 +2266,8 @@ OS << " if (N.Val->hasOneUse()) {\n"; OS << " return CurDAG->SelectNodeTo(N.Val, " << II.Namespace << "::" << II.TheDef->getName(); - if (N->getType() != MVT::isVoid) - OS << ", MVT::" << getEnumName(N->getType()); + if (N->getTypeNum(0) != MVT::isVoid) + OS << ", MVT::" << getEnumName(N->getTypeNum(0)); if (HasOutFlag) OS << ", MVT::Flag"; for (unsigned i = 0, e = Ops.size(); i != e; ++i) @@ -2207,8 +2278,8 @@ OS << " } else {\n"; OS << " return CodeGenMap[N] = CurDAG->getTargetNode(" << II.Namespace << "::" << II.TheDef->getName(); - if (N->getType() != MVT::isVoid) - OS << ", MVT::" << getEnumName(N->getType()); + if (N->getTypeNum(0) != MVT::isVoid) + OS << ", MVT::" << getEnumName(N->getTypeNum(0)); if (HasOutFlag) OS << ", MVT::Flag"; for (unsigned i = 0, e = Ops.size(); i != e; ++i) @@ -2249,9 +2320,9 @@ // Did we find one? if (!Pat->hasTypeSet()) { // Move a type over from 'other' to 'pat'. - Pat->setType(Other->getType()); + Pat->setTypes(Other->getExtTypes()); OS << " if (" << Prefix << ".Val->getValueType(0) != MVT::" - << getName(Pat->getType()) << ") goto P" << PatternNo << "Fail;\n"; + << getName(Pat->getTypeNum(0)) << ") goto P" << PatternNo << "Fail;\n"; return true; } Index: llvm/utils/TableGen/DAGISelEmitter.h diff -u llvm/utils/TableGen/DAGISelEmitter.h:1.48 llvm/utils/TableGen/DAGISelEmitter.h:1.49 --- llvm/utils/TableGen/DAGISelEmitter.h:1.48 Fri Dec 23 16:11:47 2005 +++ llvm/utils/TableGen/DAGISelEmitter.h Thu Dec 29 18:12:56 2005 @@ -124,9 +124,9 @@ /// patterns), and as such should be ref counted. We currently just leak all /// TreePatternNode objects! class TreePatternNode { - /// The inferred type for this node, or MVT::LAST_VALUETYPE if it hasn't + /// The inferred type for this node, or MVT::isUnknown if it hasn't /// been determined yet. - unsigned char Ty; + std::vector Types; /// Operator - The Record for the operator if this is an interior node (not /// a leaf). @@ -151,26 +151,32 @@ std::vector Children; public: TreePatternNode(Record *Op, const std::vector &Ch) - : Ty(MVT::isUnknown), Operator(Op), Val(0), TransformFn(0), - Children(Ch) {} + : Types(), Operator(Op), Val(0), TransformFn(0), + Children(Ch) { Types.push_back(MVT::isUnknown); } TreePatternNode(Init *val) // leaf ctor - : Ty(MVT::isUnknown), Operator(0), Val(val), TransformFn(0) {} + : Types(), Operator(0), Val(val), TransformFn(0) { Types.push_back(MVT::isUnknown); } ~TreePatternNode(); const std::string &getName() const { return Name; } void setName(const std::string &N) { Name = N; } bool isLeaf() const { return Val != 0; } - bool hasTypeSet() const { return Ty < MVT::LAST_VALUETYPE; } + bool hasTypeSet() const { return Types[0] < MVT::LAST_VALUETYPE; } bool isTypeCompletelyUnknown() const { - return Ty == MVT::isUnknown; + return Types[0] == MVT::isUnknown; } - MVT::ValueType getType() const { + MVT::ValueType getTypeNum(unsigned Num) const { assert(hasTypeSet() && "Doesn't have a type yet!"); - return (MVT::ValueType)Ty; + assert(Types.size() > Num && "Type num out of range!"); + return (MVT::ValueType)Types[Num]; } - unsigned char getExtType() const { return Ty; } - void setType(unsigned char VT) { Ty = VT; } + unsigned char getExtTypeNum(unsigned Num) const { + assert(Types.size() > Num && "Extended type num out of range!"); + return Types[Num]; + } + const std::vector &getExtTypes() const { return Types; } + void setTypes(const std::vector &T) { Types = T; } + void removeTypes() { Types = std::vector(1,MVT::isUnknown); } Init *getLeafValue() const { assert(isLeaf()); return Val; } Record *getOperator() const { assert(!isLeaf()); return Operator; } @@ -181,6 +187,7 @@ Children[i] = N; } + const std::string &getPredicateFn() const { return PredicateFn; } void setPredicateFn(const std::string &Fn) { PredicateFn = Fn; } @@ -222,7 +229,12 @@ /// information. If N already contains a conflicting type, then throw an /// exception. This returns true if any information was updated. /// - bool UpdateNodeType(unsigned char EVT, TreePattern &TP); + bool UpdateNodeType(const std::vector &ExtVTs, + TreePattern &TP); + bool UpdateNodeType(unsigned char ExtVT, TreePattern &TP) { + std::vector ExtVTs(1, ExtVT); + return UpdateNodeType(ExtVTs, TP); + } /// ContainsUnresolvedType - Return true if this tree contains any /// unresolved types. From natebegeman at mac.com Thu Dec 29 18:13:08 2005 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 29 Dec 2005 18:13:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrInfo.td Message-ID: <200512300013.SAA29743@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstrInfo.td updated: 1.166 -> 1.167 --- Log message: Add support for generating v4i32 altivec code --- Diffs of the changes: (+10 -2) PPCInstrInfo.td | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.166 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.167 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.166 Mon Dec 26 03:11:45 2005 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Thu Dec 29 18:12:56 2005 @@ -447,7 +447,7 @@ []>; def LVX : XForm_1<31, 103, (ops VRRC:$vD, memrr:$src), "lvx $vD, $src", LdStGeneral, - [(set VRRC:$vD, (load xoaddr:$src))]>; + [(set VRRC:$vD, (v4f32 (load xoaddr:$src)))]>; } def LVSL : XForm_1<31, 6, (ops VRRC:$vD, GPRC:$base, GPRC:$rA), "lvsl $vD, $base, $rA", LdStGeneral, @@ -542,7 +542,7 @@ []>; def STVX : XForm_8<31, 231, (ops VRRC:$rS, memrr:$dst), "stvx $rS, $dst", LdStGeneral, - [(store VRRC:$rS, xoaddr:$dst)]>; + [(store (v4f32 VRRC:$rS), xoaddr:$dst)]>; } def SRAWI : XForm_10<31, 824, (ops GPRC:$rA, GPRC:$rS, u5imm:$SH), "srawi $rA, $rS, $SH", IntShift, @@ -892,6 +892,9 @@ def VADDFP : VXForm_1<10, (ops VRRC:$vD, VRRC:$vA, VRRC:$vB), "vaddfp $vD, $vA, $vB", VecFP, [(set VRRC:$vD, (fadd VRRC:$vA, VRRC:$vB))]>; +def VADDUWM : VXForm_1<128, (ops VRRC:$vD, VRRC:$vA, VRRC:$vB), + "vadduwm $vD, $vA, $vB", VecGeneral, + [(set VRRC:$vD, (add VRRC:$vA, VRRC:$vB))]>; def VCFSX : VXForm_1<842, (ops VRRC:$vD, u5imm:$UIMM, VRRC:$vB), "vcfsx $vD, $vB, $UIMM", VecFP, []>; @@ -1060,6 +1063,11 @@ def : Pat<(f64 (extload xaddr:$src, f32)), (FMRSD (LFSX xaddr:$src))>; +def : Pat<(v4i32 (load xoaddr:$src)), + (v4i32 (LVX xoaddr:$src))>; +def : Pat<(store (v4i32 VRRC:$rS), xoaddr:$dst), + (STVX (v4i32 VRRC:$rS), xoaddr:$dst)>; + def : Pat<(retflag), (BLR)>; // Same as above, but using a temporary. FIXME: implement temporaries :) From alenhar2 at cs.uiuc.edu Thu Dec 29 20:30:14 2005 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Thu, 29 Dec 2005 20:30:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp AlphaInstrInfo.td Message-ID: <200512300230.UAA30884@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelDAGToDAG.cpp updated: 1.23 -> 1.24 AlphaInstrInfo.td updated: 1.95 -> 1.96 --- Log message: improve constant loading. Still sucks, but oh well --- Diffs of the changes: (+53 -17) AlphaISelDAGToDAG.cpp | 38 +++++++++++++++++++++++--------------- AlphaInstrInfo.td | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 17 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp diff -u llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.23 llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.24 --- llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.23 Sun Dec 25 11:36:48 2005 +++ llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Thu Dec 29 20:30:02 2005 @@ -38,13 +38,14 @@ class AlphaDAGToDAGISel : public SelectionDAGISel { AlphaTargetLowering AlphaLowering; - static const int IMM_LOW = -32768; - static const int IMM_HIGH = 32767; - static const int IMM_MULT = 65536; + static const int64_t IMM_LOW = -32768; + static const int64_t IMM_HIGH = 32767; + static const int64_t IMM_MULT = 65536; public: AlphaDAGToDAGISel(TargetMachine &TM) - : SelectionDAGISel(AlphaLowering), AlphaLowering(TM) {} + : SelectionDAGISel(AlphaLowering), AlphaLowering(TM) + {} /// getI64Imm - Return a target constant with the specified value, of type /// i64. @@ -240,17 +241,24 @@ return CurDAG->SelectNodeTo(N, Alpha::RETDAG, MVT::Other, Chain, InFlag); } case ISD::Constant: { - int64_t val = (int64_t)cast(N)->getValue(); - if (val > (int64_t)IMM_HIGH +(int64_t)IMM_HIGH* (int64_t)IMM_MULT || - val < (int64_t)IMM_LOW + (int64_t)IMM_LOW * (int64_t)IMM_MULT) { - MachineConstantPool *CP = BB->getParent()->getConstantPool(); - ConstantUInt *C = - ConstantUInt::get(Type::getPrimitiveType(Type::ULongTyID) , val); - SDOperand Tmp, CPI = CurDAG->getTargetConstantPool(C, MVT::i64); - Tmp = CurDAG->getTargetNode(Alpha::LDAHr, MVT::i64, CPI, getGlobalBaseReg()); - return CurDAG->SelectNodeTo(N, Alpha::LDQr, MVT::i64, CPI, Tmp); - } - break; + uint64_t uval = cast(N)->getValue(); + int64_t val = (int64_t)uval; + int32_t val32 = (int32_t)val; + if (val <= IMM_HIGH + IMM_HIGH * IMM_MULT && + val >= IMM_LOW + IMM_LOW * IMM_MULT) + break; //(LDAH (LDA)) + if ((uval >> 32) == 0 && //empty upper bits + val32 <= IMM_HIGH + IMM_HIGH * IMM_MULT && + val32 >= IMM_LOW + IMM_LOW * IMM_MULT) + break; //(zext (LDAH (LDA))) + //Else use the constant pool + MachineConstantPool *CP = BB->getParent()->getConstantPool(); + ConstantUInt *C = + ConstantUInt::get(Type::getPrimitiveType(Type::ULongTyID) , uval); + SDOperand Tmp, CPI = CurDAG->getTargetConstantPool(C, MVT::i64); + Tmp = CurDAG->getTargetNode(Alpha::LDAHr, MVT::i64, CPI, getGlobalBaseReg()); + return CurDAG->SelectNodeTo(N, Alpha::LDQr, MVT::i64, MVT::Other, + CPI, Tmp, CurDAG->getEntryNode()); } case ISD::ConstantFP: if (ConstantFPSDNode *CN = dyn_cast(N)) { Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.95 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.96 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.95 Wed Dec 28 19:06:12 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Thu Dec 29 20:30:02 2005 @@ -57,6 +57,20 @@ return (int64_t)N->getValue() == (int16_t)N->getValue(); }]>; +def SExtInt : SDNodeXFormgetValue() << 32) >> 32); +}]>; + +def immSExt16int : PatLeaf<(imm), [{ + // immSExt16 predicate - True if the immediate fits in a 16-bit sign extended + // field. Used by instructions like 'lda'. + int64_t val = (int64_t)N->getValue(); + uint32_t uval32 = (uint32_t)val; + int32_t val32 = (int32_t)val; + return (int64_t)uval32 == val && val32 == (int16_t)val32; +}], SExtInt>; + + def iZAPX : SDNodeXFormgetValue(); @@ -778,12 +792,19 @@ //Constant handling def immConst2Part : PatLeaf<(imm), [{ - // immZAP predicate - True if the immediate fits is suitable for use in a - // ZAP instruction + //true if imm fits in a LDAH LDA pair int64_t val = (int64_t)N->getValue(); return (val <= (int64_t)IMM_HIGH +(int64_t)IMM_HIGH* (int64_t)IMM_MULT & val >= (int64_t)IMM_LOW + (int64_t)IMM_LOW * (int64_t)IMM_MULT); }]>; +def immConst2PartInt : PatLeaf<(imm), [{ + //true if imm fits in a LDAH LDA pair with zeroext + uint64_t uval = N->getValue(); + int32_t val32 = (int32_t)uval; + return ((uval >> 32) == 0 && //empty upper bits + val32 <= IMM_HIGH + IMM_HIGH * IMM_MULT && + val32 >= IMM_LOW + IMM_LOW * IMM_MULT); +}], SExtInt>; //TODO: factor this out def LL16 : SDNodeXForm; +def : Pat<(i64 immSExt16int:$imm), + (ZAPNOTi (LDA (SExtInt immSExt16int:$imm), R31), 15)>; +def : Pat<(i64 immConst2PartInt:$imm), + (ZAPNOTi (LDA (LL16 (SExtInt immConst2PartInt:$imm)), + (LDAH (LH16 (SExtInt immConst2PartInt:$imm)), R31)), 15)>; + + //TODO: I want to just define these like this! //def : Pat<(i64 0), // (R31)>; From duraid at octopus.com.au Thu Dec 29 20:47:33 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Thu, 29 Dec 2005 20:47:33 -0600 Subject: [llvm-commits] CVS: llvm/tools/llc/llc.cpp Message-ID: <200512300247.UAA31121@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: llc.cpp updated: 1.121 -> 1.122 --- Log message: delete file portably --- Diffs of the changes: (+2 -1) llc.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.121 llvm/tools/llc/llc.cpp:1.122 --- llvm/tools/llc/llc.cpp:1.121 Tue Dec 27 23:56:36 2005 +++ llvm/tools/llc/llc.cpp Thu Dec 29 20:47:21 2005 @@ -24,6 +24,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/PluginLoader.h" #include "llvm/Support/PassNameParser.h" +#include "llvm/Support/FileUtilities.h" #include "llvm/Analysis/Verifier.h" #include "llvm/System/Signals.h" #include "llvm/Config/config.h" @@ -244,7 +245,7 @@ << "' does not support generation of this file type!\n"; if (Out != &std::cout) delete Out; // And the Out file is empty and useless, so remove it now. - std::remove(OutputFilename.c_str()); + sys::Path(OutputFilename).eraseFromDisk(); return 1; } else { // Run our queue of passes all at once now, efficiently. From duraid at octopus.com.au Thu Dec 29 20:50:56 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Thu, 29 Dec 2005 20:50:56 -0600 Subject: [llvm-commits] CVS: llvm/tools/llc/llc.cpp Message-ID: <200512300250.UAA31147@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: llc.cpp updated: 1.122 -> 1.123 --- Log message: don't need this anymore --- Diffs of the changes: (+0 -1) llc.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/tools/llc/llc.cpp diff -u llvm/tools/llc/llc.cpp:1.122 llvm/tools/llc/llc.cpp:1.123 --- llvm/tools/llc/llc.cpp:1.122 Thu Dec 29 20:47:21 2005 +++ llvm/tools/llc/llc.cpp Thu Dec 29 20:50:44 2005 @@ -31,7 +31,6 @@ #include #include #include -#include using namespace llvm; From reid at x10sys.com Fri Dec 30 03:07:50 2005 From: reid at x10sys.com (Reid Spencer) Date: Fri, 30 Dec 2005 03:07:50 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-prof/llvm-prof.cpp Message-ID: <200512300907.DAA29624@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-prof: llvm-prof.cpp updated: 1.26 -> 1.27 --- Log message: Revert removal of std:: prefixes and addtion of "using namespace std;". This violates the LLVM coding standards. --- Diffs of the changes: (+55 -55) llvm-prof.cpp | 110 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 55 insertions(+), 55 deletions(-) Index: llvm/tools/llvm-prof/llvm-prof.cpp diff -u llvm/tools/llvm-prof/llvm-prof.cpp:1.26 llvm/tools/llvm-prof/llvm-prof.cpp:1.27 --- llvm/tools/llvm-prof/llvm-prof.cpp:1.26 Thu Dec 29 15:13:45 2005 +++ llvm/tools/llvm-prof/llvm-prof.cpp Fri Dec 30 03:07:29 2005 @@ -26,14 +26,13 @@ #include using namespace llvm; -using namespace std; namespace { - cl::opt + cl::opt BytecodeFile(cl::Positional, cl::desc(""), cl::Required); - cl::opt + cl::opt ProfileDataFile(cl::Positional, cl::desc(""), cl::Optional, cl::init("llvmprof.out")); @@ -50,31 +49,31 @@ // PairSecondSort - A sorting predicate to sort by the second element of a pair. template struct PairSecondSortReverse - : public binary_function, - pair, bool> { - bool operator()(const pair &LHS, - const pair &RHS) const { + : public std::binary_function, + std::pair, bool> { + bool operator()(const std::pair &LHS, + const std::pair &RHS) const { return LHS.second > RHS.second; } }; namespace { class ProfileAnnotator : public AssemblyAnnotationWriter { - map &FuncFreqs; - map &BlockFreqs; - map &EdgeFreqs; + std::map &FuncFreqs; + std::map &BlockFreqs; + std::map &EdgeFreqs; public: - ProfileAnnotator(map &FF, - map &BF, - map &EF) + ProfileAnnotator(std::map &FF, + std::map &BF, + std::map &EF) : FuncFreqs(FF), BlockFreqs(BF), EdgeFreqs(EF) {} - virtual void emitFunctionAnnot(const Function *F, ostream &OS) { + virtual void emitFunctionAnnot(const Function *F, std::ostream &OS) { OS << ";;; %" << F->getName() << " called " << FuncFreqs[F] << " times.\n;;;\n"; } virtual void emitBasicBlockStartAnnot(const BasicBlock *BB, - ostream &OS) { + std::ostream &OS) { if (BlockFreqs.empty()) return; if (unsigned Count = BlockFreqs[BB]) OS << "\t;;; Basic block executed " << Count << " times.\n"; @@ -82,18 +81,18 @@ OS << "\t;;; Never executed!\n"; } - virtual void emitBasicBlockEndAnnot(const BasicBlock *BB, ostream &OS){ + virtual void emitBasicBlockEndAnnot(const BasicBlock *BB, std::ostream &OS){ if (EdgeFreqs.empty()) return; // Figure out how many times each successor executed. - vector > SuccCounts; + std::vector > SuccCounts; const TerminatorInst *TI = BB->getTerminator(); - map::iterator I = - EdgeFreqs.lower_bound(make_pair(const_cast(BB), 0U)); + std::map::iterator I = + EdgeFreqs.lower_bound(std::make_pair(const_cast(BB), 0U)); for (; I != EdgeFreqs.end() && I->first.first == BB; ++I) if (I->second) - SuccCounts.push_back(make_pair(TI->getSuccessor(I->first.second), + SuccCounts.push_back(std::make_pair(TI->getSuccessor(I->first.second), I->second)); if (!SuccCounts.empty()) { OS << "\t;;; Out-edge counts:"; @@ -113,25 +112,26 @@ sys::PrintStackTraceOnErrorSignal(); // Read in the bytecode file... - string ErrorMessage; + std::string ErrorMessage; Module *M = ParseBytecodeFile(BytecodeFile, &ErrorMessage); if (M == 0) { - cerr << argv[0] << ": " << BytecodeFile << ": " << ErrorMessage << "\n"; + std::cerr << argv[0] << ": " << BytecodeFile << ": " + << ErrorMessage << "\n"; return 1; } // Read the profiling information ProfileInfoLoader PI(argv[0], ProfileDataFile, *M); - map FuncFreqs; - map BlockFreqs; - map EdgeFreqs; + std::map FuncFreqs; + std::map BlockFreqs; + std::map EdgeFreqs; // Output a report. Eventually, there will be multiple reports selectable on // the command line, for now, just keep things simple. // Emit the most frequent function table... - vector > FunctionCounts; + std::vector > FunctionCounts; PI.getFunctionCounts(FunctionCounts); FuncFreqs.insert(FunctionCounts.begin(), FunctionCounts.end()); @@ -143,41 +143,41 @@ for (unsigned i = 0, e = FunctionCounts.size(); i != e; ++i) TotalExecutions += FunctionCounts[i].second; - cout << "===" << string(73, '-') << "===\n" + std::cout << "===" << std::string(73, '-') << "===\n" << "LLVM profiling output for execution"; - if (PI.getNumExecutions() != 1) cout << "s"; - cout << ":\n"; + if (PI.getNumExecutions() != 1) std::cout << "s"; + std::cout << ":\n"; for (unsigned i = 0, e = PI.getNumExecutions(); i != e; ++i) { - cout << " "; - if (e != 1) cout << i+1 << ". "; - cout << PI.getExecution(i) << "\n"; + std::cout << " "; + if (e != 1) std::cout << i+1 << ". "; + std::cout << PI.getExecution(i) << "\n"; } - cout << "\n===" << string(73, '-') << "===\n"; - cout << "Function execution frequencies:\n\n"; + std::cout << "\n===" << std::string(73, '-') << "===\n"; + std::cout << "Function execution frequencies:\n\n"; // Print out the function frequencies... - cout << " ## Frequency\n"; + std::cout << " ## Frequency\n"; for (unsigned i = 0, e = FunctionCounts.size(); i != e; ++i) { if (FunctionCounts[i].second == 0) { - cout << "\n NOTE: " << e-i << " function" << + std::cout << "\n NOTE: " << e-i << " function" << (e-i-1 ? "s were" : " was") << " never executed!\n"; break; } - cout << setw(3) << i+1 << ". " - << setw(5) << FunctionCounts[i].second << "/" + std::cout << std::setw(3) << i+1 << ". " + << std::setw(5) << FunctionCounts[i].second << "/" << TotalExecutions << " " << FunctionCounts[i].first->getName().c_str() << "\n"; } - set FunctionsToPrint; + std::set FunctionsToPrint; // If we have block count information, print out the LLVM module with // frequency annotations. if (PI.hasAccurateBlockCounts()) { - vector > Counts; + std::vector > Counts; PI.getBlockCounts(Counts); TotalExecutions = 0; @@ -188,20 +188,20 @@ sort(Counts.begin(), Counts.end(), PairSecondSortReverse()); - cout << "\n===" << string(73, '-') << "===\n"; - cout << "Top 20 most frequently executed basic blocks:\n\n"; + std::cout << "\n===" << std::string(73, '-') << "===\n"; + std::cout << "Top 20 most frequently executed basic blocks:\n\n"; // Print out the function frequencies... - cout <<" ## %% \tFrequency\n"; + std::cout <<" ## %% \tFrequency\n"; unsigned BlocksToPrint = Counts.size(); if (BlocksToPrint > 20) BlocksToPrint = 20; for (unsigned i = 0; i != BlocksToPrint; ++i) { if (Counts[i].second == 0) break; Function *F = Counts[i].first->getParent(); - cout << setw(3) << i+1 << ". " - << setw(5) << setprecision(2) + std::cout << std::setw(3) << i+1 << ". " + << std::setw(5) << std::setprecision(2) << Counts[i].second/(double)TotalExecutions*100 << "% " - << setw(5) << Counts[i].second << "/" + << std::setw(5) << Counts[i].second << "/" << TotalExecutions << "\t" << F->getName().c_str() << "() - " << Counts[i].first->getName().c_str() << "\n"; @@ -212,31 +212,31 @@ } if (PI.hasAccurateEdgeCounts()) { - vector > Counts; + std::vector > Counts; PI.getEdgeCounts(Counts); EdgeFreqs.insert(Counts.begin(), Counts.end()); } if (PrintAnnotatedLLVM || PrintAllCode) { - cout << "\n===" << string(73, '-') << "===\n"; - cout << "Annotated LLVM code for the module:\n\n"; + std::cout << "\n===" << std::string(73, '-') << "===\n"; + std::cout << "Annotated LLVM code for the module:\n\n"; ProfileAnnotator PA(FuncFreqs, BlockFreqs, EdgeFreqs); if (FunctionsToPrint.empty() || PrintAllCode) - M->print(cout, &PA); + M->print(std::cout, &PA); else // Print just a subset of the functions... - for (set::iterator I = FunctionsToPrint.begin(), + for (std::set::iterator I = FunctionsToPrint.begin(), E = FunctionsToPrint.end(); I != E; ++I) - (*I)->print(cout, &PA); + (*I)->print(std::cout, &PA); } return 0; - } catch (const string& msg) { - cerr << argv[0] << ": " << msg << "\n"; + } catch (const std::string& msg) { + std::cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } From duraid at octopus.com.au Fri Dec 30 08:57:12 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Fri, 30 Dec 2005 08:57:12 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/SubtargetEmitter.cpp InstrInfoEmitter.cpp Message-ID: <200512301457.IAA09971@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: SubtargetEmitter.cpp updated: 1.14 -> 1.15 InstrInfoEmitter.cpp updated: 1.33 -> 1.34 --- Log message: almost got the HP-UX tester up.. :) --- Diffs of the changes: (+7 -7) InstrInfoEmitter.cpp | 2 +- SubtargetEmitter.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/utils/TableGen/SubtargetEmitter.cpp diff -u llvm/utils/TableGen/SubtargetEmitter.cpp:1.14 llvm/utils/TableGen/SubtargetEmitter.cpp:1.15 --- llvm/utils/TableGen/SubtargetEmitter.cpp:1.14 Thu Nov 3 16:47:42 2005 +++ llvm/utils/TableGen/SubtargetEmitter.cpp Fri Dec 30 08:56:37 2005 @@ -46,7 +46,7 @@ bool isBits) { // Get all records of class and sort std::vector DefList = Records.getAllDerivedDefinitions(ClassName); - sort(DefList.begin(), DefList.end(), LessRecord()); + std::sort(DefList.begin(), DefList.end(), LessRecord()); // Open enumeration OS << "enum {\n"; @@ -81,7 +81,7 @@ // Gather and sort all the features std::vector FeatureList = Records.getAllDerivedDefinitions("SubtargetFeature"); - sort(FeatureList.begin(), FeatureList.end(), LessRecord()); + std::sort(FeatureList.begin(), FeatureList.end(), LessRecord()); // Begin feature table OS << "// Sorted (by key) array of values for CPU features.\n" @@ -126,7 +126,7 @@ // Gather and sort processor information std::vector ProcessorList = Records.getAllDerivedDefinitions("Processor"); - sort(ProcessorList.begin(), ProcessorList.end(), LessRecordFieldName()); + std::sort(ProcessorList.begin(), ProcessorList.end(), LessRecordFieldName()); // Begin processor table OS << "// Sorted (by key) array of values for CPU subtype.\n" @@ -183,7 +183,7 @@ // Gather and sort all itinerary classes std::vector ItinClassList = Records.getAllDerivedDefinitions("InstrItinClass"); - sort(ItinClassList.begin(), ItinClassList.end(), LessRecord()); + std::sort(ItinClassList.begin(), ItinClassList.end(), LessRecord()); // For each itinerary class unsigned N = ItinClassList.size(); @@ -388,7 +388,7 @@ // Gather and sort processor information std::vector ProcessorList = Records.getAllDerivedDefinitions("Processor"); - sort(ProcessorList.begin(), ProcessorList.end(), LessRecordFieldName()); + std::sort(ProcessorList.begin(), ProcessorList.end(), LessRecordFieldName()); // Begin processor table OS << "\n"; @@ -455,7 +455,7 @@ void SubtargetEmitter::ParseFeaturesFunction(std::ostream &OS) { std::vector Features = Records.getAllDerivedDefinitions("SubtargetFeature"); - sort(Features.begin(), Features.end(), LessRecord()); + std::sort(Features.begin(), Features.end(), LessRecord()); OS << "// ParseSubtargetFeatures - Parses features string setting specified\n" "// subtarget options.\n" Index: llvm/utils/TableGen/InstrInfoEmitter.cpp diff -u llvm/utils/TableGen/InstrInfoEmitter.cpp:1.33 llvm/utils/TableGen/InstrInfoEmitter.cpp:1.34 --- llvm/utils/TableGen/InstrInfoEmitter.cpp:1.33 Sat Nov 19 01:05:57 2005 +++ llvm/utils/TableGen/InstrInfoEmitter.cpp Fri Dec 30 08:56:37 2005 @@ -253,7 +253,7 @@ if (!IsItineraries) return; - sort(DefList.begin(), DefList.end(), LessRecord()); + std::sort(DefList.begin(), DefList.end(), LessRecord()); for (unsigned i = 0, N = DefList.size(); i < N; i++) { Record *Def = DefList[i]; From duraid at octopus.com.au Fri Dec 30 10:42:00 2005 From: duraid at octopus.com.au (Duraid Madina) Date: Fri, 30 Dec 2005 10:42:00 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200512301642.KAA10361@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.118 -> 1.119 --- Log message: HP-UX DVDs are crunchy and good to eat --- Diffs of the changes: (+1 -1) DAGISelEmitter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.118 llvm/utils/TableGen/DAGISelEmitter.cpp:1.119 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.118 Thu Dec 29 18:12:56 2005 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Fri Dec 30 10:41:48 2005 @@ -56,7 +56,7 @@ const std::vector &RHS) { if (LHS.size() > RHS.size()) return false; for (unsigned i = 0, e = LHS.size(); i != e; ++i) - if (find(RHS.begin(), RHS.end(), LHS[i]) == RHS.end()) + if (std::find(RHS.begin(), RHS.end(), LHS[i]) == RHS.end()) return false; return true; } From lattner at cs.uiuc.edu Fri Dec 30 14:00:57 2005 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 30 Dec 2005 14:00:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManagerT.h Message-ID: <200512302000.OAA17279@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManagerT.h updated: 1.57 -> 1.58 --- Log message: Patch #1 of Saem Ghani's Pass Manager refactoring. From the man: "All this should do is create what will eventually be the specialised passmanagers. Currently, the templates are inheriting them, once the template specialisations' methods have been absorbed, patches submitted method by method. I'll nuke the specialisations and have the new objects inherit directly from passmanagert, and sanitise the world of all references to templates. " --- Diffs of the changes: (+36 -5) PassManagerT.h | 41 ++++++++++++++++++++++++++++++++++++----- 1 files changed, 36 insertions(+), 5 deletions(-) Index: llvm/lib/VMCore/PassManagerT.h diff -u llvm/lib/VMCore/PassManagerT.h:1.57 llvm/lib/VMCore/PassManagerT.h:1.58 --- llvm/lib/VMCore/PassManagerT.h:1.57 Thu Apr 21 18:46:51 2005 +++ llvm/lib/VMCore/PassManagerT.h Fri Dec 30 14:00:46 2005 @@ -175,7 +175,7 @@ public: PassManagerT(ParentClass *Par = 0) : Parent(Par), Batcher(0) {} - ~PassManagerT() { + virtual ~PassManagerT() { // Delete all of the contained passes... for (typename std::vector::iterator I = Passes.begin(), E = Passes.end(); I != E; ++I) @@ -623,6 +623,16 @@ }; +//===----------------------------------------------------------------------===// +// BasicBlockPassManager +// +// This pass manager is used to group together all of the BasicBlockPass's +// into a single unit. +// +class BasicBlockPassManager { + //TODO:Start absorbing PassManagerTraits +}; + //===----------------------------------------------------------------------===// // PassManagerTraits Specialization @@ -630,7 +640,8 @@ // This pass manager is used to group together all of the BasicBlockPass's // into a single unit. // -template<> class PassManagerTraits : public BasicBlockPass { +template<> class PassManagerTraits : public BasicBlockPass, + public BasicBlockPassManager { public: // PassClass - The type of passes tracked by this PassManager typedef BasicBlockPass PassClass; @@ -677,6 +688,16 @@ }; +//===----------------------------------------------------------------------===// +// FunctionPassManager +// +// This pass manager is used to group together all of the FunctionPass's +// into a single unit. +// +class FunctionPassManagerT { + //TODO:Start absorbing PassManagerTraits +}; + //===----------------------------------------------------------------------===// // PassManagerTraits Specialization @@ -684,7 +705,8 @@ // This pass manager is used to group together all of the FunctionPass's // into a single unit. // -template<> class PassManagerTraits : public FunctionPass { +template<> class PassManagerTraits : public FunctionPass, + public FunctionPassManagerT { public: // PassClass - The type of passes tracked by this PassManager typedef FunctionPass PassClass; @@ -722,13 +744,23 @@ }; +//===----------------------------------------------------------------------===// +// ModulePassManager +// +// This is the top level PassManager implementation that holds generic passes. +// +class ModulePassManager { + //TODO:Start absorbing PassManagerTraits +}; + //===----------------------------------------------------------------------===// // PassManagerTraits Specialization // // This is the top level PassManager implementation that holds generic passes. // -template<> class PassManagerTraits : public ModulePass { +template<> class PassManagerTraits : public ModulePass, + public ModulePassManager { public: // PassClass - The type of passes tracked by this PassManager typedef ModulePass PassClass; @@ -757,7 +789,6 @@ }; - //===----------------------------------------------------------------------===// // PassManagerTraits Method Implementations // From lattner at cs.uiuc.edu Sun Jan 1 15:59:43 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 1 Jan 2006 15:59:43 -0600 Subject: [llvm-commits] CVS: llvm/docs/CodingStandards.html Message-ID: <200601012159.PAA01797@zion.cs.uiuc.edu> Changes in directory llvm/docs: CodingStandards.html updated: 1.25 -> 1.26 --- Log message: Add a section about using namespaces. --- Diffs of the changes: (+36 -21) CodingStandards.html | 57 ++++++++++++++++++++++++++++++++------------------- 1 files changed, 36 insertions(+), 21 deletions(-) Index: llvm/docs/CodingStandards.html diff -u llvm/docs/CodingStandards.html:1.25 llvm/docs/CodingStandards.html:1.26 --- llvm/docs/CodingStandards.html:1.25 Fri Dec 3 18:32:12 2004 +++ llvm/docs/CodingStandards.html Sun Jan 1 15:59:22 2006 @@ -45,9 +45,9 @@
  • The Low Level Issues
    1. Assert Liberally
    2. +
    3. Do not use 'using namespace std'
    4. Prefer Preincrement
    5. Avoid std::endl
    6. -
    7. Exploit C++ to its Fullest
  • See Also
  • @@ -535,6 +535,40 @@ + + + +
    +

    In LLVM, we prefer to explicitly prefix all identifiers from the standard +namespace with an "std::" prefix, rather than rely on "using namespace std;". +

    + +

    In header files, adding a 'using namespace XXX' directive pollutes the +namespace of any source file that includes the header. This is clearly a bad +thing.

    + +

    In implementation files (e.g. .cpp files) the rule is more of a stylistic +rule, but is still important. Basically, using explicit namespace prefixes +makes +the code more clear - because it is immediately obvious what facilities +are being used and where they are coming from - and more portable - +because namespace clashes cannot occur between LLVM code and other namespaces. +The portability rule is important because different standard library +implementations expose different symbols (potentially ones they shouldn't) and +future revisions to the C++ standard will add more symbols to the std +namespace. As such, we never 'using namespace std;' in LLVM.

    + +

    The exception to the general rule (i.e. it's not an exception for the std +namespace) is for implementation files. For example, all of the code in the +LLVM project implements code that lives in the 'llvm' namespace. As such, it +is ok, and actually more clear, for the .cpp files to have a 'using namespace +llvm' directive at their top, after the #includes. The general form of this +rule is that any .cpp file that implements code in any namespace may use that +namespace (and its parents), but should not use any others.

    + +
    @@ -579,25 +613,6 @@
    - - - -
    - -

    C++ is a powerful language. With a firm grasp on its capabilities, you can -make write effective, consise, readable and maintainable code all at the same -time. By staying consistent, you reduce the amount of special cases that need -to be remembered. Reducing the total number of lines of code you write is a -good way to avoid documentation, and avoid giving bugs a place to hide.

    - -

    For these reasons, come to know and love the contents of your local -<algorithm> header file. Know about <functional> -and what it can do for you. C++ is just a tool that wants you to master it.

    - -
    -
    See Also @@ -639,7 +654,7 @@ Chris Lattner
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2004/12/04 00:32:12 $ + Last modified: $Date: 2006/01/01 21:59:22 $ From alenhar2 at cs.uiuc.edu Sun Jan 1 16:14:05 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 1 Jan 2006 16:14:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp Message-ID: <200601012214.QAA01976@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaRegisterInfo.cpp updated: 1.30 -> 1.31 --- Log message: clean this function up some --- Diffs of the changes: (+26 -37) AlphaRegisterInfo.cpp | 63 ++++++++++++++++++++------------------------------ 1 files changed, 26 insertions(+), 37 deletions(-) Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.30 llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.31 --- llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.30 Wed Nov 9 13:17:08 2005 +++ llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp Sun Jan 1 16:13:54 2006 @@ -126,43 +126,32 @@ MachineInstr *AlphaRegisterInfo::foldMemoryOperand(MachineInstr *MI, unsigned OpNum, int FrameIndex) const { - // Make sure this is a reg-reg copy. - unsigned Opc = MI->getOpcode(); - - if ((Opc == Alpha::BIS && - MI->getOperand(1).getReg() == MI->getOperand(2).getReg())) { - if (OpNum == 0) { // move -> store - unsigned InReg = MI->getOperand(1).getReg(); - return BuildMI(Alpha::STQ, 3).addReg(InReg).addFrameIndex(FrameIndex) - .addReg(Alpha::F31); - } else { // load -> move - unsigned OutReg = MI->getOperand(0).getReg(); - return BuildMI(Alpha::LDQ, 2, OutReg).addFrameIndex(FrameIndex) - .addReg(Alpha::F31); - } - } else if ((Opc == Alpha::CPYSS && - MI->getOperand(1).getReg() == MI->getOperand(2).getReg())) { - if (OpNum == 0) { // move -> store - unsigned InReg = MI->getOperand(1).getReg(); - return BuildMI(Alpha::STS, 3).addReg(InReg).addFrameIndex(FrameIndex) - .addReg(Alpha::F31); - } else { // load -> move - unsigned OutReg = MI->getOperand(0).getReg(); - return BuildMI(Alpha::LDS, 2, OutReg).addFrameIndex(FrameIndex) - .addReg(Alpha::F31); - } - } else if ((Opc == Alpha::CPYST && - MI->getOperand(1).getReg() == MI->getOperand(2).getReg())) { - if (OpNum == 0) { // move -> store - unsigned InReg = MI->getOperand(1).getReg(); - return BuildMI(Alpha::STT, 3).addReg(InReg).addFrameIndex(FrameIndex) - .addReg(Alpha::F31); - } else { // load -> move - unsigned OutReg = MI->getOperand(0).getReg(); - return BuildMI(Alpha::LDT, 2, OutReg).addFrameIndex(FrameIndex) - .addReg(Alpha::F31); - } - } + // Make sure this is a reg-reg copy. + unsigned Opc = MI->getOpcode(); + + switch(Opc) { + default: + break; + case Alpha::BIS: + case Alpha::CPYSS: + case Alpha::CPYST: + if (MI->getOperand(1).getReg() == MI->getOperand(2).getReg()) { + if (OpNum == 0) { // move -> store + unsigned InReg = MI->getOperand(1).getReg(); + Opc = (Opc == Alpha::BIS) ? Alpha::STQ : + ((Opc == Alpha::CPYSS) ? Alpha::STS : Alpha::STT); + return BuildMI(Opc, 3).addReg(InReg).addFrameIndex(FrameIndex) + .addReg(Alpha::F31); + } else { // load -> move + unsigned OutReg = MI->getOperand(0).getReg(); + Opc = (Opc == Alpha::BIS) ? Alpha::LDQ : + ((Opc == Alpha::CPYSS) ? Alpha::LDS : Alpha::LDT); + return BuildMI(Opc, 2, OutReg).addFrameIndex(FrameIndex) + .addReg(Alpha::F31); + } + } + break; + } return 0; } From alenhar2 at cs.uiuc.edu Sun Jan 1 16:14:42 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 1 Jan 2006 16:14:42 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/zapnot2.ll Message-ID: <200601012214.QAA01990@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Alpha: zapnot2.ll updated: 1.2 -> 1.3 --- Log message: Change this regression so andi is not a valid codegen of it --- Diffs of the changes: (+1 -1) zapnot2.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/Alpha/zapnot2.ll diff -u llvm/test/Regression/CodeGen/Alpha/zapnot2.ll:1.2 llvm/test/Regression/CodeGen/Alpha/zapnot2.ll:1.3 --- llvm/test/Regression/CodeGen/Alpha/zapnot2.ll:1.2 Fri May 13 10:42:07 2005 +++ llvm/test/Regression/CodeGen/Alpha/zapnot2.ll Sun Jan 1 16:14:31 2006 @@ -5,6 +5,6 @@ long %bar(long %x) { entry: - %tmp.1 = and long %x, 255 ; [#uses=1] + %tmp.1 = and long %x, 16711935 ; [#uses=1] ret long %tmp.1 } From alenhar2 at cs.uiuc.edu Sun Jan 1 16:16:26 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 1 Jan 2006 16:16:26 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp AlphaInstrFormats.td AlphaInstrInfo.td Message-ID: <200601012216.QAA02029@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelDAGToDAG.cpp updated: 1.24 -> 1.25 AlphaInstrFormats.td updated: 1.21 -> 1.22 AlphaInstrInfo.td updated: 1.96 -> 1.97 --- Log message: Move brcond over and fix some imm patterns. This may be the last change before changing the default alpha isel. --- Diffs of the changes: (+166 -160) AlphaISelDAGToDAG.cpp | 85 +++++++++--------- AlphaInstrFormats.td | 17 +++ AlphaInstrInfo.td | 224 ++++++++++++++++++++++++-------------------------- 3 files changed, 166 insertions(+), 160 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp diff -u llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.24 llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.25 --- llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.24 Thu Dec 29 20:30:02 2005 +++ llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Sun Jan 1 16:16:14 2006 @@ -41,7 +41,46 @@ static const int64_t IMM_LOW = -32768; static const int64_t IMM_HIGH = 32767; static const int64_t IMM_MULT = 65536; - + static const int64_t IMM_FULLHIGH = IMM_HIGH + IMM_HIGH * IMM_MULT; + static const int64_t IMM_FULLLOW = IMM_LOW + IMM_LOW * IMM_MULT; + + static int64_t get_ldah16(int64_t x) { + int64_t y = x / IMM_MULT; + if (x % IMM_MULT > IMM_HIGH) + ++y; + return y; + } + + static int64_t get_lda16(int64_t x) { + return x - get_ldah16(x) * IMM_MULT; + } + + static uint64_t get_zapImm(uint64_t x) { + unsigned int build = 0; + for(int i = 0; i < 8; ++i) + { + if ((x & 0x00FF) == 0x00FF) + build |= 1 << i; + else if ((x & 0x00FF) != 0) + { build = 0; break; } + x >>= 8; + } + return x; + } + + static bool isFPZ(SDOperand N) { + ConstantFPSDNode *CN = dyn_cast(N); + return (CN && (CN->isExactlyValue(+0.0) || CN->isExactlyValue(-0.0))); + } + static bool isFPZn(SDOperand N) { + ConstantFPSDNode *CN = dyn_cast(N); + return (CN && CN->isExactlyValue(-0.0)); + } + static bool isFPZp(SDOperand N) { + ConstantFPSDNode *CN = dyn_cast(N); + return (CN && CN->isExactlyValue(+0.0)); + } + public: AlphaDAGToDAGISel(TargetMachine &TM) : SelectionDAGISel(AlphaLowering), AlphaLowering(TM) @@ -154,46 +193,6 @@ CodeGenMap[Op.getValue(1)] = Result.getValue(1); return SDOperand(Result.Val, Op.ResNo); } - case ISD::BRCOND: { - if (N->getOperand(1).getOpcode() == ISD::SETCC && - MVT::isFloatingPoint(N->getOperand(1).getOperand(0).getValueType())) { - SDOperand Chain = Select(N->getOperand(0)); - SDOperand CC1 = Select(N->getOperand(1).getOperand(0)); - SDOperand CC2 = Select(N->getOperand(1).getOperand(1)); - ISD::CondCode cCode= cast(N->getOperand(1).getOperand(2))->get(); - - bool rev = false; - bool isNE = false; - unsigned Opc = Alpha::WTF; - switch(cCode) { - default: N->dump(); assert(0 && "Unknown FP comparison!"); - case ISD::SETEQ: Opc = Alpha::CMPTEQ; break; - case ISD::SETLT: Opc = Alpha::CMPTLT; break; - case ISD::SETLE: Opc = Alpha::CMPTLE; break; - case ISD::SETGT: Opc = Alpha::CMPTLT; rev = true; break; - case ISD::SETGE: Opc = Alpha::CMPTLE; rev = true; break; - case ISD::SETNE: Opc = Alpha::CMPTEQ; isNE = true; break; - }; - SDOperand cmp = CurDAG->getTargetNode(Opc, MVT::f64, - rev?CC2:CC1, - rev?CC1:CC2); - - MachineBasicBlock *Dest = - cast(N->getOperand(2))->getBasicBlock(); - if(isNE) - return CurDAG->SelectNodeTo(N, Alpha::FBEQ, MVT::Other, cmp, - CurDAG->getBasicBlock(Dest), Chain); - else - return CurDAG->SelectNodeTo(N, Alpha::FBNE, MVT::Other, cmp, - CurDAG->getBasicBlock(Dest), Chain); - } - SDOperand Chain = Select(N->getOperand(0)); - SDOperand CC = Select(N->getOperand(1)); - MachineBasicBlock *Dest = - cast(N->getOperand(2))->getBasicBlock(); - return CurDAG->SelectNodeTo(N, Alpha::BNE, MVT::Other, CC, - CurDAG->getBasicBlock(Dest), Chain); - } case ISD::FrameIndex: { int FI = cast(N)->getIndex(); @@ -248,8 +247,8 @@ val >= IMM_LOW + IMM_LOW * IMM_MULT) break; //(LDAH (LDA)) if ((uval >> 32) == 0 && //empty upper bits - val32 <= IMM_HIGH + IMM_HIGH * IMM_MULT && - val32 >= IMM_LOW + IMM_LOW * IMM_MULT) + val32 <= IMM_HIGH + IMM_HIGH * IMM_MULT) + // val32 >= IMM_LOW + IMM_LOW * IMM_MULT) //always true break; //(zext (LDAH (LDA))) //Else use the constant pool MachineConstantPool *CP = BB->getParent()->getConstantPool(); Index: llvm/lib/Target/Alpha/AlphaInstrFormats.td diff -u llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.21 llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.22 --- llvm/lib/Target/Alpha/AlphaInstrFormats.td:1.21 Sun Dec 25 11:36:48 2005 +++ llvm/lib/Target/Alpha/AlphaInstrFormats.td Sun Jan 1 16:16:14 2006 @@ -107,10 +107,23 @@ let Inst{25-21} = Ra; let Inst{20-0} = disp; } +let isBranch = 1, isTerminator = 1 in +class BFormDG opcode, string asmstr, list pattern> + : InstAlpha { + let Pattern = pattern; + + bits<5> Ra; + bits<21> disp; + + let Inst{25-21} = Ra; + let Inst{20-0} = disp; +} let isBranch = 1, isTerminator = 1 in -class FBForm opcode, string asmstr> - : InstAlpha { +class FBForm opcode, string asmstr, list pattern> + : InstAlpha { + let Pattern = pattern; + bits<5> Ra; bits<21> disp; Index: llvm/lib/Target/Alpha/AlphaInstrInfo.td diff -u llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.96 llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.97 --- llvm/lib/Target/Alpha/AlphaInstrInfo.td:1.96 Thu Dec 29 20:30:02 2005 +++ llvm/lib/Target/Alpha/AlphaInstrInfo.td Sun Jan 1 16:16:14 2006 @@ -34,72 +34,56 @@ def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_AlphaCallSeq,[SDNPHasChain]>; def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_AlphaCallSeq,[SDNPHasChain]>; +def SDTFPLeaf : SDTypeProfile<1, 0, [SDTCisFP<0>]>; // for 'fpimm'. +def fpimm : SDNode<"ISD::ConstantFP" , SDTFPLeaf , [], "ConstantFPSDNode">; //******************** //Paterns for matching //******************** -def invX : SDNodeXFormgetValue()); }]>; -def immUExt8 : PatLeaf<(imm), [{ - // immUExt8 predicate - True if the immediate fits in a 8-bit zero extended - // field. Used by instructions like 'addi'. +def negX : SDNodeXFormgetValue() + 1); +}]>; +def SExt32 : SDNodeXFormgetValue() << 32) >> 32); +}]>; +def SExt16 : SDNodeXFormgetValue() << 48) >> 48); +}]>; +def LL16 : SDNodeXFormgetValue())); +}]>; +def LH16 : SDNodeXFormgetValue())); +}]>; +def iZAPX : SDNodeXFormgetValue())); +}]>; + +def immUExt8 : PatLeaf<(imm), [{ //imm fits in 8 bit zero extended field return (uint64_t)N->getValue() == (uint8_t)N->getValue(); }]>; -def immUExt8inv : PatLeaf<(imm), [{ - // immUExt8inv predicate - True if the inverted immediate fits in a 8-bit zero extended - // field. Used by instructions like 'ornoti'. +def immUExt8inv : PatLeaf<(imm), [{ //inverted imm fits in 8 bit zero extended field return (uint64_t)~N->getValue() == (uint8_t)~N->getValue(); }], invX>; -def immSExt16 : PatLeaf<(imm), [{ - // immSExt16 predicate - True if the immediate fits in a 16-bit sign extended - // field. Used by instructions like 'lda'. - return (int64_t)N->getValue() == (int16_t)N->getValue(); -}]>; - -def SExtInt : SDNodeXFormgetValue() << 32) >> 32); +def immUExt8neg : PatLeaf<(imm), [{ //negated imm fits in 8 bit zero extended field + return ((uint64_t)~N->getValue() + 1) == (uint8_t)((uint64_t)~N->getValue() + 1); +}], negX>; +def immSExt16 : PatLeaf<(imm), [{ //imm fits in 16 bit sign extended field + return ((int64_t)N->getValue() << 48) >> 48 == (int64_t)N->getValue(); }]>; - -def immSExt16int : PatLeaf<(imm), [{ - // immSExt16 predicate - True if the immediate fits in a 16-bit sign extended - // field. Used by instructions like 'lda'. - int64_t val = (int64_t)N->getValue(); - uint32_t uval32 = (uint32_t)val; - int32_t val32 = (int32_t)val; - return (int64_t)uval32 == val && val32 == (int16_t)val32; -}], SExtInt>; - - -def iZAPX : SDNodeXFormgetValue(); - unsigned int build = 0; - for(int i = 0; i < 8; ++i) - { - if ((UImm & 0x00FF) == 0x00FF) - build |= 1 << i; - else if ((UImm & 0x00FF) != 0) - { build = 0; break; } - UImm >>= 8; - } - return getI64Imm(build); -}]>; -def immZAP : PatLeaf<(imm), [{ - // immZAP predicate - True if the immediate fits is suitable for use in a - // ZAP instruction - uint64_t UImm = (uint64_t)N->getValue(); - unsigned int build = 0; - for(int i = 0; i < 8; ++i) - { - if ((UImm & 0x00FF) == 0x00FF) - build |= 1 << i; - else if ((UImm & 0x00FF) != 0) - { build = 0; break; } - UImm >>= 8; - } +def immSExt16int : PatLeaf<(imm), [{ //(int)imm fits in a 16 bit sign extended field + return ((int64_t)N->getValue() << 48) >> 48 == ((int64_t)N->getValue() << 32) >> 32; +}], SExt16>; +def immZAP : PatLeaf<(imm), [{ //imm is good for zapi + uint64_t build = get_zapImm((uint64_t)N->getValue()); return build != 0; }], iZAPX>; +def immFPZ : PatLeaf<(fpimm), [{ //the only fpconstant nodes are +/- 0.0 + return true; +}]>; def intop : PatFrag<(ops node:$op), (sext_inreg node:$op, i32)>; def add4 : PatFrag<(ops node:$op1, node:$op2), @@ -111,11 +95,8 @@ def sub8 : PatFrag<(ops node:$op1, node:$op2), (sub (shl node:$op1, 3), node:$op2)>; - // //#define FP $15 - // //#define RA $26 - // //#define PV $27 - // //#define GP $29 - // //#define SP $30 + +//Pseudo ops for selection def PHI : PseudoInstAlpha<(ops variable_ops), "#phi", []>; @@ -127,6 +108,7 @@ [(set F8RC:$RA, (undef))]>; def WTF : PseudoInstAlpha<(ops variable_ops), "#wtf", []>; + let isLoad = 1, hasCtrlDep = 1 in { def ADJUSTSTACKUP : PseudoInstAlpha<(ops s64imm:$amt), "; ADJUP $amt", [(callseq_start imm:$amt)]>; @@ -138,12 +120,7 @@ def MEMLABEL : PseudoInstAlpha<(ops s64imm:$i, s64imm:$j, s64imm:$k, s64imm:$m), "LSMARKER$$$i$$$j$$$k$$$m:\n",[]>; -//***************** -//These are shortcuts, the assembler expands them -//***************** -//AT = R28 -//T0-T7 = R1 - R8 -//T8-T11 = R22-R25 + //An even better improvement on the Int = SetCC(FP): SelectCC! //These are evil because they hide control flow in a MBB @@ -322,11 +299,11 @@ def S8SUBL : OForm< 0x10, 0x1B, "s8subl $RA,$RB,$RC", [(set GPRC:$RC, (intop (sub8 GPRC:$RA, GPRC:$RB)))]>; def S8SUBLi : OFormL<0x10, 0x1B, "s8subl $RA,$L,$RC", - [(set GPRC:$RC, (intop (sub8 GPRC:$RA, immUExt8:$L)))]>; + [(set GPRC:$RC, (intop (add8 GPRC:$RA, immUExt8neg:$L)))]>; def S8SUBQ : OForm< 0x10, 0x3B, "s8subq $RA,$RB,$RC", [(set GPRC:$RC, (sub8 GPRC:$RA, GPRC:$RB))]>; def S8SUBQi : OFormL<0x10, 0x3B, "s8subq $RA,$L,$RC", - [(set GPRC:$RC, (sub8 GPRC:$RA, immUExt8:$L))]>; + [(set GPRC:$RC, (add8 GPRC:$RA, immUExt8neg:$L))]>; def SEXTB : OForm2<0x1C, 0x00, "sextb $RB,$RC", [(set GPRC:$RC, (sext_inreg GPRC:$RB, i8))]>; def SEXTW : OForm2<0x1C, 0x01, "sextw $RB,$RC", @@ -346,11 +323,11 @@ def SUBL : OForm< 0x10, 0x09, "subl $RA,$RB,$RC", [(set GPRC:$RC, (intop (sub GPRC:$RA, GPRC:$RB)))]>; def SUBLi : OFormL<0x10, 0x09, "subl $RA,$L,$RC", - [(set GPRC:$RC, (intop (sub GPRC:$RA, immUExt8:$L)))]>; + [(set GPRC:$RC, (intop (add GPRC:$RA, immUExt8neg:$L)))]>; def SUBQ : OForm< 0x10, 0x29, "subq $RA,$RB,$RC", [(set GPRC:$RC, (sub GPRC:$RA, GPRC:$RB))]>; def SUBQi : OFormL<0x10, 0x29, "subq $RA,$L,$RC", - [(set GPRC:$RC, (sub GPRC:$RA, immUExt8:$L))]>; + [(set GPRC:$RC, (add GPRC:$RA, immUExt8neg:$L))]>; def UMULH : OForm< 0x13, 0x30, "umulh $RA,$RB,$RC", [(set GPRC:$RC, (mulhu GPRC:$RA, GPRC:$RB))]>; def UMULHi : OFormL<0x13, 0x30, "umulh $RA,$L,$RC", @@ -449,10 +426,6 @@ def JSR_COROUTINE : MbrForm< 0x1A, 0x03, (ops GPRC:$RD, GPRC:$RS, s14imm:$DISP), "jsr_coroutine $RD,($RS),$DISP">; //Jump to subroutine return -let Ra = 31 in -def BR : BFormD<0x30, "br $$31,$DISP", [(br bb:$DISP)]>; - - let OperandList = (ops GPRC:$RA, s64imm:$DISP, GPRC:$RB) in { def LDQ : MForm<0x29, 0, 1, "ldq $RA,$DISP($RB)", [(set GPRC:$RA, (load (add GPRC:$RB, immSExt16:$DISP)))]>; @@ -594,24 +567,6 @@ def : Pat<(Alpha_rellit texternalsym:$ext, GPRC:$RB), (LDQl texternalsym:$ext, GPRC:$RB)>; -//Branches, int -def BEQ : BForm<0x39, "beq $RA,$DISP">; //Branch if = zero -def BGE : BForm<0x3E, "bge $RA,$DISP">; //Branch if >= zero -def BGT : BForm<0x3F, "bgt $RA,$DISP">; //Branch if > zero -def BLBC : BForm<0x38, "blbc $RA,$DISP">; //Branch if low bit clear -def BLBS : BForm<0x3C, "blbs $RA,$DISP">; //Branch if low bit set -def BLE : BForm<0x3B, "ble $RA,$DISP">; //Branch if <= zero -def BLT : BForm<0x3A, "blt $RA,$DISP">; //Branch if < zero -def BNE : BForm<0x3D, "bne $RA,$DISP">; //Branch if != zero - -//Branches, float -def FBEQ : FBForm<0x31, "fbeq $RA,$DISP">; //Floating branch if = zero -def FBGE : FBForm<0x36, "fbge $RA,$DISP">; //Floating branch if >= zero -def FBGT : FBForm<0x37, "fbgt $RA,$DISP">; //Floating branch if > zero -def FBLE : FBForm<0x33, "fble $RA,$DISP">; //Floating branch if <= zero -def FBLT : FBForm<0x32, "fblt $RA,$DISP">; //Floating branch if < zero -def FBNE : FBForm<0x35, "fbne $RA,$DISP">; //Floating branch if != zero - def RPCC : MfcForm<0x18, 0xC000, "rpcc $RA">; //Read process cycle counter //Basic Floating point ops @@ -747,6 +702,63 @@ def CVTTS : FPForm<0x16, 0x7AC, "cvtts/sui $RB,$RC", [(set F4RC:$RC, (fround F8RC:$RB))]>; + +///////////////////////////////////////////////////////// +//Branching +///////////////////////////////////////////////////////// +let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, noResults = 1 in { +let Ra = 31 in +def BR : BFormD<0x30, "br $$31,$DISP", [(br bb:$DISP)]>; + +//Branches, int +def BEQ : BFormDG<0x39, "beq $RA,$DISP", + [(brcond (seteq GPRC:$RA, 0), bb:$DISP)]>; +def BGE : BFormDG<0x3E, "bge $RA,$DISP", + [(brcond (setge GPRC:$RA, 0), bb:$DISP)]>; +def BGT : BFormDG<0x3F, "bgt $RA,$DISP", + [(brcond (setgt GPRC:$RA, 0), bb:$DISP)]>; +def BLBC : BFormDG<0x38, "blbc $RA,$DISP", []>; //TODO: Low bit clear +def BLBS : BFormDG<0x3C, "blbs $RA,$DISP", + [(brcond (seteq GPRC:$RA, 1), bb:$DISP)]>; +def BLE : BFormDG<0x3B, "ble $RA,$DISP", + [(brcond (setle GPRC:$RA, 0), bb:$DISP)]>; +def BLT : BFormDG<0x3A, "blt $RA,$DISP", + [(brcond (setlt GPRC:$RA, 0), bb:$DISP)]>; +def BNE : BFormDG<0x3D, "bne $RA,$DISP", + [(brcond (setne GPRC:$RA, 0), bb:$DISP)]>; + +//Branches, float +def FBEQ : FBForm<0x31, "fbeq $RA,$DISP", + [(brcond (seteq F8RC:$RA, immFPZ), bb:$DISP)]>; +def FBGE : FBForm<0x36, "fbge $RA,$DISP", + [(brcond (setge F8RC:$RA, immFPZ), bb:$DISP)]>; +def FBGT : FBForm<0x37, "fbgt $RA,$DISP", + [(brcond (setgt F8RC:$RA, immFPZ), bb:$DISP)]>; +def FBLE : FBForm<0x33, "fble $RA,$DISP", + [(brcond (setle F8RC:$RA, immFPZ), bb:$DISP)]>; +def FBLT : FBForm<0x32, "fblt $RA,$DISP", + [(brcond (setlt F8RC:$RA, immFPZ), bb:$DISP)]>; +def FBNE : FBForm<0x35, "fbne $RA,$DISP", + [(brcond (setne F8RC:$RA, immFPZ), bb:$DISP)]>; +} + +def : Pat<(brcond (and GPRC:$RA, 1), bb:$DISP), (BLBS GPRC:$RA, bb:$DISP)>; +def : Pat<(brcond GPRC:$RA, bb:$DISP), (BNE GPRC:$RA, bb:$DISP)>; +def : Pat<(brcond (seteq F8RC:$RA, F8RC:$RB), bb:$DISP), + (FBNE (CMPTEQ F8RC:$RA, F8RC:$RB), bb:$DISP)>; +def : Pat<(brcond (setlt F8RC:$RA, F8RC:$RB), bb:$DISP), + (FBNE (CMPTLT F8RC:$RA, F8RC:$RB), bb:$DISP)>; +def : Pat<(brcond (setle F8RC:$RA, F8RC:$RB), bb:$DISP), + (FBNE (CMPTLE F8RC:$RA, F8RC:$RB), bb:$DISP)>; +def : Pat<(brcond (setgt F8RC:$RA, F8RC:$RB), bb:$DISP), + (FBNE (CMPTLT F8RC:$RB, F8RC:$RA), bb:$DISP)>; +def : Pat<(brcond (setge F8RC:$RA, F8RC:$RB), bb:$DISP), + (FBNE (CMPTLE F8RC:$RB, F8RC:$RA), bb:$DISP)>; +def : Pat<(brcond (setne F8RC:$RA, F8RC:$RB), bb:$DISP), + (FBEQ (CMPTEQ F8RC:$RA, F8RC:$RB), bb:$DISP)>; + +//End Branches + //S_floating : IEEE Single //T_floating : IEEE Double @@ -794,34 +806,16 @@ def immConst2Part : PatLeaf<(imm), [{ //true if imm fits in a LDAH LDA pair int64_t val = (int64_t)N->getValue(); - return (val <= (int64_t)IMM_HIGH +(int64_t)IMM_HIGH* (int64_t)IMM_MULT & - val >= (int64_t)IMM_LOW + (int64_t)IMM_LOW * (int64_t)IMM_MULT); + return (val <= IMM_FULLHIGH && val >= IMM_FULLLOW); }]>; def immConst2PartInt : PatLeaf<(imm), [{ //true if imm fits in a LDAH LDA pair with zeroext uint64_t uval = N->getValue(); int32_t val32 = (int32_t)uval; return ((uval >> 32) == 0 && //empty upper bits - val32 <= IMM_HIGH + IMM_HIGH * IMM_MULT && - val32 >= IMM_LOW + IMM_LOW * IMM_MULT); -}], SExtInt>; - -//TODO: factor this out -def LL16 : SDNodeXFormgetValue(); - int64_t y = l / IMM_MULT; - if (l % IMM_MULT > IMM_HIGH) - ++y; - return getI64Imm(l - y * IMM_MULT); -}]>; -//TODO: factor this out -def LH16 : SDNodeXFormgetValue(); - int64_t y = l / IMM_MULT; - if (l % IMM_MULT > IMM_HIGH) - ++y; - return getI64Imm(y); -}]>; + val32 <= IMM_FULLHIGH); +// val32 >= IMM_FULLLOW + IMM_LOW * IMM_MULT); //Always True +}], SExt32>; def : Pat<(i64 immConst2Part:$imm), (LDA (LL16 immConst2Part:$imm), (LDAH (LH16 immConst2Part:$imm), R31))>; @@ -830,10 +824,10 @@ (LDA immSExt16:$imm, R31)>; def : Pat<(i64 immSExt16int:$imm), - (ZAPNOTi (LDA (SExtInt immSExt16int:$imm), R31), 15)>; + (ZAPNOTi (LDA (SExt16 immSExt16int:$imm), R31), 15)>; def : Pat<(i64 immConst2PartInt:$imm), - (ZAPNOTi (LDA (LL16 (SExtInt immConst2PartInt:$imm)), - (LDAH (LH16 (SExtInt immConst2PartInt:$imm)), R31)), 15)>; + (ZAPNOTi (LDA (LL16 (SExt16 immConst2PartInt:$imm)), + (LDAH (LH16 (SExt16 immConst2PartInt:$imm)), R31)), 15)>; //TODO: I want to just define these like this! From alenhar2 at cs.uiuc.edu Sun Jan 1 16:16:55 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Sun, 1 Jan 2006 16:16:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetSelectionDAG.td Message-ID: <200601012216.QAA02050@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetSelectionDAG.td updated: 1.37 -> 1.38 --- Log message: Add support for brcond --- Diffs of the changes: (+5 -0) TargetSelectionDAG.td | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/lib/Target/TargetSelectionDAG.td diff -u llvm/lib/Target/TargetSelectionDAG.td:1.37 llvm/lib/Target/TargetSelectionDAG.td:1.38 --- llvm/lib/Target/TargetSelectionDAG.td:1.37 Sat Dec 24 17:36:59 2005 +++ llvm/lib/Target/TargetSelectionDAG.td Sun Jan 1 16:16:43 2006 @@ -131,6 +131,10 @@ SDTCisVT<0, OtherVT> ]>; +def SDTBrcond : SDTypeProfile<0, 2, [ // brcond + SDTCisInt<0>, SDTCisVT<1, OtherVT> +]>; + def SDTRet : SDTypeProfile<0, 0, []>; // ret def SDTReadPort : SDTypeProfile<1, 1, [ // readport @@ -260,6 +264,7 @@ def select : SDNode<"ISD::SELECT" , SDTSelect>; def selectcc : SDNode<"ISD::SELECT_CC" , SDTSelectCC>; +def brcond : SDNode<"ISD::BRCOND" , SDTBrcond, [SDNPHasChain]>; def br : SDNode<"ISD::BR" , SDTBr, [SDNPHasChain]>; def ret : SDNode<"ISD::RET" , SDTRet, [SDNPHasChain]>; From lattner at cs.uiuc.edu Sun Jan 1 16:20:43 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sun, 1 Jan 2006 16:20:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaJITInfo.cpp Message-ID: <200601012220.QAA02467@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaJITInfo.cpp updated: 1.7 -> 1.8 --- Log message: Remove a 'using namespace std'. --- Diffs of the changes: (+4 -5) AlphaJITInfo.cpp | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) Index: llvm/lib/Target/Alpha/AlphaJITInfo.cpp diff -u llvm/lib/Target/Alpha/AlphaJITInfo.cpp:1.7 llvm/lib/Target/Alpha/AlphaJITInfo.cpp:1.8 --- llvm/lib/Target/Alpha/AlphaJITInfo.cpp:1.7 Thu Aug 4 10:32:36 2005 +++ llvm/lib/Target/Alpha/AlphaJITInfo.cpp Sun Jan 1 16:20:31 2006 @@ -20,7 +20,6 @@ #include #include #include -using namespace std; using namespace llvm; #define BUILD_OFormatI(Op, RA, LIT, FUN, RC) \ @@ -240,7 +239,7 @@ //because gpdist are paired and relative to the pc of the first inst, //we need to have some state - static map, void*> gpdistmap; + static std::map, void*> gpdistmap; for (unsigned i = 0; i != NumRelocs; ++i, ++MR) { unsigned *RelocPos = (unsigned*)Function + MR->getMachineCodeOffset()/4; @@ -276,13 +275,13 @@ idx = getUpper16(idx); DEBUG(std::cerr << "LDAH: " << idx << "\n"); //add the relocation to the map - gpdistmap[make_pair(Function, MR->getConstantVal())] = RelocPos; + gpdistmap[std::make_pair(Function, MR->getConstantVal())] = RelocPos; break; case 0x08: //LDA - assert(gpdistmap[make_pair(Function, MR->getConstantVal())] && + assert(gpdistmap[std::make_pair(Function, MR->getConstantVal())] && "LDAg without seeing LDAHg"); idx = &GOTBase[GOToffset * 8] - - (unsigned char*)gpdistmap[make_pair(Function, MR->getConstantVal())]; + (unsigned char*)gpdistmap[std::make_pair(Function, MR->getConstantVal())]; idx = getLower16(idx); DEBUG(std::cerr << "LDA: " << idx << "\n"); break;