From sabre at nondot.org Mon Apr 2 00:09:11 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 00:09:11 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/PowerPC/branch-opt.ll Message-ID: <200704020509.l3259BKU011303@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/PowerPC: branch-opt.ll updated: 1.6 -> 1.7 --- Log message: my patch fixed the fixme. --- Diffs of the changes: (+1 -2) branch-opt.ll | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/test/CodeGen/PowerPC/branch-opt.ll diff -u llvm/test/CodeGen/PowerPC/branch-opt.ll:1.6 llvm/test/CodeGen/PowerPC/branch-opt.ll:1.7 --- llvm/test/CodeGen/PowerPC/branch-opt.ll:1.6 Fri Feb 16 18:44:34 2007 +++ llvm/test/CodeGen/PowerPC/branch-opt.ll Mon Apr 2 00:08:54 2007 @@ -1,6 +1,5 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'b LBB.*' | wc -l | grep 5 -;;; FIXME, 4 unconditional branches is minimal +; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep 'b LBB.*' | wc -l | grep 4 target endian = big target pointersize = 32 From sabre at nondot.org Mon Apr 2 00:35:25 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 00:35:25 -0500 Subject: [llvm-commits] CVS: llvm/test/Transforms/InstCombine/xor.ll Message-ID: <200704020535.l325ZPJD012404@zion.cs.uiuc.edu> Changes in directory llvm/test/Transforms/InstCombine: xor.ll updated: 1.20 -> 1.21 --- Log message: creative way to add one. --- Diffs of the changes: (+6 -0) xor.ll | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/test/Transforms/InstCombine/xor.ll diff -u llvm/test/Transforms/InstCombine/xor.ll:1.20 llvm/test/Transforms/InstCombine/xor.ll:1.21 --- llvm/test/Transforms/InstCombine/xor.ll:1.20 Fri Jan 26 02:25:06 2007 +++ llvm/test/Transforms/InstCombine/xor.ll Mon Apr 2 00:35:08 2007 @@ -190,3 +190,9 @@ ret int %tmp6 } +int %test28(int %indvar) { + %tmp7 = add int %indvar, -2147483647 + %tmp214 = xor int %tmp7, -2147483648 + ret int %tmp214 +} + From sabre at nondot.org Mon Apr 2 00:36:39 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 00:36:39 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704020536.l325adWo012464@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.718 -> 1.719 --- Log message: simplify (x+c)^signbit as (x+c+signbit), pointed out by PR1288: http://llvm.org/PR1288 . This implements test/Transforms/InstCombine/xor.ll:test28 --- Diffs of the changes: (+7 -1) InstructionCombining.cpp | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.718 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.719 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.718 Sun Apr 1 15:57:36 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 2 00:36:22 2007 @@ -4005,7 +4005,7 @@ return BinaryOperator::createOr(Op0NotVal, NotY); } } - + if (ConstantInt *Op0CI = dyn_cast(Op0I->getOperand(1))) if (Op0I->getOpcode() == Instruction::Add) { // ~(X-c) --> (-c-1)-X @@ -4015,6 +4015,12 @@ ConstantExpr::getSub(NegOp0CI, ConstantInt::get(I.getType(), 1)), Op0I->getOperand(0)); + } else if (RHS->getValue().isMinSignedValue()) { + // (X + C) ^ signbit -> (X + C + signbit) + Constant *C = ConstantInt::get(RHS->getValue() + Op0CI->getValue()); + return BinaryOperator::createAdd(Op0I->getOperand(0), C); + + } } else if (Op0I->getOpcode() == Instruction::Or) { // (X|C1)^C2 -> X^(C1|C2) iff X&~C1 == 0 From sabre at nondot.org Mon Apr 2 00:41:17 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 00:41:17 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h Message-ID: <200704020541.l325fHZQ012626@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: APInt.h updated: 1.60 -> 1.61 --- Log message: add a helper function. --- Diffs of the changes: (+3 -0) APInt.h | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/ADT/APInt.h diff -u llvm/include/llvm/ADT/APInt.h:1.60 llvm/include/llvm/ADT/APInt.h:1.61 --- llvm/include/llvm/ADT/APInt.h:1.60 Sun Apr 1 07:45:33 2007 +++ llvm/include/llvm/ADT/APInt.h Mon Apr 2 00:41:00 2007 @@ -272,6 +272,9 @@ /// @returns true if the argument APInt value is a power of two > 0. bool isPowerOf2() const; + /// isSignBit - Return true if this is the value returned by getSignBit. + bool isSignBit() const { return isMinSignedValue(); } + /// This converts the APInt to a boolean value as a test against zero. /// @brief Boolean conversion function. inline bool getBoolValue() const { From sabre at nondot.org Mon Apr 2 00:41:56 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 00:41:56 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200704020541.l325fuqC012671@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.105 -> 1.106 --- Log message: Treat xor of signbit like an add. --- Diffs of the changes: (+10 -1) ScalarEvolution.cpp | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.105 llvm/lib/Analysis/ScalarEvolution.cpp:1.106 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.105 Sat Mar 3 19:25:35 2007 +++ llvm/lib/Analysis/ScalarEvolution.cpp Mon Apr 2 00:41:38 2007 @@ -1427,7 +1427,16 @@ } } break; - + case Instruction::Xor: + // If the RHS of the xor is a signbit, then this is just an add. + // Instcombine turns add of signbit into xor as a strength reduction step. + if (ConstantInt *CI = dyn_cast(I->getOperand(1))) { + if (CI->getValue().isSignBit()) + return SCEVAddExpr::get(getSCEV(I->getOperand(0)), + getSCEV(I->getOperand(1))); + } + break; + case Instruction::Shl: // Turn shift left of a constant amount into a multiply. if (ConstantInt *SA = dyn_cast(I->getOperand(1))) { From sabre at nondot.org Mon Apr 2 00:42:39 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 00:42:39 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704020542.l325gdZG012726@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.719 -> 1.720 --- Log message: use more obvious function name. --- Diffs of the changes: (+1 -1) InstructionCombining.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.719 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.720 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.719 Mon Apr 2 00:36:22 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 2 00:42:22 2007 @@ -4015,7 +4015,7 @@ ConstantExpr::getSub(NegOp0CI, ConstantInt::get(I.getType(), 1)), Op0I->getOperand(0)); - } else if (RHS->getValue().isMinSignedValue()) { + } else if (RHS->getValue().isSignBit()) { // (X + C) ^ signbit -> (X + C + signbit) Constant *C = ConstantInt::get(RHS->getValue() + Op0CI->getValue()); return BinaryOperator::createAdd(Op0I->getOperand(0), C); From sabre at nondot.org Mon Apr 2 00:49:16 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 00:49:16 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704020549.l325nG5k013022@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.720 -> 1.721 --- Log message: Wrap long line --- Diffs of the changes: (+3 -3) InstructionCombining.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.720 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.721 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.720 Mon Apr 2 00:42:22 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 2 00:48:58 2007 @@ -4019,8 +4019,7 @@ // (X + C) ^ signbit -> (X + C + signbit) Constant *C = ConstantInt::get(RHS->getValue() + Op0CI->getValue()); return BinaryOperator::createAdd(Op0I->getOperand(0), C); - - + } } else if (Op0I->getOpcode() == Instruction::Or) { // (X|C1)^C2 -> X^(C1|C2) iff X&~C1 == 0 @@ -6272,7 +6271,8 @@ case Instruction::ZExt: { // We need to emit an AND to clear the high bits. assert(SrcBitSize < DestBitSize && "Not a zext?"); - Constant *C = ConstantInt::get(APInt::getLowBitsSet(DestBitSize, SrcBitSize)); + Constant *C = ConstantInt::get(APInt::getLowBitsSet(DestBitSize, + SrcBitSize)); return BinaryOperator::createAnd(Res, C); } case Instruction::SExt: From sabre at nondot.org Mon Apr 2 00:58:17 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 00:58:17 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/PowerPC/compare-simm.ll Message-ID: <200704020558.l325wHZn013410@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/PowerPC: compare-simm.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+13 -0) compare-simm.ll | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/test/CodeGen/PowerPC/compare-simm.ll diff -c /dev/null llvm/test/CodeGen/PowerPC/compare-simm.ll:1.1 *** /dev/null Mon Apr 2 00:58:09 2007 --- llvm/test/CodeGen/PowerPC/compare-simm.ll Mon Apr 2 00:57:59 2007 *************** *** 0 **** --- 1,13 ---- + ; RUN: llvm-as < %s | llc -march=ppc32 | grep 'cmpwi cr0, r3, -1' + + define i32 @test(i32 %x) { + %c = icmp eq i32 %x, -1 + br i1 %c, label %T, label %F + T: + %A = call i32 @test(i32 123) + %B = add i32 %A, 43 + ret i32 %B + F: + %G = add i32 %x, 1234 + ret i32 %G + } From sabre at nondot.org Mon Apr 2 01:00:00 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 01:00:00 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Message-ID: <200704020600.l3260065013462@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.229 -> 1.230 --- Log message: Fix a bug which caused us to never be able to use signed comparisons for equality comparisons of a constant. This allows us to codegen the 'sintzero' loop in PR1288: http://llvm.org/PR1288 as: LBB1_1: ;cond_next li r4, 0 addi r2, r2, 1 stw r4, 0(r3) addi r3, r3, 4 cmpwi cr0, r2, -1 bne cr0, LBB1_1 ;cond_next instead of: LBB1_1: ;cond_next addi r2, r2, 1 li r4, 0 xoris r5, r2, 65535 stw r4, 0(r3) addi r3, r3, 4 cmplwi cr0, r5, 65535 bne cr0, LBB1_1 ;cond_next This implements CodeGen/PowerPC/compare-simm.ll, and also cuts 74 instructions out of kc++. --- Diffs of the changes: (+1 -1) PPCISelDAGToDAG.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.229 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.230 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.229 Tue Dec 19 16:59:26 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Mon Apr 2 00:59:42 2007 @@ -508,7 +508,7 @@ return SDOperand(CurDAG->getTargetNode(PPC::CMPLWI, MVT::i32, LHS, getI32Imm(Imm & 0xFFFF)), 0); // If this is a 16-bit signed immediate, fold it. - if (isInt16(Imm)) + if (isInt16((int)Imm)) return SDOperand(CurDAG->getTargetNode(PPC::CMPWI, MVT::i32, LHS, getI32Imm(Imm & 0xFFFF)), 0); From reid at x10sys.com Mon Apr 2 01:10:11 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 01:10:11 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704020610.l326ABZc013855@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.22 -> 1.23 --- Log message: Add Devang. --- Diffs of the changes: (+4 -3) DevMtgMay2007.html | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.22 llvm-www/DevMtgMay2007.html:1.23 --- llvm-www/DevMtgMay2007.html:1.22 Sun Apr 1 16:07:53 2007 +++ llvm-www/DevMtgMay2007.html Mon Apr 2 01:09:54 2007 @@ -212,13 +212,14 @@ Chris LattnerApple, Inc. Nick LewyckyIndependent Scott Michel + 2Aerospace + Devang PatelApple, Inc. Reid SpencerIndependent Sarah Thompson + 1NASA, Ames Research Center Bill WendlingApple, Inc. Marcel WeiherMetaObject -

Total confirmed attendees: 13

-

Possible additional attendees: 8

+

Total confirmed attendees: 14

+

Possible additional attendees: 7

@@ -228,6 +229,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
Last modified: $Date: 2007/04/01 21:07:53 $ +
Last modified: $Date: 2007/04/02 06:09:54 $ From sabre at nondot.org Mon Apr 2 01:33:28 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 01:33:28 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/ARM/lsr-scale-addr-mode.ll Message-ID: <200704020633.l326XSbP014774@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/ARM: lsr-scale-addr-mode.ll added (r1.1) --- Log message: new testcase. --- Diffs of the changes: (+19 -0) lsr-scale-addr-mode.ll | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/test/CodeGen/ARM/lsr-scale-addr-mode.ll diff -c /dev/null llvm/test/CodeGen/ARM/lsr-scale-addr-mode.ll:1.1 *** /dev/null Mon Apr 2 01:33:20 2007 --- llvm/test/CodeGen/ARM/lsr-scale-addr-mode.ll Mon Apr 2 01:33:10 2007 *************** *** 0 **** --- 1,19 ---- + ; RUN: llvm-as < %s | llc -march=arm | grep -F 'str r2, [r0, +r3, lsl #2]' + ; Should use scaled addressing mode. + + define void @sintzero(i32* %a) { + entry: + store i32 0, i32* %a + br label %cond_next + + cond_next: ; preds = %cond_next, %entry + %indvar = phi i32 [ 0, %entry ], [ %tmp25, %cond_next ] ; [#uses=1] + %tmp25 = add i32 %indvar, 1 ; [#uses=3] + %tmp36 = getelementptr i32* %a, i32 %tmp25 ; [#uses=1] + store i32 0, i32* %tmp36 + icmp eq i32 %tmp25, -1 ; :0 [#uses=1] + br i1 %0, label %return, label %cond_next + + return: ; preds = %cond_next + ret void + } From sabre at nondot.org Mon Apr 2 01:35:01 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 01:35:01 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200704020635.l326Z1JC014818@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.123 -> 1.124 --- Log message: Pass the type of the store access, not the type of the store, into the target hook. This allows us to codegen a loop as: LBB1_1: @cond_next mov r2, #0 str r2, [r0, +r3, lsl #2] add r3, r3, #1 cmn r3, #1 bne LBB1_1 @cond_next instead of: LBB1_1: @cond_next mov r2, #0 str r2, [r0], #+4 add r3, r3, #1 cmn r3, #1 bne LBB1_1 @cond_next This looks the same, but has one fewer induction variable (and therefore, one fewer register) live in the loop. --- Diffs of the changes: (+9 -2) LoopStrengthReduce.cpp | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.123 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.124 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.123 Sun Apr 1 17:21:39 2007 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Apr 2 01:34:44 2007 @@ -899,8 +899,15 @@ Imm = SC->getValue()->getSExtValue(); else Imm = 0; - if (!TLI->isLegalAddressScaleAndImm(Scale, Imm, - UsersToProcess[i].Inst->getType())) + + // If this is a load or other access, pass the type of the access in. + const Type *AccessTy = Type::VoidTy; + if (StoreInst *SI = dyn_cast(UsersToProcess[i].Inst)) + AccessTy = SI->getOperand(0)->getType(); + else if (LoadInst *LI = dyn_cast(UsersToProcess[i].Inst)) + AccessTy = LI->getType(); + + if (!TLI->isLegalAddressScaleAndImm(Scale, Imm, AccessTy)) return false; } return true; From zhousheng00 at gmail.com Mon Apr 2 03:20:58 2007 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 2 Apr 2007 03:20:58 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704020820.l328Kw6b028937@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.721 -> 1.722 --- Log message: Use uint32_t for bitwidth instead of unsigned. --- Diffs of the changes: (+29 -29) InstructionCombining.cpp | 58 +++++++++++++++++++++++------------------------ 1 files changed, 29 insertions(+), 29 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.721 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.722 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.721 Mon Apr 2 00:48:58 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 2 03:20:41 2007 @@ -1279,7 +1279,7 @@ if (DemandedMask[BitWidth-1] == 0) { // Right fill the mask of bits for this SUB to demand the most // significant bit and all those below it. - unsigned NLZ = DemandedMask.countLeadingZeros(); + uint32_t NLZ = DemandedMask.countLeadingZeros(); APInt DemandedFromOps(APInt::getLowBitsSet(BitWidth, BitWidth-NLZ)); if (SimplifyDemandedBits(I->getOperand(0), DemandedFromOps, LHSKnownZero, LHSKnownOne, Depth+1)) @@ -1871,7 +1871,7 @@ if (ConstantInt *CI = dyn_cast(RHSC)) { // X + (signbit) --> X ^ signbit const APInt& Val = CI->getValue(); - unsigned BitWidth = Val.getBitWidth(); + uint32_t BitWidth = Val.getBitWidth(); if (Val == APInt::getSignBit(BitWidth)) return BinaryOperator::createXor(LHS, RHS); @@ -1893,10 +1893,10 @@ Value *XorLHS = 0; if (isa(RHSC) && match(LHS, m_Xor(m_Value(XorLHS), m_ConstantInt(XorRHS)))) { - unsigned TySizeBits = I.getType()->getPrimitiveSizeInBits(); + uint32_t TySizeBits = I.getType()->getPrimitiveSizeInBits(); const APInt& RHSVal = cast(RHSC)->getValue(); - unsigned Size = TySizeBits / 2; + uint32_t Size = TySizeBits / 2; APInt C0080Val(APInt(TySizeBits, 1ULL).shl(Size - 1)); APInt CFF80Val(-C0080Val); do { @@ -2049,7 +2049,7 @@ // isSignBit - Return true if the value represented by the constant only has the // highest order bit set. static bool isSignBit(ConstantInt *CI) { - unsigned NumBits = CI->getType()->getPrimitiveSizeInBits(); + uint32_t NumBits = CI->getType()->getPrimitiveSizeInBits(); return CI->getValue() == APInt::getSignBit(NumBits); } @@ -2321,8 +2321,8 @@ // If the multiply type is not the same as the source type, sign extend // or truncate to the multiply type. if (I.getType() != V->getType()) { - unsigned SrcBits = V->getType()->getPrimitiveSizeInBits(); - unsigned DstBits = I.getType()->getPrimitiveSizeInBits(); + uint32_t SrcBits = V->getType()->getPrimitiveSizeInBits(); + uint32_t DstBits = I.getType()->getPrimitiveSizeInBits(); Instruction::CastOps opcode = (SrcBits == DstBits ? Instruction::BitCast : (SrcBits < DstBits ? Instruction::SExt : Instruction::Trunc)); @@ -3081,7 +3081,7 @@ // any number of 0s on either side. The 1s are allowed to wrap from LSB to // MSB, so 0x000FFF0, 0x0000FFFF, and 0xFF0000FF are all runs. 0x0F0F0000 is // not, since all 1s are not contiguous. -static bool isRunOfOnes(ConstantInt *Val, unsigned &MB, unsigned &ME) { +static bool isRunOfOnes(ConstantInt *Val, uint32_t &MB, uint32_t &ME) { const APInt& V = Val->getValue(); uint32_t BitWidth = Val->getType()->getBitWidth(); if (!APIntOps::isShiftedMask(BitWidth, V)) return false; @@ -3125,7 +3125,7 @@ // Otherwise, if Mask is 0+1+0+, and if B is known to have the low 0+ // part, we don't need any explicit masks to take them out of A. If that // is all N is, ignore it. - unsigned MB = 0, ME = 0; + uint32_t MB = 0, ME = 0; if (isRunOfOnes(Mask, MB, ME)) { // begin/end bit of run, inclusive uint32_t BitWidth = cast(RHS->getType())->getBitWidth(); APInt Mask(APInt::getLowBitsSet(BitWidth, MB-1)); @@ -4844,7 +4844,7 @@ case Instruction::Shl: // (icmp pred (shl X, ShAmt), CI) if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { if (I.isEquality()) { - unsigned TypeBits = CI->getType()->getPrimitiveSizeInBits(); + uint32_t TypeBits = CI->getType()->getPrimitiveSizeInBits(); // Check that the shift amount is in range. If not, don't perform // undefined shifts. When the shift is visited it will be @@ -4865,8 +4865,8 @@ if (LHSI->hasOneUse()) { // Otherwise strength reduce the shift into an and. uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); - uint64_t Val = (1ULL << (TypeBits-ShAmtVal))-1; - Constant *Mask = ConstantInt::get(CI->getType(), Val); + Constant *Mask = ConstantInt::get( + APInt::getLowBitsSet(TypeBits, TypeBits-ShAmtVal)); Instruction *AndI = BinaryOperator::createAnd(LHSI->getOperand(0), @@ -4886,7 +4886,7 @@ // Check that the shift amount is in range. If not, don't perform // undefined shifts. When the shift is visited it will be // simplified. - unsigned TypeBits = CI->getType()->getPrimitiveSizeInBits(); + uint32_t TypeBits = CI->getType()->getPrimitiveSizeInBits(); if (ShAmt->uge(TypeBits)) break; @@ -5180,7 +5180,7 @@ if (CastInst *Cast = dyn_cast(Op0)) { Value *CastOp = Cast->getOperand(0); const Type *SrcTy = CastOp->getType(); - unsigned SrcTySize = SrcTy->getPrimitiveSizeInBits(); + uint32_t SrcTySize = SrcTy->getPrimitiveSizeInBits(); if (SrcTy->isInteger() && SrcTySize == Cast->getType()->getPrimitiveSizeInBits()) { // If this is an unsigned comparison, try to make the comparison use @@ -5747,7 +5747,7 @@ if (ShiftAmt1 == 0) return 0; // Will be simplified in the future. Value *X = ShiftOp->getOperand(0); - unsigned AmtSum = ShiftAmt1+ShiftAmt2; // Fold into one big shift. + uint32_t AmtSum = ShiftAmt1+ShiftAmt2; // Fold into one big shift. if (AmtSum > TypeBits) AmtSum = TypeBits; @@ -5808,7 +5808,7 @@ } // Otherwise, we can't handle it yet. } else if (ShiftAmt1 < ShiftAmt2) { - unsigned ShiftDiff = ShiftAmt2-ShiftAmt1; + uint32_t ShiftDiff = ShiftAmt2-ShiftAmt1; // (X >>? C1) << C2 --> X << (C2-C1) & (-1 << C2) if (I.getOpcode() == Instruction::Shl) { @@ -5836,7 +5836,7 @@ // We can't handle (X << C1) >>s C2, it shifts arbitrary bits in. } else { assert(ShiftAmt2 < ShiftAmt1); - unsigned ShiftDiff = ShiftAmt1-ShiftAmt2; + uint32_t ShiftDiff = ShiftAmt1-ShiftAmt2; // (X >>? C1) << C2 --> X >>? (C1-C2) & (-1 << C2) if (I.getOpcode() == Instruction::Shl) { @@ -6209,8 +6209,8 @@ Value *Src = CI.getOperand(0); const Type *SrcTy = Src->getType(); const Type *DestTy = CI.getType(); - unsigned SrcBitSize = SrcTy->getPrimitiveSizeInBits(); - unsigned DestBitSize = DestTy->getPrimitiveSizeInBits(); + uint32_t SrcBitSize = SrcTy->getPrimitiveSizeInBits(); + uint32_t DestBitSize = DestTy->getPrimitiveSizeInBits(); // See if we can simplify any instructions used by the LHS whose sole // purpose is to compute bits we don't care about. @@ -6406,7 +6406,7 @@ return ReplaceInstUsesWith(CI, Res); } - unsigned ShiftAmt = KnownZeroMask.logBase2(); + uint32_t ShiftAmt = KnownZeroMask.logBase2(); Value *In = Op0; if (ShiftAmt) { // Perform a logical shr by shiftamt. @@ -6441,8 +6441,8 @@ Value *Src = CI.getOperand(0); const Type *Ty = CI.getType(); - unsigned DestBitWidth = Ty->getPrimitiveSizeInBits(); - unsigned SrcBitWidth = cast(Src->getType())->getBitWidth(); + uint32_t DestBitWidth = Ty->getPrimitiveSizeInBits(); + uint32_t SrcBitWidth = cast(Src->getType())->getBitWidth(); if (Instruction *SrcI = dyn_cast(Src)) { switch (SrcI->getOpcode()) { @@ -6507,9 +6507,9 @@ if (isa(CSrc)) { // Get the sizes of the types involved Value *A = CSrc->getOperand(0); - unsigned SrcSize = A->getType()->getPrimitiveSizeInBits(); - unsigned MidSize = CSrc->getType()->getPrimitiveSizeInBits(); - unsigned DstSize = CI.getType()->getPrimitiveSizeInBits(); + uint32_t SrcSize = A->getType()->getPrimitiveSizeInBits(); + uint32_t MidSize = CSrc->getType()->getPrimitiveSizeInBits(); + uint32_t DstSize = CI.getType()->getPrimitiveSizeInBits(); // If we're actually extending zero bits and the trunc is a no-op if (MidSize < DstSize && SrcSize == DstSize) { // Replace both of the casts with an And of the type mask. @@ -6838,7 +6838,7 @@ CanXForm = CmpCst->isZero() && IC->getPredicate() == ICmpInst::ICMP_SLT; else { - unsigned Bits = CmpCst->getType()->getPrimitiveSizeInBits(); + uint32_t Bits = CmpCst->getType()->getPrimitiveSizeInBits(); CanXForm = CmpCst->getValue() == APInt::getSignedMaxValue(Bits) && IC->getPredicate() == ICmpInst::ICMP_UGT; } @@ -6847,7 +6847,7 @@ // The comparison constant and the result are not neccessarily the // same width. Make an all-ones value by inserting a AShr. Value *X = IC->getOperand(0); - unsigned Bits = X->getType()->getPrimitiveSizeInBits(); + uint32_t Bits = X->getType()->getPrimitiveSizeInBits(); Constant *ShAmt = ConstantInt::get(X->getType(), Bits-1); Instruction *SRA = BinaryOperator::create(Instruction::AShr, X, ShAmt, "ones"); @@ -6856,8 +6856,8 @@ // Finally, convert to the type of the select RHS. We figure out // if this requires a SExt, Trunc or BitCast based on the sizes. Instruction::CastOps opc = Instruction::BitCast; - unsigned SRASize = SRA->getType()->getPrimitiveSizeInBits(); - unsigned SISize = SI.getType()->getPrimitiveSizeInBits(); + uint32_t SRASize = SRA->getType()->getPrimitiveSizeInBits(); + uint32_t SISize = SI.getType()->getPrimitiveSizeInBits(); if (SRASize < SISize) opc = Instruction::SExt; else if (SRASize > SISize) From zhousheng00 at gmail.com Mon Apr 2 08:45:48 2007 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Mon, 2 Apr 2007 08:45:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704021345.l32Djmxb009604@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.722 -> 1.723 --- Log message: 1. Make use of APInt operation instead of using ConstantExpr::getXXX. 2. Use cheaper APInt methods. --- Diffs of the changes: (+19 -26) InstructionCombining.cpp | 45 +++++++++++++++++++-------------------------- 1 files changed, 19 insertions(+), 26 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.722 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.723 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.722 Mon Apr 2 03:20:41 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 2 08:45:30 2007 @@ -522,7 +522,7 @@ // Constants can be considered to be not'ed values... if (ConstantInt *C = dyn_cast(V)) - return ConstantExpr::getNot(C); + return ConstantInt::get(~C->getValue()); return 0; } @@ -844,16 +844,14 @@ "Ty, KnownZero, KnownOne and Min, Max must have equal bitwidth."); APInt UnknownBits = ~(KnownZero|KnownOne); - APInt SignBit(APInt::getSignBit(BitWidth)); - // The minimum value is when all unknown bits are zeros, EXCEPT for the sign // bit if it is unknown. Min = KnownOne; Max = KnownOne|UnknownBits; if (UnknownBits[BitWidth-1]) { // Sign bit is unknown - Min |= SignBit; - Max &= ~SignBit; + Min.set(BitWidth-1); + Max.clear(BitWidth-1); } } @@ -1133,7 +1131,6 @@ const IntegerType *SrcTy = cast(I->getOperand(0)->getType()); uint32_t SrcBitWidth = SrcTy->getBitWidth(); - DemandedMask &= SrcTy->getMask().zext(BitWidth); DemandedMask.trunc(SrcBitWidth); RHSKnownZero.trunc(SrcBitWidth); RHSKnownOne.trunc(SrcBitWidth); @@ -1154,9 +1151,6 @@ const IntegerType *SrcTy = cast(I->getOperand(0)->getType()); uint32_t SrcBitWidth = SrcTy->getBitWidth(); - // Get the sign bit for the source type - APInt InSignBit(APInt::getSignBit(SrcBitWidth)); - InSignBit.zext(BitWidth); APInt InputDemandedBits = DemandedMask & APInt::getLowBitsSet(BitWidth, SrcBitWidth); @@ -1164,7 +1158,7 @@ // If any of the sign extended bits are demanded, we know that the sign // bit is demanded. if ((NewBits & DemandedMask) != 0) - InputDemandedBits |= InSignBit; + InputDemandedBits.set(SrcBitWidth-1); InputDemandedBits.trunc(SrcBitWidth); RHSKnownZero.trunc(SrcBitWidth); @@ -3652,7 +3646,8 @@ Instruction *Or = BinaryOperator::createOr(X, RHS); InsertNewInstBefore(Or, I); Or->takeName(Op0); - return BinaryOperator::createAnd(Or, ConstantExpr::getOr(RHS, C1)); + return BinaryOperator::createAnd(Or, + ConstantInt::get(RHS->getValue() | C1->getValue())); } // (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2) @@ -3661,7 +3656,7 @@ InsertNewInstBefore(Or, I); Or->takeName(Op0); return BinaryOperator::createXor(Or, - ConstantExpr::getAnd(C1, ConstantExpr::getNot(RHS))); + ConstantInt::get(C1->getValue() & ~RHS->getValue())); } // Try to fold constant and into select arguments. @@ -3716,13 +3711,14 @@ match(Op1, m_And(m_Value(B), m_ConstantInt(C2)))) { if (A == B) // (A & C1)|(A & C2) == A & (C1|C2) - return BinaryOperator::createAnd(A, ConstantExpr::getOr(C1, C2)); + return BinaryOperator::createAnd(A, + ConstantInt::get(C1->getValue() | C2->getValue())); // If we have: ((V + N) & C1) | (V & C2) // .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0 // replace with V+N. - if (C1 == ConstantExpr::getNot(C2)) { + if (C1->getValue() == ~C2->getValue()) { Value *V1 = 0, *V2 = 0; if ((C2->getValue() & (C2->getValue()+1)) == 0 && // C2 == 0+1+ match(A, m_Add(m_Value(V1), m_Value(V2)))) { @@ -3826,7 +3822,7 @@ Instruction *Add = BinaryOperator::createAdd(LHSVal, AddCST, LHSVal->getName()+".off"); InsertNewInstBefore(Add, I); - AddCST = ConstantExpr::getSub(AddOne(RHSCst), LHSCst); + AddCST = Subtract(AddOne(RHSCst), LHSCst); return new ICmpInst(ICmpInst::ICMP_ULT, Add, AddCST); } break; // (X == 13 | X == 15) -> no change @@ -4027,7 +4023,7 @@ Constant *NewRHS = ConstantExpr::getOr(Op0CI, RHS); // Anything in both C1 and C2 is known to be zero, remove it from // NewRHS. - Constant *CommonBits = ConstantExpr::getAnd(Op0CI, RHS); + Constant *CommonBits = And(Op0CI, RHS); NewRHS = ConstantExpr::getAnd(NewRHS, ConstantExpr::getNot(CommonBits)); AddToWorkList(Op0I); @@ -4196,7 +4192,7 @@ /// overflowed for this type. static bool AddWithOverflow(ConstantInt *&Result, ConstantInt *In1, ConstantInt *In2, bool IsSigned = false) { - Result = cast(ConstantExpr::getAdd(In1, In2)); + Result = cast(Add(In1, In2)); if (IsSigned) if (In2->getValue().isNegative()) @@ -4956,8 +4952,7 @@ // of form X/C1=C2. We solve for X by multiplying C1 (DivRHS) and // C2 (CI). By solving for X we can turn this into a range check // instead of computing a divide. - ConstantInt *Prod = - cast(ConstantExpr::getMul(CI, DivRHS)); + ConstantInt *Prod = Multiply(CI, DivRHS); // Determine if the product overflows by seeing if the product is // not equal to the divide. Make sure we do the same kind of divide @@ -5005,7 +5000,7 @@ } else { // (X / neg) op neg LoBound = Prod; LoOverflow = HiOverflow = ProdOV; - HiBound = cast(ConstantExpr::getSub(Prod, DivRHS)); + HiBound = Subtract(Prod, DivRHS); } // Dividing by a negate swaps the condition. @@ -5085,7 +5080,7 @@ if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { if (BO->hasOneUse()) return new ICmpInst(I.getPredicate(), BO->getOperand(0), - ConstantExpr::getSub(CI, BOp1C)); + Subtract(CI, BOp1C)); } else if (CI->isNullValue()) { // Replace ((add A, B) != 0) with (A != -B) if A or B is // efficiently invertible, or if the add has just this one use. @@ -5133,8 +5128,7 @@ if (ConstantInt *BOC = dyn_cast(BO->getOperand(1))) { // If bits are being compared against that are and'd out, then the // comparison can never succeed! - if (!ConstantExpr::getAnd(CI, - ConstantExpr::getNot(BOC))->isNullValue()) + if (!And(CI, ConstantInt::get(~BOC->getValue()))->isZero()) return ReplaceInstUsesWith(I, ConstantInt::get(Type::Int1Ty, isICMP_NE)); @@ -5323,7 +5317,7 @@ if (ConstantInt *C1 = dyn_cast(B)) if (ConstantInt *C2 = dyn_cast(D)) if (Op1->hasOneUse()) { - Constant *NC = ConstantExpr::getXor(C1, C2); + Constant *NC = ConstantInt::get(C1->getValue() ^ C2->getValue()); Instruction *Xor = BinaryOperator::createXor(C, NC, "tmp"); return new ICmpInst(I.getPredicate(), A, InsertNewInstBefore(Xor, I)); @@ -5975,8 +5969,7 @@ // If the allocation size is constant, form a constant mul expression Amt = ConstantInt::get(Type::Int32Ty, Scale); if (isa(NumElements)) - Amt = ConstantExpr::getMul( - cast(NumElements), cast(Amt)); + Amt = Multiply(cast(NumElements), cast(Amt)); // otherwise multiply the amount and the number of elements else if (Scale != 1) { Instruction *Tmp = BinaryOperator::createMul(Amt, NumElements, "tmp"); From reid at x10sys.com Mon Apr 2 09:28:51 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 09:28:51 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704021428.l32ESp2a011928@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.23 -> 1.24 --- Log message: Add Mark Schimmel. --- Diffs of the changes: (+4 -3) DevMtgMay2007.html | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.23 llvm-www/DevMtgMay2007.html:1.24 --- llvm-www/DevMtgMay2007.html:1.23 Mon Apr 2 01:09:54 2007 +++ llvm-www/DevMtgMay2007.html Mon Apr 2 09:28:34 2007 @@ -213,13 +213,14 @@ Nick LewyckyIndependent Scott Michel + 2Aerospace Devang PatelApple, Inc. + Mark SchimmelWind River Reid SpencerIndependent Sarah Thompson + 1NASA, Ames Research Center Bill WendlingApple, Inc. Marcel WeiherMetaObject -

Total confirmed attendees: 14

-

Possible additional attendees: 7

+

Total confirmed attendees: 15

+

Possible additional attendees: 6

@@ -229,6 +230,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
Last modified: $Date: 2007/04/02 06:09:54 $ +
Last modified: $Date: 2007/04/02 14:28:34 $ From reid at x10sys.com Mon Apr 2 10:40:56 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 10:40:56 -0500 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200704021540.l32FeuW7014674@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.267 -> 1.268 --- Log message: Check for .svn directories too to determine if a debug build is appropriate. --- Diffs of the changes: (+3 -3) configure.ac | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.267 llvm/autoconf/configure.ac:1.268 --- llvm/autoconf/configure.ac:1.267 Thu Mar 29 10:37:57 2007 +++ llvm/autoconf/configure.ac Mon Apr 2 10:40:39 2007 @@ -235,13 +235,13 @@ AC_SUBST(LLVM_CROSS_COMPILING, [0]) fi -dnl Check to see if there's a "CVS" directory indicating that this build is -dnl being done from a CVS checkout. This sets up several defaults for the +dnl Check to see if there's a "CVS" (or .svn) directory indicating that this +dnl build is being done from a checkout. This sets up several defaults for the dnl command line switches. When we build with a CVS directory, we get a dnl debug with assertions turned on. Without, we assume a source release and we dnl get an optimized build without assertions. See --enable-optimized and dnl --enable-assertions below -if test -d "CVS" -o -d "${srcdir}/CVS"; then +if test -d "CVS" -o -d "${srcdir}/CVS" -o -d ".svn" -o -d "${srcdir}/.svn"; then cvsbuild="yes" optimize="no" AC_SUBST(CVSBUILD,[[CVSBUILD=1]]) From reid at x10sys.com Mon Apr 2 10:41:56 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 10:41:56 -0500 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200704021541.l32FfurC014725@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.272 -> 1.273 --- Log message: Regenerate. --- Diffs of the changes: (+1 -1) configure | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/configure diff -u llvm/configure:1.272 llvm/configure:1.273 --- llvm/configure:1.272 Thu Mar 29 10:38:33 2007 +++ llvm/configure Mon Apr 2 10:41:39 2007 @@ -4535,7 +4535,7 @@ fi -if test -d "CVS" -o -d "${srcdir}/CVS"; then +if test -d "CVS" -o -d "${srcdir}/CVS" -o -d ".svn" -o -d "${srcdir}/.svn"; then cvsbuild="yes" optimize="no" CVSBUILD=CVSBUILD=1 From reid at x10sys.com Mon Apr 2 10:49:55 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 10:49:55 -0500 Subject: [llvm-commits] CVS: llvm-www/developers.txt Message-ID: <200704021549.l32FntRJ015200@zion.cs.uiuc.edu> Changes in directory llvm-www: developers.txt updated: 1.11 -> 1.12 --- Log message: Add Zhou Sheng to the developer's list. --- Diffs of the changes: (+1 -0) developers.txt | 1 + 1 files changed, 1 insertion(+) Index: llvm-www/developers.txt diff -u llvm-www/developers.txt:1.11 llvm-www/developers.txt:1.12 --- llvm-www/developers.txt:1.11 Sat Mar 17 12:14:55 2007 +++ llvm-www/developers.txt Mon Apr 2 10:49:38 2007 @@ -19,3 +19,4 @@ Devang Patel href=mailto:dpatel at apple.com img=PhotoDevang.jpg width=145 height=172 alt=Devang Reid Spencer href=http://illuvium.net/rspencer/ img=PhotoReid.jpg width=145 height=172 alt=Reid Bill Wendling href=http://www.isanbard.org/~wendling/ img=PhotoBill.jpg width=173 height=240 alt=Bill +Sheng Zhou href=mailto:zhousheng at gmail.com img=PhotoSheng.jpg width=200 height=231 alt=Sheng From reid at x10sys.com Mon Apr 2 10:57:52 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 10:57:52 -0500 Subject: [llvm-commits] CVS: llvm-www/img/PhotoSheng.jpg Message-ID: <200704021557.l32Fvq5f015613@zion.cs.uiuc.edu> Changes in directory llvm-www/img: PhotoSheng.jpg added (r1.1) --- Log message: Add Sheng's picture. --- Diffs of the changes: (+0 -0) PhotoSheng.jpg | 0 1 files changed Index: llvm-www/img/PhotoSheng.jpg From dpatel at apple.com Mon Apr 2 11:54:29 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 2 Apr 2007 11:54:29 -0500 Subject: [llvm-commits] CVS: llvm/docs/LinkTimeOptimization.html Message-ID: <200704021654.l32GsTHK017827@zion.cs.uiuc.edu> Changes in directory llvm/docs: LinkTimeOptimization.html updated: 1.10 -> 1.11 --- Log message: Update example notes to clarify system linker's role. --- Diffs of the changes: (+4 -2) LinkTimeOptimization.html | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/docs/LinkTimeOptimization.html diff -u llvm/docs/LinkTimeOptimization.html:1.10 llvm/docs/LinkTimeOptimization.html:1.11 --- llvm/docs/LinkTimeOptimization.html:1.10 Fri Oct 27 18:06:27 2006 +++ llvm/docs/LinkTimeOptimization.html Mon Apr 2 11:54:12 2007 @@ -83,7 +83,9 @@

The following example illustrates the advantages of LTO's integrated - approach and clean interface.

+ approach and clean interface. This example requires optimization support, + using interface described in this document, from system linker. Here, + llvm-gcc4 transparantly invokes system linker.

  • Input source file a.c is compiled into LLVM byte code form.
  • Input source file main.c is compiled into native object code. @@ -383,7 +385,7 @@ Devang Patel
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/10/27 23:06:27 $ + Last modified: $Date: 2007/04/02 16:54:12 $ From asl at math.spbu.ru Mon Apr 2 11:55:02 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 2 Apr 2007 11:55:02 -0500 Subject: [llvm-commits] CVS: llvm-www/img/PhotoAnton.jpg Message-ID: <200704021655.l32Gt2PN017956@zion.cs.uiuc.edu> Changes in directory llvm-www/img: PhotoAnton.jpg added (r1.1) --- Log message: Add myself to the developer's list --- Diffs of the changes: (+0 -0) PhotoAnton.jpg | 0 1 files changed Index: llvm-www/img/PhotoAnton.jpg From asl at math.spbu.ru Mon Apr 2 11:55:04 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 2 Apr 2007 11:55:04 -0500 Subject: [llvm-commits] CVS: llvm-www/developers.txt Message-ID: <200704021655.l32Gt4Ym017961@zion.cs.uiuc.edu> Changes in directory llvm-www: developers.txt updated: 1.12 -> 1.13 --- Log message: Add myself to the developer's list --- Diffs of the changes: (+1 -0) developers.txt | 1 + 1 files changed, 1 insertion(+) Index: llvm-www/developers.txt diff -u llvm-www/developers.txt:1.12 llvm-www/developers.txt:1.13 --- llvm-www/developers.txt:1.12 Mon Apr 2 10:49:38 2007 +++ llvm-www/developers.txt Mon Apr 2 11:54:45 2007 @@ -11,6 +11,7 @@ Brian Gaeke href=http://netfiles.uiuc.edu/gaeke/www/ img=PhotoBrian.png width=155 height=163 alt=brg Patrick Jenkins href=http://www.patjenk.com img=PhotoPatJenk.jpg width=200 width=173 height=130 alt=PatJenk Brad Jones href=http://www.nondot.org/~kungfoomaster/ img=PhotoBrad.jpg width=200 height=171 alt=KungFooMaster +Anton Korobeynikov href=mailto:asl_at_math_dot_spbu_dot_ru img=PhotoAnton.jpg width=239 height=207 alt=Anton Jim Laskey href=mailto:jlaskey at mac.com img=PhotoJim.jpg width=128 height=128 alt=Wickund Chris Lattner href=http://nondot.org/sabre/LLVMNotes/ img=PhotoChris.jpg width=150 height=152 alt=Sabre Tanya Lattner href=http://nondot.org/tonic/ img=PhotoTanya.jpg width=200 height=217 alt=tonic From reid at x10sys.com Mon Apr 2 11:58:09 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 11:58:09 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704021658.l32Gw9lQ018261@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.24 -> 1.25 --- Log message: Add Devang's talk on the PassManager. --- Diffs of the changes: (+3 -1) DevMtgMay2007.html | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.24 llvm-www/DevMtgMay2007.html:1.25 --- llvm-www/DevMtgMay2007.html:1.24 Mon Apr 2 09:28:34 2007 +++ llvm-www/DevMtgMay2007.html Mon Apr 2 11:57:52 2007 @@ -104,6 +104,8 @@ Nick Lewycky Design and implementation of the PredicateSimplifier pass, or, "VRP in LLVM" + Devang Patel + Demystifying the LLVM Pass Manager
@@ -230,6 +232,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
Last modified: $Date: 2007/04/02 14:28:34 $ +
Last modified: $Date: 2007/04/02 16:57:52 $ From reid at x10sys.com Mon Apr 2 12:18:41 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 12:18:41 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704021718.l32HIfNs019047@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.25 -> 1.26 --- Log message: Add Robert Hundt. --- Diffs of the changes: (+3 -2) DevMtgMay2007.html | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.25 llvm-www/DevMtgMay2007.html:1.26 --- llvm-www/DevMtgMay2007.html:1.25 Mon Apr 2 11:57:52 2007 +++ llvm-www/DevMtgMay2007.html Mon Apr 2 12:18:24 2007 @@ -211,6 +211,7 @@ Owen AndersonIndependent Ryan BrownGoogle Jeff CohenIndependent + Robert HundtGoogle Chris LattnerApple, Inc. Nick LewyckyIndependent Scott Michel + 2Aerospace @@ -221,7 +222,7 @@ Bill WendlingApple, Inc. Marcel WeiherMetaObject -

Total confirmed attendees: 15

+

Total confirmed attendees: 16

Possible additional attendees: 6

@@ -232,6 +233,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
Last modified: $Date: 2007/04/02 16:57:52 $ +
Last modified: $Date: 2007/04/02 17:18:24 $ From sabre at nondot.org Mon Apr 2 12:24:25 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 12:24:25 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <200704021724.l32HOPGi019286@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelLowering.cpp updated: 1.35 -> 1.36 --- Log message: add support for the 'w' inline asm register class. --- Diffs of the changes: (+28 -6) ARMISelLowering.cpp | 34 ++++++++++++++++++++++++++++------ 1 files changed, 28 insertions(+), 6 deletions(-) Index: llvm/lib/Target/ARM/ARMISelLowering.cpp diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.35 llvm/lib/Target/ARM/ARMISelLowering.cpp:1.36 --- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.35 Sun Apr 1 20:30:03 2007 +++ llvm/lib/Target/ARM/ARMISelLowering.cpp Mon Apr 2 12:24:08 2007 @@ -1598,6 +1598,7 @@ switch (Constraint[0]) { default: break; case 'l': return C_RegisterClass; + case 'w': return C_RegisterClass; } } return TargetLowering::getConstraintType(Constraint); @@ -1609,12 +1610,17 @@ if (Constraint.size() == 1) { // GCC RS6000 Constraint Letters switch (Constraint[0]) { - case 'l': - // FIXME: in thumb mode, 'l' is only low-regs. - // FALL THROUGH. - case 'r': - return std::make_pair(0U, ARM::GPRRegisterClass); - break; + case 'l': + // FIXME: in thumb mode, 'l' is only low-regs. + // FALL THROUGH. + case 'r': + return std::make_pair(0U, ARM::GPRRegisterClass); + case 'w': + if (VT == MVT::f32) + return std::make_pair(0U, ARM::SPRRegisterClass); + if (VT == MVT::f32) + return std::make_pair(0U, ARM::DPRRegisterClass); + break; } } return TargetLowering::getRegForInlineAsmConstraint(Constraint, VT); @@ -1634,6 +1640,22 @@ ARM::R4, ARM::R5, ARM::R6, ARM::R7, ARM::R8, ARM::R9, ARM::R10, ARM::R11, ARM::R12, ARM::LR, 0); + case 'w': + if (VT == MVT::f32) + return make_vector(ARM::S0, ARM::S1, ARM::S2, ARM::S3, + ARM::S4, ARM::S5, ARM::S6, ARM::S7, + ARM::S8, ARM::S9, ARM::S10, ARM::S11, + ARM::S12,ARM::S13,ARM::S14,ARM::S15, + ARM::S16,ARM::S17,ARM::S18,ARM::S19, + ARM::S20,ARM::S21,ARM::S22,ARM::S23, + ARM::S24,ARM::S25,ARM::S26,ARM::S27, + ARM::S28,ARM::S29,ARM::S30,ARM::S31, 0); + if (VT == MVT::f64) + return make_vector(ARM::D0, ARM::D1, ARM::D2, ARM::D3, + ARM::D4, ARM::D5, ARM::D6, ARM::D7, + ARM::D8, ARM::D9, ARM::D10,ARM::D11, + ARM::D12,ARM::D13,ARM::D14,ARM::D15, 0); + break; } return std::vector(); From reid at x10sys.com Mon Apr 2 12:48:09 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 12:48:09 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704021748.l32Hm9EZ020193@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.26 -> 1.27 --- Log message: Get the attendee count correct. Add Reid's talk on HLVM. --- Diffs of the changes: (+4 -3) DevMtgMay2007.html | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.26 llvm-www/DevMtgMay2007.html:1.27 --- llvm-www/DevMtgMay2007.html:1.26 Mon Apr 2 12:18:24 2007 +++ llvm-www/DevMtgMay2007.html Mon Apr 2 12:47:52 2007 @@ -107,6 +107,7 @@ Devang Patel Demystifying the LLVM Pass Manager + Reid SpencerThe Goal of HLVM @@ -216,13 +217,13 @@ Nick LewyckyIndependent Scott Michel + 2Aerospace Devang PatelApple, Inc. - Mark SchimmelWind River + Mark Schimmel + 1Wind River Reid SpencerIndependent Sarah Thompson + 1NASA, Ames Research Center Bill WendlingApple, Inc. Marcel WeiherMetaObject -

Total confirmed attendees: 16

+

Total confirmed attendees: 18

Possible additional attendees: 6

@@ -233,6 +234,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
Last modified: $Date: 2007/04/02 17:18:24 $ +
Last modified: $Date: 2007/04/02 17:47:52 $ From reid at x10sys.com Mon Apr 2 13:04:36 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 13:04:36 -0500 Subject: [llvm-commits] CVS: llvm-www/SVNMigration.html Message-ID: <200704021804.l32I4aAb020679@zion.cs.uiuc.edu> Changes in directory llvm-www: SVNMigration.html added (r1.1) --- Log message: Add a page for tracking information about the CVS -> SVN migration. --- Diffs of the changes: (+122 -0) SVNMigration.html | 122 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 122 insertions(+) Index: llvm-www/SVNMigration.html diff -c /dev/null llvm-www/SVNMigration.html:1.1 *** /dev/null Mon Apr 2 13:04:29 2007 --- llvm-www/SVNMigration.html Mon Apr 2 13:04:19 2007 *************** *** 0 **** --- 1,122 ---- + + +
Subversion Migration Notes
+
+

This document contains notes about the planned migration of the CVS code + repository to Subversion.

+
+ + + +
+

The existing branches have been categorized as shown in the table below. If + a branch is scheduled to be removed and you need it, please let + Reid know as soon as + possible.

+

Branches To Be Kept

+ + + + + + +
NameDescription
release_*Release branches (10 total)
seeBranch Vikram's group is using for Secure + Code?
parallelBranch for parallel features? (not sure)
vector_llvmBranch for vector stuff? (not sure)
+ +

Branches To Be Removed

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescription
autoconfappears to be an early version, even before the autoconf + directory existed
bug_122a bug fix branch that I created long ago. Its not needed any more. +
jrsdevhas exactly 2 header files in it, one for reoptimizer, the other for + SparcV9
llvmappears to be a *very* early version (docs has only LangRef.html, + and only 3 tools)
regalloc_linearscanhas only 3 old header files in it
PowerPC_0Appears to be an early version of the PowerPC target. Seems not + important to keep it
pre-11, prerelease_*John created these as the first step towards a release, but it + hasn't been done that way since (there's no prerelease_12 or later). + I think its not important to retain these.
SignlessTypesReid created this and doesn't need/want it
unlabelled-*these three appear to be mistakes (only a few files each)
+
+ + + +
+

Below are some tables of tag names to be kept or removed when the migration + occurs.

+

Tags To Be Kept

+ + + + + + + + + + + + + +
NameDescription
jtcAssuming this is John Criswell's tag and he wants + it
jtcllvaAssuming this is the LLVA tag
PARALLEL_ROOTRoot of the parallel branch
RELEASE_*These are the final release tags (7 total)
ROOT_RELEASE_*These are the original release tags (9 total) +
RC15This should have been ROOT_RELEASE_15, I think
startThis seems to be the very first tag. It references an + ancient version of llvm and is only of historical interest
+

Tags To Be Removed

+ + + + + + + + + + + + + + + + +
NameDescription
byebyeContains just the old lib/Analysis/DataStructure + stuff. It is inappropriately named and definitely not needed
LLVM_PRE111This is a pre-release tag to go with a branch + we're planning to remove.
new_merge_vectorAppears to be a merging tag. Pretty sure + its unneeded at this point
PowerPC_0_0Root of a branch we're deleting
PRE10Root of a branch we're deleting
PRE101Root of a branch we're deleting
PRE11Root of a branch we're deleting
PRE11_ROOTRoot of a branch we're deleting
PRE2_ROOTRoot of a branch we're deleting
regalloc_linearscan_mergein_mainMerge point of branch + we're deleting
ROOT_VLLVMAppears to be a typo
ST_incr_*SignlessTypes tags, not needed any more
+ +
+ +
+
+ Valid CSS! + Valid HTML 4.01! +
Last modified: $Date: 2007/04/02 18:04:19 $ +
+ From reid at x10sys.com Mon Apr 2 13:16:51 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 13:16:51 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704021816.l32IGpn8020964@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.27 -> 1.28 --- Log message: Add Devang's discussion topic and break discussion topics into their own group. --- Diffs of the changes: (+18 -6) DevMtgMay2007.html | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.27 llvm-www/DevMtgMay2007.html:1.28 --- llvm-www/DevMtgMay2007.html:1.27 Mon Apr 2 12:47:52 2007 +++ llvm-www/DevMtgMay2007.html Mon Apr 2 13:16:34 2007 @@ -9,6 +9,7 @@
  • Session 2: Learning LLVM
  • Session 3: Using LLVM
  • Session 4: Improving LLVM
  • +
  • Discussion Topics Submitted
  • Travel Tips
      @@ -136,14 +137,23 @@ wishful fantasies. What do you think LLVM lacks? Where does it need to go from here? This session will consist of a 5 minute presentation by the issue originator followed by 10 minutes of discussion. This will allow 6 issues to - be discussed in this time slot. + be discussed in this time slot.

      - + + future as an LLVM subproject, and plans for making LLVM more accessible + to scripting and higher level language front ends. +
      Suggested ByIssue or Discussion Topic
      Suggested ByIssue Description
      Owen AndersonIntegration of HLVM into LLVM - its - future as an LLVM subproject, and plans for making LLVM more accessible - to scripting and higher level language front ends.
      + + + +
      +

      In addition to the planned sessions above, the following discussion topics + have been submitted.

      + + +
      Suggested ByIssue or Discussion Topic
      Owen AndersonFuture development practices: with a - burgeoning number of clients and wider adoption, do we want more orgnized + burgeoning number of clients and wider adoption, do we want more organized development practices? i.e. release focuses or something?
      Owen AndersonAdoption Goals: while our adoption has increased greatly recently, we're still tiny compared to GCC. What are our @@ -153,6 +163,8 @@ given us some great things, but sometimes secrecy makes things difficult for those not involved; should there be an LLVM Foundation in our (distant?) future?
      Devang PatelUsing Bugpoint: How to use the bugpoint + tool to identifiy misoptimizations and bad code gen bugs.
      @@ -234,6 +246,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2007/04/02 17:47:52 $ +
      Last modified: $Date: 2007/04/02 18:16:34 $ From evan.cheng at apple.com Mon Apr 2 13:47:30 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 2 Apr 2007 13:47:30 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/ARM/2007-04-02-RegScavengerAssert.ll Message-ID: <200704021847.l32IlUEb021999@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/ARM: 2007-04-02-RegScavengerAssert.ll added (r1.1) --- Log message: New test case. --- Diffs of the changes: (+55 -0) 2007-04-02-RegScavengerAssert.ll | 55 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+) Index: llvm/test/CodeGen/ARM/2007-04-02-RegScavengerAssert.ll diff -c /dev/null llvm/test/CodeGen/ARM/2007-04-02-RegScavengerAssert.ll:1.1 *** /dev/null Mon Apr 2 13:47:23 2007 --- llvm/test/CodeGen/ARM/2007-04-02-RegScavengerAssert.ll Mon Apr 2 13:47:13 2007 *************** *** 0 **** --- 1,55 ---- + ; RUN: llvm-as < %s | llc -march=arm -mtriple=arm-apple-darwin + + %struct.H_TBL = type { [17 x i8], [256 x i8], i32 } + %struct.Q_TBL = type { [64 x i16], i32 } + %struct.anon = type { [80 x i8] } + %struct.X_c_coef_ccler = type { void (%struct.X_Y*, i32)*, i32 (%struct.X_Y*, i8***)* } + %struct.X_c_main_ccler = type { void (%struct.X_Y*, i32)*, void (%struct.X_Y*, i8**, i32*, i32)* } + %struct.X_c_prep_ccler = type { void (%struct.X_Y*, i32)*, void (%struct.X_Y*, i8**, i32*, i32, i8***, i32*, i32)* } + %struct.X_color_converter = type { void (%struct.X_Y*)*, void (%struct.X_Y*, i8**, i8***, i32, i32)* } + %struct.X_common_struct = type { %struct.X_error_mgr*, %struct.X_memory_mgr*, %struct.X_progress_mgr*, i8*, i32, i32 } + %struct.X_comp_master = type { void (%struct.X_Y*)*, void (%struct.X_Y*)*, void (%struct.X_Y*)*, i32, i32 } + %struct.X_component_info = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.Q_TBL*, i8* } + %struct.X_Y = type { %struct.X_error_mgr*, %struct.X_memory_mgr*, %struct.X_progress_mgr*, i8*, i32, i32, %struct.X_destination_mgr*, i32, i32, i32, i32, double, i32, i32, i32, %struct.X_component_info*, [4 x %struct.Q_TBL*], [4 x %struct.H_TBL*], [4 x %struct.H_TBL*], [16 x i8], [16 x i8], [16 x i8], i32, %struct.X_scan_info*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i16, i16, i32, i32, i32, i32, i32, i32, i32, [4 x %struct.X_component_info*], i32, i32, i32, [10 x i32], i32, i32, i32, i32, %struct.X_comp_master*, %struct.X_c_main_ccler*, %struct.X_c_prep_ccler*, %struct.X_c_coef_ccler*, %struct.X_marker_writer*, %struct.X_color_converter*, %struct.X_downssr*, %struct.X_forward_D*, %struct.X_entropy_en*, %struct.X_scan_info*, i32 } + %struct.X_destination_mgr = type { i8*, i32, void (%struct.X_Y*)*, i32 (%struct.X_Y*)*, void (%struct.X_Y*)* } + %struct.X_downssr = type { void (%struct.X_Y*)*, void (%struct.X_Y*, i8***, i32, i8***, i32)*, i32 } + %struct.X_entropy_en = type { void (%struct.X_Y*, i32)*, i32 (%struct.X_Y*, [64 x i16]**)*, void (%struct.X_Y*)* } + %struct.X_error_mgr = type { void (%struct.X_common_struct*)*, void (%struct.X_common_struct*, i32)*, void (%struct.X_common_struct*)*, void (%struct.X_common_struct*, i8*)*, void (%struct.X_common_struct*)*, i32, %struct.anon, i32, i32, i8**, i32, i8**, i32, i32 } + %struct.X_forward_D = type { void (%struct.X_Y*)*, void (%struct.X_Y*, %struct.X_component_info*, i8**, [64 x i16]*, i32, i32, i32)* } + %struct.X_marker_writer = type { void (%struct.X_Y*)*, void (%struct.X_Y*)*, void (%struct.X_Y*)*, void (%struct.X_Y*)*, void (%struct.X_Y*)*, void (%struct.X_Y*, i32, i32)*, void (%struct.X_Y*, i32)* } + %struct.X_memory_mgr = type { i8* (%struct.X_common_struct*, i32, i32)*, i8* (%struct.X_common_struct*, i32, i32)*, i8** (%struct.X_common_struct*, i32, i32, i32)*, [64 x i16]** (%struct.X_common_struct*, i32, i32, i32)*, %struct.jvirt_sAY_cc* (%struct.X_common_struct*, i32, i32, i32, i32, i32)*, %struct.jvirt_bAY_cc* (%struct.X_common_struct*, i32, i32, i32, i32, i32)*, void (%struct.X_common_struct*)*, i8** (%struct.X_common_struct*, %struct.jvirt_sAY_cc*, i32, i32, i32)*, [64 x i16]** (%struct.X_common_struct*, %struct.jvirt_bAY_cc*, i32, i32, i32)*, void (%struct.X_common_struct*, i32)*, void (%struct.X_common_struct*)*, i32, i32 } + %struct.X_progress_mgr = type { void (%struct.X_common_struct*)*, i32, i32, i32, i32 } + %struct.X_scan_info = type { i32, [4 x i32], i32, i32, i32, i32 } + %struct.jvirt_bAY_cc = type opaque + %struct.jvirt_sAY_cc = type opaque + + define void @test(%struct.X_Y* %cinfo) { + entry: + br i1 false, label %bb.preheader, label %return + + bb.preheader: ; preds = %entry + %tbl.014.us = load i32* null ; [#uses=1] + br i1 false, label %cond_next.us, label %bb + + cond_next51.us: ; preds = %cond_next.us, %cond_true33.us.cond_true46.us_crit_edge + %htblptr.019.1.us = phi %struct.H_TBL** [ %tmp37.us, %cond_true33.us.cond_true46.us_crit_edge ], [ %tmp37.us, %cond_next.us ] ; <%struct.H_TBL**> [#uses=0] + ret void + + cond_true33.us.cond_true46.us_crit_edge: ; preds = %cond_next.us + call void @_C_X_a_HT( ) + br label %cond_next51.us + + cond_next.us: ; preds = %bb.preheader + %tmp37.us = getelementptr %struct.X_Y* %cinfo, i32 0, i32 17, i32 %tbl.014.us ; <%struct.H_TBL**> [#uses=3] + %tmp4524.us = load %struct.H_TBL** %tmp37.us ; <%struct.H_TBL*> [#uses=1] + icmp eq %struct.H_TBL* %tmp4524.us, null ; :0 [#uses=1] + br i1 %0, label %cond_true33.us.cond_true46.us_crit_edge, label %cond_next51.us + + bb: ; preds = %bb.preheader + ret void + + return: ; preds = %entry + ret void + } + + declare void @_C_X_a_HT() From evan.cheng at apple.com Mon Apr 2 13:49:39 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 2 Apr 2007 13:49:39 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Message-ID: <200704021849.l32Ind6O022165@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveIntervalAnalysis.h updated: 1.76 -> 1.77 --- Log message: Ugh. Copy coalescer does not update register numbers. --- Diffs of the changes: (+4 -0) LiveIntervalAnalysis.h | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.76 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.77 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.76 Wed Feb 28 20:03:03 2007 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Apr 2 13:49:18 2007 @@ -267,6 +267,10 @@ MachineInstr *lastRegisterUse(unsigned Reg, unsigned Start, unsigned End, MachineOperand *&MOU); + /// findDefOperand - Returns the MachineOperand that is a def of the specific + /// register. It returns NULL if the def is not found. + MachineOperand *findDefOperand(MachineInstr *MI, unsigned Reg); + /// unsetRegisterKill - Unset IsKill property of all uses of the specific /// register of the specific instruction. void unsetRegisterKill(MachineInstr *MI, unsigned Reg); From evan.cheng at apple.com Mon Apr 2 13:49:38 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 2 Apr 2007 13:49:38 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200704021849.l32IncBw022160@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.231 -> 1.232 --- Log message: Ugh. Copy coalescer does not update register numbers. --- Diffs of the changes: (+15 -2) LiveIntervalAnalysis.cpp | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.231 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.232 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.231 Fri Mar 30 15:18:35 2007 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Apr 2 13:49:18 2007 @@ -945,7 +945,7 @@ } else { MachineInstr *SrcMI = getInstructionFromIndex(SrcStart); if (SrcMI) { - MachineOperand *mops = SrcMI->findRegisterDefOperand(SrcReg); + MachineOperand *mops = findDefOperand(SrcMI, repSrcReg); if (mops) // A dead def should have a single cycle interval. ++RemoveStart; @@ -1022,7 +1022,7 @@ } else { MachineInstr *SrcMI = getInstructionFromIndex(SrcStart); if (SrcMI) { - MachineOperand *mops = SrcMI->findRegisterDefOperand(SrcReg); + MachineOperand *mops = findDefOperand(SrcMI, repSrcReg); if (mops) mops->setIsDead(); } @@ -1617,6 +1617,19 @@ return NULL; } + +/// findDefOperand - Returns the MachineOperand that is a def of the specific +/// register. It returns NULL if the def is not found. +MachineOperand *LiveIntervals::findDefOperand(MachineInstr *MI, unsigned Reg) { + for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { + MachineOperand &MO = MI->getOperand(i); + if (MO.isReg() && MO.isDef() && + mri_->regsOverlap(rep(MO.getReg()), Reg)) + return &MO; + } + return NULL; +} + /// unsetRegisterKill - Unset IsKill property of all uses of specific register /// of the specific instruction. void LiveIntervals::unsetRegisterKill(MachineInstr *MI, unsigned Reg) { From sabre at nondot.org Mon Apr 2 13:51:35 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 13:51:35 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <200704021851.l32IpZaF022233@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelLowering.cpp updated: 1.36 -> 1.37 --- Log message: fix the CodeGen/ARM/2007-03-13-InstrSched.ll regression: allow IV's with scales to be folded into non-store instructions. --- Diffs of the changes: (+20 -4) ARMISelLowering.cpp | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) Index: llvm/lib/Target/ARM/ARMISelLowering.cpp diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.36 llvm/lib/Target/ARM/ARMISelLowering.cpp:1.37 --- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.36 Mon Apr 2 12:24:08 2007 +++ llvm/lib/Target/ARM/ARMISelLowering.cpp Mon Apr 2 13:51:18 2007 @@ -1332,6 +1332,15 @@ // r + r if (((unsigned)AM.HasBaseReg + AM.Scale) <= 2) return true; + + case MVT::isVoid: + // Note, we allow "void" uses (basically, uses that aren't loads or + // stores), because arm allows folding a scale into many arithmetic + // operations. This should be made more precise and revisited later. + + // Allow r << imm, but the imm has to be a multiple of two. + if (AM.Scale & 1) return false; + return isPowerOf2_32(AM.Scale); } break; } @@ -1413,12 +1422,19 @@ case MVT::i1: case MVT::i8: case MVT::i32: - // r + r - if (S == 2) - return true; - // r + r << imm + // Allow: r + r + // Allow: r << imm + // Allow: r + r << imm S &= ~1; return isPowerOf2_32(S); + case MVT::isVoid: + // Note, we allow "void" uses (basically, uses that aren't loads or + // stores), because arm allows folding a scale into many arithmetic + // operations. This should be made more precise and revisited later. + + // Allow r << imm, but the imm has to be a multiple of two. + if (S & 1) return false; + return isPowerOf2_32(S); } } From reid at x10sys.com Mon Apr 2 13:52:56 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 13:52:56 -0500 Subject: [llvm-commits] CVS: llvm-www/SVNMigration.html Message-ID: <200704021852.l32IquK8022321@zion.cs.uiuc.edu> Changes in directory llvm-www: SVNMigration.html updated: 1.1 -> 1.2 --- Log message: We don't need to keep the root version tag for branches because SVN does this automatically. --- Diffs of the changes: (+8 -7) SVNMigration.html | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) Index: llvm-www/SVNMigration.html diff -u llvm-www/SVNMigration.html:1.1 llvm-www/SVNMigration.html:1.2 --- llvm-www/SVNMigration.html:1.1 Mon Apr 2 13:04:19 2007 +++ llvm-www/SVNMigration.html Mon Apr 2 13:52:38 2007 @@ -75,13 +75,8 @@ it jtcllvaAssuming this is the LLVA tag - PARALLEL_ROOTRoot of the parallel branch RELEASE_*These are the final release tags (7 total) - ROOT_RELEASE_*These are the original release tags (9 total) - - - RC15This should have been ROOT_RELEASE_15, I think startThis seems to be the very first tag. It references an ancient version of llvm and is only of historical interest @@ -98,6 +93,7 @@ its unneeded at this point PowerPC_0_0Root of a branch we're deleting + PARALLEL_ROOTRoot of the parallel branch PRE10Root of a branch we're deleting PRE101Root of a branch we're deleting PRE11Root of a branch we're deleting @@ -105,7 +101,12 @@ PRE2_ROOTRoot of a branch we're deleting regalloc_linearscan_mergein_mainMerge point of branch we're deleting - ROOT_VLLVMAppears to be a typo + RC15This should have been ROOT_RELEASE_15, I think + ROOT_RELEASE_*These are the root version tags for release + branches (9 total). They aren't needed in SVN because of the way SVN + handles branches. + + ROOT_VLLVMThe root version tag for the vector_llvm branch. ST_incr_*SignlessTypes tags, not needed any more @@ -117,6 +118,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2007/04/02 18:04:19 $ +
      Last modified: $Date: 2007/04/02 18:52:38 $ From reid at x10sys.com Mon Apr 2 14:02:19 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 14:02:19 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704021902.l32J2JZG022699@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.28 -> 1.29 --- Log message: Add Christopher Lamb and his discussion topic. --- Diffs of the changes: (+9 -3) DevMtgMay2007.html | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.28 llvm-www/DevMtgMay2007.html:1.29 --- llvm-www/DevMtgMay2007.html:1.28 Mon Apr 2 13:16:34 2007 +++ llvm-www/DevMtgMay2007.html Mon Apr 2 14:02:02 2007 @@ -139,10 +139,15 @@ originator followed by 10 minutes of discussion. This will allow 6 issues to be discussed in this time slot.

      - + +
      Suggested ByIssue Description
      Suggested ByIssue Description
      Owen AndersonIntegration of HLVM into LLVM - its future as an LLVM subproject, and plans for making LLVM more accessible to scripting and higher level language front ends.
      Christopher LambConcurrency Primitives: for multi-threaded + shared memory models. Though I don't claim to be any sort of expert + myself, I've spent some time looking over the Java Memory Model revision + and discussions and I think it would be worth discussing similar issues + with regards to LLVM.
      @@ -225,6 +230,7 @@ Ryan BrownGoogle Jeff CohenIndependent Robert HundtGoogle + Christopher LambIndependent Chris LattnerApple, Inc. Nick LewyckyIndependent Scott Michel + 2Aerospace @@ -235,7 +241,7 @@ Bill WendlingApple, Inc. Marcel WeiherMetaObject -

      Total confirmed attendees: 18

      +

      Total confirmed attendees: 19

      Possible additional attendees: 6

      @@ -246,6 +252,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2007/04/02 18:16:34 $ +
      Last modified: $Date: 2007/04/02 19:02:02 $ From reid at x10sys.com Mon Apr 2 14:14:34 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 14:14:34 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704021914.l32JEYxK023196@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.29 -> 1.30 --- Log message: Fix Christopher Lamb's affiliation. --- Diffs of the changes: (+2 -2) DevMtgMay2007.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.29 llvm-www/DevMtgMay2007.html:1.30 --- llvm-www/DevMtgMay2007.html:1.29 Mon Apr 2 14:02:02 2007 +++ llvm-www/DevMtgMay2007.html Mon Apr 2 14:14:17 2007 @@ -230,7 +230,7 @@ Ryan BrownGoogle Jeff CohenIndependent Robert HundtGoogle - Christopher LambIndependent + Christopher LambAgeia Technologies, Inc. Chris LattnerApple, Inc. Nick LewyckyIndependent Scott Michel + 2Aerospace @@ -252,6 +252,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2007/04/02 19:02:02 $ +
      Last modified: $Date: 2007/04/02 19:14:17 $ From clattner at apple.com Mon Apr 2 15:11:53 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 2 Apr 2007 13:11:53 -0700 Subject: [llvm-commits] Patch resubmit: ROTL/ROTR cleanups In-Reply-To: <20070330190256.GA23803@rush.aero.org> References: <20070330190256.GA23803@rush.aero.org> Message-ID: <7F0A9BF5-B95B-4A88-9C07-A4C2C224BC61@apple.com> On Mar 30, 2007, at 12:02 PM, Scott Michel wrote: > Spotted what was probably a long-standing bug, since some of my > cleanups > were simple substitutions. Sorry for the delay. In general, if you keep the changes as simple and disjoint as possible, I'm more likely to look at them soon :). Here you could split up the "allow custom legalize of rotates" part from the "introduce some temporary vars" part from "match ext rotate cases" part. > -scooter > Index: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > =================================================================== > --- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (.../trunk) (revision > 2119) > +++ lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (.../branches/llvm- > spu) (revision 2119) > @@ -2683,10 +2683,24 @@ > case ISD::ROTR: > Tmp1 = LegalizeOp(Node->getOperand(0)); // LHS > Tmp2 = LegalizeOp(Node->getOperand(1)); // RHS > - > - assert(TLI.isOperationLegal(Node->getOpcode(), Node- > >getValueType(0)) && > - "Cannot handle this yet!"); > Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2); > + switch (TLI.getOperationAction(Node->getOpcode(), Node- > >getValueType(0))) { > + default: > + assert(0 && "ROTL/ROTR legalize operation not supported"); > + break; > + case TargetLowering::Legal: > + break; > + case TargetLowering::Custom: > + Tmp1 = TLI.LowerOperation(Result, DAG); > + if (Tmp1.Val) Result = Tmp1; > + break; > + case TargetLowering::Promote: > + assert(0 && "Do not know how to promote ROTL/ROTR"); > + break; > + case TargetLowering::Expand: > + assert(0 && "Do not know how to expand ROTL/ROTR"); > + break; > + } > break; Looks good. > case ISD::BSWAP: > Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp > =================================================================== > --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp (.../trunk) (revision > 2119) > +++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp (.../branches/llvm- > spu) (revision 2119) > @@ -1488,23 +1488,24 @@ > } > > unsigned OpSizeInBits = MVT::getSizeInBits(VT); > + SDOperand LHSShiftArg = LHSShift.getOperand(0); > + SDOperand LHSShiftAmt = LHSShift.getOperand(1); > + SDOperand RHSShiftAmt = RHSShift.getOperand(1); > > // fold (or (shl x, C1), (srl x, C2)) -> (rotl x, C1) > // fold (or (shl x, C1), (srl x, C2)) -> (rotr x, C2) > - if (LHSShift.getOperand(1).getOpcode() == ISD::Constant && > - RHSShift.getOperand(1).getOpcode() == ISD::Constant) { > - uint64_t LShVal = cast(LHSShift.getOperand(1))- > >getValue(); > - uint64_t RShVal = cast(RHSShift.getOperand(1))- > >getValue(); > + if (LHSShiftAmt.getOpcode() == ISD::Constant && > + RHSShiftAmt.getOpcode() == ISD::Constant) { > + uint64_t LShVal = cast(LHSShiftAmt)->getValue(); > + uint64_t RShVal = cast(RHSShiftAmt)->getValue(); > if ((LShVal + RShVal) != OpSizeInBits) > return 0; > > SDOperand Rot; > if (HasROTL) > - Rot = DAG.getNode(ISD::ROTL, VT, LHSShift.getOperand(0), > - LHSShift.getOperand(1)); > + Rot = DAG.getNode(ISD::ROTL, VT, LHSShiftArg, LHSShiftAmt); > else > - Rot = DAG.getNode(ISD::ROTR, VT, LHSShift.getOperand(0), > - RHSShift.getOperand(1)); > + Rot = DAG.getNode(ISD::ROTR, VT, LHSShiftArg, RHSShiftAmt); > > // If there is an AND of either shifted operand, apply it to > the result. > if (LHSMask.Val || RHSMask.Val) { Looks fine. > @@ -1532,35 +1533,71 @@ > > // fold (or (shl x, y), (srl x, (sub 32, y))) -> (rotl x, y) > // fold (or (shl x, y), (srl x, (sub 32, y))) -> (rotr x, (sub > 32, y)) > - if (RHSShift.getOperand(1).getOpcode() == ISD::SUB && > - LHSShift.getOperand(1) == RHSShift.getOperand(1).getOperand > (1)) { > + if (RHSShiftAmt.getOpcode() == ISD::SUB && > + LHSShiftAmt == RHSShiftAmt.getOperand(1)) { > if (ConstantSDNode *SUBC = > - dyn_cast(RHSShift.getOperand > (1).getOperand(0))) { > + dyn_cast(RHSShiftAmt.getOperand(0))) { > if (SUBC->getValue() == OpSizeInBits) > if (HasROTL) > - return DAG.getNode(ISD::ROTL, VT, LHSShift.getOperand(0), > - LHSShift.getOperand(1)).Val; > + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, > LHSShiftAmt).Val; > else > - return DAG.getNode(ISD::ROTR, VT, LHSShift.getOperand(0), > - LHSShift.getOperand(1)).Val; > + return DAG.getNode(ISD::ROTR, VT, LHSShiftArg, > RHSShiftAmt).Val; > } > } ok > // fold (or (shl x, (sub 32, y)), (srl x, r)) -> (rotr x, y) > // fold (or (shl x, (sub 32, y)), (srl x, r)) -> (rotl x, (sub > 32, y)) > - if (LHSShift.getOperand(1).getOpcode() == ISD::SUB && > - RHSShift.getOperand(1) == LHSShift.getOperand(1).getOperand > (1)) { > + if (LHSShiftAmt.getOpcode() == ISD::SUB && > + RHSShiftAmt == LHSShiftAmt.getOperand(1)) { > if (ConstantSDNode *SUBC = > - dyn_cast(LHSShift.getOperand > (1).getOperand(0))) { > + dyn_cast(LHSShiftAmt.getOperand(0))) { > if (SUBC->getValue() == OpSizeInBits) > if (HasROTL) > - return DAG.getNode(ISD::ROTL, VT, LHSShift.getOperand(0), > - LHSShift.getOperand(1)).Val; > + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, > LHSShiftAmt).Val; > else > - return DAG.getNode(ISD::ROTR, VT, LHSShift.getOperand(0), > - RHSShift.getOperand(1)).Val; > + return DAG.getNode(ISD::ROTR, VT, LHSShiftArg, > RHSShiftAmt).Val; > } > } Ok > + > + // Look for sign/zext/any-extended cases: > + if ((LHSShiftAmt.getOpcode() == ISD::SIGN_EXTEND > + || LHSShiftAmt.getOpcode() == ISD::ZERO_EXTEND > + || LHSShiftAmt.getOpcode() == ISD::ANY_EXTEND) && > + (RHSShiftAmt.getOpcode() == ISD::SIGN_EXTEND > + || RHSShiftAmt.getOpcode() == ISD::ZERO_EXTEND > + || RHSShiftAmt.getOpcode() == ISD::ANY_EXTEND)) { > + SDOperand LExtOp0 = LHSShiftAmt.getOperand(0); > + SDOperand RExtOp0 = RHSShiftAmt.getOperand(0); > + if (RExtOp0.getOpcode() == ISD::SUB && > + RExtOp0.getOperand(1) == LExtOp0) { > + // fold (or (shl x, (*ext y)), (srl x, (*ext (sub 32, y)))) -> > + // (rotr x, y) > + // fold (or (shl x, (*ext y)), (srl x, (*ext (sub 32, y)))) -> > + // (rotl x, (sub 32, y)) > + if (ConstantSDNode *SUBC = cast > (RExtOp0.getOperand(0))) { > + if (SUBC->getValue() == OpSizeInBits) { > + if (HasROTL) > + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, LHSShiftAmt).Val; > + else > + return DAG.getNode(ISD::ROTR, VT, LHSShiftArg, RHSShiftAmt).Val; > + } Okay, but needs an extra level of spacing for the indentation here (2 spaces, not 1). > + } > + } else if (LExtOp0.getOpcode() == ISD::SUB && > + RExtOp0 == LExtOp0.getOperand(1)) { > + // fold (or (shl x, (*ext (sub 32, y))), (srl x, (*ext r))) -> > + // (rotl x, y) > + // fold (or (shl x, (*ext (sub 32, y))), (srl x, (*ext r))) -> > + // (rotr x, (sub 32, y)) > + if (ConstantSDNode *SUBC = cast > (LExtOp0.getOperand(0))) { > + if (SUBC->getValue() == OpSizeInBits) { > + if (HasROTL) > + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, RHSShiftAmt).Val; > + else > + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, LHSShiftAmt).Val; > + } Likewise. > + } > + } > + } Otherwise, looks great! Please commit, -Chris From dalej at apple.com Mon Apr 2 15:31:24 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 2 Apr 2007 15:31:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp Message-ID: <200704022031.l32KVO1h025014@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMConstantIslandPass.cpp updated: 1.33 -> 1.34 --- Log message: fix off by 1 error in displacement computation --- Diffs of the changes: (+5 -0) ARMConstantIslandPass.cpp | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.33 llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.34 --- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.33 Thu Mar 1 02:26:31 2007 +++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp Mon Apr 2 15:31:06 2007 @@ -593,6 +593,11 @@ Water->begin()->getOpcode() != ARM::CONSTPOOL_ENTRY)) CPEOffset += 2; + // If the CPE is to be inserted before the instruction, that will raise + // the offset of the instruction. + if (CPEOffset < UserOffset) + UserOffset += isThumb ? 2 : 4; + return OffsetIsInRange (UserOffset, CPEOffset, MaxDisp, !isThumb); } From sabre at nondot.org Mon Apr 2 15:31:57 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 15:31:57 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/2007-03-12-BossaLLVMIntro.pdf Message-ID: <200704022031.l32KVvAx025067@zion.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2007-03-12-BossaLLVMIntro.pdf updated: 1.2 -> 1.3 --- Log message: this time with less crashing? --- Diffs of the changes: (+0 -0) 2007-03-12-BossaLLVMIntro.pdf | 0 1 files changed Index: llvm-www/pubs/2007-03-12-BossaLLVMIntro.pdf From sabre at nondot.org Mon Apr 2 15:40:08 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 15:40:08 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/X86/2007-03-24-InlineAsmVectorOp.ll Message-ID: <200704022040.l32Ke8W7025262@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/X86: 2007-03-24-InlineAsmVectorOp.ll updated: 1.2 -> 1.3 --- Log message: fix this testcase on ppc hosts --- Diffs of the changes: (+1 -1) 2007-03-24-InlineAsmVectorOp.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/CodeGen/X86/2007-03-24-InlineAsmVectorOp.ll diff -u llvm/test/CodeGen/X86/2007-03-24-InlineAsmVectorOp.ll:1.2 llvm/test/CodeGen/X86/2007-03-24-InlineAsmVectorOp.ll:1.3 --- llvm/test/CodeGen/X86/2007-03-24-InlineAsmVectorOp.ll:1.2 Tue Mar 27 21:38:26 2007 +++ llvm/test/CodeGen/X86/2007-03-24-InlineAsmVectorOp.ll Mon Apr 2 15:39:48 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 | grep 'cmpltsd %xmm0, %xmm0' +; RUN: llvm-as < %s | llc -mcpu=yonah -march=x86 | grep 'cmpltsd %xmm0, %xmm0' target datalayout = "e-p:32:32" target triple = "i686-apple-darwin9" From sabre at nondot.org Mon Apr 2 15:46:45 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 15:46:45 -0500 Subject: [llvm-commits] CVS: llvm/test/Transforms/InstCombine/bitcount.ll Message-ID: <200704022046.l32KkjF5025530@zion.cs.uiuc.edu> Changes in directory llvm/test/Transforms/InstCombine: bitcount.ll updated: 1.2 -> 1.3 --- Log message: fix this testcase so it passes --- Diffs of the changes: (+2 -2) bitcount.ll | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Transforms/InstCombine/bitcount.ll diff -u llvm/test/Transforms/InstCombine/bitcount.ll:1.2 llvm/test/Transforms/InstCombine/bitcount.ll:1.3 --- llvm/test/Transforms/InstCombine/bitcount.ll:1.2 Sun Apr 1 22:24:47 2007 +++ llvm/test/Transforms/InstCombine/bitcount.ll Mon Apr 2 15:46:28 2007 @@ -1,6 +1,6 @@ ; Tests to make sure bit counts of constants are folded -; RUN: llvm-as < %s | opt -instcombine | llvm-dis -o /dev/null -f && -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'llvm.ct' +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'ret i32 19' && +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v declare | not grep 'llvm.ct' declare i32 @llvm.ctpop.i31(i31 %val) declare i32 @llvm.cttz.i32(i32 %val) From scottm at aero.org Mon Apr 2 16:36:49 2007 From: scottm at aero.org (Scott Michel) Date: Mon, 2 Apr 2007 16:36:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp LegalizeDAG.cpp Message-ID: <200704022136.l32Lanso026971@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.284 -> 1.285 LegalizeDAG.cpp updated: 1.485 -> 1.486 --- Log message: 1. Insert custom lowering hooks for ISD::ROTR and ISD::ROTL. 2. Help DAGCombiner recognize zero/sign/any-extended versions of ROTR and ROTL patterns. This was motivated by the X86/rotate.ll testcase, which should now generate code for other platforms (and soon-to-come platforms.) Rewrote code slightly to make it easier to read. --- Diffs of the changes: (+76 -25) DAGCombiner.cpp | 81 ++++++++++++++++++++++++++++++++++++++++---------------- LegalizeDAG.cpp | 20 +++++++++++-- 2 files changed, 76 insertions(+), 25 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.284 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.285 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.284 Fri Mar 30 16:38:07 2007 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Apr 2 16:36:32 2007 @@ -1488,23 +1488,24 @@ } unsigned OpSizeInBits = MVT::getSizeInBits(VT); + SDOperand LHSShiftArg = LHSShift.getOperand(0); + SDOperand LHSShiftAmt = LHSShift.getOperand(1); + SDOperand RHSShiftAmt = RHSShift.getOperand(1); // fold (or (shl x, C1), (srl x, C2)) -> (rotl x, C1) // fold (or (shl x, C1), (srl x, C2)) -> (rotr x, C2) - if (LHSShift.getOperand(1).getOpcode() == ISD::Constant && - RHSShift.getOperand(1).getOpcode() == ISD::Constant) { - uint64_t LShVal = cast(LHSShift.getOperand(1))->getValue(); - uint64_t RShVal = cast(RHSShift.getOperand(1))->getValue(); + if (LHSShiftAmt.getOpcode() == ISD::Constant && + RHSShiftAmt.getOpcode() == ISD::Constant) { + uint64_t LShVal = cast(LHSShiftAmt)->getValue(); + uint64_t RShVal = cast(RHSShiftAmt)->getValue(); if ((LShVal + RShVal) != OpSizeInBits) return 0; SDOperand Rot; if (HasROTL) - Rot = DAG.getNode(ISD::ROTL, VT, LHSShift.getOperand(0), - LHSShift.getOperand(1)); + Rot = DAG.getNode(ISD::ROTL, VT, LHSShiftArg, LHSShiftAmt); else - Rot = DAG.getNode(ISD::ROTR, VT, LHSShift.getOperand(0), - RHSShift.getOperand(1)); + Rot = DAG.getNode(ISD::ROTR, VT, LHSShiftArg, RHSShiftAmt); // If there is an AND of either shifted operand, apply it to the result. if (LHSMask.Val || RHSMask.Val) { @@ -1532,33 +1533,69 @@ // fold (or (shl x, y), (srl x, (sub 32, y))) -> (rotl x, y) // fold (or (shl x, y), (srl x, (sub 32, y))) -> (rotr x, (sub 32, y)) - if (RHSShift.getOperand(1).getOpcode() == ISD::SUB && - LHSShift.getOperand(1) == RHSShift.getOperand(1).getOperand(1)) { + if (RHSShiftAmt.getOpcode() == ISD::SUB && + LHSShiftAmt == RHSShiftAmt.getOperand(1)) { if (ConstantSDNode *SUBC = - dyn_cast(RHSShift.getOperand(1).getOperand(0))) { + dyn_cast(RHSShiftAmt.getOperand(0))) { if (SUBC->getValue() == OpSizeInBits) if (HasROTL) - return DAG.getNode(ISD::ROTL, VT, LHSShift.getOperand(0), - LHSShift.getOperand(1)).Val; + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, LHSShiftAmt).Val; else - return DAG.getNode(ISD::ROTR, VT, LHSShift.getOperand(0), - LHSShift.getOperand(1)).Val; + return DAG.getNode(ISD::ROTR, VT, LHSShiftArg, RHSShiftAmt).Val; } } // fold (or (shl x, (sub 32, y)), (srl x, r)) -> (rotr x, y) // fold (or (shl x, (sub 32, y)), (srl x, r)) -> (rotl x, (sub 32, y)) - if (LHSShift.getOperand(1).getOpcode() == ISD::SUB && - RHSShift.getOperand(1) == LHSShift.getOperand(1).getOperand(1)) { + if (LHSShiftAmt.getOpcode() == ISD::SUB && + RHSShiftAmt == LHSShiftAmt.getOperand(1)) { if (ConstantSDNode *SUBC = - dyn_cast(LHSShift.getOperand(1).getOperand(0))) { + dyn_cast(LHSShiftAmt.getOperand(0))) { if (SUBC->getValue() == OpSizeInBits) if (HasROTL) - return DAG.getNode(ISD::ROTL, VT, LHSShift.getOperand(0), - LHSShift.getOperand(1)).Val; + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, LHSShiftAmt).Val; else - return DAG.getNode(ISD::ROTR, VT, LHSShift.getOperand(0), - RHSShift.getOperand(1)).Val; + return DAG.getNode(ISD::ROTR, VT, LHSShiftArg, RHSShiftAmt).Val; + } + } + + // Look for sign/zext/any-extended cases: + if ((LHSShiftAmt.getOpcode() == ISD::SIGN_EXTEND + || LHSShiftAmt.getOpcode() == ISD::ZERO_EXTEND + || LHSShiftAmt.getOpcode() == ISD::ANY_EXTEND) && + (RHSShiftAmt.getOpcode() == ISD::SIGN_EXTEND + || RHSShiftAmt.getOpcode() == ISD::ZERO_EXTEND + || RHSShiftAmt.getOpcode() == ISD::ANY_EXTEND)) { + SDOperand LExtOp0 = LHSShiftAmt.getOperand(0); + SDOperand RExtOp0 = RHSShiftAmt.getOperand(0); + if (RExtOp0.getOpcode() == ISD::SUB && + RExtOp0.getOperand(1) == LExtOp0) { + // fold (or (shl x, (*ext y)), (srl x, (*ext (sub 32, y)))) -> + // (rotr x, y) + // fold (or (shl x, (*ext y)), (srl x, (*ext (sub 32, y)))) -> + // (rotl x, (sub 32, y)) + if (ConstantSDNode *SUBC = cast(RExtOp0.getOperand(0))) { + if (SUBC->getValue() == OpSizeInBits) { + if (HasROTL) + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, LHSShiftAmt).Val; + else + return DAG.getNode(ISD::ROTR, VT, LHSShiftArg, RHSShiftAmt).Val; + } + } + } else if (LExtOp0.getOpcode() == ISD::SUB && + RExtOp0 == LExtOp0.getOperand(1)) { + // fold (or (shl x, (*ext (sub 32, y))), (srl x, (*ext r))) -> + // (rotl x, y) + // fold (or (shl x, (*ext (sub 32, y))), (srl x, (*ext r))) -> + // (rotr x, (sub 32, y)) + if (ConstantSDNode *SUBC = cast(LExtOp0.getOperand(0))) { + if (SUBC->getValue() == OpSizeInBits) { + if (HasROTL) + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, RHSShiftAmt).Val; + else + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, LHSShiftAmt).Val; + } + } } } Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.485 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.486 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.485 Sat Mar 24 12:37:03 2007 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Apr 2 16:36:32 2007 @@ -2683,10 +2683,24 @@ case ISD::ROTR: Tmp1 = LegalizeOp(Node->getOperand(0)); // LHS Tmp2 = LegalizeOp(Node->getOperand(1)); // RHS - - assert(TLI.isOperationLegal(Node->getOpcode(), Node->getValueType(0)) && - "Cannot handle this yet!"); Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2); + switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) { + default: + assert(0 && "ROTL/ROTR legalize operation not supported"); + break; + case TargetLowering::Legal: + break; + case TargetLowering::Custom: + Tmp1 = TLI.LowerOperation(Result, DAG); + if (Tmp1.Val) Result = Tmp1; + break; + case TargetLowering::Promote: + assert(0 && "Do not know how to promote ROTL/ROTR"); + break; + case TargetLowering::Expand: + assert(0 && "Do not know how to expand ROTL/ROTR"); + break; + } break; case ISD::BSWAP: From scottm at aero.org Mon Apr 2 16:44:12 2007 From: scottm at aero.org (Scott Michel) Date: Mon, 2 Apr 2007 14:44:12 -0700 Subject: [llvm-commits] Patch resubmit: ROTL/ROTR cleanups In-Reply-To: <7F0A9BF5-B95B-4A88-9C07-A4C2C224BC61@apple.com> References: <20070330190256.GA23803@rush.aero.org> <7F0A9BF5-B95B-4A88-9C07-A4C2C224BC61@apple.com> Message-ID: <1B0FB693-9496-4628-81C3-F5D7186FBB53@aero.org> On Apr 2, 2007, at 1:11 PM, Chris Lattner wrote: > On Mar 30, 2007, at 12:02 PM, Scott Michel wrote: >> Spotted what was probably a long-standing bug, since some of my >> cleanups >> were simple substitutions. > > Sorry for the delay. In general, if you keep the changes as simple > and disjoint as possible, I'm more likely to look at them soon :). > Here you could split up the "allow custom legalize of rotates" part > from the "introduce some temporary vars" part from "match ext > rotate cases" part. I did, I did, I did! Really! They're part and parcel of the same functionality... :-) >> + >> + // Look for sign/zext/any-extended cases: >> + if ((LHSShiftAmt.getOpcode() == ISD::SIGN_EXTEND >> + || LHSShiftAmt.getOpcode() == ISD::ZERO_EXTEND >> + || LHSShiftAmt.getOpcode() == ISD::ANY_EXTEND) && >> + (RHSShiftAmt.getOpcode() == ISD::SIGN_EXTEND >> + || RHSShiftAmt.getOpcode() == ISD::ZERO_EXTEND >> + || RHSShiftAmt.getOpcode() == ISD::ANY_EXTEND)) { >> + SDOperand LExtOp0 = LHSShiftAmt.getOperand(0); >> + SDOperand RExtOp0 = RHSShiftAmt.getOperand(0); >> + if (RExtOp0.getOpcode() == ISD::SUB && >> + RExtOp0.getOperand(1) == LExtOp0) { >> + // fold (or (shl x, (*ext y)), (srl x, (*ext (sub 32, y)))) -> >> + // (rotr x, y) >> + // fold (or (shl x, (*ext y)), (srl x, (*ext (sub 32, y)))) -> >> + // (rotl x, (sub 32, y)) >> + if (ConstantSDNode *SUBC = cast >> (RExtOp0.getOperand(0))) { >> + if (SUBC->getValue() == OpSizeInBits) { >> + if (HasROTL) >> + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, >> LHSShiftAmt).Val; >> + else >> + return DAG.getNode(ISD::ROTR, VT, LHSShiftArg, >> RHSShiftAmt).Val; >> + } > > Okay, but needs an extra level of spacing for the indentation here > (2 spaces, not 1). > >> + } >> + } else if (LExtOp0.getOpcode() == ISD::SUB && >> + RExtOp0 == LExtOp0.getOperand(1)) { >> + // fold (or (shl x, (*ext (sub 32, y))), (srl x, (*ext r))) -> >> + // (rotl x, y) >> + // fold (or (shl x, (*ext (sub 32, y))), (srl x, (*ext r))) -> >> + // (rotr x, (sub 32, y)) >> + if (ConstantSDNode *SUBC = cast >> (LExtOp0.getOperand(0))) { >> + if (SUBC->getValue() == OpSizeInBits) { >> + if (HasROTL) >> + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, >> RHSShiftAmt).Val; >> + else >> + return DAG.getNode(ISD::ROTL, VT, LHSShiftArg, >> LHSShiftAmt).Val; >> + } > > Likewise. Fixed tab violations, which made it look like incorrect indentation... -scooter From sabre at nondot.org Mon Apr 2 17:09:12 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 17:09:12 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/PowerPC/rotl-2.ll Message-ID: <200704022209.l32M9CU3027891@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/PowerPC: rotl-2.ll added (r1.1) --- Log message: Add a regtest for cases we now recognize as rotates, thanks to Scott Michel's recent dagcombine patch --- Diffs of the changes: (+38 -0) rotl-2.ll | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+) Index: llvm/test/CodeGen/PowerPC/rotl-2.ll diff -c /dev/null llvm/test/CodeGen/PowerPC/rotl-2.ll:1.1 *** /dev/null Mon Apr 2 17:09:04 2007 --- llvm/test/CodeGen/PowerPC/rotl-2.ll Mon Apr 2 17:08:54 2007 *************** *** 0 **** --- 1,38 ---- + ; RUN: llvm-as < %s | llc -march=ppc32 | grep rlwinm | wc -l | grep 4 && + ; RUN: llvm-as < %s | llc -march=ppc32 | grep rlwnm | wc -l | grep 2 && + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep or + + define i32 @rotl32(i32 %A, i8 %Amt) { + %shift.upgrd.1 = zext i8 %Amt to i32 ; [#uses=1] + %B = shl i32 %A, %shift.upgrd.1 ; [#uses=1] + %Amt2 = sub i8 32, %Amt ; [#uses=1] + %shift.upgrd.2 = zext i8 %Amt2 to i32 ; [#uses=1] + %C = lshr i32 %A, %shift.upgrd.2 ; [#uses=1] + %D = or i32 %B, %C ; [#uses=1] + ret i32 %D + } + + define i32 @rotr32(i32 %A, i8 %Amt) { + %shift.upgrd.3 = zext i8 %Amt to i32 ; [#uses=1] + %B = lshr i32 %A, %shift.upgrd.3 ; [#uses=1] + %Amt2 = sub i8 32, %Amt ; [#uses=1] + %shift.upgrd.4 = zext i8 %Amt2 to i32 ; [#uses=1] + %C = shl i32 %A, %shift.upgrd.4 ; [#uses=1] + %D = or i32 %B, %C ; [#uses=1] + ret i32 %D + } + + define i32 @rotli32(i32 %A) { + %B = shl i32 %A, 5 ; [#uses=1] + %C = lshr i32 %A, 27 ; [#uses=1] + %D = or i32 %B, %C ; [#uses=1] + ret i32 %D + } + + define i32 @rotri32(i32 %A) { + %B = lshr i32 %A, 5 ; [#uses=1] + %C = shl i32 %A, 27 ; [#uses=1] + %D = or i32 %B, %C ; [#uses=1] + ret i32 %D + } + From clattner at apple.com Mon Apr 2 17:10:00 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 2 Apr 2007 15:10:00 -0700 Subject: [llvm-commits] Patch resubmit: ROTL/ROTR cleanups In-Reply-To: <1B0FB693-9496-4628-81C3-F5D7186FBB53@aero.org> References: <20070330190256.GA23803@rush.aero.org> <7F0A9BF5-B95B-4A88-9C07-A4C2C224BC61@apple.com> <1B0FB693-9496-4628-81C3-F5D7186FBB53@aero.org> Message-ID: <88DFEF3D-BBB4-47E5-A1FD-1F17D4329889@apple.com> On Apr 2, 2007, at 2:44 PM, Scott Michel wrote: > On Apr 2, 2007, at 1:11 PM, Chris Lattner wrote: > >> On Mar 30, 2007, at 12:02 PM, Scott Michel wrote: >>> Spotted what was probably a long-standing bug, since some of my >>> cleanups >>> were simple substitutions. >> >> Sorry for the delay. In general, if you keep the changes as simple >> and disjoint as possible, I'm more likely to look at them soon :). >> Here you could split up the "allow custom legalize of rotates" part >> from the "introduce some temporary vars" part from "match ext >> rotate cases" part. > > I did, I did, I did! Really! They're part and parcel of the same > functionality... :-) :) >> Likewise. > > Fixed tab violations, which made it look like incorrect indentation... Great, even better! -Chris From sabre at nondot.org Mon Apr 2 17:52:15 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 17:52:15 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200704022252.l32MqFWJ028835@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.124 -> 1.125 --- Log message: allow -1 strides to reuse "1" strides. --- Diffs of the changes: (+2 -1) LoopStrengthReduce.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.124 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.125 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.124 Mon Apr 2 01:34:44 2007 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Apr 2 17:51:58 2007 @@ -929,7 +929,8 @@ for (std::map::iterator SI= IVsByStride.begin(), SE = IVsByStride.end(); SI != SE; ++SI) { int64_t SSInt = cast(SI->first)->getValue()->getSExtValue(); - if (unsigned(abs(SInt)) < SSInt || (SInt % SSInt) != 0) + if (SInt != -SSInt && + (unsigned(abs(SInt)) < SSInt || (SInt % SSInt) != 0)) continue; int64_t Scale = SInt / SSInt; // Check that this stride is valid for all the types used for loads and From johannes at apple.com Mon Apr 2 19:10:48 2007 From: johannes at apple.com (johannes at apple.com) Date: Mon, 2 Apr 2007 17:10:48 -0700 (PDT) Subject: [llvm-commits] [125637] arm EABI patch (from Lauro Ramos Venancio) Message-ID: <20070403001048.7E8FFCB7FEFE@src> Revision: 125637 Author: johannes Date: 2007-04-02 17:10:47 -0700 (Mon, 02 Apr 2007) Log Message: ----------- arm EABI patch (from Lauro Ramos Venancio) Modified Paths: -------------- apple-local/branches/llvm/libstdc++-v3/Makefile.in apple-local/branches/llvm/libstdc++-v3/acinclude.m4 apple-local/branches/llvm/libstdc++-v3/aclocal.m4 apple-local/branches/llvm/libstdc++-v3/configure apple-local/branches/llvm/libstdc++-v3/include/Makefile.in apple-local/branches/llvm/libstdc++-v3/libmath/Makefile.in apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.am apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.in apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_catch.cc apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_personality.cc apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_throw.cc apple-local/branches/llvm/libstdc++-v3/libsupc++/unwind-cxx.h apple-local/branches/llvm/libstdc++-v3/po/Makefile.in apple-local/branches/llvm/libstdc++-v3/src/Makefile.in Modified: apple-local/branches/llvm/libstdc++-v3/Makefile.in =================================================================== --- apple-local/branches/llvm/libstdc++-v3/Makefile.in 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/Makefile.in 2007-04-03 00:10:47 UTC (rev 125637) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -408,7 +408,13 @@ # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -420,7 +426,7 @@ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ @@ -428,7 +434,13 @@ mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: - @set fnord $$MAKEFLAGS; amf=$$2; \ + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ @@ -449,7 +461,7 @@ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ Modified: apple-local/branches/llvm/libstdc++-v3/acinclude.m4 =================================================================== --- apple-local/branches/llvm/libstdc++-v3/acinclude.m4 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/acinclude.m4 2007-04-03 00:10:47 UTC (rev 125637) @@ -1675,6 +1675,10 @@ enable_sjlj_exceptions=yes elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then enable_sjlj_exceptions=no + #APPLE LOCAL begin LLVM + elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then + enable_sjlj_exceptions=no + #APPLE LOCAL end LLVM fi fi # APPLE LOCAL LLVM HACK! Modified: apple-local/branches/llvm/libstdc++-v3/aclocal.m4 =================================================================== --- apple-local/branches/llvm/libstdc++-v3/aclocal.m4 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/aclocal.m4 2007-04-03 00:10:47 UTC (rev 125637) @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.9.3 -*- Autoconf -*- +# generated automatically by aclocal 1.9.5 -*- Autoconf -*- -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,24 +11,12 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -# -*- Autoconf -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. -# Generated from amversion.in; do not edit by hand. +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been @@ -40,27 +28,16 @@ # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], - [AM_AUTOMAKE_VERSION([1.9.3])]) + [AM_AUTOMAKE_VERSION([1.9.5])]) -# AM_AUX_DIR_EXPAND +# AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. @@ -106,27 +83,17 @@ am_aux_dir=`cd $ac_aux_dir && pwd` ]) -# AM_CONDITIONAL -*- Autoconf -*- +# AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# serial 7 -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 6 - # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. @@ -149,31 +116,20 @@ Usually this means the macro was only invoked conditionally.]]) fi])]) -# Do all the work for Automake. -*- Autoconf -*- +# Do all the work for Automake. -*- Autoconf -*- -# This macro actually does too much some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# serial 12 -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 11 - # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- @@ -333,29 +289,18 @@ rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) -# Add --enable-maintainer-mode option to configure. +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# serial 4 -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - AC_DEFUN([AM_MAINTAINER_MODE], [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode is disabled by default @@ -373,28 +318,17 @@ AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) -# -*- Autoconf -*- +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. +# serial 4 -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], @@ -419,27 +353,16 @@ fi ]) +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + # AM_PROG_MKDIR_P # --------------- # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. - -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories # created by `make install' are always world readable, even if the # installer happens to have an overly restrictive umask (e.g. 077). @@ -493,26 +416,15 @@ fi AC_SUBST([mkdir_p])]) -# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004 +# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# serial 5 -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 4 - # AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR]) # --------------------------------------------------- # Add --enable-multilib to configure. @@ -562,27 +474,16 @@ CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} CC="$CC"])])dnl -# Helper functions for option handling. -*- Autoconf -*- +# Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# serial 3 -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 2 - # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], @@ -606,29 +507,17 @@ AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. # -# Check to make sure that the build environment is sane. -# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. +# serial 4 -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 3 - # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], @@ -670,25 +559,14 @@ fi AC_MSG_RESULT(yes)]) -# AM_PROG_INSTALL_STRIP +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - +# AM_PROG_INSTALL_STRIP +# --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip @@ -711,26 +589,14 @@ # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. +# serial 2 -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -# serial 1 - - # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. Modified: apple-local/branches/llvm/libstdc++-v3/configure =================================================================== --- apple-local/branches/llvm/libstdc++-v3/configure 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/configure 2007-04-03 00:10:47 UTC (rev 125637) @@ -5031,6 +5031,8 @@ enable_sjlj_exceptions=yes elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then enable_sjlj_exceptions=no + elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then + enable_sjlj_exceptions=no fi fi # APPLE LOCAL LLVM HACK! Modified: apple-local/branches/llvm/libstdc++-v3/include/Makefile.in =================================================================== --- apple-local/branches/llvm/libstdc++-v3/include/Makefile.in 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/include/Makefile.in 2007-04-03 00:10:47 UTC (rev 125637) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. Modified: apple-local/branches/llvm/libstdc++-v3/libmath/Makefile.in =================================================================== --- apple-local/branches/llvm/libstdc++-v3/libmath/Makefile.in 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/libmath/Makefile.in 2007-04-03 00:10:47 UTC (rev 125637) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.am =================================================================== --- apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.am 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.am 2007-04-03 00:10:47 UTC (rev 125637) @@ -45,7 +45,13 @@ del_opv.cc \ del_opvnt.cc \ eh_alloc.cc \ +#APPLE LOCAL begin LLVM \ + eh_arm.cc \ +#APPLE LOCAL end LLVM \ eh_aux_runtime.cc \ +#APPLE LOCAL begin LLVM \ + eh_call.cc \ +#APPLE LOCAL end LLVM \ eh_catch.cc \ eh_exception.cc \ eh_globals.cc \ Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.in =================================================================== --- apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.in 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/libsupc++/Makefile.in 2007-04-03 00:10:47 UTC (rev 125637) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -65,29 +65,31 @@ LTLIBRARIES = $(noinst_LTLIBRARIES) $(toolexeclib_LTLIBRARIES) libsupc___la_LIBADD = am__libsupc___la_SOURCES_DIST = del_op.cc del_opnt.cc del_opv.cc \ - del_opvnt.cc eh_alloc.cc eh_aux_runtime.cc eh_catch.cc \ - eh_exception.cc eh_globals.cc eh_personality.cc \ - eh_term_handler.cc eh_terminate.cc eh_throw.cc eh_type.cc \ - eh_unex_handler.cc guard.cc new_handler.cc new_op.cc \ - new_opnt.cc new_opv.cc new_opvnt.cc pure.cc tinfo.cc tinfo2.cc \ - vec.cc vterminate.cc cp-demangle.c + del_opvnt.cc eh_alloc.cc eh_arm.cc eh_aux_runtime.cc \ + eh_call.cc eh_catch.cc eh_exception.cc eh_globals.cc \ + eh_personality.cc eh_term_handler.cc eh_terminate.cc \ + eh_throw.cc eh_type.cc eh_unex_handler.cc guard.cc \ + new_handler.cc new_op.cc new_opnt.cc new_opv.cc new_opvnt.cc \ + pure.cc tinfo.cc tinfo2.cc vec.cc vterminate.cc cp-demangle.c am__objects_1 = del_op.lo del_opnt.lo del_opv.lo del_opvnt.lo \ - eh_alloc.lo eh_aux_runtime.lo eh_catch.lo eh_exception.lo \ - eh_globals.lo eh_personality.lo eh_term_handler.lo \ - eh_terminate.lo eh_throw.lo eh_type.lo eh_unex_handler.lo \ - guard.lo new_handler.lo new_op.lo new_opnt.lo new_opv.lo \ - new_opvnt.lo pure.lo tinfo.lo tinfo2.lo vec.lo vterminate.lo + eh_alloc.lo eh_arm.lo eh_aux_runtime.lo eh_call.lo eh_catch.lo \ + eh_exception.lo eh_globals.lo eh_personality.lo \ + eh_term_handler.lo eh_terminate.lo eh_throw.lo eh_type.lo \ + eh_unex_handler.lo guard.lo new_handler.lo new_op.lo \ + new_opnt.lo new_opv.lo new_opvnt.lo pure.lo tinfo.lo tinfo2.lo \ + vec.lo vterminate.lo @GLIBCXX_HOSTED_TRUE at am__objects_2 = cp-demangle.lo am_libsupc___la_OBJECTS = $(am__objects_1) $(am__objects_2) libsupc___la_OBJECTS = $(am_libsupc___la_OBJECTS) libsupc__convenience_la_LIBADD = am__libsupc__convenience_la_SOURCES_DIST = del_op.cc del_opnt.cc \ - del_opv.cc del_opvnt.cc eh_alloc.cc eh_aux_runtime.cc \ - eh_catch.cc eh_exception.cc eh_globals.cc eh_personality.cc \ - eh_term_handler.cc eh_terminate.cc eh_throw.cc eh_type.cc \ - eh_unex_handler.cc guard.cc new_handler.cc new_op.cc \ - new_opnt.cc new_opv.cc new_opvnt.cc pure.cc tinfo.cc tinfo2.cc \ - vec.cc vterminate.cc cp-demangle.c + del_opv.cc del_opvnt.cc eh_alloc.cc eh_arm.cc \ + eh_aux_runtime.cc eh_call.cc eh_catch.cc eh_exception.cc \ + eh_globals.cc eh_personality.cc eh_term_handler.cc \ + eh_terminate.cc eh_throw.cc eh_type.cc eh_unex_handler.cc \ + guard.cc new_handler.cc new_op.cc new_opnt.cc new_opv.cc \ + new_opvnt.cc pure.cc tinfo.cc tinfo2.cc vec.cc vterminate.cc \ + cp-demangle.c am_libsupc__convenience_la_OBJECTS = $(am__objects_1) $(am__objects_2) libsupc__convenience_la_OBJECTS = \ $(am_libsupc__convenience_la_OBJECTS) @@ -310,7 +312,13 @@ del_opv.cc \ del_opvnt.cc \ eh_alloc.cc \ +#APPLE LOCAL begin LLVM \ + eh_arm.cc \ +#APPLE LOCAL end LLVM \ eh_aux_runtime.cc \ +#APPLE LOCAL begin LLVM \ + eh_call.cc \ +#APPLE LOCAL end LLVM \ eh_catch.cc \ eh_exception.cc \ eh_globals.cc \ Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_catch.cc =================================================================== --- apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_catch.cc 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_catch.cc 2007-04-03 00:10:47 UTC (rev 125637) @@ -38,9 +38,10 @@ { _Unwind_Exception *exceptionObject = reinterpret_cast <_Unwind_Exception *>(exc_obj_in); - __cxa_exception *header = __get_exception_header_from_ue (exceptionObject); - return header->adjustedPtr; +// APPLE LOCAL begin LLVM + return __gxx_caught_object(exceptionObject); +// APPLE LOCAL end LLVM } extern "C" void * @@ -51,12 +52,17 @@ __cxa_eh_globals *globals = __cxa_get_globals (); __cxa_exception *prev = globals->caughtExceptions; __cxa_exception *header = __get_exception_header_from_ue (exceptionObject); +// APPLE LOCAL begin LLVM + void* objectp; +// APPLE LOCAL end LLVM // Foreign exceptions can't be stacked here. If the exception stack is // empty, then fine. Otherwise we really have no choice but to terminate. // Note that this use of "header" is a lie. It's fine so long as we only // examine header->unwindHeader though. - if (header->unwindHeader.exception_class != __gxx_exception_class) +// APPLE LOCAL begin LLVM + if (!__is_gxx_exception_class(header->unwindHeader.exception_class)) +// APPLE LOCAL end LLVM { if (prev != 0) std::terminate (); @@ -85,7 +91,13 @@ globals->caughtExceptions = header; } - return header->adjustedPtr; +// APPLE LOCAL begin LLVM + objectp = __gxx_caught_object(exceptionObject); +#ifdef __ARM_EABI_UNWINDER__ + _Unwind_Complete(exceptionObject); +#endif + return objectp; +// APPLE LOCAL end LLVM } @@ -102,7 +114,9 @@ // A foreign exception couldn't have been stacked (see above), // so by definition processing must be complete. - if (header->unwindHeader.exception_class != __gxx_exception_class) +// APPLE LOCAL begin LLVM + if (!__is_gxx_exception_class(header->unwindHeader.exception_class)) +// APPLE LOCAL end LLVM { globals->caughtExceptions = 0; _Unwind_DeleteException (&header->unwindHeader); Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_personality.cc =================================================================== --- apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_personality.cc 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_personality.cc 2007-04-03 00:10:47 UTC (rev 125637) @@ -35,6 +35,12 @@ using namespace __cxxabiv1; +// APPLE LOCAL begin LLVM +#ifdef __ARM_EABI_UNWINDER__ +#define NO_SIZE_OF_ENCODED_VALUE +#endif +// APPLE LOCAL end LLVM + #include "unwind-pe.h" @@ -84,6 +90,119 @@ return p; } +// APPLE LOCAL begin LLVM +#ifdef __ARM_EABI_UNWINDER__ + +// Return an element from a type table. + +static const std::type_info* +get_ttype_entry(lsda_header_info* info, _Unwind_Word i) +{ + _Unwind_Ptr ptr; + + ptr = (_Unwind_Ptr) (info->TType - (i * 4)); + ptr = _Unwind_decode_target2(ptr); + + return reinterpret_cast(ptr); +} + +// The ABI provides a routine for matching exception object types. +typedef _Unwind_Control_Block _throw_typet; +#define get_adjusted_ptr(catch_type, throw_type, thrown_ptr_p) \ + (__cxa_type_match (throw_type, catch_type, false, thrown_ptr_p) \ + != ctm_failed) + +// Return true if THROW_TYPE matches one if the filter types. + +static bool +check_exception_spec(lsda_header_info* info, _throw_typet* throw_type, + void* thrown_ptr, _Unwind_Sword filter_value) +{ + const _Unwind_Word* e = ((const _Unwind_Word*) info->TType) + - filter_value - 1; + + while (1) + { + const std::type_info* catch_type; + _Unwind_Word tmp; + + tmp = *e; + + // Zero signals the end of the list. If we've not found + // a match by now, then we've failed the specification. + if (tmp == 0) + return false; + + tmp = _Unwind_decode_target2((_Unwind_Word) e); + + // Match a ttype entry. + catch_type = reinterpret_cast(tmp); + + // ??? There is currently no way to ask the RTTI code about the + // relationship between two types without reference to a specific + // object. There should be; then we wouldn't need to mess with + // thrown_ptr here. + if (get_adjusted_ptr(catch_type, throw_type, &thrown_ptr)) + return true; + + // Advance to the next entry. + e++; + } +} + + +// Save stage1 handler information in the exception object + +static inline void +save_caught_exception(struct _Unwind_Exception* ue_header, + struct _Unwind_Context* context, + void* thrown_ptr, + int handler_switch_value, + const unsigned char* language_specific_data, + _Unwind_Ptr landing_pad, + const unsigned char* action_record + __attribute__((__unused__))) +{ + ue_header->barrier_cache.sp = _Unwind_GetGR(context, 13); + ue_header->barrier_cache.bitpattern[0] = (_uw) thrown_ptr; + ue_header->barrier_cache.bitpattern[1] + = (_uw) handler_switch_value; + ue_header->barrier_cache.bitpattern[2] + = (_uw) language_specific_data; + ue_header->barrier_cache.bitpattern[3] = (_uw) landing_pad; +} + + +// Restore the catch handler data saved during phase1. + +static inline void +restore_caught_exception(struct _Unwind_Exception* ue_header, + int& handler_switch_value, + const unsigned char*& language_specific_data, + _Unwind_Ptr& landing_pad) +{ + handler_switch_value = (int) ue_header->barrier_cache.bitpattern[1]; + language_specific_data = + (const unsigned char*) ue_header->barrier_cache.bitpattern[2]; + landing_pad = (_Unwind_Ptr) ue_header->barrier_cache.bitpattern[3]; +} + +#define CONTINUE_UNWINDING \ + do \ + { \ + if (__gnu_unwind_frame(ue_header, context) != _URC_OK) \ + return _URC_FAILURE; \ + return _URC_CONTINUE_UNWIND; \ + } \ + while (0) + +#else +// APPLE LOCAL end LLVM +typedef const std::type_info _throw_typet; + + +// Return an element from a type table. + static const std::type_info * get_ttype_entry (lsda_header_info *info, _Unwind_Word i) { @@ -127,8 +246,10 @@ // Return true if THROW_TYPE matches one if the filter types. static bool -check_exception_spec (lsda_header_info *info, const std::type_info *throw_type, - void *thrown_ptr, _Unwind_Sword filter_value) +// APPLE LOCAL begin LLVM +check_exception_spec(lsda_header_info* info, _throw_typet* throw_type, + void* thrown_ptr, _Unwind_Sword filter_value) +// APPLE LOCAL end LLVM { const unsigned char *e = info->TType - filter_value - 1; @@ -156,6 +277,52 @@ } } + +// APPLE LOCAL begin LLVM +// Save stage1 handler information in the exception object + +static inline void +save_caught_exception(struct _Unwind_Exception* ue_header, + struct _Unwind_Context* context + __attribute__((__unused__)), + void* thrown_ptr, + int handler_switch_value, + const unsigned char* language_specific_data, + _Unwind_Ptr landing_pad __attribute__((__unused__)), + const unsigned char* action_record) +{ + __cxa_exception* xh = __get_exception_header_from_ue(ue_header); + + xh->handlerSwitchValue = handler_switch_value; + xh->actionRecord = action_record; + xh->languageSpecificData = language_specific_data; + xh->adjustedPtr = thrown_ptr; + + // ??? Completely unknown what this field is supposed to be for. + // ??? Need to cache TType encoding base for call_unexpected. + xh->catchTemp = landing_pad; +} + + +// Restore the catch handler information saved during phase1. + +static inline void +restore_caught_exception(struct _Unwind_Exception* ue_header, + int& handler_switch_value, + const unsigned char*& language_specific_data, + _Unwind_Ptr& landing_pad) +{ + __cxa_exception* xh = __get_exception_header_from_ue(ue_header); + handler_switch_value = xh->handlerSwitchValue; + language_specific_data = xh->languageSpecificData; + landing_pad = (_Unwind_Ptr) xh->catchTemp; +} + +#define CONTINUE_UNWINDING return _URC_CONTINUE_UNWIND + +#endif // !__ARM_EABI_UNWINDER__ +// APPLE LOCAL end LLVM + // Return true if the filter spec is empty, ie throw(). static bool @@ -178,14 +345,20 @@ #endif extern "C" _Unwind_Reason_Code +// APPLE LOCAL begin LLVM +#ifdef __ARM_EABI_UNWINDER__ +PERSONALITY_FUNCTION (_Unwind_State state, + struct _Unwind_Exception* ue_header, + struct _Unwind_Context* context) +#else +// APPLE LOCAL end LLVM PERSONALITY_FUNCTION (int version, _Unwind_Action actions, _Unwind_Exception_Class exception_class, struct _Unwind_Exception *ue_header, struct _Unwind_Context *context) +#endif { - __cxa_exception *xh = __get_exception_header_from_ue (ue_header); - enum found_handler_type { found_nothing, @@ -200,19 +373,66 @@ const unsigned char *p; _Unwind_Ptr landing_pad, ip; int handler_switch_value; - void *thrown_ptr = xh + 1; +// APPLE LOCAL begin LLVM + void* thrown_ptr = ue_header + 1; + bool foreign_exception; +#ifdef __ARM_EABI_UNWINDER__ + _Unwind_Action actions; + + switch (state) + { + case _US_VIRTUAL_UNWIND_FRAME: + actions = _UA_SEARCH_PHASE; + break; + + case _US_UNWIND_FRAME_STARTING: + actions = _UA_CLEANUP_PHASE; + if (ue_header->barrier_cache.sp == _Unwind_GetGR(context, 13)) + actions |= _UA_HANDLER_FRAME; + break; + + case _US_UNWIND_FRAME_RESUME: + CONTINUE_UNWINDING; + break; + + default: + abort(); + } + + // We don't know which runtime we're working with, so can't check this. + // However the ABI routines hide this from us, and we don't actually need + // to know. + foreign_exception = false; + + // The dwarf unwinder assumes the context structure holds things like the + // function and LSDA pointers. The ARM implementation caches these in + // the exception header (UCB). To avoid rewriting everything we make the + // virtual IP register point at the UCB. + ip = (_Unwind_Ptr) ue_header; + _Unwind_SetGR(context, 12, ip); +#else + __cxa_exception* xh = __get_exception_header_from_ue(ue_header); +// APPLE LOCAL end LLVM + // Interface version check. if (version != 1) return _URC_FATAL_PHASE1_ERROR; +// APPLE LOCAL begin LLVM + foreign_exception = !__is_gxx_exception_class(exception_class); +#endif +// APPLE LOCAL end LLVM // Shortcut for phase 2 found handler for domestic exception. +// APPLE LOCAL begin LLVM if (actions == (_UA_CLEANUP_PHASE | _UA_HANDLER_FRAME) - && exception_class == __gxx_exception_class) + && !foreign_exception) +// APPLE LOCAL end LLVM { - handler_switch_value = xh->handlerSwitchValue; - language_specific_data = xh->languageSpecificData; - landing_pad = (_Unwind_Ptr) xh->catchTemp; +// APPLE LOCAL begin LLVM + restore_caught_exception(ue_header, handler_switch_value, + language_specific_data, landing_pad); +// APPLE LOCAL end LLVM found_type = (landing_pad == 0 ? found_terminate : found_handler); goto install_context; } @@ -222,11 +442,15 @@ // If no LSDA, then there are no handlers or cleanups. if (! language_specific_data) - return _URC_CONTINUE_UNWIND; +// APPLE LOCAL begin LLVM + CONTINUE_UNWINDING; +// APPLE LOCAL end LLVM // Parse the LSDA header. p = parse_lsda_header (context, language_specific_data, &info); - info.ttype_base = base_of_encoded_value (info.ttype_encoding, context); +// APPLE LOCAL begin LLVM + info.ttype_base = 0; +// APPLE LOCAL end LLVM ip = _Unwind_GetIP (context) - 1; landing_pad = 0; action_record = 0; @@ -312,7 +536,10 @@ // Otherwise we have a catch handler or exception specification. _Unwind_Sword ar_filter, ar_disp; - const std::type_info *throw_type, *catch_type; +// APPLE LOCAL begin LLVM + const std::type_info* catch_type; + _throw_typet* throw_type; +// APPLE LOCAL end LLVM bool saw_cleanup = false; bool saw_handler = false; @@ -320,11 +547,21 @@ // exception class, there's no exception type. // ??? What to do about GNU Java and GNU Ada exceptions. +// APPLE LOCAL begin LLVM +#ifdef __ARM_EABI_UNWINDER__ + throw_type = ue_header; +#else +// APPLE LOCAL end LLVM if ((actions & _UA_FORCE_UNWIND) - || exception_class != __gxx_exception_class) +// APPLE LOCAL begin LLVM + || foreign_exception) +// APPLE LOCAL end LLVM throw_type = 0; else throw_type = xh->exceptionType; +// APPLE LOCAL begin LLVM +#endif +// APPLE LOCAL end LLVM while (1) { @@ -387,34 +624,41 @@ do_something: if (found_type == found_nothing) - return _URC_CONTINUE_UNWIND; +// APPLE LOCAL begin LLVM + CONTINUE_UNWINDING; +// APPLE LOCAL end LLVM if (actions & _UA_SEARCH_PHASE) { if (found_type == found_cleanup) - return _URC_CONTINUE_UNWIND; +// APPLE LOCAL begin LLVM + CONTINUE_UNWINDING; +// APPLE LOCAL end LLVM // For domestic exceptions, we cache data from phase 1 for phase 2. - if (exception_class == __gxx_exception_class) +// APPLE LOCAL begin LLVM + if (!foreign_exception) { - xh->handlerSwitchValue = handler_switch_value; - xh->actionRecord = action_record; - xh->languageSpecificData = language_specific_data; - xh->adjustedPtr = thrown_ptr; - - // ??? Completely unknown what this field is supposed to be for. - // ??? Need to cache TType encoding base for call_unexpected. - xh->catchTemp = landing_pad; + save_caught_exception(ue_header, context, thrown_ptr, + handler_switch_value, language_specific_data, + landing_pad, action_record); } +//APPLE LOCAL end LLVM return _URC_HANDLER_FOUND; } install_context: + +// APPLE LOCAL begin LLVM +#ifndef __ARM_EABI_UNWINDER__ +// APPLE LOCAL end LLVM // We can't use any of the cxa routines with foreign exceptions, // because they all expect ue_header to be a struct __cxa_exception. // So in that case, call terminate or unexpected directly. if ((actions & _UA_FORCE_UNWIND) - || exception_class != __gxx_exception_class) +// APPLE LOCAL begin LLVM + || foreign_exception) +// APPLE LOCAL end LLVM { if (found_type == found_terminate) std::terminate (); @@ -427,32 +671,74 @@ } } else +// APPLE LOCAL begin LLVM +#endif +// APPLE LOCAL end LLVM { if (found_type == found_terminate) - { - __cxa_begin_catch (&xh->unwindHeader); - __terminate (xh->terminateHandler); - } +// APPLE LOCAL begin LLVM + __cxa_call_terminate(ue_header); +// APPLE LOCAL end LLVM // Cache the TType base value for __cxa_call_unexpected, as we won't // have an _Unwind_Context then. if (handler_switch_value < 0) { parse_lsda_header (context, language_specific_data, &info); + +// APPLE LOCAL begin LLVM +#ifdef __ARM_EABI_UNWINDER__ + const _Unwind_Word* e; + _Unwind_Word n; + + e = ((const _Unwind_Word*) info.TType) - handler_switch_value - 1; + // Count the number of rtti objects. + n = 0; + while (e[n] != 0) + n++; + + // Count. + ue_header->barrier_cache.bitpattern[1] = n; + // Base (obsolete) + ue_header->barrier_cache.bitpattern[2] = 0; + // Stride. + ue_header->barrier_cache.bitpattern[3] = 4; + // List head. + ue_header->barrier_cache.bitpattern[4] = (_Unwind_Word) e; +#else +// APPLE LOCAL end LLVM xh->catchTemp = base_of_encoded_value (info.ttype_encoding, context); +// APPLE LOCAL begin LLVM +#endif +// APPLE LOCAL end LLVM } } /* For targets with pointers smaller than the word size, we must extend the pointer, and this extension is target dependent. */ _Unwind_SetGR (context, __builtin_eh_return_data_regno (0), - __builtin_extend_pointer (&xh->unwindHeader)); +// APPLE LOCAL begin LLVM + __builtin_extend_pointer (ue_header)); +// APPLE LOCAL end LLVM _Unwind_SetGR (context, __builtin_eh_return_data_regno (1), handler_switch_value); _Unwind_SetIP (context, landing_pad); +// APPLE LOCAL begin LLVM +#ifdef __ARM_EABI_UNWINDER__ + if (found_type == found_cleanup) + __cxa_begin_cleanup(ue_header); +#endif +// APPLE LOCAL end LLVM return _URC_INSTALL_CONTEXT; } +// APPLE LOCAL begin LLVM +/* The ARM EABI implementation of __cxa_call_unexpected is in a different + file so that the personality routine san be used standalone. The generic + routine sahred datastructures with the PR so it is most convenient to + implement it here. */ +#ifndef __ARM_EABI_UNWINDER__ +// APPLE LOCAL end LLVM extern "C" void __cxa_call_unexpected (void *exc_obj_in) { @@ -507,9 +793,12 @@ const std::type_info &bad_exc = typeid (std::bad_exception); if (check_exception_spec (&info, &bad_exc, 0, xh_switch_value)) throw std::bad_exception(); +// APPLE LOCAL begin LLVM #endif +// APPLE LOCAL end LLVM // Otherwise, die. __terminate (xh_terminate_handler); } } +#endif Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_throw.cc =================================================================== --- apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_throw.cc 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_throw.cc 2007-04-03 00:10:47 UTC (rev 125637) @@ -63,7 +63,9 @@ header->exceptionDestructor = dest; header->unexpectedHandler = __unexpected_handler; header->terminateHandler = __terminate_handler; - header->unwindHeader.exception_class = __gxx_exception_class; +// APPLE LOCAL begin LLVM + __GXX_INIT_EXCEPTION_CLASS(header->unwindHeader.exception_class); +// APPLE LOCAL end LLVM header->unwindHeader.exception_cleanup = __gxx_exception_cleanup; #ifdef _GLIBCXX_SJLJ_EXCEPTIONS @@ -89,7 +91,9 @@ if (header) { // Tell __cxa_end_catch this is a rethrow. - if (header->unwindHeader.exception_class != __gxx_exception_class) +// APPLE LOCAL begin LLVM + if (!__is_gxx_exception_class(header->unwindHeader.exception_class)) +// APPLE LOCAL end LLVM globals->caughtExceptions = 0; else header->handlerCount = -header->handlerCount; @@ -97,7 +101,9 @@ #ifdef _GLIBCXX_SJLJ_EXCEPTIONS _Unwind_SjLj_Resume_or_Rethrow (&header->unwindHeader); #else -#ifdef _LIBUNWIND_STD_ABI +// APPLE LOCAL begin LLVM +#if defined(_LIBUNWIND_STD_ABI) || defined (__ARM_EABI_UNWINDER__) +// APPLE LOCAL end LLVM _Unwind_RaiseException (&header->unwindHeader); #else _Unwind_Resume_or_Rethrow (&header->unwindHeader); Modified: apple-local/branches/llvm/libstdc++-v3/libsupc++/unwind-cxx.h =================================================================== --- apple-local/branches/llvm/libstdc++-v3/libsupc++/unwind-cxx.h 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/libsupc++/unwind-cxx.h 2007-04-03 00:10:47 UTC (rev 125637) @@ -67,6 +67,15 @@ // value is a signal that this object has been rethrown. int handlerCount; +// APPLE LOCAL begin LLVM +#ifdef __ARM_EABI_UNWINDER__ + // Stack of exceptions in cleanups. + __cxa_exception* nextPropagatingException; + + // The nuber of active cleanup handlers for this exception. + int propagationCount; +#else +// APPLE LOCAL end LLVM // Cache parsed handler data from the personality routine Phase 1 // for Phase 2 and __cxa_call_unexpected. int handlerSwitchValue; @@ -74,6 +83,9 @@ const unsigned char *languageSpecificData; _Unwind_Ptr catchTemp; void *adjustedPtr; +// APPLE LOCAL begin LLVM +#endif +// APPLE LOCAL end LLVM // The generic exception header. Must be last. _Unwind_Exception unwindHeader; @@ -84,6 +96,11 @@ { __cxa_exception *caughtExceptions; unsigned int uncaughtExceptions; +// APPLE LOCAL begin LLVM +#ifdef __ARM_EABI_UNWINDER__ + __cxa_exception* propagatingExceptions; +#endif +// APPLE LOCAL end LLVM }; @@ -122,7 +139,25 @@ // throws, and if bad_exception needs to be thrown. Called from the // compiler. extern "C" void __cxa_call_unexpected (void *) __attribute__((noreturn)); +// APPLE LOCAL begin LLVM +extern "C" void __cxa_call_terminate (void*) __attribute__((noreturn)); +// APPLE LOCAL end LLVM +// APPLE LOCAL begin LLVM +#ifdef __ARM_EABI_UNWINDER__ +// Arm EABI specified routines. +typedef enum { + ctm_failed = 0, + ctm_succeeded = 1, + ctm_succeeded_with_ptr_to_base = 2 +} __cxa_type_match_result; +extern "C" bool __cxa_type_match(_Unwind_Exception*, const std::type_info*, + bool, void**); +extern "C" void __cxa_begin_cleanup (_Unwind_Exception*); +extern "C" void __cxa_end_cleanup (void); +#endif +// APPLE LOCAL end LLVM + // Invokes given handler, dying appropriately if the user handler was // so inconsiderate as to return. extern void __terminate(std::terminate_handler) __attribute__((noreturn)); @@ -134,6 +169,56 @@ // These are explicitly GNU C++ specific. +// APPLE LOCAL begin LLVM +// Acquire the C++ exception header from the C++ object. +static inline __cxa_exception * +__get_exception_header_from_obj (void *ptr) +{ + return reinterpret_cast<__cxa_exception *>(ptr) - 1; +} + +// Acquire the C++ exception header from the generic exception header. +static inline __cxa_exception * +__get_exception_header_from_ue (_Unwind_Exception *exc) +{ + return reinterpret_cast<__cxa_exception *>(exc + 1) - 1; +} + +#ifdef __ARM_EABI_UNWINDER__ +static inline bool +__is_gxx_exception_class(_Unwind_Exception_Class c) +{ + // TODO: Take advantage of the fact that c will always be word aligned. + return c[0] == 'G' + && c[1] == 'N' + && c[2] == 'U' + && c[3] == 'C' + && c[4] == 'C' + && c[5] == '+' + && c[6] == '+' + && c[7] == '\0'; +} + +static inline void +__GXX_INIT_EXCEPTION_CLASS(_Unwind_Exception_Class c) +{ + c[0] = 'G'; + c[1] = 'N'; + c[2] = 'U'; + c[3] = 'C'; + c[4] = 'C'; + c[5] = '+'; + c[6] = '+'; + c[7] = '\0'; +} + +static inline void* +__gxx_caught_object(_Unwind_Exception* eo) +{ + return (void*)eo->barrier_cache.bitpattern[0]; +} +#else // !__ARM_EABI_UNWINDER__ +// APPLE LOCAL end LLVM // This is the exception class we report -- "GNUCC++\0". const _Unwind_Exception_Class __gxx_exception_class = ((((((((_Unwind_Exception_Class) 'G' @@ -145,6 +230,16 @@ << 8 | (_Unwind_Exception_Class) '+') << 8 | (_Unwind_Exception_Class) '\0'); +// APPLE LOCAL begin LLVM +static inline bool +__is_gxx_exception_class(_Unwind_Exception_Class c) +{ + return c == __gxx_exception_class; +} + +#define __GXX_INIT_EXCEPTION_CLASS(c) c = __gxx_exception_class +// APPLE LOCAL end LLVM + // GNU C++ personality routine, Version 0. extern "C" _Unwind_Reason_Code __gxx_personality_v0 (int, _Unwind_Action, _Unwind_Exception_Class, @@ -155,20 +250,16 @@ (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *, struct _Unwind_Context *); -// Acquire the C++ exception header from the C++ object. -static inline __cxa_exception * -__get_exception_header_from_obj (void *ptr) +// APPLE LOCAL begin LLVM +static inline void* +__gxx_caught_object(_Unwind_Exception* eo) { - return reinterpret_cast<__cxa_exception *>(ptr) - 1; + __cxa_exception* header = __get_exception_header_from_ue (eo); + return header->adjustedPtr; } +#endif // !__ARM_EABI_UNWINDER__ +// APPLE LOCAL end LLVM -// Acquire the C++ exception header from the generic exception header. -static inline __cxa_exception * -__get_exception_header_from_ue (_Unwind_Exception *exc) -{ - return reinterpret_cast<__cxa_exception *>(exc + 1) - 1; -} - } /* namespace __cxxabiv1 */ #pragma GCC visibility pop Modified: apple-local/branches/llvm/libstdc++-v3/po/Makefile.in =================================================================== --- apple-local/branches/llvm/libstdc++-v3/po/Makefile.in 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/po/Makefile.in 2007-04-03 00:10:47 UTC (rev 125637) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. Modified: apple-local/branches/llvm/libstdc++-v3/src/Makefile.in =================================================================== --- apple-local/branches/llvm/libstdc++-v3/src/Makefile.in 2007-04-02 21:58:58 UTC (rev 125636) +++ apple-local/branches/llvm/libstdc++-v3/src/Makefile.in 2007-04-03 00:10:47 UTC (rev 125637) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. From sabre at nondot.org Mon Apr 2 19:13:33 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 19:13:33 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/ARM/arm-negative-stride.ll Message-ID: <200704030013.l330DXNQ030767@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/ARM: arm-negative-stride.ll added (r1.1) --- Log message: new testcase, where we should use a negative stride --- Diffs of the changes: (+20 -0) arm-negative-stride.ll | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+) Index: llvm/test/CodeGen/ARM/arm-negative-stride.ll diff -c /dev/null llvm/test/CodeGen/ARM/arm-negative-stride.ll:1.1 *** /dev/null Mon Apr 2 19:13:26 2007 --- llvm/test/CodeGen/ARM/arm-negative-stride.ll Mon Apr 2 19:13:16 2007 *************** *** 0 **** --- 1,20 ---- + ; RUN: llvm-as < %s | llc -march=arm | grep -F 'str r1, [r3, -r0, lsl #2]' + + define void @test(i32* %P, i32 %A, i32 %i) { + entry: + icmp eq i32 %i, 0 ; :0 [#uses=1] + br i1 %0, label %return, label %bb + + bb: ; preds = %bb, %entry + %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb ] ; [#uses=2] + %i_addr.09.0 = sub i32 %i, %indvar ; [#uses=1] + %tmp2 = getelementptr i32* %P, i32 %i_addr.09.0 ; [#uses=1] + store i32 %A, i32* %tmp2 + %indvar.next = add i32 %indvar, 1 ; [#uses=2] + icmp eq i32 %indvar.next, %i ; :1 [#uses=1] + br i1 %1, label %return, label %bb + + return: ; preds = %bb, %entry + ret void + } + From johannes at apple.com Mon Apr 2 19:13:00 2007 From: johannes at apple.com (johannes at apple.com) Date: Mon, 2 Apr 2007 17:13:00 -0700 (PDT) Subject: [llvm-commits] [125638] arm EABI patch (Lauro Ramos Venancio) Message-ID: <20070403001300.D6582CB80647@src> Revision: 125638 Author: johannes Date: 2007-04-02 17:13:00 -0700 (Mon, 02 Apr 2007) Log Message: ----------- arm EABI patch (Lauro Ramos Venancio) Modified Paths: -------------- apple-local/branches/llvm/gcc/Makefile.in apple-local/branches/llvm/gcc/ada/misc.c apple-local/branches/llvm/gcc/c-decl.c apple-local/branches/llvm/gcc/config/arm/arm.c apple-local/branches/llvm/gcc/config/arm/arm.h apple-local/branches/llvm/gcc/config/arm/bpabi.h apple-local/branches/llvm/gcc/config/arm/elf.h apple-local/branches/llvm/gcc/config/arm/lib1funcs.asm apple-local/branches/llvm/gcc/config/arm/libgcc-bpabi.ver apple-local/branches/llvm/gcc/config/arm/t-bpabi apple-local/branches/llvm/gcc/config/arm/t-symbian apple-local/branches/llvm/gcc/config/i386/t-netware apple-local/branches/llvm/gcc/config/ia64/ia64.h apple-local/branches/llvm/gcc/cp/Make-lang.in apple-local/branches/llvm/gcc/cp/decl.c apple-local/branches/llvm/gcc/cp/except.c apple-local/branches/llvm/gcc/except.c apple-local/branches/llvm/gcc/except.h apple-local/branches/llvm/gcc/java/decl.c apple-local/branches/llvm/gcc/objc/objc-act.c apple-local/branches/llvm/gcc/optabs.c apple-local/branches/llvm/gcc/opts.c apple-local/branches/llvm/gcc/target-def.h apple-local/branches/llvm/gcc/target.h apple-local/branches/llvm/gcc/unwind-c.c Modified: apple-local/branches/llvm/gcc/Makefile.in =================================================================== --- apple-local/branches/llvm/gcc/Makefile.in 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/Makefile.in 2007-04-03 00:13:00 UTC (rev 125638) @@ -340,10 +340,11 @@ $(srcdir)/ginclude/stddef.h \ $(srcdir)/ginclude/tgmath.h \ $(srcdir)/ginclude/varargs.h \ - $(srcdir)/unwind.h \ $(EXTRA_HEADERS) # APPLE LOCAL end radar 2872232 add tgmath.h +UNWIND_H = $(srcdir)/unwind-generic.h + # The GCC to use for compiling libgcc.a and crt*.o. # Usually the one we just built. # Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS). @@ -582,7 +583,7 @@ $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c LIB2ADDEHSTATIC = $(LIB2ADDEH) LIB2ADDEHSHARED = $(LIB2ADDEH) -LIB2ADDEHDEP = unwind.h unwind-pe.h unwind.inc unwind-dw2-fde.h unwind-dw2.h +LIB2ADDEHDEP = $(UNWIND_H) unwind-pe.h unwind.inc unwind-dw2-fde.h unwind-dw2.h # Don't build libunwind by default. LIBUNWIND = @@ -3129,7 +3130,7 @@ # be rebuilt. # Build the include directory -stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) xlimits.h +stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) xlimits.h $(UNWIND_H) # Copy in the headers provided with gcc. # The sed command gets just the last file name component; # this is necessary because VPATH could add a dirname. @@ -3147,6 +3148,7 @@ done rm -f include/limits.h cp xlimits.h include/limits.h + cp $(UNWIND_H) include/unwind.h chmod a+r include/limits.h # Install the README rm -f include/README @@ -3772,6 +3774,7 @@ $(DESTDIR)$(itoolsdatadir)/include/$$realfile ; \ done $(INSTALL_DATA) xlimits.h $(DESTDIR)$(itoolsdatadir)/include/limits.h + $(INSTALL_DATA) $(UNWIND_H) $(DESTDIR)$(itoolsdatadir)/include/unwind.h $(INSTALL_DATA) $(srcdir)/gsyslimits.h \ $(DESTDIR)$(itoolsdatadir)/gsyslimits.h $(INSTALL_DATA) macro_list $(DESTDIR)$(itoolsdatadir)/macro_list Modified: apple-local/branches/llvm/gcc/ada/misc.c =================================================================== --- apple-local/branches/llvm/gcc/ada/misc.c 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/ada/misc.c 2007-04-03 00:13:00 UTC (rev 125638) @@ -478,6 +478,9 @@ using_eh_for_cleanups (); eh_personality_libfunc = init_one_libfunc ("__gnat_eh_personality"); + /* APPLE LOCAL begin LLVM */ + default_init_unwind_resume_libfunc (); + /* APPLE LOCAL end LLVM */ lang_eh_type_covers = gnat_eh_type_covers; lang_eh_runtime_type = gnat_eh_runtime_type; Modified: apple-local/branches/llvm/gcc/c-decl.c =================================================================== --- apple-local/branches/llvm/gcc/c-decl.c 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/c-decl.c 2007-04-03 00:13:00 UTC (rev 125638) @@ -3765,6 +3765,9 @@ = init_one_libfunc (USING_SJLJ_EXCEPTIONS ? "__gcc_personality_sj0" : "__gcc_personality_v0"); + /* APPLE LOCAL begin LLVM */ + default_init_unwind_resume_libfunc (); + /* APPLE LOCAL end LLVM */ using_eh_for_cleanups (); } Modified: apple-local/branches/llvm/gcc/config/arm/arm.c =================================================================== --- apple-local/branches/llvm/gcc/config/arm/arm.c 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/config/arm/arm.c 2007-04-03 00:13:00 UTC (rev 125638) @@ -171,6 +171,14 @@ static bool arm_promote_prototypes (tree); static bool arm_default_short_enums (void); static bool arm_align_anon_bitfield (void); +/* APPLE LOCAL begin LLVM */ +static bool arm_return_in_msb (tree); +static bool arm_must_pass_in_stack (enum machine_mode, tree); +#ifdef TARGET_UNWIND_INFO +static void arm_unwind_emit (FILE *, rtx); +static bool arm_output_ttype (rtx); +#endif +/* APPLE LOCAL end LLVM */ static tree arm_cxx_guard_type (void); static bool arm_cxx_guard_mask_bit (void); @@ -182,6 +190,9 @@ static void arm_cxx_determine_class_data_visibility (tree); static bool arm_cxx_class_data_always_comdat (void); /* APPLE LOCAL end mainline 4.2 2006-03-01 4311680 */ +/* APPLE LOCAL begin LLVM */ +static bool arm_cxx_use_aeabi_atexit (void); +/* APPLE LOCAL end LLVM */ static void arm_init_libfuncs (void); static unsigned HOST_WIDE_INT arm_shift_truncation_mask (enum machine_mode); @@ -325,6 +336,30 @@ #define TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT arm_cxx_class_data_always_comdat /* APPLE LOCAL end mainline 4.2 2006-03-01 4311680 */ + +/* APPLE LOCAL begin LLVM */ +#undef TARGET_CXX_USE_AEABI_ATEXIT +#define TARGET_CXX_USE_AEABI_ATEXIT arm_cxx_use_aeabi_atexit + +#undef TARGET_RETURN_IN_MSB +#define TARGET_RETURN_IN_MSB arm_return_in_msb + +#undef TARGET_MUST_PASS_IN_STACK +#define TARGET_MUST_PASS_IN_STACK arm_must_pass_in_stack + +#ifdef TARGET_UNWIND_INFO +#undef TARGET_UNWIND_EMIT +#define TARGET_UNWIND_EMIT arm_unwind_emit + +/* EABI unwinding tables use a different format for the typeinfo tables. */ +#undef TARGET_ASM_TTYPE +#define TARGET_ASM_TTYPE arm_output_ttype + +#undef TARGET_ARM_EABI_UNWINDER +#define TARGET_ARM_EABI_UNWINDER true +#endif /* TARGET_UNWIND_INFO */ +/* APPLE LOCAL end LLVM */ + struct gcc_target targetm = TARGET_INITIALIZER; /* Obstack for minipool constant handling. */ @@ -2316,11 +2351,25 @@ int unsignedp ATTRIBUTE_UNUSED; rtx r ATTRIBUTE_UNUSED; - mode = TYPE_MODE (type); /* Promote integer types. */ if (INTEGRAL_TYPE_P (type)) PROMOTE_FUNCTION_MODE (mode, unsignedp, type); + + /* APPLE LOCAL begin LLVM */ + /* Promotes small structs returned in a register to full-word size + for big-endian AAPCS. */ + if (arm_return_in_msb (type)) + { + HOST_WIDE_INT size = int_size_in_bytes (type); + if (size % UNITS_PER_WORD != 0) + { + size += UNITS_PER_WORD - size % UNITS_PER_WORD; + mode = mode_for_size (size * BITS_PER_UNIT, MODE_INT, 0); + } + } + /* APPLE LOCAL end LLVM */ + return LIBCALL_VALUE(mode); } @@ -4886,7 +4935,20 @@ return GENERAL_REGS; } +/* APPLE LOCAL begin LLVM */ +/* Values which must be returned in the most-significant end of the return + register. */ +static bool +arm_return_in_msb (tree valtype) +{ + return (TARGET_AAPCS_BASED + && BYTES_BIG_ENDIAN + && (AGGREGATE_TYPE_P (valtype) + || TREE_CODE (valtype) == COMPLEX_TYPE)); +} +/* APPLE LOCAL end LLVM */ + /* Returns TRUE if INSN is an "LDR REG, ADDR" instruction. Use by the Cirrus Maverick code which has to workaround a hardware bug triggered by such instructions. */ @@ -6462,6 +6524,60 @@ gen_lowpart (QImode, scratch))); } } + +/* APPLE LOCAL begin LLVM */ +/* Return true if a type must be passed in memory. For AAPCS, small aggregates + (padded to the size of a word) should be passed in a register. */ + +static bool +arm_must_pass_in_stack (enum machine_mode mode, tree type) +{ + if (TARGET_AAPCS_BASED) + return must_pass_in_stack_var_size (mode, type); + else + return must_pass_in_stack_var_size_or_pad (mode, type); +} + + +/* For use by FUNCTION_ARG_PADDING (MODE, TYPE). + Return true if an argument passed on the stack should be padded upwards, + i.e. if the least-significant byte has useful data. */ + +bool +arm_pad_arg_upward (enum machine_mode mode, tree type) +{ + if (!TARGET_AAPCS_BASED) + return DEFAULT_FUNCTION_ARG_PADDING(mode, type); + + if (type && BYTES_BIG_ENDIAN && INTEGRAL_TYPE_P (type)) + return false; + + return true; +} + + +/* Similarly, for use by BLOCK_REG_PADDING (MODE, TYPE, FIRST). + For non-AAPCS, return !BYTES_BIG_ENDIAN if the least significant + byte of the register has useful data, and return the opposite if the + most significant byte does. + For AAPCS, small aggregates and small complex types are always padded + upwards. */ + +bool +arm_pad_reg_upward (enum machine_mode mode ATTRIBUTE_UNUSED, + tree type, int first ATTRIBUTE_UNUSED) +{ + if (TARGET_AAPCS_BASED + && BYTES_BIG_ENDIAN + && (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == COMPLEX_TYPE) + && int_size_in_bytes (type) <= 4) + return true; + + /* Otherwise, use default padding. */ + return !BYTES_BIG_ENDIAN; +} +/* APPLE LOCAL end LLVM */ + /* Print a symbolic form of X to the debug file, F. */ static void @@ -12690,6 +12806,23 @@ return; } + /* APPLE LOCAL begin LLVM */ + if (ARM_EABI_UNWIND_TABLES && push) + { + fprintf (f, "\t.save\t{"); + for (regno = 0; regno < 15; regno++) + { + if (real_regs & (1 << regno)) + { + if (real_regs & ((1 << regno) -1)) + fprintf (f, ", "); + asm_fprintf (f, "%r", regno); + } + } + fprintf (f, "}\n"); + } + /* APPLE LOCAL end LLVM */ + fprintf (f, "\t%s\t{", push ? "push" : "pop"); /* Look at the low registers first. */ @@ -13374,6 +13507,13 @@ if (current_function_pretend_args_size) { + /* APPLE LOCAL begin LLVM */ + /* Output unwind directive for the stack adjustment. */ + if (ARM_EABI_UNWIND_TABLES) + fprintf (f, "\t.pad #%d\n", + current_function_pretend_args_size); + /* APPLE LOCAL end LLVM */ + if (cfun->machine->uses_anonymous_args) { int num_pushes; @@ -13435,6 +13575,11 @@ work_register = thumb_find_work_register (live_regs_mask); + /* APPLE LOCAL begin LLVM */ + if (ARM_EABI_UNWIND_TABLES) + asm_fprintf (f, "\t.pad #16\n"); + /* APPLE LOCAL end LLVM */ + asm_fprintf (f, "\tsub\t%r, %r, #16\t%@ Create stack backtrace structure\n", SP_REGNUM, SP_REGNUM); @@ -14511,6 +14656,14 @@ /* APPLE LOCAL end mainline 4.2 2006-03-01 4311680 */ } +/* APPLE LOCAL begin LLVM */ +static bool +arm_cxx_use_aeabi_atexit (void) +{ + return TARGET_AAPCS_BASED; +} +/* APPLE LOCAL end LLVM */ + void arm_set_return_address (rtx source, rtx scratch) { @@ -14624,3 +14777,290 @@ { return mode == SImode ? 255 : 0; } + + +/* APPLE LOCAL begin LLVM */ +/* Map internal gcc register numbers to DWARF2 register numbers. */ + +unsigned int +arm_dbx_register_number (unsigned int regno) +{ + if (regno < 16) + return regno; + + /* TODO: Legacy targets output FPA regs as registers 16-23 for backwards + compatibility. The EABI defines them as registers 96-103. */ + if (IS_FPA_REGNUM (regno)) + return (TARGET_AAPCS_BASED ? 96 : 16) + regno - FIRST_FPA_REGNUM; + + if (IS_VFP_REGNUM (regno)) + return 64 + regno - FIRST_VFP_REGNUM; + + if (IS_IWMMXT_GR_REGNUM (regno)) + return 104 + regno - FIRST_IWMMXT_GR_REGNUM; + + if (IS_IWMMXT_REGNUM (regno)) + return 112 + regno - FIRST_IWMMXT_REGNUM; + + abort (); +} + + +#ifdef TARGET_UNWIND_INFO +/* Emit unwind directives for a store-multiple instruction. This should + only ever be generated by the function prologue code, so we expect it + to have a particular form. */ + +static void +arm_unwind_emit_stm (FILE * asm_out_file, rtx p) +{ + int i; + HOST_WIDE_INT offset; + HOST_WIDE_INT nregs; + int reg_size; + unsigned reg; + unsigned lastreg; + rtx e; + + /* First insn will adjust the stack pointer. */ + e = XVECEXP (p, 0, 0); + if (GET_CODE (e) != SET + || GET_CODE (XEXP (e, 0)) != REG + || REGNO (XEXP (e, 0)) != SP_REGNUM + || GET_CODE (XEXP (e, 1)) != PLUS) + abort (); + + offset = -INTVAL (XEXP (XEXP (e, 1), 1)); + nregs = XVECLEN (p, 0) - 1; + + reg = REGNO (XEXP (XVECEXP (p, 0, 1), 1)); + if (reg < 16) + { + /* The function prologue may also push pc, but not annotate it as it is + never restored. We turn this into an stack pointer adjustment. */ + if (nregs * 4 == offset - 4) + { + fprintf (asm_out_file, "\t.pad #4\n"); + offset -= 4; + } + reg_size = 4; + } + else if (IS_VFP_REGNUM (reg)) + { + /* FPA register saves use an additional word. */ + offset -= 4; + reg_size = 8; + } + else if (reg >= FIRST_FPA_REGNUM && reg <= LAST_FPA_REGNUM) + { + /* FPA registers are done differently. */ + asm_fprintf (asm_out_file, "\t.save %r, %lld\n", reg, nregs); + return; + } + else + /* Unknown register type. */ + abort (); + + /* If the stack increment doesn't match the size of the saved registers, + something has gone horribly wrong. */ + if (offset != nregs * reg_size) + abort (); + + fprintf (asm_out_file, "\t.save {"); + + offset = 0; + lastreg = 0; + /* The remaining insns will describe the stores. */ + for (i = 1; i <= nregs; i++) + { + /* Expect (set (mem ) (reg)). + Where is (reg:SP) or (plus (reg:SP) (const_int)). */ + e = XVECEXP (p, 0, i); + if (GET_CODE (e) != SET + || GET_CODE (XEXP (e, 0)) != MEM + || GET_CODE (XEXP (e, 1)) != REG) + abort (); + + reg = REGNO (XEXP (e, 1)); + if (reg < lastreg) + abort (); + + if (i != 1) + fprintf (asm_out_file, ", "); + /* We can't use %r for vfp because we need to use the + double precision register names. */ + if (IS_VFP_REGNUM (reg)) + asm_fprintf (asm_out_file, "d%d", (reg - FIRST_VFP_REGNUM) / 2); + else + asm_fprintf (asm_out_file, "%r", reg); + +#ifdef ENABLE_CHECKING + /* Check that the addresses are consecutive. */ + e = XEXP (XEXP (e, 0), 0); + if (GET_CODE (e) == PLUS) + { + offset += reg_size; + if (GET_CODE (XEXP (e, 0)) != REG + || REGNO (XEXP (e, 0)) != SP_REGNUM + || GET_CODE (XEXP (e, 1)) != CONST_INT + || offset != INTVAL (XEXP (e, 1))) + abort (); + } + else if (i != 1 + || GET_CODE (e) != REG + || REGNO (e) != SP_REGNUM) + abort (); +#endif + } + fprintf (asm_out_file, "}\n"); +} + +/* Emit unwind directives for a SET. */ + +static void +arm_unwind_emit_set (FILE * asm_out_file, rtx p) +{ + rtx e0; + rtx e1; + + e0 = XEXP (p, 0); + e1 = XEXP (p, 1); + switch (GET_CODE (e0)) + { + case MEM: + /* Pushing a single register. */ + if (GET_CODE (XEXP (e0, 0)) != PRE_DEC + || GET_CODE (XEXP (XEXP (e0, 0), 0)) != REG + || REGNO (XEXP (XEXP (e0, 0), 0)) != SP_REGNUM) + abort (); + + asm_fprintf (asm_out_file, "\t.save "); + if (IS_VFP_REGNUM (REGNO (e1))) + asm_fprintf(asm_out_file, "{d%d}\n", + (REGNO (e1) - FIRST_VFP_REGNUM) / 2); + else + asm_fprintf(asm_out_file, "{%r}\n", REGNO (e1)); + break; + + case REG: + if (REGNO (e0) == SP_REGNUM) + { + /* A stack increment. */ + if (GET_CODE (e1) != PLUS + || GET_CODE (XEXP (e1, 0)) != REG + || REGNO (XEXP (e1, 0)) != SP_REGNUM + || GET_CODE (XEXP (e1, 1)) != CONST_INT) + abort (); + + asm_fprintf (asm_out_file, "\t.pad #%lld\n", + -INTVAL (XEXP (e1, 1))); + } + else if (REGNO (e0) == HARD_FRAME_POINTER_REGNUM) + { + HOST_WIDE_INT offset; + unsigned reg; + + if (GET_CODE (e1) == PLUS) + { + if (GET_CODE (XEXP (e1, 0)) != REG + || GET_CODE (XEXP (e1, 1)) != CONST_INT) + abort (); + reg = REGNO (XEXP (e1, 0)); + offset = INTVAL (XEXP (e1, 1)); + asm_fprintf (asm_out_file, "\t.setfp %r, %r, #%lld\n", + HARD_FRAME_POINTER_REGNUM, reg, + INTVAL (XEXP (e1, 1))); + } + else if (GET_CODE (e1) == REG) + { + reg = REGNO (e1); + asm_fprintf (asm_out_file, "\t.setfp %r, %r\n", + HARD_FRAME_POINTER_REGNUM, reg); + } + else + abort (); + } + else if (GET_CODE (e1) == REG && REGNO (e1) == SP_REGNUM) + { + /* Move from sp to reg. */ + asm_fprintf (asm_out_file, "\t.movsp %r\n", REGNO (e0)); + } + else + abort (); + break; + + default: + abort (); + } +} + + +/* Emit unwind directives for the given insn. */ + +static void +arm_unwind_emit (FILE * asm_out_file, rtx insn) +{ + rtx pat; + + if (!ARM_EABI_UNWIND_TABLES) + return; + + if (GET_CODE (insn) == NOTE || !RTX_FRAME_RELATED_P (insn)) + return; + + pat = find_reg_note (insn, REG_FRAME_RELATED_EXPR, NULL_RTX); + if (pat) + pat = XEXP (pat, 0); + else + pat = PATTERN (insn); + + switch (GET_CODE (pat)) + { + case SET: + arm_unwind_emit_set (asm_out_file, pat); + break; + + case SEQUENCE: + /* Store multiple. */ + arm_unwind_emit_stm (asm_out_file, pat); + break; + + default: + abort(); + } +} + + +/* Output a reference from a function exception table to the type_info + object X. The EABI specifies that the symbol should be relocated by + an R_ARM_TARGET2 relocation. */ + +static bool +arm_output_ttype (rtx x) +{ + fputs ("\t.word\t", asm_out_file); + output_addr_const (asm_out_file, x); + /* Use special relocations for symbol references. */ + if (GET_CODE (x) != CONST_INT) + fputs ("(TARGET2)", asm_out_file); + fputc ('\n', asm_out_file); + + return TRUE; +} +#endif /* TARGET_UNWIND_INFO */ + + +/* Output unwind directives for the start/end of a function. */ + +void +arm_output_fn_unwind (FILE * f, bool prologue) +{ + if (!ARM_EABI_UNWIND_TABLES) + return; + + if (prologue) + fputs ("\t.fnstart\n", f); + else + fputs ("\t.fnend\n", f); +} +/* APPLE LOCAL end LLVM */ Modified: apple-local/branches/llvm/gcc/config/arm/arm.h =================================================================== --- apple-local/branches/llvm/gcc/config/arm/arm.h 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/config/arm/arm.h 2007-04-03 00:13:00 UTC (rev 125638) @@ -609,10 +609,13 @@ (MODE) = SImode; \ } +/* APPLE LOCAL begin LLVM */ #define PROMOTE_FUNCTION_MODE(MODE, UNSIGNEDP, TYPE) \ - if (GET_MODE_CLASS (MODE) == MODE_INT \ - && GET_MODE_SIZE (MODE) < 4) \ - (MODE) = SImode; \ + if ((GET_MODE_CLASS (MODE) == MODE_INT \ + || GET_MODE_CLASS (MODE) == MODE_COMPLEX_INT) \ + && GET_MODE_SIZE (MODE) < 4) \ + (MODE) = SImode; \ +/* APPLE LOCAL end LLVM */ /* Define this if most significant bit is lowest numbered in instructions that operate on numbered bit-fields. */ @@ -992,8 +995,13 @@ #define FIRST_HI_REGNUM 8 #define LAST_HI_REGNUM 11 +/* APPLE LOCAL begin LLVM */ +#ifndef TARGET_UNWIND_INFO /* We use sjlj exceptions for backwards compatibility. */ #define MUST_USE_SJLJ_EXCEPTIONS 1 +#endif +/* APPLE LOCAL end LLVM */ + /* We can generate DWARF2 Unwind info, even though we don't use it. */ #define DWARF2_UNWIND_INFO 1 @@ -1041,6 +1049,10 @@ /* ARM floating pointer registers. */ #define FIRST_FPA_REGNUM 16 #define LAST_FPA_REGNUM 23 +/* APPLE LOCAL begin LLVM */ +#define IS_FPA_REGNUM(REGNUM) \ + (((REGNUM) >= FIRST_FPA_REGNUM) && ((REGNUM) <= LAST_FPA_REGNUM)) +/* APPLE LOCAL end LLVM */ #define FIRST_IWMMXT_GR_REGNUM 43 #define LAST_IWMMXT_GR_REGNUM 46 @@ -1073,6 +1085,10 @@ /* VFP adds 32 + 1 more. */ #define FIRST_PSEUDO_REGISTER 96 +/* APPLE LOCAL begin LLVM */ +#define DBX_REGISTER_NUMBER(REGNO) arm_dbx_register_number (REGNO) +/* APPLE LOCAL end LLVM */ + /* Value should be nonzero if functions must have frame pointers. Zero means the frame pointer need not be set up (and parms may be accessed via the stack pointer) in functions that seem suitable. @@ -1764,6 +1780,19 @@ #define FUNCTION_ARG(CUM, MODE, TYPE, NAMED) \ arm_function_arg (&(CUM), (MODE), (TYPE), (NAMED)) +/* APPLE LOCAL begin LLVM */ +#define FUNCTION_ARG_PADDING(MODE, TYPE) \ + (arm_pad_arg_upward (MODE, TYPE) ? upward : downward) + +#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ + (arm_pad_reg_upward (MODE, TYPE, FIRST) ? upward : downward) + +/* For AAPCS, padding should never be below the argument. For other ABIs, + * mimic the default. */ +#define PAD_VARARGS_DOWN \ + ((TARGET_AAPCS_BASED) ? 0 : BYTES_BIG_ENDIAN) +/* APPLE LOCAL end LLVM */ + /* Initialize a variable CUM of type CUMULATIVE_ARGS for a call to a function whose data type is FNTYPE. For a library call, FNTYPE is 0. @@ -2128,6 +2157,17 @@ if (!TARGET_LONG_CALLS || ! DECL_SECTION_NAME (DECL)) \ arm_encode_call_attribute (DECL, SHORT_CALL_FLAG_CHAR) +/* APPLE LOCAL begin LLVM */ +#define ARM_OUTPUT_FN_UNWIND(F, PROLOGUE) arm_output_fn_unwind (F, PROLOGUE) + +#ifdef TARGET_UNWIND_INFO +#define ARM_EABI_UNWIND_TABLES \ + ((!USING_SJLJ_EXCEPTIONS && flag_exceptions) || flag_unwind_tables) +#else +#define ARM_EABI_UNWIND_TABLES 0 +#endif +/* APPLE LOCAL end LLVM */ + /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx and check its validity for a certain class. We have two alternate definitions for each of them. Modified: apple-local/branches/llvm/gcc/config/arm/bpabi.h =================================================================== --- apple-local/branches/llvm/gcc/config/arm/bpabi.h 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/config/arm/bpabi.h 2007-04-03 00:13:00 UTC (rev 125638) @@ -26,6 +26,11 @@ /* Assume that AAPCS ABIs should adhere to the full BPABI. */ #define TARGET_BPABI (TARGET_AAPCS_BASED) +/* APPLE LOCAL begin LLVM */ +/* BPABI targets use EABI frame unwinding tables. */ +#define TARGET_UNWIND_INFO 1 +/* APPLE LOCAL end LLVM */ + /* Section 4.1 of the AAPCS requires the use of VFP format. */ /* APPLE LOCAL begin LLVM */ #undef FPUTYPE_DEFAULT Modified: apple-local/branches/llvm/gcc/config/arm/elf.h =================================================================== --- apple-local/branches/llvm/gcc/config/arm/elf.h 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/config/arm/elf.h 2007-04-03 00:13:00 UTC (rev 125638) @@ -77,6 +77,9 @@ ASM_OUTPUT_TYPE_DIRECTIVE (FILE, NAME, "function"); \ ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \ ASM_OUTPUT_LABEL(FILE, NAME); \ +/* APPLE LOCAL begin LLVM */ \ + ARM_OUTPUT_FN_UNWIND (FILE, TRUE); \ +/* APPLE LOCAL end LLVM */ \ } \ while (0) @@ -85,6 +88,9 @@ #define ASM_DECLARE_FUNCTION_SIZE(FILE, FNAME, DECL) \ do \ { \ +/* APPLE LOCAL begin LLVM */ \ + ARM_OUTPUT_FN_UNWIND (FILE, FALSE); \ +/* APPLE LOCAL end LLVM */ \ ARM_DECLARE_FUNCTION_SIZE (FILE, FNAME, DECL); \ if (!flag_inhibit_size_directive) \ ASM_OUTPUT_MEASURED_SIZE (FILE, FNAME); \ Modified: apple-local/branches/llvm/gcc/config/arm/lib1funcs.asm =================================================================== --- apple-local/branches/llvm/gcc/config/arm/lib1funcs.asm 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/config/arm/lib1funcs.asm 2007-04-03 00:13:00 UTC (rev 125638) @@ -637,6 +637,9 @@ #ifdef L_udivsi3 FUNC_START udivsi3 +/* APPLE LOCAL begin LLVM */ + FUNC_ALIAS aeabi_uidiv udivsi3 +/* APPLE LOCAL end LLVM */ #ifdef __thumb__ @@ -747,6 +750,9 @@ #ifdef L_divsi3 FUNC_START divsi3 +/* APPLE LOCAL begin LLVM */ + FUNC_ALIAS aeabi_idiv divsi3 +/* APPLE LOCAL end LLVM */ #ifdef __thumb__ cmp divisor, #0 @@ -1230,4 +1236,7 @@ #include "ieee754-df.S" #include "ieee754-sf.S" #include "bpabi.S" +/* APPLE LOCAL begin LLVM */ +#include "libunwind.S" +/* APPLE LOCAL end LLVM */ #endif /* __symbian__ */ Modified: apple-local/branches/llvm/gcc/config/arm/libgcc-bpabi.ver =================================================================== --- apple-local/branches/llvm/gcc/config/arm/libgcc-bpabi.ver 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/config/arm/libgcc-bpabi.ver 2007-04-03 00:13:00 UTC (rev 125638) @@ -42,6 +42,9 @@ __aeabi_fsub __aeabi_i2d __aeabi_i2f +#APPLE LOCAL begin LLVM + __aeabi_idiv +#APPLE LOCAL end LLVM __aeabi_idiv0 __aeabi_idivmod __aeabi_l2d @@ -55,9 +58,32 @@ __aeabi_lmul __aeabi_ui2d __aeabi_ui2f +#APPLE LOCAL begin LLVM + __aeabi_uidiv +#APPLE LOCAL end LLVM __aeabi_uidivmod __aeabi_uldivmod __aeabi_ulcmp __aeabi_ul2d __aeabi_ul2f +#APPLE LOCAL begin LLVM + __aeabi_uread4 + __aeabi_uread8 + __aeabi_uwrite4 + __aeabi_uwrite8 + + # Exception-Handling + # \S 7.5 + _Unwind_Complete + _Unwind_VRS_Get + _Unwind_VRS_Set + _Unwind_VRS_Pop + # \S 9.2 + __aeabi_unwind_cpp_pr0 + __aeabi_unwind_cpp_pr1 + __aeabi_unwind_cpp_pr2 + # The libstdc++ exception-handling personality routine uses this + # GNU-specific entry point. + __gnu_unwind_frame +#APPLE LOCAL end LLVM } Modified: apple-local/branches/llvm/gcc/config/arm/t-bpabi =================================================================== --- apple-local/branches/llvm/gcc/config/arm/t-bpabi 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/config/arm/t-bpabi 2007-04-03 00:13:00 UTC (rev 125638) @@ -1,9 +1,20 @@ # Add the bpabi.S functions. -LIB1ASMFUNCS += _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod +#APPLE LOCAL begin LLVM +LIB1ASMFUNCS += _aeabi_lcmp _aeabi_ulcmp _aeabi_ldivmod _aeabi_uldivmod \ + _unwind +#APPLE LOCAL end LLVM # Add the BPABI C functions. -LIB2FUNCS_EXTRA = $(srcdir)/config/arm/bpabi.c +#APPLE LOCAL begin LLVM +LIB2FUNCS_EXTRA = $(srcdir)/config/arm/bpabi.c \ + $(srcdir)/config/arm/unaligned-funcs.c +UNWIND_H = $(srcdir)/config/arm/unwind-arm.h +LIB2ADDEH = $(srcdir)/config/arm/unwind-arm.c \ + $(srcdir)/config/arm/pr-support.c $(srcdir)/unwind-c.c +LIB2ADDEHDEP = $(UNWIND_H) +#APPLE LOCAL end LLVM + # Add the BPABI names. SHLIB_MAPFILES += $(srcdir)/config/arm/libgcc-bpabi.ver Modified: apple-local/branches/llvm/gcc/config/arm/t-symbian =================================================================== --- apple-local/branches/llvm/gcc/config/arm/t-symbian 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/config/arm/t-symbian 2007-04-03 00:13:00 UTC (rev 125638) @@ -12,6 +12,13 @@ _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \ _fixsfsi _fixunssfsi +#APPLE LOCAL begin LLVM +# Include the gcc personality routine +UNWIND_H = $(srcdir)/config/arm/unwind-arm.h +LIB2ADDEH = $(srcdir)/unwind-c.c +LIB2ADDEHDEP = $(UNWIND_H) +#APPLE LOCAL end LLVM + # Create a multilib for processors with VFP floating-point, and a # multilib for those without -- using the soft-float ABI in both # cases. Symbian OS object should be compiled with interworking Modified: apple-local/branches/llvm/gcc/config/i386/t-netware =================================================================== --- apple-local/branches/llvm/gcc/config/i386/t-netware 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/config/i386/t-netware 2007-04-03 00:13:00 UTC (rev 125638) @@ -6,5 +6,4 @@ # We don't need some of GCC's own include files. USER_H = $(srcdir)/ginclude/stdarg.h \ $(srcdir)/ginclude/varargs.h \ - $(srcdir)/unwind.h \ $(EXTRA_HEADERS) $(LANG_EXTRA_HEADERS) Modified: apple-local/branches/llvm/gcc/config/ia64/ia64.h =================================================================== --- apple-local/branches/llvm/gcc/config/ia64/ia64.h 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/config/ia64/ia64.h 2007-04-03 00:13:00 UTC (rev 125638) @@ -2176,6 +2176,10 @@ #define TARGET_UNWIND_INFO 1 +/* APPLE LOCAL begin LLVM */ +#define TARGET_UNWIND_TABLES_DEFAULT true +/* APPLE LOCAL end LLVM */ + #define EH_RETURN_DATA_REGNO(N) ((N) < 4 ? (N) + 15 : INVALID_REGNUM) /* This function contains machine specific function data. */ Modified: apple-local/branches/llvm/gcc/cp/Make-lang.in =================================================================== --- apple-local/branches/llvm/gcc/cp/Make-lang.in 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/cp/Make-lang.in 2007-04-03 00:13:00 UTC (rev 125638) @@ -291,8 +291,8 @@ # APPLE LOCAL end mainline cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H) cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) flags.h toplev.h convert.h -cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) except.h toplev.h \ - cp/cfns.h $(EXPR_H) libfuncs.h tree-inline.h +cp/except.o: cp/except.c $(CXX_TREE_H) $(TM_H) flags.h $(RTL_H) except.h \ + toplev.h cp/cfns.h $(EXPR_H) libfuncs.h tree-inline.h $(TARGET_H) cp/expr.o: cp/expr.c $(CXX_TREE_H) $(TM_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \ except.h $(TM_P_H) # APPLE LOCAL begin mainline Modified: apple-local/branches/llvm/gcc/cp/decl.c =================================================================== --- apple-local/branches/llvm/gcc/cp/decl.c 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/cp/decl.c 2007-04-03 00:13:00 UTC (rev 125638) @@ -5216,6 +5216,9 @@ tree fn_type; tree fn_ptr_type; const char *name; + /* APPLE LOCAL begin LLVM */ + bool use_aeabi_atexit; + /* APPLE LOCAL end LLVM */ if (atexit_node) return atexit_node; @@ -5229,6 +5232,9 @@ We build up the argument types and then then function type itself. */ + /* APPLE LOCAL begin LLVM */ + use_aeabi_atexit = targetm.cxx.use_aeabi_atexit (); + /* APPLE LOCAL end LLVM */ /* First, build the pointer-to-function type for the first argument. */ arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node); @@ -5236,12 +5242,27 @@ fn_ptr_type = build_pointer_type (fn_type); /* Then, build the rest of the argument types. */ arg_types = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types); - arg_types = tree_cons (NULL_TREE, fn_ptr_type, arg_types); + /* APPLE LOCAL begin LLVM */ + if (use_aeabi_atexit) + { + arg_types = tree_cons (NULL_TREE, fn_ptr_type, arg_types); + arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types); + } + else + { + arg_types = tree_cons (NULL_TREE, ptr_type_node, arg_types); + arg_types = tree_cons (NULL_TREE, fn_ptr_type, arg_types); + } + /* APPLE LOCAL end LLVM */ /* And the final __cxa_atexit type. */ fn_type = build_function_type (integer_type_node, arg_types); fn_ptr_type = build_pointer_type (fn_type); - name = "__cxa_atexit"; + /* APPLE LOCAL begin LLVM */ + if (use_aeabi_atexit) + name = "__aeabi_atexit"; + else + name = "__cxa_atexit"; + /* APPLE LOCAL end LLVM */ } else { @@ -5402,8 +5423,18 @@ args = tree_cons (NULL_TREE, build_unary_op (ADDR_EXPR, get_dso_handle_node (), 0), NULL_TREE); - args = tree_cons (NULL_TREE, null_pointer_node, args); - args = tree_cons (NULL_TREE, cleanup, args); + /* APPLE LOCAL begin LLVM */ + if (targetm.cxx.use_aeabi_atexit ()) + { + args = tree_cons (NULL_TREE, cleanup, args); + args = tree_cons (NULL_TREE, null_pointer_node, args); + } + else + { + args = tree_cons (NULL_TREE, null_pointer_node, args); + args = tree_cons (NULL_TREE, cleanup, args); + } + /* APPLE LOCAL end LLVM */ } else args = tree_cons (NULL_TREE, cleanup, NULL_TREE); Modified: apple-local/branches/llvm/gcc/cp/except.c =================================================================== --- apple-local/branches/llvm/gcc/cp/except.c 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/cp/except.c 2007-04-03 00:13:00 UTC (rev 125638) @@ -38,6 +38,9 @@ #include "toplev.h" #include "tree-inline.h" #include "tree-iterator.h" +/* APPLE LOCAL begin LLVM */ +#include "target.h" +/* APPLE LOCAL end LLVM */ static void push_eh_cleanup (tree); static tree prepare_eh_type (tree); @@ -79,6 +82,12 @@ eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS ? "__gxx_personality_sj0" : "__gxx_personality_v0"); +/* APPLE LOCAL begin LLVM */ + if (targetm.arm_eabi_unwinder) + unwind_resume_libfunc = init_one_libfunc ("__cxa_end_cleanup"); + else + default_init_unwind_resume_libfunc (); +/* APPLE LOCAL end LLVM */ lang_eh_runtime_type = build_eh_type_type; lang_protect_cleanup_actions = &cp_protect_cleanup_actions; Modified: apple-local/branches/llvm/gcc/except.c =================================================================== --- apple-local/branches/llvm/gcc/except.c 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/except.c 2007-04-03 00:13:00 UTC (rev 125638) @@ -235,7 +235,9 @@ int built_landing_pads; int last_region_number; - varray_type ttype_data; +/* APPLE LOCAL begin LLVM */ + VEC(tree) *ttype_data; +/* APPLE LOCAL end LLVM */ varray_type ehspec_data; varray_type action_record_data; @@ -967,10 +969,14 @@ n = xmalloc (sizeof (*n)); n->t = type; - n->filter = VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data) + 1; +/* APPLE LOCAL begin LLVM */ + n->filter = VEC_length (tree, cfun->eh->ttype_data) + 1; +/* APPLE LOCAL end LLVM */ *slot = n; - VARRAY_PUSH_TREE (cfun->eh->ttype_data, type); +/* APPLE LOCAL begin LLVM */ + VEC_safe_push (tree, cfun->eh->ttype_data, type); +/* APPLE LOCAL end LLVM */ } return n->filter; @@ -998,12 +1004,25 @@ n->filter = -(VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data) + 1); *slot = n; - /* Look up each type in the list and encode its filter - value as a uleb128. Terminate the list with 0. */ +/* APPLE LOCAL begin LLVM */ + /* Generate a 0 terminated list of filter values. */ for (; list ; list = TREE_CHAIN (list)) - push_uleb128 (&cfun->eh->ehspec_data, - add_ttypes_entry (ttypes_hash, TREE_VALUE (list))); - VARRAY_PUSH_UCHAR (cfun->eh->ehspec_data, 0); + { + if (targetm.arm_eabi_unwinder) + VARRAY_PUSH_TREE (cfun->eh->ehspec_data, TREE_VALUE (list)); + else + { + /* Look up each type in the list and encode its filter + value as a uleb128. */ + push_uleb128 (&cfun->eh->ehspec_data, + add_ttypes_entry (ttypes_hash, TREE_VALUE (list))); + } + } + if (targetm.arm_eabi_unwinder) + VARRAY_PUSH_TREE (cfun->eh->ehspec_data, NULL_TREE); + else + VARRAY_PUSH_UCHAR (cfun->eh->ehspec_data, 0); +/* APPLE LOCAL end LLVM */ } return n->filter; @@ -1020,8 +1039,13 @@ int i; htab_t ttypes, ehspec; - VARRAY_TREE_INIT (cfun->eh->ttype_data, 16, "ttype_data"); - VARRAY_UCHAR_INIT (cfun->eh->ehspec_data, 64, "ehspec_data"); +/* APPLE LOCAL begin LLVM */ + cfun->eh->ttype_data = VEC_alloc (tree, 16); + if (targetm.arm_eabi_unwinder) + VARRAY_TREE_INIT (cfun->eh->ehspec_data, 64, "ehspec_data"); + else + VARRAY_UCHAR_INIT (cfun->eh->ehspec_data, 64, "ehspec_data"); +/* APPLE LOCAL end LLVM */ ttypes = htab_create (31, ttypes_filter_hash, ttypes_filter_eq, free); ehspec = htab_create (31, ehspec_filter_hash, ehspec_filter_eq, free); @@ -3228,6 +3252,56 @@ readonly_data_section (); } + +/* APPLE LOCAL begin LLVM */ +/* Output a reference from an exception table to the type_info object TYPE. + TT_FORMAT and TT_FORMAT_SIZE descibe the DWARF encoding method used for + the value. */ + +static void +output_ttype (tree type, int tt_format, int tt_format_size) +{ + rtx value; + + if (type == NULL_TREE) + value = const0_rtx; + else + { + struct cgraph_varpool_node *node; + + type = lookup_type_for_runtime (type); + value = expand_expr (type, NULL_RTX, VOIDmode, EXPAND_INITIALIZER); + + /* Let cgraph know that the rtti decl is used. Not all of the + paths below go through assemble_integer, which would take + care of this for us. */ + STRIP_NOPS (type); + if (TREE_CODE (type) == ADDR_EXPR) + { + type = TREE_OPERAND (type, 0); + if (TREE_CODE (type) == VAR_DECL) + { + node = cgraph_varpool_node (type); + if (node) + cgraph_varpool_mark_needed_node (node); + } + } + else if (TREE_CODE (type) != INTEGER_CST) + abort (); + } + + /* Allow the target to override the type table entry format. */ + if (targetm.asm_out.ttype (value)) + return; + + if (tt_format == DW_EH_PE_absptr || tt_format == DW_EH_PE_aligned) + assemble_integer (value, tt_format_size, + tt_format_size * BITS_PER_UNIT, 1); + else + dw2_asm_output_encoded_addr_rtx (tt_format, value, NULL); +} +/* APPLE LOCAL end LLVM */ + void output_function_exception_table (void) { @@ -3263,8 +3337,10 @@ targetm.asm_out.except_table_label (asm_out_file); /* APPLE LOCAL end mainline */ - have_tt_data = (VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data) > 0 +/* APPLE LOCAL begin LLVM */ + have_tt_data = (VEC_length (tree, cfun->eh->ttype_data) > 0 || VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data) > 0); +/* APPLE LOCAL end LLVM */ /* Indicate the format of the @TType entries. */ if (! have_tt_data) @@ -3326,7 +3402,9 @@ after_disp = (1 + size_of_uleb128 (call_site_len) + call_site_len + VARRAY_ACTIVE_SIZE (cfun->eh->action_record_data) - + (VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data) +/* APPLE LOCAL begin LLVM */ + + (VEC_length (tree, cfun->eh->ttype_data) +/* APPLE LOCAL end LLVM */ * tt_format_size)); disp = after_disp; @@ -3388,44 +3466,15 @@ if (have_tt_data) assemble_align (tt_format_size * BITS_PER_UNIT); - i = VARRAY_ACTIVE_SIZE (cfun->eh->ttype_data); +/* APPLE LOCAL begin LLVM */ + i = VEC_length (tree, cfun->eh->ttype_data); +/* APPLE LOCAL end LLVM */ while (i-- > 0) { - tree type = VARRAY_TREE (cfun->eh->ttype_data, i); - rtx value; - - if (type == NULL_TREE) - value = const0_rtx; - else - { - struct cgraph_varpool_node *node; - - type = lookup_type_for_runtime (type); - value = expand_expr (type, NULL_RTX, VOIDmode, EXPAND_INITIALIZER); - - /* Let cgraph know that the rtti decl is used. Not all of the - paths below go through assemble_integer, which would take - care of this for us. */ - STRIP_NOPS (type); - if (TREE_CODE (type) == ADDR_EXPR) - { - type = TREE_OPERAND (type, 0); - if (TREE_CODE (type) == VAR_DECL) - { - node = cgraph_varpool_node (type); - if (node) - cgraph_varpool_mark_needed_node (node); - } - } - else - gcc_assert (TREE_CODE (type) == INTEGER_CST); - } - - if (tt_format == DW_EH_PE_absptr || tt_format == DW_EH_PE_aligned) - assemble_integer (value, tt_format_size, - tt_format_size * BITS_PER_UNIT, 1); - else - dw2_asm_output_encoded_addr_rtx (tt_format, value, NULL); +/* APPLE LOCAL begin LLVM */ + tree type = VEC_index (tree, cfun->eh->ttype_data, i); + output_ttype (type, tt_format, tt_format_size); +/* APPLE LOCAL end LLVM */ } #ifdef HAVE_AS_LEB128 @@ -3436,10 +3485,35 @@ /* ??? Decode and interpret the data for flag_debug_asm. */ n = VARRAY_ACTIVE_SIZE (cfun->eh->ehspec_data); for (i = 0; i < n; ++i) - dw2_asm_output_data (1, VARRAY_UCHAR (cfun->eh->ehspec_data, i), - (i ? NULL : "Exception specification table")); +/* APPLE LOCAL begin LLVM */ + { + if (targetm.arm_eabi_unwinder) + { + tree type = VARRAY_TREE (cfun->eh->ehspec_data, i); + output_ttype (type, tt_format, tt_format_size); + } + else + dw2_asm_output_data (1, VARRAY_UCHAR (cfun->eh->ehspec_data, i), + (i ? NULL : "Exception specification table")); + } +/* APPLE LOCAL end LLVM */ function_section (current_function_decl); } + + +/* APPLE LOCAL begin LLVM */ +/* Initialize unwind_resume_libfunc. */ + +void +default_init_unwind_resume_libfunc (void) +{ + /* The default c++ routines aren't actually c++ specific, so use those. */ + unwind_resume_libfunc = + init_one_libfunc ( USING_SJLJ_EXCEPTIONS ? "_Unwind_SjLj_Resume" + : "_Unwind_Resume"); +} +/* APPLE LOCAL end LLVM */ + #include "gt-except.h" Modified: apple-local/branches/llvm/gcc/except.h =================================================================== --- apple-local/branches/llvm/gcc/except.h 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/except.h 2007-04-03 00:13:00 UTC (rev 125638) @@ -84,6 +84,9 @@ extern int check_handled (tree, tree); extern void sjlj_emit_function_exit_after (rtx); +/* APPLE LOCAL begin LLVM */ +extern void default_init_unwind_resume_libfunc (void); +/* APPLE LOCAL end LLVM */ extern struct eh_region *gen_eh_region_cleanup (struct eh_region *, struct eh_region *); Modified: apple-local/branches/llvm/gcc/java/decl.c =================================================================== --- apple-local/branches/llvm/gcc/java/decl.c 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/java/decl.c 2007-04-03 00:13:00 UTC (rev 125638) @@ -1185,6 +1185,9 @@ eh_personality_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS ? "__gcj_personality_sj0" : "__gcj_personality_v0"); + /* APPLE LOCAL begin LLVM */ + default_init_unwind_resume_libfunc (); + /* APPLE LOCAL end LLVM */ lang_eh_runtime_type = do_nothing; Modified: apple-local/branches/llvm/gcc/objc/objc-act.c =================================================================== --- apple-local/branches/llvm/gcc/objc/objc-act.c 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/objc/objc-act.c 2007-04-03 00:13:00 UTC (rev 125638) @@ -7063,6 +7063,9 @@ = init_one_libfunc (USING_SJLJ_EXCEPTIONS ? "__gnu_objc_personality_sj0" : "__gnu_objc_personality_v0"); +/* APPLE LOCAL begin LLVM */ + default_init_unwind_resume_libfunc (); +/* APPLE LOCAL end LLVM */ using_eh_for_cleanups (); lang_eh_runtime_type = objc_eh_runtime_type; } Modified: apple-local/branches/llvm/gcc/optabs.c =================================================================== --- apple-local/branches/llvm/gcc/optabs.c 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/optabs.c 2007-04-03 00:13:00 UTC (rev 125638) @@ -5207,9 +5207,6 @@ memset_libfunc = init_one_libfunc ("memset"); setbits_libfunc = init_one_libfunc ("__setbits"); - unwind_resume_libfunc = init_one_libfunc (USING_SJLJ_EXCEPTIONS - ? "_Unwind_SjLj_Resume" - : "_Unwind_Resume"); #ifndef DONT_USE_BUILTIN_SETJMP setjmp_libfunc = init_one_libfunc ("__builtin_setjmp"); longjmp_libfunc = init_one_libfunc ("__builtin_longjmp"); Modified: apple-local/branches/llvm/gcc/opts.c =================================================================== --- apple-local/branches/llvm/gcc/opts.c 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/opts.c 2007-04-03 00:13:00 UTC (rev 125638) @@ -722,11 +722,10 @@ target_flags = 0; set_target_switch (""); - /* Unwind tables are always present when a target has ABI-specified unwind - tables, so the default should be ON. */ -#ifdef TARGET_UNWIND_INFO - flag_unwind_tables = TARGET_UNWIND_INFO; -#endif +/* APPLE LOCAL begin LLVM */ + /* Some tagets have ABI-specified unwind tables. */ + flag_unwind_tables = targetm.unwind_tables_default; +/* APPLE LOCAL end LLVM */ #ifdef OPTIMIZATION_OPTIONS /* Allow default optimizations to be specified on a per-machine basis. */ Modified: apple-local/branches/llvm/gcc/target-def.h =================================================================== --- apple-local/branches/llvm/gcc/target-def.h 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/target-def.h 2007-04-03 00:13:00 UTC (rev 125638) @@ -75,6 +75,12 @@ #define TARGET_ASM_INTERNAL_LABEL default_internal_label #endif +/* APPLE LOCAL begin LLVM */ +#ifndef TARGET_ARM_TTYPE +#define TARGET_ASM_TTYPE hook_bool_rtx_false +#endif +/* APPLE LOCAL end LLVM */ + #ifndef TARGET_ASM_ASSEMBLE_VISIBILITY #define TARGET_ASM_ASSEMBLE_VISIBILITY default_assemble_visibility #endif @@ -216,6 +222,9 @@ TARGET_ASM_EMIT_EXCEPT_TABLE_LABEL, \ TARGET_UNWIND_EMIT, \ TARGET_ASM_INTERNAL_LABEL, \ +/* APPLE LOCAL begin LLVM */ \ + TARGET_ASM_TTYPE, \ +/* APPLE LOCAL end LLVM */ \ TARGET_ASM_ASSEMBLE_VISIBILITY, \ TARGET_ASM_FUNCTION_PROLOGUE, \ TARGET_ASM_FUNCTION_END_PROLOGUE, \ @@ -422,6 +431,10 @@ #endif /* APPLE LOCAL end mainline 2005-10-12 */ +/* APPLE LOCAL begin LLVM */ +#define TARGET_ARM_EABI_UNWINDER false +/* APPLE LOCAL end LLVM */ + #define TARGET_PROMOTE_FUNCTION_ARGS hook_bool_tree_false #define TARGET_PROMOTE_FUNCTION_RETURN hook_bool_tree_false #define TARGET_PROMOTE_PROTOTYPES hook_bool_tree_false @@ -485,6 +498,11 @@ } /* APPLE LOCAL end mainline 2005-04-14 */ +/* APPLE LOCAL begin LLVM */ +#ifndef TARGET_UNWIND_TABLES_DEFAULT +#define TARGET_UNWIND_TABLES_DEFAULT false +#endif +/* APPLE LOCAL end LLVM */ #ifndef TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME #define TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME 0 @@ -543,6 +561,12 @@ #endif /* APPLE LOCAL begin mainline 2005-10-12 */ +/* APPLE LOCAL begin LLVM */ +#ifndef TARGET_CXX_USE_AEABI_ATEXIT +#define TARGET_CXX_USE_AEABI_ATEXIT hook_bool_void_false +#endif +/* APPLE LOCAL end LLVM */ + #define TARGET_CXX \ { \ TARGET_CXX_GUARD_TYPE, \ @@ -557,8 +581,11 @@ TARGET_CXX_CLASS_DATA_ALWAYS_COMDAT, \ /* APPLE LOCAL end mainline 4.2 2006-03-01 4311680 */ \ /* APPLE LOCAL begin mainline 2005-10-12 */ \ - TARGET_CXX_ADJUST_CLASS_AT_DEFINITION \ + TARGET_CXX_ADJUST_CLASS_AT_DEFINITION, \ /* APPLE LOCAL end mainline 2005-10-12 */ \ + /* APPLE LOCAL begin LLVM */ \ + TARGET_CXX_USE_AEABI_ATEXIT, \ + /* APPLE LOCAL end LLVM */ \ } /* The whole shebang. */ @@ -625,6 +652,9 @@ /* APPLE LOCAL end mainline 2005-10-12 */ \ TARGET_CALLS, \ TARGET_CXX, \ +/* APPLE LOCAL begin LLVM */ \ + TARGET_UNWIND_TABLES_DEFAULT, \ +/* APPLE LOCAL end LLVM */ \ TARGET_HAVE_NAMED_SECTIONS, \ TARGET_HAVE_CTORS_DTORS, \ TARGET_HAVE_TLS, \ @@ -637,6 +667,9 @@ TARGET_HANDLE_PRAGMA_REDEFINE_EXTNAME, \ TARGET_HANDLE_PRAGMA_EXTERN_PREFIX, \ TARGET_RELAXED_ORDERING, \ +/* APPLE LOCAL begin LLVM */ \ + TARGET_ARM_EABI_UNWINDER \ +/* APPLE LOCAL end LLVM */ \ } #include "hooks.h" Modified: apple-local/branches/llvm/gcc/target.h =================================================================== --- apple-local/branches/llvm/gcc/target.h 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/target.h 2007-04-03 00:13:00 UTC (rev 125638) @@ -97,6 +97,11 @@ /* Output an internal label. */ void (* internal_label) (FILE *, const char *, unsigned long); +/* APPLE LOCAL begin LLVM */ + /* Emit a ttype table reference to a typeinfo object. */ + bool (* ttype) (rtx); +/* APPLE LOCAL end LLVM */ + /* Emit an assembler directive to set visibility for the symbol associated with the tree decl. */ void (* visibility) (tree, int); @@ -642,8 +647,16 @@ target modifications). */ void (*adjust_class_at_definition) (tree type); /* APPLE LOCAL end mainline 2005-10-12 */ + /* APPLE LOCAL begin LLVM */ + bool (*use_aeabi_atexit) (void); + /* APPLE LOCAL end LLVM */ } cxx; + /* APPLE LOCAL begin LLVM */ + /* True if unwinding tables should be generated by default. */ + bool unwind_tables_default; + /* APPLE LOCAL end LLVM */ + /* Leave the boolean fields at the end. */ /* True if arbitrary sections are supported. */ @@ -691,6 +704,13 @@ synchronization is explicitly requested. */ bool relaxed_ordering; +/* APPLE LOCAL begin LLVM */ + /* Returns true if we should generate exception tables for use with the + ARM EABI. The effects the encoding of function exception specifications. + */ + bool arm_eabi_unwinder; +/* APPLE LOCAL end LLVM */ + /* Leave the boolean fields at the end. */ }; Modified: apple-local/branches/llvm/gcc/unwind-c.c =================================================================== --- apple-local/branches/llvm/gcc/unwind-c.c 2007-04-03 00:10:47 UTC (rev 125637) +++ apple-local/branches/llvm/gcc/unwind-c.c 2007-04-03 00:13:00 UTC (rev 125638) @@ -81,6 +81,22 @@ return p; } +/* APPLE LOCAL begin LLVM */ +#ifdef __ARM_EABI_UNWINDER__ +/* ARM EABI personality routines must also unwind the stack. */ +#define CONTINUE_UNWINDING \ + do \ + { \ + if (__gnu_unwind_frame (ue_header, context) != _URC_OK) \ + return _URC_FAILURE; \ + return _URC_CONTINUE_UNWIND; \ + } \ + while (0) +#else +#define CONTINUE_UNWINDING return _URC_CONTINUE_UNWIND +#endif +/* APPLE LOCAL end LLVM */ + #ifdef __USING_SJLJ_EXCEPTIONS__ #define PERSONALITY_FUNCTION __gcc_personality_sj0 #define __builtin_eh_return_data_regno(x) x @@ -88,7 +104,19 @@ #define PERSONALITY_FUNCTION __gcc_personality_v0 #endif +/* APPLE LOCAL begin LLVM */ +#ifdef __ARM_EABI_UNWINDER__ _Unwind_Reason_Code +PERSONALITY_FUNCTION (_Unwind_State, struct _Unwind_Exception *, + struct _Unwind_Context *); + +_Unwind_Reason_Code +PERSONALITY_FUNCTION (_Unwind_State state, + struct _Unwind_Exception * ue_header, + struct _Unwind_Context * context) +#else +/* APPLE LOCAL end LLVM */ +_Unwind_Reason_Code PERSONALITY_FUNCTION (int, _Unwind_Action, _Unwind_Exception_Class, struct _Unwind_Exception *, struct _Unwind_Context *); @@ -98,24 +126,45 @@ _Unwind_Exception_Class exception_class ATTRIBUTE_UNUSED, struct _Unwind_Exception *ue_header, struct _Unwind_Context *context) +/* APPLE LOCAL begin LLVM */ +#endif +/* APPLE LOCAL end LLVM */ { lsda_header_info info; const unsigned char *language_specific_data, *p, *action_record; _Unwind_Ptr landing_pad, ip; +/* APPLE LOCAL begin LLVM */ +#ifdef __ARM_EABI_UNWINDER__ + if (state != _US_UNWIND_FRAME_STARTING) + CONTINUE_UNWINDING; + + /* The dwarf unwinder assumes the context structure holds things like the + function and LSDA pointers. The ARM implementation caches these in + the exception header (UCB). To avoid rewriting everything we make the + virtual IP register point at the UCB. */ + ip = (_Unwind_Ptr) ue_header; + _Unwind_SetGR (context, 12, ip); +#else +/* APPLE LOCAL end LLVM */ if (version != 1) return _URC_FATAL_PHASE1_ERROR; /* Currently we only support cleanups for C. */ if ((actions & _UA_CLEANUP_PHASE) == 0) - return _URC_CONTINUE_UNWIND; +/* APPLE LOCAL begin LLVM */ + CONTINUE_UNWINDING; +#endif +/* APPLE LOCAL end LLVM */ language_specific_data = (const unsigned char *) _Unwind_GetLanguageSpecificData (context); /* If no LSDA, then there are no handlers or cleanups. */ if (! language_specific_data) - return _URC_CONTINUE_UNWIND; +/* APPLE LOCAL begin LLVM */ + CONTINUE_UNWINDING; +/* APPLE LOCAL end LLVM */ /* Parse the LSDA header. */ p = parse_lsda_header (context, language_specific_data, &info); @@ -171,20 +220,23 @@ goto found_something; } } - #endif /* IP is not in table. No associated cleanups. */ /* ??? This is where C++ calls std::terminate to catch throw from a destructor. */ - return _URC_CONTINUE_UNWIND; +/* APPLE LOCAL begin LLVM */ + CONTINUE_UNWINDING; +/* APPLE LOCAL end LLVM */ found_something: if (landing_pad == 0) { /* IP is present, but has a null landing pad. No handler to be run. */ - return _URC_CONTINUE_UNWIND; +/* APPLE LOCAL begin LLVM */ + CONTINUE_UNWINDING; +/* APPLE LOCAL end LLVM */ } _Unwind_SetGR (context, __builtin_eh_return_data_regno (0), From sabre at nondot.org Mon Apr 2 19:14:15 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 19:14:15 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <200704030014.l330EFo7030792@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelLowering.cpp updated: 1.37 -> 1.38 --- Log message: Arm supports negative strides as well, add them. This lets us compile: CodeGen/ARM/arm-negative-stride.ll to: LBB1_2: @bb str r1, [r3, -r0, lsl #2] add r0, r0, #1 cmp r0, r2 bne LBB1_2 @bb --- Diffs of the changes: (+6 -3) ARMISelLowering.cpp | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/lib/Target/ARM/ARMISelLowering.cpp diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.37 llvm/lib/Target/ARM/ARMISelLowering.cpp:1.38 --- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.37 Mon Apr 2 13:51:18 2007 +++ llvm/lib/Target/ARM/ARMISelLowering.cpp Mon Apr 2 19:13:57 2007 @@ -1323,7 +1323,7 @@ // This assumes i64 is legalized to a pair of i32. If not (i.e. // ldrd / strd are used, then its address mode is same as i16. // r + r - if (AM.Scale == 2) + if (AM.Scale == 1) return true; // r + r << imm if (!isPowerOf2_32(AM.Scale & ~1)) @@ -1422,7 +1422,9 @@ case MVT::i1: case MVT::i8: case MVT::i32: - // Allow: r + r + if (S < 0) S = -S; + if (S == 1) return true; // Allow: r + r + // Allow: r << imm // Allow: r + r << imm S &= ~1; @@ -1431,7 +1433,8 @@ // Note, we allow "void" uses (basically, uses that aren't loads or // stores), because arm allows folding a scale into many arithmetic // operations. This should be made more precise and revisited later. - + if (S == 1) return true; // Allow: r + r + // Allow r << imm, but the imm has to be a multiple of two. if (S & 1) return false; return isPowerOf2_32(S); From johannes at apple.com Mon Apr 2 19:13:59 2007 From: johannes at apple.com (johannes at apple.com) Date: Mon, 2 Apr 2007 17:13:59 -0700 (PDT) Subject: [llvm-commits] [125639] arm EABI patch (Lauro Ramos Venancio) Message-ID: <20070403001359.AA7B3CB80E8B@src> Revision: 125639 Author: johannes Date: 2007-04-02 17:13:59 -0700 (Mon, 02 Apr 2007) Log Message: ----------- arm EABI patch (Lauro Ramos Venancio) Added Paths: ----------- apple-local/branches/llvm/gcc/unwind-generic.h apple-local/branches/llvm/gcc/unwind.h.removed Removed Paths: ------------- apple-local/branches/llvm/gcc/unwind.h Added: apple-local/branches/llvm/gcc/unwind-generic.h =================================================================== --- apple-local/branches/llvm/gcc/unwind-generic.h (rev 0) +++ apple-local/branches/llvm/gcc/unwind-generic.h 2007-04-03 00:13:59 UTC (rev 125639) @@ -0,0 +1,240 @@ +/* Exception handling and frame unwind runtime interface routines. + Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the Free + Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +/* This is derived from the C++ ABI for IA-64. Where we diverge + for cross-architecture compatibility are noted with "@@@". */ + +#ifndef _UNWIND_H +#define _UNWIND_H + +#ifndef HIDE_EXPORTS +#pragma GCC visibility push(default) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Level 1: Base ABI */ + +/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is + inefficient for 32-bit and smaller machines. */ +typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); +typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); +#if defined(__ia64__) && defined(__hpux__) +typedef unsigned _Unwind_Ptr __attribute__((__mode__(__word__))); +#else +typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); +#endif +typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); + +/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and + consumer of an exception. We'll go along with this for now even on + 32-bit machines. We'll need to provide some other option for + 16-bit machines and for machines with > 8 bits per byte. */ +typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__))); + +/* The unwind interface uses reason codes in several contexts to + identify the reasons for failures or other actions. */ +typedef enum +{ + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 +} _Unwind_Reason_Code; + + +/* The unwind interface uses a pointer to an exception header object + as its representation of an exception being thrown. In general, the + full representation of an exception object is language- and + implementation-specific, but it will be prefixed by a header + understood by the unwind interface. */ + +struct _Unwind_Exception; + +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, + struct _Unwind_Exception *); + +struct _Unwind_Exception +{ + _Unwind_Exception_Class exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; + _Unwind_Word private_1; + _Unwind_Word private_2; + + /* @@@ The IA-64 ABI says that this structure must be double-word aligned. + Taking that literally does not make much sense generically. Instead we + provide the maximum alignment required by any type for the machine. */ +} __attribute__((__aligned__)); + + +/* The ACTIONS argument to the personality routine is a bitwise OR of one + or more of the following constants. */ +typedef int _Unwind_Action; + +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 +#define _UA_END_OF_STACK 16 + +/* This is an opaque type used to refer to a system-specific data + structure used by the system unwinder. This context is created and + destroyed by the system, and passed to the personality routine + during unwinding. */ +struct _Unwind_Context; + +/* Raise an exception, passing along the given exception object. */ +extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); + +/* Raise an exception for forced unwinding. */ + +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *, void *); + +extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, + _Unwind_Stop_Fn, + void *); + +/* Helper to invoke the exception_cleanup routine. */ +extern void _Unwind_DeleteException (struct _Unwind_Exception *); + +/* Resume propagation of an existing exception. This is used after + e.g. executing cleanup code, and not to implement rethrowing. */ +extern void _Unwind_Resume (struct _Unwind_Exception *); + +/* @@@ Resume propagation of an FORCE_UNWIND exception, or to rethrow + a normal exception that was handled. */ +extern _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); + +/* @@@ Use unwind data to perform a stack backtrace. The trace callback + is called for every stack frame in the call chain, but no cleanup + actions are performed. */ +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) + (struct _Unwind_Context *, void *); + +extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); + +/* These functions are used for communicating information about the unwind + context (i.e. the unwind descriptors and the user register state) between + the unwind library and the personality routine and landing pad. Only + selected registers maybe manipulated. */ + +extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int); +extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word); + +extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); +extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr); + +/* @@@ Retrieve the CFA of the given context. */ +extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); + +extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *); + +extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *); + + +/* The personality routine is the function in the C++ (or other language) + runtime library which serves as an interface between the system unwind + library and language-specific exception handling semantics. It is + specific to the code fragment described by an unwind info block, and + it is always referenced via the pointer in the unwind info block, and + hence it has no ABI-specified name. + + Note that this implies that two different C++ implementations can + use different names, and have different contents in the language + specific data area. Moreover, that the language specific data + area contains no version info because name of the function invoked + provides more effective versioning by detecting at link time the + lack of code to handle the different data format. */ + +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *); + +/* @@@ The following alternate entry points are for setjmp/longjmp + based unwinding. */ + +struct SjLj_Function_Context; +extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *); +extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *); + +extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException + (struct _Unwind_Exception *); +extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind + (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); +extern void _Unwind_SjLj_Resume (struct _Unwind_Exception *); +extern _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow (struct _Unwind_Exception *); + +/* @@@ The following provide access to the base addresses for text + and data-relative addressing in the LDSA. In order to stay link + compatible with the standard ABI for IA-64, we inline these. */ + +#ifdef __ia64__ +#include + +static inline _Unwind_Ptr +_Unwind_GetDataRelBase (struct _Unwind_Context *_C) +{ + /* The GP is stored in R1. */ + return _Unwind_GetGR (_C, 1); +} + +static inline _Unwind_Ptr +_Unwind_GetTextRelBase (struct _Unwind_Context *_C __attribute__ ((__unused__))) +{ + abort (); + return 0; +} + +/* @@@ Retrieve the Backing Store Pointer of the given context. */ +extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *); +#else +extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *); +extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *); +#endif + +/* @@@ Given an address, return the entry point of the function that + contains it. */ +extern void * _Unwind_FindEnclosingFunction (void *pc); + +#ifdef __cplusplus +} +#endif + +#ifndef HIDE_EXPORTS +#pragma GCC visibility pop +#endif + +#endif /* unwind.h */ Deleted: apple-local/branches/llvm/gcc/unwind.h =================================================================== --- apple-local/branches/llvm/gcc/unwind.h 2007-04-03 00:13:00 UTC (rev 125638) +++ apple-local/branches/llvm/gcc/unwind.h 2007-04-03 00:13:59 UTC (rev 125639) @@ -1,240 +0,0 @@ -/* Exception handling and frame unwind runtime interface routines. - Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GCC is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -/* As a special exception, if you include this header file into source - files compiled by GCC, this header file does not by itself cause - the resulting executable to be covered by the GNU General Public - License. This exception does not however invalidate any other - reasons why the executable file might be covered by the GNU General - Public License. */ - -/* This is derived from the C++ ABI for IA-64. Where we diverge - for cross-architecture compatibility are noted with "@@@". */ - -#ifndef _UNWIND_H -#define _UNWIND_H - -#ifndef HIDE_EXPORTS -#pragma GCC visibility push(default) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Level 1: Base ABI */ - -/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is - inefficient for 32-bit and smaller machines. */ -typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); -typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); -#if defined(__ia64__) && defined(__hpux__) -typedef unsigned _Unwind_Ptr __attribute__((__mode__(__word__))); -#else -typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); -#endif -typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); - -/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and - consumer of an exception. We'll go along with this for now even on - 32-bit machines. We'll need to provide some other option for - 16-bit machines and for machines with > 8 bits per byte. */ -typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__))); - -/* The unwind interface uses reason codes in several contexts to - identify the reasons for failures or other actions. */ -typedef enum -{ - _URC_NO_REASON = 0, - _URC_FOREIGN_EXCEPTION_CAUGHT = 1, - _URC_FATAL_PHASE2_ERROR = 2, - _URC_FATAL_PHASE1_ERROR = 3, - _URC_NORMAL_STOP = 4, - _URC_END_OF_STACK = 5, - _URC_HANDLER_FOUND = 6, - _URC_INSTALL_CONTEXT = 7, - _URC_CONTINUE_UNWIND = 8 -} _Unwind_Reason_Code; - - -/* The unwind interface uses a pointer to an exception header object - as its representation of an exception being thrown. In general, the - full representation of an exception object is language- and - implementation-specific, but it will be prefixed by a header - understood by the unwind interface. */ - -struct _Unwind_Exception; - -typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, - struct _Unwind_Exception *); - -struct _Unwind_Exception -{ - _Unwind_Exception_Class exception_class; - _Unwind_Exception_Cleanup_Fn exception_cleanup; - _Unwind_Word private_1; - _Unwind_Word private_2; - - /* @@@ The IA-64 ABI says that this structure must be double-word aligned. - Taking that literally does not make much sense generically. Instead we - provide the maximum alignment required by any type for the machine. */ -} __attribute__((__aligned__)); - - -/* The ACTIONS argument to the personality routine is a bitwise OR of one - or more of the following constants. */ -typedef int _Unwind_Action; - -#define _UA_SEARCH_PHASE 1 -#define _UA_CLEANUP_PHASE 2 -#define _UA_HANDLER_FRAME 4 -#define _UA_FORCE_UNWIND 8 -#define _UA_END_OF_STACK 16 - -/* This is an opaque type used to refer to a system-specific data - structure used by the system unwinder. This context is created and - destroyed by the system, and passed to the personality routine - during unwinding. */ -struct _Unwind_Context; - -/* Raise an exception, passing along the given exception object. */ -extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); - -/* Raise an exception for forced unwinding. */ - -typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) - (int, _Unwind_Action, _Unwind_Exception_Class, - struct _Unwind_Exception *, struct _Unwind_Context *, void *); - -extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, - _Unwind_Stop_Fn, - void *); - -/* Helper to invoke the exception_cleanup routine. */ -extern void _Unwind_DeleteException (struct _Unwind_Exception *); - -/* Resume propagation of an existing exception. This is used after - e.g. executing cleanup code, and not to implement rethrowing. */ -extern void _Unwind_Resume (struct _Unwind_Exception *); - -/* @@@ Resume propagation of an FORCE_UNWIND exception, or to rethrow - a normal exception that was handled. */ -extern _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); - -/* @@@ Use unwind data to perform a stack backtrace. The trace callback - is called for every stack frame in the call chain, but no cleanup - actions are performed. */ -typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) - (struct _Unwind_Context *, void *); - -extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); - -/* These functions are used for communicating information about the unwind - context (i.e. the unwind descriptors and the user register state) between - the unwind library and the personality routine and landing pad. Only - selected registers maybe manipulated. */ - -extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int); -extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word); - -extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); -extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr); - -/* @@@ Retrieve the CFA of the given context. */ -extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); - -extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *); - -extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *); - - -/* The personality routine is the function in the C++ (or other language) - runtime library which serves as an interface between the system unwind - library and language-specific exception handling semantics. It is - specific to the code fragment described by an unwind info block, and - it is always referenced via the pointer in the unwind info block, and - hence it has no ABI-specified name. - - Note that this implies that two different C++ implementations can - use different names, and have different contents in the language - specific data area. Moreover, that the language specific data - area contains no version info because name of the function invoked - provides more effective versioning by detecting at link time the - lack of code to handle the different data format. */ - -typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) - (int, _Unwind_Action, _Unwind_Exception_Class, - struct _Unwind_Exception *, struct _Unwind_Context *); - -/* @@@ The following alternate entry points are for setjmp/longjmp - based unwinding. */ - -struct SjLj_Function_Context; -extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *); -extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *); - -extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException - (struct _Unwind_Exception *); -extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind - (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); -extern void _Unwind_SjLj_Resume (struct _Unwind_Exception *); -extern _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow (struct _Unwind_Exception *); - -/* @@@ The following provide access to the base addresses for text - and data-relative addressing in the LDSA. In order to stay link - compatible with the standard ABI for IA-64, we inline these. */ - -#ifdef __ia64__ -#include - -static inline _Unwind_Ptr -_Unwind_GetDataRelBase (struct _Unwind_Context *_C) -{ - /* The GP is stored in R1. */ - return _Unwind_GetGR (_C, 1); -} - -static inline _Unwind_Ptr -_Unwind_GetTextRelBase (struct _Unwind_Context *_C __attribute__ ((__unused__))) -{ - abort (); - return 0; -} - -/* @@@ Retrieve the Backing Store Pointer of the given context. */ -extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *); -#else -extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *); -extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *); -#endif - -/* @@@ Given an address, return the entry point of the function that - contains it. */ -extern void * _Unwind_FindEnclosingFunction (void *pc); - -#ifdef __cplusplus -} -#endif - -#ifndef HIDE_EXPORTS -#pragma GCC visibility pop -#endif - -#endif /* unwind.h */ Added: apple-local/branches/llvm/gcc/unwind.h.removed =================================================================== --- apple-local/branches/llvm/gcc/unwind.h.removed (rev 0) +++ apple-local/branches/llvm/gcc/unwind.h.removed 2007-04-03 00:13:59 UTC (rev 125639) @@ -0,0 +1,240 @@ +/* Exception handling and frame unwind runtime interface routines. + Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. + + This file is part of GCC. + + GCC is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + GCC is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with GCC; see the file COPYING. If not, write to the Free + Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +/* As a special exception, if you include this header file into source + files compiled by GCC, this header file does not by itself cause + the resulting executable to be covered by the GNU General Public + License. This exception does not however invalidate any other + reasons why the executable file might be covered by the GNU General + Public License. */ + +/* This is derived from the C++ ABI for IA-64. Where we diverge + for cross-architecture compatibility are noted with "@@@". */ + +#ifndef _UNWIND_H +#define _UNWIND_H + +#ifndef HIDE_EXPORTS +#pragma GCC visibility push(default) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Level 1: Base ABI */ + +/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is + inefficient for 32-bit and smaller machines. */ +typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); +typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); +#if defined(__ia64__) && defined(__hpux__) +typedef unsigned _Unwind_Ptr __attribute__((__mode__(__word__))); +#else +typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); +#endif +typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); + +/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and + consumer of an exception. We'll go along with this for now even on + 32-bit machines. We'll need to provide some other option for + 16-bit machines and for machines with > 8 bits per byte. */ +typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__))); + +/* The unwind interface uses reason codes in several contexts to + identify the reasons for failures or other actions. */ +typedef enum +{ + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 +} _Unwind_Reason_Code; + + +/* The unwind interface uses a pointer to an exception header object + as its representation of an exception being thrown. In general, the + full representation of an exception object is language- and + implementation-specific, but it will be prefixed by a header + understood by the unwind interface. */ + +struct _Unwind_Exception; + +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, + struct _Unwind_Exception *); + +struct _Unwind_Exception +{ + _Unwind_Exception_Class exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; + _Unwind_Word private_1; + _Unwind_Word private_2; + + /* @@@ The IA-64 ABI says that this structure must be double-word aligned. + Taking that literally does not make much sense generically. Instead we + provide the maximum alignment required by any type for the machine. */ +} __attribute__((__aligned__)); + + +/* The ACTIONS argument to the personality routine is a bitwise OR of one + or more of the following constants. */ +typedef int _Unwind_Action; + +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 +#define _UA_END_OF_STACK 16 + +/* This is an opaque type used to refer to a system-specific data + structure used by the system unwinder. This context is created and + destroyed by the system, and passed to the personality routine + during unwinding. */ +struct _Unwind_Context; + +/* Raise an exception, passing along the given exception object. */ +extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); + +/* Raise an exception for forced unwinding. */ + +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *, void *); + +extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, + _Unwind_Stop_Fn, + void *); + +/* Helper to invoke the exception_cleanup routine. */ +extern void _Unwind_DeleteException (struct _Unwind_Exception *); + +/* Resume propagation of an existing exception. This is used after + e.g. executing cleanup code, and not to implement rethrowing. */ +extern void _Unwind_Resume (struct _Unwind_Exception *); + +/* @@@ Resume propagation of an FORCE_UNWIND exception, or to rethrow + a normal exception that was handled. */ +extern _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); + +/* @@@ Use unwind data to perform a stack backtrace. The trace callback + is called for every stack frame in the call chain, but no cleanup + actions are performed. */ +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) + (struct _Unwind_Context *, void *); + +extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); + +/* These functions are used for communicating information about the unwind + context (i.e. the unwind descriptors and the user register state) between + the unwind library and the personality routine and landing pad. Only + selected registers maybe manipulated. */ + +extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int); +extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word); + +extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); +extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr); + +/* @@@ Retrieve the CFA of the given context. */ +extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); + +extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *); + +extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *); + + +/* The personality routine is the function in the C++ (or other language) + runtime library which serves as an interface between the system unwind + library and language-specific exception handling semantics. It is + specific to the code fragment described by an unwind info block, and + it is always referenced via the pointer in the unwind info block, and + hence it has no ABI-specified name. + + Note that this implies that two different C++ implementations can + use different names, and have different contents in the language + specific data area. Moreover, that the language specific data + area contains no version info because name of the function invoked + provides more effective versioning by detecting at link time the + lack of code to handle the different data format. */ + +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *); + +/* @@@ The following alternate entry points are for setjmp/longjmp + based unwinding. */ + +struct SjLj_Function_Context; +extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *); +extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *); + +extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException + (struct _Unwind_Exception *); +extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind + (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); +extern void _Unwind_SjLj_Resume (struct _Unwind_Exception *); +extern _Unwind_Reason_Code _Unwind_SjLj_Resume_or_Rethrow (struct _Unwind_Exception *); + +/* @@@ The following provide access to the base addresses for text + and data-relative addressing in the LDSA. In order to stay link + compatible with the standard ABI for IA-64, we inline these. */ + +#ifdef __ia64__ +#include + +static inline _Unwind_Ptr +_Unwind_GetDataRelBase (struct _Unwind_Context *_C) +{ + /* The GP is stored in R1. */ + return _Unwind_GetGR (_C, 1); +} + +static inline _Unwind_Ptr +_Unwind_GetTextRelBase (struct _Unwind_Context *_C __attribute__ ((__unused__))) +{ + abort (); + return 0; +} + +/* @@@ Retrieve the Backing Store Pointer of the given context. */ +extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *); +#else +extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *); +extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *); +#endif + +/* @@@ Given an address, return the entry point of the function that + contains it. */ +extern void * _Unwind_FindEnclosingFunction (void *pc); + +#ifdef __cplusplus +} +#endif + +#ifndef HIDE_EXPORTS +#pragma GCC visibility pop +#endif + +#endif /* unwind.h */ From johannes at apple.com Mon Apr 2 19:14:25 2007 From: johannes at apple.com (johannes at apple.com) Date: Mon, 2 Apr 2007 17:14:25 -0700 (PDT) Subject: [llvm-commits] [125640] arm EABI patch (Lauro Ramos Venancio) Message-ID: <20070403001425.A434ECB811D2@src> Revision: 125640 Author: johannes Date: 2007-04-02 17:14:25 -0700 (Mon, 02 Apr 2007) Log Message: ----------- arm EABI patch (Lauro Ramos Venancio) Modified Paths: -------------- apple-local/branches/llvm/libcpp/configure apple-local/branches/llvm/libcpp/configure.ac Modified: apple-local/branches/llvm/libcpp/configure =================================================================== --- apple-local/branches/llvm/libcpp/configure 2007-04-03 00:13:59 UTC (rev 125639) +++ apple-local/branches/llvm/libcpp/configure 2007-04-03 00:14:25 UTC (rev 125640) @@ -7965,7 +7965,7 @@ case $target in # APPLE LOCAL begin 4126124 alpha*-*-* | \ - arm*-*-eabi* | \ + arm*-*-*eabi* | \ arm*-*-symbianelf* | \ x86_64-*-* | \ ia64-*-* | \ Modified: apple-local/branches/llvm/libcpp/configure.ac =================================================================== --- apple-local/branches/llvm/libcpp/configure.ac 2007-04-03 00:13:59 UTC (rev 125639) +++ apple-local/branches/llvm/libcpp/configure.ac 2007-04-03 00:14:25 UTC (rev 125640) @@ -108,7 +108,9 @@ case $target in # APPLE LOCAL begin 4126124 alpha*-*-* | \ - arm*-*-eabi* | \ + #APPLE LOCAL begin LLVM + arm*-*-*eabi* | \ + #APPLE LOCAL end LLVM arm*-*-symbianelf* | \ x86_64-*-* | \ ia64-*-* | \ From johannes at apple.com Mon Apr 2 19:16:00 2007 From: johannes at apple.com (johannes at apple.com) Date: Mon, 2 Apr 2007 17:16:00 -0700 (PDT) Subject: [llvm-commits] [125641] arm EABI patch (files I missed) (Lauro Ramos Venancio) Message-ID: <20070403001600.72A50CB813E8@src> Revision: 125641 Author: johannes Date: 2007-04-02 17:16:00 -0700 (Mon, 02 Apr 2007) Log Message: ----------- arm EABI patch (files I missed) (Lauro Ramos Venancio) Modified Paths: -------------- apple-local/branches/llvm/gcc/config/arm/arm-protos.h apple-local/branches/llvm/libstdc++-v3/testsuite/Makefile.in Modified: apple-local/branches/llvm/gcc/config/arm/arm-protos.h =================================================================== --- apple-local/branches/llvm/gcc/config/arm/arm-protos.h 2007-04-03 00:14:25 UTC (rev 125640) +++ apple-local/branches/llvm/gcc/config/arm/arm-protos.h 2007-04-03 00:16:00 UTC (rev 125641) @@ -38,6 +38,10 @@ unsigned int); extern HOST_WIDE_INT thumb_compute_initial_elimination_offset (unsigned int, unsigned int); +/* APPLE LOCAL begin LLVM */ +extern unsigned int arm_dbx_register_number (unsigned int); +extern void arm_output_fn_unwind (FILE *, bool); +/* APPLE LOCAL end LLVM */ #ifdef TREE_CODE extern int arm_return_in_memory (tree); @@ -120,6 +124,10 @@ #if defined TREE_CODE extern rtx arm_function_arg (CUMULATIVE_ARGS *, enum machine_mode, tree, int); extern void arm_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree); +/* APPLE LOCAL begin LLVM */ +extern bool arm_pad_arg_upward (enum machine_mode, tree); +extern bool arm_pad_reg_upward (enum machine_mode, tree, int); +/* APPLE LOCAL end LLVM */ extern bool arm_needs_doubleword_align (enum machine_mode, tree); extern rtx arm_function_value(tree, tree); #endif Modified: apple-local/branches/llvm/libstdc++-v3/testsuite/Makefile.in =================================================================== --- apple-local/branches/llvm/libstdc++-v3/testsuite/Makefile.in 2007-04-03 00:14:25 UTC (rev 125640) +++ apple-local/branches/llvm/libstdc++-v3/testsuite/Makefile.in 2007-04-03 00:16:00 UTC (rev 125641) @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.3 from Makefile.am. +# Makefile.in generated by automake 1.9.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004 Free Software Foundation, Inc. +# 2003, 2004, 2005 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. From sabre at nondot.org Mon Apr 2 20:41:51 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 20:41:51 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200704030141.l331fpWq032590@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.143 -> 1.144 --- Log message: add a helper function to constantint. --- Diffs of the changes: (+3 -0) Constants.h | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.143 llvm/include/llvm/Constants.h:1.144 --- llvm/include/llvm/Constants.h:1.143 Fri Mar 30 11:50:28 2007 +++ llvm/include/llvm/Constants.h Mon Apr 2 20:41:34 2007 @@ -52,6 +52,9 @@ inline const APInt& getValue() const { return Val; } + + /// getBitWidth - Return the bitwidth of this constant. + unsigned getBitWidth() const { return Val.getBitWidth(); } /// Return the constant as a 64-bit unsigned integer value after it /// has been zero extended as appropriate for the type of this constant. Note From sabre at nondot.org Mon Apr 2 20:45:51 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 20:45:51 -0500 Subject: [llvm-commits] CVS: llvm/test/Transforms/InstCombine/xor2.ll Message-ID: <200704030145.l331jpvY032740@zion.cs.uiuc.edu> Changes in directory llvm/test/Transforms/InstCombine: xor2.ll added (r1.1) --- Log message: new testcase for PR1253: http://llvm.org/PR1253 --- Diffs of the changes: (+19 -0) xor2.ll | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/test/Transforms/InstCombine/xor2.ll diff -c /dev/null llvm/test/Transforms/InstCombine/xor2.ll:1.1 *** /dev/null Mon Apr 2 20:45:42 2007 --- llvm/test/Transforms/InstCombine/xor2.ll Mon Apr 2 20:45:32 2007 *************** *** 0 **** --- 1,19 ---- + ; This test makes sure that these instructions are properly eliminated. + ; + + ; RUN: llvm-as < %s | opt -instcombine -disable-output && + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'xor ' + + ; PR1253 + define i1 @test0(i32 %A) { + %B = xor i32 %A, -2147483648 + %C = icmp sgt i32 %B, -1 + ret i1 %C + } + + define i1 @test1(i32 %A) { + %B = xor i32 %A, 12345 + %C = icmp slt i32 %B, 0 + ret i1 %C + } + From sabre at nondot.org Mon Apr 2 20:47:58 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 20:47:58 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704030147.l331lwsM000383@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.723 -> 1.724 --- Log message: Fix PR1253: http://llvm.org/PR1253 and xor2.ll:test[01] --- Diffs of the changes: (+30 -1) InstructionCombining.cpp | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.723 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.724 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.723 Mon Apr 2 08:45:30 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 2 20:47:41 2007 @@ -4714,7 +4714,36 @@ // instruction can be folded into the icmp if (Instruction *LHSI = dyn_cast(Op0)) switch (LHSI->getOpcode()) { - case Instruction::And: + case Instruction::Xor: // (icmp pred (and X, XorCST), CI) + if (ConstantInt *XorCST = dyn_cast(LHSI->getOperand(1))) { + // If this is a comparison that tests the signbit (X < 0) or (x > -1), + // fold the xor. + if (I.getPredicate() == ICmpInst::ICMP_SLT && CI->isZero() || + I.getPredicate() == ICmpInst::ICMP_SGT && CI->isAllOnesValue()) { + Value *CompareVal = LHSI->getOperand(0); + + // If the sign bit of the XorCST is not set, there is no change to + // the operation, just stop using the Xor. + if (!XorCST->getValue().isNegative()) { + I.setOperand(0, CompareVal); + AddToWorkList(LHSI); + return &I; + } + + // Was the old condition true if the operand is positive? + bool isTrueIfPositive = I.getPredicate() == ICmpInst::ICMP_SGT; + + // If so, the new one isn't. + isTrueIfPositive ^= true; + + if (isTrueIfPositive) + return new ICmpInst(ICmpInst::ICMP_SGT, CompareVal, SubOne(CI)); + else + return new ICmpInst(ICmpInst::ICMP_SLT, CompareVal, AddOne(CI)); + } + } + break; + case Instruction::And: // (icmp pred (and X, AndCST), CI) if (LHSI->hasOneUse() && isa(LHSI->getOperand(1)) && LHSI->getOperand(0)->hasOneUse()) { ConstantInt *AndCST = cast(LHSI->getOperand(1)); From sabre at nondot.org Mon Apr 2 23:26:03 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 23:26:03 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h Message-ID: <200704030426.l334Q3dY003778@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: APInt.h updated: 1.61 -> 1.62 --- Log message: add missing operator --- Diffs of the changes: (+4 -0) APInt.h | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/include/llvm/ADT/APInt.h diff -u llvm/include/llvm/ADT/APInt.h:1.61 llvm/include/llvm/ADT/APInt.h:1.62 --- llvm/include/llvm/ADT/APInt.h:1.61 Mon Apr 2 00:41:00 2007 +++ llvm/include/llvm/ADT/APInt.h Mon Apr 2 23:25:46 2007 @@ -542,6 +542,10 @@ APInt operator-(uint64_t RHS) const { return (*this) - APInt(BitWidth, RHS); } + + APInt operator<<(unsigned Bits) const { + return shl(Bits); + } /// Arithmetic right-shift this APInt by shiftAmt. /// @brief Arithmetic right-shift function. From sabre at nondot.org Mon Apr 2 23:47:09 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 2 Apr 2007 23:47:09 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704030447.l334l9cN004177@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.724 -> 1.725 --- Log message: Split a whole ton of code out of visitICmpInst into visitICmpInstWithInstAndIntCst. --- Diffs of the changes: (+524 -520) InstructionCombining.cpp | 1044 +++++++++++++++++++++++------------------------ 1 files changed, 524 insertions(+), 520 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.724 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.725 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.724 Mon Apr 2 20:47:41 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 2 23:46:52 2007 @@ -183,6 +183,9 @@ Instruction *visitFCmpInst(FCmpInst &I); Instruction *visitICmpInst(ICmpInst &I); Instruction *visitICmpInstWithCastAndCast(ICmpInst &ICI); + Instruction *visitICmpInstWithInstAndIntCst(ICmpInst &ICI, + Instruction *LHS, + ConstantInt *RHS); Instruction *FoldGEPICmp(User *GEPLHS, Value *RHS, ICmpInst::Predicate Cond, Instruction &I); @@ -4713,525 +4716,11 @@ // instruction, see if that instruction also has constants so that the // instruction can be folded into the icmp if (Instruction *LHSI = dyn_cast(Op0)) - switch (LHSI->getOpcode()) { - case Instruction::Xor: // (icmp pred (and X, XorCST), CI) - if (ConstantInt *XorCST = dyn_cast(LHSI->getOperand(1))) { - // If this is a comparison that tests the signbit (X < 0) or (x > -1), - // fold the xor. - if (I.getPredicate() == ICmpInst::ICMP_SLT && CI->isZero() || - I.getPredicate() == ICmpInst::ICMP_SGT && CI->isAllOnesValue()) { - Value *CompareVal = LHSI->getOperand(0); - - // If the sign bit of the XorCST is not set, there is no change to - // the operation, just stop using the Xor. - if (!XorCST->getValue().isNegative()) { - I.setOperand(0, CompareVal); - AddToWorkList(LHSI); - return &I; - } - - // Was the old condition true if the operand is positive? - bool isTrueIfPositive = I.getPredicate() == ICmpInst::ICMP_SGT; - - // If so, the new one isn't. - isTrueIfPositive ^= true; - - if (isTrueIfPositive) - return new ICmpInst(ICmpInst::ICMP_SGT, CompareVal, SubOne(CI)); - else - return new ICmpInst(ICmpInst::ICMP_SLT, CompareVal, AddOne(CI)); - } - } - break; - case Instruction::And: // (icmp pred (and X, AndCST), CI) - if (LHSI->hasOneUse() && isa(LHSI->getOperand(1)) && - LHSI->getOperand(0)->hasOneUse()) { - ConstantInt *AndCST = cast(LHSI->getOperand(1)); - - // If the LHS is an AND of a truncating cast, we can widen the - // and/compare to be the input width without changing the value - // produced, eliminating a cast. - if (CastInst *Cast = dyn_cast(LHSI->getOperand(0))) { - // We can do this transformation if either the AND constant does not - // have its sign bit set or if it is an equality comparison. - // Extending a relational comparison when we're checking the sign - // bit would not work. - if (Cast->hasOneUse() && isa(Cast) && - (I.isEquality() || AndCST->getValue().isPositive() && - CI->getValue().isPositive())) { - ConstantInt *NewCST; - ConstantInt *NewCI; - APInt NewCSTVal(AndCST->getValue()), NewCIVal(CI->getValue()); - uint32_t BitWidth = cast( - Cast->getOperand(0)->getType())->getBitWidth(); - NewCST = ConstantInt::get(NewCSTVal.zext(BitWidth)); - NewCI = ConstantInt::get(NewCIVal.zext(BitWidth)); - Instruction *NewAnd = - BinaryOperator::createAnd(Cast->getOperand(0), NewCST, - LHSI->getName()); - InsertNewInstBefore(NewAnd, I); - return new ICmpInst(I.getPredicate(), NewAnd, NewCI); - } - } - - // If this is: (X >> C1) & C2 != C3 (where any shift and any compare - // could exist), turn it into (X & (C2 << C1)) != (C3 << C1). This - // happens a LOT in code produced by the C front-end, for bitfield - // access. - BinaryOperator *Shift = dyn_cast(LHSI->getOperand(0)); - if (Shift && !Shift->isShift()) - Shift = 0; - - ConstantInt *ShAmt; - ShAmt = Shift ? dyn_cast(Shift->getOperand(1)) : 0; - const Type *Ty = Shift ? Shift->getType() : 0; // Type of the shift. - const Type *AndTy = AndCST->getType(); // Type of the and. - - // We can fold this as long as we can't shift unknown bits - // into the mask. This can only happen with signed shift - // rights, as they sign-extend. - if (ShAmt) { - bool CanFold = Shift->isLogicalShift(); - if (!CanFold) { - // To test for the bad case of the signed shr, see if any - // of the bits shifted in could be tested after the mask. - uint32_t TyBits = Ty->getPrimitiveSizeInBits(); - int ShAmtVal = TyBits - ShAmt->getLimitedValue(TyBits); - - uint32_t BitWidth = AndTy->getPrimitiveSizeInBits(); - if ((APInt::getHighBitsSet(BitWidth, BitWidth-ShAmtVal) & - AndCST->getValue()) == 0) - CanFold = true; - } - - if (CanFold) { - Constant *NewCst; - if (Shift->getOpcode() == Instruction::Shl) - NewCst = ConstantExpr::getLShr(CI, ShAmt); - else - NewCst = ConstantExpr::getShl(CI, ShAmt); - - // Check to see if we are shifting out any of the bits being - // compared. - if (ConstantExpr::get(Shift->getOpcode(), NewCst, ShAmt) != CI){ - // If we shifted bits out, the fold is not going to work out. - // As a special case, check to see if this means that the - // result is always true or false now. - if (I.getPredicate() == ICmpInst::ICMP_EQ) - return ReplaceInstUsesWith(I, ConstantInt::getFalse()); - if (I.getPredicate() == ICmpInst::ICMP_NE) - return ReplaceInstUsesWith(I, ConstantInt::getTrue()); - } else { - I.setOperand(1, NewCst); - Constant *NewAndCST; - if (Shift->getOpcode() == Instruction::Shl) - NewAndCST = ConstantExpr::getLShr(AndCST, ShAmt); - else - NewAndCST = ConstantExpr::getShl(AndCST, ShAmt); - LHSI->setOperand(1, NewAndCST); - LHSI->setOperand(0, Shift->getOperand(0)); - AddToWorkList(Shift); // Shift is dead. - AddUsesToWorkList(I); - return &I; - } - } - } - - // Turn ((X >> Y) & C) == 0 into (X & (C << Y)) == 0. The later is - // preferable because it allows the C<hasOneUse() && CI->isNullValue() && - I.isEquality() && !Shift->isArithmeticShift() && - isa(Shift->getOperand(0))) { - // Compute C << Y. - Value *NS; - if (Shift->getOpcode() == Instruction::LShr) { - NS = BinaryOperator::createShl(AndCST, - Shift->getOperand(1), "tmp"); - } else { - // Insert a logical shift. - NS = BinaryOperator::createLShr(AndCST, - Shift->getOperand(1), "tmp"); - } - InsertNewInstBefore(cast(NS), I); - - // Compute X & (C << Y). - Instruction *NewAnd = BinaryOperator::createAnd( - Shift->getOperand(0), NS, LHSI->getName()); - InsertNewInstBefore(NewAnd, I); - - I.setOperand(0, NewAnd); - return &I; - } - } - break; - - case Instruction::Shl: // (icmp pred (shl X, ShAmt), CI) - if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { - if (I.isEquality()) { - uint32_t TypeBits = CI->getType()->getPrimitiveSizeInBits(); - - // Check that the shift amount is in range. If not, don't perform - // undefined shifts. When the shift is visited it will be - // simplified. - if (ShAmt->uge(TypeBits)) - break; - - // If we are comparing against bits always shifted out, the - // comparison cannot succeed. - Constant *Comp = - ConstantExpr::getShl(ConstantExpr::getLShr(CI, ShAmt), ShAmt); - if (Comp != CI) {// Comparing against a bit that we know is zero. - bool IsICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; - Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); - return ReplaceInstUsesWith(I, Cst); - } - - if (LHSI->hasOneUse()) { - // Otherwise strength reduce the shift into an and. - uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); - Constant *Mask = ConstantInt::get( - APInt::getLowBitsSet(TypeBits, TypeBits-ShAmtVal)); - - Instruction *AndI = - BinaryOperator::createAnd(LHSI->getOperand(0), - Mask, LHSI->getName()+".mask"); - Value *And = InsertNewInstBefore(AndI, I); - return new ICmpInst(I.getPredicate(), And, - ConstantExpr::getLShr(CI, ShAmt)); - } - } - } - break; - - case Instruction::LShr: // (icmp pred (shr X, ShAmt), CI) - case Instruction::AShr: - if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { - if (I.isEquality()) { - // Check that the shift amount is in range. If not, don't perform - // undefined shifts. When the shift is visited it will be - // simplified. - uint32_t TypeBits = CI->getType()->getPrimitiveSizeInBits(); - if (ShAmt->uge(TypeBits)) - break; - - // If we are comparing against bits always shifted out, the - // comparison cannot succeed. - Constant *Comp; - if (LHSI->getOpcode() == Instruction::LShr) - Comp = ConstantExpr::getLShr(ConstantExpr::getShl(CI, ShAmt), - ShAmt); - else - Comp = ConstantExpr::getAShr(ConstantExpr::getShl(CI, ShAmt), - ShAmt); - - if (Comp != CI) {// Comparing against a bit that we know is zero. - bool IsICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; - Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); - return ReplaceInstUsesWith(I, Cst); - } - - if (LHSI->hasOneUse() || CI->isNullValue()) { - uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); - - // Otherwise strength reduce the shift into an and. - APInt Val(APInt::getHighBitsSet(TypeBits, TypeBits - ShAmtVal)); - Constant *Mask = ConstantInt::get(Val); - - Instruction *AndI = - BinaryOperator::createAnd(LHSI->getOperand(0), - Mask, LHSI->getName()+".mask"); - Value *And = InsertNewInstBefore(AndI, I); - return new ICmpInst(I.getPredicate(), And, - ConstantExpr::getShl(CI, ShAmt)); - } - } - } - break; - - case Instruction::SDiv: - case Instruction::UDiv: - // Fold: icmp pred ([us]div X, C1), C2 -> range test - // Fold this div into the comparison, producing a range check. - // Determine, based on the divide type, what the range is being - // checked. If there is an overflow on the low or high side, remember - // it, otherwise compute the range [low, hi) bounding the new value. - // See: InsertRangeTest above for the kinds of replacements possible. - if (ConstantInt *DivRHS = dyn_cast(LHSI->getOperand(1))) { - // FIXME: If the operand types don't match the type of the divide - // then don't attempt this transform. The code below doesn't have the - // logic to deal with a signed divide and an unsigned compare (and - // vice versa). This is because (x /s C1) getOpcode() == Instruction::SDiv; - if (!I.isEquality() && DivIsSigned != I.isSignedPredicate()) - break; - if (DivRHS->isZero()) - break; // Don't hack on div by zero - - // Initialize the variables that will indicate the nature of the - // range check. - bool LoOverflow = false, HiOverflow = false; - ConstantInt *LoBound = 0, *HiBound = 0; - - // Compute Prod = CI * DivRHS. We are essentially solving an equation - // of form X/C1=C2. We solve for X by multiplying C1 (DivRHS) and - // C2 (CI). By solving for X we can turn this into a range check - // instead of computing a divide. - ConstantInt *Prod = Multiply(CI, DivRHS); - - // Determine if the product overflows by seeing if the product is - // not equal to the divide. Make sure we do the same kind of divide - // as in the LHS instruction that we're folding. - bool ProdOV = (DivIsSigned ? ConstantExpr::getSDiv(Prod, DivRHS) : - ConstantExpr::getUDiv(Prod, DivRHS)) != CI; - - // Get the ICmp opcode - ICmpInst::Predicate predicate = I.getPredicate(); - - if (!DivIsSigned) { // udiv - LoBound = Prod; - LoOverflow = ProdOV; - HiOverflow = ProdOV || - AddWithOverflow(HiBound, LoBound, DivRHS, false); - } else if (DivRHS->getValue().isPositive()) { // Divisor is > 0. - if (CI->isNullValue()) { // (X / pos) op 0 - // Can't overflow. - LoBound = cast(ConstantExpr::getNeg(SubOne(DivRHS))); - HiBound = DivRHS; - } else if (CI->getValue().isPositive()) { // (X / pos) op pos - LoBound = Prod; - LoOverflow = ProdOV; - HiOverflow = ProdOV || - AddWithOverflow(HiBound, Prod, DivRHS, true); - } else { // (X / pos) op neg - Constant *DivRHSH = ConstantExpr::getNeg(SubOne(DivRHS)); - LoOverflow = AddWithOverflow(LoBound, Prod, - cast(DivRHSH), true); - HiBound = AddOne(Prod); - HiOverflow = ProdOV; - } - } else { // Divisor is < 0. - if (CI->isNullValue()) { // (X / neg) op 0 - LoBound = AddOne(DivRHS); - HiBound = cast(ConstantExpr::getNeg(DivRHS)); - if (HiBound == DivRHS) - LoBound = 0; // - INTMIN = INTMIN - } else if (CI->getValue().isPositive()) { // (X / neg) op pos - HiOverflow = LoOverflow = ProdOV; - if (!LoOverflow) - LoOverflow = AddWithOverflow(LoBound, Prod, AddOne(DivRHS), - true); - HiBound = AddOne(Prod); - } else { // (X / neg) op neg - LoBound = Prod; - LoOverflow = HiOverflow = ProdOV; - HiBound = Subtract(Prod, DivRHS); - } - - // Dividing by a negate swaps the condition. - predicate = ICmpInst::getSwappedPredicate(predicate); - } - - if (LoBound) { - Value *X = LHSI->getOperand(0); - switch (predicate) { - default: assert(0 && "Unhandled icmp opcode!"); - case ICmpInst::ICMP_EQ: - if (LoOverflow && HiOverflow) - return ReplaceInstUsesWith(I, ConstantInt::getFalse()); - else if (HiOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : - ICmpInst::ICMP_UGE, X, LoBound); - else if (LoOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : - ICmpInst::ICMP_ULT, X, HiBound); - else - return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, - true, I); - case ICmpInst::ICMP_NE: - if (LoOverflow && HiOverflow) - return ReplaceInstUsesWith(I, ConstantInt::getTrue()); - else if (HiOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : - ICmpInst::ICMP_ULT, X, LoBound); - else if (LoOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : - ICmpInst::ICMP_UGE, X, HiBound); - else - return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, - false, I); - case ICmpInst::ICMP_ULT: - case ICmpInst::ICMP_SLT: - if (LoOverflow) - return ReplaceInstUsesWith(I, ConstantInt::getFalse()); - return new ICmpInst(predicate, X, LoBound); - case ICmpInst::ICMP_UGT: - case ICmpInst::ICMP_SGT: - if (HiOverflow) - return ReplaceInstUsesWith(I, ConstantInt::getFalse()); - if (predicate == ICmpInst::ICMP_UGT) - return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound); - else - return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound); - } - } - } - break; - } - - // Simplify icmp_eq and icmp_ne instructions with integer constant RHS. - if (I.isEquality()) { - bool isICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; - - // If the first operand is (add|sub|and|or|xor|rem) with a constant, and - // the second operand is a constant, simplify a bit. - if (BinaryOperator *BO = dyn_cast(Op0)) { - switch (BO->getOpcode()) { - case Instruction::SRem: - // If we have a signed (X % (2^c)) == 0, turn it into an unsigned one. - if (CI->isZero() && isa(BO->getOperand(1)) && - BO->hasOneUse()) { - const APInt& V = cast(BO->getOperand(1))->getValue(); - if (V.sgt(APInt(V.getBitWidth(), 1)) && V.isPowerOf2()) { - Value *NewRem = InsertNewInstBefore(BinaryOperator::createURem( - BO->getOperand(0), BO->getOperand(1), BO->getName()), I); - return new ICmpInst(I.getPredicate(), NewRem, - Constant::getNullValue(BO->getType())); - } - } - break; - case Instruction::Add: - // Replace ((add A, B) != C) with (A != C-B) if B & C are constants. - if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { - if (BO->hasOneUse()) - return new ICmpInst(I.getPredicate(), BO->getOperand(0), - Subtract(CI, BOp1C)); - } else if (CI->isNullValue()) { - // Replace ((add A, B) != 0) with (A != -B) if A or B is - // efficiently invertible, or if the add has just this one use. - Value *BOp0 = BO->getOperand(0), *BOp1 = BO->getOperand(1); - - if (Value *NegVal = dyn_castNegVal(BOp1)) - return new ICmpInst(I.getPredicate(), BOp0, NegVal); - else if (Value *NegVal = dyn_castNegVal(BOp0)) - return new ICmpInst(I.getPredicate(), NegVal, BOp1); - else if (BO->hasOneUse()) { - Instruction *Neg = BinaryOperator::createNeg(BOp1); - InsertNewInstBefore(Neg, I); - Neg->takeName(BO); - return new ICmpInst(I.getPredicate(), BOp0, Neg); - } - } - break; - case Instruction::Xor: - // For the xor case, we can xor two constants together, eliminating - // the explicit xor. - if (Constant *BOC = dyn_cast(BO->getOperand(1))) - return new ICmpInst(I.getPredicate(), BO->getOperand(0), - ConstantExpr::getXor(CI, BOC)); - - // FALLTHROUGH - case Instruction::Sub: - // Replace (([sub|xor] A, B) != 0) with (A != B) - if (CI->isZero()) - return new ICmpInst(I.getPredicate(), BO->getOperand(0), - BO->getOperand(1)); - break; - - case Instruction::Or: - // If bits are being or'd in that are not present in the constant we - // are comparing against, then the comparison could never succeed! - if (Constant *BOC = dyn_cast(BO->getOperand(1))) { - Constant *NotCI = ConstantExpr::getNot(CI); - if (!ConstantExpr::getAnd(BOC, NotCI)->isNullValue()) - return ReplaceInstUsesWith(I, ConstantInt::get(Type::Int1Ty, - isICMP_NE)); - } - break; - - case Instruction::And: - if (ConstantInt *BOC = dyn_cast(BO->getOperand(1))) { - // If bits are being compared against that are and'd out, then the - // comparison can never succeed! - if (!And(CI, ConstantInt::get(~BOC->getValue()))->isZero()) - return ReplaceInstUsesWith(I, ConstantInt::get(Type::Int1Ty, - isICMP_NE)); - - // If we have ((X & C) == C), turn it into ((X & C) != 0). - if (CI == BOC && isOneBitSet(CI)) - return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : - ICmpInst::ICMP_NE, Op0, - Constant::getNullValue(CI->getType())); - - // Replace (and X, (1 << size(X)-1) != 0) with x s< 0 - if (isSignBit(BOC)) { - Value *X = BO->getOperand(0); - Constant *Zero = Constant::getNullValue(X->getType()); - ICmpInst::Predicate pred = isICMP_NE ? - ICmpInst::ICMP_SLT : ICmpInst::ICMP_SGE; - return new ICmpInst(pred, X, Zero); - } - - // ((X & ~7) == 0) --> X < 8 - if (CI->isNullValue() && isHighOnes(BOC)) { - Value *X = BO->getOperand(0); - Constant *NegX = ConstantExpr::getNeg(BOC); - ICmpInst::Predicate pred = isICMP_NE ? - ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT; - return new ICmpInst(pred, X, NegX); - } - - } - default: break; - } - } else if (IntrinsicInst *II = dyn_cast(Op0)) { - // Handle icmp {eq|ne} , intcst. - if (II->getIntrinsicID() == Intrinsic::bswap) { - AddToWorkList(II); - I.setOperand(0, II->getOperand(1)); - I.setOperand(1, ConstantInt::get(CI->getValue().byteSwap())); - return &I; - } - } - } else { // Not a ICMP_EQ/ICMP_NE - // If the LHS is a cast from an integral value of the same size, then - // since we know the RHS is a constant, try to simlify. - if (CastInst *Cast = dyn_cast(Op0)) { - Value *CastOp = Cast->getOperand(0); - const Type *SrcTy = CastOp->getType(); - uint32_t SrcTySize = SrcTy->getPrimitiveSizeInBits(); - if (SrcTy->isInteger() && - SrcTySize == Cast->getType()->getPrimitiveSizeInBits()) { - // If this is an unsigned comparison, try to make the comparison use - // smaller constant values. - switch (I.getPredicate()) { - default: break; - case ICmpInst::ICMP_ULT: { // X u< 128 => X s> -1 - ConstantInt *CUI = cast(CI); - if (CUI->getValue() == APInt::getSignBit(SrcTySize)) - return new ICmpInst(ICmpInst::ICMP_SGT, CastOp, - ConstantInt::get(APInt::getAllOnesValue(SrcTySize))); - break; - } - case ICmpInst::ICMP_UGT: { // X u> 127 => X s< 0 - ConstantInt *CUI = cast(CI); - if (CUI->getValue() == APInt::getSignedMaxValue(SrcTySize)) - return new ICmpInst(ICmpInst::ICMP_SLT, CastOp, - Constant::getNullValue(SrcTy)); - break; - } - } - - } - } - } + if (Instruction *Res = visitICmpInstWithInstAndIntCst(I, LHSI, CI)) + return Res; } - // Handle icmp with constant RHS + // Handle icmp with constant (but not simple integer constant) RHS if (Constant *RHSC = dyn_cast(Op1)) { if (Instruction *LHSI = dyn_cast(Op0)) switch (LHSI->getOpcode()) { @@ -5406,9 +4895,524 @@ return Changed ? &I : 0; } -// visitICmpInstWithCastAndCast - Handle icmp (cast x to y), (cast/cst). -// We only handle extending casts so far. -// +/// visitICmpInstWithInstAndIntCst - Handle "icmp (instr, intcst)". +/// +Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, + Instruction *LHSI, + ConstantInt *RHS) { + const APInt &RHSV = RHS->getValue(); + + switch (LHSI->getOpcode()) { + case Instruction::Xor: // (icmp pred (and X, XorCST), CI) + if (ConstantInt *XorCST = dyn_cast(LHSI->getOperand(1))) { + // If this is a comparison that tests the signbit (X < 0) or (x > -1), + // fold the xor. + if (ICI.getPredicate() == ICmpInst::ICMP_SLT && RHSV == 0 || + ICI.getPredicate() == ICmpInst::ICMP_SGT && RHSV.isAllOnesValue()) { + Value *CompareVal = LHSI->getOperand(0); + + // If the sign bit of the XorCST is not set, there is no change to + // the operation, just stop using the Xor. + if (!XorCST->getValue().isNegative()) { + ICI.setOperand(0, CompareVal); + AddToWorkList(LHSI); + return &ICI; + } + + // Was the old condition true if the operand is positive? + bool isTrueIfPositive = ICI.getPredicate() == ICmpInst::ICMP_SGT; + + // If so, the new one isn't. + isTrueIfPositive ^= true; + + if (isTrueIfPositive) + return new ICmpInst(ICmpInst::ICMP_SGT, CompareVal, SubOne(RHS)); + else + return new ICmpInst(ICmpInst::ICMP_SLT, CompareVal, AddOne(RHS)); + } + } + break; + case Instruction::And: // (icmp pred (and X, AndCST), RHS) + if (LHSI->hasOneUse() && isa(LHSI->getOperand(1)) && + LHSI->getOperand(0)->hasOneUse()) { + ConstantInt *AndCST = cast(LHSI->getOperand(1)); + + // If the LHS is an AND of a truncating cast, we can widen the + // and/compare to be the input width without changing the value + // produced, eliminating a cast. + if (CastInst *Cast = dyn_cast(LHSI->getOperand(0))) { + // We can do this transformation if either the AND constant does not + // have its sign bit set or if it is an equality comparison. + // Extending a relational comparison when we're checking the sign + // bit would not work. + if (Cast->hasOneUse() && isa(Cast) && + (ICI.isEquality() || AndCST->getValue().isPositive() && + RHSV.isPositive())) { + ConstantInt *NewCST; + ConstantInt *NewCI; + APInt NewCSTVal(AndCST->getValue()), NewCIVal(RHSV); + uint32_t BitWidth = + cast(Cast->getOperand(0)->getType())->getBitWidth(); + NewCST = ConstantInt::get(NewCSTVal.zext(BitWidth)); + NewCI = ConstantInt::get(NewCIVal.zext(BitWidth)); + Instruction *NewAnd = + BinaryOperator::createAnd(Cast->getOperand(0), NewCST, + LHSI->getName()); + InsertNewInstBefore(NewAnd, ICI); + return new ICmpInst(ICI.getPredicate(), NewAnd, NewCI); + } + } + + // If this is: (X >> C1) & C2 != C3 (where any shift and any compare + // could exist), turn it into (X & (C2 << C1)) != (C3 << C1). This + // happens a LOT in code produced by the C front-end, for bitfield + // access. + BinaryOperator *Shift = dyn_cast(LHSI->getOperand(0)); + if (Shift && !Shift->isShift()) + Shift = 0; + + ConstantInt *ShAmt; + ShAmt = Shift ? dyn_cast(Shift->getOperand(1)) : 0; + const Type *Ty = Shift ? Shift->getType() : 0; // Type of the shift. + const Type *AndTy = AndCST->getType(); // Type of the and. + + // We can fold this as long as we can't shift unknown bits + // into the mask. This can only happen with signed shift + // rights, as they sign-extend. + if (ShAmt) { + bool CanFold = Shift->isLogicalShift(); + if (!CanFold) { + // To test for the bad case of the signed shr, see if any + // of the bits shifted in could be tested after the mask. + uint32_t TyBits = Ty->getPrimitiveSizeInBits(); + int ShAmtVal = TyBits - ShAmt->getLimitedValue(TyBits); + + uint32_t BitWidth = AndTy->getPrimitiveSizeInBits(); + if ((APInt::getHighBitsSet(BitWidth, BitWidth-ShAmtVal) & + AndCST->getValue()) == 0) + CanFold = true; + } + + if (CanFold) { + Constant *NewCst; + if (Shift->getOpcode() == Instruction::Shl) + NewCst = ConstantExpr::getLShr(RHS, ShAmt); + else + NewCst = ConstantExpr::getShl(RHS, ShAmt); + + // Check to see if we are shifting out any of the bits being + // compared. + if (ConstantExpr::get(Shift->getOpcode(), NewCst, ShAmt) != RHS) { + // If we shifted bits out, the fold is not going to work out. + // As a special case, check to see if this means that the + // result is always true or false now. + if (ICI.getPredicate() == ICmpInst::ICMP_EQ) + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); + if (ICI.getPredicate() == ICmpInst::ICMP_NE) + return ReplaceInstUsesWith(ICI, ConstantInt::getTrue()); + } else { + ICI.setOperand(1, NewCst); + Constant *NewAndCST; + if (Shift->getOpcode() == Instruction::Shl) + NewAndCST = ConstantExpr::getLShr(AndCST, ShAmt); + else + NewAndCST = ConstantExpr::getShl(AndCST, ShAmt); + LHSI->setOperand(1, NewAndCST); + LHSI->setOperand(0, Shift->getOperand(0)); + AddToWorkList(Shift); // Shift is dead. + AddUsesToWorkList(ICI); + return &ICI; + } + } + } + + // Turn ((X >> Y) & C) == 0 into (X & (C << Y)) == 0. The later is + // preferable because it allows the C<hasOneUse() && RHSV == 0 && + ICI.isEquality() && !Shift->isArithmeticShift() && + isa(Shift->getOperand(0))) { + // Compute C << Y. + Value *NS; + if (Shift->getOpcode() == Instruction::LShr) { + NS = BinaryOperator::createShl(AndCST, + Shift->getOperand(1), "tmp"); + } else { + // Insert a logical shift. + NS = BinaryOperator::createLShr(AndCST, + Shift->getOperand(1), "tmp"); + } + InsertNewInstBefore(cast(NS), ICI); + + // Compute X & (C << Y). + Instruction *NewAnd = + BinaryOperator::createAnd(Shift->getOperand(0), NS, LHSI->getName()); + InsertNewInstBefore(NewAnd, ICI); + + ICI.setOperand(0, NewAnd); + return &ICI; + } + } + break; + + case Instruction::Shl: // (icmp pred (shl X, ShAmt), CI) + if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { + if (ICI.isEquality()) { + uint32_t TypeBits = RHSV.getBitWidth(); + + // Check that the shift amount is in range. If not, don't perform + // undefined shifts. When the shift is visited it will be + // simplified. + if (ShAmt->uge(TypeBits)) + break; + + // If we are comparing against bits always shifted out, the + // comparison cannot succeed. + Constant *Comp = + ConstantExpr::getShl(ConstantExpr::getLShr(RHS, ShAmt), ShAmt); + if (Comp != RHS) {// Comparing against a bit that we know is zero. + bool IsICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE; + Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); + return ReplaceInstUsesWith(ICI, Cst); + } + + if (LHSI->hasOneUse()) { + // Otherwise strength reduce the shift into an and. + uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); + Constant *Mask = + ConstantInt::get(APInt::getLowBitsSet(TypeBits, TypeBits-ShAmtVal)); + + Instruction *AndI = + BinaryOperator::createAnd(LHSI->getOperand(0), + Mask, LHSI->getName()+".mask"); + Value *And = InsertNewInstBefore(AndI, ICI); + return new ICmpInst(ICI.getPredicate(), And, + ConstantInt::get(RHSV << ShAmtVal)); + } + } + } + break; + + case Instruction::LShr: // (icmp pred (shr X, ShAmt), CI) + case Instruction::AShr: + if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { + if (ICI.isEquality()) { + // Check that the shift amount is in range. If not, don't perform + // undefined shifts. When the shift is visited it will be + // simplified. + uint32_t TypeBits = RHSV.getBitWidth(); + if (ShAmt->uge(TypeBits)) + break; + uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); + + // If we are comparing against bits always shifted out, the + // comparison cannot succeed. + APInt Comp = RHSV << ShAmtVal; + if (LHSI->getOpcode() == Instruction::LShr) + Comp = Comp.lshr(ShAmtVal); + else + Comp = Comp.ashr(ShAmtVal); + + if (Comp != RHSV) { // Comparing against a bit that we know is zero. + bool IsICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE; + Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); + return ReplaceInstUsesWith(ICI, Cst); + } + + if (LHSI->hasOneUse() || RHSV == 0) { + // Otherwise strength reduce the shift into an and. + APInt Val(APInt::getHighBitsSet(TypeBits, TypeBits - ShAmtVal)); + Constant *Mask = ConstantInt::get(Val); + + Instruction *AndI = + BinaryOperator::createAnd(LHSI->getOperand(0), + Mask, LHSI->getName()+".mask"); + Value *And = InsertNewInstBefore(AndI, ICI); + return new ICmpInst(ICI.getPredicate(), And, + ConstantExpr::getShl(RHS, ShAmt)); + } + } + } + break; + + case Instruction::SDiv: + case Instruction::UDiv: + // Fold: icmp pred ([us]div X, C1), C2 -> range test + // Fold this div into the comparison, producing a range check. + // Determine, based on the divide type, what the range is being + // checked. If there is an overflow on the low or high side, remember + // it, otherwise compute the range [low, hi) bounding the new value. + // See: InsertRangeTest above for the kinds of replacements possible. + if (ConstantInt *DivRHS = dyn_cast(LHSI->getOperand(1))) { + // FIXME: If the operand types don't match the type of the divide + // then don't attempt this transform. The code below doesn't have the + // logic to deal with a signed divide and an unsigned compare (and + // vice versa). This is because (x /s C1) getOpcode() == Instruction::SDiv; + if (!ICI.isEquality() && DivIsSigned != ICI.isSignedPredicate()) + break; + if (DivRHS->isZero()) + break; // Don't hack on div by zero + + // Initialize the variables that will indicate the nature of the + // range check. + bool LoOverflow = false, HiOverflow = false; + ConstantInt *LoBound = 0, *HiBound = 0; + + // Compute Prod = CI * DivRHS. We are essentially solving an equation + // of form X/C1=C2. We solve for X by multiplying C1 (DivRHS) and + // C2 (CI). By solving for X we can turn this into a range check + // instead of computing a divide. + ConstantInt *Prod = Multiply(RHS, DivRHS); + + // Determine if the product overflows by seeing if the product is + // not equal to the divide. Make sure we do the same kind of divide + // as in the LHS instruction that we're folding. + bool ProdOV = (DivIsSigned ? ConstantExpr::getSDiv(Prod, DivRHS) : + ConstantExpr::getUDiv(Prod, DivRHS)) != RHS; + + // Get the ICmp opcode + ICmpInst::Predicate predicate = ICI.getPredicate(); + + if (!DivIsSigned) { // udiv + LoBound = Prod; + LoOverflow = ProdOV; + HiOverflow = ProdOV || + AddWithOverflow(HiBound, LoBound, DivRHS, false); + } else if (DivRHS->getValue().isPositive()) { // Divisor is > 0. + if (RHSV == 0) { // (X / pos) op 0 + // Can't overflow. + LoBound = cast(ConstantExpr::getNeg(SubOne(DivRHS))); + HiBound = DivRHS; + } else if (RHSV.isPositive()) { // (X / pos) op pos + LoBound = Prod; + LoOverflow = ProdOV; + HiOverflow = ProdOV || + AddWithOverflow(HiBound, Prod, DivRHS, true); + } else { // (X / pos) op neg + Constant *DivRHSH = ConstantExpr::getNeg(SubOne(DivRHS)); + LoOverflow = AddWithOverflow(LoBound, Prod, + cast(DivRHSH), true); + HiBound = AddOne(Prod); + HiOverflow = ProdOV; + } + } else { // Divisor is < 0. + if (RHSV == 0) { // (X / neg) op 0 + LoBound = AddOne(DivRHS); + HiBound = cast(ConstantExpr::getNeg(DivRHS)); + if (HiBound == DivRHS) + LoBound = 0; // - INTMIN = INTMIN + } else if (RHSV.isPositive()) { // (X / neg) op pos + HiOverflow = LoOverflow = ProdOV; + if (!LoOverflow) + LoOverflow = AddWithOverflow(LoBound, Prod, AddOne(DivRHS), + true); + HiBound = AddOne(Prod); + } else { // (X / neg) op neg + LoBound = Prod; + LoOverflow = HiOverflow = ProdOV; + HiBound = Subtract(Prod, DivRHS); + } + + // Dividing by a negate swaps the condition. + predicate = ICmpInst::getSwappedPredicate(predicate); + } + + if (LoBound) { + Value *X = LHSI->getOperand(0); + switch (predicate) { + default: assert(0 && "Unhandled icmp opcode!"); + case ICmpInst::ICMP_EQ: + if (LoOverflow && HiOverflow) + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); + else if (HiOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : + ICmpInst::ICMP_UGE, X, LoBound); + else if (LoOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : + ICmpInst::ICMP_ULT, X, HiBound); + else + return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, + true, ICI); + case ICmpInst::ICMP_NE: + if (LoOverflow && HiOverflow) + return ReplaceInstUsesWith(ICI, ConstantInt::getTrue()); + else if (HiOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : + ICmpInst::ICMP_ULT, X, LoBound); + else if (LoOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : + ICmpInst::ICMP_UGE, X, HiBound); + else + return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, + false, ICI); + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + if (LoOverflow) + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); + return new ICmpInst(predicate, X, LoBound); + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + if (HiOverflow) + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); + if (predicate == ICmpInst::ICMP_UGT) + return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound); + else + return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound); + } + } + } + break; + } + + // Simplify icmp_eq and icmp_ne instructions with integer constant RHS. + if (ICI.isEquality()) { + bool isICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE; + + // If the first operand is (add|sub|and|or|xor|rem) with a constant, and + // the second operand is a constant, simplify a bit. + if (BinaryOperator *BO = dyn_cast(LHSI)) { + switch (BO->getOpcode()) { + case Instruction::SRem: + // If we have a signed (X % (2^c)) == 0, turn it into an unsigned one. + if (RHSV == 0 && isa(BO->getOperand(1)) &&BO->hasOneUse()){ + const APInt &V = cast(BO->getOperand(1))->getValue(); + if (V.sgt(APInt(V.getBitWidth(), 1)) && V.isPowerOf2()) { + Instruction *NewRem = + BinaryOperator::createURem(BO->getOperand(0), BO->getOperand(1), + BO->getName()); + InsertNewInstBefore(NewRem, ICI); + return new ICmpInst(ICI.getPredicate(), NewRem, + Constant::getNullValue(BO->getType())); + } + } + break; + case Instruction::Add: + // Replace ((add A, B) != C) with (A != C-B) if B & C are constants. + if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { + if (BO->hasOneUse()) + return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), + Subtract(RHS, BOp1C)); + } else if (RHSV == 0) { + // Replace ((add A, B) != 0) with (A != -B) if A or B is + // efficiently invertible, or if the add has just this one use. + Value *BOp0 = BO->getOperand(0), *BOp1 = BO->getOperand(1); + + if (Value *NegVal = dyn_castNegVal(BOp1)) + return new ICmpInst(ICI.getPredicate(), BOp0, NegVal); + else if (Value *NegVal = dyn_castNegVal(BOp0)) + return new ICmpInst(ICI.getPredicate(), NegVal, BOp1); + else if (BO->hasOneUse()) { + Instruction *Neg = BinaryOperator::createNeg(BOp1); + InsertNewInstBefore(Neg, ICI); + Neg->takeName(BO); + return new ICmpInst(ICI.getPredicate(), BOp0, Neg); + } + } + break; + case Instruction::Xor: + // For the xor case, we can xor two constants together, eliminating + // the explicit xor. + if (Constant *BOC = dyn_cast(BO->getOperand(1))) + return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), + ConstantExpr::getXor(RHS, BOC)); + + // FALLTHROUGH + case Instruction::Sub: + // Replace (([sub|xor] A, B) != 0) with (A != B) + if (RHSV == 0) + return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), + BO->getOperand(1)); + break; + + case Instruction::Or: + // If bits are being or'd in that are not present in the constant we + // are comparing against, then the comparison could never succeed! + if (Constant *BOC = dyn_cast(BO->getOperand(1))) { + Constant *NotCI = ConstantExpr::getNot(RHS); + if (!ConstantExpr::getAnd(BOC, NotCI)->isNullValue()) + return ReplaceInstUsesWith(ICI, ConstantInt::get(Type::Int1Ty, + isICMP_NE)); + } + break; + + case Instruction::And: + if (ConstantInt *BOC = dyn_cast(BO->getOperand(1))) { + // If bits are being compared against that are and'd out, then the + // comparison can never succeed! + if ((RHSV & ~BOC->getValue()) != 0) + return ReplaceInstUsesWith(ICI, ConstantInt::get(Type::Int1Ty, + isICMP_NE)); + + // If we have ((X & C) == C), turn it into ((X & C) != 0). + if (RHS == BOC && RHSV.isPowerOf2()) + return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : + ICmpInst::ICMP_NE, RHS, + Constant::getNullValue(RHS->getType())); + + // Replace (and X, (1 << size(X)-1) != 0) with x s< 0 + if (isSignBit(BOC)) { + Value *X = BO->getOperand(0); + Constant *Zero = Constant::getNullValue(X->getType()); + ICmpInst::Predicate pred = isICMP_NE ? + ICmpInst::ICMP_SLT : ICmpInst::ICMP_SGE; + return new ICmpInst(pred, X, Zero); + } + + // ((X & ~7) == 0) --> X < 8 + if (RHSV == 0 && isHighOnes(BOC)) { + Value *X = BO->getOperand(0); + Constant *NegX = ConstantExpr::getNeg(BOC); + ICmpInst::Predicate pred = isICMP_NE ? + ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT; + return new ICmpInst(pred, X, NegX); + } + } + default: break; + } + } else if (IntrinsicInst *II = dyn_cast(LHSI)) { + // Handle icmp {eq|ne} , intcst. + if (II->getIntrinsicID() == Intrinsic::bswap) { + AddToWorkList(II); + ICI.setOperand(0, II->getOperand(1)); + ICI.setOperand(1, ConstantInt::get(RHSV.byteSwap())); + return &ICI; + } + } + } else { // Not a ICMP_EQ/ICMP_NE + // If the LHS is a cast from an integral value of the same size, then + // since we know the RHS is a constant, try to simlify. + if (CastInst *Cast = dyn_cast(LHSI)) { + Value *CastOp = Cast->getOperand(0); + const Type *SrcTy = CastOp->getType(); + uint32_t SrcTySize = SrcTy->getPrimitiveSizeInBits(); + if (SrcTy->isInteger() && + SrcTySize == Cast->getType()->getPrimitiveSizeInBits()) { + // If this is an unsigned comparison, try to make the comparison use + // smaller constant values. + if (ICI.getPredicate() == ICmpInst::ICMP_ULT && RHSV.isSignBit()) { + // X u< 128 => X s> -1 + return new ICmpInst(ICmpInst::ICMP_SGT, CastOp, + ConstantInt::get(APInt::getAllOnesValue(SrcTySize))); + } else if (ICI.getPredicate() == ICmpInst::ICMP_UGT && + RHSV == APInt::getSignedMaxValue(SrcTySize)) { + // X u> 127 => X s< 0 + return new ICmpInst(ICmpInst::ICMP_SLT, CastOp, + Constant::getNullValue(SrcTy)); + } + } + } + } + return 0; +} + +/// visitICmpInstWithCastAndCast - Handle icmp (cast x to y), (cast/cst). +/// We only handle extending casts so far. +/// Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { const CastInst *LHSCI = cast(ICI.getOperand(0)); Value *LHSCIOp = LHSCI->getOperand(0); From reid at x10sys.com Mon Apr 2 23:56:39 2007 From: reid at x10sys.com (Reid Spencer) Date: Mon, 2 Apr 2007 23:56:39 -0500 Subject: [llvm-commits] CVS: llvm-www/SVNMigration.html Message-ID: <200704030456.l334udQR004396@zion.cs.uiuc.edu> Changes in directory llvm-www: SVNMigration.html updated: 1.2 -> 1.3 --- Log message: Add a note about renaming things. --- Diffs of the changes: (+34 -1) SVNMigration.html | 35 ++++++++++++++++++++++++++++++++++- 1 files changed, 34 insertions(+), 1 deletion(-) Index: llvm-www/SVNMigration.html diff -u llvm-www/SVNMigration.html:1.2 llvm-www/SVNMigration.html:1.3 --- llvm-www/SVNMigration.html:1.2 Mon Apr 2 13:52:38 2007 +++ llvm-www/SVNMigration.html Mon Apr 2 23:56:22 2007 @@ -7,6 +7,39 @@ + +
      +

      Since everything will be in one SVN repository, we thought we'd take this + opportunity to rename some top level directories to reduce redundancy. This + will be more important with Subversion because of Subversion URLs which will + already contain llvm.org (host) and llvm-something (repository). We + don't need another level of "llvm" in the top level directories as well.

      +

      The proposed renamining is shown in the table below.

      + + + + + + + + + + +
      Old NameNew Name
      llvmllvm
      llvm-testtest-suite
      llvm-stackerstacker
      llvm-javajava
      llvm-tvtelevision
      llvm-poolallocpoolalloc
      Adaptiveadaptive
      nightlytest-serversidenightly-test
      +

      NOTE: Due to synchronization of commits in the conversion process, + we will likely transition all of the above to Subversion in one shot. + This will allow SVN revision numbers to increase temporally instead + of disjointedly if the projects were imported one at a time. It also + permits revision groups to span across projects. For example, + changes to llvm and llvm-stacker made at the same time with + the same commit comment would be grouped as one SVN revision. + This increases the atomicity of commits and reduces the total number of + revisions in the SVN repository.

      +

      NOTE: we will be converting neither llvm-www (UIUC web site) nor + llvm-gcc (old version 3).

      +
      + +

      The existing branches have been categorized as shown in the table below. If @@ -118,6 +151,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2007/04/02 18:52:38 $ +
      Last modified: $Date: 2007/04/03 04:56:22 $ From reid at x10sys.com Tue Apr 3 00:03:15 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 00:03:15 -0500 Subject: [llvm-commits] CVS: llvm-www/SVNMigration.html Message-ID: <200704030503.l3353Fpk004571@zion.cs.uiuc.edu> Changes in directory llvm-www: SVNMigration.html updated: 1.3 -> 1.4 --- Log message: Update the current status of branch/tag migration. --- Diffs of the changes: (+13 -17) SVNMigration.html | 30 +++++++++++++----------------- 1 files changed, 13 insertions(+), 17 deletions(-) Index: llvm-www/SVNMigration.html diff -u llvm-www/SVNMigration.html:1.3 llvm-www/SVNMigration.html:1.4 --- llvm-www/SVNMigration.html:1.3 Mon Apr 2 23:56:22 2007 +++ llvm-www/SVNMigration.html Tue Apr 3 00:02:58 2007 @@ -50,10 +50,12 @@ - + + + +
      NameDescription
      release_*Release branches (10 total)
      seeBranch Vikram's group is using for Secure - Code?
      seeBranch SVA project (will be renamed "SVA")
      parallelBranch for parallel features? (not sure)
      vector_llvmBranch for vector stuff? (not sure)
      PowerPC_0An early version of the PowerPC target, needed by release_13.

      Branches To Be Removed

      @@ -78,10 +80,6 @@ regalloc_linearscan has only 3 old header files in it - PowerPC_0 - Appears to be an early version of the PowerPC target. Seems not - important to keep it - pre-11, prerelease_* John created these as the first step towards a release, but it hasn't been done that way since (there's no prerelease_12 or later). @@ -104,28 +102,26 @@

      Tags To Be Kept

      - - - - - - - + +
      NameDescription
      jtcAssuming this is John Criswell's tag and he wants - it
      jtcllvaAssuming this is the LLVA tag
      RELEASE_*These are the final release tags (7 total)
      startThis seems to be the very first tag. It references an - ancient version of llvm and is only of historical interest
      RELEASE_*These are the release tags (7 total).
      startThis seems to be the very first tag. It is required + by the RELEASE_* tags.

      Tags To Be Removed

      + + + - + @@ -151,6 +147,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!">Valid HTML 4.01! -
      Last modified: $Date: 2007/04/03 04:56:22 $ +
      Last modified: $Date: 2007/04/03 05:02:58 $ From sabre at nondot.org Tue Apr 3 00:11:41 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 00:11:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200704030511.l335Bfgd004749@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.125 -> 1.126 --- Log message: split some code out into a helper function --- Diffs of the changes: (+30 -18) LoopStrengthReduce.cpp | 48 ++++++++++++++++++++++++++++++------------------ 1 files changed, 30 insertions(+), 18 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.125 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.126 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.125 Mon Apr 2 17:51:58 2007 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Tue Apr 3 00:11:24 2007 @@ -176,6 +176,8 @@ SCEVHandle GetExpressionSCEV(Instruction *E, Loop *L); void OptimizeIndvars(Loop *L); + bool FindIVForUser(ICmpInst *Cond, IVStrideUse *&CondUse, + const SCEVHandle *&CondStride); unsigned CheckForIVReuse(const SCEVHandle&, IVExpr&, const Type*, const std::vector& UsersToProcess); @@ -1222,6 +1224,31 @@ // different starting values, into different PHIs. } +/// FindIVForUser - If Cond has an operand that is an expression of an IV, +/// set the IV user and stride information and return true, otherwise return +/// false. +bool LoopStrengthReduce::FindIVForUser(ICmpInst *Cond, IVStrideUse *&CondUse, + const SCEVHandle *&CondStride) { + for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e && !CondUse; + ++Stride) { + std::map::iterator SI = + IVUsesByStride.find(StrideOrder[Stride]); + assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); + + for (std::vector::iterator UI = SI->second.Users.begin(), + E = SI->second.Users.end(); UI != E; ++UI) + if (UI->User == Cond) { + // NOTE: we could handle setcc instructions with multiple uses here, but + // InstCombine does it as well for simple uses, it's not clear that it + // occurs enough in real life to handle. + CondUse = &*UI; + CondStride = &SI->first; + return true; + } + } + return false; +} + // OptimizeIndvars - Now that IVUsesByStride is set up with all of the indvar // uses in the loop, look to see if we can eliminate some, in favor of using // common indvars for the different uses. @@ -1246,24 +1273,9 @@ IVStrideUse *CondUse = 0; const SCEVHandle *CondStride = 0; - for (unsigned Stride = 0, e = StrideOrder.size(); Stride != e && !CondUse; - ++Stride) { - std::map::iterator SI = - IVUsesByStride.find(StrideOrder[Stride]); - assert(SI != IVUsesByStride.end() && "Stride doesn't exist!"); - - for (std::vector::iterator UI = SI->second.Users.begin(), - E = SI->second.Users.end(); UI != E; ++UI) - if (UI->User == Cond) { - CondUse = &*UI; - CondStride = &SI->first; - // NOTE: we could handle setcc instructions with multiple uses here, but - // InstCombine does it as well for simple uses, it's not clear that it - // occurs enough in real life to handle. - break; - } - } - if (!CondUse) return; // setcc doesn't use the IV. + if (!FindIVForUser(Cond, CondUse, CondStride)) + return; // setcc doesn't use the IV. + // It's possible for the setcc instruction to be anywhere in the loop, and // possible for it to have multiple users. If it is not immediately before From isanbard at gmail.com Tue Apr 3 01:00:55 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 3 Apr 2007 01:00:55 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.cpp X86InstrMMX.td Message-ID: <200704030600.l3360tpM005770@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.cpp updated: 1.81 -> 1.82 X86InstrMMX.td updated: 1.28 -> 1.29 --- Log message: Add FEMMS and ADDQ. Renamed MMX recipes to prepend the MMX_ to them. --- Diffs of the changes: (+85 -69) X86InstrInfo.cpp | 10 +-- X86InstrMMX.td | 144 ++++++++++++++++++++++++++++++------------------------- 2 files changed, 85 insertions(+), 69 deletions(-) Index: llvm/lib/Target/X86/X86InstrInfo.cpp diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.81 llvm/lib/Target/X86/X86InstrInfo.cpp:1.82 --- llvm/lib/Target/X86/X86InstrInfo.cpp:1.81 Wed Mar 28 13:12:31 2007 +++ llvm/lib/Target/X86/X86InstrInfo.cpp Tue Apr 3 01:00:37 2007 @@ -38,7 +38,7 @@ oc == X86::MOVAPSrr || oc == X86::MOVAPDrr || oc == X86::MOVSS2PSrr || oc == X86::MOVSD2PDrr || oc == X86::MOVPS2SSrr || oc == X86::MOVPD2SDrr || - oc == X86::MOVD64rr || oc == X86::MOVQ64rr) { + oc == X86::MMX_MOVD64rr || oc == X86::MMX_MOVQ64rr) { assert(MI.getNumOperands() == 2 && MI.getOperand(0).isRegister() && MI.getOperand(1).isRegister() && @@ -65,8 +65,8 @@ case X86::MOVSDrm: case X86::MOVAPSrm: case X86::MOVAPDrm: - case X86::MOVD64rm: - case X86::MOVQ64rm: + case X86::MMX_MOVD64rm: + case X86::MMX_MOVQ64rm: if (MI->getOperand(1).isFrameIndex() && MI->getOperand(2).isImmediate() && MI->getOperand(3).isRegister() && MI->getOperand(4).isImmediate() && MI->getOperand(2).getImmedValue() == 1 && @@ -95,8 +95,8 @@ case X86::MOVSDmr: case X86::MOVAPSmr: case X86::MOVAPDmr: - case X86::MOVD64mr: - case X86::MOVQ64mr: + case X86::MMX_MOVD64mr: + case X86::MMX_MOVQ64mr: if (MI->getOperand(0).isFrameIndex() && MI->getOperand(1).isImmediate() && MI->getOperand(2).isRegister() && MI->getOperand(3).isImmediate() && MI->getOperand(1).getImmedValue() == 1 && Index: llvm/lib/Target/X86/X86InstrMMX.td diff -u llvm/lib/Target/X86/X86InstrMMX.td:1.28 llvm/lib/Target/X86/X86InstrMMX.td:1.29 --- llvm/lib/Target/X86/X86InstrMMX.td:1.28 Tue Mar 27 19:57:11 2007 +++ llvm/lib/Target/X86/X86InstrMMX.td Tue Apr 3 01:00:37 2007 @@ -118,10 +118,11 @@ } //===----------------------------------------------------------------------===// -// MMX EMMS Instruction +// MMX EMMS & FEMMS Instructions //===----------------------------------------------------------------------===// -def MMX_EMMS : MMXI<0x77, RawFrm, (ops), "emms", [(int_x86_mmx_emms)]>; +def MMX_EMMS : MMXI<0x77, RawFrm, (ops), "emms", [(int_x86_mmx_emms)]>; +def MMX_FEMMS : MMXI<0x0E, RawFrm, (ops), "femms", [(int_x86_mmx_femms)]>; //===----------------------------------------------------------------------===// // MMX Scalar Instructions @@ -130,9 +131,10 @@ // Arithmetic Instructions // -- Addition -defm MMX_PADDB : MMXI_binop_rm<0xFC, "paddb", add, v8i8, 1>; +defm MMX_PADDB : MMXI_binop_rm<0xFC, "paddb", add, v8i8, 1>; defm MMX_PADDW : MMXI_binop_rm<0xFD, "paddw", add, v4i16, 1>; defm MMX_PADDD : MMXI_binop_rm<0xFE, "paddd", add, v2i32, 1>; +defm MMX_PADDQ : MMXI_binop_rm<0xD4, "paddq", add, v1i64, 1>; defm MMX_PADDSB : MMXI_binop_rm_int<0xEC, "paddsb" , int_x86_mmx_padds_b, 1>; defm MMX_PADDSW : MMXI_binop_rm_int<0xED, "paddsw" , int_x86_mmx_padds_w, 1>; @@ -309,45 +311,52 @@ defm MMX_PACKUSWB : MMXI_binop_rm_int<0x67, "packuswb", int_x86_mmx_packuswb>; // Data Transfer Instructions -def MOVD64rr : MMXI<0x6E, MRMSrcReg, (ops VR64:$dst, GR32:$src), - "movd {$src, $dst|$dst, $src}", []>; -def MOVD64rm : MMXI<0x6E, MRMSrcMem, (ops VR64:$dst, i32mem:$src), - "movd {$src, $dst|$dst, $src}", []>; -def MOVD64mr : MMXI<0x7E, MRMDestMem, (ops i32mem:$dst, VR64:$src), - "movd {$src, $dst|$dst, $src}", []>; - -def MOVQ64rr : MMXI<0x6F, MRMSrcReg, (ops VR64:$dst, VR64:$src), - "movq {$src, $dst|$dst, $src}", []>; -def MOVQ64rm : MMXI<0x6F, MRMSrcMem, (ops VR64:$dst, i64mem:$src), - "movq {$src, $dst|$dst, $src}", - [(set VR64:$dst, (load_mmx addr:$src))]>; -def MOVQ64mr : MMXI<0x7F, MRMDestMem, (ops i64mem:$dst, VR64:$src), - "movq {$src, $dst|$dst, $src}", - [(store (v1i64 VR64:$src), addr:$dst)]>; +def MMX_MOVD64rr : MMXI<0x6E, MRMSrcReg, (ops VR64:$dst, GR32:$src), + "movd {$src, $dst|$dst, $src}", []>; +def MMX_MOVD64rm : MMXI<0x6E, MRMSrcMem, (ops VR64:$dst, i32mem:$src), + "movd {$src, $dst|$dst, $src}", []>; +def MMX_MOVD64mr : MMXI<0x7E, MRMDestMem, (ops i32mem:$dst, VR64:$src), + "movd {$src, $dst|$dst, $src}", []>; + +def MMX_MOVQ64rr : MMXI<0x6F, MRMSrcReg, (ops VR64:$dst, VR64:$src), + "movq {$src, $dst|$dst, $src}", []>; +def MMX_MOVQ64rm : MMXI<0x6F, MRMSrcMem, (ops VR64:$dst, i64mem:$src), + "movq {$src, $dst|$dst, $src}", + [(set VR64:$dst, (load_mmx addr:$src))]>; +def MMX_MOVQ64mr : MMXI<0x7F, MRMDestMem, (ops i64mem:$dst, VR64:$src), + "movq {$src, $dst|$dst, $src}", + [(store (v1i64 VR64:$src), addr:$dst)]>; // Conversion instructions -def CVTPI2PSrr : MMXI<0x2A, MRMSrcReg, (ops VR128:$dst, VR64:$src), - "cvtpi2ps {$src, $dst|$dst, $src}", []>; -def CVTPI2PSrm : MMXI<0x2A, MRMSrcMem, (ops VR128:$dst, i64mem:$src), - "cvtpi2ps {$src, $dst|$dst, $src}", []>; -def CVTPI2PDrr : MMX2I<0x2A, MRMSrcReg, (ops VR128:$dst, VR64:$src), - "cvtpi2pd {$src, $dst|$dst, $src}", []>; -def CVTPI2PDrm : MMX2I<0x2A, MRMSrcMem, (ops VR128:$dst, i64mem:$src), - "cvtpi2pd {$src, $dst|$dst, $src}", []>; -def CVTTPS2PIrr: I<0x2C, MRMSrcReg, (ops VR64:$dst, VR128:$src), - "cvttps2pi {$src, $dst|$dst, $src}", []>, TB, - Requires<[HasMMX]>; -def CVTTPS2PIrm: I<0x2C, MRMSrcMem, (ops VR64:$dst, f64mem:$src), - "cvttps2pi {$src, $dst|$dst, $src}", []>, TB, - Requires<[HasMMX]>; -def CVTPS2PIrr : MMXI<0x2D, MRMSrcReg, (ops VR64:$dst, VR128:$src), - "cvtps2pi {$src, $dst|$dst, $src}", []>; -def CVTPS2PIrm : MMXI<0x2D, MRMSrcMem, (ops VR64:$dst, f64mem:$src), - "cvtps2pi {$src, $dst|$dst, $src}", []>; -def CVTPD2PIrr : MMX2I<0x2D, MRMSrcReg, (ops VR64:$dst, VR128:$src), - "cvtpd2pi {$src, $dst|$dst, $src}", []>; -def CVTPD2PIrm : MMX2I<0x2D, MRMSrcMem, (ops VR64:$dst, f128mem:$src), - "cvtpd2pi {$src, $dst|$dst, $src}", []>; +def MMX_CVTPD2PIrr : MMX2I<0x2D, MRMSrcReg, (ops VR64:$dst, VR128:$src), + "cvtpd2pi {$src, $dst|$dst, $src}", []>; +def MMX_CVTPD2PIrm : MMX2I<0x2D, MRMSrcMem, (ops VR64:$dst, f128mem:$src), + "cvtpd2pi {$src, $dst|$dst, $src}", []>; + +def MMX_CVTPI2PDrr : MMX2I<0x2A, MRMSrcReg, (ops VR128:$dst, VR64:$src), + "cvtpi2pd {$src, $dst|$dst, $src}", []>; +def MMX_CVTPI2PDrm : MMX2I<0x2A, MRMSrcMem, (ops VR128:$dst, i64mem:$src), + "cvtpi2pd {$src, $dst|$dst, $src}", []>; + +def MMX_CVTPI2PSrr : MMXI<0x2A, MRMSrcReg, (ops VR128:$dst, VR64:$src), + "cvtpi2ps {$src, $dst|$dst, $src}", []>; +def MMX_CVTPI2PSrm : MMXI<0x2A, MRMSrcMem, (ops VR128:$dst, i64mem:$src), + "cvtpi2ps {$src, $dst|$dst, $src}", []>; + +def MMX_CVTPS2PIrr : MMXI<0x2D, MRMSrcReg, (ops VR64:$dst, VR128:$src), + "cvtps2pi {$src, $dst|$dst, $src}", []>; +def MMX_CVTPS2PIrm : MMXI<0x2D, MRMSrcMem, (ops VR64:$dst, f64mem:$src), + "cvtps2pi {$src, $dst|$dst, $src}", []>; + +def MMX_CVTTPD2PIrr: MMX2I<0x2C, MRMSrcReg, (ops VR64:$dst, VR128:$src), + "cvttpd2pi {$src, $dst|$dst, $src}", []>; +def MMX_CVTTPD2PIrm: MMX2I<0x2C, MRMSrcMem, (ops VR64:$dst, f128mem:$src), + "cvttpd2pi {$src, $dst|$dst, $src}", []>; + +def MMX_CVTTPS2PIrr: MMXI<0x2C, MRMSrcReg, (ops VR64:$dst, VR128:$src), + "cvttps2pi {$src, $dst|$dst, $src}", []>; +def MMX_CVTTPS2PIrm: MMXI<0x2C, MRMSrcMem, (ops VR64:$dst, f64mem:$src), + "cvttps2pi {$src, $dst|$dst, $src}", []>; // Shuffle and unpack instructions def PSHUFWri : MMXIi8<0x70, MRMSrcReg, @@ -387,11 +396,13 @@ // Store 64-bit integer vector values. def : Pat<(store (v8i8 VR64:$src), addr:$dst), - (MOVQ64mr addr:$dst, VR64:$src)>; + (MMX_MOVQ64mr addr:$dst, VR64:$src)>; def : Pat<(store (v4i16 VR64:$src), addr:$dst), - (MOVQ64mr addr:$dst, VR64:$src)>; + (MMX_MOVQ64mr addr:$dst, VR64:$src)>; def : Pat<(store (v2i32 VR64:$src), addr:$dst), - (MOVQ64mr addr:$dst, VR64:$src)>; + (MMX_MOVQ64mr addr:$dst, VR64:$src)>; +def : Pat<(store (v1i64 VR64:$src), addr:$dst), + (MMX_MOVQ64mr addr:$dst, VR64:$src)>; // 64-bit vector all zero's. def : Pat<(v8i8 immAllZerosV), (MMX_V_SET0)>; @@ -419,34 +430,39 @@ def : Pat<(v1i64 (bitconvert (v4i16 VR64:$src))), (v1i64 VR64:$src)>; def : Pat<(v1i64 (bitconvert (v8i8 VR64:$src))), (v1i64 VR64:$src)>; -// Splat v1i64 -// MMX_SHUFFLE_get_shuf_imm xform function: convert vector_shuffle mask to -// MMX_PSHUF*, MMX_SHUFP* etc. imm. -def MMX_SHUFFLE_get_shuf_imm : SDNodeXForm; +def MMX_X86s2vec : SDNode<"X86ISD::S2VEC", SDTypeProfile<1, 1, []>, []>; + +// Scalar to v4i16 / v8i8. The source may be a GR32, but only the lower 8 or +// 16-bits matter. +def : Pat<(v8i8 (MMX_X86s2vec GR32:$src)), (MMX_MOVD64rr GR32:$src)>; +def : Pat<(v4i16 (MMX_X86s2vec GR32:$src)), (MMX_MOVD64rr GR32:$src)>; -def MMX_splat_mask : PatLeaf<(build_vector), [{ - return X86::isSplatMask(N); -}], MMX_SHUFFLE_get_shuf_imm>; +// Recipes for: vector_shuffle v1, , <0, 0, 1, 1, ...> +def MMX_UNPCKL_v_undef_shuffle_mask : PatLeaf<(build_vector), [{ + return X86::isUNPCKL_v_undef_Mask(N); +}]>; let AddedComplexity = 10 in { - def : Pat<(vector_shuffle (v1i64 VR64:$src), (undef), - MMX_splat_mask:$sm), - (MMX_PUNPCKHDQrr VR64:$src, VR64:$src)>; - def : Pat<(vector_shuffle (v1i64 VR64:$src), (undef), - MMX_UNPCKH_shuffle_mask:$sm), - (MMX_PUNPCKHDQrr VR64:$src, VR64:$src)>; + def : Pat<(v8i8 (vector_shuffle VR64:$src, (undef), + MMX_UNPCKL_v_undef_shuffle_mask)), + (MMX_PUNPCKLBWrr VR64:$src, VR64:$src)>; + def : Pat<(v4i16 (vector_shuffle VR64:$src, (undef), + MMX_UNPCKL_v_undef_shuffle_mask)), + (MMX_PUNPCKLWDrr VR64:$src, VR64:$src)>; + def : Pat<(v2i32 (vector_shuffle VR64:$src, (undef), + MMX_UNPCKL_v_undef_shuffle_mask)), + (MMX_PUNPCKLDQrr VR64:$src, VR64:$src)>; } -def MMX_X86s2vec : SDNode<"X86ISD::S2VEC", SDTypeProfile<1, 1, []>, []>; - -// Scalar to v4i16 / v8i8. The source may be a GR32, but only the lower 8 or -// 16-bits matter. -def : Pat<(v8i8 (MMX_X86s2vec GR32:$src)), (MOVD64rr GR32:$src)>; -def : Pat<(v4i16 (MMX_X86s2vec GR32:$src)), (MOVD64rr GR32:$src)>; +let AddedComplexity = 20 in { + def : Pat<(bc_v2i32 (vector_shuffle immAllZerosV, + (v2i32 (scalar_to_vector (load_mmx addr:$src))), + MMX_UNPCKL_shuffle_mask)), + (MMX_PUNPCKLDQrm VR64:$src, VR64:$src)>; +} // Some special case PANDN patterns. +// FIXME: Get rid of these. def : Pat<(v1i64 (and (xor VR64:$src1, (bc_v1i64 (v2i32 immAllOnesV))), VR64:$src2)), (MMX_PANDNrr VR64:$src1, VR64:$src2)>; From isanbard at gmail.com Tue Apr 3 01:00:56 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 3 Apr 2007 01:00:56 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/IntrinsicsX86.td Message-ID: <200704030600.l3360ueJ005776@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: IntrinsicsX86.td updated: 1.40 -> 1.41 --- Log message: Add FEMMS and ADDQ. Renamed MMX recipes to prepend the MMX_ to them. --- Diffs of the changes: (+3 -1) IntrinsicsX86.td | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/include/llvm/IntrinsicsX86.td diff -u llvm/include/llvm/IntrinsicsX86.td:1.40 llvm/include/llvm/IntrinsicsX86.td:1.41 --- llvm/include/llvm/IntrinsicsX86.td:1.40 Tue Mar 27 15:21:31 2007 +++ llvm/include/llvm/IntrinsicsX86.td Tue Apr 3 01:00:36 2007 @@ -541,7 +541,9 @@ // Empty MMX state op. let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". - def int_x86_mmx_emms : GCCBuiltin<"__builtin_ia32_emms">, + def int_x86_mmx_emms : GCCBuiltin<"__builtin_ia32_emms">, + Intrinsic<[llvm_void_ty], [IntrWriteMem]>; + def int_x86_mmx_femms : GCCBuiltin<"__builtin_ia32_femms">, Intrinsic<[llvm_void_ty], [IntrWriteMem]>; } From bwendlin at apple.com Tue Apr 3 01:12:18 2007 From: bwendlin at apple.com (bwendlin at apple.com) Date: Mon, 2 Apr 2007 23:12:18 -0700 (PDT) Subject: [llvm-commits] [125666] Add support for the PADDQ builtin. Message-ID: <20070403061218.A2AE2CC2E950@src> Revision: 125666 Author: bwendlin Date: 2007-04-02 23:12:17 -0700 (Mon, 02 Apr 2007) Log Message: ----------- Add support for the PADDQ builtin. Modified Paths: -------------- apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp Modified: apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp =================================================================== --- apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp 2007-04-03 03:01:10 UTC (rev 125665) +++ apple-local/branches/llvm/gcc/config/i386/llvm-i386.cpp 2007-04-03 06:12:17 UTC (rev 125666) @@ -34,7 +34,9 @@ #include "toplev.h" } -/* TargetIntrinsicCastResult - This function just provides a frequently * used sequence for use inside TargetIntrinsicLower. */ +/* TargetIntrinsicCastResult - This function just provides a frequently used + * sequence for use inside TargetIntrinsicLower. + */ static void TargetIntrinsicCastResult(Value *&Result, const Type *ResultType, bool ResIsSigned, bool ExpIsSigned, BasicBlock *CurBB) { @@ -43,14 +45,16 @@ Result = CastInst::create(opcode, Result, ResultType, "tmp", CurBB); } -/* IntrinsicOpIsSigned - This function determines if a given operand * to the intrinsic is signed or not. */ +/* IntrinsicOpIsSigned - This function determines if a given operand to the + * intrinsic is signed or not. + */ static bool IntrinsicOpIsSigned(SmallVector &Args, unsigned OpNum) { return !TYPE_UNSIGNED(TREE_TYPE(Args[OpNum])); } -/* TargetIntrinsicLower - For builtins that we want to expand to normal - * LLVM code, emit the code now. If we can handle the code, this macro should - * emit the code, return true. +/* TargetIntrinsicLower - For builtins that we want to expand to normal LLVM + * code, emit the code now. If we can handle the code, this macro should emit + * the code, return true. */ bool TreeToLLVM::TargetIntrinsicLower(tree exp, unsigned FnCode, @@ -69,6 +73,7 @@ case IX86_BUILTIN_PADDB: case IX86_BUILTIN_PADDW: case IX86_BUILTIN_PADDD: + case IX86_BUILTIN_PADDQ: case IX86_BUILTIN_PADDB128: case IX86_BUILTIN_PADDW128: case IX86_BUILTIN_PADDD128: From isanbard at gmail.com Tue Apr 3 01:18:49 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 3 Apr 2007 01:18:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200704030618.l336In0u006111@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86RegisterInfo.cpp updated: 1.208 -> 1.209 --- Log message: Changed to new MMX_ recipes. --- Diffs of the changes: (+3 -3) X86RegisterInfo.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.208 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.209 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.208 Tue Mar 20 03:09:38 2007 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Tue Apr 3 01:18:31 2007 @@ -90,7 +90,7 @@ } else if (RC == &X86::VR128RegClass) { Opc = X86::MOVAPSmr; } else if (RC == &X86::VR64RegClass) { - Opc = X86::MOVQ64mr; + Opc = X86::MMX_MOVQ64mr; } else { assert(0 && "Unknown regclass"); abort(); @@ -125,7 +125,7 @@ } else if (RC == &X86::VR128RegClass) { Opc = X86::MOVAPSrm; } else if (RC == &X86::VR64RegClass) { - Opc = X86::MOVQ64rm; + Opc = X86::MMX_MOVQ64rm; } else { assert(0 && "Unknown regclass"); abort(); @@ -159,7 +159,7 @@ } else if (RC == &X86::VR128RegClass) { Opc = X86::MOVAPSrr; } else if (RC == &X86::VR64RegClass) { - Opc = X86::MOVQ64rr; + Opc = X86::MMX_MOVQ64rr; } else { assert(0 && "Unknown regclass"); abort(); From wendling at apple.com Tue Apr 3 01:34:40 2007 From: wendling at apple.com (Bill Wendling) Date: Mon, 2 Apr 2007 23:34:40 -0700 Subject: [llvm-commits] eh_arm.cc Message-ID: I'm getting this error during llvm-gcc compilation: make[3]: *** No rule to make target `eh_arm.cc', needed by `eh_arm.lo'. Stop. make[3]: *** Waiting for unfinished jobs.... -bw From evan.cheng at apple.com Tue Apr 3 01:43:46 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 3 Apr 2007 01:43:46 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/RegisterScavenging.cpp Message-ID: <200704030643.l336hkHH006770@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: RegisterScavenging.cpp updated: 1.14 -> 1.15 --- Log message: Bad bad bug. findRegisterUseOperand() returns -1 if a use if not found. --- Diffs of the changes: (+1 -1) RegisterScavenging.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/RegisterScavenging.cpp diff -u llvm/lib/CodeGen/RegisterScavenging.cpp:1.14 llvm/lib/CodeGen/RegisterScavenging.cpp:1.15 --- llvm/lib/CodeGen/RegisterScavenging.cpp:1.14 Mon Mar 26 17:23:54 2007 +++ llvm/lib/CodeGen/RegisterScavenging.cpp Tue Apr 3 01:43:29 2007 @@ -235,7 +235,7 @@ I = next(I); while (I != MBB->end()) { Dist++; - if (I->findRegisterUseOperand(Reg)) + if (I->findRegisterUseOperand(Reg) != -1) return Dist; I = next(I); } From evan.cheng at apple.com Tue Apr 3 01:44:42 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 3 Apr 2007 01:44:42 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrInfo.cpp Message-ID: <200704030644.l336igMk006806@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.cpp updated: 1.18 -> 1.19 --- Log message: Inverted logic. --- Diffs of the changes: (+1 -1) ARMInstrInfo.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/ARM/ARMInstrInfo.cpp diff -u llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.18 llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.19 --- llvm/lib/Target/ARM/ARMInstrInfo.cpp:1.18 Mon Mar 26 17:41:48 2007 +++ llvm/lib/Target/ARM/ARMInstrInfo.cpp Tue Apr 3 01:44:25 2007 @@ -279,7 +279,7 @@ // Look at the two new MI's in reverse order. MachineInstr *NewMI = NewMIs[j]; int NIdx = NewMI->findRegisterUseOperand(Reg); - if (NIdx != -1) + if (NIdx == -1) continue; LV.addVirtualRegisterKilled(Reg, NewMI); if (VI.removeKill(MI)) From dpatel at apple.com Tue Apr 3 02:16:35 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 3 Apr 2007 00:16:35 -0700 Subject: [llvm-commits] eh_arm.cc In-Reply-To: References: Message-ID: <124DED6F-23CB-4938-93CF-08D897B23F26@apple.com> On Apr 2, 2007, at 11:34 PM, Bill Wendling wrote: > I'm getting this error during llvm-gcc compilation: > > make[3]: *** No rule to make target `eh_arm.cc', needed by > `eh_arm.lo'. Stop. > make[3]: *** Waiting for unfinished jobs.... This is related to Lauro Ramos Venancio's patch Dale committed. - Devang From reid at x10sys.com Tue Apr 3 02:19:13 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 02:19:13 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704030719.l337JD6O014295@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.30 -> 1.31 --- Log message: Add Evan Cheng. --- Diffs of the changes: (+4 -3) DevMtgMay2007.html | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.30 llvm-www/DevMtgMay2007.html:1.31 --- llvm-www/DevMtgMay2007.html:1.30 Mon Apr 2 14:14:17 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 02:17:54 2007 @@ -228,6 +228,7 @@ + @@ -241,8 +242,8 @@
      NameDescription
      byebyeContains just the old lib/Analysis/DataStructure stuff. It is inappropriately named and definitely not needed
      jtcAssuming this is John Criswell's tag and he wants + it
      jtcllvaAssuming this is the LLVA tag
      LLVM_PRE111This is a pre-release tag to go with a branch we're planning to remove.
      new_merge_vectorAppears to be a merging tag. Pretty sure its unneeded at this point
      PowerPC_0_0Root of a branch we're deleting
      PowerPC_0_0Required by PowerPC_0 branch
      PARALLEL_ROOTRoot of the parallel branch
      PRE10Root of a branch we're deleting
      PRE101Root of a branch we're deleting
      Vikram AdveUIUC
      Owen AndersonIndependent
      Ryan BrownGoogle
      Evan ChengApple, Inc.
      Jeff CohenIndependent
      Robert HundtGoogle
      Christopher LambAgeia Technologies, Inc.
      Bill WendlingApple, Inc.
      Marcel WeiherMetaObject
      -

      Total confirmed attendees: 19

      -

      Possible additional attendees: 6

      +

      Total confirmed attendees: 20

      +

      Possible additional attendeew: 5

      @@ -252,6 +253,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2007/04/02 19:14:17 $ +
      Last modified: $Date: 2007/04/03 07:17:54 $ From reid at x10sys.com Tue Apr 3 02:43:44 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 02:43:44 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704030743.l337hiDO017050@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.31 -> 1.32 --- Log message: Portray the confirmed/unconfirmed attendees more accurately. --- Diffs of the changes: (+14 -6) DevMtgMay2007.html | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.31 llvm-www/DevMtgMay2007.html:1.32 --- llvm-www/DevMtgMay2007.html:1.31 Tue Apr 3 02:17:54 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 02:43:27 2007 @@ -224,6 +224,7 @@

      The table below lists the confirmed attendees for the meeting.

      + @@ -234,16 +235,23 @@ - + - + - + + + + + + + +
      Confirmed Attendees
      NameOrganization
      Vikram AdveUIUC
      Owen AndersonIndependent
      Christopher LambAgeia Technologies, Inc.
      Chris LattnerApple, Inc.
      Nick LewyckyIndependent
      Scott Michel + 2Aerospace
      Scott MichelAerospace
      Devang PatelApple, Inc.
      Mark Schimmel + 1Wind River
      Mark SchimmelWind River
      Reid SpencerIndependent
      Sarah Thompson + 1NASA, Ames Research Center
      Sarah ThompsonNASA, Ames Research Center
      Bill WendlingApple, Inc.
      Marcel WeiherMetaObject
      Unconfirmed Attendees
      NameOrganization
      Unconfirmed 3Adobe
      Unconfirmed 2+Apple
      Unconfirmed 2Aerospace
      Unconfirmed 1Wind River
      Unconfirmed 1NASA, Ames
      -

      Total confirmed attendees: 20

      -

      Possible additional attendeew: 5

      +

      Total confirmed attendees: 16

      +

      Possible additional attendeew: 9

      @@ -253,6 +261,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2007/04/03 07:17:54 $ +
      Last modified: $Date: 2007/04/03 07:43:27 $ From reid at x10sys.com Tue Apr 3 02:54:12 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 02:54:12 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704030754.l337sCZE017304@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.32 -> 1.33 --- Log message: Fix typo. --- Diffs of the changes: (+2 -2) DevMtgMay2007.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.32 llvm-www/DevMtgMay2007.html:1.33 --- llvm-www/DevMtgMay2007.html:1.32 Tue Apr 3 02:43:27 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 02:53:55 2007 @@ -251,7 +251,7 @@ Unconfirmed 1NASA, Ames

      Total confirmed attendees: 16

      -

      Possible additional attendeew: 9

      +

      Possible additional attendees: 9

      @@ -261,6 +261,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2007/04/03 07:43:27 $ +
      Last modified: $Date: 2007/04/03 07:53:55 $ From reid at x10sys.com Tue Apr 3 02:56:44 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 02:56:44 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704030756.l337uioZ017414@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.33 -> 1.34 --- Log message: Put the actual date in the title. --- Diffs of the changes: (+2 -2) DevMtgMay2007.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.33 llvm-www/DevMtgMay2007.html:1.34 --- llvm-www/DevMtgMay2007.html:1.33 Tue Apr 3 02:53:55 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 02:56:27 2007 @@ -1,5 +1,5 @@ -
      May 2007 LLVM Developers Meeting
      +
      May 25, 2007
      LLVM Developers' Meeting
      1. Summary
      2. Agenda @@ -261,6 +261,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
        Last modified: $Date: 2007/04/03 07:53:55 $ +
        Last modified: $Date: 2007/04/03 07:56:27 $ From evan.cheng at apple.com Tue Apr 3 03:12:08 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 3 Apr 2007 03:12:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704030812.l338C85l017774@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.725 -> 1.726 --- Log message: Reverting back to 1.723. The last two commits broke JM (and possibily others) on ARM. --- Diffs of the changes: (+491 -524) InstructionCombining.cpp | 1015 ++++++++++++++++++++++------------------------- 1 files changed, 491 insertions(+), 524 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.725 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.726 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.725 Mon Apr 2 23:46:52 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Apr 3 03:11:50 2007 @@ -183,9 +183,6 @@ Instruction *visitFCmpInst(FCmpInst &I); Instruction *visitICmpInst(ICmpInst &I); Instruction *visitICmpInstWithCastAndCast(ICmpInst &ICI); - Instruction *visitICmpInstWithInstAndIntCst(ICmpInst &ICI, - Instruction *LHS, - ConstantInt *RHS); Instruction *FoldGEPICmp(User *GEPLHS, Value *RHS, ICmpInst::Predicate Cond, Instruction &I); @@ -4716,11 +4713,496 @@ // instruction, see if that instruction also has constants so that the // instruction can be folded into the icmp if (Instruction *LHSI = dyn_cast(Op0)) - if (Instruction *Res = visitICmpInstWithInstAndIntCst(I, LHSI, CI)) - return Res; + switch (LHSI->getOpcode()) { + case Instruction::And: + if (LHSI->hasOneUse() && isa(LHSI->getOperand(1)) && + LHSI->getOperand(0)->hasOneUse()) { + ConstantInt *AndCST = cast(LHSI->getOperand(1)); + + // If the LHS is an AND of a truncating cast, we can widen the + // and/compare to be the input width without changing the value + // produced, eliminating a cast. + if (CastInst *Cast = dyn_cast(LHSI->getOperand(0))) { + // We can do this transformation if either the AND constant does not + // have its sign bit set or if it is an equality comparison. + // Extending a relational comparison when we're checking the sign + // bit would not work. + if (Cast->hasOneUse() && isa(Cast) && + (I.isEquality() || AndCST->getValue().isPositive() && + CI->getValue().isPositive())) { + ConstantInt *NewCST; + ConstantInt *NewCI; + APInt NewCSTVal(AndCST->getValue()), NewCIVal(CI->getValue()); + uint32_t BitWidth = cast( + Cast->getOperand(0)->getType())->getBitWidth(); + NewCST = ConstantInt::get(NewCSTVal.zext(BitWidth)); + NewCI = ConstantInt::get(NewCIVal.zext(BitWidth)); + Instruction *NewAnd = + BinaryOperator::createAnd(Cast->getOperand(0), NewCST, + LHSI->getName()); + InsertNewInstBefore(NewAnd, I); + return new ICmpInst(I.getPredicate(), NewAnd, NewCI); + } + } + + // If this is: (X >> C1) & C2 != C3 (where any shift and any compare + // could exist), turn it into (X & (C2 << C1)) != (C3 << C1). This + // happens a LOT in code produced by the C front-end, for bitfield + // access. + BinaryOperator *Shift = dyn_cast(LHSI->getOperand(0)); + if (Shift && !Shift->isShift()) + Shift = 0; + + ConstantInt *ShAmt; + ShAmt = Shift ? dyn_cast(Shift->getOperand(1)) : 0; + const Type *Ty = Shift ? Shift->getType() : 0; // Type of the shift. + const Type *AndTy = AndCST->getType(); // Type of the and. + + // We can fold this as long as we can't shift unknown bits + // into the mask. This can only happen with signed shift + // rights, as they sign-extend. + if (ShAmt) { + bool CanFold = Shift->isLogicalShift(); + if (!CanFold) { + // To test for the bad case of the signed shr, see if any + // of the bits shifted in could be tested after the mask. + uint32_t TyBits = Ty->getPrimitiveSizeInBits(); + int ShAmtVal = TyBits - ShAmt->getLimitedValue(TyBits); + + uint32_t BitWidth = AndTy->getPrimitiveSizeInBits(); + if ((APInt::getHighBitsSet(BitWidth, BitWidth-ShAmtVal) & + AndCST->getValue()) == 0) + CanFold = true; + } + + if (CanFold) { + Constant *NewCst; + if (Shift->getOpcode() == Instruction::Shl) + NewCst = ConstantExpr::getLShr(CI, ShAmt); + else + NewCst = ConstantExpr::getShl(CI, ShAmt); + + // Check to see if we are shifting out any of the bits being + // compared. + if (ConstantExpr::get(Shift->getOpcode(), NewCst, ShAmt) != CI){ + // If we shifted bits out, the fold is not going to work out. + // As a special case, check to see if this means that the + // result is always true or false now. + if (I.getPredicate() == ICmpInst::ICMP_EQ) + return ReplaceInstUsesWith(I, ConstantInt::getFalse()); + if (I.getPredicate() == ICmpInst::ICMP_NE) + return ReplaceInstUsesWith(I, ConstantInt::getTrue()); + } else { + I.setOperand(1, NewCst); + Constant *NewAndCST; + if (Shift->getOpcode() == Instruction::Shl) + NewAndCST = ConstantExpr::getLShr(AndCST, ShAmt); + else + NewAndCST = ConstantExpr::getShl(AndCST, ShAmt); + LHSI->setOperand(1, NewAndCST); + LHSI->setOperand(0, Shift->getOperand(0)); + AddToWorkList(Shift); // Shift is dead. + AddUsesToWorkList(I); + return &I; + } + } + } + + // Turn ((X >> Y) & C) == 0 into (X & (C << Y)) == 0. The later is + // preferable because it allows the C<hasOneUse() && CI->isNullValue() && + I.isEquality() && !Shift->isArithmeticShift() && + isa(Shift->getOperand(0))) { + // Compute C << Y. + Value *NS; + if (Shift->getOpcode() == Instruction::LShr) { + NS = BinaryOperator::createShl(AndCST, + Shift->getOperand(1), "tmp"); + } else { + // Insert a logical shift. + NS = BinaryOperator::createLShr(AndCST, + Shift->getOperand(1), "tmp"); + } + InsertNewInstBefore(cast(NS), I); + + // Compute X & (C << Y). + Instruction *NewAnd = BinaryOperator::createAnd( + Shift->getOperand(0), NS, LHSI->getName()); + InsertNewInstBefore(NewAnd, I); + + I.setOperand(0, NewAnd); + return &I; + } + } + break; + + case Instruction::Shl: // (icmp pred (shl X, ShAmt), CI) + if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { + if (I.isEquality()) { + uint32_t TypeBits = CI->getType()->getPrimitiveSizeInBits(); + + // Check that the shift amount is in range. If not, don't perform + // undefined shifts. When the shift is visited it will be + // simplified. + if (ShAmt->uge(TypeBits)) + break; + + // If we are comparing against bits always shifted out, the + // comparison cannot succeed. + Constant *Comp = + ConstantExpr::getShl(ConstantExpr::getLShr(CI, ShAmt), ShAmt); + if (Comp != CI) {// Comparing against a bit that we know is zero. + bool IsICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; + Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); + return ReplaceInstUsesWith(I, Cst); + } + + if (LHSI->hasOneUse()) { + // Otherwise strength reduce the shift into an and. + uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); + Constant *Mask = ConstantInt::get( + APInt::getLowBitsSet(TypeBits, TypeBits-ShAmtVal)); + + Instruction *AndI = + BinaryOperator::createAnd(LHSI->getOperand(0), + Mask, LHSI->getName()+".mask"); + Value *And = InsertNewInstBefore(AndI, I); + return new ICmpInst(I.getPredicate(), And, + ConstantExpr::getLShr(CI, ShAmt)); + } + } + } + break; + + case Instruction::LShr: // (icmp pred (shr X, ShAmt), CI) + case Instruction::AShr: + if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { + if (I.isEquality()) { + // Check that the shift amount is in range. If not, don't perform + // undefined shifts. When the shift is visited it will be + // simplified. + uint32_t TypeBits = CI->getType()->getPrimitiveSizeInBits(); + if (ShAmt->uge(TypeBits)) + break; + + // If we are comparing against bits always shifted out, the + // comparison cannot succeed. + Constant *Comp; + if (LHSI->getOpcode() == Instruction::LShr) + Comp = ConstantExpr::getLShr(ConstantExpr::getShl(CI, ShAmt), + ShAmt); + else + Comp = ConstantExpr::getAShr(ConstantExpr::getShl(CI, ShAmt), + ShAmt); + + if (Comp != CI) {// Comparing against a bit that we know is zero. + bool IsICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; + Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); + return ReplaceInstUsesWith(I, Cst); + } + + if (LHSI->hasOneUse() || CI->isNullValue()) { + uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); + + // Otherwise strength reduce the shift into an and. + APInt Val(APInt::getHighBitsSet(TypeBits, TypeBits - ShAmtVal)); + Constant *Mask = ConstantInt::get(Val); + + Instruction *AndI = + BinaryOperator::createAnd(LHSI->getOperand(0), + Mask, LHSI->getName()+".mask"); + Value *And = InsertNewInstBefore(AndI, I); + return new ICmpInst(I.getPredicate(), And, + ConstantExpr::getShl(CI, ShAmt)); + } + } + } + break; + + case Instruction::SDiv: + case Instruction::UDiv: + // Fold: icmp pred ([us]div X, C1), C2 -> range test + // Fold this div into the comparison, producing a range check. + // Determine, based on the divide type, what the range is being + // checked. If there is an overflow on the low or high side, remember + // it, otherwise compute the range [low, hi) bounding the new value. + // See: InsertRangeTest above for the kinds of replacements possible. + if (ConstantInt *DivRHS = dyn_cast(LHSI->getOperand(1))) { + // FIXME: If the operand types don't match the type of the divide + // then don't attempt this transform. The code below doesn't have the + // logic to deal with a signed divide and an unsigned compare (and + // vice versa). This is because (x /s C1) getOpcode() == Instruction::SDiv; + if (!I.isEquality() && DivIsSigned != I.isSignedPredicate()) + break; + if (DivRHS->isZero()) + break; // Don't hack on div by zero + + // Initialize the variables that will indicate the nature of the + // range check. + bool LoOverflow = false, HiOverflow = false; + ConstantInt *LoBound = 0, *HiBound = 0; + + // Compute Prod = CI * DivRHS. We are essentially solving an equation + // of form X/C1=C2. We solve for X by multiplying C1 (DivRHS) and + // C2 (CI). By solving for X we can turn this into a range check + // instead of computing a divide. + ConstantInt *Prod = Multiply(CI, DivRHS); + + // Determine if the product overflows by seeing if the product is + // not equal to the divide. Make sure we do the same kind of divide + // as in the LHS instruction that we're folding. + bool ProdOV = (DivIsSigned ? ConstantExpr::getSDiv(Prod, DivRHS) : + ConstantExpr::getUDiv(Prod, DivRHS)) != CI; + + // Get the ICmp opcode + ICmpInst::Predicate predicate = I.getPredicate(); + + if (!DivIsSigned) { // udiv + LoBound = Prod; + LoOverflow = ProdOV; + HiOverflow = ProdOV || + AddWithOverflow(HiBound, LoBound, DivRHS, false); + } else if (DivRHS->getValue().isPositive()) { // Divisor is > 0. + if (CI->isNullValue()) { // (X / pos) op 0 + // Can't overflow. + LoBound = cast(ConstantExpr::getNeg(SubOne(DivRHS))); + HiBound = DivRHS; + } else if (CI->getValue().isPositive()) { // (X / pos) op pos + LoBound = Prod; + LoOverflow = ProdOV; + HiOverflow = ProdOV || + AddWithOverflow(HiBound, Prod, DivRHS, true); + } else { // (X / pos) op neg + Constant *DivRHSH = ConstantExpr::getNeg(SubOne(DivRHS)); + LoOverflow = AddWithOverflow(LoBound, Prod, + cast(DivRHSH), true); + HiBound = AddOne(Prod); + HiOverflow = ProdOV; + } + } else { // Divisor is < 0. + if (CI->isNullValue()) { // (X / neg) op 0 + LoBound = AddOne(DivRHS); + HiBound = cast(ConstantExpr::getNeg(DivRHS)); + if (HiBound == DivRHS) + LoBound = 0; // - INTMIN = INTMIN + } else if (CI->getValue().isPositive()) { // (X / neg) op pos + HiOverflow = LoOverflow = ProdOV; + if (!LoOverflow) + LoOverflow = AddWithOverflow(LoBound, Prod, AddOne(DivRHS), + true); + HiBound = AddOne(Prod); + } else { // (X / neg) op neg + LoBound = Prod; + LoOverflow = HiOverflow = ProdOV; + HiBound = Subtract(Prod, DivRHS); + } + + // Dividing by a negate swaps the condition. + predicate = ICmpInst::getSwappedPredicate(predicate); + } + + if (LoBound) { + Value *X = LHSI->getOperand(0); + switch (predicate) { + default: assert(0 && "Unhandled icmp opcode!"); + case ICmpInst::ICMP_EQ: + if (LoOverflow && HiOverflow) + return ReplaceInstUsesWith(I, ConstantInt::getFalse()); + else if (HiOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : + ICmpInst::ICMP_UGE, X, LoBound); + else if (LoOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : + ICmpInst::ICMP_ULT, X, HiBound); + else + return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, + true, I); + case ICmpInst::ICMP_NE: + if (LoOverflow && HiOverflow) + return ReplaceInstUsesWith(I, ConstantInt::getTrue()); + else if (HiOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : + ICmpInst::ICMP_ULT, X, LoBound); + else if (LoOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : + ICmpInst::ICMP_UGE, X, HiBound); + else + return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, + false, I); + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + if (LoOverflow) + return ReplaceInstUsesWith(I, ConstantInt::getFalse()); + return new ICmpInst(predicate, X, LoBound); + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + if (HiOverflow) + return ReplaceInstUsesWith(I, ConstantInt::getFalse()); + if (predicate == ICmpInst::ICMP_UGT) + return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound); + else + return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound); + } + } + } + break; + } + + // Simplify icmp_eq and icmp_ne instructions with integer constant RHS. + if (I.isEquality()) { + bool isICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; + + // If the first operand is (add|sub|and|or|xor|rem) with a constant, and + // the second operand is a constant, simplify a bit. + if (BinaryOperator *BO = dyn_cast(Op0)) { + switch (BO->getOpcode()) { + case Instruction::SRem: + // If we have a signed (X % (2^c)) == 0, turn it into an unsigned one. + if (CI->isZero() && isa(BO->getOperand(1)) && + BO->hasOneUse()) { + const APInt& V = cast(BO->getOperand(1))->getValue(); + if (V.sgt(APInt(V.getBitWidth(), 1)) && V.isPowerOf2()) { + Value *NewRem = InsertNewInstBefore(BinaryOperator::createURem( + BO->getOperand(0), BO->getOperand(1), BO->getName()), I); + return new ICmpInst(I.getPredicate(), NewRem, + Constant::getNullValue(BO->getType())); + } + } + break; + case Instruction::Add: + // Replace ((add A, B) != C) with (A != C-B) if B & C are constants. + if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { + if (BO->hasOneUse()) + return new ICmpInst(I.getPredicate(), BO->getOperand(0), + Subtract(CI, BOp1C)); + } else if (CI->isNullValue()) { + // Replace ((add A, B) != 0) with (A != -B) if A or B is + // efficiently invertible, or if the add has just this one use. + Value *BOp0 = BO->getOperand(0), *BOp1 = BO->getOperand(1); + + if (Value *NegVal = dyn_castNegVal(BOp1)) + return new ICmpInst(I.getPredicate(), BOp0, NegVal); + else if (Value *NegVal = dyn_castNegVal(BOp0)) + return new ICmpInst(I.getPredicate(), NegVal, BOp1); + else if (BO->hasOneUse()) { + Instruction *Neg = BinaryOperator::createNeg(BOp1); + InsertNewInstBefore(Neg, I); + Neg->takeName(BO); + return new ICmpInst(I.getPredicate(), BOp0, Neg); + } + } + break; + case Instruction::Xor: + // For the xor case, we can xor two constants together, eliminating + // the explicit xor. + if (Constant *BOC = dyn_cast(BO->getOperand(1))) + return new ICmpInst(I.getPredicate(), BO->getOperand(0), + ConstantExpr::getXor(CI, BOC)); + + // FALLTHROUGH + case Instruction::Sub: + // Replace (([sub|xor] A, B) != 0) with (A != B) + if (CI->isZero()) + return new ICmpInst(I.getPredicate(), BO->getOperand(0), + BO->getOperand(1)); + break; + + case Instruction::Or: + // If bits are being or'd in that are not present in the constant we + // are comparing against, then the comparison could never succeed! + if (Constant *BOC = dyn_cast(BO->getOperand(1))) { + Constant *NotCI = ConstantExpr::getNot(CI); + if (!ConstantExpr::getAnd(BOC, NotCI)->isNullValue()) + return ReplaceInstUsesWith(I, ConstantInt::get(Type::Int1Ty, + isICMP_NE)); + } + break; + + case Instruction::And: + if (ConstantInt *BOC = dyn_cast(BO->getOperand(1))) { + // If bits are being compared against that are and'd out, then the + // comparison can never succeed! + if (!And(CI, ConstantInt::get(~BOC->getValue()))->isZero()) + return ReplaceInstUsesWith(I, ConstantInt::get(Type::Int1Ty, + isICMP_NE)); + + // If we have ((X & C) == C), turn it into ((X & C) != 0). + if (CI == BOC && isOneBitSet(CI)) + return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : + ICmpInst::ICMP_NE, Op0, + Constant::getNullValue(CI->getType())); + + // Replace (and X, (1 << size(X)-1) != 0) with x s< 0 + if (isSignBit(BOC)) { + Value *X = BO->getOperand(0); + Constant *Zero = Constant::getNullValue(X->getType()); + ICmpInst::Predicate pred = isICMP_NE ? + ICmpInst::ICMP_SLT : ICmpInst::ICMP_SGE; + return new ICmpInst(pred, X, Zero); + } + + // ((X & ~7) == 0) --> X < 8 + if (CI->isNullValue() && isHighOnes(BOC)) { + Value *X = BO->getOperand(0); + Constant *NegX = ConstantExpr::getNeg(BOC); + ICmpInst::Predicate pred = isICMP_NE ? + ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT; + return new ICmpInst(pred, X, NegX); + } + + } + default: break; + } + } else if (IntrinsicInst *II = dyn_cast(Op0)) { + // Handle icmp {eq|ne} , intcst. + if (II->getIntrinsicID() == Intrinsic::bswap) { + AddToWorkList(II); + I.setOperand(0, II->getOperand(1)); + I.setOperand(1, ConstantInt::get(CI->getValue().byteSwap())); + return &I; + } + } + } else { // Not a ICMP_EQ/ICMP_NE + // If the LHS is a cast from an integral value of the same size, then + // since we know the RHS is a constant, try to simlify. + if (CastInst *Cast = dyn_cast(Op0)) { + Value *CastOp = Cast->getOperand(0); + const Type *SrcTy = CastOp->getType(); + uint32_t SrcTySize = SrcTy->getPrimitiveSizeInBits(); + if (SrcTy->isInteger() && + SrcTySize == Cast->getType()->getPrimitiveSizeInBits()) { + // If this is an unsigned comparison, try to make the comparison use + // smaller constant values. + switch (I.getPredicate()) { + default: break; + case ICmpInst::ICMP_ULT: { // X u< 128 => X s> -1 + ConstantInt *CUI = cast(CI); + if (CUI->getValue() == APInt::getSignBit(SrcTySize)) + return new ICmpInst(ICmpInst::ICMP_SGT, CastOp, + ConstantInt::get(APInt::getAllOnesValue(SrcTySize))); + break; + } + case ICmpInst::ICMP_UGT: { // X u> 127 => X s< 0 + ConstantInt *CUI = cast(CI); + if (CUI->getValue() == APInt::getSignedMaxValue(SrcTySize)) + return new ICmpInst(ICmpInst::ICMP_SLT, CastOp, + Constant::getNullValue(SrcTy)); + break; + } + } + + } + } + } } - // Handle icmp with constant (but not simple integer constant) RHS + // Handle icmp with constant RHS if (Constant *RHSC = dyn_cast(Op1)) { if (Instruction *LHSI = dyn_cast(Op0)) switch (LHSI->getOpcode()) { @@ -4895,524 +5377,9 @@ return Changed ? &I : 0; } -/// visitICmpInstWithInstAndIntCst - Handle "icmp (instr, intcst)". -/// -Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, - Instruction *LHSI, - ConstantInt *RHS) { - const APInt &RHSV = RHS->getValue(); - - switch (LHSI->getOpcode()) { - case Instruction::Xor: // (icmp pred (and X, XorCST), CI) - if (ConstantInt *XorCST = dyn_cast(LHSI->getOperand(1))) { - // If this is a comparison that tests the signbit (X < 0) or (x > -1), - // fold the xor. - if (ICI.getPredicate() == ICmpInst::ICMP_SLT && RHSV == 0 || - ICI.getPredicate() == ICmpInst::ICMP_SGT && RHSV.isAllOnesValue()) { - Value *CompareVal = LHSI->getOperand(0); - - // If the sign bit of the XorCST is not set, there is no change to - // the operation, just stop using the Xor. - if (!XorCST->getValue().isNegative()) { - ICI.setOperand(0, CompareVal); - AddToWorkList(LHSI); - return &ICI; - } - - // Was the old condition true if the operand is positive? - bool isTrueIfPositive = ICI.getPredicate() == ICmpInst::ICMP_SGT; - - // If so, the new one isn't. - isTrueIfPositive ^= true; - - if (isTrueIfPositive) - return new ICmpInst(ICmpInst::ICMP_SGT, CompareVal, SubOne(RHS)); - else - return new ICmpInst(ICmpInst::ICMP_SLT, CompareVal, AddOne(RHS)); - } - } - break; - case Instruction::And: // (icmp pred (and X, AndCST), RHS) - if (LHSI->hasOneUse() && isa(LHSI->getOperand(1)) && - LHSI->getOperand(0)->hasOneUse()) { - ConstantInt *AndCST = cast(LHSI->getOperand(1)); - - // If the LHS is an AND of a truncating cast, we can widen the - // and/compare to be the input width without changing the value - // produced, eliminating a cast. - if (CastInst *Cast = dyn_cast(LHSI->getOperand(0))) { - // We can do this transformation if either the AND constant does not - // have its sign bit set or if it is an equality comparison. - // Extending a relational comparison when we're checking the sign - // bit would not work. - if (Cast->hasOneUse() && isa(Cast) && - (ICI.isEquality() || AndCST->getValue().isPositive() && - RHSV.isPositive())) { - ConstantInt *NewCST; - ConstantInt *NewCI; - APInt NewCSTVal(AndCST->getValue()), NewCIVal(RHSV); - uint32_t BitWidth = - cast(Cast->getOperand(0)->getType())->getBitWidth(); - NewCST = ConstantInt::get(NewCSTVal.zext(BitWidth)); - NewCI = ConstantInt::get(NewCIVal.zext(BitWidth)); - Instruction *NewAnd = - BinaryOperator::createAnd(Cast->getOperand(0), NewCST, - LHSI->getName()); - InsertNewInstBefore(NewAnd, ICI); - return new ICmpInst(ICI.getPredicate(), NewAnd, NewCI); - } - } - - // If this is: (X >> C1) & C2 != C3 (where any shift and any compare - // could exist), turn it into (X & (C2 << C1)) != (C3 << C1). This - // happens a LOT in code produced by the C front-end, for bitfield - // access. - BinaryOperator *Shift = dyn_cast(LHSI->getOperand(0)); - if (Shift && !Shift->isShift()) - Shift = 0; - - ConstantInt *ShAmt; - ShAmt = Shift ? dyn_cast(Shift->getOperand(1)) : 0; - const Type *Ty = Shift ? Shift->getType() : 0; // Type of the shift. - const Type *AndTy = AndCST->getType(); // Type of the and. - - // We can fold this as long as we can't shift unknown bits - // into the mask. This can only happen with signed shift - // rights, as they sign-extend. - if (ShAmt) { - bool CanFold = Shift->isLogicalShift(); - if (!CanFold) { - // To test for the bad case of the signed shr, see if any - // of the bits shifted in could be tested after the mask. - uint32_t TyBits = Ty->getPrimitiveSizeInBits(); - int ShAmtVal = TyBits - ShAmt->getLimitedValue(TyBits); - - uint32_t BitWidth = AndTy->getPrimitiveSizeInBits(); - if ((APInt::getHighBitsSet(BitWidth, BitWidth-ShAmtVal) & - AndCST->getValue()) == 0) - CanFold = true; - } - - if (CanFold) { - Constant *NewCst; - if (Shift->getOpcode() == Instruction::Shl) - NewCst = ConstantExpr::getLShr(RHS, ShAmt); - else - NewCst = ConstantExpr::getShl(RHS, ShAmt); - - // Check to see if we are shifting out any of the bits being - // compared. - if (ConstantExpr::get(Shift->getOpcode(), NewCst, ShAmt) != RHS) { - // If we shifted bits out, the fold is not going to work out. - // As a special case, check to see if this means that the - // result is always true or false now. - if (ICI.getPredicate() == ICmpInst::ICMP_EQ) - return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); - if (ICI.getPredicate() == ICmpInst::ICMP_NE) - return ReplaceInstUsesWith(ICI, ConstantInt::getTrue()); - } else { - ICI.setOperand(1, NewCst); - Constant *NewAndCST; - if (Shift->getOpcode() == Instruction::Shl) - NewAndCST = ConstantExpr::getLShr(AndCST, ShAmt); - else - NewAndCST = ConstantExpr::getShl(AndCST, ShAmt); - LHSI->setOperand(1, NewAndCST); - LHSI->setOperand(0, Shift->getOperand(0)); - AddToWorkList(Shift); // Shift is dead. - AddUsesToWorkList(ICI); - return &ICI; - } - } - } - - // Turn ((X >> Y) & C) == 0 into (X & (C << Y)) == 0. The later is - // preferable because it allows the C<hasOneUse() && RHSV == 0 && - ICI.isEquality() && !Shift->isArithmeticShift() && - isa(Shift->getOperand(0))) { - // Compute C << Y. - Value *NS; - if (Shift->getOpcode() == Instruction::LShr) { - NS = BinaryOperator::createShl(AndCST, - Shift->getOperand(1), "tmp"); - } else { - // Insert a logical shift. - NS = BinaryOperator::createLShr(AndCST, - Shift->getOperand(1), "tmp"); - } - InsertNewInstBefore(cast(NS), ICI); - - // Compute X & (C << Y). - Instruction *NewAnd = - BinaryOperator::createAnd(Shift->getOperand(0), NS, LHSI->getName()); - InsertNewInstBefore(NewAnd, ICI); - - ICI.setOperand(0, NewAnd); - return &ICI; - } - } - break; - - case Instruction::Shl: // (icmp pred (shl X, ShAmt), CI) - if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { - if (ICI.isEquality()) { - uint32_t TypeBits = RHSV.getBitWidth(); - - // Check that the shift amount is in range. If not, don't perform - // undefined shifts. When the shift is visited it will be - // simplified. - if (ShAmt->uge(TypeBits)) - break; - - // If we are comparing against bits always shifted out, the - // comparison cannot succeed. - Constant *Comp = - ConstantExpr::getShl(ConstantExpr::getLShr(RHS, ShAmt), ShAmt); - if (Comp != RHS) {// Comparing against a bit that we know is zero. - bool IsICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE; - Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); - return ReplaceInstUsesWith(ICI, Cst); - } - - if (LHSI->hasOneUse()) { - // Otherwise strength reduce the shift into an and. - uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); - Constant *Mask = - ConstantInt::get(APInt::getLowBitsSet(TypeBits, TypeBits-ShAmtVal)); - - Instruction *AndI = - BinaryOperator::createAnd(LHSI->getOperand(0), - Mask, LHSI->getName()+".mask"); - Value *And = InsertNewInstBefore(AndI, ICI); - return new ICmpInst(ICI.getPredicate(), And, - ConstantInt::get(RHSV << ShAmtVal)); - } - } - } - break; - - case Instruction::LShr: // (icmp pred (shr X, ShAmt), CI) - case Instruction::AShr: - if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { - if (ICI.isEquality()) { - // Check that the shift amount is in range. If not, don't perform - // undefined shifts. When the shift is visited it will be - // simplified. - uint32_t TypeBits = RHSV.getBitWidth(); - if (ShAmt->uge(TypeBits)) - break; - uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); - - // If we are comparing against bits always shifted out, the - // comparison cannot succeed. - APInt Comp = RHSV << ShAmtVal; - if (LHSI->getOpcode() == Instruction::LShr) - Comp = Comp.lshr(ShAmtVal); - else - Comp = Comp.ashr(ShAmtVal); - - if (Comp != RHSV) { // Comparing against a bit that we know is zero. - bool IsICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE; - Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); - return ReplaceInstUsesWith(ICI, Cst); - } - - if (LHSI->hasOneUse() || RHSV == 0) { - // Otherwise strength reduce the shift into an and. - APInt Val(APInt::getHighBitsSet(TypeBits, TypeBits - ShAmtVal)); - Constant *Mask = ConstantInt::get(Val); - - Instruction *AndI = - BinaryOperator::createAnd(LHSI->getOperand(0), - Mask, LHSI->getName()+".mask"); - Value *And = InsertNewInstBefore(AndI, ICI); - return new ICmpInst(ICI.getPredicate(), And, - ConstantExpr::getShl(RHS, ShAmt)); - } - } - } - break; - - case Instruction::SDiv: - case Instruction::UDiv: - // Fold: icmp pred ([us]div X, C1), C2 -> range test - // Fold this div into the comparison, producing a range check. - // Determine, based on the divide type, what the range is being - // checked. If there is an overflow on the low or high side, remember - // it, otherwise compute the range [low, hi) bounding the new value. - // See: InsertRangeTest above for the kinds of replacements possible. - if (ConstantInt *DivRHS = dyn_cast(LHSI->getOperand(1))) { - // FIXME: If the operand types don't match the type of the divide - // then don't attempt this transform. The code below doesn't have the - // logic to deal with a signed divide and an unsigned compare (and - // vice versa). This is because (x /s C1) getOpcode() == Instruction::SDiv; - if (!ICI.isEquality() && DivIsSigned != ICI.isSignedPredicate()) - break; - if (DivRHS->isZero()) - break; // Don't hack on div by zero - - // Initialize the variables that will indicate the nature of the - // range check. - bool LoOverflow = false, HiOverflow = false; - ConstantInt *LoBound = 0, *HiBound = 0; - - // Compute Prod = CI * DivRHS. We are essentially solving an equation - // of form X/C1=C2. We solve for X by multiplying C1 (DivRHS) and - // C2 (CI). By solving for X we can turn this into a range check - // instead of computing a divide. - ConstantInt *Prod = Multiply(RHS, DivRHS); - - // Determine if the product overflows by seeing if the product is - // not equal to the divide. Make sure we do the same kind of divide - // as in the LHS instruction that we're folding. - bool ProdOV = (DivIsSigned ? ConstantExpr::getSDiv(Prod, DivRHS) : - ConstantExpr::getUDiv(Prod, DivRHS)) != RHS; - - // Get the ICmp opcode - ICmpInst::Predicate predicate = ICI.getPredicate(); - - if (!DivIsSigned) { // udiv - LoBound = Prod; - LoOverflow = ProdOV; - HiOverflow = ProdOV || - AddWithOverflow(HiBound, LoBound, DivRHS, false); - } else if (DivRHS->getValue().isPositive()) { // Divisor is > 0. - if (RHSV == 0) { // (X / pos) op 0 - // Can't overflow. - LoBound = cast(ConstantExpr::getNeg(SubOne(DivRHS))); - HiBound = DivRHS; - } else if (RHSV.isPositive()) { // (X / pos) op pos - LoBound = Prod; - LoOverflow = ProdOV; - HiOverflow = ProdOV || - AddWithOverflow(HiBound, Prod, DivRHS, true); - } else { // (X / pos) op neg - Constant *DivRHSH = ConstantExpr::getNeg(SubOne(DivRHS)); - LoOverflow = AddWithOverflow(LoBound, Prod, - cast(DivRHSH), true); - HiBound = AddOne(Prod); - HiOverflow = ProdOV; - } - } else { // Divisor is < 0. - if (RHSV == 0) { // (X / neg) op 0 - LoBound = AddOne(DivRHS); - HiBound = cast(ConstantExpr::getNeg(DivRHS)); - if (HiBound == DivRHS) - LoBound = 0; // - INTMIN = INTMIN - } else if (RHSV.isPositive()) { // (X / neg) op pos - HiOverflow = LoOverflow = ProdOV; - if (!LoOverflow) - LoOverflow = AddWithOverflow(LoBound, Prod, AddOne(DivRHS), - true); - HiBound = AddOne(Prod); - } else { // (X / neg) op neg - LoBound = Prod; - LoOverflow = HiOverflow = ProdOV; - HiBound = Subtract(Prod, DivRHS); - } - - // Dividing by a negate swaps the condition. - predicate = ICmpInst::getSwappedPredicate(predicate); - } - - if (LoBound) { - Value *X = LHSI->getOperand(0); - switch (predicate) { - default: assert(0 && "Unhandled icmp opcode!"); - case ICmpInst::ICMP_EQ: - if (LoOverflow && HiOverflow) - return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); - else if (HiOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : - ICmpInst::ICMP_UGE, X, LoBound); - else if (LoOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : - ICmpInst::ICMP_ULT, X, HiBound); - else - return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, - true, ICI); - case ICmpInst::ICMP_NE: - if (LoOverflow && HiOverflow) - return ReplaceInstUsesWith(ICI, ConstantInt::getTrue()); - else if (HiOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : - ICmpInst::ICMP_ULT, X, LoBound); - else if (LoOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : - ICmpInst::ICMP_UGE, X, HiBound); - else - return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, - false, ICI); - case ICmpInst::ICMP_ULT: - case ICmpInst::ICMP_SLT: - if (LoOverflow) - return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); - return new ICmpInst(predicate, X, LoBound); - case ICmpInst::ICMP_UGT: - case ICmpInst::ICMP_SGT: - if (HiOverflow) - return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); - if (predicate == ICmpInst::ICMP_UGT) - return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound); - else - return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound); - } - } - } - break; - } - - // Simplify icmp_eq and icmp_ne instructions with integer constant RHS. - if (ICI.isEquality()) { - bool isICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE; - - // If the first operand is (add|sub|and|or|xor|rem) with a constant, and - // the second operand is a constant, simplify a bit. - if (BinaryOperator *BO = dyn_cast(LHSI)) { - switch (BO->getOpcode()) { - case Instruction::SRem: - // If we have a signed (X % (2^c)) == 0, turn it into an unsigned one. - if (RHSV == 0 && isa(BO->getOperand(1)) &&BO->hasOneUse()){ - const APInt &V = cast(BO->getOperand(1))->getValue(); - if (V.sgt(APInt(V.getBitWidth(), 1)) && V.isPowerOf2()) { - Instruction *NewRem = - BinaryOperator::createURem(BO->getOperand(0), BO->getOperand(1), - BO->getName()); - InsertNewInstBefore(NewRem, ICI); - return new ICmpInst(ICI.getPredicate(), NewRem, - Constant::getNullValue(BO->getType())); - } - } - break; - case Instruction::Add: - // Replace ((add A, B) != C) with (A != C-B) if B & C are constants. - if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { - if (BO->hasOneUse()) - return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), - Subtract(RHS, BOp1C)); - } else if (RHSV == 0) { - // Replace ((add A, B) != 0) with (A != -B) if A or B is - // efficiently invertible, or if the add has just this one use. - Value *BOp0 = BO->getOperand(0), *BOp1 = BO->getOperand(1); - - if (Value *NegVal = dyn_castNegVal(BOp1)) - return new ICmpInst(ICI.getPredicate(), BOp0, NegVal); - else if (Value *NegVal = dyn_castNegVal(BOp0)) - return new ICmpInst(ICI.getPredicate(), NegVal, BOp1); - else if (BO->hasOneUse()) { - Instruction *Neg = BinaryOperator::createNeg(BOp1); - InsertNewInstBefore(Neg, ICI); - Neg->takeName(BO); - return new ICmpInst(ICI.getPredicate(), BOp0, Neg); - } - } - break; - case Instruction::Xor: - // For the xor case, we can xor two constants together, eliminating - // the explicit xor. - if (Constant *BOC = dyn_cast(BO->getOperand(1))) - return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), - ConstantExpr::getXor(RHS, BOC)); - - // FALLTHROUGH - case Instruction::Sub: - // Replace (([sub|xor] A, B) != 0) with (A != B) - if (RHSV == 0) - return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), - BO->getOperand(1)); - break; - - case Instruction::Or: - // If bits are being or'd in that are not present in the constant we - // are comparing against, then the comparison could never succeed! - if (Constant *BOC = dyn_cast(BO->getOperand(1))) { - Constant *NotCI = ConstantExpr::getNot(RHS); - if (!ConstantExpr::getAnd(BOC, NotCI)->isNullValue()) - return ReplaceInstUsesWith(ICI, ConstantInt::get(Type::Int1Ty, - isICMP_NE)); - } - break; - - case Instruction::And: - if (ConstantInt *BOC = dyn_cast(BO->getOperand(1))) { - // If bits are being compared against that are and'd out, then the - // comparison can never succeed! - if ((RHSV & ~BOC->getValue()) != 0) - return ReplaceInstUsesWith(ICI, ConstantInt::get(Type::Int1Ty, - isICMP_NE)); - - // If we have ((X & C) == C), turn it into ((X & C) != 0). - if (RHS == BOC && RHSV.isPowerOf2()) - return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : - ICmpInst::ICMP_NE, RHS, - Constant::getNullValue(RHS->getType())); - - // Replace (and X, (1 << size(X)-1) != 0) with x s< 0 - if (isSignBit(BOC)) { - Value *X = BO->getOperand(0); - Constant *Zero = Constant::getNullValue(X->getType()); - ICmpInst::Predicate pred = isICMP_NE ? - ICmpInst::ICMP_SLT : ICmpInst::ICMP_SGE; - return new ICmpInst(pred, X, Zero); - } - - // ((X & ~7) == 0) --> X < 8 - if (RHSV == 0 && isHighOnes(BOC)) { - Value *X = BO->getOperand(0); - Constant *NegX = ConstantExpr::getNeg(BOC); - ICmpInst::Predicate pred = isICMP_NE ? - ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT; - return new ICmpInst(pred, X, NegX); - } - } - default: break; - } - } else if (IntrinsicInst *II = dyn_cast(LHSI)) { - // Handle icmp {eq|ne} , intcst. - if (II->getIntrinsicID() == Intrinsic::bswap) { - AddToWorkList(II); - ICI.setOperand(0, II->getOperand(1)); - ICI.setOperand(1, ConstantInt::get(RHSV.byteSwap())); - return &ICI; - } - } - } else { // Not a ICMP_EQ/ICMP_NE - // If the LHS is a cast from an integral value of the same size, then - // since we know the RHS is a constant, try to simlify. - if (CastInst *Cast = dyn_cast(LHSI)) { - Value *CastOp = Cast->getOperand(0); - const Type *SrcTy = CastOp->getType(); - uint32_t SrcTySize = SrcTy->getPrimitiveSizeInBits(); - if (SrcTy->isInteger() && - SrcTySize == Cast->getType()->getPrimitiveSizeInBits()) { - // If this is an unsigned comparison, try to make the comparison use - // smaller constant values. - if (ICI.getPredicate() == ICmpInst::ICMP_ULT && RHSV.isSignBit()) { - // X u< 128 => X s> -1 - return new ICmpInst(ICmpInst::ICMP_SGT, CastOp, - ConstantInt::get(APInt::getAllOnesValue(SrcTySize))); - } else if (ICI.getPredicate() == ICmpInst::ICMP_UGT && - RHSV == APInt::getSignedMaxValue(SrcTySize)) { - // X u> 127 => X s< 0 - return new ICmpInst(ICmpInst::ICMP_SLT, CastOp, - Constant::getNullValue(SrcTy)); - } - } - } - } - return 0; -} - -/// visitICmpInstWithCastAndCast - Handle icmp (cast x to y), (cast/cst). -/// We only handle extending casts so far. -/// +// visitICmpInstWithCastAndCast - Handle icmp (cast x to y), (cast/cst). +// We only handle extending casts so far. +// Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { const CastInst *LHSCI = cast(ICI.getOperand(0)); Value *LHSCIOp = LHSCI->getOperand(0); From reid at x10sys.com Tue Apr 3 03:29:02 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 03:29:02 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200704030829.l338T27p018299@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.65 -> 1.66 --- Log message: Prepare for Subversion migration by implementing a -usesvn to tell the script to to check out llvm and llvm-test from Subversion instead of CVS. Without this option the script will continue to check out from CVS. To specify the Subversion URL, set the SVNURL environment variable or pass -svnurl followed by the URL. For now, -svnurl will default to Reid's temporary (read-only, daily snapshot) SVN server. Try it out if you like! --- Diffs of the changes: (+147 -62) NewNightlyTest.pl | 209 +++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 147 insertions(+), 62 deletions(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.65 llvm/utils/NewNightlyTest.pl:1.66 --- llvm/utils/NewNightlyTest.pl:1.65 Fri Nov 24 14:34:16 2006 +++ llvm/utils/NewNightlyTest.pl Tue Apr 3 03:28:44 2007 @@ -1,6 +1,7 @@ #!/usr/bin/perl use POSIX qw(strftime); use File::Copy; +use Date::Parse; use Socket; # @@ -45,6 +46,10 @@ # -gccpath Path to gcc/g++ used to build LLVM # -cvstag Check out a specific CVS tag to build LLVM (useful for # testing release branches) +# -usesvn Check code out from a subversion repository. With no +# argument, use the standard repository. An argument specifies +# the repository URL to use. +# -svnurl Specify the SVN URL where LLVM can be found # -target Specify the target triplet # -cflags Next argument specifies that C compilation options that # override the default. @@ -91,6 +96,8 @@ # ############################################################## my $HOME = $ENV{'HOME'}; +my $SVNURL = $ENV{"SVNURL"}; +$SVNURL = 'svn://anon at hlvm.org:3691/llvm.svn' unless $SVNURL; my $CVSRootDir = $ENV{'CVSROOT'}; $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; my $BuildDir = $ENV{'BUILDDIR'}; @@ -116,6 +123,7 @@ $CONFIGUREARGS=""; $nickname=""; $NOTEST=0; +$USESVN=0; $NORUNNINGTESTS=0; $MAKECMD="make"; $SUBMITSERVER = "llvm.org"; @@ -163,6 +171,8 @@ else { $GCCPATH=""; } if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; } else { $CVSCOOPT="";} + if (/^-usesvn/) { $USESVN = 1; } + if (/^-svnurl/) { $SVNURL = $ARGV[0]; shift; next; } if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next; } if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; @@ -225,7 +235,7 @@ ############################################################## my $Prefix = "$WebDir/$DATE"; my $BuildLog = "$Prefix-Build-Log.txt"; -my $CVSLog = "$Prefix-CVS-Log.txt"; +my $COLog = "$Prefix-CVS-Log.txt"; my $OldenTestsLog = "$Prefix-Olden-tests.txt"; my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz"; my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz"; @@ -242,11 +252,15 @@ if ($VERBOSE) { print "INITIALIZED\n"; - print "CVS Root = $CVSRootDir\n"; + if ($USESVN) { + print "SVN URL = $SVNURL\n"; + } else { + print "CVS Root = $CVSRootDir\n"; + } + print "COLog = $COLog\n"; print "BuildDir = $BuildDir\n"; print "WebDir = $WebDir\n"; print "Prefix = $Prefix\n"; - print "CVSLog = $CVSLog\n"; print "BuildLog = $BuildLog\n"; } @@ -477,39 +491,48 @@ print "Build directory exists! Removing it\n"; } system "rm -rf $BuildDir"; - mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!"; + mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; } else { if ( $VERBOSE ) { print "Build directory exists!\n"; } } } else { - mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!"; + mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; } } -ChangeDir( $BuildDir, "CVS checkout directory" ); +ChangeDir( $BuildDir, "checkout directory" ); ############################################################## # -# Check out the llvm tree, saving CVS messages to the cvs log... +# Check out the llvm tree, using either SVN or CVS # ############################################################## -my $CVSOPT = ""; -# Use compression if going over ssh. -$CVSOPT = "-z3" - if $CVSRootDir =~ /^:ext:/; -my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT"; if (!$NOCHECKOUT) { if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; - print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) " . - "> $CVSLog 2>&1\n"; } - system "( time -p $CVSCMD llvm; cd llvm/projects ; " . - "$CVSCMD llvm-test ) > $CVSLog 2>&1"; - ChangeDir( $BuildDir , "CVS Checkout directory") ; + if ($USESVN) { + my $SVNCMD = "$NICE svn co $SVNURL"; + if ($VERBOSE) { + print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . + "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n"; + system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . + "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n"; + } + } else { + my $CVSOPT = ""; + $CVSOPT = "-z3" # Use compression if going over ssh. + if $CVSRootDir =~ /^:ext:/; + my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT"; + print "( time -p $CVSCMD llvm; cd llvm/projects ; " . + "$CVSCMD llvm-test ) > $COLog 2>&1"; + system "( time -p $CVSCMD llvm; cd llvm/projects ; " . + "$CVSCMD llvm-test ) > $COLog 2>&1"; + } } +ChangeDir( $BuildDir , "Checkout directory") ; ChangeDir( "llvm" , "llvm source directory") ; ############################################################## @@ -519,14 +542,20 @@ # This can probably be put on the server side # ############################################################## -my $CVSCheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`; -my $CVSCheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $CVSLog`; -my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`; -my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; - -my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0; -my $NumDirsInCVS = - `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0; +my $CheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $COLog`; +my $CheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $COLog`; +my $CheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $COLog`; +my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; + +my $NumFilesInCVS = 0; +my $NumDirsInCVS = 0; +if ($USESVN) { + $NumFilesInCVS = `egrep '^A' $COLog | wc -l` + 0; + $NumDirsInCVS = `sed -e 's#/[^/]*$##' $COLog | sort | uniq | wc -l` + 0; +} else { + $NumFilesInCVS = `egrep '^U' $COLog | wc -l` + 0; + $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $COLog | wc -l` + 0; +} ############################################################## # @@ -538,47 +567,103 @@ my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated); -if(!$NOCVSSTATS){ - +if (!$NOCVSSTATS) { if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; } - @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`; -#print join "\n", @CVSHistory; print "\n"; - my $DateRE = '[-/:0-9 ]+\+[0-9]+'; - -# Loop over every record from the CVS history, filling in the hashes. - foreach $File (@CVSHistory) { - my ($Type, $Date, $UID, $Rev, $Filename); - if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) { - ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5"); - } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) { - ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", ""); - } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) { - ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/"); - } else { - print "UNMATCHABLE: $File\n"; - next; + if ($USESVN) { + my $delimiter = "----------------------------------------------------" . + "--------------------\n"; + @SVNHistory = split $delimiter, `svn log --verbose -r{$DATE}:HEAD`; + +# Skip very first entry. + shift @SVNHistory; + foreach $Record (@SVNHistory) { + my (@Lines, @Fields); + my ($Rev, $Author, $StrTime, $LogLines, $Time); + @Lines = split "\n", $Record; +# print join"\n", @Lines; + + ($Rev, $Author, $StrTime, $LogLines) = split ' \| ', $Lines[0]; + $Time = str2time($StrTime); + if (time() - $Time > 24*3600) { + next; } - # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n"; - - if ($Filename =~ /^llvm/) { - if ($Type eq 'M') { # Modified - $ModifiedFiles{$Filename} = 1; - $UsersCommitted{$UID} = 1; - } elsif ($Type eq 'A') { # Added - $AddedFiles{$Filename} = 1; - $UsersCommitted{$UID} = 1; - } elsif ($Type eq 'R') { # Removed - $RemovedFiles{$Filename} = 1; - $UsersCommitted{$UID} = 1; - } else { - $UsersUpdated{$UID} = 1; + + $UsersCommitted{$Author} = 1; + + #print $Rev, $Author, $Time, $LogLines, "\n"; + + my $i = 2; + while ($Lines[$i] ne '') { + my ($Type, $Filename, $FromFile, $FromRev); + #print $Lines[$i], "\n"; + + if ($Lines[$i] =~ / ([MAD]) ([^ ]+) \(from ([^ ]+):([^ ]+)\)/) { + ($Type, $Filename, $FromFile, $FromRev) = ($1, $2, $3, $4); + } elsif ($Lines[$i] =~ / ([MAD]) ([^ ]+)/) { + ($Type, $Filename, $FromFile, $FromRev) = ($1, $2, "", ""); + } else { + print "UNMATCHABLE: $Lines[$i]\n"; + } + + if ($Type eq 'M') { # Modified + $ModifiedFiles{$Filename} = 1; + } elsif ($Type eq 'A') { # Added + if ($FromFile eq "") { # File was added + $AddedFiles{$Filename} = 1; + } else { #File was added from another file - moved or copied. + $MovedFiles{$Filename} = 1; } + } elsif ($Type eq 'D') { # Removed + $RemovedFiles{$Filename} = 1; + } else { + print "INVALID TYPE: $Type"; + } + + #print $Filename, "\n"; + #print $Type, $File, $FromFile, $FromRev, "\n"; + ++$i; } - } + } + } else { + @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`; +#print join "\n", @CVSHistory; print "\n"; + + my $DateRE = '[-/:0-9 ]+\+[0-9]+'; - my $TestError = 1; +# Loop over every record from the CVS history, filling in the hashes. + foreach $File (@CVSHistory) { + my ($Type, $Date, $UID, $Rev, $Filename); + if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) { + ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5"); + } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) { + ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", ""); + } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) { + ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/"); + } else { + print "UNMATCHABLE: $File\n"; + next; + } + # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n"; + + if ($Filename =~ /^llvm/) { + if ($Type eq 'M') { # Modified + $ModifiedFiles{$Filename} = 1; + $UsersCommitted{$UID} = 1; + } elsif ($Type eq 'A') { # Added + $AddedFiles{$Filename} = 1; + $UsersCommitted{$UID} = 1; + } elsif ($Type eq 'R') { # Removed + $RemovedFiles{$Filename} = 1; + $UsersCommitted{$UID} = 1; + } else { + $UsersUpdated{$UID} = 1; + } + } + } + my $TestError = 1; + } #$USESVN }#!NOCVSSTATS my $CVSAddedFiles = join "\n", sort keys %AddedFiles; @@ -944,7 +1029,7 @@ my @CVS_DATA; my $cvs_data; - at CVS_DATA = ReadFile "$CVSLog"; + at CVS_DATA = ReadFile "$COLog"; $cvs_data = join("\n", @CVS_DATA); my @BUILD_DATA; @@ -990,8 +1075,8 @@ 'nickname' => $nickname, 'dejagnutime_wall' => $DejagnuWallTime, 'dejagnutime_cpu' => $DejagnuTime, - 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall, - 'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU, + 'cvscheckouttime_wall' => $CheckoutTime_Wall, + 'cvscheckouttime_cpu' => $CheckoutTime_CPU, 'configtime_wall' => $ConfigWallTime, 'configtime_cpu'=> $ConfigTime, 'buildtime_wall' => $BuildWallTime, From asl at math.spbu.ru Tue Apr 3 03:56:54 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 03 Apr 2007 12:56:54 +0400 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200704030812.l338C85l017774.SS49512SS@zion.cs.uiuc.edu> References: <200704030812.l338C85l017774.SS49512SS@zion.cs.uiuc.edu> Message-ID: <1175590614.9200.60.camel@asl.dorms.spbu.ru> > Reverting back to 1.723. The last two commits broke JM (and possibily others) on ARM. Definitely. Qt is broken too. Funny, but I see exactly the same errors, as soon after Reid's InstCombine APIntifiaction (some bits are missing, so tool outputs "settitle" instead of "setTitle" :) ). Will investigate this evening. Seems to be easy to reduce to one file. -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From nicolas.geoffray at lip6.fr Tue Apr 3 05:27:24 2007 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 3 Apr 2007 05:27:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCCallingConv.td PPCISelLowering.cpp PPCInstr64Bit.td PPCInstrInfo.td PPCRegisterInfo.cpp Message-ID: <200704031027.l33ARO0P020780@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCCallingConv.td updated: 1.1 -> 1.2 PPCISelLowering.cpp updated: 1.265 -> 1.266 PPCInstr64Bit.td updated: 1.42 -> 1.43 PPCInstrInfo.td updated: 1.276 -> 1.277 PPCRegisterInfo.cpp updated: 1.118 -> 1.119 --- Log message: The ELF ABI specifies F1-F8 registers as argument registers for double, not F1-F10. This affects only ELF, not MachO. --- Diffs of the changes: (+12 -10) PPCCallingConv.td | 4 ++-- PPCISelLowering.cpp | 6 +++--- PPCInstr64Bit.td | 2 +- PPCInstrInfo.td | 2 +- PPCRegisterInfo.cpp | 8 +++++--- 5 files changed, 12 insertions(+), 10 deletions(-) Index: llvm/lib/Target/PowerPC/PPCCallingConv.td diff -u llvm/lib/Target/PowerPC/PPCCallingConv.td:1.1 llvm/lib/Target/PowerPC/PPCCallingConv.td:1.2 --- llvm/lib/Target/PowerPC/PPCCallingConv.td:1.1 Mon Mar 5 18:59:59 2007 +++ llvm/lib/Target/PowerPC/PPCCallingConv.td Tue Apr 3 05:27:07 2007 @@ -44,8 +44,8 @@ // Darwin passes FP values in F1 - F13 CCIfType<[f32, f64], CCIfSubtarget<"isMachoABI()", CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8,F9,F10,F11,F12,F13]>>>, - // Other sub-targets pass FP values in F1-10. - CCIfType<[f32, f64], CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8, F9,F10]>>, + // Other sub-targets pass FP values in F1-F8. + CCIfType<[f32, f64], CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8]>>, // The first 12 Vector arguments are passed in altivec registers. CCIfType<[v16i8, v8i16, v4i32, v4f32], Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.265 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.266 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.265 Fri Mar 30 18:15:24 2007 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Tue Apr 3 05:27:07 2007 @@ -1113,7 +1113,7 @@ static const unsigned FPR[] = { PPC::F1, PPC::F2, PPC::F3, PPC::F4, PPC::F5, PPC::F6, PPC::F7, - PPC::F8, PPC::F9, PPC::F10 + PPC::F8 }; return FPR; } @@ -1154,7 +1154,7 @@ }; const unsigned Num_GPR_Regs = sizeof(GPR_32)/sizeof(GPR_32[0]); - const unsigned Num_FPR_Regs = isMachoABI ? 13 : 10; + const unsigned Num_FPR_Regs = isMachoABI ? 13 : 8; const unsigned Num_VR_Regs = sizeof( VR)/sizeof( VR[0]); unsigned GPR_idx = 0, FPR_idx = 0, VR_idx = 0; @@ -1410,7 +1410,7 @@ PPC::V9, PPC::V10, PPC::V11, PPC::V12, PPC::V13 }; const unsigned NumGPRs = sizeof(GPR_32)/sizeof(GPR_32[0]); - const unsigned NumFPRs = isMachoABI ? 13 : 10; + const unsigned NumFPRs = isMachoABI ? 13 : 8; const unsigned NumVRs = sizeof( VR)/sizeof( VR[0]); const unsigned *GPR = isPPC64 ? GPR_64 : GPR_32; Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.42 llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.43 --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.42 Sat Mar 24 23:44:03 2007 +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td Tue Apr 3 05:27:07 2007 @@ -91,7 +91,7 @@ let isCall = 1, noResults = 1, PPC970_Unit = 7, // All calls clobber the PPC64 non-callee saved registers. Defs = [X0,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12, - F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10, + F0,F1,F2,F3,F4,F5,F6,F7,F8, V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19, LR8,CTR8, CR0,CR1,CR5,CR6,CR7] in { Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.276 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.277 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.276 Tue Feb 27 07:01:19 2007 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Tue Apr 3 05:27:07 2007 @@ -396,7 +396,7 @@ let isCall = 1, noResults = 1, PPC970_Unit = 7, // 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, + F0,F1,F2,F3,F4,F5,F6,F7,F8, V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19, LR,CTR, CR0,CR1,CR5,CR6,CR7] in { Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.118 llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.119 --- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.118 Wed Mar 21 11:44:14 2007 +++ llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Tue Apr 3 05:27:07 2007 @@ -278,7 +278,8 @@ PPC::R24, PPC::R25, PPC::R26, PPC::R27, PPC::R28, PPC::R29, PPC::R30, PPC::R31, - PPC::F11, PPC::F12, PPC::F13, + PPC::F9, + PPC::F10, PPC::F11, PPC::F12, PPC::F13, PPC::F14, PPC::F15, PPC::F16, PPC::F17, PPC::F18, PPC::F19, PPC::F20, PPC::F21, PPC::F22, PPC::F23, PPC::F24, PPC::F25, @@ -320,8 +321,9 @@ PPC::X20, PPC::X21, PPC::X22, PPC::X23, PPC::X24, PPC::X25, PPC::X26, PPC::X27, PPC::X28, PPC::X29, PPC::X30, PPC::X31, - - PPC::F11, PPC::F12, PPC::F13, + + PPC::F9, + PPC::F10, PPC::F11, PPC::F12, PPC::F13, PPC::F14, PPC::F15, PPC::F16, PPC::F17, PPC::F18, PPC::F19, PPC::F20, PPC::F21, PPC::F22, PPC::F23, PPC::F24, PPC::F25, From nicolas.geoffray at lip6.fr Tue Apr 3 05:58:06 2007 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 3 Apr 2007 05:58:06 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Message-ID: <200704031058.l33Aw6JE021262@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCRegisterInfo.cpp updated: 1.119 -> 1.120 --- Log message: Addition to the previous commit for getCalleeSavedRegClasses: "The ELF ABI specifies F1-F8 registers as argument registers for double, not F1-F10. This affects only ELF, not MachO." --- Diffs of the changes: (+4 -2) PPCRegisterInfo.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.119 llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.120 --- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.119 Tue Apr 3 05:27:07 2007 +++ llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Tue Apr 3 05:57:49 2007 @@ -378,7 +378,8 @@ &PPC::GPRCRegClass,&PPC::GPRCRegClass,&PPC::GPRCRegClass,&PPC::GPRCRegClass, &PPC::GPRCRegClass,&PPC::GPRCRegClass,&PPC::GPRCRegClass,&PPC::GPRCRegClass, - &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, + &PPC::F8RCRegClass, + &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, @@ -424,7 +425,8 @@ &PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass, &PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass, - &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, + &PPC::F8RCRegClass, + &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, From lauro.venancio at gmail.com Tue Apr 3 07:08:09 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Tue, 3 Apr 2007 09:08:09 -0300 Subject: [llvm-commits] eh_arm.cc In-Reply-To: <124DED6F-23CB-4938-93CF-08D897B23F26@apple.com> References: <124DED6F-23CB-4938-93CF-08D897B23F26@apple.com> Message-ID: <9c10c9f0704030508t6d037a1fscdbb3cac0aaec544@mail.gmail.com> The file eh_arm.cc wasn't committed. It is in the patch. I can't test and see if other files are missing because the patch doesn't reach the public svn yet. Lauro 2007/4/3, Devang Patel : > > On Apr 2, 2007, at 11:34 PM, Bill Wendling wrote: > > > I'm getting this error during llvm-gcc compilation: > > > > make[3]: *** No rule to make target `eh_arm.cc', needed by > > `eh_arm.lo'. Stop. > > make[3]: *** Waiting for unfinished jobs.... > > This is related to Lauro Ramos Venancio's patch Dale committed. > > - > Devang > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From nicolas.geoffray at lip6.fr Tue Apr 3 07:35:47 2007 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 3 Apr 2007 07:35:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCCallingConv.td PPCFrameInfo.h PPCISelLowering.cpp PPCInstr64Bit.td PPCRegisterInfo.cpp PPCSubtarget.h Message-ID: <200704031235.l33CZl4S023016@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCCallingConv.td updated: 1.2 -> 1.3 PPCFrameInfo.h updated: 1.13 -> 1.14 PPCISelLowering.cpp updated: 1.266 -> 1.267 PPCInstr64Bit.td updated: 1.43 -> 1.44 PPCRegisterInfo.cpp updated: 1.120 -> 1.121 PPCSubtarget.h updated: 1.25 -> 1.26 --- Log message: The PPC64 ELF ABI is "intended to use the same structure layout and calling convention rules as the 64-bit PowerOpen ABI" (Reference http://www.linux-foundation.org/spec/ELF/ppc64/). Change all ELF tests to ELF32. --- Diffs of the changes: (+46 -92) PPCCallingConv.td | 4 +- PPCFrameInfo.h | 14 ++++---- PPCISelLowering.cpp | 26 +++++++-------- PPCInstr64Bit.td | 5 +-- PPCRegisterInfo.cpp | 85 +++++++++++----------------------------------------- PPCSubtarget.h | 4 +- 6 files changed, 46 insertions(+), 92 deletions(-) Index: llvm/lib/Target/PowerPC/PPCCallingConv.td diff -u llvm/lib/Target/PowerPC/PPCCallingConv.td:1.2 llvm/lib/Target/PowerPC/PPCCallingConv.td:1.3 --- llvm/lib/Target/PowerPC/PPCCallingConv.td:1.2 Tue Apr 3 05:27:07 2007 +++ llvm/lib/Target/PowerPC/PPCCallingConv.td Tue Apr 3 07:35:28 2007 @@ -41,10 +41,10 @@ CCIfType<[i32], CCAssignToReg<[R3, R4, R5, R6, R7, R8, R9, R10]>>, CCIfType<[i64], CCAssignToReg<[X3, X4, X5, X6, X7, X8, X9, X10]>>, - // Darwin passes FP values in F1 - F13 + // Common sub-targets passes FP values in F1 - F13 CCIfType<[f32, f64], CCIfSubtarget<"isMachoABI()", CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8,F9,F10,F11,F12,F13]>>>, - // Other sub-targets pass FP values in F1-F8. + // ELF32 sub-target pass FP values in F1 - F8. CCIfType<[f32, f64], CCAssignToReg<[F1, F2, F3, F4, F5, F6, F7, F8]>>, // The first 12 Vector arguments are passed in altivec registers. Index: llvm/lib/Target/PowerPC/PPCFrameInfo.h diff -u llvm/lib/Target/PowerPC/PPCFrameInfo.h:1.13 llvm/lib/Target/PowerPC/PPCFrameInfo.h:1.14 --- llvm/lib/Target/PowerPC/PPCFrameInfo.h:1.13 Sat Feb 24 23:34:32 2007 +++ llvm/lib/Target/PowerPC/PPCFrameInfo.h Tue Apr 3 07:35:28 2007 @@ -32,8 +32,8 @@ static unsigned getReturnSaveOffset(bool LP64, bool isMacho) { if (isMacho) return LP64 ? 16 : 8; - // For ELF ABI: - return LP64 ? 8 : 4; + // For ELF 32 ABI: + return 4; } /// getFramePointerSaveOffset - Return the previous frame offset to save the @@ -46,9 +46,9 @@ if (isMacho) return LP64 ? 40 : 20; - // For ELF ABI: + // For ELF 32 ABI: // Save it right before the link register - return LP64 ? -8 : -4; + return -4; } /// getLinkageSize - Return the size of the PowerPC ABI linkage area. @@ -57,8 +57,8 @@ if (isMacho) return 6 * (LP64 ? 8 : 4); - // For ELF ABI: - return LP64 ? 16 : 8; + // For ELF 32 ABI: + return 8; } /// getMinCallArgumentsSize - Return the size of the minium PowerPC ABI @@ -73,7 +73,7 @@ if (isMacho) return 8 * (LP64 ? 8 : 4); - // For Linux ABI: + // For ELF 32 ABI: // There is no default stack allocated for the 8 first GPR arguments. return 0; } Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.266 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.267 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.266 Tue Apr 3 05:27:07 2007 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Tue Apr 3 07:35:28 2007 @@ -1132,7 +1132,7 @@ MVT::ValueType PtrVT = DAG.getTargetLoweringInfo().getPointerTy(); bool isPPC64 = PtrVT == MVT::i64; bool isMachoABI = Subtarget.isMachoABI(); - bool isELF_ABI = Subtarget.isELF_ABI(); + bool isELF32_ABI = Subtarget.isELF32_ABI(); unsigned PtrByteSize = isPPC64 ? 8 : 4; unsigned ArgOffset = PPCFrameInfo::getLinkageSize(isPPC64, isMachoABI); @@ -1165,7 +1165,7 @@ // entry to a function on PPC, the arguments start after the linkage area, // although the first ones are often in registers. // - // In the ELF ABI, GPRs and stack are double word align: an argument + // In the ELF 32 ABI, GPRs and stack are double word align: an argument // represented with two words (long long or double) must be copied to an // even GPR_idx value or to an even ArgOffset value. @@ -1187,7 +1187,7 @@ default: assert(0 && "Unhandled argument type!"); case MVT::i32: // Double word align in ELF - if (Expand && isELF_ABI && !isPPC64) GPR_idx += (GPR_idx % 2); + if (Expand && isELF32_ABI) GPR_idx += (GPR_idx % 2); if (GPR_idx != Num_GPR_Regs) { unsigned VReg = RegMap->createVirtualRegister(&PPC::GPRCRegClass); MF.addLiveIn(GPR[GPR_idx], VReg); @@ -1198,7 +1198,7 @@ ArgSize = PtrByteSize; } // Stack align in ELF - if (needsLoad && Expand && isELF_ABI && !isPPC64) + if (needsLoad && Expand && isELF32_ABI) ArgOffset += ((ArgOffset/4) % 2) * PtrByteSize; // All int arguments reserve stack space in Macho ABI. if (isMachoABI || needsLoad) ArgOffset += PtrByteSize; @@ -1240,7 +1240,7 @@ } // Stack align in ELF - if (needsLoad && Expand && isELF_ABI && !isPPC64) + if (needsLoad && Expand && isELF32_ABI) ArgOffset += ((ArgOffset/4) % 2) * PtrByteSize; // All FP arguments reserve stack space in Macho ABI. if (isMachoABI || needsLoad) ArgOffset += isPPC64 ? 8 : ObjSize; @@ -1344,7 +1344,7 @@ unsigned NumOps = (Op.getNumOperands() - 5) / 2; bool isMachoABI = Subtarget.isMachoABI(); - bool isELF_ABI = Subtarget.isELF_ABI(); + bool isELF32_ABI = Subtarget.isELF32_ABI(); MVT::ValueType PtrVT = DAG.getTargetLoweringInfo().getPointerTy(); bool isPPC64 = PtrVT == MVT::i64; @@ -1432,8 +1432,8 @@ // register cannot be found for it. SDOperand PtrOff; - // Stack align in ELF - if (isELF_ABI && Expand && !isPPC64) + // Stack align in ELF 32 + if (isELF32_ABI && Expand) PtrOff = DAG.getConstant(ArgOffset + ((ArgOffset/4) % 2) * PtrByteSize, StackPtr.getValueType()); else @@ -1453,7 +1453,7 @@ case MVT::i32: case MVT::i64: // Double word align in ELF - if (isELF_ABI && Expand && !isPPC64) GPR_idx += (GPR_idx % 2); + if (isELF32_ABI && Expand) GPR_idx += (GPR_idx % 2); if (GPR_idx != NumGPRs) { RegsToPass.push_back(std::make_pair(GPR[GPR_idx++], Arg)); } else { @@ -1462,7 +1462,7 @@ } if (inMem || isMachoABI) { // Stack align in ELF - if (isELF_ABI && Expand && !isPPC64) + if (isELF32_ABI && Expand) ArgOffset += ((ArgOffset/4) % 2) * PtrByteSize; ArgOffset += PtrByteSize; @@ -1516,7 +1516,7 @@ } if (inMem || isMachoABI) { // Stack align in ELF - if (isELF_ABI && Expand && !isPPC64) + if (isELF32_ABI && Expand) ArgOffset += ((ArgOffset/4) % 2) * PtrByteSize; if (isPPC64) ArgOffset += 8; @@ -1548,8 +1548,8 @@ InFlag = Chain.getValue(1); } - // With the ELF ABI, set CR6 to true if this is a vararg call. - if (isVarArg && isELF_ABI) { + // With the ELF 32 ABI, set CR6 to true if this is a vararg call. + if (isVarArg && isELF32_ABI) { SDOperand SetCR(DAG.getTargetNode(PPC::SETCR, MVT::i32), 0); Chain = DAG.getCopyToReg(Chain, PPC::CR6, SetCR, InFlag); InFlag = Chain.getValue(1); Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.43 llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.44 --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.43 Tue Apr 3 05:27:07 2007 +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td Tue Apr 3 07:35:28 2007 @@ -87,11 +87,12 @@ "bla $func", BrB, [(PPCcall_Macho (i64 imm:$func))]>; } -// ELF ABI Calls. +// ELF 64 ABI Calls = Macho ABI Calls +// Used to define BL8_ELF and BLA8_ELF let isCall = 1, noResults = 1, PPC970_Unit = 7, // All calls clobber the PPC64 non-callee saved registers. Defs = [X0,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12, - F0,F1,F2,F3,F4,F5,F6,F7,F8, + F0,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,F13, V0,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12,V13,V14,V15,V16,V17,V18,V19, LR8,CTR8, CR0,CR1,CR5,CR6,CR7] in { Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.120 llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.121 --- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.120 Tue Apr 3 05:57:49 2007 +++ llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Tue Apr 3 07:35:28 2007 @@ -250,7 +250,7 @@ const unsigned* PPCRegisterInfo::getCalleeSavedRegs() const { // 32-bit Darwin calling convention. - static const unsigned Darwin32_CalleeSavedRegs[] = { + static const unsigned Macho32_CalleeSavedRegs[] = { PPC::R13, PPC::R14, PPC::R15, PPC::R16, PPC::R17, PPC::R18, PPC::R19, PPC::R20, PPC::R21, PPC::R22, PPC::R23, @@ -294,7 +294,7 @@ PPC::LR, 0 }; // 64-bit Darwin calling convention. - static const unsigned Darwin64_CalleeSavedRegs[] = { + static const unsigned Macho64_CalleeSavedRegs[] = { PPC::X14, PPC::X15, PPC::X16, PPC::X17, PPC::X18, PPC::X19, PPC::X20, PPC::X21, PPC::X22, PPC::X23, @@ -315,41 +315,18 @@ PPC::LR8, 0 }; - static const unsigned ELF64_CalleeSavedRegs[] = { - PPC::X14, PPC::X15, - PPC::X16, PPC::X17, PPC::X18, PPC::X19, - PPC::X20, PPC::X21, PPC::X22, PPC::X23, - PPC::X24, PPC::X25, PPC::X26, PPC::X27, - PPC::X28, PPC::X29, PPC::X30, PPC::X31, - - PPC::F9, - PPC::F10, PPC::F11, PPC::F12, PPC::F13, - PPC::F14, PPC::F15, PPC::F16, PPC::F17, - PPC::F18, PPC::F19, PPC::F20, PPC::F21, - PPC::F22, PPC::F23, PPC::F24, PPC::F25, - PPC::F26, PPC::F27, PPC::F28, PPC::F29, - PPC::F30, PPC::F31, - - PPC::CR2, PPC::CR3, PPC::CR4, - PPC::V20, PPC::V21, PPC::V22, PPC::V23, - PPC::V24, PPC::V25, PPC::V26, PPC::V27, - PPC::V28, PPC::V29, PPC::V30, PPC::V31, - - PPC::LR8, 0 - }; - if (Subtarget.isMachoABI()) - return Subtarget.isPPC64() ? Darwin64_CalleeSavedRegs : - Darwin32_CalleeSavedRegs; + return Subtarget.isPPC64() ? Macho64_CalleeSavedRegs : + Macho32_CalleeSavedRegs; - // ELF. - return Subtarget.isPPC64() ? ELF64_CalleeSavedRegs : ELF32_CalleeSavedRegs; + // ELF 32. + return ELF32_CalleeSavedRegs; } const TargetRegisterClass* const* PPCRegisterInfo::getCalleeSavedRegClasses() const { - // 32-bit Darwin calling convention. - static const TargetRegisterClass * const Darwin32_CalleeSavedRegClasses[] = { + // 32-bit Macho calling convention. + static const TargetRegisterClass * const Macho32_CalleeSavedRegClasses[] = { &PPC::GPRCRegClass,&PPC::GPRCRegClass,&PPC::GPRCRegClass, &PPC::GPRCRegClass,&PPC::GPRCRegClass,&PPC::GPRCRegClass,&PPC::GPRCRegClass, &PPC::GPRCRegClass,&PPC::GPRCRegClass,&PPC::GPRCRegClass,&PPC::GPRCRegClass, @@ -395,8 +372,8 @@ &PPC::GPRCRegClass, 0 }; - // 64-bit Darwin calling convention. - static const TargetRegisterClass * const Darwin64_CalleeSavedRegClasses[] = { + // 64-bit Macho calling convention. + static const TargetRegisterClass * const Macho64_CalleeSavedRegClasses[] = { &PPC::G8RCRegClass,&PPC::G8RCRegClass, &PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass, &PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass, @@ -418,37 +395,12 @@ &PPC::G8RCRegClass, 0 }; - static const TargetRegisterClass * const ELF64_CalleeSavedRegClasses[] = { - &PPC::G8RCRegClass,&PPC::G8RCRegClass, - &PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass, - &PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass, - &PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass, - &PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass,&PPC::G8RCRegClass, - - &PPC::F8RCRegClass, - &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, - &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, - &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, - &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, - &PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass,&PPC::F8RCRegClass, - &PPC::F8RCRegClass,&PPC::F8RCRegClass, - - &PPC::CRRCRegClass,&PPC::CRRCRegClass,&PPC::CRRCRegClass, - - &PPC::VRRCRegClass,&PPC::VRRCRegClass,&PPC::VRRCRegClass,&PPC::VRRCRegClass, - &PPC::VRRCRegClass,&PPC::VRRCRegClass,&PPC::VRRCRegClass,&PPC::VRRCRegClass, - &PPC::VRRCRegClass,&PPC::VRRCRegClass,&PPC::VRRCRegClass,&PPC::VRRCRegClass, - - &PPC::G8RCRegClass, 0 - }; - if (Subtarget.isMachoABI()) - return Subtarget.isPPC64() ? Darwin64_CalleeSavedRegClasses : - Darwin32_CalleeSavedRegClasses; + return Subtarget.isPPC64() ? Macho64_CalleeSavedRegClasses : + Macho32_CalleeSavedRegClasses; - // ELF. - return Subtarget.isPPC64() ? ELF64_CalleeSavedRegClasses : - ELF32_CalleeSavedRegClasses; + // ELF 32. + return ELF32_CalleeSavedRegClasses; } // needsFP - Return true if the specified function should have a dedicated frame @@ -900,15 +852,16 @@ // Save R31 if necessary int FPSI = FI->getFramePointerSaveIndex(); bool IsPPC64 = Subtarget.isPPC64(); - bool IsELF_ABI = Subtarget.isELF_ABI(); + bool IsELF32_ABI = Subtarget.isELF32_ABI(); + bool IsMachoABI = Subtarget.isMachoABI(); const MachineFrameInfo *MFI = MF.getFrameInfo(); // If the frame pointer save index hasn't been defined yet. if (!FPSI && (NoFramePointerElim || MFI->hasVarSizedObjects()) - && IsELF_ABI) { + && IsELF32_ABI) { // Find out what the fix offset of the frame pointer save area. - int FPOffset = PPCFrameInfo::getFramePointerSaveOffset(IsPPC64, - !IsELF_ABI); + int FPOffset = PPCFrameInfo::getFramePointerSaveOffset(IsPPC64, + IsMachoABI); // Allocate the frame index for frame pointer save area. FPSI = MF.getFrameInfo()->CreateFixedObject(IsPPC64? 8 : 4, FPOffset); // Save the result. Index: llvm/lib/Target/PowerPC/PPCSubtarget.h diff -u llvm/lib/Target/PowerPC/PPCSubtarget.h:1.25 llvm/lib/Target/PowerPC/PPCSubtarget.h:1.26 --- llvm/lib/Target/PowerPC/PPCSubtarget.h:1.25 Sat Feb 24 23:04:13 2007 +++ llvm/lib/Target/PowerPC/PPCSubtarget.h Tue Apr 3 07:35:28 2007 @@ -134,8 +134,8 @@ bool isDarwin() const { return IsDarwin; } - bool isMachoABI() const { return IsDarwin; } - bool isELF_ABI() const { return !IsDarwin; } + bool isMachoABI() const { return IsDarwin || IsPPC64; } + bool isELF32_ABI() const { return !IsDarwin && !IsPPC64; } unsigned getAsmFlavor() const { return AsmFlavor != Unset ? unsigned(AsmFlavor) : 0; From lauro.venancio at gmail.com Tue Apr 3 08:49:09 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Tue, 3 Apr 2007 10:49:09 -0300 Subject: [llvm-commits] eh_arm.cc In-Reply-To: <9c10c9f0704030508t6d037a1fscdbb3cac0aaec544@mail.gmail.com> References: <124DED6F-23CB-4938-93CF-08D897B23F26@apple.com> <9c10c9f0704030508t6d037a1fscdbb3cac0aaec544@mail.gmail.com> Message-ID: <9c10c9f0704030649p607c5084r8d0b2dcb4b142133@mail.gmail.com> Files missed: ? libstdc++-v3/libsupc++/eh_arm.cc ? libstdc++-v3/libsupc++/eh_call.cc ? gcc/config/arm/libunwind.S ? gcc/config/arm/pr-support.c ? gcc/config/arm/unwind-arm.c ? gcc/config/arm/unaligned-funcs.c ? gcc/config/arm/unwind-arm.h Lauro 2007/4/3, Lauro Ramos Venancio : > The file eh_arm.cc wasn't committed. It is in the patch. I can't test > and see if other files are missing because the patch doesn't reach the > public svn yet. > > Lauro > > 2007/4/3, Devang Patel : > > > > On Apr 2, 2007, at 11:34 PM, Bill Wendling wrote: > > > > > I'm getting this error during llvm-gcc compilation: > > > > > > make[3]: *** No rule to make target `eh_arm.cc', needed by > > > `eh_arm.lo'. Stop. > > > make[3]: *** Waiting for unfinished jobs.... > > > > This is related to Lauro Ramos Venancio's patch Dale committed. > > > > - > > Devang > > _______________________________________________ > > llvm-commits mailing list > > llvm-commits at cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > From nicolas.geoffray at lip6.fr Tue Apr 3 09:00:09 2007 From: nicolas.geoffray at lip6.fr (Nicolas Geoffray) Date: Tue, 3 Apr 2007 09:00:09 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp PPCISelLowering.h Message-ID: <200704031400.l33E09Ek024682@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.267 -> 1.268 PPCISelLowering.h updated: 1.64 -> 1.65 --- Log message: Starting implementation of the ELF32 ABI specification of varargs handling. LowerVASTART emits the right code if the subtarget is ELF32, the other intrinsics (VAARG, VACOPY and VAEND) are not yet implemented. --- Diffs of the changes: (+177 -9) PPCISelLowering.cpp | 180 +++++++++++++++++++++++++++++++++++++++++++++++++--- PPCISelLowering.h | 6 + 2 files changed, 177 insertions(+), 9 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.267 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.268 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.267 Tue Apr 3 07:35:28 2007 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Tue Apr 3 08:59:52 2007 @@ -169,8 +169,13 @@ // VASTART needs to be custom lowered to use the VarArgsFrameIndex setOperationAction(ISD::VASTART , MVT::Other, Custom); + // VAARG is custom lowered with ELF 32 ABI + if (TM.getSubtarget().isELF32_ABI()) + setOperationAction(ISD::VAARG, MVT::Other, Custom); + else + setOperationAction(ISD::VAARG, MVT::Other, Expand); + // Use the default implementation. - setOperationAction(ISD::VAARG , MVT::Other, Expand); setOperationAction(ISD::VACOPY , MVT::Other, Expand); setOperationAction(ISD::VAEND , MVT::Other, Expand); setOperationAction(ISD::STACKSAVE , MVT::Other, Expand); @@ -1086,15 +1091,96 @@ return SDOperand(); } +static SDOperand LowerVAARG(SDOperand Op, SelectionDAG &DAG, + int VarArgsFrameIndex, + int VarArgsStackOffset, + unsigned VarArgsNumGPR, + unsigned VarArgsNumFPR, + const PPCSubtarget &Subtarget) { + + assert(0 && "VAARG in ELF32 ABI not implemented yet!"); +} + static SDOperand LowerVASTART(SDOperand Op, SelectionDAG &DAG, - unsigned VarArgsFrameIndex) { - // vastart just stores the address of the VarArgsFrameIndex slot into the - // memory location argument. + int VarArgsFrameIndex, + int VarArgsStackOffset, + unsigned VarArgsNumGPR, + unsigned VarArgsNumFPR, + const PPCSubtarget &Subtarget) { + + if (Subtarget.isMachoABI()) { + // vastart just stores the address of the VarArgsFrameIndex slot into the + // memory location argument. + MVT::ValueType PtrVT = DAG.getTargetLoweringInfo().getPointerTy(); + SDOperand FR = DAG.getFrameIndex(VarArgsFrameIndex, PtrVT); + SrcValueSDNode *SV = cast(Op.getOperand(2)); + return DAG.getStore(Op.getOperand(0), FR, Op.getOperand(1), SV->getValue(), + SV->getOffset()); + } + + // For ELF 32 ABI we follow the layout of the va_list struct. + // We suppose the given va_list is already allocated. + // + // typedef struct { + // char gpr; /* index into the array of 8 GPRs + // * stored in the register save area + // * gpr=0 corresponds to r3, + // * gpr=1 to r4, etc. + // */ + // char fpr; /* index into the array of 8 FPRs + // * stored in the register save area + // * fpr=0 corresponds to f1, + // * fpr=1 to f2, etc. + // */ + // char *overflow_arg_area; + // /* location on stack that holds + // * the next overflow argument + // */ + // char *reg_save_area; + // /* where r3:r10 and f1:f8 (if saved) + // * are stored + // */ + // } va_list[1]; + + + SDOperand ArgGPR = DAG.getConstant(VarArgsNumGPR, MVT::i8); + SDOperand ArgFPR = DAG.getConstant(VarArgsNumFPR, MVT::i8); + + MVT::ValueType PtrVT = DAG.getTargetLoweringInfo().getPointerTy(); + + SDOperand StackOffset = DAG.getFrameIndex(VarArgsStackOffset, PtrVT); SDOperand FR = DAG.getFrameIndex(VarArgsFrameIndex, PtrVT); + + SDOperand ConstFrameOffset = DAG.getConstant(MVT::getSizeInBits(PtrVT)/8, + PtrVT); + SDOperand ConstStackOffset = DAG.getConstant(MVT::getSizeInBits(PtrVT)/8 - 1, + PtrVT); + SDOperand ConstFPROffset = DAG.getConstant(1, PtrVT); + SrcValueSDNode *SV = cast(Op.getOperand(2)); - return DAG.getStore(Op.getOperand(0), FR, Op.getOperand(1), SV->getValue(), + + // Store first byte : number of int regs + SDOperand firstStore = DAG.getStore(Op.getOperand(0), ArgGPR, + Op.getOperand(1), SV->getValue(), + SV->getOffset()); + SDOperand nextPtr = DAG.getNode(ISD::ADD, PtrVT, Op.getOperand(1), + ConstFPROffset); + + // Store second byte : number of float regs + SDOperand secondStore = DAG.getStore(firstStore, ArgFPR, nextPtr, + SV->getValue(), SV->getOffset()); + nextPtr = DAG.getNode(ISD::ADD, PtrVT, nextPtr, ConstStackOffset); + + // Store second word : arguments given on stack + SDOperand thirdStore = DAG.getStore(secondStore, StackOffset, nextPtr, + SV->getValue(), SV->getOffset()); + nextPtr = DAG.getNode(ISD::ADD, PtrVT, nextPtr, ConstFrameOffset); + + // Store third word : arguments given in registers + return DAG.getStore(thirdStore, FR, nextPtr, SV->getValue(), SV->getOffset()); + } #include "PPCGenCallingConv.inc" @@ -1120,6 +1206,9 @@ static SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG, int &VarArgsFrameIndex, + int &VarArgsStackOffset, + unsigned &VarArgsNumGPR, + unsigned &VarArgsNumFPR, const PPCSubtarget &Subtarget) { // TODO: add description of PPC stack frame format, or at least some docs. // @@ -1287,13 +1376,47 @@ // the start of the first vararg value... for expansion of llvm.va_start. bool isVarArg = cast(Op.getOperand(2))->getValue() != 0; if (isVarArg) { + + int depth; + if (isELF32_ABI) { + VarArgsNumGPR = GPR_idx; + VarArgsNumFPR = FPR_idx; + + // Make room for Num_GPR_Regs, Num_FPR_Regs and for a possible frame + // pointer. + depth = -(Num_GPR_Regs * MVT::getSizeInBits(PtrVT)/8 + + Num_FPR_Regs * MVT::getSizeInBits(MVT::f64)/8 + + MVT::getSizeInBits(PtrVT)/8); + + VarArgsStackOffset = MFI->CreateFixedObject(MVT::getSizeInBits(PtrVT)/8, + ArgOffset); + + } + else + depth = ArgOffset; + VarArgsFrameIndex = MFI->CreateFixedObject(MVT::getSizeInBits(PtrVT)/8, - ArgOffset); + depth); SDOperand FIN = DAG.getFrameIndex(VarArgsFrameIndex, PtrVT); + + SmallVector MemOps; + + // In ELF 32 ABI, the fixed integer arguments of a variadic function are + // stored to the VarArgsFrameIndex on the stack. + if (isELF32_ABI) { + for (GPR_idx = 0; GPR_idx != VarArgsNumGPR; ++GPR_idx) { + SDOperand Val = DAG.getRegister(GPR[GPR_idx], PtrVT); + SDOperand Store = DAG.getStore(Root, Val, FIN, NULL, 0); + MemOps.push_back(Store); + // Increment the address by four for the next argument to store + SDOperand PtrOff = DAG.getConstant(MVT::getSizeInBits(PtrVT)/8, PtrVT); + FIN = DAG.getNode(ISD::ADD, PtrOff.getValueType(), FIN, PtrOff); + } + } + // If this function is vararg, store any remaining integer argument regs // to their spots on the stack so that they may be loaded by deferencing the // result of va_next. - SmallVector MemOps; for (; GPR_idx != Num_GPR_Regs; ++GPR_idx) { unsigned VReg; if (isPPC64) @@ -1309,6 +1432,35 @@ SDOperand PtrOff = DAG.getConstant(MVT::getSizeInBits(PtrVT)/8, PtrVT); FIN = DAG.getNode(ISD::ADD, PtrOff.getValueType(), FIN, PtrOff); } + + // In ELF 32 ABI, the double arguments are stored to the VarArgsFrameIndex + // on the stack. + if (isELF32_ABI) { + for (FPR_idx = 0; FPR_idx != VarArgsNumFPR; ++FPR_idx) { + SDOperand Val = DAG.getRegister(FPR[FPR_idx], MVT::f64); + SDOperand Store = DAG.getStore(Root, Val, FIN, NULL, 0); + MemOps.push_back(Store); + // Increment the address by eight for the next argument to store + SDOperand PtrOff = DAG.getConstant(MVT::getSizeInBits(MVT::f64)/8, + PtrVT); + FIN = DAG.getNode(ISD::ADD, PtrOff.getValueType(), FIN, PtrOff); + } + + for (; FPR_idx != Num_FPR_Regs; ++FPR_idx) { + unsigned VReg; + VReg = RegMap->createVirtualRegister(&PPC::F8RCRegClass); + + MF.addLiveIn(FPR[FPR_idx], VReg); + SDOperand Val = DAG.getCopyFromReg(Root, VReg, MVT::f64); + SDOperand Store = DAG.getStore(Val.getValue(1), Val, FIN, NULL, 0); + MemOps.push_back(Store); + // Increment the address by eight for the next argument to store + SDOperand PtrOff = DAG.getConstant(MVT::getSizeInBits(MVT::f64)/8, + PtrVT); + FIN = DAG.getNode(ISD::ADD, PtrOff.getValueType(), FIN, PtrOff); + } + } + if (!MemOps.empty()) Root = DAG.getNode(ISD::TokenFactor, MVT::Other,&MemOps[0],MemOps.size()); } @@ -2709,9 +2861,19 @@ case ISD::GlobalAddress: return LowerGlobalAddress(Op, DAG); case ISD::JumpTable: return LowerJumpTable(Op, DAG); case ISD::SETCC: return LowerSETCC(Op, DAG); - case ISD::VASTART: return LowerVASTART(Op, DAG, VarArgsFrameIndex); + case ISD::VASTART: + return LowerVASTART(Op, DAG, VarArgsFrameIndex, VarArgsStackOffset, + VarArgsNumGPR, VarArgsNumFPR, PPCSubTarget); + + case ISD::VAARG: + return LowerVAARG(Op, DAG, VarArgsFrameIndex, VarArgsStackOffset, + VarArgsNumGPR, VarArgsNumFPR, PPCSubTarget); + case ISD::FORMAL_ARGUMENTS: - return LowerFORMAL_ARGUMENTS(Op, DAG, VarArgsFrameIndex, PPCSubTarget); + return LowerFORMAL_ARGUMENTS(Op, DAG, VarArgsFrameIndex, + VarArgsStackOffset, VarArgsNumGPR, + VarArgsNumFPR, PPCSubTarget); + case ISD::CALL: return LowerCALL(Op, DAG, PPCSubTarget); case ISD::RET: return LowerRET(Op, DAG, getTargetMachine()); case ISD::STACKRESTORE: return LowerSTACKRESTORE(Op, DAG, PPCSubTarget); Index: llvm/lib/Target/PowerPC/PPCISelLowering.h diff -u llvm/lib/Target/PowerPC/PPCISelLowering.h:1.64 llvm/lib/Target/PowerPC/PPCISelLowering.h:1.65 --- llvm/lib/Target/PowerPC/PPCISelLowering.h:1.64 Fri Mar 30 18:15:24 2007 +++ llvm/lib/Target/PowerPC/PPCISelLowering.h Tue Apr 3 08:59:52 2007 @@ -173,6 +173,12 @@ class PPCTargetLowering : public TargetLowering { int VarArgsFrameIndex; // FrameIndex for start of varargs area. + int VarArgsStackOffset; // StackOffset for start of stack + // arguments. + unsigned VarArgsNumGPR; // Index of the first unused integer + // register for parameter passing. + unsigned VarArgsNumFPR; // Index of the first unused double + // register for parameter passing. int ReturnAddrIndex; // FrameIndex for return slot. const PPCSubtarget &PPCSubTarget; public: From lauro.venancio at gmail.com Tue Apr 3 09:48:04 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Tue, 3 Apr 2007 11:48:04 -0300 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCCallingConv.td PPCFrameInfo.h PPCISelLowering.cpp PPCInstr64Bit.td PPCRegisterInfo.cpp PPCSubtarget.h In-Reply-To: <200704031235.l33CZl4S023016@zion.cs.uiuc.edu> References: <200704031235.l33CZl4S023016@zion.cs.uiuc.edu> Message-ID: <9c10c9f0704030748h19ed9cc5k87c1666d39f2c8f9@mail.gmail.com> > @@ -46,9 +46,9 @@ > if (isMacho) > return LP64 ? 40 : 20; > > - // For ELF ABI: > + // For ELF 32 ABI: > // Save it right before the link register > - return LP64 ? -8 : -4; > + return -4; > } This function is unsigned and it is returning a negative value. Lauro From reid at x10sys.com Tue Apr 3 12:05:36 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 12:05:36 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704031705.l33H5aQF028545@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.34 -> 1.35 --- Log message: Add links into the agenda and fix the table tags there. Mention Oscar's brief talk. --- Diffs of the changes: (+12 -10) DevMtgMay2007.html | 22 ++++++++++++---------- 1 files changed, 12 insertions(+), 10 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.34 llvm-www/DevMtgMay2007.html:1.35 --- llvm-www/DevMtgMay2007.html:1.34 Tue Apr 3 02:56:27 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 12:05:19 2007 @@ -63,15 +63,15 @@ - - - - - - - - - + + + + + + + + +
        StartStopDescription
        08:0008:45Meet - Greet
        08:4509:00Session 0: LLVM History
        09:0010:30Session 1: Introductions
        10:3011:00Break - Informal Discussions
        11:0012:00Session 2: Learning LLVM
        12:0013:00Lunch Break
        13:0015:00Session 3: Using LLVM
        15:0015:30Break - Informal Discussions
        15:3017:00Session 4: Improving LLVM
        17:0018:00Wrap up - Social Time
        08:4509:00Session 0: LLVM History
        09:0010:30Session 1: Introductions
        10:3011:00Break - Informal Discussions
        11:0012:00Session 2: Learning LLVM
        12:0013:00Lunch Break
        13:0015:00Session 3: Using LLVM
        15:0015:30Break - Informal Discussions
        15:3017:00Session 4: Improving LLVM
        17:0018:00Wrap up - Social Time
        18:0021:00Dinner (Optional)
        @@ -82,6 +82,8 @@ of LLVM) will present a brief and casual history of how LLVM got from an idea in the back of Chris' brain in 2000 to an up-and-coming Open Source project in 2007.

        +

        Also featured in this session will be a brief talk by Oscar describing his + plans for world domination.

        @@ -261,6 +263,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
        Last modified: $Date: 2007/04/03 07:56:27 $ +
        Last modified: $Date: 2007/04/03 17:05:19 $ From reid at x10sys.com Tue Apr 3 12:09:03 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 12:09:03 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704031709.l33H93am028769@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.35 -> 1.36 --- Log message: HTML 4.01 compliance. --- Diffs of the changes: (+2 -2) DevMtgMay2007.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.35 llvm-www/DevMtgMay2007.html:1.36 --- llvm-www/DevMtgMay2007.html:1.35 Tue Apr 3 12:05:19 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 12:08:45 2007 @@ -158,7 +158,7 @@

        In addition to the planned sessions above, the following discussion topics have been submitted.

        - + @@ -263,6 +263,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!">Valid HTML 4.01! -
        Last modified: $Date: 2007/04/03 17:05:19 $ +
        Last modified: $Date: 2007/04/03 17:08:45 $ From johannes at apple.com Tue Apr 3 12:22:19 2007 From: johannes at apple.com (johannes at apple.com) Date: Tue, 3 Apr 2007 10:22:19 -0700 (PDT) Subject: [llvm-commits] [125690] missed part of ARM EABI patch Message-ID: <20070403172219.4DE2CCD33E60@src> Revision: 125690 Author: johannes Date: 2007-04-03 10:22:18 -0700 (Tue, 03 Apr 2007) Log Message: ----------- missed part of ARM EABI patch Added Paths: ----------- apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_arm.cc apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_call.cc Added: apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_arm.cc =================================================================== --- apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_arm.cc (rev 0) +++ apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_arm.cc 2007-04-03 17:22:18 UTC (rev 125690) @@ -0,0 +1,153 @@ +// -*- C++ -*- ARM specific Exception handling support routines. +// Copyright (C) 2004, 2005 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with GCC; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + +#include +#include "unwind-cxx.h" + +#ifdef __ARM_EABI_UNWINDER__ + +using namespace __cxxabiv1; + + +// Given the thrown type THROW_TYPE, pointer to a variable containing a +// pointer to the exception object THROWN_PTR_P and a type CATCH_TYPE to +// compare against, return whether or not there is a match and if so, +// update *THROWN_PTR_P. + +extern "C" __cxa_type_match_result +__cxa_type_match(_Unwind_Exception* ue_header, + const std::type_info* catch_type, + bool is_reference __attribute__((__unused__)), + void** thrown_ptr_p) +{ + if (!__is_gxx_exception_class(ue_header->exception_class)) + return ctm_failed; + + __cxa_exception* xh = __get_exception_header_from_ue(ue_header); + const std::type_info* throw_type = xh->exceptionType; + void* thrown_ptr = *thrown_ptr_p; + + // Pointer types need to adjust the actual pointer, not + // the pointer to pointer that is the exception object. + // This also has the effect of passing pointer types + // "by value" through the __cxa_begin_catch return value. + if (throw_type->__is_pointer_p()) + thrown_ptr = *(void**) thrown_ptr; + + if (catch_type->__do_catch(throw_type, &thrown_ptr, 1)) + { + *thrown_ptr_p = thrown_ptr; + + if (typeid(*catch_type) == typeid (typeid(void*))) + { + const __pointer_type_info *catch_pointer_type = + static_cast (catch_type); + const __pointer_type_info *throw_pointer_type = + static_cast (throw_type); + + if (typeid (*catch_pointer_type->__pointee) != typeid (void) + && (*catch_pointer_type->__pointee != + *throw_pointer_type->__pointee)) + return ctm_succeeded_with_ptr_to_base; + } + + return ctm_succeeded; + } + + return ctm_failed; +} + +// ABI defined routine called at the start of a cleanup handler. +extern "C" bool +__cxa_begin_cleanup(_Unwind_Exception* ue_header) +{ + __cxa_eh_globals *globals = __cxa_get_globals(); + __cxa_exception *header = __get_exception_header_from_ue(ue_header); + + if (!__is_gxx_exception_class(header->unwindHeader.exception_class)) + { + // TODO: cleanups with foreign exceptions. + return false; + } + header->propagationCount++; + // Add it to the chain if this is the first time we've seen this exception. + if (header->propagationCount == 1) + { + header->nextPropagatingException = globals->propagatingExceptions; + globals->propagatingExceptions = header; + } + return true; +} + +// Do the work for __cxa_end_cleanup. Returns the currently propagating +// exception object. +extern "C" _Unwind_Exception * +__gnu_end_cleanup(void) +{ + __cxa_exception *header; + __cxa_eh_globals *globals = __cxa_get_globals(); + + header = globals->propagatingExceptions; + + // Check something hasn't gone horribly wrong. + if (!header) + std::terminate(); + + header->propagationCount--; + if (header->propagationCount == 0) + { + // Remove exception from chain. + globals->propagatingExceptions = header->nextPropagatingException; + header->nextPropagatingException = NULL; + } + return &header->unwindHeader; +} + +// Assembly wrapper to call __gnu_end_cleanup without clobbering r1-r3. +// Also push r4 to preserve stack alignment. +#ifdef __thumb__ +asm (".global __cxa_end_cleanup\n" +" .type __cxa_end_cleanup, \"function\"\n" +" .thumb_func\n" +"__cxa_end_cleanup:\n" +" push\t{r1, r2, r3, r4}\n" +" bl\t__gnu_end_cleanup\n" +" pop\t{r1, r2, r3, r4}\n" +" bl\t_Unwind_Resume @ Never returns\n"); +#else +asm (".global __cxa_end_cleanup\n" +" .type __cxa_end_cleanup, \"function\"\n" +"__cxa_end_cleanup:\n" +" stmfd\tsp!, {r1, r2, r3, r4}\n" +" bl\t__gnu_end_cleanup\n" +" ldmfd\tsp!, {r1, r2, r3, r4}\n" +" bl\t_Unwind_Resume @ Never returns\n"); +#endif + +#endif Added: apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_call.cc =================================================================== --- apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_call.cc (rev 0) +++ apple-local/branches/llvm/libstdc++-v3/libsupc++/eh_call.cc 2007-04-03 17:22:18 UTC (rev 125690) @@ -0,0 +1,162 @@ +// -*- C++ -*- Helpers for calling unextected and terminate +// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +// +// This file is part of GCC. +// +// GCC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// GCC is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with GCC; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +// As a special exception, you may use this file as part of a free software +// library without restriction. Specifically, if other files instantiate +// templates or use macros or inline functions from this file, or you compile +// this file and link it with other files to produce an executable, this +// file does not by itself cause the resulting executable to be covered by +// the GNU General Public License. This exception does not however +// invalidate any other reasons why the executable file might be covered by +// the GNU General Public License. + + +#include +#include +#include +#include "unwind-cxx.h" + +using namespace __cxxabiv1; + +#include "unwind-pe.h" + + +// Helper routine for when the exception handling code needs to call +// terminate. + +extern "C" void +__cxa_call_terminate(_Unwind_Exception* ue_header) +{ + + if (ue_header) + { + // terminate is classed as a catch handler. + __cxa_begin_catch(ue_header); + + // Call the terminate handler that was in effect when we threw this + // exception. */ + if (__is_gxx_exception_class(ue_header->exception_class)) + { + __cxa_exception* xh; + + xh = __get_exception_header_from_ue(ue_header); + __terminate(xh->terminateHandler); + } + } + /* Call the global routine if we don't have anything better. */ + std::terminate(); +} + + +#ifdef __ARM_EABI_UNWINDER__ +// The ARM EABI __cxa_call_unexpected has the same semantics as the generic +// routine, but the exception specification has a different format. +extern "C" void +__cxa_call_unexpected(void* exc_obj_in) +{ + _Unwind_Exception* exc_obj + = reinterpret_cast<_Unwind_Exception*>(exc_obj_in); + + int rtti_count = 0; + _Unwind_Word rtti_stride = 0; + _Unwind_Word* rtti_list = NULL; + bool foreign_exception; + std::unexpected_handler unexpectedHandler = NULL; + std::terminate_handler terminateHandler = NULL; + __cxa_exception* xh; + if (__is_gxx_exception_class(exc_obj->exception_class)) + { + // Save data from the EO, which may be clobbered by _cxa_begin_catch. + xh = __get_exception_header_from_ue(exc_obj); + unexpectedHandler = xh->unexpectedHandler; + terminateHandler = xh->terminateHandler; + rtti_count = exc_obj->barrier_cache.bitpattern[1]; + + rtti_stride = exc_obj->barrier_cache.bitpattern[3]; + rtti_list = (_Unwind_Word*) exc_obj->barrier_cache.bitpattern[4]; + foreign_exception = false; + } + else + foreign_exception = true; + + /* This must be called after extracting data from the EO, but before + calling unexpected(). */ + __cxa_begin_catch(exc_obj); + + // This function is a handler for our exception argument. If we exit + // by throwing a different exception, we'll need the original cleaned up. + struct end_catch_protect + { + end_catch_protect() { } + ~end_catch_protect() { __cxa_end_catch(); } + } end_catch_protect_obj; + + + try + { + if (foreign_exception) + std::unexpected(); + else + __unexpected(unexpectedHandler); + } + catch(...) + { + /* See if the new exception matches the rtti list. */ + if (foreign_exception) + std::terminate(); + + // Get the exception thrown from unexpected. + + __cxa_eh_globals* globals = __cxa_get_globals_fast(); + __cxa_exception* new_xh = globals->caughtExceptions; + void* new_ptr = new_xh + 1; + const std::type_info* catch_type; + int n; + bool bad_exception_allowed = false; + const std::type_info& bad_exc = typeid(std::bad_exception); + + // Check the new exception against the rtti list + for (n = 0; n < rtti_count; n++) + { + _Unwind_Word offset; + + offset = (_Unwind_Word) &rtti_list[n * (rtti_stride >> 2)]; + offset = _Unwind_decode_target2(offset); + catch_type = (const std::type_info*) (offset); + + if (__cxa_type_match(&new_xh->unwindHeader, catch_type, false, + &new_ptr) != ctm_failed) + __throw_exception_again; + + if (catch_type->__do_catch(&bad_exc, 0, 1)) + bad_exception_allowed = true; + } + + // If the exception spec allows std::bad_exception, throw that. +#ifdef __EXCEPTIONS + if (bad_exception_allowed) + throw std::bad_exception(); +#endif + + // Otherwise, die. + __terminate(terminateHandler); + } +} +#endif // __ARM_EABI_UNWINDER__ From johannes at apple.com Tue Apr 3 12:23:51 2007 From: johannes at apple.com (johannes at apple.com) Date: Tue, 3 Apr 2007 10:23:51 -0700 (PDT) Subject: [llvm-commits] [125691] missing files from ARM EABI patch Message-ID: <20070403172351.DA83BCD33F3A@src> Revision: 125691 Author: johannes Date: 2007-04-03 10:23:51 -0700 (Tue, 03 Apr 2007) Log Message: ----------- missing files from ARM EABI patch Added Paths: ----------- apple-local/branches/llvm/gcc/config/arm/libunwind.S apple-local/branches/llvm/gcc/config/arm/pr-support.c apple-local/branches/llvm/gcc/config/arm/unaligned-funcs.c apple-local/branches/llvm/gcc/config/arm/unwind-arm.c apple-local/branches/llvm/gcc/config/arm/unwind-arm.h Added: apple-local/branches/llvm/gcc/config/arm/libunwind.S =================================================================== --- apple-local/branches/llvm/gcc/config/arm/libunwind.S (rev 0) +++ apple-local/branches/llvm/gcc/config/arm/libunwind.S 2007-04-03 17:23:51 UTC (rev 125691) @@ -0,0 +1,116 @@ +/* Support functions for the unwinder. + Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Contributed by Paul Brook + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + In addition to the permissions in the GNU General Public License, the + Free Software Foundation gives you unlimited permission to link the + compiled version of this file into combinations with other programs, + and to distribute those combinations without any restriction coming + from the use of this file. (The General Public License restrictions + do apply in other respects; for example, they cover modification of + the file, and distribution when not linked into a combine + executable.) + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifdef L_unwind + +.macro UNPREFIX name + .global SYM (\name) + EQUIV SYM (\name), SYM (__\name) +.endm + +/* r0 points to a 16-word block. Upload these values to the actual core + state. */ +ARM_FUNC_START restore_core_regs + /* We must use sp as the base register when restoring sp. Push the + last 3 registers onto the top of the current stack to achieve + this. */ + add r1, r0, #52 + ldmia r1, {r3, r4, r5} /* {sp, lr, pc}. */ +#ifdef __INTERWORKING__ + /* Restore pc into ip. */ + mov r2, r5 + stmfd sp!, {r2, r3, r4} +#else + stmfd sp!, {r3, r4, r5} +#endif + /* Don't bother restoring ip. */ + ldmia r0, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp} + /* Pop the three registers we pushed earlier. */ +#ifdef __INTERWORKING__ + ldmfd sp, {ip, sp, lr} + bx ip +#else + ldmfd sp, {sp, lr, pc} +#endif + FUNC_END restore_core_regs + UNPREFIX restore_core_regs + +/* Load VFP registers d0-d15 from the address in r0. */ +ARM_FUNC_START gnu_Unwind_Restore_VFP + /* Use the generic coprocessor form so that gas doesn't complain + on soft-float targets. */ + ldc p11,cr0,[r0],{0x21} /* fldmiax r0, {d0-d15} */ + RET + +/* Store VFR regsters d0-d15 to the address in r0. */ +ARM_FUNC_START gnu_Unwind_Save_VFP + /* Use the generic coprocessor form so that gas doesn't complain + on soft-float targets. */ + stc p11,cr0,[r0],{0x21} /* fstmiax r0, {d0-d15} */ + RET + +/* Wrappers to save core registers, then call the real routine. */ + +.macro UNWIND_WRAPPER name + ARM_FUNC_START \name + /* Create a phase2_vrs structure. */ + /* Split reg push in two to ensure the correct value for sp. */ + stmfd sp!, {sp, lr, pc} + stmfd sp!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, sl, fp, ip} + + /* Demand-save flags, plus an extra word for alignment. */ + mov r3, #0 + stmfd sp!, {r2, r3} + + /* Point r1 at the block. Pass r0 unchanged. */ + add r1, sp, #4 +#if defined(__thumb__) + /* Switch back to thumb mode to avoid interworking hassle. */ + adr ip, .L1_\name + orr ip, ip, #1 + bx ip + .thumb +.L1_\name: + bl SYM (__gnu\name) __PLT__ + ldr r3, [sp, #64] + add sp, #72 + bx r3 +#else + bl SYM (__gnu\name) __PLT__ + ldr lr, [sp, #64] + add sp, sp, #72 + RET +#endif + FUNC_END \name + UNPREFIX \name +.endm + +UNWIND_WRAPPER _Unwind_RaiseException +UNWIND_WRAPPER _Unwind_Resume + +#endif /* L_unwind */ Added: apple-local/branches/llvm/gcc/config/arm/pr-support.c =================================================================== --- apple-local/branches/llvm/gcc/config/arm/pr-support.c (rev 0) +++ apple-local/branches/llvm/gcc/config/arm/pr-support.c 2007-04-03 17:23:51 UTC (rev 125691) @@ -0,0 +1,377 @@ +/* ARM EABI compliant unwinding routines + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Contributed by Paul Brook + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + In addition to the permissions in the GNU General Public License, the + Free Software Foundation gives you unlimited permission to link the + compiled version of this file into combinations with other programs, + and to distribute those combinations without any restriction coming + from the use of this file. (The General Public License restrictions + do apply in other respects; for example, they cover modification of + the file, and distribution when not linked into a combine + executable.) + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ +#include "unwind.h" + +typedef struct _ZSt9type_info type_info; /* This names C++ type_info type */ + +/* Misc constants. */ +#define R_IP 12 +#define R_SP 13 +#define R_LR 14 +#define R_PC 15 + +#define uint32_highbit (((_uw) 1) << 31) + +void __attribute__((weak)) __cxa_call_unexpected(_Unwind_Control_Block *ucbp); + +/* Unwind descriptors. */ + +typedef struct +{ + _uw16 length; + _uw16 offset; +} EHT16; + +typedef struct +{ + _uw length; + _uw offset; +} EHT32; + +/* Calculate the address encoded by a 31-bit self-relative offset at address + P. Copy of routine in unwind-arm.c. */ + +static inline _uw +selfrel_offset31 (const _uw *p) +{ + _uw offset; + + offset = *p; + /* Sign extend to 32 bits. */ + if (offset & (1 << 30)) + offset |= 1u << 31; + + return offset + (_uw) p; +} + + +/* Personality routine helper functions. */ + +#define CODE_FINISH (0xb0) + +/* Return the next byte of unwinding information, or CODE_FINISH if there is + no data remaining. */ +static inline _uw8 +next_unwind_byte (__gnu_unwind_state * uws) +{ + _uw8 b; + + if (uws->bytes_left == 0) + { + /* Load another word */ + if (uws->words_left == 0) + return CODE_FINISH; /* Nothing left. */ + uws->words_left--; + uws->data = *(uws->next++); + uws->bytes_left = 3; + } + else + uws->bytes_left--; + + /* Extract the most significant byte. */ + b = (uws->data >> 24) & 0xff; + uws->data <<= 8; + return b; +} + +/* Execute the unwinding instructions described by UWS. */ +_Unwind_Reason_Code +__gnu_unwind_execute (_Unwind_Context * context, __gnu_unwind_state * uws) +{ + _uw op; + int set_pc; + _uw reg; + + set_pc = 0; + for (;;) + { + op = next_unwind_byte (uws); + if (op == CODE_FINISH) + { + /* If we haven't already set pc then copy it from lr. */ + if (!set_pc) + { + _Unwind_VRS_Get (context, _UVRSC_CORE, R_LR, _UVRSD_UINT32, + ®); + _Unwind_VRS_Set (context, _UVRSC_CORE, R_PC, _UVRSD_UINT32, + ®); + set_pc = 1; + } + /* Drop out of the loop. */ + break; + } + if ((op & 0x80) == 0) + { + /* vsp = vsp +- (imm6 << 2 + 4). */ + _uw offset; + + offset = ((op & 0x3f) << 2) + 4; + _Unwind_VRS_Get (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, ®); + if (op & 0x40) + reg -= offset; + else + reg += offset; + _Unwind_VRS_Set (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, ®); + continue; + } + + if ((op & 0xf0) == 0x80) + { + op = (op << 8) | next_unwind_byte (uws); + if (op == 0x8000) + { + /* Refuse to unwind. */ + return _URC_FAILURE; + } + /* Pop r4-r15 under mask. */ + op = (op << 4) & 0xfff0; + if (_Unwind_VRS_Pop (context, _UVRSC_CORE, op, _UVRSD_UINT32) + != _UVRSR_OK) + return _URC_FAILURE; + if (op & (1 << R_PC)) + set_pc = 1; + continue; + } + if ((op & 0xf0) == 0x90) + { + op &= 0xf; + if (op == 13 || op == 15) + /* Reserved. */ + return _URC_FAILURE; + /* vsp = r[nnnn]. */ + _Unwind_VRS_Get (context, _UVRSC_CORE, op, _UVRSD_UINT32, ®); + _Unwind_VRS_Set (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, ®); + continue; + } + if ((op & 0xf0) == 0xa0) + { + /* Pop r4-r[4+nnn], [lr]. */ + _uw mask; + + mask = (0xff0 >> (7 - (op & 7))) & 0xff0; + if (op & 8) + mask |= (1 << R_LR); + if (_Unwind_VRS_Pop (context, _UVRSC_CORE, mask, _UVRSD_UINT32) + != _UVRSR_OK) + return _URC_FAILURE; + continue; + } + if ((op & 0xf0) == 0xb0) + { + /* op == 0xb0 already handled. */ + if (op == 0xb1) + { + op = next_unwind_byte (uws); + if (op == 0 || ((op & 0xf0) != 0)) + /* Spare. */ + return _URC_FAILURE; + /* Pop r0-r4 under mask. */ + if (_Unwind_VRS_Pop (context, _UVRSC_CORE, op, _UVRSD_UINT32) + != _UVRSR_OK) + return _URC_FAILURE; + continue; + } + if (op == 0xb2) + { + /* vsp = vsp + 0x204 + (uleb128 << 2). */ + int shift; + + _Unwind_VRS_Get (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, + ®); + op = next_unwind_byte (uws); + shift = 2; + while (op & 0x80) + { + reg += ((op & 0x7f) << shift); + shift += 7; + op = next_unwind_byte (uws); + } + reg += ((op & 0x7f) << shift) + 0x204; + _Unwind_VRS_Set (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, + ®); + continue; + } + if (op == 0xb3) + { + /* Pop VFP registers with fldmx. */ + op = next_unwind_byte (uws); + op = ((op & 0xf0) << 12) | (op & 0xf); + if (_Unwind_VRS_Pop (context, _UVRSC_VFP, op, _UVRSD_VFPX) + != _UVRSR_OK) + return _URC_FAILURE; + continue; + } + if ((op & 0xfc) == 0xb4) + { + /* Pop FPA E[4]-E[4+nn]. */ + op = 0x40000 | ((op & 3) + 1); + if (_Unwind_VRS_Pop (context, _UVRSC_FPA, op, _UVRSD_FPAX) + != _UVRSR_OK) + return _URC_FAILURE; + continue; + } + /* op & 0xf8 == 0xb8. */ + /* Pop VFP D[8]-D[8+nnn] with fldmx. */ + op = 0x80000 | ((op & 7) + 1); + if (_Unwind_VRS_Pop (context, _UVRSC_VFP, op, _UVRSD_VFPX) + != _UVRSR_OK) + return _URC_FAILURE; + continue; + } + if ((op & 0xf0) == 0xc0) + { + if (op == 0xc6) + { + /* Pop iWMMXt D registers. */ + op = next_unwind_byte (uws); + op = ((op & 0xf0) << 12) | (op & 0xf); + if (_Unwind_VRS_Pop (context, _UVRSC_WMMXD, op, _UVRSD_UINT64) + != _UVRSR_OK) + return _URC_FAILURE; + continue; + } + if (op == 0xc7) + { + op = next_unwind_byte (uws); + if (op == 0 || (op & 0xf0) != 0) + /* Spare. */ + return _URC_FAILURE; + /* Pop iWMMXt wCGR{3,2,1,0} under mask. */ + if (_Unwind_VRS_Pop (context, _UVRSC_WMMXC, op, _UVRSD_UINT32) + != _UVRSR_OK) + return _URC_FAILURE; + continue; + } + if ((op & 0xf8) == 0xc0) + { + /* Pop iWMMXt wR[10]-wR[10+nnn]. */ + op = 0xa0000 | ((op & 0xf) + 1); + if (_Unwind_VRS_Pop (context, _UVRSC_WMMXD, op, _UVRSD_UINT64) + != _UVRSR_OK) + return _URC_FAILURE; + continue; + } + if (op == 0xc8) + { + /* Pop FPA registers. */ + op = next_unwind_byte (uws); + op = ((op & 0xf0) << 12) | (op & 0xf); + if (_Unwind_VRS_Pop (context, _UVRSC_FPA, op, _UVRSD_FPAX) + != _UVRSR_OK) + return _URC_FAILURE; + continue; + } + if (op == 0xc9) + { + /* Pop VFP registers with fldmd. */ + op = next_unwind_byte (uws); + op = ((op & 0xf0) << 12) | (op & 0xf); + if (_Unwind_VRS_Pop (context, _UVRSC_VFP, op, _UVRSD_DOUBLE) + != _UVRSR_OK) + return _URC_FAILURE; + continue; + } + /* Spare. */ + return _URC_FAILURE; + } + if ((op & 0xf8) == 0xd0) + { + /* Pop VFP D[8]-D[8+nnn] with fldmd. */ + op = 0x80000 | ((op & 7) + 1); + if (_Unwind_VRS_Pop (context, _UVRSC_VFP, op, _UVRSD_DOUBLE) + != _UVRSR_OK) + return _URC_FAILURE; + continue; + } + /* Spare. */ + return _URC_FAILURE; + } + return _URC_OK; +} + + +/* Execute the unwinding instructions associated with a frame. UCBP and + CONTEXT are the current exception object and virtual CPU state + respectively. */ + +_Unwind_Reason_Code +__gnu_unwind_frame (_Unwind_Control_Block * ucbp, _Unwind_Context * context) +{ + _uw *ptr; + __gnu_unwind_state uws; + + ptr = (_uw *) ucbp->pr_cache.ehtp; + /* Skip over the personality routine address. */ + ptr++; + /* Setup the unwinder state. */ + uws.data = (*ptr) << 8; + uws.next = ptr + 1; + uws.bytes_left = 3; + uws.words_left = ((*ptr) >> 24) & 0xff; + + return __gnu_unwind_execute (context, &uws); +} + +/* Get the _Unwind_Control_Block from an _Unwind_Context. */ + +static inline _Unwind_Control_Block * +unwind_UCB_from_context (_Unwind_Context * context) +{ + return (_Unwind_Control_Block *) _Unwind_GetGR (context, R_IP); +} + +/* Get the start address of the function being unwound. */ + +_Unwind_Ptr +_Unwind_GetRegionStart (_Unwind_Context * context) +{ + _Unwind_Control_Block *ucbp; + + ucbp = unwind_UCB_from_context (context); + return (_Unwind_Ptr) ucbp->pr_cache.fnstart; +} + +/* Find the Language specific exception data. */ + +void * +_Unwind_GetLanguageSpecificData (_Unwind_Context * context) +{ + _Unwind_Control_Block *ucbp; + _uw *ptr; + + /* Get a pointer to the exception table entry. */ + ucbp = unwind_UCB_from_context (context); + ptr = (_uw *) ucbp->pr_cache.ehtp; + /* Skip the personality routine address. */ + ptr++; + /* Skip the unwind opcodes. */ + ptr += (((*ptr) >> 24) & 0xff) + 1; + + return ptr; +} + Added: apple-local/branches/llvm/gcc/config/arm/unaligned-funcs.c =================================================================== --- apple-local/branches/llvm/gcc/config/arm/unaligned-funcs.c (rev 0) +++ apple-local/branches/llvm/gcc/config/arm/unaligned-funcs.c 2007-04-03 17:23:51 UTC (rev 125691) @@ -0,0 +1,62 @@ +/* EABI unaligned read/write functions. + + Copyright (C) 2005 Free Software Foundation, Inc. + Contributed by CodeSourcery, LLC. + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + In addition to the permissions in the GNU General Public License, the + Free Software Foundation gives you unlimited permission to link the + compiled version of this file into combinations with other programs, + and to distribute those combinations without any restriction coming + from the use of this file. (The General Public License restrictions + do apply in other respects; for example, they cover modification of + the file, and distribution when not linked into a combine + executable.) + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +int __aeabi_uread4 (void *); +int __aeabi_uwrite4 (int, void *); +long long __aeabi_uread8 (void *); +long long __aeabi_uwrite8 (long long, void *); + +struct __attribute__((packed)) u4 { int data; }; +struct __attribute__((packed)) u8 { long long data; }; + +int +__aeabi_uread4 (void *ptr) +{ + return ((struct u4 *) ptr)->data; +} + +int +__aeabi_uwrite4 (int data, void *ptr) +{ + ((struct u4 *) ptr)->data = data; + return data; +} + +long long +__aeabi_uread8 (void *ptr) +{ + return ((struct u8 *) ptr)->data; +} + +long long +__aeabi_uwrite8 (long long data, void *ptr) +{ + ((struct u8 *) ptr)->data = data; + return data; +} Added: apple-local/branches/llvm/gcc/config/arm/unwind-arm.c =================================================================== --- apple-local/branches/llvm/gcc/config/arm/unwind-arm.c (rev 0) +++ apple-local/branches/llvm/gcc/config/arm/unwind-arm.c 2007-04-03 17:23:51 UTC (rev 125691) @@ -0,0 +1,855 @@ +/* ARM EABI compliant unwinding routines. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + Contributed by Paul Brook + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + In addition to the permissions in the GNU General Public License, the + Free Software Foundation gives you unlimited permission to link the + compiled version of this file into combinations with other programs, + and to distribute those combinations without any restriction coming + from the use of this file. (The General Public License restrictions + do apply in other respects; for example, they cover modification of + the file, and distribution when not linked into a combine + executable.) + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ +#include "unwind.h" + +/* Definitions for C++ runtime support routines. We make these weak + declarations to avoid pulling in libsupc++ unneccesarily. */ +typedef unsigned char bool; + +typedef struct _ZSt9type_info type_info; /* This names C++ type_info type */ + +void __attribute__((weak)) __cxa_call_unexpected(_Unwind_Control_Block *ucbp); +bool __attribute__((weak)) __cxa_begin_cleanup(_Unwind_Control_Block *ucbp); +bool __attribute__((weak)) __cxa_type_match(_Unwind_Control_Block *ucbp, + const type_info *rttip, + void **matched_object); + +_Unwind_Ptr __attribute__((weak)) +__gnu_Unwind_Find_exidx (_Unwind_Ptr, int *); + +/* Misc constants. */ +#define R_IP 12 +#define R_SP 13 +#define R_LR 14 +#define R_PC 15 + +#define EXIDX_CANTUNWIND 1 +#define uint32_highbit (((_uw) 1) << 31) + +#define UCB_PR_ADDR(ucbp) ((ucbp)->unwinder_cache.reserved2) +#define UCB_SAVED_CALLSITE_ADDR(ucbp) ((ucbp)->unwinder_cache.reserved3) + +struct core_regs +{ + _uw r[16]; +}; + +/* We use normal integer types here to avoid the compiler generating + coprocessor instructions. */ +struct vfp_regs +{ + _uw64 d[16]; + _uw pad; +}; + +struct fpa_reg +{ + _uw w[3]; +}; + +struct fpa_regs +{ + struct fpa_reg f[8]; +}; + +/* Unwind descriptors. */ + +typedef struct +{ + _uw16 length; + _uw16 offset; +} EHT16; + +typedef struct +{ + _uw length; + _uw offset; +} EHT32; + +/* The ABI specifies that the unwind routines may only use core registers, + except when actually manipulating coprocessor state. This allows + us to write one implementation that works on all platforms by + demand-saving coprocessor registers. + + During unwinding we hold the coprocessor state in the actual hardware + registers and allocate demand-save areas for use during phase1 + unwinding. */ + +typedef struct +{ + /* The first fields must be the same as a phase2_vrs. */ + _uw demand_save_flags; + struct core_regs core; + struct vfp_regs vfp; + struct fpa_regs fpa; +} phase1_vrs; + +#define DEMAND_SAVE_VFP 1 + +/* This must match the structure created by the assembly wrappers. */ +typedef struct +{ + _uw demand_save_flags; + struct core_regs core; +} phase2_vrs; + + +/* An exeption index table entry. */ + +typedef struct __EIT_entry +{ + _uw fnoffset; + _uw content; +} __EIT_entry; + +/* Assembly helper functions. */ + +/* Restore core register state. Never returns. */ +void __attribute__((noreturn)) restore_core_regs (struct core_regs *); + + +/* Coprocessor register state manipulation functions. */ + +void __gnu_Unwind_Save_VFP (struct vfp_regs * p); +void __gnu_Unwind_Restore_VFP (struct vfp_regs * p); + +/* Restore coprocessor state after phase1 unwinding. */ +static void +restore_non_core_regs (phase1_vrs * vrs) +{ + if ((vrs->demand_save_flags & DEMAND_SAVE_VFP) == 0) + __gnu_Unwind_Restore_VFP (&vrs->vfp); +} + +/* A better way to do this would probably be to compare the absolute address + with a segment relative relocation of the same symbol. */ + +extern int __text_start; +extern int __data_start; + +/* The exception index table location. */ +extern __EIT_entry __exidx_start; +extern __EIT_entry __exidx_end; + +/* ABI defined personality routines. */ +extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr0 (_Unwind_State, + _Unwind_Control_Block *, _Unwind_Context *);// __attribute__((weak)); +extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr1 (_Unwind_State, + _Unwind_Control_Block *, _Unwind_Context *) __attribute__((weak)); +extern _Unwind_Reason_Code __aeabi_unwind_cpp_pr2 (_Unwind_State, + _Unwind_Control_Block *, _Unwind_Context *) __attribute__((weak)); + +/* ABI defined routine to store a virtual register to memory. */ + +_Unwind_VRS_Result _Unwind_VRS_Get (_Unwind_Context *context, + _Unwind_VRS_RegClass regclass, + _uw regno, + _Unwind_VRS_DataRepresentation representation, + void *valuep) +{ + phase1_vrs *vrs = (phase1_vrs *) context; + + switch (regclass) + { + case _UVRSC_CORE: + if (representation != _UVRSD_UINT32 + || regno > 15) + return _UVRSR_FAILED; + *(_uw *) valuep = vrs->core.r[regno]; + return _UVRSR_OK; + + case _UVRSC_VFP: + case _UVRSC_FPA: + case _UVRSC_WMMXD: + case _UVRSC_WMMXC: + return _UVRSR_NOT_IMPLEMENTED; + + default: + return _UVRSR_FAILED; + } +} + + +/* ABI defined function to load a virtual register from memory. */ + +_Unwind_VRS_Result _Unwind_VRS_Set (_Unwind_Context *context, + _Unwind_VRS_RegClass regclass, + _uw regno, + _Unwind_VRS_DataRepresentation representation, + void *valuep) +{ + phase1_vrs *vrs = (phase1_vrs *) context; + + switch (regclass) + { + case _UVRSC_CORE: + if (representation != _UVRSD_UINT32 + || regno > 15) + return _UVRSR_FAILED; + + vrs->core.r[regno] = *(_uw *) valuep; + return _UVRSR_OK; + + case _UVRSC_VFP: + case _UVRSC_FPA: + case _UVRSC_WMMXD: + case _UVRSC_WMMXC: + return _UVRSR_NOT_IMPLEMENTED; + + default: + return _UVRSR_FAILED; + } +} + + +/* ABI defined function to pop registers off the stack. */ + +_Unwind_VRS_Result _Unwind_VRS_Pop (_Unwind_Context *context, + _Unwind_VRS_RegClass regclass, + _uw discriminator, + _Unwind_VRS_DataRepresentation representation) +{ + phase1_vrs *vrs = (phase1_vrs *) context; + + switch (regclass) + { + case _UVRSC_CORE: + { + _uw *ptr; + _uw mask; + int i; + + if (representation != _UVRSD_UINT32) + return _UVRSR_FAILED; + + mask = discriminator & 0xffff; + ptr = (_uw *) vrs->core.r[R_SP]; + /* Pop the requested registers. */ + for (i = 0; i < 16; i++) + { + if (mask & (1 << i)) + vrs->core.r[i] = *(ptr++); + } + /* Writeback the stack pointer value if it wasn't restored. */ + if ((mask & (1 << R_SP)) == 0) + vrs->core.r[R_SP] = (_uw) ptr; + } + return _UVRSR_OK; + + case _UVRSC_VFP: + { + _uw start = discriminator >> 16; + _uw count = discriminator & 0xffff; + struct vfp_regs tmp; + _uw *sp; + _uw *dest; + + if ((representation != _UVRSD_VFPX && representation != _UVRSD_DOUBLE) + || start + count > 16) + return _UVRSR_FAILED; + + if (vrs->demand_save_flags & DEMAND_SAVE_VFP) + { + /* Demand-save resisters for stage1. */ + vrs->demand_save_flags &= ~DEMAND_SAVE_VFP; + __gnu_Unwind_Save_VFP (&vrs->vfp); + } + + /* Restore the registers from the stack. Do this by saving the + current VFP registers to a memory area, moving the in-memory + values into that area, and restoring from the whole area. + For _UVRSD_VFPX we assume FSTMX standard format 1. */ + __gnu_Unwind_Save_VFP (&tmp); + + /* The stack address is only guaranteed to be word aligned, so + we can't use doubleword copies. */ + sp = (_uw *) vrs->core.r[R_SP]; + dest = (_uw *) &tmp.d[start]; + count *= 2; + while (count--) + *(dest++) = *(sp++); + + /* Skip the pad word */ + if (representation == _UVRSD_VFPX) + sp++; + + /* Set the new stack pointer. */ + vrs->core.r[R_SP] = (_uw) sp; + + /* Reload the registers. */ + __gnu_Unwind_Restore_VFP (&tmp); + } + return _UVRSR_OK; + + case _UVRSC_FPA: + case _UVRSC_WMMXD: + case _UVRSC_WMMXC: + return _UVRSR_NOT_IMPLEMENTED; + + default: + return _UVRSR_FAILED; + } +} + + +/* Core unwinding functions. */ + +/* Calculate the address encoded by a 31-bit self-relative offset at address + P. */ +static inline _uw +selfrel_offset31 (const _uw *p) +{ + _uw offset; + + offset = *p; + /* Sign extend to 32 bits. */ + if (offset & (1 << 30)) + offset |= 1u << 31; + + return offset + (_uw) p; +} + + +/* Perform a binary search for RETURN_ADDRESS in TABLE. The table contains + NREC entries. */ + +static const __EIT_entry * +search_EIT_table (const __EIT_entry * table, int nrec, _uw return_address) +{ + _uw next_fn; + _uw this_fn; + int n, left, right; + + if (nrec == 0) + return (__EIT_entry *) 0; + + left = 0; + right = nrec - 1; + + while (1) + { + n = (left + right) / 2; + this_fn = selfrel_offset31 (&table[n].fnoffset); + if (n != nrec - 1) + next_fn = selfrel_offset31 (&table[n + 1].fnoffset); + else + next_fn = ~(_uw) 0; + + if (return_address < this_fn) + { + if (n == left) + return (__EIT_entry *) 0; + right = n - 1; + } + else if (return_address < next_fn) + return &table[n]; + else + left = n + 1; + } +} + +/* Find the exception index table eintry for the given address. + Fill in the relevant fields of the UCB. + Returns _URC_FAILURE if an error occured, _URC_OK on success*/ + +static _Unwind_Reason_Code +get_eit_entry (_Unwind_Control_Block *ucbp, _uw return_address) +{ + const __EIT_entry * eitp; + int nrec; + + /* The return address is the address of the instruction following the + call instruction (plus one in thumb mode). If this was the last + instruction in the function the address will lie in the following + function. Subtract 2 from the address so that it points within the call + instruction itself. */ + return_address -= 2; + + if (__gnu_Unwind_Find_exidx) + { + eitp = (const __EIT_entry *) __gnu_Unwind_Find_exidx (return_address, + &nrec); + if (!eitp) + { + UCB_PR_ADDR (ucbp) = 0; + return _URC_FAILURE; + } + } + else + { + eitp = &__exidx_start; + nrec = &__exidx_end - &__exidx_start; + } + + eitp = search_EIT_table (eitp, nrec, return_address); + + if (!eitp) + { + UCB_PR_ADDR (ucbp) = 0; + return _URC_FAILURE; + } + ucbp->pr_cache.fnstart = selfrel_offset31 (&eitp->fnoffset); + + /* Can this frame be unwound at all? */ + if (eitp->content == EXIDX_CANTUNWIND) + { + UCB_PR_ADDR (ucbp) = 0; + return _URC_FAILURE; + } + + /* Obtain the address of the "real" __EHT_Header word. */ + + if (eitp->content & uint32_highbit) + { + /* It is immediate data. */ + ucbp->pr_cache.ehtp = (_Unwind_EHT_Header *)&eitp->content; + ucbp->pr_cache.additional = 1; + } + else + { + /* The low 31 bits of the content field are a self-relative + offset to an _Unwind_EHT_Entry structure. */ + ucbp->pr_cache.ehtp = + (_Unwind_EHT_Header *) selfrel_offset31 (&eitp->content); + ucbp->pr_cache.additional = 0; + } + + /* Discover the personality routine address. */ + if (*ucbp->pr_cache.ehtp & (1u << 31)) + { + /* One of the predefined standard routines. */ + _uw idx = (*(_uw *) ucbp->pr_cache.ehtp >> 24) & 0xf; + if (idx == 0) + UCB_PR_ADDR (ucbp) = (_uw) &__aeabi_unwind_cpp_pr0; + else if (idx == 1) + UCB_PR_ADDR (ucbp) = (_uw) &__aeabi_unwind_cpp_pr1; + else if (idx == 2) + UCB_PR_ADDR (ucbp) = (_uw) &__aeabi_unwind_cpp_pr2; + else + { /* Failed */ + UCB_PR_ADDR (ucbp) = 0; + return _URC_FAILURE; + } + } + else + { + /* Execute region offset to PR */ + UCB_PR_ADDR (ucbp) = selfrel_offset31 (ucbp->pr_cache.ehtp); + } + return _URC_OK; +} + + +/* Perform phase2 unwinding. VRS is the initial virtual register state. */ + +static void __attribute__((noreturn)) +unwind_phase2 (_Unwind_Control_Block * ucbp, phase2_vrs * vrs) +{ + _Unwind_Reason_Code pr_result; + + for(;;) + { + /* Find the entry for this routine. */ + if (get_eit_entry (ucbp, vrs->core.r[R_PC]) != _URC_OK) + abort (); + + UCB_SAVED_CALLSITE_ADDR (ucbp) = vrs->core.r[R_PC]; + + /* Call the pr to decide what to do. */ + pr_result = ((personality_routine) UCB_PR_ADDR (ucbp)) + (_US_UNWIND_FRAME_STARTING, ucbp, (_Unwind_Context *) vrs); + + if (pr_result != _URC_CONTINUE_UNWIND) + break; + } + + if (pr_result != _URC_INSTALL_CONTEXT) + abort(); + + restore_core_regs (&vrs->core); +} + +/* Perform phase1 unwinding. UCBP is the exception being thrown, and + entry_VRS is the register state on entry to _Unwind_RaiseException. */ + +_Unwind_Reason_Code +__gnu_Unwind_RaiseException (_Unwind_Control_Block *, phase2_vrs *); + +_Unwind_Reason_Code +__gnu_Unwind_RaiseException (_Unwind_Control_Block * ucbp, + phase2_vrs * entry_vrs) +{ + phase1_vrs saved_vrs; + _Unwind_Reason_Code pr_result; + + /* Set the pc to the call site. */ + entry_vrs->core.r[R_PC] = entry_vrs->core.r[R_LR]; + + /* Save the core registers. */ + saved_vrs.core = entry_vrs->core; + /* Set demand-save flags. */ + saved_vrs.demand_save_flags = ~(_uw) 0; + + /* Unwind until we reach a propagation barrier. */ + for (;;) + { + /* Find the entry for this routine. */ + if (get_eit_entry (ucbp, saved_vrs.core.r[R_PC]) != _URC_OK) + return _URC_FAILURE; + + /* Call the pr to decide what to do. */ + pr_result = ((personality_routine) UCB_PR_ADDR (ucbp)) + (_US_VIRTUAL_UNWIND_FRAME, ucbp, (void *) &saved_vrs); + + if (pr_result != _URC_CONTINUE_UNWIND) + break; + } + + /* We've unwound as far as we want to go, so restore the original + register state. */ + restore_non_core_regs (&saved_vrs); + if (pr_result != _URC_HANDLER_FOUND) + { + /* Some sort of failure has occurred in the pr and probably the + pr returned _URC_FAILURE. */ + return _URC_FAILURE; + } + + unwind_phase2 (ucbp, entry_vrs); +} + +/* Resume unwinding after a cleanup has been run. UCBP is the exception + being thrown and ENTRY_VRS is the register state on entry to + _Unwind_Resume. */ +_Unwind_Reason_Code +__gnu_Unwind_Resume (_Unwind_Control_Block *, phase2_vrs *); + +_Unwind_Reason_Code +__gnu_Unwind_Resume (_Unwind_Control_Block * ucbp, phase2_vrs * entry_vrs) +{ + _Unwind_Reason_Code pr_result; + + /* Recover the saved address. */ + entry_vrs->core.r[R_PC] = UCB_SAVED_CALLSITE_ADDR (ucbp); + + /* Call the cached PR. */ + pr_result = ((personality_routine) UCB_PR_ADDR (ucbp)) + (_US_UNWIND_FRAME_RESUME, ucbp, (_Unwind_Context *) entry_vrs); + + switch (pr_result) + { + case _URC_INSTALL_CONTEXT: + /* Upload the registers to enter the landing pad. */ + restore_core_regs (&entry_vrs->core); + + case _URC_CONTINUE_UNWIND: + /* Continue unwinding the next frame. */ + unwind_phase2 (ucbp, entry_vrs); + + default: + abort (); + } +} + +/* Clean up an exception object when unwinding is complete. */ +void +_Unwind_Complete (_Unwind_Control_Block * ucbp __attribute__((unused))) +{ +} + + +/* Get the _Unwind_Control_Block from an _Unwind_Context. */ + +static inline _Unwind_Control_Block * +unwind_UCB_from_context (_Unwind_Context * context) +{ + return (_Unwind_Control_Block *) _Unwind_GetGR (context, R_IP); +} + + +/* Free an exception. */ + +void +_Unwind_DeleteException (_Unwind_Exception * exc) +{ + if (exc->exception_cleanup) + (*exc->exception_cleanup) (_URC_FOREIGN_EXCEPTION_CAUGHT, exc); +} + + +/* Common implementation for ARM ABI defined personality routines. + ID is the index of the personality routine, other arguments are as defined + by __aeabi_unwind_cpp_pr{0,1,2}. */ + +static _Unwind_Reason_Code +__gnu_unwind_pr_common (_Unwind_State state, + _Unwind_Control_Block *ucbp, + _Unwind_Context *context, + int id) +{ + __gnu_unwind_state uws; + _uw *data; + _uw offset; + _uw len; + _uw rtti_count; + int phase2_call_unexpected_after_unwind = 0; + int in_range = 0; + + data = (_uw *) ucbp->pr_cache.ehtp; + uws.data = *(data++); + uws.next = data; + if (id == 0) + { + uws.data <<= 8; + uws.words_left = 0; + uws.bytes_left = 3; + } + else + { + uws.words_left = (uws.data >> 16) & 0xff; + uws.data <<= 16; + uws.bytes_left = 2; + data += uws.words_left; + } + + /* Restore the saved pointer. */ + if (state == _US_UNWIND_FRAME_RESUME) + data = (_uw *) ucbp->cleanup_cache.bitpattern[0]; + + if ((ucbp->pr_cache.additional & 1) == 0) + { + /* Process descriptors. */ + while (*data) + { + _uw addr; + _uw fnstart; + + if (id == 2) + { + len = ((EHT32 *) data)->length; + offset = ((EHT32 *) data)->offset; + data += 2; + } + else + { + len = ((EHT16 *) data)->length; + offset = ((EHT16 *) data)->offset; + data++; + } + + fnstart = ucbp->pr_cache.fnstart + (offset & ~1); + addr = _Unwind_GetGR (context, R_PC); + in_range = (fnstart <= addr && addr < fnstart + (len & ~1)); + + switch (((offset & 1) << 1) | (len & 1)) + { + case 0: + /* Cleanup. */ + if (state != _US_VIRTUAL_UNWIND_FRAME + && in_range) + { + /* Cleanup in range, and we are running cleanups. */ + _uw lp; + + /* Landing pad address is 31-bit pc-relatvie offset. */ + lp = selfrel_offset31 (data); + data++; + /* Save the exception data pointer. */ + ucbp->cleanup_cache.bitpattern[0] = (_uw) data; + if (!__cxa_begin_cleanup (ucbp)) + return _URC_FAILURE; + /* Setup the VRS to enter the landing pad. */ + _Unwind_SetGR (context, R_PC, lp); + return _URC_INSTALL_CONTEXT; + } + /* Cleanup not in range, or we are in stage 1. */ + data++; + break; + + case 1: + /* Catch handler. */ + if (state == _US_VIRTUAL_UNWIND_FRAME) + { + if (in_range) + { + /* Check for a barrier. */ + _uw rtti; + void *matched; + + /* Check for no-throw areas. */ + if (data[1] == (_uw) -2) + return _URC_FAILURE; + + /* The thrown object immediately folows the ECB. */ + matched = (void *)(ucbp + 1); + if (data[1] != (_uw) -1) + { + /* Match a catch specification. */ + rtti = _Unwind_decode_target2 ((_uw) &data[1]); + if (!__cxa_type_match (ucbp, (type_info *) rtti, + &matched)) + matched = (void *)0; + } + + if (matched) + { + ucbp->barrier_cache.sp = + _Unwind_GetGR (context, R_SP); + ucbp->barrier_cache.bitpattern[0] = (_uw) matched; + ucbp->barrier_cache.bitpattern[1] = (_uw) data; + return _URC_HANDLER_FOUND; + } + } + /* Handler out of range, or not matched. */ + } + else if (ucbp->barrier_cache.sp == _Unwind_GetGR (context, R_SP) + && ucbp->barrier_cache.bitpattern[1] == (_uw) data) + { + /* Matched a previous propagation barrier. */ + _uw lp; + + /* Setup for entry to the handler. */ + lp = selfrel_offset31 (data); + _Unwind_SetGR (context, R_PC, lp); + _Unwind_SetGR (context, 0, (_uw) ucbp); + return _URC_INSTALL_CONTEXT; + } + /* Catch handler not mached. Advance to the next descriptor. */ + data += 2; + break; + + case 2: + rtti_count = data[0] & 0x7fffffff; + /* Exception specification. */ + if (state == _US_VIRTUAL_UNWIND_FRAME) + { + if (in_range) + { + /* Match against teh exception specification. */ + _uw i; + _uw rtti; + void *matched; + + for (i = 0; i < rtti_count; i++) + { + matched = (void *)(ucbp + 1); + rtti = _Unwind_decode_target2 ((_uw) &data[i + 1]); + if (__cxa_type_match (ucbp, (type_info *) rtti, + &matched)) + break; + } + + if (i == rtti_count) + { + /* Exception does not match the spec. */ + ucbp->barrier_cache.sp = + _Unwind_GetGR (context, R_SP); + ucbp->barrier_cache.bitpattern[0] = (_uw) matched; + ucbp->barrier_cache.bitpattern[1] = (_uw) data; + return _URC_HANDLER_FOUND; + } + } + /* Handler out of range, or exception is permitted. */ + } + else if (ucbp->barrier_cache.sp == _Unwind_GetGR (context, R_SP) + && ucbp->barrier_cache.bitpattern[1] == (_uw) data) + { + /* Matched a previous propagation barrier. */ + _uw lp; + /* Record the RTTI list for __cxa_call_unexpected. */ + ucbp->barrier_cache.bitpattern[1] = rtti_count; + ucbp->barrier_cache.bitpattern[2] = 0; + ucbp->barrier_cache.bitpattern[3] = 4; + ucbp->barrier_cache.bitpattern[4] = (_uw) &data[1]; + + if (data[0] & uint32_highbit) + phase2_call_unexpected_after_unwind = 1; + else + { + data += rtti_count + 1; + /* Setup for entry to the handler. */ + lp = selfrel_offset31 (data); + data++; + _Unwind_SetGR (context, R_PC, lp); + _Unwind_SetGR (context, 0, (_uw) ucbp); + return _URC_INSTALL_CONTEXT; + } + } + if (data[0] & uint32_highbit) + data++; + data += rtti_count + 1; + break; + + default: + /* Should never happen. */ + return _URC_FAILURE; + } + /* Finished processing this descriptor. */ + } + } + + if (__gnu_unwind_execute (context, &uws) != _URC_OK) + return _URC_FAILURE; + + if (phase2_call_unexpected_after_unwind) + { + /* Enter __cxa_unexpected as if called from the callsite. */ + _Unwind_SetGR (context, R_LR, _Unwind_GetGR (context, R_PC)); + _Unwind_SetGR (context, R_PC, (_uw) &__cxa_call_unexpected); + return _URC_INSTALL_CONTEXT; + } + + return _URC_CONTINUE_UNWIND; +} + + +/* ABI defined personality routine entry points. */ + +_Unwind_Reason_Code +__aeabi_unwind_cpp_pr0 (_Unwind_State state, + _Unwind_Control_Block *ucbp, + _Unwind_Context *context) +{ + return __gnu_unwind_pr_common (state, ucbp, context, 0); +} + +_Unwind_Reason_Code +__aeabi_unwind_cpp_pr1 (_Unwind_State state, + _Unwind_Control_Block *ucbp, + _Unwind_Context *context) +{ + return __gnu_unwind_pr_common (state, ucbp, context, 1); +} + +_Unwind_Reason_Code +__aeabi_unwind_cpp_pr2 (_Unwind_State state, + _Unwind_Control_Block *ucbp, + _Unwind_Context *context) +{ + return __gnu_unwind_pr_common (state, ucbp, context, 2); +} Added: apple-local/branches/llvm/gcc/config/arm/unwind-arm.h =================================================================== --- apple-local/branches/llvm/gcc/config/arm/unwind-arm.h (rev 0) +++ apple-local/branches/llvm/gcc/config/arm/unwind-arm.h 2007-04-03 17:23:51 UTC (rev 125691) @@ -0,0 +1,271 @@ +/* Header file for the ARM EABI unwinder + Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Contributed by Paul Brook + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + In addition to the permissions in the GNU General Public License, the + Free Software Foundation gives you unlimited permission to link the + compiled version of this file into combinations with other programs, + and to distribute those combinations without any restriction coming + from the use of this file. (The General Public License restrictions + do apply in other respects; for example, they cover modification of + the file, and distribution when not linked into a combine + executable.) + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* Language-independent unwinder header public defines. This contins both + ABI defined objects, and GNU support routines.*/ + +#ifndef UNWIND_ARM_H +#define UNWIND_ARM_H + +#define __ARM_EABI_UNWINDER__ 1 + +#ifdef __cplusplus +extern "C" { +#endif + /* We add a prototype for abort here to avoid creating a dependency on + target headers. */ + extern void abort(); + + typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); + typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); + typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); + typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); + typedef _Unwind_Word _uw; + typedef unsigned _uw64 __attribute__((mode(__DI__))); + typedef unsigned _uw16 __attribute__((mode(__HI__))); + typedef unsigned _uw8 __attribute__((mode(__QI__))); + + typedef enum + { + _URC_OK = 0, /* operation completed successfully */ + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8, + _URC_FAILURE = 9 /* unspecified failure of some kind */ + } + _Unwind_Reason_Code; + + typedef enum + { + _US_VIRTUAL_UNWIND_FRAME = 0, + _US_UNWIND_FRAME_STARTING = 1, + _US_UNWIND_FRAME_RESUME = 2 + } + _Unwind_State; + + typedef struct _Unwind_Control_Block _Unwind_Control_Block; + typedef struct _Unwind_Context _Unwind_Context; + typedef _uw _Unwind_EHT_Header; + + + /* UCB: */ + + struct _Unwind_Control_Block + { + char exception_class[8]; + void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *); + /* Unwinder cache, private fields for the unwinder's use */ + struct + { + _uw reserved1; /* init reserved1 to 0, then don't touch */ + _uw reserved2; + _uw reserved3; + _uw reserved4; + _uw reserved5; + } + unwinder_cache; + /* Propagation barrier cache (valid after phase 1): */ + struct + { + _uw sp; + _uw bitpattern[5]; + } + barrier_cache; + /* Cleanup cache (preserved over cleanup): */ + struct + { + _uw bitpattern[4]; + } + cleanup_cache; + /* Pr cache (for pr's benefit): */ + struct + { + _uw fnstart; /* function start address */ + _Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */ + _uw additional; /* additional data */ + _uw reserved1; + } + pr_cache; + long long int :0; /* Force alignment to 8-byte boundary */ + }; + + /* Interface functions: */ + _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Control_Block *ucbp); + void __attribute__((noreturn)) _Unwind_Resume(_Unwind_Control_Block *ucbp); + void _Unwind_Complete(_Unwind_Control_Block *ucbp); + + /* Virtual Register Set*/ + + typedef enum + { + _UVRSC_CORE = 0, /* integer register */ + _UVRSC_VFP = 1, /* vfp */ + _UVRSC_FPA = 2, /* fpa */ + _UVRSC_WMMXD = 3, /* Intel WMMX data register */ + _UVRSC_WMMXC = 4 /* Intel WMMX control register */ + } + _Unwind_VRS_RegClass; + + typedef enum + { + _UVRSD_UINT32 = 0, + _UVRSD_VFPX = 1, + _UVRSD_FPAX = 2, + _UVRSD_UINT64 = 3, + _UVRSD_FLOAT = 4, + _UVRSD_DOUBLE = 5 + } + _Unwind_VRS_DataRepresentation; + + typedef enum + { + _UVRSR_OK = 0, + _UVRSR_NOT_IMPLEMENTED = 1, + _UVRSR_FAILED = 2 + } + _Unwind_VRS_Result; + + /* Frame unwinding state. */ + typedef struct + { + /* The current word (bytes packed msb first). */ + _uw data; + /* Pointer to the next word of data. */ + _uw *next; + /* The number of bytes left in this word. */ + _uw8 bytes_left; + /* The number of words pointed to by ptr. */ + _uw8 words_left; + } + __gnu_unwind_state; + + typedef _Unwind_Reason_Code (*personality_routine) (_Unwind_State, + _Unwind_Control_Block *, _Unwind_Context *); + + _Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass, + _uw, _Unwind_VRS_DataRepresentation, + void *); + + _Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *, _Unwind_VRS_RegClass, + _uw, _Unwind_VRS_DataRepresentation, + void *); + + _Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass, + _uw, _Unwind_VRS_DataRepresentation); + + + /* Support functions for the PR. */ +#define _Unwind_Exception _Unwind_Control_Block + typedef char _Unwind_Exception_Class[8]; + + void * _Unwind_GetLanguageSpecificData (_Unwind_Context *); + _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); + + /* These two should never be used */ + static inline _Unwind_Ptr + _Unwind_GetDataRelBase (_Unwind_Context * context __attribute__ ((unused))) + { + abort (); + } + + static inline _Unwind_Ptr + _Unwind_GetTextRelBase (_Unwind_Context * context __attribute__ ((unused))) + { + abort (); + } + + void _Unwind_DeleteException (_Unwind_Exception *); + + _Unwind_Reason_Code __gnu_unwind_frame (_Unwind_Control_Block *, + _Unwind_Context *); + _Unwind_Reason_Code __gnu_unwind_execute (_Unwind_Context *, + __gnu_unwind_state *); + + /* Decode an R_ARM_TARGET2 relocation. */ + static inline _Unwind_Word + _Unwind_decode_target2 (_Unwind_Word ptr) + { + _Unwind_Word tmp; + + tmp = *(_Unwind_Word *) ptr; + /* Zero values are always NULL. */ + if (!tmp) + return 0; + +#if defined(linux) || defined(__NetBSD__) + /* Pc-relative indirect. */ + tmp += ptr; + tmp = *(_Unwind_Word *) tmp; +#elif defined(__symbian__) + /* Absoute pointer. Nothing more to do. */ +#else + /* Pc-relative pointer. */ + tmp += ptr; +#endif + return tmp; + } + + static inline _Unwind_Word + _Unwind_GetGR (_Unwind_Context *context, int regno) + { + _uw val; + _Unwind_VRS_Get (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); + return val; + } + + /* Return the address of the instruction, not the actual IP value. */ +#define _Unwind_GetIP(context) \ + (_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1) + + static inline void + _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val) + { + _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); + } + + /* The dwarf unwinder doesn't understand arm/thumb state. We assume the + landing pad uses the same instruction set as the callsite. */ +#define _Unwind_SetIP(context, val) \ + _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1)) + + /* Provided only for for compatibility with existing code. */ + typedef int _Unwind_Action; +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 +#define _UA_END_OF_STACK 16 + +#define _URC_NO_REASON _URC_OK + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* defined UNWIND_ARM_H */ From dalej at apple.com Tue Apr 3 12:24:34 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 3 Apr 2007 10:24:34 -0700 Subject: [llvm-commits] eh_arm.cc In-Reply-To: <9c10c9f0704030649p607c5084r8d0b2dcb4b142133@mail.gmail.com> References: <124DED6F-23CB-4938-93CF-08D897B23F26@apple.com> <9c10c9f0704030508t6d037a1fscdbb3cac0aaec544@mail.gmail.com> <9c10c9f0704030649p607c5084r8d0b2dcb4b142133@mail.gmail.com> Message-ID: <184988F1-C512-4E60-B176-FB3A4007BD86@apple.com> On Apr 3, 2007, at 6:49 AM, Lauro Ramos Venancio wrote: > Files missed: > ? libstdc++-v3/libsupc++/eh_arm.cc > ? libstdc++-v3/libsupc++/eh_call.cc > ? gcc/config/arm/libunwind.S > ? gcc/config/arm/pr-support.c > ? gcc/config/arm/unwind-arm.c > ? gcc/config/arm/unaligned-funcs.c > ? gcc/config/arm/unwind-arm.h > > Lauro\ Sorry everybody, my fault. Should be OK now. > 2007/4/3, Lauro Ramos Venancio : >> The file eh_arm.cc wasn't committed. It is in the patch. I can't test >> and see if other files are missing because the patch doesn't reach >> the >> public svn yet. >> >> Lauro >> >> 2007/4/3, Devang Patel : >>> >>> On Apr 2, 2007, at 11:34 PM, Bill Wendling wrote: >>> >>>> I'm getting this error during llvm-gcc compilation: >>>> >>>> make[3]: *** No rule to make target `eh_arm.cc', needed by >>>> `eh_arm.lo'. Stop. >>>> make[3]: *** Waiting for unfinished jobs.... >>> >>> This is related to Lauro Ramos Venancio's patch Dale committed. >>> >>> - >>> Devang >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Tue Apr 3 12:43:42 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 12:43:42 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704031743.l33Hhgrq029815@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.726 -> 1.727 --- Log message: reinstate the previous two patches, with a bugfix :) ldecod now passes. --- Diffs of the changes: (+525 -493) InstructionCombining.cpp | 1018 ++++++++++++++++++++++++----------------------- 1 files changed, 525 insertions(+), 493 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.726 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.727 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.726 Tue Apr 3 03:11:50 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Apr 3 12:43:25 2007 @@ -183,6 +183,9 @@ Instruction *visitFCmpInst(FCmpInst &I); Instruction *visitICmpInst(ICmpInst &I); Instruction *visitICmpInstWithCastAndCast(ICmpInst &ICI); + Instruction *visitICmpInstWithInstAndIntCst(ICmpInst &ICI, + Instruction *LHS, + ConstantInt *RHS); Instruction *FoldGEPICmp(User *GEPLHS, Value *RHS, ICmpInst::Predicate Cond, Instruction &I); @@ -4713,496 +4716,11 @@ // instruction, see if that instruction also has constants so that the // instruction can be folded into the icmp if (Instruction *LHSI = dyn_cast(Op0)) - switch (LHSI->getOpcode()) { - case Instruction::And: - if (LHSI->hasOneUse() && isa(LHSI->getOperand(1)) && - LHSI->getOperand(0)->hasOneUse()) { - ConstantInt *AndCST = cast(LHSI->getOperand(1)); - - // If the LHS is an AND of a truncating cast, we can widen the - // and/compare to be the input width without changing the value - // produced, eliminating a cast. - if (CastInst *Cast = dyn_cast(LHSI->getOperand(0))) { - // We can do this transformation if either the AND constant does not - // have its sign bit set or if it is an equality comparison. - // Extending a relational comparison when we're checking the sign - // bit would not work. - if (Cast->hasOneUse() && isa(Cast) && - (I.isEquality() || AndCST->getValue().isPositive() && - CI->getValue().isPositive())) { - ConstantInt *NewCST; - ConstantInt *NewCI; - APInt NewCSTVal(AndCST->getValue()), NewCIVal(CI->getValue()); - uint32_t BitWidth = cast( - Cast->getOperand(0)->getType())->getBitWidth(); - NewCST = ConstantInt::get(NewCSTVal.zext(BitWidth)); - NewCI = ConstantInt::get(NewCIVal.zext(BitWidth)); - Instruction *NewAnd = - BinaryOperator::createAnd(Cast->getOperand(0), NewCST, - LHSI->getName()); - InsertNewInstBefore(NewAnd, I); - return new ICmpInst(I.getPredicate(), NewAnd, NewCI); - } - } - - // If this is: (X >> C1) & C2 != C3 (where any shift and any compare - // could exist), turn it into (X & (C2 << C1)) != (C3 << C1). This - // happens a LOT in code produced by the C front-end, for bitfield - // access. - BinaryOperator *Shift = dyn_cast(LHSI->getOperand(0)); - if (Shift && !Shift->isShift()) - Shift = 0; - - ConstantInt *ShAmt; - ShAmt = Shift ? dyn_cast(Shift->getOperand(1)) : 0; - const Type *Ty = Shift ? Shift->getType() : 0; // Type of the shift. - const Type *AndTy = AndCST->getType(); // Type of the and. - - // We can fold this as long as we can't shift unknown bits - // into the mask. This can only happen with signed shift - // rights, as they sign-extend. - if (ShAmt) { - bool CanFold = Shift->isLogicalShift(); - if (!CanFold) { - // To test for the bad case of the signed shr, see if any - // of the bits shifted in could be tested after the mask. - uint32_t TyBits = Ty->getPrimitiveSizeInBits(); - int ShAmtVal = TyBits - ShAmt->getLimitedValue(TyBits); - - uint32_t BitWidth = AndTy->getPrimitiveSizeInBits(); - if ((APInt::getHighBitsSet(BitWidth, BitWidth-ShAmtVal) & - AndCST->getValue()) == 0) - CanFold = true; - } - - if (CanFold) { - Constant *NewCst; - if (Shift->getOpcode() == Instruction::Shl) - NewCst = ConstantExpr::getLShr(CI, ShAmt); - else - NewCst = ConstantExpr::getShl(CI, ShAmt); - - // Check to see if we are shifting out any of the bits being - // compared. - if (ConstantExpr::get(Shift->getOpcode(), NewCst, ShAmt) != CI){ - // If we shifted bits out, the fold is not going to work out. - // As a special case, check to see if this means that the - // result is always true or false now. - if (I.getPredicate() == ICmpInst::ICMP_EQ) - return ReplaceInstUsesWith(I, ConstantInt::getFalse()); - if (I.getPredicate() == ICmpInst::ICMP_NE) - return ReplaceInstUsesWith(I, ConstantInt::getTrue()); - } else { - I.setOperand(1, NewCst); - Constant *NewAndCST; - if (Shift->getOpcode() == Instruction::Shl) - NewAndCST = ConstantExpr::getLShr(AndCST, ShAmt); - else - NewAndCST = ConstantExpr::getShl(AndCST, ShAmt); - LHSI->setOperand(1, NewAndCST); - LHSI->setOperand(0, Shift->getOperand(0)); - AddToWorkList(Shift); // Shift is dead. - AddUsesToWorkList(I); - return &I; - } - } - } - - // Turn ((X >> Y) & C) == 0 into (X & (C << Y)) == 0. The later is - // preferable because it allows the C<hasOneUse() && CI->isNullValue() && - I.isEquality() && !Shift->isArithmeticShift() && - isa(Shift->getOperand(0))) { - // Compute C << Y. - Value *NS; - if (Shift->getOpcode() == Instruction::LShr) { - NS = BinaryOperator::createShl(AndCST, - Shift->getOperand(1), "tmp"); - } else { - // Insert a logical shift. - NS = BinaryOperator::createLShr(AndCST, - Shift->getOperand(1), "tmp"); - } - InsertNewInstBefore(cast(NS), I); - - // Compute X & (C << Y). - Instruction *NewAnd = BinaryOperator::createAnd( - Shift->getOperand(0), NS, LHSI->getName()); - InsertNewInstBefore(NewAnd, I); - - I.setOperand(0, NewAnd); - return &I; - } - } - break; - - case Instruction::Shl: // (icmp pred (shl X, ShAmt), CI) - if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { - if (I.isEquality()) { - uint32_t TypeBits = CI->getType()->getPrimitiveSizeInBits(); - - // Check that the shift amount is in range. If not, don't perform - // undefined shifts. When the shift is visited it will be - // simplified. - if (ShAmt->uge(TypeBits)) - break; - - // If we are comparing against bits always shifted out, the - // comparison cannot succeed. - Constant *Comp = - ConstantExpr::getShl(ConstantExpr::getLShr(CI, ShAmt), ShAmt); - if (Comp != CI) {// Comparing against a bit that we know is zero. - bool IsICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; - Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); - return ReplaceInstUsesWith(I, Cst); - } - - if (LHSI->hasOneUse()) { - // Otherwise strength reduce the shift into an and. - uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); - Constant *Mask = ConstantInt::get( - APInt::getLowBitsSet(TypeBits, TypeBits-ShAmtVal)); - - Instruction *AndI = - BinaryOperator::createAnd(LHSI->getOperand(0), - Mask, LHSI->getName()+".mask"); - Value *And = InsertNewInstBefore(AndI, I); - return new ICmpInst(I.getPredicate(), And, - ConstantExpr::getLShr(CI, ShAmt)); - } - } - } - break; - - case Instruction::LShr: // (icmp pred (shr X, ShAmt), CI) - case Instruction::AShr: - if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { - if (I.isEquality()) { - // Check that the shift amount is in range. If not, don't perform - // undefined shifts. When the shift is visited it will be - // simplified. - uint32_t TypeBits = CI->getType()->getPrimitiveSizeInBits(); - if (ShAmt->uge(TypeBits)) - break; - - // If we are comparing against bits always shifted out, the - // comparison cannot succeed. - Constant *Comp; - if (LHSI->getOpcode() == Instruction::LShr) - Comp = ConstantExpr::getLShr(ConstantExpr::getShl(CI, ShAmt), - ShAmt); - else - Comp = ConstantExpr::getAShr(ConstantExpr::getShl(CI, ShAmt), - ShAmt); - - if (Comp != CI) {// Comparing against a bit that we know is zero. - bool IsICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; - Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); - return ReplaceInstUsesWith(I, Cst); - } - - if (LHSI->hasOneUse() || CI->isNullValue()) { - uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); - - // Otherwise strength reduce the shift into an and. - APInt Val(APInt::getHighBitsSet(TypeBits, TypeBits - ShAmtVal)); - Constant *Mask = ConstantInt::get(Val); - - Instruction *AndI = - BinaryOperator::createAnd(LHSI->getOperand(0), - Mask, LHSI->getName()+".mask"); - Value *And = InsertNewInstBefore(AndI, I); - return new ICmpInst(I.getPredicate(), And, - ConstantExpr::getShl(CI, ShAmt)); - } - } - } - break; - - case Instruction::SDiv: - case Instruction::UDiv: - // Fold: icmp pred ([us]div X, C1), C2 -> range test - // Fold this div into the comparison, producing a range check. - // Determine, based on the divide type, what the range is being - // checked. If there is an overflow on the low or high side, remember - // it, otherwise compute the range [low, hi) bounding the new value. - // See: InsertRangeTest above for the kinds of replacements possible. - if (ConstantInt *DivRHS = dyn_cast(LHSI->getOperand(1))) { - // FIXME: If the operand types don't match the type of the divide - // then don't attempt this transform. The code below doesn't have the - // logic to deal with a signed divide and an unsigned compare (and - // vice versa). This is because (x /s C1) getOpcode() == Instruction::SDiv; - if (!I.isEquality() && DivIsSigned != I.isSignedPredicate()) - break; - if (DivRHS->isZero()) - break; // Don't hack on div by zero - - // Initialize the variables that will indicate the nature of the - // range check. - bool LoOverflow = false, HiOverflow = false; - ConstantInt *LoBound = 0, *HiBound = 0; - - // Compute Prod = CI * DivRHS. We are essentially solving an equation - // of form X/C1=C2. We solve for X by multiplying C1 (DivRHS) and - // C2 (CI). By solving for X we can turn this into a range check - // instead of computing a divide. - ConstantInt *Prod = Multiply(CI, DivRHS); - - // Determine if the product overflows by seeing if the product is - // not equal to the divide. Make sure we do the same kind of divide - // as in the LHS instruction that we're folding. - bool ProdOV = (DivIsSigned ? ConstantExpr::getSDiv(Prod, DivRHS) : - ConstantExpr::getUDiv(Prod, DivRHS)) != CI; - - // Get the ICmp opcode - ICmpInst::Predicate predicate = I.getPredicate(); - - if (!DivIsSigned) { // udiv - LoBound = Prod; - LoOverflow = ProdOV; - HiOverflow = ProdOV || - AddWithOverflow(HiBound, LoBound, DivRHS, false); - } else if (DivRHS->getValue().isPositive()) { // Divisor is > 0. - if (CI->isNullValue()) { // (X / pos) op 0 - // Can't overflow. - LoBound = cast(ConstantExpr::getNeg(SubOne(DivRHS))); - HiBound = DivRHS; - } else if (CI->getValue().isPositive()) { // (X / pos) op pos - LoBound = Prod; - LoOverflow = ProdOV; - HiOverflow = ProdOV || - AddWithOverflow(HiBound, Prod, DivRHS, true); - } else { // (X / pos) op neg - Constant *DivRHSH = ConstantExpr::getNeg(SubOne(DivRHS)); - LoOverflow = AddWithOverflow(LoBound, Prod, - cast(DivRHSH), true); - HiBound = AddOne(Prod); - HiOverflow = ProdOV; - } - } else { // Divisor is < 0. - if (CI->isNullValue()) { // (X / neg) op 0 - LoBound = AddOne(DivRHS); - HiBound = cast(ConstantExpr::getNeg(DivRHS)); - if (HiBound == DivRHS) - LoBound = 0; // - INTMIN = INTMIN - } else if (CI->getValue().isPositive()) { // (X / neg) op pos - HiOverflow = LoOverflow = ProdOV; - if (!LoOverflow) - LoOverflow = AddWithOverflow(LoBound, Prod, AddOne(DivRHS), - true); - HiBound = AddOne(Prod); - } else { // (X / neg) op neg - LoBound = Prod; - LoOverflow = HiOverflow = ProdOV; - HiBound = Subtract(Prod, DivRHS); - } - - // Dividing by a negate swaps the condition. - predicate = ICmpInst::getSwappedPredicate(predicate); - } - - if (LoBound) { - Value *X = LHSI->getOperand(0); - switch (predicate) { - default: assert(0 && "Unhandled icmp opcode!"); - case ICmpInst::ICMP_EQ: - if (LoOverflow && HiOverflow) - return ReplaceInstUsesWith(I, ConstantInt::getFalse()); - else if (HiOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : - ICmpInst::ICMP_UGE, X, LoBound); - else if (LoOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : - ICmpInst::ICMP_ULT, X, HiBound); - else - return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, - true, I); - case ICmpInst::ICMP_NE: - if (LoOverflow && HiOverflow) - return ReplaceInstUsesWith(I, ConstantInt::getTrue()); - else if (HiOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : - ICmpInst::ICMP_ULT, X, LoBound); - else if (LoOverflow) - return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : - ICmpInst::ICMP_UGE, X, HiBound); - else - return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, - false, I); - case ICmpInst::ICMP_ULT: - case ICmpInst::ICMP_SLT: - if (LoOverflow) - return ReplaceInstUsesWith(I, ConstantInt::getFalse()); - return new ICmpInst(predicate, X, LoBound); - case ICmpInst::ICMP_UGT: - case ICmpInst::ICMP_SGT: - if (HiOverflow) - return ReplaceInstUsesWith(I, ConstantInt::getFalse()); - if (predicate == ICmpInst::ICMP_UGT) - return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound); - else - return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound); - } - } - } - break; - } - - // Simplify icmp_eq and icmp_ne instructions with integer constant RHS. - if (I.isEquality()) { - bool isICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE; - - // If the first operand is (add|sub|and|or|xor|rem) with a constant, and - // the second operand is a constant, simplify a bit. - if (BinaryOperator *BO = dyn_cast(Op0)) { - switch (BO->getOpcode()) { - case Instruction::SRem: - // If we have a signed (X % (2^c)) == 0, turn it into an unsigned one. - if (CI->isZero() && isa(BO->getOperand(1)) && - BO->hasOneUse()) { - const APInt& V = cast(BO->getOperand(1))->getValue(); - if (V.sgt(APInt(V.getBitWidth(), 1)) && V.isPowerOf2()) { - Value *NewRem = InsertNewInstBefore(BinaryOperator::createURem( - BO->getOperand(0), BO->getOperand(1), BO->getName()), I); - return new ICmpInst(I.getPredicate(), NewRem, - Constant::getNullValue(BO->getType())); - } - } - break; - case Instruction::Add: - // Replace ((add A, B) != C) with (A != C-B) if B & C are constants. - if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { - if (BO->hasOneUse()) - return new ICmpInst(I.getPredicate(), BO->getOperand(0), - Subtract(CI, BOp1C)); - } else if (CI->isNullValue()) { - // Replace ((add A, B) != 0) with (A != -B) if A or B is - // efficiently invertible, or if the add has just this one use. - Value *BOp0 = BO->getOperand(0), *BOp1 = BO->getOperand(1); - - if (Value *NegVal = dyn_castNegVal(BOp1)) - return new ICmpInst(I.getPredicate(), BOp0, NegVal); - else if (Value *NegVal = dyn_castNegVal(BOp0)) - return new ICmpInst(I.getPredicate(), NegVal, BOp1); - else if (BO->hasOneUse()) { - Instruction *Neg = BinaryOperator::createNeg(BOp1); - InsertNewInstBefore(Neg, I); - Neg->takeName(BO); - return new ICmpInst(I.getPredicate(), BOp0, Neg); - } - } - break; - case Instruction::Xor: - // For the xor case, we can xor two constants together, eliminating - // the explicit xor. - if (Constant *BOC = dyn_cast(BO->getOperand(1))) - return new ICmpInst(I.getPredicate(), BO->getOperand(0), - ConstantExpr::getXor(CI, BOC)); - - // FALLTHROUGH - case Instruction::Sub: - // Replace (([sub|xor] A, B) != 0) with (A != B) - if (CI->isZero()) - return new ICmpInst(I.getPredicate(), BO->getOperand(0), - BO->getOperand(1)); - break; - - case Instruction::Or: - // If bits are being or'd in that are not present in the constant we - // are comparing against, then the comparison could never succeed! - if (Constant *BOC = dyn_cast(BO->getOperand(1))) { - Constant *NotCI = ConstantExpr::getNot(CI); - if (!ConstantExpr::getAnd(BOC, NotCI)->isNullValue()) - return ReplaceInstUsesWith(I, ConstantInt::get(Type::Int1Ty, - isICMP_NE)); - } - break; - - case Instruction::And: - if (ConstantInt *BOC = dyn_cast(BO->getOperand(1))) { - // If bits are being compared against that are and'd out, then the - // comparison can never succeed! - if (!And(CI, ConstantInt::get(~BOC->getValue()))->isZero()) - return ReplaceInstUsesWith(I, ConstantInt::get(Type::Int1Ty, - isICMP_NE)); - - // If we have ((X & C) == C), turn it into ((X & C) != 0). - if (CI == BOC && isOneBitSet(CI)) - return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : - ICmpInst::ICMP_NE, Op0, - Constant::getNullValue(CI->getType())); - - // Replace (and X, (1 << size(X)-1) != 0) with x s< 0 - if (isSignBit(BOC)) { - Value *X = BO->getOperand(0); - Constant *Zero = Constant::getNullValue(X->getType()); - ICmpInst::Predicate pred = isICMP_NE ? - ICmpInst::ICMP_SLT : ICmpInst::ICMP_SGE; - return new ICmpInst(pred, X, Zero); - } - - // ((X & ~7) == 0) --> X < 8 - if (CI->isNullValue() && isHighOnes(BOC)) { - Value *X = BO->getOperand(0); - Constant *NegX = ConstantExpr::getNeg(BOC); - ICmpInst::Predicate pred = isICMP_NE ? - ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT; - return new ICmpInst(pred, X, NegX); - } - - } - default: break; - } - } else if (IntrinsicInst *II = dyn_cast(Op0)) { - // Handle icmp {eq|ne} , intcst. - if (II->getIntrinsicID() == Intrinsic::bswap) { - AddToWorkList(II); - I.setOperand(0, II->getOperand(1)); - I.setOperand(1, ConstantInt::get(CI->getValue().byteSwap())); - return &I; - } - } - } else { // Not a ICMP_EQ/ICMP_NE - // If the LHS is a cast from an integral value of the same size, then - // since we know the RHS is a constant, try to simlify. - if (CastInst *Cast = dyn_cast(Op0)) { - Value *CastOp = Cast->getOperand(0); - const Type *SrcTy = CastOp->getType(); - uint32_t SrcTySize = SrcTy->getPrimitiveSizeInBits(); - if (SrcTy->isInteger() && - SrcTySize == Cast->getType()->getPrimitiveSizeInBits()) { - // If this is an unsigned comparison, try to make the comparison use - // smaller constant values. - switch (I.getPredicate()) { - default: break; - case ICmpInst::ICMP_ULT: { // X u< 128 => X s> -1 - ConstantInt *CUI = cast(CI); - if (CUI->getValue() == APInt::getSignBit(SrcTySize)) - return new ICmpInst(ICmpInst::ICMP_SGT, CastOp, - ConstantInt::get(APInt::getAllOnesValue(SrcTySize))); - break; - } - case ICmpInst::ICMP_UGT: { // X u> 127 => X s< 0 - ConstantInt *CUI = cast(CI); - if (CUI->getValue() == APInt::getSignedMaxValue(SrcTySize)) - return new ICmpInst(ICmpInst::ICMP_SLT, CastOp, - Constant::getNullValue(SrcTy)); - break; - } - } - - } - } - } + if (Instruction *Res = visitICmpInstWithInstAndIntCst(I, LHSI, CI)) + return Res; } - // Handle icmp with constant RHS + // Handle icmp with constant (but not simple integer constant) RHS if (Constant *RHSC = dyn_cast(Op1)) { if (Instruction *LHSI = dyn_cast(Op0)) switch (LHSI->getOpcode()) { @@ -5377,9 +4895,524 @@ return Changed ? &I : 0; } -// visitICmpInstWithCastAndCast - Handle icmp (cast x to y), (cast/cst). -// We only handle extending casts so far. -// +/// visitICmpInstWithInstAndIntCst - Handle "icmp (instr, intcst)". +/// +Instruction *InstCombiner::visitICmpInstWithInstAndIntCst(ICmpInst &ICI, + Instruction *LHSI, + ConstantInt *RHS) { + const APInt &RHSV = RHS->getValue(); + + switch (LHSI->getOpcode()) { + case Instruction::Xor: // (icmp pred (and X, XorCST), CI) + if (ConstantInt *XorCST = dyn_cast(LHSI->getOperand(1))) { + // If this is a comparison that tests the signbit (X < 0) or (x > -1), + // fold the xor. + if (ICI.getPredicate() == ICmpInst::ICMP_SLT && RHSV == 0 || + ICI.getPredicate() == ICmpInst::ICMP_SGT && RHSV.isAllOnesValue()) { + Value *CompareVal = LHSI->getOperand(0); + + // If the sign bit of the XorCST is not set, there is no change to + // the operation, just stop using the Xor. + if (!XorCST->getValue().isNegative()) { + ICI.setOperand(0, CompareVal); + AddToWorkList(LHSI); + return &ICI; + } + + // Was the old condition true if the operand is positive? + bool isTrueIfPositive = ICI.getPredicate() == ICmpInst::ICMP_SGT; + + // If so, the new one isn't. + isTrueIfPositive ^= true; + + if (isTrueIfPositive) + return new ICmpInst(ICmpInst::ICMP_SGT, CompareVal, SubOne(RHS)); + else + return new ICmpInst(ICmpInst::ICMP_SLT, CompareVal, AddOne(RHS)); + } + } + break; + case Instruction::And: // (icmp pred (and X, AndCST), RHS) + if (LHSI->hasOneUse() && isa(LHSI->getOperand(1)) && + LHSI->getOperand(0)->hasOneUse()) { + ConstantInt *AndCST = cast(LHSI->getOperand(1)); + + // If the LHS is an AND of a truncating cast, we can widen the + // and/compare to be the input width without changing the value + // produced, eliminating a cast. + if (TruncInst *Cast = dyn_cast(LHSI->getOperand(0))) { + // We can do this transformation if either the AND constant does not + // have its sign bit set or if it is an equality comparison. + // Extending a relational comparison when we're checking the sign + // bit would not work. + if (Cast->hasOneUse() && + (ICI.isEquality() || AndCST->getValue().isPositive() && + RHSV.isPositive())) { + uint32_t BitWidth = + cast(Cast->getOperand(0)->getType())->getBitWidth(); + APInt NewCST = AndCST->getValue(); + NewCST.zext(BitWidth); + APInt NewCI = RHSV; + NewCI.zext(BitWidth); + Instruction *NewAnd = + BinaryOperator::createAnd(Cast->getOperand(0), + ConstantInt::get(NewCST),LHSI->getName()); + InsertNewInstBefore(NewAnd, ICI); + return new ICmpInst(ICI.getPredicate(), NewAnd, + ConstantInt::get(NewCI)); + } + } + + // If this is: (X >> C1) & C2 != C3 (where any shift and any compare + // could exist), turn it into (X & (C2 << C1)) != (C3 << C1). This + // happens a LOT in code produced by the C front-end, for bitfield + // access. + BinaryOperator *Shift = dyn_cast(LHSI->getOperand(0)); + if (Shift && !Shift->isShift()) + Shift = 0; + + ConstantInt *ShAmt; + ShAmt = Shift ? dyn_cast(Shift->getOperand(1)) : 0; + const Type *Ty = Shift ? Shift->getType() : 0; // Type of the shift. + const Type *AndTy = AndCST->getType(); // Type of the and. + + // We can fold this as long as we can't shift unknown bits + // into the mask. This can only happen with signed shift + // rights, as they sign-extend. + if (ShAmt) { + bool CanFold = Shift->isLogicalShift(); + if (!CanFold) { + // To test for the bad case of the signed shr, see if any + // of the bits shifted in could be tested after the mask. + uint32_t TyBits = Ty->getPrimitiveSizeInBits(); + int ShAmtVal = TyBits - ShAmt->getLimitedValue(TyBits); + + uint32_t BitWidth = AndTy->getPrimitiveSizeInBits(); + if ((APInt::getHighBitsSet(BitWidth, BitWidth-ShAmtVal) & + AndCST->getValue()) == 0) + CanFold = true; + } + + if (CanFold) { + Constant *NewCst; + if (Shift->getOpcode() == Instruction::Shl) + NewCst = ConstantExpr::getLShr(RHS, ShAmt); + else + NewCst = ConstantExpr::getShl(RHS, ShAmt); + + // Check to see if we are shifting out any of the bits being + // compared. + if (ConstantExpr::get(Shift->getOpcode(), NewCst, ShAmt) != RHS) { + // If we shifted bits out, the fold is not going to work out. + // As a special case, check to see if this means that the + // result is always true or false now. + if (ICI.getPredicate() == ICmpInst::ICMP_EQ) + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); + if (ICI.getPredicate() == ICmpInst::ICMP_NE) + return ReplaceInstUsesWith(ICI, ConstantInt::getTrue()); + } else { + ICI.setOperand(1, NewCst); + Constant *NewAndCST; + if (Shift->getOpcode() == Instruction::Shl) + NewAndCST = ConstantExpr::getLShr(AndCST, ShAmt); + else + NewAndCST = ConstantExpr::getShl(AndCST, ShAmt); + LHSI->setOperand(1, NewAndCST); + LHSI->setOperand(0, Shift->getOperand(0)); + AddToWorkList(Shift); // Shift is dead. + AddUsesToWorkList(ICI); + return &ICI; + } + } + } + + // Turn ((X >> Y) & C) == 0 into (X & (C << Y)) == 0. The later is + // preferable because it allows the C<hasOneUse() && RHSV == 0 && + ICI.isEquality() && !Shift->isArithmeticShift() && + isa(Shift->getOperand(0))) { + // Compute C << Y. + Value *NS; + if (Shift->getOpcode() == Instruction::LShr) { + NS = BinaryOperator::createShl(AndCST, + Shift->getOperand(1), "tmp"); + } else { + // Insert a logical shift. + NS = BinaryOperator::createLShr(AndCST, + Shift->getOperand(1), "tmp"); + } + InsertNewInstBefore(cast(NS), ICI); + + // Compute X & (C << Y). + Instruction *NewAnd = + BinaryOperator::createAnd(Shift->getOperand(0), NS, LHSI->getName()); + InsertNewInstBefore(NewAnd, ICI); + + ICI.setOperand(0, NewAnd); + return &ICI; + } + } + break; + + case Instruction::Shl: // (icmp pred (shl X, ShAmt), CI) + if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { + if (ICI.isEquality()) { + uint32_t TypeBits = RHSV.getBitWidth(); + + // Check that the shift amount is in range. If not, don't perform + // undefined shifts. When the shift is visited it will be + // simplified. + if (ShAmt->uge(TypeBits)) + break; + + // If we are comparing against bits always shifted out, the + // comparison cannot succeed. + Constant *Comp = + ConstantExpr::getShl(ConstantExpr::getLShr(RHS, ShAmt), ShAmt); + if (Comp != RHS) {// Comparing against a bit that we know is zero. + bool IsICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE; + Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); + return ReplaceInstUsesWith(ICI, Cst); + } + + if (LHSI->hasOneUse()) { + // Otherwise strength reduce the shift into an and. + uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); + Constant *Mask = + ConstantInt::get(APInt::getLowBitsSet(TypeBits, TypeBits-ShAmtVal)); + + Instruction *AndI = + BinaryOperator::createAnd(LHSI->getOperand(0), + Mask, LHSI->getName()+".mask"); + Value *And = InsertNewInstBefore(AndI, ICI); + return new ICmpInst(ICI.getPredicate(), And, + ConstantInt::get(RHSV << ShAmtVal)); + } + } + } + break; + + case Instruction::LShr: // (icmp pred (shr X, ShAmt), CI) + case Instruction::AShr: + if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { + if (ICI.isEquality()) { + // Check that the shift amount is in range. If not, don't perform + // undefined shifts. When the shift is visited it will be + // simplified. + uint32_t TypeBits = RHSV.getBitWidth(); + if (ShAmt->uge(TypeBits)) + break; + uint32_t ShAmtVal = (uint32_t)ShAmt->getLimitedValue(TypeBits); + + // If we are comparing against bits always shifted out, the + // comparison cannot succeed. + APInt Comp = RHSV << ShAmtVal; + if (LHSI->getOpcode() == Instruction::LShr) + Comp = Comp.lshr(ShAmtVal); + else + Comp = Comp.ashr(ShAmtVal); + + if (Comp != RHSV) { // Comparing against a bit that we know is zero. + bool IsICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE; + Constant *Cst = ConstantInt::get(Type::Int1Ty, IsICMP_NE); + return ReplaceInstUsesWith(ICI, Cst); + } + + if (LHSI->hasOneUse() || RHSV == 0) { + // Otherwise strength reduce the shift into an and. + APInt Val(APInt::getHighBitsSet(TypeBits, TypeBits - ShAmtVal)); + Constant *Mask = ConstantInt::get(Val); + + Instruction *AndI = + BinaryOperator::createAnd(LHSI->getOperand(0), + Mask, LHSI->getName()+".mask"); + Value *And = InsertNewInstBefore(AndI, ICI); + return new ICmpInst(ICI.getPredicate(), And, + ConstantExpr::getShl(RHS, ShAmt)); + } + } + } + break; + + case Instruction::SDiv: + case Instruction::UDiv: + // Fold: icmp pred ([us]div X, C1), C2 -> range test + // Fold this div into the comparison, producing a range check. + // Determine, based on the divide type, what the range is being + // checked. If there is an overflow on the low or high side, remember + // it, otherwise compute the range [low, hi) bounding the new value. + // See: InsertRangeTest above for the kinds of replacements possible. + if (ConstantInt *DivRHS = dyn_cast(LHSI->getOperand(1))) { + // FIXME: If the operand types don't match the type of the divide + // then don't attempt this transform. The code below doesn't have the + // logic to deal with a signed divide and an unsigned compare (and + // vice versa). This is because (x /s C1) getOpcode() == Instruction::SDiv; + if (!ICI.isEquality() && DivIsSigned != ICI.isSignedPredicate()) + break; + if (DivRHS->isZero()) + break; // Don't hack on div by zero + + // Initialize the variables that will indicate the nature of the + // range check. + bool LoOverflow = false, HiOverflow = false; + ConstantInt *LoBound = 0, *HiBound = 0; + + // Compute Prod = CI * DivRHS. We are essentially solving an equation + // of form X/C1=C2. We solve for X by multiplying C1 (DivRHS) and + // C2 (CI). By solving for X we can turn this into a range check + // instead of computing a divide. + ConstantInt *Prod = Multiply(RHS, DivRHS); + + // Determine if the product overflows by seeing if the product is + // not equal to the divide. Make sure we do the same kind of divide + // as in the LHS instruction that we're folding. + bool ProdOV = (DivIsSigned ? ConstantExpr::getSDiv(Prod, DivRHS) : + ConstantExpr::getUDiv(Prod, DivRHS)) != RHS; + + // Get the ICmp opcode + ICmpInst::Predicate predicate = ICI.getPredicate(); + + if (!DivIsSigned) { // udiv + LoBound = Prod; + LoOverflow = ProdOV; + HiOverflow = ProdOV || + AddWithOverflow(HiBound, LoBound, DivRHS, false); + } else if (DivRHS->getValue().isPositive()) { // Divisor is > 0. + if (RHSV == 0) { // (X / pos) op 0 + // Can't overflow. + LoBound = cast(ConstantExpr::getNeg(SubOne(DivRHS))); + HiBound = DivRHS; + } else if (RHSV.isPositive()) { // (X / pos) op pos + LoBound = Prod; + LoOverflow = ProdOV; + HiOverflow = ProdOV || + AddWithOverflow(HiBound, Prod, DivRHS, true); + } else { // (X / pos) op neg + Constant *DivRHSH = ConstantExpr::getNeg(SubOne(DivRHS)); + LoOverflow = AddWithOverflow(LoBound, Prod, + cast(DivRHSH), true); + HiBound = AddOne(Prod); + HiOverflow = ProdOV; + } + } else { // Divisor is < 0. + if (RHSV == 0) { // (X / neg) op 0 + LoBound = AddOne(DivRHS); + HiBound = cast(ConstantExpr::getNeg(DivRHS)); + if (HiBound == DivRHS) + LoBound = 0; // - INTMIN = INTMIN + } else if (RHSV.isPositive()) { // (X / neg) op pos + HiOverflow = LoOverflow = ProdOV; + if (!LoOverflow) + LoOverflow = AddWithOverflow(LoBound, Prod, AddOne(DivRHS), + true); + HiBound = AddOne(Prod); + } else { // (X / neg) op neg + LoBound = Prod; + LoOverflow = HiOverflow = ProdOV; + HiBound = Subtract(Prod, DivRHS); + } + + // Dividing by a negate swaps the condition. + predicate = ICmpInst::getSwappedPredicate(predicate); + } + + if (LoBound) { + Value *X = LHSI->getOperand(0); + switch (predicate) { + default: assert(0 && "Unhandled icmp opcode!"); + case ICmpInst::ICMP_EQ: + if (LoOverflow && HiOverflow) + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); + else if (HiOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : + ICmpInst::ICMP_UGE, X, LoBound); + else if (LoOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : + ICmpInst::ICMP_ULT, X, HiBound); + else + return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, + true, ICI); + case ICmpInst::ICMP_NE: + if (LoOverflow && HiOverflow) + return ReplaceInstUsesWith(ICI, ConstantInt::getTrue()); + else if (HiOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT : + ICmpInst::ICMP_ULT, X, LoBound); + else if (LoOverflow) + return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE : + ICmpInst::ICMP_UGE, X, HiBound); + else + return InsertRangeTest(X, LoBound, HiBound, DivIsSigned, + false, ICI); + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + if (LoOverflow) + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); + return new ICmpInst(predicate, X, LoBound); + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + if (HiOverflow) + return ReplaceInstUsesWith(ICI, ConstantInt::getFalse()); + if (predicate == ICmpInst::ICMP_UGT) + return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound); + else + return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound); + } + } + } + break; + } + + // Simplify icmp_eq and icmp_ne instructions with integer constant RHS. + if (ICI.isEquality()) { + bool isICMP_NE = ICI.getPredicate() == ICmpInst::ICMP_NE; + + // If the first operand is (add|sub|and|or|xor|rem) with a constant, and + // the second operand is a constant, simplify a bit. + if (BinaryOperator *BO = dyn_cast(LHSI)) { + switch (BO->getOpcode()) { + case Instruction::SRem: + // If we have a signed (X % (2^c)) == 0, turn it into an unsigned one. + if (RHSV == 0 && isa(BO->getOperand(1)) &&BO->hasOneUse()){ + const APInt &V = cast(BO->getOperand(1))->getValue(); + if (V.sgt(APInt(V.getBitWidth(), 1)) && V.isPowerOf2()) { + Instruction *NewRem = + BinaryOperator::createURem(BO->getOperand(0), BO->getOperand(1), + BO->getName()); + InsertNewInstBefore(NewRem, ICI); + return new ICmpInst(ICI.getPredicate(), NewRem, + Constant::getNullValue(BO->getType())); + } + } + break; + case Instruction::Add: + // Replace ((add A, B) != C) with (A != C-B) if B & C are constants. + if (ConstantInt *BOp1C = dyn_cast(BO->getOperand(1))) { + if (BO->hasOneUse()) + return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), + Subtract(RHS, BOp1C)); + } else if (RHSV == 0) { + // Replace ((add A, B) != 0) with (A != -B) if A or B is + // efficiently invertible, or if the add has just this one use. + Value *BOp0 = BO->getOperand(0), *BOp1 = BO->getOperand(1); + + if (Value *NegVal = dyn_castNegVal(BOp1)) + return new ICmpInst(ICI.getPredicate(), BOp0, NegVal); + else if (Value *NegVal = dyn_castNegVal(BOp0)) + return new ICmpInst(ICI.getPredicate(), NegVal, BOp1); + else if (BO->hasOneUse()) { + Instruction *Neg = BinaryOperator::createNeg(BOp1); + InsertNewInstBefore(Neg, ICI); + Neg->takeName(BO); + return new ICmpInst(ICI.getPredicate(), BOp0, Neg); + } + } + break; + case Instruction::Xor: + // For the xor case, we can xor two constants together, eliminating + // the explicit xor. + if (Constant *BOC = dyn_cast(BO->getOperand(1))) + return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), + ConstantExpr::getXor(RHS, BOC)); + + // FALLTHROUGH + case Instruction::Sub: + // Replace (([sub|xor] A, B) != 0) with (A != B) + if (RHSV == 0) + return new ICmpInst(ICI.getPredicate(), BO->getOperand(0), + BO->getOperand(1)); + break; + + case Instruction::Or: + // If bits are being or'd in that are not present in the constant we + // are comparing against, then the comparison could never succeed! + if (Constant *BOC = dyn_cast(BO->getOperand(1))) { + Constant *NotCI = ConstantExpr::getNot(RHS); + if (!ConstantExpr::getAnd(BOC, NotCI)->isNullValue()) + return ReplaceInstUsesWith(ICI, ConstantInt::get(Type::Int1Ty, + isICMP_NE)); + } + break; + + case Instruction::And: + if (ConstantInt *BOC = dyn_cast(BO->getOperand(1))) { + // If bits are being compared against that are and'd out, then the + // comparison can never succeed! + if ((RHSV & ~BOC->getValue()) != 0) + return ReplaceInstUsesWith(ICI, ConstantInt::get(Type::Int1Ty, + isICMP_NE)); + + // If we have ((X & C) == C), turn it into ((X & C) != 0). + if (RHS == BOC && RHSV.isPowerOf2()) + return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ : + ICmpInst::ICMP_NE, LHSI, + Constant::getNullValue(RHS->getType())); + + // Replace (and X, (1 << size(X)-1) != 0) with x s< 0 + if (isSignBit(BOC)) { + Value *X = BO->getOperand(0); + Constant *Zero = Constant::getNullValue(X->getType()); + ICmpInst::Predicate pred = isICMP_NE ? + ICmpInst::ICMP_SLT : ICmpInst::ICMP_SGE; + return new ICmpInst(pred, X, Zero); + } + + // ((X & ~7) == 0) --> X < 8 + if (RHSV == 0 && isHighOnes(BOC)) { + Value *X = BO->getOperand(0); + Constant *NegX = ConstantExpr::getNeg(BOC); + ICmpInst::Predicate pred = isICMP_NE ? + ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT; + return new ICmpInst(pred, X, NegX); + } + } + default: break; + } + } else if (IntrinsicInst *II = dyn_cast(LHSI)) { + // Handle icmp {eq|ne} , intcst. + if (II->getIntrinsicID() == Intrinsic::bswap) { + AddToWorkList(II); + ICI.setOperand(0, II->getOperand(1)); + ICI.setOperand(1, ConstantInt::get(RHSV.byteSwap())); + return &ICI; + } + } + } else { // Not a ICMP_EQ/ICMP_NE + // If the LHS is a cast from an integral value of the same size, then + // since we know the RHS is a constant, try to simlify. + if (CastInst *Cast = dyn_cast(LHSI)) { + Value *CastOp = Cast->getOperand(0); + const Type *SrcTy = CastOp->getType(); + uint32_t SrcTySize = SrcTy->getPrimitiveSizeInBits(); + if (SrcTy->isInteger() && + SrcTySize == Cast->getType()->getPrimitiveSizeInBits()) { + // If this is an unsigned comparison, try to make the comparison use + // smaller constant values. + if (ICI.getPredicate() == ICmpInst::ICMP_ULT && RHSV.isSignBit()) { + // X u< 128 => X s> -1 + return new ICmpInst(ICmpInst::ICMP_SGT, CastOp, + ConstantInt::get(APInt::getAllOnesValue(SrcTySize))); + } else if (ICI.getPredicate() == ICmpInst::ICMP_UGT && + RHSV == APInt::getSignedMaxValue(SrcTySize)) { + // X u> 127 => X s< 0 + return new ICmpInst(ICmpInst::ICMP_SLT, CastOp, + Constant::getNullValue(SrcTy)); + } + } + } + } + return 0; +} + +/// visitICmpInstWithCastAndCast - Handle icmp (cast x to y), (cast/cst). +/// We only handle extending casts so far. +/// Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) { const CastInst *LHSCI = cast(ICI.getOperand(0)); Value *LHSCIOp = LHSCI->getOperand(0); @@ -6286,8 +6319,7 @@ case Instruction::And: case Instruction::Or: case Instruction::Xor: - // If we are discarding information, or just changing the sign, - // rewrite. + // If we are discarding information, rewrite. if (DestBitSize <= SrcBitSize && DestBitSize != 1) { // Don't insert two casts if they cannot be eliminated. We allow // two casts to be inserted if the sizes are the same. This could From clattner at apple.com Tue Apr 3 15:52:42 2007 From: clattner at apple.com (clattner at apple.com) Date: Tue, 3 Apr 2007 13:52:42 -0700 (PDT) Subject: [llvm-commits] [125692] Fix compilation of: Message-ID: <20070403205242.49C8ECE0C9CD@src> Revision: 125692 Author: clattner Date: 2007-04-03 13:52:42 -0700 (Tue, 03 Apr 2007) Log Message: ----------- Fix compilation of: @interface B -(int)bar; @end @interface A -(void) Foo:(int) state; @end @implementation A - (void) Foo:(int) state { int wasResponded = 0; @try { if (state) { B * b = 0; @try { } @finally { wasResponded = ![b bar]; } } } @finally { } } @end With -fexceptions. Modified Paths: -------------- apple-local/branches/llvm/gcc/llvm-convert.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-04-03 17:23:51 UTC (rev 125691) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-04-03 20:52:42 UTC (rev 125692) @@ -2659,6 +2659,7 @@ BasicBlock::iterator InsertPt; if (Instruction *I = dyn_cast(FirstVal)) { InsertPt = I; // Insert after the init instruction. + // If the instruction is an alloca in the entry block, the insert point // will be before the alloca. Advance to the AllocaInsertionPoint if we are // before it. @@ -2671,6 +2672,13 @@ } } } + + // If the instruction is an invoke, the init is inserted on the normal edge. + if (InvokeInst *II = dyn_cast(I)) { + InsertPt = II->getNormalDest()->begin(); + while (isa(InsertPt)) + ++InsertPt; + } } else { InsertPt = AllocaInsertionPoint; // Insert after the allocas. } From lauro.venancio at gmail.com Tue Apr 3 16:16:48 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Tue, 3 Apr 2007 18:16:48 -0300 Subject: [llvm-commits] [patch llvm-gcc] change the function arguments lowering Message-ID: <9c10c9f0704031416u4db1d03fw236fe76fcba2f00c@mail.gmail.com> This patch makes llvm-gcc use arrays to lower function arguments. For example a 30 bytes parameter is lowered to { [3 x i64], i32, i16} instead of { i64, i64, i64, i32, i16}. This reduces the size of ll file generated from lencod/rdopt.c from 17M to 1.2M. Lauro -------------- next part -------------- A non-text attachment was scrubbed... Name: llvm-gcc.patch Type: text/x-patch Size: 1775 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070403/53d86562/attachment.bin From evan.cheng at apple.com Tue Apr 3 16:31:38 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 3 Apr 2007 16:31:38 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMRegisterInfo.cpp Message-ID: <200704032131.l33LVcCe003325@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMRegisterInfo.cpp updated: 1.84 -> 1.85 --- Log message: Fixed a bug that causes codegen of noop like add r0, r0, #0. --- Diffs of the changes: (+1 -1) ARMRegisterInfo.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.84 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.85 --- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.84 Tue Mar 20 03:07:04 2007 +++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Tue Apr 3 16:31:21 2007 @@ -732,7 +732,7 @@ // a sequence of ADDri instructions. First though, pull as much of the imm // into this ADDri as possible. unsigned RotAmt = ARM_AM::getSOImmValRotate(Offset); - unsigned ThisImmVal = Offset & ARM_AM::rotr32(0xFF, (32-RotAmt) & 31); + unsigned ThisImmVal = Offset & ARM_AM::rotr32(0xFF, RotAmt); // We will handle these bits from offset, clear them. Offset &= ~ThisImmVal; From evan.cheng at apple.com Tue Apr 3 16:38:20 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 3 Apr 2007 16:38:20 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/ARM/2007-04-03-PEIBug.ll Message-ID: <200704032138.l33LcK5s003438@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/ARM: 2007-04-03-PEIBug.ll added (r1.1) --- Log message: New test case. --- Diffs of the changes: (+12 -0) 2007-04-03-PEIBug.ll | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/test/CodeGen/ARM/2007-04-03-PEIBug.ll diff -c /dev/null llvm/test/CodeGen/ARM/2007-04-03-PEIBug.ll:1.1 *** /dev/null Tue Apr 3 16:38:13 2007 --- llvm/test/CodeGen/ARM/2007-04-03-PEIBug.ll Tue Apr 3 16:38:03 2007 *************** *** 0 **** --- 1,12 ---- + ; RUN: llvm-as < %s | llc -march=arm | not grep "add.*#0" + + define i32 @foo() { + entry: + %A = alloca [1123 x i32], align 16 ; <[1123 x i32]*> [#uses=1] + %B = alloca [3123 x i32], align 16 ; <[3123 x i32]*> [#uses=1] + %C = alloca [12312 x i32], align 16 ; <[12312 x i32]*> [#uses=1] + %tmp = call i32 (...)* @bar( [3123 x i32]* %B, [1123 x i32]* %A, [12312 x i32]* %C ) ; [#uses=0] + ret i32 undef + } + + declare i32 @bar(...) From lattner at cs.uiuc.edu Tue Apr 3 16:45:32 2007 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 3 Apr 2007 16:45:32 -0500 Subject: [llvm-commits] CVS: llvm/test/FrontendObjC/ Message-ID: <200704032145.l33LjWtM003690@zion.cs.uiuc.edu> Changes in directory llvm/test/FrontendObjC: --- Log message: Directory /var/cvs/llvm/llvm/test/FrontendObjC added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From lattner at cs.uiuc.edu Tue Apr 3 16:45:32 2007 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 3 Apr 2007 16:45:32 -0500 Subject: [llvm-commits] CVS: llvm/test/FrontendAda/ Message-ID: <200704032145.l33LjWAE003687@zion.cs.uiuc.edu> Changes in directory llvm/test/FrontendAda: --- Log message: Directory /var/cvs/llvm/llvm/test/FrontendAda added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From sabre at nondot.org Tue Apr 3 16:46:40 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 16:46:40 -0500 Subject: [llvm-commits] CVS: llvm/test/FrontendAda/array_constructor.adb array_range_ref.adb array_ref.adb array_size.adb emit_var.ads fat_fields.adb fat_fields.ads non_lvalue.adb non_lvalue.ads switch.adb var_size.adb var_size.ads vce.adb vce_lv.adb Message-ID: <200704032146.l33LkelW003826@zion.cs.uiuc.edu> Changes in directory llvm/test/FrontendAda: array_constructor.adb added (r1.1) array_range_ref.adb added (r1.1) array_ref.adb added (r1.1) array_size.adb added (r1.1) emit_var.ads added (r1.1) fat_fields.adb added (r1.1) fat_fields.ads added (r1.1) non_lvalue.adb added (r1.1) non_lvalue.ads added (r1.1) switch.adb added (r1.1) var_size.adb added (r1.1) var_size.ads added (r1.1) vce.adb added (r1.1) vce_lv.adb added (r1.1) --- Log message: move ada tests --- Diffs of the changes: (+115 -0) array_constructor.adb | 6 ++++++ array_range_ref.adb | 7 +++++++ array_ref.adb | 11 +++++++++++ array_size.adb | 10 ++++++++++ emit_var.ads | 5 +++++ fat_fields.adb | 10 ++++++++++ fat_fields.ads | 6 ++++++ non_lvalue.adb | 7 +++++++ non_lvalue.ads | 11 +++++++++++ switch.adb | 12 ++++++++++++ var_size.adb | 7 +++++++ var_size.ads | 7 +++++++ vce.adb | 7 +++++++ vce_lv.adb | 9 +++++++++ 14 files changed, 115 insertions(+) Index: llvm/test/FrontendAda/array_constructor.adb diff -c /dev/null llvm/test/FrontendAda/array_constructor.adb:1.1 *** /dev/null Tue Apr 3 16:46:32 2007 --- llvm/test/FrontendAda/array_constructor.adb Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,6 ---- + -- RUN: %llvmgcc -c %s -o /dev/null + procedure Array_Constructor is + A : array (Integer range <>) of Boolean := (True, False); + begin + null; + end; Index: llvm/test/FrontendAda/array_range_ref.adb diff -c /dev/null llvm/test/FrontendAda/array_range_ref.adb:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/array_range_ref.adb Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,7 ---- + -- RUN: %llvmgcc -c %s -o /dev/null + procedure Array_Range_Ref is + A : String (1 .. 3); + B : String := A (A'RANGE)(1 .. 3); + begin + null; + end; Index: llvm/test/FrontendAda/array_ref.adb diff -c /dev/null llvm/test/FrontendAda/array_ref.adb:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/array_ref.adb Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,11 ---- + -- RUN: %llvmgcc -c %s -o /dev/null + procedure Array_Ref is + type A is array (Natural range <>, Natural range <>) of Boolean; + type A_Access is access A; + function Get (X : A_Access) return Boolean is + begin + return X (0, 0); + end; + begin + null; + end; Index: llvm/test/FrontendAda/array_size.adb diff -c /dev/null llvm/test/FrontendAda/array_size.adb:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/array_size.adb Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,10 ---- + -- RUN: %llvmgcc -c %s -o /dev/null + procedure Array_Size is + subtype S is String (1 .. 2); + type R is record + A : S; + end record; + X : R; + begin + null; + end; Index: llvm/test/FrontendAda/emit_var.ads diff -c /dev/null llvm/test/FrontendAda/emit_var.ads:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/emit_var.ads Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,5 ---- + -- RUN: %llvmgcc -c %s -o /dev/null + with Ada.Finalization; + package Emit_Var is + type Search_Type is new Ada.Finalization.Controlled with null record; + end; Index: llvm/test/FrontendAda/fat_fields.adb diff -c /dev/null llvm/test/FrontendAda/fat_fields.adb:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/fat_fields.adb Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,10 ---- + -- RUN: %llvmgcc -c %s -o /dev/null + -- RUN: %llvmgcc -c %s -O2 -o /dev/null + package body Fat_Fields is + procedure Proc is + begin + if P = null then + null; + end if; + end; + end; Index: llvm/test/FrontendAda/fat_fields.ads diff -c /dev/null llvm/test/FrontendAda/fat_fields.ads:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/fat_fields.ads Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,6 ---- + package Fat_Fields is + pragma Elaborate_Body; + type A is array (Positive range <>) of Boolean; + type A_Ptr is access A; + P : A_Ptr := null; + end; Index: llvm/test/FrontendAda/non_lvalue.adb diff -c /dev/null llvm/test/FrontendAda/non_lvalue.adb:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/non_lvalue.adb Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,7 ---- + -- RUN: %llvmgcc -c %s -o /dev/null + package body Non_LValue is + function A (Y : U) return String is + begin + return Y.X.B; + end; + end; Index: llvm/test/FrontendAda/non_lvalue.ads diff -c /dev/null llvm/test/FrontendAda/non_lvalue.ads:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/non_lvalue.ads Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,11 ---- + package Non_LValue is + type T (Length : Natural) is record + A : String (1 .. Length); + B : String (1 .. Length); + end record; + type T_Ptr is access all T; + type U is record + X : T_Ptr; + end record; + function A (Y : U) return String; + end; Index: llvm/test/FrontendAda/switch.adb diff -c /dev/null llvm/test/FrontendAda/switch.adb:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/switch.adb Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,12 ---- + -- RUN: %llvmgcc -c %s -o /dev/null + function Switch (N : Integer) return Integer is + begin + case N is + when Integer'First .. -1 => + return -1; + when 0 => + return 0; + when others => + return 1; + end case; + end; Index: llvm/test/FrontendAda/var_size.adb diff -c /dev/null llvm/test/FrontendAda/var_size.adb:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/var_size.adb Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,7 ---- + -- RUN: %llvmgcc -c %s -o /dev/null + package body Var_Size is + function A (X : T) return String is + begin + return X.A; + end; + end; Index: llvm/test/FrontendAda/var_size.ads diff -c /dev/null llvm/test/FrontendAda/var_size.ads:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/var_size.ads Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,7 ---- + package Var_Size is + type T (Length : Natural) is record + A : String (1 .. Length); + B : String (1 .. Length); + end record; + function A (X : T) return String; + end; Index: llvm/test/FrontendAda/vce.adb diff -c /dev/null llvm/test/FrontendAda/vce.adb:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/vce.adb Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,7 ---- + -- RUN: %llvmgcc -c %s -o /dev/null + procedure VCE is + S : String (1 .. 2); + B : Character := 'B'; + begin + S := 'A' & B; + end; Index: llvm/test/FrontendAda/vce_lv.adb diff -c /dev/null llvm/test/FrontendAda/vce_lv.adb:1.1 *** /dev/null Tue Apr 3 16:46:40 2007 --- llvm/test/FrontendAda/vce_lv.adb Tue Apr 3 16:46:22 2007 *************** *** 0 **** --- 1,9 ---- + -- RUN: %llvmgcc -c %s -o /dev/null + procedure VCE_LV is + type P is access String ; + type T is new P (5 .. 7); + subtype U is String (5 .. 7); + X : T := new U'(others => 'A'); + begin + null; + end; From sabre at nondot.org Tue Apr 3 16:47:53 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 16:47:53 -0500 Subject: [llvm-commits] CVS: llvm/test/FrontendObjC/2007-04-03-ObjcEH.m Message-ID: <200704032147.l33LlrdI003938@zion.cs.uiuc.edu> Changes in directory llvm/test/FrontendObjC: 2007-04-03-ObjcEH.m added (r1.1) --- Log message: testcase for recent bugfix --- Diffs of the changes: (+29 -0) 2007-04-03-ObjcEH.m | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+) Index: llvm/test/FrontendObjC/2007-04-03-ObjcEH.m diff -c /dev/null llvm/test/FrontendObjC/2007-04-03-ObjcEH.m:1.1 *** /dev/null Tue Apr 3 16:47:46 2007 --- llvm/test/FrontendObjC/2007-04-03-ObjcEH.m Tue Apr 3 16:47:36 2007 *************** *** 0 **** --- 1,29 ---- + // RUN: %llvmgcc -c %s -o /dev/null + + @interface B + -(int)bar; + @end + + @interface A + -(void) Foo:(int) state; + @end + + @implementation A + - (void) Foo:(int) state { + + int wasResponded = 0; + @try { + if (state) { + B * b = 0; + @try { } + @finally { + wasResponded = ![b bar]; + } + } + } + @finally { + } + } + @end + + From lattner at cs.uiuc.edu Tue Apr 3 16:49:51 2007 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 3 Apr 2007 16:49:51 -0500 Subject: [llvm-commits] CVS: llvm/test/AdaFrontend/array_constructor.adb array_range_ref.adb array_ref.adb array_size.adb emit_var.ads fat_fields.adb fat_fields.ads non_lvalue.adb non_lvalue.ads switch.adb var_size.adb var_size.ads vce.adb vce_lv.adb Message-ID: <200704032149.l33LnpSX004033@zion.cs.uiuc.edu> Changes in directory llvm/test/AdaFrontend: array_constructor.adb (r1.1) removed array_range_ref.adb (r1.1) removed array_ref.adb (r1.1) removed array_size.adb (r1.1) removed emit_var.ads (r1.1) removed fat_fields.adb (r1.1) removed fat_fields.ads (r1.1) removed non_lvalue.adb (r1.1) removed non_lvalue.ads (r1.1) removed switch.adb (r1.1) removed var_size.adb (r1.1) removed var_size.ads (r1.1) removed vce.adb (r1.1) removed vce_lv.adb (r1.1) removed --- Log message: move these to FrontendAda --- Diffs of the changes: (+0 -0) 0 files changed From sabre at nondot.org Tue Apr 3 17:15:55 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 17:15:55 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/StringMap.cpp Message-ID: <200704032215.l33MFtYv004650@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: StringMap.cpp updated: 1.9 -> 1.10 --- Log message: greatly reduce hte default size of stringmap. --- Diffs of the changes: (+1 -1) StringMap.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Support/StringMap.cpp diff -u llvm/lib/Support/StringMap.cpp:1.9 llvm/lib/Support/StringMap.cpp:1.10 --- llvm/lib/Support/StringMap.cpp:1.9 Sun Feb 11 14:58:00 2007 +++ llvm/lib/Support/StringMap.cpp Tue Apr 3 17:15:38 2007 @@ -18,7 +18,7 @@ StringMapImpl::StringMapImpl(unsigned InitSize, unsigned itemSize) { assert((InitSize & (InitSize-1)) == 0 && "Init Size must be a power of 2 or zero!"); - NumBuckets = InitSize ? InitSize : 512; + NumBuckets = InitSize ? InitSize : 16; ItemSize = itemSize; NumItems = 0; NumTombstones = 0; From criswell at cs.uiuc.edu Tue Apr 3 17:32:28 2007 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 3 Apr 2007 17:32:28 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704032232.RAA12379@choi.cs.uiuc.edu> Changes in directory llvm-www: Users.html added (r1.1) --- Log message: List of Users of LLVM. --- Diffs of the changes: (+171 -0) Users.html | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 171 insertions(+) Index: llvm-www/Users.html diff -c /dev/null llvm-www/Users.html:1.1 *** /dev/null Tue Apr 3 17:31:59 2007 --- llvm-www/Users.html Tue Apr 3 17:31:48 2007 *************** *** 0 **** --- 1,171 ---- + + +
        LLVM Users
        + +

        + This page lists the people and organizations that have used or are currently + using LLVM in research, education, industry, or open source development. It + only includes users who have publicly discussed their use of LLVM in one form + or another (mentioned it on llvmdev, published work on it, etc.). + We believe there are many other users not listed here and would welcome a brief + note telling us about your use so that we can add you to the list. +

        + +
        Industry Users
        +
        + +
        +
        Suggested ByIssue or Discussion Topic
        Suggested ByIssue or Discussion Topic
        Owen AndersonFuture development practices: with a burgeoning number of clients and wider adoption, do we want more organized development practices? i.e. release focuses or something?
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        CompanyDescription
        AsceniumCompiler for reconfigurable processor
        Apple ComputerOpenGL Engine in MacOS X (Leopard)
        Hue ASJIT compilation of shader programs
        MobileyeCompiler for stack machine architecture
        Siemens Technology-to-Business CenterCompiler for embedded VLIW processor
        + +
        +
        Academic/Research Users
        +
        + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        OrganizationPeopleDescription
        Ghent UniversityKenneth HosteInstrumentation of software
        New York UniversityAnna Zaks Validation of interprocedural optimizations
        + University of California, San Diego + Michael McCracken + LENS Framework +
        + University of California, Los Angeles + Jason Cong xPilot behavioral synthesis system
        + University of Illinois at Urbana-Champaign + + Vikram Adve's Research Group + All LLVM Group Research Projects
        +
        + +
        + +
        Educational Users
        +
        + +
        + + + + + + + + + + + + +
        OrganizationClass
        + University of Illinois at Urbana-Champaign + CS 426, CS 526, CS 433, CS 533
        +
        + +
        + +
        Open Source Projects
        +
        + +
        + + + + + + + + + + + + +
        ProjectDescription
        PyPy ProjectPython interpreter written in Python. Targets LLVM and C.
        +
        + + + + +
        +
        + Valid CSS! + Valid HTML 4.01! + +
        LLVM Development List
        + Last modified: $Date: 2007/04/03 22:31:48 $ +
        + From reid at x10sys.com Tue Apr 3 17:59:18 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 17:59:18 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704032259.l33MxIRV005472@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.36 -> 1.37 --- Log message: Add Stuart Hastings --- Diffs of the changes: (+5 -4) DevMtgMay2007.html | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.36 llvm-www/DevMtgMay2007.html:1.37 --- llvm-www/DevMtgMay2007.html:1.36 Tue Apr 3 12:08:45 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 17:59:01 2007 @@ -233,6 +233,7 @@ Ryan BrownGoogle Evan ChengApple, Inc. Jeff CohenIndependent + Stuart HastingsApple, Inc. Robert HundtGoogle Christopher LambAgeia Technologies, Inc. Chris LattnerApple, Inc. @@ -246,13 +247,13 @@ Marcel WeiherMetaObject Unconfirmed Attendees NameOrganization - Unconfirmed 3Adobe - Unconfirmed 2+Apple + Unconfirmed 3Adobe Systems Incorporated. + Unconfirmed 2+Apple, Inc. Unconfirmed 2Aerospace Unconfirmed 1Wind River Unconfirmed 1NASA, Ames -

        Total confirmed attendees: 16

        +

        Total confirmed attendees: 17

        Possible additional attendees: 9

        @@ -263,6 +264,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
        Last modified: $Date: 2007/04/03 17:08:45 $ +
        Last modified: $Date: 2007/04/03 22:59:01 $ From sabre at nondot.org Tue Apr 3 18:29:57 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 18:29:57 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704032329.l33NTvYX006092@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.727 -> 1.728 --- Log message: Fix a bug I introduced with my patch yesterday which broke Qt (I converted some constant exprs to apints). Thanks to Anton for tracking down a small testcase that triggered this! --- Diffs of the changes: (+1 -1) InstructionCombining.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.727 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.728 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.727 Tue Apr 3 12:43:25 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Apr 3 18:29:39 2007 @@ -5087,7 +5087,7 @@ Mask, LHSI->getName()+".mask"); Value *And = InsertNewInstBefore(AndI, ICI); return new ICmpInst(ICI.getPredicate(), And, - ConstantInt::get(RHSV << ShAmtVal)); + ConstantInt::get(RHSV.lshr(ShAmtVal))); } } } From isanbard at gmail.com Tue Apr 3 18:37:37 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 3 Apr 2007 18:37:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200704032337.l33NbbrT006252@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.160 -> 1.161 --- Log message: Updated --- Diffs of the changes: (+4 -0) README.txt | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.160 llvm/lib/Target/X86/README.txt:1.161 --- llvm/lib/Target/X86/README.txt:1.160 Wed Mar 28 13:17:19 2007 +++ llvm/lib/Target/X86/README.txt Tue Apr 3 18:37:20 2007 @@ -1039,3 +1039,7 @@ return f(decode); return 0; } + +//===---------------------------------------------------------------------===// + +Add support for 3DNow! From evan.cheng at apple.com Tue Apr 3 18:40:09 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 3 Apr 2007 18:40:09 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp Message-ID: <200704032340.l33Ne9ei006311@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMConstantIslandPass.cpp updated: 1.34 -> 1.35 --- Log message: Remove unused constant pool entries. --- Diffs of the changes: (+60 -32) ARMConstantIslandPass.cpp | 92 ++++++++++++++++++++++++++++++---------------- 1 files changed, 60 insertions(+), 32 deletions(-) Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.34 llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.35 --- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.34 Mon Apr 2 15:31:06 2007 +++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp Tue Apr 3 18:39:48 2007 @@ -139,13 +139,15 @@ MachineBasicBlock *SplitBlockBeforeInstr(MachineInstr *MI); void UpdateForInsertedWaterBlock(MachineBasicBlock *NewBB); void AdjustBBOffsetsAfter(MachineBasicBlock *BB, int delta); - bool DecrementOldEntry(unsigned CPI, MachineInstr* CPEMI, unsigned Size); + bool DecrementOldEntry(unsigned CPI, MachineInstr* CPEMI); int LookForExistingCPEntry(CPUser& U, unsigned UserOffset); bool LookForWater(CPUser&U, unsigned UserOffset, bool* PadNewWater, MachineBasicBlock** NewMBB); void CreateNewWater(unsigned CPUserIndex, unsigned UserOffset, MachineBasicBlock** NewMBB); bool HandleConstantPoolUser(MachineFunction &Fn, unsigned CPUserIndex); + void RemoveDeadCPEMI(MachineInstr *CPEMI); + bool RemoveUnusedCPEntries(); bool CPEIsInRange(MachineInstr *MI, unsigned UserOffset, MachineInstr *CPEMI, unsigned Disp, bool DoDump); @@ -197,6 +199,9 @@ InitialFunctionScan(Fn, CPEMIs); CPEMIs.clear(); + /// Remove dead constant pool entries. + RemoveUnusedCPEntries(); + // Iteratively place constant pool entries and fix up branches until there // is no change. bool MadeChange = false; @@ -210,7 +215,7 @@ break; MadeChange = true; } - + // If LR has been forced spilled and no far jumps (i.e. BL) has been issued. // Undo the spill / restore of LR if possible. if (!HasFarJump && AFI->isLRSpilledForFarJump() && isThumb) @@ -648,34 +653,13 @@ /// becomes 0 remove the entry and instruction. Returns true if we removed /// the entry, false if we didn't. -bool ARMConstantIslands::DecrementOldEntry(unsigned CPI, MachineInstr *CPEMI, - unsigned Size) { +bool ARMConstantIslands::DecrementOldEntry(unsigned CPI, MachineInstr *CPEMI) { // Find the old entry. Eliminate it if it is no longer used. - CPEntry *OldCPE = findConstPoolEntry(CPI, CPEMI); - assert(OldCPE && "Unexpected!"); - if (--OldCPE->RefCount == 0) { - MachineBasicBlock *OldCPEBB = OldCPE->CPEMI->getParent(); - if (OldCPEBB->empty()) { - // In thumb mode, the size of island is padded by two to compensate for - // the alignment requirement. Thus it will now be 2 when the block is - // empty, so fix this. - // All succeeding offsets have the current size value added in, fix this. - if (BBSizes[OldCPEBB->getNumber()] != 0) { - AdjustBBOffsetsAfter(OldCPEBB, -BBSizes[OldCPEBB->getNumber()]); - BBSizes[OldCPEBB->getNumber()] = 0; - } - // An island has only one predecessor BB and one successor BB. Check if - // this BB's predecessor jumps directly to this BB's successor. This - // shouldn't happen currently. - assert(!BBIsJumpedOver(OldCPEBB) && "How did this happen?"); - // FIXME: remove the empty blocks after all the work is done? - } else { - BBSizes[OldCPEBB->getNumber()] -= Size; - // All succeeding offsets have the current size value added in, fix this. - AdjustBBOffsetsAfter(OldCPEBB, -Size); - } - OldCPE->CPEMI->eraseFromParent(); - OldCPE->CPEMI = NULL; + CPEntry *CPE = findConstPoolEntry(CPI, CPEMI); + assert(CPE && "Unexpected!"); + if (--CPE->RefCount == 0) { + RemoveDeadCPEMI(CPEMI); + CPE->CPEMI = NULL; NumCPEs--; return true; } @@ -723,8 +707,7 @@ CPEs[i].RefCount++; // ...and the original. If we didn't remove the old entry, none of the // addresses changed, so we don't need another pass. - unsigned Size = CPEMI->getOperand(2).getImm(); - return DecrementOldEntry(CPI, CPEMI, Size) ? 2 : 1; + return DecrementOldEntry(CPI, CPEMI) ? 2 : 1; } } return 0; @@ -910,7 +893,7 @@ UpdateForInsertedWaterBlock(NewIsland); // Decrement the old entry, and remove it if refcount becomes 0. - DecrementOldEntry(CPI, CPEMI, Size); + DecrementOldEntry(CPI, CPEMI); // Now that we have an island to add the CPE to, clone the original CPE and // add it to the island. @@ -938,6 +921,51 @@ return true; } +/// RemoveDeadCPEMI - Remove a dead constant pool entry instruction. Update +/// sizes and offsets of impacted basic blocks. +void ARMConstantIslands::RemoveDeadCPEMI(MachineInstr *CPEMI) { + MachineBasicBlock *CPEBB = CPEMI->getParent(); + if (CPEBB->empty()) { + // In thumb mode, the size of island is padded by two to compensate for + // the alignment requirement. Thus it will now be 2 when the block is + // empty, so fix this. + // All succeeding offsets have the current size value added in, fix this. + if (BBSizes[CPEBB->getNumber()] != 0) { + AdjustBBOffsetsAfter(CPEBB, -BBSizes[CPEBB->getNumber()]); + BBSizes[CPEBB->getNumber()] = 0; + } + // An island has only one predecessor BB and one successor BB. Check if + // this BB's predecessor jumps directly to this BB's successor. This + // shouldn't happen currently. + assert(!BBIsJumpedOver(CPEBB) && "How did this happen?"); + // FIXME: remove the empty blocks after all the work is done? + } else { + unsigned Size = CPEMI->getOperand(2).getImm(); + BBSizes[CPEBB->getNumber()] -= Size; + // All succeeding offsets have the current size value added in, fix this. + AdjustBBOffsetsAfter(CPEBB, -Size); + } + + CPEMI->eraseFromParent(); +} + +/// RemoveUnusedCPEntries - Remove constant pool entries whose refcounts +/// are zero. +bool ARMConstantIslands::RemoveUnusedCPEntries() { + unsigned MadeChange = false; + for (unsigned i = 0, e = CPEntries.size(); i != e; ++i) { + std::vector &CPEs = CPEntries[i]; + for (unsigned j = 0, ee = CPEs.size(); j != ee; ++j) { + if (CPEs[j].RefCount == 0 && CPEs[j].CPEMI) { + RemoveDeadCPEMI(CPEs[j].CPEMI); + CPEs[j].CPEMI = NULL; + MadeChange = true; + } + } + } + return MadeChange; +} + /// BBIsInRange - Returns true if the distance between specific MI and /// specific BB can fit in MI's displacement field. bool ARMConstantIslands::BBIsInRange(MachineInstr *MI,MachineBasicBlock *DestBB, From evan.cheng at apple.com Tue Apr 3 18:41:11 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 3 Apr 2007 18:41:11 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/ARM/2007-04-03-UndefinedSymbol.ll Message-ID: <200704032341.l33NfBXk006362@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/ARM: 2007-04-03-UndefinedSymbol.ll added (r1.1) --- Log message: New test case. --- Diffs of the changes: (+98 -0) 2007-04-03-UndefinedSymbol.ll | 98 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 98 insertions(+) Index: llvm/test/CodeGen/ARM/2007-04-03-UndefinedSymbol.ll diff -c /dev/null llvm/test/CodeGen/ARM/2007-04-03-UndefinedSymbol.ll:1.1 *** /dev/null Tue Apr 3 18:41:04 2007 --- llvm/test/CodeGen/ARM/2007-04-03-UndefinedSymbol.ll Tue Apr 3 18:40:54 2007 *************** *** 0 **** --- 1,98 ---- + ; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin -relocation-model=pic | not grep "LPC9" + + %struct.B = type { i32 } + %struct.anon = type { void (%struct.B*)*, i32 } + @str = internal constant [7 x i8] c"i, %d\0A\00" ; <[7 x i8]*> [#uses=1] + @str1 = internal constant [7 x i8] c"j, %d\0A\00" ; <[7 x i8]*> [#uses=1] + + define internal void @_ZN1B1iEv(%struct.B* %this) { + entry: + %tmp1 = getelementptr %struct.B* %this, i32 0, i32 0 ; [#uses=1] + %tmp2 = load i32* %tmp1 ; [#uses=1] + %tmp4 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([7 x i8]* @str, i32 0, i32 0), i32 %tmp2 ) ; [#uses=0] + ret void + } + + declare i32 @printf(i8*, ...) + + define internal void @_ZN1B1jEv(%struct.B* %this) { + entry: + %tmp1 = getelementptr %struct.B* %this, i32 0, i32 0 ; [#uses=1] + %tmp2 = load i32* %tmp1 ; [#uses=1] + %tmp4 = tail call i32 (i8*, ...)* @printf( i8* getelementptr ([7 x i8]* @str1, i32 0, i32 0), i32 %tmp2 ) ; [#uses=0] + ret void + } + + define i32 @main() { + entry: + %b.i29 = alloca %struct.B, align 4 ; <%struct.B*> [#uses=3] + %b.i1 = alloca %struct.B, align 4 ; <%struct.B*> [#uses=3] + %b.i = alloca %struct.B, align 4 ; <%struct.B*> [#uses=3] + %tmp2.i = getelementptr %struct.B* %b.i, i32 0, i32 0 ; [#uses=1] + store i32 4, i32* %tmp2.i + br i1 icmp eq (i64 and (i64 zext (i32 ptrtoint (void (%struct.B*)* @_ZN1B1iEv to i32) to i64), i64 4294967296), i64 0), label %_Z3fooiM1BFvvE.exit, label %cond_true.i + + cond_true.i: ; preds = %entry + %b2.i = bitcast %struct.B* %b.i to i8* ; [#uses=1] + %ctg23.i = getelementptr i8* %b2.i, i32 ashr (i32 trunc (i64 lshr (i64 zext (i32 ptrtoint (void (%struct.B*)* @_ZN1B1iEv to i32) to i64), i64 32) to i32), i32 1) ; [#uses=1] + %tmp121314.i = bitcast i8* %ctg23.i to i32 (...)*** ; [#uses=1] + %tmp15.i = load i32 (...)*** %tmp121314.i ; [#uses=1] + %tmp151.i = bitcast i32 (...)** %tmp15.i to i8* ; [#uses=1] + %ctg2.i = getelementptr i8* %tmp151.i, i32 ptrtoint (void (%struct.B*)* @_ZN1B1iEv to i32) ; [#uses=1] + %tmp2021.i = bitcast i8* %ctg2.i to i32 (...)** ; [#uses=1] + %tmp22.i = load i32 (...)** %tmp2021.i ; [#uses=1] + %tmp2223.i = bitcast i32 (...)* %tmp22.i to void (%struct.B*)* ; [#uses=1] + br label %_Z3fooiM1BFvvE.exit + + _Z3fooiM1BFvvE.exit: ; preds = %cond_true.i, %entry + %iftmp.2.0.i = phi void (%struct.B*)* [ %tmp2223.i, %cond_true.i ], [ inttoptr (i32 ptrtoint (void (%struct.B*)* @_ZN1B1iEv to i32) to void (%struct.B*)*), %entry ] ; [#uses=1] + %b4.i = bitcast %struct.B* %b.i to i8* ; [#uses=1] + %ctg25.i = getelementptr i8* %b4.i, i32 ashr (i32 trunc (i64 lshr (i64 zext (i32 ptrtoint (void (%struct.B*)* @_ZN1B1iEv to i32) to i64), i64 32) to i32), i32 1) ; [#uses=1] + %tmp3031.i = bitcast i8* %ctg25.i to %struct.B* ; <%struct.B*> [#uses=1] + call void %iftmp.2.0.i( %struct.B* %tmp3031.i ) + %tmp2.i30 = getelementptr %struct.B* %b.i29, i32 0, i32 0 ; [#uses=1] + store i32 6, i32* %tmp2.i30 + br i1 icmp eq (i64 and (i64 zext (i32 ptrtoint (void (%struct.B*)* @_ZN1B1jEv to i32) to i64), i64 4294967296), i64 0), label %_Z3fooiM1BFvvE.exit56, label %cond_true.i46 + + cond_true.i46: ; preds = %_Z3fooiM1BFvvE.exit + %b2.i35 = bitcast %struct.B* %b.i29 to i8* ; [#uses=1] + %ctg23.i36 = getelementptr i8* %b2.i35, i32 ashr (i32 trunc (i64 lshr (i64 zext (i32 ptrtoint (void (%struct.B*)* @_ZN1B1jEv to i32) to i64), i64 32) to i32), i32 1) ; [#uses=1] + %tmp121314.i37 = bitcast i8* %ctg23.i36 to i32 (...)*** ; [#uses=1] + %tmp15.i38 = load i32 (...)*** %tmp121314.i37 ; [#uses=1] + %tmp151.i41 = bitcast i32 (...)** %tmp15.i38 to i8* ; [#uses=1] + %ctg2.i42 = getelementptr i8* %tmp151.i41, i32 ptrtoint (void (%struct.B*)* @_ZN1B1jEv to i32) ; [#uses=1] + %tmp2021.i43 = bitcast i8* %ctg2.i42 to i32 (...)** ; [#uses=1] + %tmp22.i44 = load i32 (...)** %tmp2021.i43 ; [#uses=1] + %tmp2223.i45 = bitcast i32 (...)* %tmp22.i44 to void (%struct.B*)* ; [#uses=1] + br label %_Z3fooiM1BFvvE.exit56 + + _Z3fooiM1BFvvE.exit56: ; preds = %cond_true.i46, %_Z3fooiM1BFvvE.exit + %iftmp.2.0.i49 = phi void (%struct.B*)* [ %tmp2223.i45, %cond_true.i46 ], [ inttoptr (i32 ptrtoint (void (%struct.B*)* @_ZN1B1jEv to i32) to void (%struct.B*)*), %_Z3fooiM1BFvvE.exit ] ; [#uses=1] + %b4.i53 = bitcast %struct.B* %b.i29 to i8* ; [#uses=1] + %ctg25.i54 = getelementptr i8* %b4.i53, i32 ashr (i32 trunc (i64 lshr (i64 zext (i32 ptrtoint (void (%struct.B*)* @_ZN1B1jEv to i32) to i64), i64 32) to i32), i32 1) ; [#uses=1] + %tmp3031.i55 = bitcast i8* %ctg25.i54 to %struct.B* ; <%struct.B*> [#uses=1] + call void %iftmp.2.0.i49( %struct.B* %tmp3031.i55 ) + %tmp2.i2 = getelementptr %struct.B* %b.i1, i32 0, i32 0 ; [#uses=1] + store i32 -1, i32* %tmp2.i2 + br i1 icmp eq (i64 and (i64 zext (i32 ptrtoint (void (%struct.B*)* @_ZN1B1iEv to i32) to i64), i64 4294967296), i64 0), label %_Z3fooiM1BFvvE.exit28, label %cond_true.i18 + + cond_true.i18: ; preds = %_Z3fooiM1BFvvE.exit56 + %b2.i7 = bitcast %struct.B* %b.i1 to i8* ; [#uses=1] + %ctg23.i8 = getelementptr i8* %b2.i7, i32 ashr (i32 trunc (i64 lshr (i64 zext (i32 ptrtoint (void (%struct.B*)* @_ZN1B1iEv to i32) to i64), i64 32) to i32), i32 1) ; [#uses=1] + %tmp121314.i9 = bitcast i8* %ctg23.i8 to i32 (...)*** ; [#uses=1] + %tmp15.i10 = load i32 (...)*** %tmp121314.i9 ; [#uses=1] + %tmp151.i13 = bitcast i32 (...)** %tmp15.i10 to i8* ; [#uses=1] + %ctg2.i14 = getelementptr i8* %tmp151.i13, i32 ptrtoint (void (%struct.B*)* @_ZN1B1iEv to i32) ; [#uses=1] + %tmp2021.i15 = bitcast i8* %ctg2.i14 to i32 (...)** ; [#uses=1] + %tmp22.i16 = load i32 (...)** %tmp2021.i15 ; [#uses=1] + %tmp2223.i17 = bitcast i32 (...)* %tmp22.i16 to void (%struct.B*)* ; [#uses=1] + br label %_Z3fooiM1BFvvE.exit28 + + _Z3fooiM1BFvvE.exit28: ; preds = %cond_true.i18, %_Z3fooiM1BFvvE.exit56 + %iftmp.2.0.i21 = phi void (%struct.B*)* [ %tmp2223.i17, %cond_true.i18 ], [ inttoptr (i32 ptrtoint (void (%struct.B*)* @_ZN1B1iEv to i32) to void (%struct.B*)*), %_Z3fooiM1BFvvE.exit56 ] ; [#uses=1] + %b4.i25 = bitcast %struct.B* %b.i1 to i8* ; [#uses=1] + %ctg25.i26 = getelementptr i8* %b4.i25, i32 ashr (i32 trunc (i64 lshr (i64 zext (i32 ptrtoint (void (%struct.B*)* @_ZN1B1iEv to i32) to i64), i64 32) to i32), i32 1) ; [#uses=1] + %tmp3031.i27 = bitcast i8* %ctg25.i26 to %struct.B* ; <%struct.B*> [#uses=1] + call void %iftmp.2.0.i21( %struct.B* %tmp3031.i27 ) + ret i32 0 + } From sabre at nondot.org Tue Apr 3 18:41:51 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 18:41:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200704032341.l33NfpZF006401@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.161 -> 1.162 --- Log message: make a new missing features section --- Diffs of the changes: (+6 -2) README.txt | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.161 llvm/lib/Target/X86/README.txt:1.162 --- llvm/lib/Target/X86/README.txt:1.161 Tue Apr 3 18:37:20 2007 +++ llvm/lib/Target/X86/README.txt Tue Apr 3 18:41:34 2007 @@ -2,6 +2,12 @@ // Random ideas for the X86 backend. //===---------------------------------------------------------------------===// +Missing features: + - support for 3DNow! + - weird abis? + +//===---------------------------------------------------------------------===// + Add a MUL2U and MUL2S nodes to represent a multiply that returns both the Hi and Lo parts (combination of MUL and MULH[SU] into one node). Add this to X86, & make the dag combiner produce it when needed. This will eliminate one @@ -1040,6 +1046,4 @@ return 0; } -//===---------------------------------------------------------------------===// -Add support for 3DNow! From isanbard at gmail.com Tue Apr 3 18:48:50 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 3 Apr 2007 18:48:50 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.cpp X86InstrMMX.td Message-ID: <200704032348.l33NmorQ006590@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.cpp updated: 1.82 -> 1.83 X86InstrMMX.td updated: 1.29 -> 1.30 --- Log message: Adding more MMX instructions. --- Diffs of the changes: (+128 -64) X86InstrInfo.cpp | 4 - X86InstrMMX.td | 188 ++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 128 insertions(+), 64 deletions(-) Index: llvm/lib/Target/X86/X86InstrInfo.cpp diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.82 llvm/lib/Target/X86/X86InstrInfo.cpp:1.83 --- llvm/lib/Target/X86/X86InstrInfo.cpp:1.82 Tue Apr 3 01:00:37 2007 +++ llvm/lib/Target/X86/X86InstrInfo.cpp Tue Apr 3 18:48:32 2007 @@ -38,7 +38,8 @@ oc == X86::MOVAPSrr || oc == X86::MOVAPDrr || oc == X86::MOVSS2PSrr || oc == X86::MOVSD2PDrr || oc == X86::MOVPS2SSrr || oc == X86::MOVPD2SDrr || - oc == X86::MMX_MOVD64rr || oc == X86::MMX_MOVQ64rr) { + oc == X86::MMX_MOVD64rr || oc == X86::MMX_MOVQ64rr || + oc == X86::MMX_MOVDQ2Qrr || oc == X86::MMX_MOVQ2DQrr) { assert(MI.getNumOperands() == 2 && MI.getOperand(0).isRegister() && MI.getOperand(1).isRegister() && @@ -97,6 +98,7 @@ case X86::MOVAPDmr: case X86::MMX_MOVD64mr: case X86::MMX_MOVQ64mr: + case X86::MMX_MOVNTQmr: if (MI->getOperand(0).isFrameIndex() && MI->getOperand(1).isImmediate() && MI->getOperand(2).isRegister() && MI->getOperand(3).isImmediate() && MI->getOperand(1).getImmedValue() == 1 && Index: llvm/lib/Target/X86/X86InstrMMX.td diff -u llvm/lib/Target/X86/X86InstrMMX.td:1.29 llvm/lib/Target/X86/X86InstrMMX.td:1.30 --- llvm/lib/Target/X86/X86InstrMMX.td:1.29 Tue Apr 3 01:00:37 2007 +++ llvm/lib/Target/X86/X86InstrMMX.td Tue Apr 3 18:48:32 2007 @@ -20,12 +20,19 @@ // MMXI - MMX instructions with TB prefix. // MMX2I - MMX / SSE2 instructions with TB and OpSize prefixes. // MMXIi8 - MMX instructions with ImmT == Imm8 and TB prefix. +// MMXIi8 - MMX instructions with ImmT == Imm8 and TB prefix. +// MMXID - MMX instructions with XD prefix. +// MMXIS - MMX instructions with XS prefix. class MMXI o, Format F, dag ops, string asm, list pattern> : I, TB, Requires<[HasMMX]>; class MMX2I o, Format F, dag ops, string asm, list pattern> : I, TB, OpSize, Requires<[HasMMX]>; class MMXIi8 o, Format F, dag ops, string asm, list pattern> : Ii8, TB, Requires<[HasMMX]>; +class MMXID o, Format F, dag ops, string asm, list pattern> + : Ii8, XD, Requires<[HasMMX]>; +class MMXIS o, Format F, dag ops, string asm, list pattern> + : Ii8, XS, Requires<[HasMMX]>; // Some 'special' instructions def IMPLICIT_DEF_VR64 : I<0, Pseudo, (ops VR64:$dst), @@ -51,6 +58,18 @@ def bc_v1i64 : PatFrag<(ops node:$in), (v1i64 (bitconvert node:$in))>; //===----------------------------------------------------------------------===// +// MMX Masks +//===----------------------------------------------------------------------===// + +def MMX_UNPCKH_shuffle_mask : PatLeaf<(build_vector), [{ + return X86::isUNPCKHMask(N); +}]>; + +def MMX_UNPCKL_shuffle_mask : PatLeaf<(build_vector), [{ + return X86::isUNPCKLMask(N); +}]>; + +//===----------------------------------------------------------------------===// // MMX Multiclasses //===----------------------------------------------------------------------===// @@ -128,6 +147,35 @@ // MMX Scalar Instructions //===----------------------------------------------------------------------===// +// Data Transfer Instructions +def MMX_MOVD64rr : MMXI<0x6E, MRMSrcReg, (ops VR64:$dst, GR32:$src), + "movd {$src, $dst|$dst, $src}", []>; +def MMX_MOVD64rm : MMXI<0x6E, MRMSrcMem, (ops VR64:$dst, i32mem:$src), + "movd {$src, $dst|$dst, $src}", []>; +def MMX_MOVD64mr : MMXI<0x7E, MRMDestMem, (ops i32mem:$dst, VR64:$src), + "movd {$src, $dst|$dst, $src}", []>; + +def MMX_MOVQ64rr : MMXI<0x6F, MRMSrcReg, (ops VR64:$dst, VR64:$src), + "movq {$src, $dst|$dst, $src}", []>; +def MMX_MOVQ64rm : MMXI<0x6F, MRMSrcMem, (ops VR64:$dst, i64mem:$src), + "movq {$src, $dst|$dst, $src}", + [(set VR64:$dst, (load_mmx addr:$src))]>; +def MMX_MOVQ64mr : MMXI<0x7F, MRMDestMem, (ops i64mem:$dst, VR64:$src), + "movq {$src, $dst|$dst, $src}", + [(store (v1i64 VR64:$src), addr:$dst)]>; + +def MMX_MOVDQ2Qrr : MMXID<0xD6, MRMDestMem, (ops VR64:$dst, VR128:$src), + "movdq2q {$src, $dst|$dst, $src}", + [(store (i64 (vector_extract (v2i64 VR128:$src), + (iPTR 0))), VR64:$dst)]>; +def MMX_MOVQ2DQrr : MMXIS<0xD6, MRMDestMem, (ops VR128:$dst, VR64:$src), + "movq2dq {$src, $dst|$dst, $src}", + [(store (v1i64 VR64:$src), VR128:$dst)]>; + +def MMX_MOVNTQmr : MMXI<0xE7, MRMDestMem, (ops i64mem:$dst, VR64:$src), + "movntq {$src, $dst|$dst, $src}", []>; + + // Arithmetic Instructions // -- Addition @@ -155,11 +203,25 @@ // -- Multiplication defm MMX_PMULLW : MMXI_binop_rm<0xD5, "pmullw", mul, v4i16, 1>; -defm MMX_PMULHW : MMXI_binop_rm_int<0xE5, "pmulhw" , int_x86_mmx_pmulh_w , 1>; -// -- Multiply and Add +defm MMX_PMULHW : MMXI_binop_rm_int<0xE5, "pmulhw", int_x86_mmx_pmulh_w, 1>; +defm MMX_PMULHUW : MMXI_binop_rm_int<0xE4, "pmulhuw", int_x86_mmx_pmulhu_w, 1>; +defm MMX_PMULUDQ : MMXI_binop_rm_int<0xF4, "pmuludq", int_x86_mmx_pmulu_dq, 1>; + +// -- Miscellanea defm MMX_PMADDWD : MMXI_binop_rm_int<0xF5, "pmaddwd", int_x86_mmx_pmadd_wd, 1>; +defm MMX_PAVGB : MMXI_binop_rm_int<0xE0, "pavgb", int_x86_mmx_pavg_b, 1>; +defm MMX_PAVGW : MMXI_binop_rm_int<0xE3, "pavgw", int_x86_mmx_pavg_w, 1>; + +defm MMX_PMINUB : MMXI_binop_rm_int<0xDA, "pminub", int_x86_mmx_pminu_b, 1>; +defm MMX_PMINSW : MMXI_binop_rm_int<0xEA, "pminsw", int_x86_mmx_pmins_w, 1>; + +defm MMX_PMAXUB : MMXI_binop_rm_int<0xDE, "pmaxub", int_x86_mmx_pmaxu_b, 1>; +defm MMX_PMAXSW : MMXI_binop_rm_int<0xEE, "pmaxsw", int_x86_mmx_pmaxs_w, 1>; + +defm MMX_PSADBW : MMXI_binop_rm_int<0xE0, "psadbw", int_x86_mmx_psad_bw, 1>; + // Logical Instructions defm MMX_PAND : MMXI_binop_rm_v1i64<0xDB, "pand", and, 1>; defm MMX_POR : MMXI_binop_rm_v1i64<0xEB, "por" , or, 1>; @@ -208,13 +270,6 @@ defm MMX_PCMPGTD : MMXI_binop_rm_int<0x66, "pcmpgtd", int_x86_mmx_pcmpgt_d>; // Conversion Instructions -def MMX_UNPCKH_shuffle_mask : PatLeaf<(build_vector), [{ - return X86::isUNPCKHMask(N); -}]>; - -def MMX_UNPCKL_shuffle_mask : PatLeaf<(build_vector), [{ - return X86::isUNPCKLMask(N); -}]>; // -- Unpack Instructions let isTwoAddress = 1 in { @@ -310,53 +365,36 @@ defm MMX_PACKSSDW : MMXI_binop_rm_int<0x6B, "packssdw", int_x86_mmx_packssdw>; defm MMX_PACKUSWB : MMXI_binop_rm_int<0x67, "packuswb", int_x86_mmx_packuswb>; -// Data Transfer Instructions -def MMX_MOVD64rr : MMXI<0x6E, MRMSrcReg, (ops VR64:$dst, GR32:$src), - "movd {$src, $dst|$dst, $src}", []>; -def MMX_MOVD64rm : MMXI<0x6E, MRMSrcMem, (ops VR64:$dst, i32mem:$src), - "movd {$src, $dst|$dst, $src}", []>; -def MMX_MOVD64mr : MMXI<0x7E, MRMDestMem, (ops i32mem:$dst, VR64:$src), - "movd {$src, $dst|$dst, $src}", []>; - -def MMX_MOVQ64rr : MMXI<0x6F, MRMSrcReg, (ops VR64:$dst, VR64:$src), - "movq {$src, $dst|$dst, $src}", []>; -def MMX_MOVQ64rm : MMXI<0x6F, MRMSrcMem, (ops VR64:$dst, i64mem:$src), - "movq {$src, $dst|$dst, $src}", - [(set VR64:$dst, (load_mmx addr:$src))]>; -def MMX_MOVQ64mr : MMXI<0x7F, MRMDestMem, (ops i64mem:$dst, VR64:$src), - "movq {$src, $dst|$dst, $src}", - [(store (v1i64 VR64:$src), addr:$dst)]>; - -// Conversion instructions -def MMX_CVTPD2PIrr : MMX2I<0x2D, MRMSrcReg, (ops VR64:$dst, VR128:$src), - "cvtpd2pi {$src, $dst|$dst, $src}", []>; -def MMX_CVTPD2PIrm : MMX2I<0x2D, MRMSrcMem, (ops VR64:$dst, f128mem:$src), - "cvtpd2pi {$src, $dst|$dst, $src}", []>; - -def MMX_CVTPI2PDrr : MMX2I<0x2A, MRMSrcReg, (ops VR128:$dst, VR64:$src), - "cvtpi2pd {$src, $dst|$dst, $src}", []>; -def MMX_CVTPI2PDrm : MMX2I<0x2A, MRMSrcMem, (ops VR128:$dst, i64mem:$src), - "cvtpi2pd {$src, $dst|$dst, $src}", []>; - -def MMX_CVTPI2PSrr : MMXI<0x2A, MRMSrcReg, (ops VR128:$dst, VR64:$src), - "cvtpi2ps {$src, $dst|$dst, $src}", []>; -def MMX_CVTPI2PSrm : MMXI<0x2A, MRMSrcMem, (ops VR128:$dst, i64mem:$src), - "cvtpi2ps {$src, $dst|$dst, $src}", []>; - -def MMX_CVTPS2PIrr : MMXI<0x2D, MRMSrcReg, (ops VR64:$dst, VR128:$src), - "cvtps2pi {$src, $dst|$dst, $src}", []>; -def MMX_CVTPS2PIrm : MMXI<0x2D, MRMSrcMem, (ops VR64:$dst, f64mem:$src), - "cvtps2pi {$src, $dst|$dst, $src}", []>; - -def MMX_CVTTPD2PIrr: MMX2I<0x2C, MRMSrcReg, (ops VR64:$dst, VR128:$src), - "cvttpd2pi {$src, $dst|$dst, $src}", []>; -def MMX_CVTTPD2PIrm: MMX2I<0x2C, MRMSrcMem, (ops VR64:$dst, f128mem:$src), - "cvttpd2pi {$src, $dst|$dst, $src}", []>; - -def MMX_CVTTPS2PIrr: MMXI<0x2C, MRMSrcReg, (ops VR64:$dst, VR128:$src), - "cvttps2pi {$src, $dst|$dst, $src}", []>; -def MMX_CVTTPS2PIrm: MMXI<0x2C, MRMSrcMem, (ops VR64:$dst, f64mem:$src), - "cvttps2pi {$src, $dst|$dst, $src}", []>; +// -- Conversion Instructions +def MMX_CVTPD2PIrr : MMX2I<0x2D, MRMSrcReg, (ops VR64:$dst, VR128:$src), + "cvtpd2pi {$src, $dst|$dst, $src}", []>; +def MMX_CVTPD2PIrm : MMX2I<0x2D, MRMSrcMem, (ops VR64:$dst, f128mem:$src), + "cvtpd2pi {$src, $dst|$dst, $src}", []>; + +def MMX_CVTPI2PDrr : MMX2I<0x2A, MRMSrcReg, (ops VR128:$dst, VR64:$src), + "cvtpi2pd {$src, $dst|$dst, $src}", []>; +def MMX_CVTPI2PDrm : MMX2I<0x2A, MRMSrcMem, (ops VR128:$dst, i64mem:$src), + "cvtpi2pd {$src, $dst|$dst, $src}", []>; + +def MMX_CVTPI2PSrr : MMXI<0x2A, MRMSrcReg, (ops VR128:$dst, VR64:$src), + "cvtpi2ps {$src, $dst|$dst, $src}", []>; +def MMX_CVTPI2PSrm : MMXI<0x2A, MRMSrcMem, (ops VR128:$dst, i64mem:$src), + "cvtpi2ps {$src, $dst|$dst, $src}", []>; + +def MMX_CVTPS2PIrr : MMXI<0x2D, MRMSrcReg, (ops VR64:$dst, VR128:$src), + "cvtps2pi {$src, $dst|$dst, $src}", []>; +def MMX_CVTPS2PIrm : MMXI<0x2D, MRMSrcMem, (ops VR64:$dst, f64mem:$src), + "cvtps2pi {$src, $dst|$dst, $src}", []>; + +def MMX_CVTTPD2PIrr : MMX2I<0x2C, MRMSrcReg, (ops VR64:$dst, VR128:$src), + "cvttpd2pi {$src, $dst|$dst, $src}", []>; +def MMX_CVTTPD2PIrm : MMX2I<0x2C, MRMSrcMem, (ops VR64:$dst, f128mem:$src), + "cvttpd2pi {$src, $dst|$dst, $src}", []>; + +def MMX_CVTTPS2PIrr : MMXI<0x2C, MRMSrcReg, (ops VR64:$dst, VR128:$src), + "cvttps2pi {$src, $dst|$dst, $src}", []>; +def MMX_CVTTPS2PIrm : MMXI<0x2C, MRMSrcMem, (ops VR64:$dst, f64mem:$src), + "cvttps2pi {$src, $dst|$dst, $src}", []>; // Shuffle and unpack instructions def PSHUFWri : MMXIi8<0x70, MRMSrcReg, @@ -366,14 +404,38 @@ (ops VR64:$dst, i64mem:$src1, i8imm:$src2), "pshufw {$src2, $src1, $dst|$dst, $src1, $src2}", []>; +// Extract / Insert +def MMX_X86pextrw : SDNode<"X86ISD::PEXTRW", SDTypeProfile<1, 2, []>, []>; +def MMX_X86pinsrw : SDNode<"X86ISD::PINSRW", SDTypeProfile<1, 3, []>, []>; + +def MMX_PEXTRWri : MMXIi8<0xC5, MRMSrcReg, + (ops GR32:$dst, VR64:$src1, i16i8imm:$src2), + "pextrw {$src2, $src1, $dst|$dst, $src1, $src2}", + [(set GR32:$dst, (MMX_X86pextrw (v4i16 VR64:$src1), + (iPTR imm:$src2)))]>; +let isTwoAddress = 1 in { + def MMX_PINSRWrri : MMXIi8<0xC4, MRMSrcReg, + (ops VR64:$dst, VR64:$src1, GR32:$src2, i16i8imm:$src3), + "pinsrw {$src3, $src2, $dst|$dst, $src2, $src3}", + [(set VR64:$dst, (v4i16 (MMX_X86pinsrw (v4i16 VR64:$src1), + GR32:$src2, (iPTR imm:$src3))))]>; + def MMX_PINSRWrmi : MMXIi8<0xC4, MRMSrcMem, + (ops VR64:$dst, VR64:$src1, i16mem:$src2, i16i8imm:$src3), + "pinsrw {$src3, $src2, $dst|$dst, $src2, $src3}", + [(set VR64:$dst, + (v4i16 (MMX_X86pinsrw (v4i16 VR64:$src1), + (i32 (anyext (loadi16 addr:$src2))), + (iPTR imm:$src3))))]>; +} + +// Mask creation +def MMX_PMOVMSKBrr : MMXI<0xD7, MRMSrcReg, (ops GR32:$dst, VR64:$src), + "pmovmskb {$src, $dst|$dst, $src}", + [(set GR32:$dst, (int_x86_mmx_pmovmskb VR64:$src))]>; + // Misc. -def MOVNTQ : I<0xE7, MRMDestMem, (ops i64mem:$dst, VR64:$src), - "movntq {$src, $dst|$dst, $src}", []>, TB, - Requires<[HasMMX]>; - -def MASKMOVQ : I<0xF7, MRMDestMem, (ops VR64:$src, VR64:$mask), - "maskmovq {$mask, $src|$src, $mask}", []>, TB, - Requires<[HasMMX]>; +def MMX_MASKMOVQ : MMXI<0xF7, MRMDestMem, (ops VR64:$src, VR64:$mask), + "maskmovq {$mask, $src|$src, $mask}", []>; //===----------------------------------------------------------------------===// // Alias Instructions From isanbard at gmail.com Tue Apr 3 18:48:52 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 3 Apr 2007 18:48:52 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/IntrinsicsX86.td Message-ID: <200704032348.l33Nmqf3006596@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: IntrinsicsX86.td updated: 1.41 -> 1.42 --- Log message: Adding more MMX instructions. --- Diffs of the changes: (+41 -0) IntrinsicsX86.td | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+) Index: llvm/include/llvm/IntrinsicsX86.td diff -u llvm/include/llvm/IntrinsicsX86.td:1.41 llvm/include/llvm/IntrinsicsX86.td:1.42 --- llvm/include/llvm/IntrinsicsX86.td:1.41 Tue Apr 3 01:00:36 2007 +++ llvm/include/llvm/IntrinsicsX86.td Tue Apr 3 18:48:32 2007 @@ -583,9 +583,44 @@ def int_x86_mmx_pmulh_w : GCCBuiltin<"__builtin_ia32_pmulhw">, Intrinsic<[llvm_v4i16_ty, llvm_v4i16_ty, llvm_v4i16_ty], [IntrNoMem]>; + def int_x86_mmx_pmulhu_w : GCCBuiltin<"__builtin_ia32_pmulhuw">, + Intrinsic<[llvm_v4i16_ty, llvm_v4i16_ty, + llvm_v4i16_ty], [IntrNoMem]>; + def int_x86_mmx_pmulu_dq : GCCBuiltin<"__builtin_ia32_pmuludq">, + Intrinsic<[llvm_v2i32_ty, llvm_v2i32_ty, + llvm_v2i32_ty], [IntrNoMem]>; def int_x86_mmx_pmadd_wd : GCCBuiltin<"__builtin_ia32_pmaddwd">, Intrinsic<[llvm_v2i32_ty, llvm_v4i16_ty, llvm_v4i16_ty], [IntrNoMem]>; + + // Averages + def int_x86_mmx_pavg_b : GCCBuiltin<"__builtin_ia32_pavgb">, + Intrinsic<[llvm_v8i8_ty, llvm_v8i8_ty, + llvm_v8i8_ty], [IntrNoMem]>; + def int_x86_mmx_pavg_w : GCCBuiltin<"__builtin_ia32_pavgw">, + Intrinsic<[llvm_v4i16_ty, llvm_v4i16_ty, + llvm_v4i16_ty], [IntrNoMem]>; + + // Maximum + def int_x86_mmx_pmaxu_b : GCCBuiltin<"__builtin_ia32_pmaxub">, + Intrinsic<[llvm_v8i8_ty, llvm_v8i8_ty, + llvm_v8i8_ty], [IntrNoMem]>; + def int_x86_mmx_pmaxs_w : GCCBuiltin<"__builtin_ia32_pmaxsw">, + Intrinsic<[llvm_v4i16_ty, llvm_v4i16_ty, + llvm_v4i16_ty], [IntrNoMem]>; + + // Minimum + def int_x86_mmx_pminu_b : GCCBuiltin<"__builtin_ia32_pminub">, + Intrinsic<[llvm_v8i8_ty, llvm_v8i8_ty, + llvm_v8i8_ty], [IntrNoMem]>; + def int_x86_mmx_pmins_w : GCCBuiltin<"__builtin_ia32_pminsw">, + Intrinsic<[llvm_v4i16_ty, llvm_v4i16_ty, + llvm_v4i16_ty], [IntrNoMem]>; + + // Packed sum of absolute differences + def int_x86_mmx_psad_bw : GCCBuiltin<"__builtin_ia32_psadbw">, + Intrinsic<[llvm_v4i16_ty, llvm_v8i8_ty, + llvm_v8i8_ty], [IntrNoMem]>; } // Integer shift ops. @@ -654,3 +689,9 @@ Intrinsic<[llvm_v2i32_ty, llvm_v2i32_ty, llvm_v2i32_ty], [IntrNoMem]>; } + +// Misc. +let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.". + def int_x86_mmx_pmovmskb : GCCBuiltin<"__builtin_ia32_pmovmskb">, + Intrinsic<[llvm_i32_ty, llvm_v8i8_ty], [IntrNoMem]>; +} From reid at x10sys.com Tue Apr 3 18:58:55 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 18:58:55 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704032358.l33NwtPt006847@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.37 -> 1.38 --- Log message: Add Dale Johannesen. --- Diffs of the changes: (+5 -4) DevMtgMay2007.html | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.37 llvm-www/DevMtgMay2007.html:1.38 --- llvm-www/DevMtgMay2007.html:1.37 Tue Apr 3 17:59:01 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 18:58:37 2007 @@ -235,6 +235,7 @@ Jeff CohenIndependent Stuart HastingsApple, Inc. Robert HundtGoogle + Dale JohannesenApple, Inc. Christopher LambAgeia Technologies, Inc. Chris LattnerApple, Inc. Nick LewyckyIndependent @@ -248,13 +249,13 @@ Unconfirmed Attendees NameOrganization Unconfirmed 3Adobe Systems Incorporated. - Unconfirmed 2+Apple, Inc. Unconfirmed 2Aerospace + Unconfirmed 1Apple, Inc. Unconfirmed 1Wind River Unconfirmed 1NASA, Ames -

        Total confirmed attendees: 17

        -

        Possible additional attendees: 9

        +

        Total confirmed attendees: 18

        +

        Possible additional attendees: 8

        @@ -264,6 +265,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
        Last modified: $Date: 2007/04/03 22:59:01 $ +
        Last modified: $Date: 2007/04/03 23:58:37 $ From reid at x10sys.com Tue Apr 3 19:03:06 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 19:03:06 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704040003.l34036cd006977@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.38 -> 1.39 --- Log message: Add the Adobe contingent. --- Diffs of the changes: (+7 -4) DevMtgMay2007.html | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.38 llvm-www/DevMtgMay2007.html:1.39 --- llvm-www/DevMtgMay2007.html:1.38 Tue Apr 3 18:58:37 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 19:02:49 2007 @@ -229,18 +229,22 @@ Confirmed Attendees NameOrganization Vikram AdveUIUC + Bob ArcherAdobe Systems Incorporated. Owen AndersonIndependent Ryan BrownGoogle Evan ChengApple, Inc. Jeff CohenIndependent + Han GaoAdobe Systems Incorporated. Stuart HastingsApple, Inc. Robert HundtGoogle Dale JohannesenApple, Inc. Christopher LambAgeia Technologies, Inc. Chris LattnerApple, Inc. Nick LewyckyIndependent + Paul McJonesAdobe Systems Incorporated. Scott MichelAerospace Devang PatelApple, Inc. + Chuck RoseAdobe Systems Incorporated. Mark SchimmelWind River Reid SpencerIndependent Sarah ThompsonNASA, Ames Research Center @@ -248,14 +252,13 @@ Marcel WeiherMetaObject Unconfirmed Attendees NameOrganization - Unconfirmed 3Adobe Systems Incorporated. Unconfirmed 2Aerospace Unconfirmed 1Apple, Inc. Unconfirmed 1Wind River Unconfirmed 1NASA, Ames -

        Total confirmed attendees: 18

        -

        Possible additional attendees: 8

        +

        Total confirmed attendees: 22

        +

        Possible additional attendees: 5

        @@ -265,6 +268,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
        Last modified: $Date: 2007/04/03 23:58:37 $ +
        Last modified: $Date: 2007/04/04 00:02:49 $ From evan.cheng at apple.com Tue Apr 3 19:06:24 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 3 Apr 2007 19:06:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp Message-ID: <200704040006.l3406OsI007047@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelLowering.cpp updated: 1.38 -> 1.39 --- Log message: Typo. --- Diffs of the changes: (+1 -1) ARMISelLowering.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/ARM/ARMISelLowering.cpp diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.38 llvm/lib/Target/ARM/ARMISelLowering.cpp:1.39 --- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.38 Mon Apr 2 19:13:57 2007 +++ llvm/lib/Target/ARM/ARMISelLowering.cpp Tue Apr 3 19:06:07 2007 @@ -1637,7 +1637,7 @@ case 'w': if (VT == MVT::f32) return std::make_pair(0U, ARM::SPRRegisterClass); - if (VT == MVT::f32) + if (VT == MVT::f64) return std::make_pair(0U, ARM::DPRRegisterClass); break; } From evan.cheng at apple.com Tue Apr 3 19:13:46 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 3 Apr 2007 19:13:46 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMAsmPrinter.cpp Message-ID: <200704040013.l340DkoJ007230@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMAsmPrinter.cpp updated: 1.63 -> 1.64 --- Log message: Implement inline asm modifier P. --- Diffs of the changes: (+1 -0) ARMAsmPrinter.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.63 llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.64 --- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.63 Thu Mar 29 02:49:34 2007 +++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp Tue Apr 3 19:13:29 2007 @@ -688,6 +688,7 @@ switch (ExtraCode[0]) { default: return true; // Unknown modifier. case 'c': // Don't print "$" before a global var name or constant. + case 'P': // Print a VFP double precision register. printOperand(MI, OpNo); return false; case 'Q': From evan.cheng at apple.com Tue Apr 3 19:15:34 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 3 Apr 2007 19:15:34 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/ARM/inlineasm2.ll Message-ID: <200704040015.l340FYdq007273@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/ARM: inlineasm2.ll added (r1.1) --- Log message: New asm test case. --- Diffs of the changes: (+11 -0) inlineasm2.ll | 11 +++++++++++ 1 files changed, 11 insertions(+) Index: llvm/test/CodeGen/ARM/inlineasm2.ll diff -c /dev/null llvm/test/CodeGen/ARM/inlineasm2.ll:1.1 *** /dev/null Tue Apr 3 19:15:27 2007 --- llvm/test/CodeGen/ARM/inlineasm2.ll Tue Apr 3 19:15:17 2007 *************** *** 0 **** --- 1,11 ---- + ; RUN: llvm-as < %s | llc -march=arm -mattr=+vfp2 + + define double @__ieee754_sqrt(double %x) { + %tmp2 = tail call double asm "fsqrtd ${0:P}, ${1:P}", "=w,w"( double %x ) + ret double %tmp2 + } + + define float @__ieee754_sqrtf(float %x) { + %tmp2 = tail call float asm "fsqrts $0, $1", "=w,w"( float %x ) + ret float %tmp2 + } From sabre at nondot.org Tue Apr 3 19:29:58 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 19:29:58 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/StringMap.h Message-ID: <200704040029.l340Twxo007545@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: StringMap.h updated: 1.12 -> 1.13 --- Log message: Extend StringMap to support being initialized as completely empty. When initialized this way, they do not do a malloc to allocate their buckets. --- Diffs of the changes: (+24 -11) StringMap.h | 35 ++++++++++++++++++++++++----------- 1 files changed, 24 insertions(+), 11 deletions(-) Index: llvm/include/llvm/ADT/StringMap.h diff -u llvm/include/llvm/ADT/StringMap.h:1.12 llvm/include/llvm/ADT/StringMap.h:1.13 --- llvm/include/llvm/ADT/StringMap.h:1.12 Sun Feb 11 15:46:36 2007 +++ llvm/include/llvm/ADT/StringMap.h Tue Apr 3 19:29:37 2007 @@ -55,6 +55,7 @@ unsigned NumTombstones; unsigned ItemSize; protected: + StringMapImpl(unsigned itemSize) : ItemSize(itemSize) { init(16); } StringMapImpl(unsigned InitSize, unsigned ItemSize); void RehashTable(); @@ -87,7 +88,8 @@ /// RemoveKey - Remove the StringMapEntry for the specified key from the /// table, returning it. If the key is not in the table, this returns null. StringMapEntryBase *RemoveKey(const char *KeyStart, const char *KeyEnd); - +private: + void init(unsigned Size); public: static StringMapEntryBase *getTombstoneVal() { return (StringMapEntryBase*)-1; @@ -185,7 +187,8 @@ AllocatorTy Allocator; typedef StringMapEntry MapEntryTy; public: - StringMap(unsigned InitialSize = 0) + StringMap() : StringMapImpl(sizeof(MapEntryTy)) {} + StringMap(unsigned InitialSize) : StringMapImpl(InitialSize, sizeof(MapEntryTy)) {} AllocatorTy &getAllocator() { return Allocator; } @@ -194,11 +197,18 @@ typedef StringMapConstIterator const_iterator; typedef StringMapIterator iterator; - iterator begin() { return iterator(TheTable); } - iterator end() { return iterator(TheTable+NumBuckets); } - const_iterator begin() const { return const_iterator(TheTable); } - const_iterator end() const { return const_iterator(TheTable+NumBuckets); } - + iterator begin() { + return iterator(TheTable, NumBuckets == 0); + } + iterator end() { + return iterator(TheTable+NumBuckets, true); + } + const_iterator begin() const { + return const_iterator(TheTable, NumBuckets == 0); + } + const_iterator end() const { + return const_iterator(TheTable+NumBuckets, true); + } iterator find(const char *KeyStart, const char *KeyEnd) { int Bucket = FindKey(KeyStart, KeyEnd); @@ -279,8 +289,10 @@ protected: StringMapImpl::ItemBucket *Ptr; public: - StringMapConstIterator(StringMapImpl::ItemBucket *Bucket) : Ptr(Bucket) { - AdvancePastEmptyBuckets(); + StringMapConstIterator(StringMapImpl::ItemBucket *Bucket, + bool NoAdvance = false) + : Ptr(Bucket) { + if (!NoAdvance) AdvancePastEmptyBuckets(); } const StringMapEntry &operator*() const { @@ -316,8 +328,9 @@ template class StringMapIterator : public StringMapConstIterator { public: - StringMapIterator(StringMapImpl::ItemBucket *Bucket) - : StringMapConstIterator(Bucket) { + StringMapIterator(StringMapImpl::ItemBucket *Bucket, + bool NoAdvance = false) + : StringMapConstIterator(Bucket, NoAdvance) { } StringMapEntry &operator*() const { return *static_cast*>(this->Ptr->Item); From sabre at nondot.org Tue Apr 3 19:29:56 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 19:29:56 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/StringMap.cpp Message-ID: <200704040029.l340TuPj007540@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: StringMap.cpp updated: 1.10 -> 1.11 --- Log message: Extend StringMap to support being initialized as completely empty. When initialized this way, they do not do a malloc to allocate their buckets. --- Diffs of the changes: (+22 -2) StringMap.cpp | 24 ++++++++++++++++++++++-- 1 files changed, 22 insertions(+), 2 deletions(-) Index: llvm/lib/Support/StringMap.cpp diff -u llvm/lib/Support/StringMap.cpp:1.10 llvm/lib/Support/StringMap.cpp:1.11 --- llvm/lib/Support/StringMap.cpp:1.10 Tue Apr 3 17:15:38 2007 +++ llvm/lib/Support/StringMap.cpp Tue Apr 3 19:29:37 2007 @@ -16,10 +16,25 @@ using namespace llvm; StringMapImpl::StringMapImpl(unsigned InitSize, unsigned itemSize) { + ItemSize = itemSize; + + // If a size is specified, initialize the table with that many buckets. + if (InitSize) { + init(InitSize); + return; + } + + // Otherwise, initialize it with zero buckets to avoid the allocation. + TheTable = 0; + NumBuckets = 0; + NumItems = 0; + NumTombstones = 0; +} + +void StringMapImpl::init(unsigned InitSize) { assert((InitSize & (InitSize-1)) == 0 && "Init Size must be a power of 2 or zero!"); NumBuckets = InitSize ? InitSize : 16; - ItemSize = itemSize; NumItems = 0; NumTombstones = 0; @@ -52,8 +67,12 @@ /// case, the FullHashValue field of the bucket will be set to the hash value /// of the string. unsigned StringMapImpl::LookupBucketFor(const char *NameStart, - const char *NameEnd) { + const char *NameEnd) { unsigned HTSize = NumBuckets; + if (HTSize == 0) { // Hash table unallocated so far? + init(16); + HTSize = NumBuckets; + } unsigned FullHashValue = HashString(NameStart, NameEnd); unsigned BucketNo = FullHashValue & (HTSize-1); @@ -110,6 +129,7 @@ /// This does not modify the map. int StringMapImpl::FindKey(const char *KeyStart, const char *KeyEnd) const { unsigned HTSize = NumBuckets; + if (HTSize == 0) return -1; // Really empty table? unsigned FullHashValue = HashString(KeyStart, KeyEnd); unsigned BucketNo = FullHashValue & (HTSize-1); From sabre at nondot.org Tue Apr 3 19:31:07 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 19:31:07 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ValueSymbolTable.h Message-ID: <200704040031.l340V7st007615@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: ValueSymbolTable.h updated: 1.9 -> 1.10 --- Log message: Initialize the symbol table to zero explicitly. This ensures that the symbol table does no allocations for prototypes or other lazily deserialized functions, saving significant space and time. --- Diffs of the changes: (+1 -1) ValueSymbolTable.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/ValueSymbolTable.h diff -u llvm/include/llvm/ValueSymbolTable.h:1.9 llvm/include/llvm/ValueSymbolTable.h:1.10 --- llvm/include/llvm/ValueSymbolTable.h:1.9 Sun Mar 25 20:45:35 2007 +++ llvm/include/llvm/ValueSymbolTable.h Tue Apr 3 19:30:49 2007 @@ -61,7 +61,7 @@ /// @{ public: - ValueSymbolTable() : vmap(16), LastUnique(0) {} + ValueSymbolTable() : vmap(0), LastUnique(0) {} ~ValueSymbolTable(); /// @} From reid at x10sys.com Tue Apr 3 19:39:40 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 19:39:40 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704040039.l340deIh007828@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.39 -> 1.40 --- Log message: Add Andrew Lenharth and Fernando Magno Quintao Pereira --- Diffs of the changes: (+4 -2) DevMtgMay2007.html | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.39 llvm-www/DevMtgMay2007.html:1.40 --- llvm-www/DevMtgMay2007.html:1.39 Tue Apr 3 19:02:49 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 19:39:22 2007 @@ -240,10 +240,12 @@ Dale JohannesenApple, Inc. Christopher LambAgeia Technologies, Inc. Chris LattnerApple, Inc. + Andrew LenharthUIUC Nick LewyckyIndependent Paul McJonesAdobe Systems Incorporated. Scott MichelAerospace Devang PatelApple, Inc. + Fernando Magno Quintao PereiraUCLA Chuck RoseAdobe Systems Incorporated. Mark SchimmelWind River Reid SpencerIndependent @@ -257,7 +259,7 @@ Unconfirmed 1Wind River Unconfirmed 1NASA, Ames -

        Total confirmed attendees: 22

        +

        Total confirmed attendees: 24

        Possible additional attendees: 5

        @@ -268,6 +270,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
        Last modified: $Date: 2007/04/04 00:02:49 $ +
        Last modified: $Date: 2007/04/04 00:39:22 $ From sabre at nondot.org Tue Apr 3 19:44:53 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 19:44:53 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/StringMap.cpp Message-ID: <200704040044.l340irol007959@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: StringMap.cpp updated: 1.11 -> 1.12 --- Log message: use calloc instead of new/memset, it is more efficient --- Diffs of the changes: (+2 -4) StringMap.cpp | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) Index: llvm/lib/Support/StringMap.cpp diff -u llvm/lib/Support/StringMap.cpp:1.11 llvm/lib/Support/StringMap.cpp:1.12 --- llvm/lib/Support/StringMap.cpp:1.11 Tue Apr 3 19:29:37 2007 +++ llvm/lib/Support/StringMap.cpp Tue Apr 3 19:44:31 2007 @@ -38,8 +38,7 @@ NumItems = 0; NumTombstones = 0; - TheTable = new ItemBucket[NumBuckets+1](); - memset(TheTable, 0, NumBuckets*sizeof(ItemBucket)); + TheTable = (ItemBucket*)calloc(NumBuckets+1, sizeof(ItemBucket)); // Allocate one extra bucket, set it to look filled so the iterators stop at // end. @@ -200,8 +199,7 @@ unsigned NewSize = NumBuckets*2; // Allocate one extra bucket which will always be non-empty. This allows the // iterators to stop at end. - ItemBucket *NewTableArray = new ItemBucket[NewSize+1](); - memset(NewTableArray, 0, NewSize*sizeof(ItemBucket)); + ItemBucket *NewTableArray =(ItemBucket*)calloc(NewSize+1, sizeof(ItemBucket)); NewTableArray[NewSize].Item = (StringMapEntryBase*)2; // Rehash all the items into their new buckets. Luckily :) we already have From sabre at nondot.org Tue Apr 3 19:44:53 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 3 Apr 2007 19:44:53 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/StringMap.h Message-ID: <200704040044.l340irPL007962@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: StringMap.h updated: 1.13 -> 1.14 --- Log message: use calloc instead of new/memset, it is more efficient --- Diffs of the changes: (+1 -1) StringMap.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/ADT/StringMap.h diff -u llvm/include/llvm/ADT/StringMap.h:1.13 llvm/include/llvm/ADT/StringMap.h:1.14 --- llvm/include/llvm/ADT/StringMap.h:1.13 Tue Apr 3 19:29:37 2007 +++ llvm/include/llvm/ADT/StringMap.h Tue Apr 3 19:44:30 2007 @@ -279,7 +279,7 @@ if (I->Item && I->Item != getTombstoneVal()) static_cast(I->Item)->Destroy(Allocator); } - delete [] TheTable; + free(TheTable); } }; From reid at x10sys.com Tue Apr 3 19:50:00 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 19:50:00 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704040050.l340o0dw008094@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.40 -> 1.41 --- Log message: Two columns for confirmed attendees .. there's so many! --- Diffs of the changes: (+18 -4) DevMtgMay2007.html | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.40 llvm-www/DevMtgMay2007.html:1.41 --- llvm-www/DevMtgMay2007.html:1.40 Tue Apr 3 19:39:22 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 19:49:43 2007 @@ -225,8 +225,11 @@

        The table below lists the confirmed attendees for the meeting.

        + + + + + +
        - + @@ -242,6 +245,12 @@ +
        Confirmed Attendees
        Confirmed Attendees (A-L)
        NameOrganization
        Vikram AdveUIUC
        Bob ArcherAdobe Systems Incorporated.
        Chris LattnerApple, Inc.
        Andrew LenharthUIUC
        Nick LewyckyIndependent
        +
        + + + @@ -252,6 +261,12 @@ +
        Confirmed Attendees (M-Z)
        NameOrganization
        Paul McJonesAdobe Systems Incorporated.
        Scott MichelAerospace
        Devang PatelApple, Inc.
        Sarah ThompsonNASA, Ames Research Center
        Bill WendlingApple, Inc.
        Marcel WeiherMetaObject
        +
        +

        Total confirmed: 24

        + @@ -259,8 +274,7 @@
        Unconfirmed Attendees
        NameOrganization
        Unconfirmed 2Aerospace
        Unconfirmed 1Wind River
        Unconfirmed 1NASA, Ames
        -

        Total confirmed attendees: 24

        -

        Possible additional attendees: 5

        +

        Total unconfirmed: 5

        @@ -270,6 +284,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
        Last modified: $Date: 2007/04/04 00:39:22 $ +
        Last modified: $Date: 2007/04/04 00:49:43 $ From reid at x10sys.com Tue Apr 3 19:53:34 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 19:53:34 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704040053.l340rYed008230@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.41 -> 1.42 --- Log message: Add Gabe McArthur --- Diffs of the changes: (+3 -2) DevMtgMay2007.html | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.41 llvm-www/DevMtgMay2007.html:1.42 --- llvm-www/DevMtgMay2007.html:1.41 Tue Apr 3 19:49:43 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 19:53:17 2007 @@ -269,12 +269,13 @@ +
        Unconfirmed Attendees
        NameOrganization
        Gabe McArthurIndependent
        Unconfirmed 2Aerospace
        Unconfirmed 1Apple, Inc.
        Unconfirmed 1Wind River
        Unconfirmed 1NASA, Ames
        -

        Total unconfirmed: 5

        +

        Total unconfirmed: 6

        @@ -284,6 +285,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
        Last modified: $Date: 2007/04/04 00:49:43 $ +
        Last modified: $Date: 2007/04/04 00:53:17 $ From reid at x10sys.com Tue Apr 3 19:55:48 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 19:55:48 -0500 Subject: [llvm-commits] CVS: llvm-www/llvm.css Message-ID: <200704040055.l340tmjA008322@zion.cs.uiuc.edu> Changes in directory llvm-www: llvm.css updated: 1.20 -> 1.21 --- Log message: Table headings centered. --- Diffs of the changes: (+1 -1) llvm.css | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/llvm.css diff -u llvm-www/llvm.css:1.20 llvm-www/llvm.css:1.21 --- llvm-www/llvm.css:1.20 Sat Mar 31 20:44:55 2007 +++ llvm-www/llvm.css Tue Apr 3 19:55:31 2007 @@ -95,7 +95,7 @@ .www TH { border: 2px solid gray; font-weight: bold; font-size: 105%; color: black; background: url("img/lines.gif"); font-family: "Georgia,Palatino,Times,Roman,SanSerif"; - text-align: left; vertical-align: middle; } + text-align: center; vertical-align: middle; } TABLE.www { text-align: left; border: 2px solid black; border-collapse: collapse; margin-top: 1em; margin-left: 1em; margin-right: 1em; margin-bottom: 1em; } From reid at x10sys.com Tue Apr 3 20:00:16 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 20:00:16 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704040100.l3410GxE008464@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.42 -> 1.43 --- Log message: Gabe confirmed. --- Diffs of the changes: (+4 -4) DevMtgMay2007.html | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.42 llvm-www/DevMtgMay2007.html:1.43 --- llvm-www/DevMtgMay2007.html:1.42 Tue Apr 3 19:53:17 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 19:59:59 2007 @@ -251,6 +251,7 @@ + @@ -265,17 +266,16 @@
        Confirmed Attendees (M-Z)
        NameOrganization
        Gabe McArthurIndependent
        Paul McJonesAdobe Systems Incorporated.
        Scott MichelAerospace
        Devang PatelApple, Inc.
        -

        Total confirmed: 24

        +

        Total confirmed: 25

        -
        Unconfirmed Attendees
        NameOrganization
        Gabe McArthurIndependent
        Unconfirmed 2Aerospace
        Unconfirmed 1Apple, Inc.
        Unconfirmed 1Wind River
        Unconfirmed 1NASA, Ames
        -

        Total unconfirmed: 6

        +

        Total unconfirmed: 5

        @@ -285,6 +285,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
        Last modified: $Date: 2007/04/04 00:53:17 $ +
        Last modified: $Date: 2007/04/04 00:59:59 $ From reid at x10sys.com Tue Apr 3 21:42:52 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 21:42:52 -0500 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200704040242.l342gqB5010232@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.224 -> 1.225 --- Log message: Remove intrinsics that we will not be implementing. Fix the anchor names of intrinsics to all be int_ so as to distinguish them from the i_ prefix reserved for instructions. --- Diffs of the changes: (+68 -347) LangRef.html | 415 +++++++++-------------------------------------------------- 1 files changed, 68 insertions(+), 347 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.224 llvm/docs/LangRef.html:1.225 --- llvm/docs/LangRef.html:1.224 Sun Apr 1 21:25:19 2007 +++ llvm/docs/LangRef.html Tue Apr 3 21:42:35 2007 @@ -146,44 +146,45 @@
        1. Variable Argument Handling Intrinsics
            -
          1. 'llvm.va_start' Intrinsic
          2. -
          3. 'llvm.va_end' Intrinsic
          4. -
          5. 'llvm.va_copy' Intrinsic
          6. +
          7. 'llvm.va_start' Intrinsic
          8. +
          9. 'llvm.va_end' Intrinsic
          10. +
          11. 'llvm.va_copy' Intrinsic
        2. Accurate Garbage Collection Intrinsics
            -
          1. 'llvm.gcroot' Intrinsic
          2. -
          3. 'llvm.gcread' Intrinsic
          4. -
          5. 'llvm.gcwrite' Intrinsic
          6. +
          7. 'llvm.gcroot' Intrinsic
          8. +
          9. 'llvm.gcread' Intrinsic
          10. +
          11. 'llvm.gcwrite' Intrinsic
        3. Code Generator Intrinsics
            -
          1. 'llvm.returnaddress' Intrinsic
          2. -
          3. 'llvm.frameaddress' Intrinsic
          4. -
          5. 'llvm.stacksave' Intrinsic
          6. -
          7. 'llvm.stackrestore' Intrinsic
          8. -
          9. 'llvm.prefetch' Intrinsic
          10. -
          11. 'llvm.pcmarker' Intrinsic
          12. -
          13. llvm.readcyclecounter' Intrinsic
          14. +
          15. 'llvm.returnaddress' Intrinsic
          16. +
          17. 'llvm.frameaddress' Intrinsic
          18. +
          19. 'llvm.stacksave' Intrinsic
          20. +
          21. 'llvm.stackrestore' Intrinsic
          22. +
          23. 'llvm.prefetch' Intrinsic
          24. +
          25. 'llvm.pcmarker' Intrinsic
          26. +
          27. llvm.readcyclecounter' Intrinsic
        4. Standard C Library Intrinsics
            -
          1. 'llvm.memcpy.*' Intrinsic
          2. -
          3. 'llvm.memmove.*' Intrinsic
          4. -
          5. 'llvm.memset.*' Intrinsic
          6. -
          7. 'llvm.sqrt.*' Intrinsic
          8. -
          9. 'llvm.powi.*' Intrinsic
          10. +
          11. 'llvm.memcpy.*' Intrinsic
          12. +
          13. 'llvm.memmove.*' Intrinsic
          14. +
          15. 'llvm.memset.*' Intrinsic
          16. +
          17. 'llvm.sqrt.*' Intrinsic
          18. +
          19. 'llvm.powi.*' Intrinsic
        5. Bit Manipulation Intrinsics
            -
          1. 'llvm.bswap.*' Intrinsics
          2. +
          3. 'llvm.bswap.*' Intrinsics
          4. 'llvm.ctpop.*' Intrinsic
          5. 'llvm.ctlz.*' Intrinsic
          6. 'llvm.cttz.*' Intrinsic
          7. +
          8. 'llvm.part.select.*' Intrinsic
        6. Debugger intrinsics
        7. @@ -1498,7 +1499,7 @@

          -  %X = call i32 asm "bswap $0", "=r,r"(i32 %Y)
          +  %X = call i32 asm "bswap $0", "=r,r"(i32 %Y)
           

          @@ -3663,7 +3664,7 @@

          @@ -3692,7 +3693,7 @@
          @@ -3701,7 +3702,7 @@
          Overview:

          The 'llvm.va_end' intrinsic destroys <arglist> -which has been initialized previously with llvm.va_start +which has been initialized previously with llvm.va_start or llvm.va_copy.

          Arguments:
          @@ -3712,15 +3713,15 @@

          The 'llvm.va_end' intrinsic works just like the va_end macro available in C. In a target-dependent way, it destroys the va_list. -Calls to llvm.va_start and llvm.va_copy must be matched exactly +Calls to llvm.va_start and llvm.va_copy must be matched exactly with calls to llvm.va_end.

          @@ -3747,7 +3748,7 @@

          The 'llvm.va_copy' intrinsic works just like the va_copy macro available in C. In a target-dependent way, it copies the source va_list element into the destination list. This intrinsic is necessary -because the llvm.va_start intrinsic may be +because the llvm.va_start intrinsic may be arbitrarily complex and require memory allocation, for example.

          @@ -3762,9 +3763,9 @@

          LLVM support for Accurate Garbage Collection requires the implementation and generation of these intrinsics. -These intrinsics allow identification of GC roots on the +These intrinsics allow identification of GC roots on the stack, as well as garbage collector implementations that require read and write barriers. +href="#int_gcread">read and write barriers. Front-ends for type-safe garbage collected languages should generate these intrinsics to make use of the LLVM garbage collectors. For more details, see Accurate Garbage Collection with LLVM. @@ -3773,7 +3774,7 @@

          @@ -3807,7 +3808,7 @@
          @@ -3842,7 +3843,7 @@
          @@ -3891,7 +3892,7 @@
          @@ -3936,7 +3937,7 @@
          @@ -3979,7 +3980,7 @@
          @@ -3993,7 +3994,7 @@

          The 'llvm.stacksave' intrinsic is used to remember the current state of -the function stack, for use with +the function stack, for use with llvm.stackrestore. This is useful for implementing language features like scoped automatic variable sized arrays in C99.

          @@ -4002,7 +4003,7 @@

          This intrinsic returns a opaque pointer value that can be passed to llvm.stackrestore. When an +href="#int_stackrestore">llvm.stackrestore. When an llvm.stackrestore intrinsic is executed with a value saved from llvm.stacksave, it effectively restores the state of the stack to the state it was in when the llvm.stacksave intrinsic executed. In @@ -4014,7 +4015,7 @@

          @@ -4029,7 +4030,7 @@

          The 'llvm.stackrestore' intrinsic is used to restore the state of the function stack to the state it was in when the corresponding llvm.stacksave intrinsic executed. This is +href="#int_stacksave">llvm.stacksave intrinsic executed. This is useful for implementing language features like scoped automatic variable sized arrays in C99.

          @@ -4037,7 +4038,7 @@
          Semantics:

          -See the description for llvm.stacksave. +See the description for llvm.stacksave.

          @@ -4045,7 +4046,7 @@
          @@ -4090,7 +4091,7 @@
          @@ -4131,7 +4132,7 @@
          @@ -4179,7 +4180,7 @@
          @@ -4233,7 +4234,7 @@
          @@ -4288,7 +4289,7 @@
          @@ -4341,7 +4342,7 @@
          @@ -4377,7 +4378,7 @@
          @@ -4426,7 +4427,7 @@
          @@ -4589,300 +4590,6 @@ - -
          -
          Syntax:
          -

          This is an overloaded intrinsic. You can use llvm.bit.and.reduce on -any integer bit width. -

          -  declare i1 @llvm.bit.and.reduce.i32(i32 %val)
          -  declare i1 @llvm.bit.and.reduce.i97(i97 %val)
          -
          -
          Overview:
          -

          The 'llvm.bit.and.reduce' family of intrinsic functions applies the -AND operator bitwise to each bit in %val until it yields the result. -

          - -
          Arguments:
          -

          The argument may be any bit width. The result is always a 1-bit integer.

          - -
          Semantics:
          -

          The 'llvm.bit.and.reduce' intrinsic is the equivalent of a test -against -1. Only if all bits in %val are set will the result -be 1, otherwise 0.

          -
          - - - - -
          -
          Syntax:
          -

          This is an overloaded intrinsic. You can use llvm.bit.or.reduce on -any integer bit width. -

          -  declare i1 @llvm.bit.or.reduce.i32(i32 %val)
          -  declare i1 @llvm.bit.or.reduce.i97(i97 %val)
          -
          -
          Overview:
          -

          The 'llvm.bit.or.reduce' family of intrinsic functions applies the -OR operator bitwise to each bit in %val until it yields the result. -

          - -
          Arguments:
          -

          The argument may be any bit width. The result is always a 1-bit integer.

          - -
          Semantics:
          -

          The 'llvm.bit.or.reduce' intrinsic is the equivalent of a test -against 0. Only if all bits in %val are clear will the result -be 0, otherwise 1.

          -
          - - - - -
          -
          Syntax:
          -

          This is an overloaded intrinsic. You can use llvm.bit.xor.reduce on -any integer bit width. -

          -  declare i1 @llvm.bit.xor.reduce.i32(i32 %val)
          -  declare i1 @llvm.bit.xor.reduce.i97(i97 %val)
          -
          -
          Overview:
          -

          The 'llvm.bit.xor.reduce' family of intrinsic functions applies the -XOR operator bitwise to each bit in %val until it yields the result. -

          - -
          Arguments:
          -

          The argument may be any bit width. The result is always a 1-bit integer.

          - -
          Semantics:
          -

          The 'llvm.bit.xor.reduce' computes its result by performing an XOR -operation on the two lowest order bits in %val. That result is then -XOR'd with the next bit in %val and this process continues until all -bits in %val have been XOR'd with the result of the previous XORs. The -resulting bit is returned.

          -
          - - - - -
          -
          Syntax:
          -

          This is an overloaded intrinsic. You can use llvm.bit.nand.reduce on -any integer bit width. -

          -  declare i1 @llvm.bit.nand.reduce.i32(i32 %val)
          -  declare i1 @llvm.bit.nand.reduce.i97(i97 %val)
          -
          -
          Overview:
          -

          The 'llvm.bit.nand.reduce' family of intrinsic functions applies the -NAND operator bitwise to each bit in %val until it yields the result. -

          - -
          Arguments:
          -

          The argument may be any bit width. The result is always a 1-bit integer.

          - -
          Semantics:
          -

          The 'llvm.bit.nand.reduce' intrinsic is the equivalent of taking the -complement of the llvm.bit.and.reduce intrinsic. That is, it returns 0 -if %val is all ones (-1) and 1 otherwise.

          -
          - - - - -
          -
          Syntax:
          -

          This is an overloaded intrinsic. You can use llvm.bit.nor.reduce on -any integer bit width. -

          -  declare i1 @llvm.bit.nor.reduce.i32(i32 %val)
          -  declare i1 @llvm.bit.nor.reduce.i97(i97 %val)
          -
          -
          Overview:
          -

          The 'llvm.bit.nor.reduce' family of intrinsic functions applies the -NOR operator bitwise to each bit in %val until it yields the result. -

          - -
          Arguments:
          -

          The argument may be any bit width. The result is always a 1-bit integer.

          - -
          Semantics:
          -

          The 'llvm.bit.nor.reduce' intrinsic is equivalent to the complement -of the llvm.bit.or.reduce intrinsic. That is, it returns 1 if all bits -in %val are 0, and 1 otherwise.

          -
          - - - - -
          -
          Syntax:
          -

          This is an overloaded intrinsic. You can use llvm.bit.nxor.reduce on -any integer bit width. -

          -  declare i1 @llvm.bit.nxor.reduce.i32(i32 %val)
          -  declare i1 @llvm.bit.nxor.reduce.i97(i97 %val)
          -
          -
          Overview:
          -

          The 'llvm.bit.nxor.reduce' family of intrinsic functions applies the -AND operator bitwise to each bit in %val until it yields the result. -

          - -
          Arguments:
          -

          The argument may be any bit width. The result is always a 1-bit integer.

          - -
          Semantics:
          -

          The 'llvm.bit.nxor.reduce' intrinsic is the equivalent of the -complement of the llvm.bit.xor.reduce intrinsic.

          -
          - - - - -
          -
          Syntax:
          -

          This is an overloaded intrinsic. You can use llvm.bit.select on any -integer bit width. -

          -  declare i1 @llvm.bit.select.i17  (i17 %val, i32 %bit)
          -  declare i1 @llvm.bit.select.i29  (i29 %val, i32 %bit)
          -
          - -
          Overview:
          -

          The 'llvm.bit.select' family of intrinsic functions selects a -specific bit from an integer value and returns it.

          - -
          Arguments:
          -

          The two arguments may be any bit width. The result is always a 1-bit -integer. The first argument, %val may be any bit width and is the -value from which the bit is selected. The second argument, %bit must -be an i32 and is the bit index of the bit to be selected. Bits are -numbered starting with 0 as the lowest ordered bit.

          - -
          Semantics:
          -

          The 'llvm.bit.select' intrinsic is the equivalent of shift and a -truncate operation. The %val is shifted right by %bit bits and -then truncated to a 1-bit integer.

          -
          - - - - -
          -
          Syntax:
          -

          This is an overloaded intrinsic. You can use llvm.bit.set on any -integer bit width. -

          -  declare i17 @llvm.bit.set.i17.i17 (i17 %val, i32 %bit)
          -  declare i52 @llvm.bit.set.i52.i52 (i52 %val, i32 %bit)
          -
          - -
          Overview:
          -

          -The 'llvm.bit.set' family of intrinsic functions sets a specific bit in -a %val and returns the result.

          - -
          Arguments:
          -

          The result and the first argument, %val, may be an integer of any -bit width, but they must be the same bit width. The second argument must be an -i32.

          - -
          Semantics:
          -

          The 'llvm.bit.set' intrinsic is the equivalent of creating a bit -mask for the %bit requested in the width of %val, ORing that -mask with %val and returning the result.

          -
          - - - - -
          - -
          Syntax:
          -

          This is an overloaded intrinsic. You can use llvm.bit.clear on any -integer bit width. -

          -  declare i17 @llvm.bit.clear.i17.i17 (i17 %val, i32 %bit)
          -  declare i29 @llvm.bit.clear.i29.i29 (i29 %val, i32 %bit)
          -
          - -
          Overview:
          -

          The 'llvm.bit.clear' family of intrinsic functions clears a specific -bit in a value and returns the result.

          - -
          Arguments:
          -

          The result and the first argument, %val, may be an integer of any -bit width, but they must be the same bit width. The second argument must be an -i32.

          - -
          Semantics:
          -

          The 'llvm.bit.clear' intrinsic is the equivalent of making a bit -mask in the width of %val but with the bit at index %bit set -to zero, ANDing that mask with %val and returning the result.

          -
          - - - - -
          - -
          Syntax:
          -

          This is an overloaded intrinsic. You can use llvm.bit.concat on any -integer bit width. -

          -  declare i32 @llvm.bit.concat.i32.i17.i15 (i17 %hi, i15 %lo)
          -  declare i29 @llvm.bit.concat.i29.i12.i15 (i12 %hi, i15 %lo)
          -
          - -
          Overview:
          -

          The 'llvm.bit.concat' family of intrinsic functions concatenates two -integer values to produce a longer one.

          - -
          Arguments:
          -

          The two arguments may be any bit width. The result must be an integer type -whose bit width is the sum of the arguments' bit widths. The first argument, -%hi, represents the bits that will occupy the high order bit locations -in the concatenated result. The second argument, %lo, will occupy the -lower order bit locations in the result.

          - -
          Semantics:
          - -

          The 'llvm.bit.concat' intrinsic is the equivalent of two -zext instructions, a shl and an or. The operation -proceeds as follows:

          -
            -
          1. Each of the arguments is zext'd to the result bit width.
          2. -
          3. The %hi argument is shift left by the width of the %lo - argument (shifted into to high order bits).
          4. -
          5. The shifted %hi value and %lo are or'd together - to form the result.
          6. -
          -
          - - - @@ -4904,11 +4611,15 @@
          Arguments:

          The first argument, %val and the result may be integer types of any bit width but they must have the same bit width. The second and third -arguments must be i32 type.

          +arguments must be i32 type since they specify only a bit index.

          Semantics:
          -

          The 'llvm.bit.part.select' intrinsic is the equivalent of shifting -%val right by %loBit bits and then ANDing it with a mask with +

          The operation of the 'llvm.bit.part.select' intrinsic has two modes +of operation: forwards and reverse. If %loBit is greater than +%hiBits then the intrinsic operates in reverse mode. Otherwise it +operates in forward mode.

          +

          In forward mode, this intrinsic is the equivalent of shifting %val +right by %loBit bits and then ANDing it with a mask with only the %hiBit - %loBit bits set, as follows:

          1. The %val is shifted right (LSHR) by the number of bits specified @@ -4918,6 +4629,16 @@
          2. A mask of the retained bits is created by shifting a -1 value.
          3. The mask is ANDed with %val to produce the result.
          +

          In reverse mode, a similar computation is made except that:

          +
            +
          1. The bits selected wrap around to include both the highest and lowest bits. + For example, part_select(i16 X, 4, 7) selects bits from X with a mask of + 0x00F0 (forwards case) while part_select(i16 X, 8, 3) selects bits from X + with a mask of 0xFF0F.
          2. +
          3. The bits returned in the reverse case are reversed. So, if X has the value + 0x6ACF and we apply part_select(i16 X, 8, 3) to it, we get back the value + 0x0A6F.
          4. +
          @@ -4996,7 +4717,7 @@ Chris Lattner
          The LLVM Compiler Infrastructure
          - Last modified: $Date: 2007/04/02 02:25:19 $ + Last modified: $Date: 2007/04/04 02:42:35 $ From jeffc at jolt-lang.org Tue Apr 3 22:09:37 2007 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 03 Apr 2007 20:09:37 -0700 Subject: [llvm-commits] eh_arm.cc In-Reply-To: <184988F1-C512-4E60-B176-FB3A4007BD86@apple.com> References: <124DED6F-23CB-4938-93CF-08D897B23F26@apple.com> <9c10c9f0704030508t6d037a1fscdbb3cac0aaec544@mail.gmail.com> <9c10c9f0704030649p607c5084r8d0b2dcb4b142133@mail.gmail.com> <184988F1-C512-4E60-B176-FB3A4007BD86@apple.com> Message-ID: <461316F1.70207@jolt-lang.org> The build of llvm-gcc is now broken on other platforms: Making install in libsupc++ gmake[2]: Entering directory `/usr/home/jeffc/llvm-gcc/obj/amd64-unknown-freebsd6.2/libstdc++-v3/libsupc++' gmake[2]: *** No rule to make target `eh_arm.lo', needed by `libsupc++convenience.la'. Stop. Dale Johannesen wrote: > On Apr 3, 2007, at 6:49 AM, Lauro Ramos Venancio wrote: > > >> Files missed: >> ? libstdc++-v3/libsupc++/eh_arm.cc >> ? libstdc++-v3/libsupc++/eh_call.cc >> ? gcc/config/arm/libunwind.S >> ? gcc/config/arm/pr-support.c >> ? gcc/config/arm/unwind-arm.c >> ? gcc/config/arm/unaligned-funcs.c >> ? gcc/config/arm/unwind-arm.h >> >> Lauro\ >> > > Sorry everybody, my fault. Should be OK now. > > >> 2007/4/3, Lauro Ramos Venancio : >> >>> The file eh_arm.cc wasn't committed. It is in the patch. I can't test >>> and see if other files are missing because the patch doesn't reach >>> the >>> public svn yet. >>> >>> Lauro >>> >>> 2007/4/3, Devang Patel : >>> >>>> On Apr 2, 2007, at 11:34 PM, Bill Wendling wrote: >>>> >>>> >>>>> I'm getting this error during llvm-gcc compilation: >>>>> >>>>> make[3]: *** No rule to make target `eh_arm.cc', needed by >>>>> `eh_arm.lo'. Stop. >>>>> make[3]: *** Waiting for unfinished jobs.... >>>>> >>>> This is related to Lauro Ramos Venancio's patch Dale committed. >>>> >>>> - >>>> Devang >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>>> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > > From dalej at apple.com Tue Apr 3 22:30:41 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 3 Apr 2007 20:30:41 -0700 Subject: [llvm-commits] eh_arm.cc In-Reply-To: <461316F1.70207@jolt-lang.org> References: <124DED6F-23CB-4938-93CF-08D897B23F26@apple.com> <9c10c9f0704030508t6d037a1fscdbb3cac0aaec544@mail.gmail.com> <9c10c9f0704030649p607c5084r8d0b2dcb4b142133@mail.gmail.com> <184988F1-C512-4E60-B176-FB3A4007BD86@apple.com> <461316F1.70207@jolt-lang.org> Message-ID: On Apr 3, 2007, at 8:09 PM, Jeff Cohen wrote: > The build of llvm-gcc is now broken on other platforms: > > Making install in libsupc++ > gmake[2]: Entering directory `/usr/home/jeffc/llvm-gcc/obj/amd64- > unknown-freebsd6.2/libstdc++-v3/libsupc++' > gmake[2]: *** No rule to make target `eh_arm.lo', needed by `libsupc > ++convenience.la'. Stop. You have eh_arm.cc, and you reconfigured? The makefiles look to me like it should be finding this, the treatment of eh_arm looks identical to, for example, eh_alloc. Lauro, can you help? > Dale Johannesen wrote: >> On Apr 3, 2007, at 6:49 AM, Lauro Ramos Venancio wrote: >> Files missed: >>> ? libstdc++-v3/libsupc++/eh_arm.cc >>> ? libstdc++-v3/libsupc++/eh_call.cc >>> ? gcc/config/arm/libunwind.S >>> ? gcc/config/arm/pr-support.c >>> ? gcc/config/arm/unwind-arm.c >>> ? gcc/config/arm/unaligned-funcs.c >>> ? gcc/config/arm/unwind-arm.h >>> >>> Lauro\ >>> >> >> Sorry everybody, my fault. Should be OK now. >> >> >>> 2007/4/3, Lauro Ramos Venancio : >>> >>>> The file eh_arm.cc wasn't committed. It is in the patch. I can't >>>> test >>>> and see if other files are missing because the patch doesn't >>>> reach the >>>> public svn yet. >>>> >>>> Lauro >>>> >>>> 2007/4/3, Devang Patel : >>>> >>>>> On Apr 2, 2007, at 11:34 PM, Bill Wendling wrote: >>>>> >>>>> >>>>>> I'm getting this error during llvm-gcc compilation: >>>>>> >>>>>> make[3]: *** No rule to make target `eh_arm.cc', needed by >>>>>> `eh_arm.lo'. Stop. >>>>>> make[3]: *** Waiting for unfinished jobs.... >>>>>> >>>>> This is related to Lauro Ramos Venancio's patch Dale committed. >>>>> >>>>> - >>>>> Devang >>>>> _______________________________________________ >>>>> llvm-commits mailing list >>>>> llvm-commits at cs.uiuc.edu >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>>> >>>>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> >> >> > From jeffc at jolt-lang.org Tue Apr 3 22:49:30 2007 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 03 Apr 2007 20:49:30 -0700 Subject: [llvm-commits] eh_arm.cc In-Reply-To: References: <124DED6F-23CB-4938-93CF-08D897B23F26@apple.com> <9c10c9f0704030508t6d037a1fscdbb3cac0aaec544@mail.gmail.com> <9c10c9f0704030649p607c5084r8d0b2dcb4b142133@mail.gmail.com> <184988F1-C512-4E60-B176-FB3A4007BD86@apple.com> <461316F1.70207@jolt-lang.org> Message-ID: <4613204A.9030109@jolt-lang.org> Yep... clean build. Dale Johannesen wrote: > > On Apr 3, 2007, at 8:09 PM, Jeff Cohen wrote: > >> The build of llvm-gcc is now broken on other platforms: >> >> Making install in libsupc++ >> gmake[2]: Entering directory >> `/usr/home/jeffc/llvm-gcc/obj/amd64-unknown-freebsd6.2/libstdc++-v3/libsupc++' >> >> gmake[2]: *** No rule to make target `eh_arm.lo', needed by >> `libsupc++convenience.la'. Stop. > > You have eh_arm.cc, and you reconfigured? The makefiles look to me > like it should be finding this, > the treatment of eh_arm looks identical to, for example, eh_alloc. > Lauro, can you help? > >> Dale Johannesen wrote: >>> On Apr 3, 2007, at 6:49 AM, Lauro Ramos Venancio wrote: >>> Files missed: >>>> ? libstdc++-v3/libsupc++/eh_arm.cc >>>> ? libstdc++-v3/libsupc++/eh_call.cc >>>> ? gcc/config/arm/libunwind.S >>>> ? gcc/config/arm/pr-support.c >>>> ? gcc/config/arm/unwind-arm.c >>>> ? gcc/config/arm/unaligned-funcs.c >>>> ? gcc/config/arm/unwind-arm.h >>>> >>>> Lauro\ >>>> >>> >>> Sorry everybody, my fault. Should be OK now. >>> >>> >>>> 2007/4/3, Lauro Ramos Venancio : >>>> >>>>> The file eh_arm.cc wasn't committed. It is in the patch. I can't test >>>>> and see if other files are missing because the patch doesn't >>>>> reach the >>>>> public svn yet. >>>>> >>>>> Lauro >>>>> >>>>> 2007/4/3, Devang Patel : >>>>> >>>>>> On Apr 2, 2007, at 11:34 PM, Bill Wendling wrote: >>>>>> >>>>>> >>>>>>> I'm getting this error during llvm-gcc compilation: >>>>>>> >>>>>>> make[3]: *** No rule to make target `eh_arm.cc', needed by >>>>>>> `eh_arm.lo'. Stop. >>>>>>> make[3]: *** Waiting for unfinished jobs.... >>>>>>> >>>>>> This is related to Lauro Ramos Venancio's patch Dale committed. >>>>>> >>>>>> - >>>>>> Devang >>>>>> _______________________________________________ >>>>>> llvm-commits mailing list >>>>>> llvm-commits at cs.uiuc.edu >>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>>>> >>>>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >>> >>> >>> >> > > > > From jeffc at jolt-lang.org Tue Apr 3 22:54:39 2007 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 03 Apr 2007 20:54:39 -0700 Subject: [llvm-commits] eh_arm.cc In-Reply-To: <4613204A.9030109@jolt-lang.org> References: <124DED6F-23CB-4938-93CF-08D897B23F26@apple.com> <9c10c9f0704030508t6d037a1fscdbb3cac0aaec544@mail.gmail.com> <9c10c9f0704030649p607c5084r8d0b2dcb4b142133@mail.gmail.com> <184988F1-C512-4E60-B176-FB3A4007BD86@apple.com> <461316F1.70207@jolt-lang.org> <4613204A.9030109@jolt-lang.org> Message-ID: <4613217F.8010201@jolt-lang.org> Correction... I do not have eh_arm.cc. I'm at revision 301, and I certainly pulled in something that requires eh_arm.cc. Jeff Cohen wrote: > Yep... clean build. > > Dale Johannesen wrote: > >> On Apr 3, 2007, at 8:09 PM, Jeff Cohen wrote: >> >> >>> The build of llvm-gcc is now broken on other platforms: >>> >>> Making install in libsupc++ >>> gmake[2]: Entering directory >>> `/usr/home/jeffc/llvm-gcc/obj/amd64-unknown-freebsd6.2/libstdc++-v3/libsupc++' >>> >>> gmake[2]: *** No rule to make target `eh_arm.lo', needed by >>> `libsupc++convenience.la'. Stop. >>> >> You have eh_arm.cc, and you reconfigured? The makefiles look to me >> like it should be finding this, >> the treatment of eh_arm looks identical to, for example, eh_alloc. >> Lauro, can you help? >> >> >>> Dale Johannesen wrote: >>> >>>> On Apr 3, 2007, at 6:49 AM, Lauro Ramos Venancio wrote: >>>> Files missed: >>>> >>>>> ? libstdc++-v3/libsupc++/eh_arm.cc >>>>> ? libstdc++-v3/libsupc++/eh_call.cc >>>>> ? gcc/config/arm/libunwind.S >>>>> ? gcc/config/arm/pr-support.c >>>>> ? gcc/config/arm/unwind-arm.c >>>>> ? gcc/config/arm/unaligned-funcs.c >>>>> ? gcc/config/arm/unwind-arm.h >>>>> >>>>> Lauro\ >>>>> >>>>> >>>> Sorry everybody, my fault. Should be OK now. >>>> >>>> >>>> >>>>> 2007/4/3, Lauro Ramos Venancio : >>>>> >>>>> >>>>>> The file eh_arm.cc wasn't committed. It is in the patch. I can't test >>>>>> and see if other files are missing because the patch doesn't >>>>>> reach the >>>>>> public svn yet. >>>>>> >>>>>> Lauro >>>>>> >>>>>> 2007/4/3, Devang Patel : >>>>>> >>>>>> >>>>>>> On Apr 2, 2007, at 11:34 PM, Bill Wendling wrote: >>>>>>> >>>>>>> >>>>>>> >>>>>>>> I'm getting this error during llvm-gcc compilation: >>>>>>>> >>>>>>>> make[3]: *** No rule to make target `eh_arm.cc', needed by >>>>>>>> `eh_arm.lo'. Stop. >>>>>>>> make[3]: *** Waiting for unfinished jobs.... >>>>>>>> >>>>>>>> >>>>>>> This is related to Lauro Ramos Venancio's patch Dale committed. >>>>>>> >>>>>>> - >>>>>>> Devang >>>>>>> _______________________________________________ >>>>>>> llvm-commits mailing list >>>>>>> llvm-commits at cs.uiuc.edu >>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>>>>> >>>>>>> >>>>>>> >>>>> _______________________________________________ >>>>> llvm-commits mailing list >>>>> llvm-commits at cs.uiuc.edu >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>>> >>>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>>> >>>> >>>> >>>> >>>> >> >> >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > > From clattner at apple.com Tue Apr 3 23:02:49 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 3 Apr 2007 21:02:49 -0700 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html In-Reply-To: <200704040242.l342gqB5010232@zion.cs.uiuc.edu> References: <200704040242.l342gqB5010232@zion.cs.uiuc.edu> Message-ID: On Apr 3, 2007, at 7:42 PM, Reid Spencer wrote: > > Remove intrinsics that we will not be implementing. > Fix the anchor names of intrinsics to all be int_ so as to distinguish > them from the i_ prefix reserved for instructions. Hey Reid, Please make sure nothing else references these links outside Langref. -Chris From clattner at apple.com Tue Apr 3 23:03:25 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 3 Apr 2007 21:03:25 -0700 Subject: [llvm-commits] eh_arm.cc In-Reply-To: <4613217F.8010201@jolt-lang.org> References: <124DED6F-23CB-4938-93CF-08D897B23F26@apple.com> <9c10c9f0704030508t6d037a1fscdbb3cac0aaec544@mail.gmail.com> <9c10c9f0704030649p607c5084r8d0b2dcb4b142133@mail.gmail.com> <184988F1-C512-4E60-B176-FB3A4007BD86@apple.com> <461316F1.70207@jolt-lang.org> <4613204A.9030109@jolt-lang.org> <4613217F.8010201@jolt-lang.org> Message-ID: <984D3425-1925-4C00-AA1C-75476E82F575@apple.com> On Apr 3, 2007, at 8:54 PM, Jeff Cohen wrote: > Correction... I do not have eh_arm.cc. I'm at revision 301, and I > certainly pulled in something that requires eh_arm.cc. The fix should hit the mirror tonight -Chris From reid at x10sys.com Tue Apr 3 23:14:48 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 23:14:48 -0500 Subject: [llvm-commits] CVS: llvm/docs/ReleaseNotes.html Message-ID: <200704040414.l344EmNM012253@zion.cs.uiuc.edu> Changes in directory llvm/docs: ReleaseNotes.html updated: 1.367 -> 1.368 --- Log message: Fix links to intrinsic functions outside LangRef.html --- Diffs of the changes: (+3 -3) ReleaseNotes.html | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/docs/ReleaseNotes.html diff -u llvm/docs/ReleaseNotes.html:1.367 llvm/docs/ReleaseNotes.html:1.368 --- llvm/docs/ReleaseNotes.html:1.367 Tue Jan 23 06:35:46 2007 +++ llvm/docs/ReleaseNotes.html Tue Apr 3 23:14:31 2007 @@ -363,8 +363,8 @@ frontends.
        8. The C backend does not correctly implement the llvm.stacksave or -llvm.stackrestore +href="LangRef.html#int_stacksave">llvm.stacksave or +llvm.stackrestore intrinsics. This means that some code compiled by it can run out of stack space if they depend on these (e.g. C99 varargs).
        9. @@ -680,7 +680,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /> The LLVM Compiler Infrastructure
          - Last modified: $Date: 2007/01/23 12:35:46 $ + Last modified: $Date: 2007/04/04 04:14:31 $ From reid at x10sys.com Tue Apr 3 23:16:02 2007 From: reid at x10sys.com (Reid Spencer) Date: Tue, 3 Apr 2007 23:16:02 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704040416.l344G2Hs012331@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.43 -> 1.44 --- Log message: Add Steve Naroff --- Diffs of the changes: (+4 -4) DevMtgMay2007.html | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.43 llvm-www/DevMtgMay2007.html:1.44 --- llvm-www/DevMtgMay2007.html:1.43 Tue Apr 3 19:59:59 2007 +++ llvm-www/DevMtgMay2007.html Tue Apr 3 23:15:45 2007 @@ -254,6 +254,7 @@ Gabe McArthurIndependent Paul McJonesAdobe Systems Incorporated. Scott MichelAerospace + Steve NaroffApple, Inc. Devang PatelApple, Inc. Fernando Magno Quintao PereiraUCLA Chuck RoseAdobe Systems Incorporated. @@ -266,16 +267,15 @@ -

          Total confirmed: 25

          +

          Total confirmed: 26

          -
          Unconfirmed Attendees
          NameOrganization
          Unconfirmed 2Aerospace
          Unconfirmed 1Apple, Inc.
          Unconfirmed 1Wind River
          Unconfirmed 1NASA, Ames
          -

          Total unconfirmed: 5

          +

          Total unconfirmed: 4

          @@ -285,6 +285,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
          Last modified: $Date: 2007/04/04 00:59:59 $ +
          Last modified: $Date: 2007/04/04 04:15:45 $ From reid at x10sys.com Wed Apr 4 00:46:21 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 00:46:21 -0500 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200704040546.l345kLMo013924@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.225 -> 1.226 --- Log message: Appease Chris' pedantic streak. --- Diffs of the changes: (+15 -14) LangRef.html | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.225 llvm/docs/LangRef.html:1.226 --- llvm/docs/LangRef.html:1.225 Tue Apr 3 21:42:35 2007 +++ llvm/docs/LangRef.html Wed Apr 4 00:46:04 2007 @@ -184,7 +184,8 @@
        10. 'llvm.ctpop.*' Intrinsic
        11. 'llvm.ctlz.*' Intrinsic
        12. 'llvm.cttz.*' Intrinsic
        13. -
        14. 'llvm.part.select.*' Intrinsic
        15. +
        16. 'llvm.bit.part_select.*' Intrinsic
        17. +
        18. 'llvm.bit.part_set.*' Intrinsic
      3. Debugger intrinsics
      4. @@ -4590,21 +4591,21 @@
        Syntax:
        -

        This is an overloaded intrinsic. You can use llvm.bit.part.select +

        This is an overloaded intrinsic. You can use llvm.bit.part_select on any integer bit width.

        -  declare i17 @llvm.bit.part.select.i17.i17 (i17 %val, i32 %loBit, i32 %hiBit)
        -  declare i29 @llvm.bit.part.select.i29.i29 (i29 %val, i32 %loBit, i32 %hiBit)
        +  declare i17 @llvm.bit.part_select.i17.i17 (i17 %val, i32 %loBit, i32 %hiBit)
        +  declare i29 @llvm.bit.part_select.i29.i29 (i29 %val, i32 %loBit, i32 %hiBit)
         
        Overview:
        -

        The 'llvm.bit.part.select' family of intrinsic functions selects a +

        The 'llvm.bit.part_select' family of intrinsic functions selects a range of bits from an integer value and returns them in the same bit width as the original value.

        @@ -4614,7 +4615,7 @@ arguments must be i32 type since they specify only a bit index.

        Semantics:
        -

        The operation of the 'llvm.bit.part.select' intrinsic has two modes +

        The operation of the 'llvm.bit.part_select' intrinsic has two modes of operation: forwards and reverse. If %loBit is greater than %hiBits then the intrinsic operates in reverse mode. Otherwise it operates in forward mode.

        @@ -4643,21 +4644,21 @@
        Syntax:
        -

        This is an overloaded intrinsic. You can use llvm.bit.part.set on +

        This is an overloaded intrinsic. You can use llvm.bit.part_set on any integer bit width.

        -  declare i17 @llvm.bit.part.set.i17.i17.i9 (i17 %val, i32 %bit, i9 %newbits)
        -  declare i29 @llvm.bit.part.set.i29.i29.i13(i29 %val, i32 %bit, i13 %newbits)
        +  declare i17 @llvm.bit.part_set.i17.i17.i9 (i17 %val, i32 %bit, i9 %newbits)
        +  declare i29 @llvm.bit.part_set.i29.i29.i13(i29 %val, i32 %bit, i13 %newbits)
         
        Overview:
        -

        The 'llvm.bit.part.set' family of intrinsic functions sets a range +

        The 'llvm.bit.part_set' family of intrinsic functions sets a range of bits in a given value to a new value and returns the result.

        Arguments:
        @@ -4667,7 +4668,7 @@ of the first argument.

        Semantics:
        -

        The 'llvm.bit.part.set' intrinsic sets the value given by +

        The 'llvm.bit.part_set' intrinsic sets the value given by %newbits into %val at the bit index given by %bit. This is equivalent to the following sequence:

          @@ -4717,7 +4718,7 @@ Chris Lattner
          The LLVM Compiler Infrastructure
          - Last modified: $Date: 2007/04/04 02:42:35 $ + Last modified: $Date: 2007/04/04 05:46:04 $ From clattner at apple.com Wed Apr 4 01:02:10 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 3 Apr 2007 23:02:10 -0700 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html In-Reply-To: <200704040546.l345kLMo013924@zion.cs.uiuc.edu> References: <200704040546.l345kLMo013924@zion.cs.uiuc.edu> Message-ID: On Apr 3, 2007, at 10:46 PM, Reid Spencer wrote: > Changes in directory llvm/docs: > > LangRef.html updated: 1.225 -> 1.226 > --- > Log message: > > Appease Chris' pedantic streak. Heh, it's just a streak? -Chris From sabre at nondot.org Wed Apr 4 01:18:38 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 4 Apr 2007 01:18:38 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h Message-ID: <200704040618.l346Iclu014651@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: APInt.h updated: 1.62 -> 1.63 --- Log message: trivial optimization --- Diffs of the changes: (+1 -1) APInt.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/ADT/APInt.h diff -u llvm/include/llvm/ADT/APInt.h:1.62 llvm/include/llvm/ADT/APInt.h:1.63 --- llvm/include/llvm/ADT/APInt.h:1.62 Mon Apr 2 23:25:46 2007 +++ llvm/include/llvm/ADT/APInt.h Wed Apr 4 01:18:21 2007 @@ -278,7 +278,7 @@ /// This converts the APInt to a boolean value as a test against zero. /// @brief Boolean conversion function. inline bool getBoolValue() const { - return countLeadingZeros() != BitWidth; + return *this != 0; } /// @} From reid at x10sys.com Wed Apr 4 01:30:06 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 01:30:06 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/System/Path.h Message-ID: <200704040630.l346U6kn014828@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/System: Path.h updated: 1.48 -> 1.49 --- Log message: For PR1302: http://llvm.org/PR1302 : Make the FileType enumerators more readable and add COFF, ELF and Mach-O. --- Diffs of the changes: (+7 -4) Path.h | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) Index: llvm/include/llvm/System/Path.h diff -u llvm/include/llvm/System/Path.h:1.48 llvm/include/llvm/System/Path.h:1.49 --- llvm/include/llvm/System/Path.h:1.48 Thu Mar 29 14:05:44 2007 +++ llvm/include/llvm/System/Path.h Wed Apr 4 01:29:49 2007 @@ -536,10 +536,13 @@ /// This enumeration delineates the kinds of files that LLVM knows about. enum LLVMFileType { - UnknownFileType = 0, ///< Unrecognized file - BytecodeFileType = 1, ///< Uncompressed bytecode file - CompressedBytecodeFileType = 2, ///< Compressed bytecode file - ArchiveFileType = 3 ///< ar style archive file + Unknown_FileType = 0, ///< Unrecognized file + Bytecode_FileType = 1, ///< Uncompressed bytecode file + CompressedBytecode_FileType = 2, ///< Compressed bytecode file + Archive_FileType = 3, ///< ar style archive file + ELF_FileType = 4, ///< Native ELF object file or lib + Mach_O_FileType = 5, ///< Native Mach-O object file or lib + COFF_FileType = 6 ///< COFF object file or lib }; /// This utility function allows any memory block to be examined in order From reid at x10sys.com Wed Apr 4 01:30:43 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 01:30:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/System/Path.cpp Message-ID: <200704040630.l346UhE5014848@zion.cs.uiuc.edu> Changes in directory llvm/lib/System: Path.cpp updated: 1.21 -> 1.22 --- Log message: For PR1302: http://llvm.org/PR1302 : Implement recognition of COFF, ELF and Mach-O object/shared lib files. --- Diffs of the changes: (+38 -9) Path.cpp | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 38 insertions(+), 9 deletions(-) Index: llvm/lib/System/Path.cpp diff -u llvm/lib/System/Path.cpp:1.21 llvm/lib/System/Path.cpp:1.22 --- llvm/lib/System/Path.cpp:1.21 Wed Jul 26 11:55:39 2006 +++ llvm/lib/System/Path.cpp Wed Apr 4 01:30:26 2007 @@ -44,25 +44,54 @@ assert(length >=4 && "Invalid magic number length"); switch (magic[0]) { case 'l': - if (magic[1] == 'l' && magic[2] == 'v') { + if (magic[1] == 'l' && magic[2] == 'v') if (magic[3] == 'c') - return CompressedBytecodeFileType; + return CompressedBytecode_FileType; else if (magic[3] == 'm') - return BytecodeFileType; - } + return Bytecode_FileType; break; - case '!': - if (length >= 8) { + if (length >= 8) if (memcmp(magic,"!\n",8) == 0) - return ArchiveFileType; - } + return Archive_FileType; + break; + + case '\177': + if (magic[1] == 'E' && magic[2] == 'L' && magic[3] == 'F') + return ELF_FileType; + break; + + case 0xCE: + case 0xCF: + // This is complicated by an overlap with Java class files. + // See the Mach-O section in /usr/share/file/magic for details. + if (magic[1] == char(0xFA) && magic[2] == char(0xED) && + magic[3] == char(0xFE)) + if (length >= 15) + if (magic[15] == 1 || magic[15] == 3 || magic[15] == 6 || + magic[15] == 9) + return Mach_O_FileType; + break; + + case 0xF0: // PowerPC Windows + case 0x83: // Alpha 32-bit + case 0x84: // Alpha 64-bit + case 0x66: // MPS R4000 Windows + case 0x50: // mc68K + case 0x4c: // 80386 Windows + if (magic[1] == 0x01) + return COFF_FileType; + + case 0x90: // PA-RISC Windows + case 0x68: // mc68K Windows + if (magic[1] == 0x02) + return COFF_FileType; break; default: break; } - return UnknownFileType; + return Unknown_FileType; } bool From reid at x10sys.com Wed Apr 4 01:31:21 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 01:31:21 -0500 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/Archive.cpp ArchiveReader.cpp ArchiveWriter.cpp Message-ID: <200704040631.l346VLcJ014874@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: Archive.cpp updated: 1.19 -> 1.20 ArchiveReader.cpp updated: 1.49 -> 1.50 ArchiveWriter.cpp updated: 1.36 -> 1.37 --- Log message: For PR1302: http://llvm.org/PR1302 : Adjust useage of sys::Path::FileType for new enumerator names. --- Diffs of the changes: (+6 -6) Archive.cpp | 4 ++-- ArchiveReader.cpp | 4 ++-- ArchiveWriter.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Bytecode/Archive/Archive.cpp diff -u llvm/lib/Bytecode/Archive/Archive.cpp:1.19 llvm/lib/Bytecode/Archive/Archive.cpp:1.20 --- llvm/lib/Bytecode/Archive/Archive.cpp:1.19 Thu Mar 29 14:05:44 2007 +++ llvm/lib/Bytecode/Archive/Archive.cpp Wed Apr 4 01:31:04 2007 @@ -125,10 +125,10 @@ // Determine what kind of file it is switch (sys::IdentifyFileType(signature,4)) { - case sys::BytecodeFileType: + case sys::Bytecode_FileType: flags |= BytecodeFlag; break; - case sys::CompressedBytecodeFileType: + case sys::CompressedBytecode_FileType: flags |= CompressedBytecodeFlag; flags &= ~CompressedFlag; break; Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.49 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.50 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.49 Wed Feb 7 15:41:01 2007 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Wed Apr 4 01:31:04 2007 @@ -205,10 +205,10 @@ // Determine if this is a bytecode file switch (sys::IdentifyFileType(At, 4)) { - case sys::BytecodeFileType: + case sys::Bytecode_FileType: flags |= ArchiveMember::BytecodeFlag; break; - case sys::CompressedBytecodeFileType: + case sys::CompressedBytecode_FileType: flags |= ArchiveMember::CompressedBytecodeFlag; flags &= ~ArchiveMember::CompressedFlag; break; Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.36 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.37 --- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.36 Thu Mar 29 14:05:44 2007 +++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Wed Apr 4 01:31:04 2007 @@ -178,10 +178,10 @@ std::string magic; mbr->path.getMagicNumber(magic,4); switch (sys::IdentifyFileType(magic.c_str(),4)) { - case sys::BytecodeFileType: + case sys::Bytecode_FileType: flags |= ArchiveMember::BytecodeFlag; break; - case sys::CompressedBytecodeFileType: + case sys::CompressedBytecode_FileType: flags |= ArchiveMember::CompressedBytecodeFlag; break; default: From reid at x10sys.com Wed Apr 4 01:32:18 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 01:32:18 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Linker.h Message-ID: <200704040632.l346WIce014899@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Linker.h updated: 1.21 -> 1.22 --- Log message: Make the LinkInFile and LinkInLibrary both return an indication of whether the file was found to be a native library (and thus not linked by these functions). --- Diffs of the changes: (+3 -2) Linker.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Linker.h diff -u llvm/include/llvm/Linker.h:1.21 llvm/include/llvm/Linker.h:1.22 --- llvm/include/llvm/Linker.h:1.21 Sat Nov 11 13:59:25 2006 +++ llvm/include/llvm/Linker.h Wed Apr 4 01:32:01 2007 @@ -182,7 +182,8 @@ /// @see getLastError /// @brief Link in a single file. bool LinkInFile( - const sys::Path& File ///< File to link in. + const sys::Path& File, ///< File to link in. + bool &is_native ///< Indicates if the file is native object file ); /// This function provides a way to selectively link in a set of modules, @@ -212,7 +213,7 @@ /// @brief Link one library into the module bool LinkInLibrary ( const std::string& Library, ///< The library to link in - bool& is_file ///< Indicates if lib is really a bc file + bool& is_native ///< Indicates if lib a native library ); /// This function links one bytecode archive, \p Filename, into the module. From reid at x10sys.com Wed Apr 4 01:33:34 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 01:33:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkItems.cpp Message-ID: <200704040633.l346XYJk014939@zion.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkItems.cpp updated: 1.9 -> 1.10 --- Log message: For PR1302: http://llvm.org/PR1302 : Implement file tests for both LinkInLibrary and LinkInFile to determine if the file is native. Don't generate warnings if the file is native. --- Diffs of the changes: (+61 -31) LinkItems.cpp | 92 ++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 61 insertions(+), 31 deletions(-) Index: llvm/lib/Linker/LinkItems.cpp diff -u llvm/lib/Linker/LinkItems.cpp:1.9 llvm/lib/Linker/LinkItems.cpp:1.10 --- llvm/lib/Linker/LinkItems.cpp:1.9 Sat Nov 11 05:54:25 2006 +++ llvm/lib/Linker/LinkItems.cpp Wed Apr 4 01:33:17 2007 @@ -33,14 +33,17 @@ if (I->second) { // Link in the library suggested. bool is_bytecode = true; - if (LinkInLibrary(I->first,is_bytecode)) + if (LinkInLibrary(I->first, is_bytecode)) return true; if (!is_bytecode) NativeItems.push_back(*I); } else { // Link in the file suggested - if (LinkInFile(sys::Path(I->first))) + bool is_native = false; + if (LinkInFile(sys::Path(I->first), is_native)) return true; + if (is_native) + NativeItems.push_back(*I); } } @@ -61,8 +64,8 @@ /// LinkInLibrary - links one library into the HeadModule. /// -bool Linker::LinkInLibrary(const std::string& Lib, bool& is_bytecode) { - is_bytecode = false; +bool Linker::LinkInLibrary(const std::string& Lib, bool& is_native) { + is_native = false; // Determine where this library lives. sys::Path Pathname = FindLib(Lib); if (Pathname.isEmpty()) @@ -72,20 +75,27 @@ std::string Magic; Pathname.getMagicNumber(Magic, 64); switch (sys::IdentifyFileType(Magic.c_str(), 64)) { - case sys::BytecodeFileType: - case sys::CompressedBytecodeFileType: + default: assert(0 && "Bad file type identification"); + case sys::Unknown_FileType: + return warning("Supposed library '" + Lib + "' isn't a library."); + + case sys::Bytecode_FileType: + case sys::CompressedBytecode_FileType: // LLVM ".so" file. - if (LinkInFile(Pathname)) + if (LinkInFile(Pathname, is_native)) return error("Cannot link file '" + Pathname.toString() + "'"); - is_bytecode = true; break; - case sys::ArchiveFileType: + + case sys::Archive_FileType: if (LinkInArchive(Pathname)) return error("Cannot link archive '" + Pathname.toString() + "'"); - is_bytecode = true; break; - default: - return warning("Supposed library '" + Lib + "' isn't a library."); + + case sys::ELF_FileType: + case sys::Mach_O_FileType: + case sys::COFF_FileType: + is_native = true; + break; } return false; } @@ -135,28 +145,47 @@ /// TRUE - An error occurred. /// FALSE - No errors. /// -bool Linker::LinkInFile(const sys::Path &File) { +bool Linker::LinkInFile(const sys::Path &File, bool &is_native) { + is_native = false; // Make sure we can at least read the file if (!File.canRead()) return error("Cannot find linker input '" + File.toString() + "'"); - // A user may specify an ar archive without -l, perhaps because it - // is not installed as a library. Detect that and link the library. - if (File.isArchive()) { - if (LinkInArchive(File)) - return error("Cannot link archive '" + File.toString() + "'"); - } else if (File.isBytecodeFile()) { - verbose("Linking bytecode file '" + File.toString() + "'"); - - std::auto_ptr M(LoadObject(File)); - if (M.get() == 0) - return error("Cannot load file '" + File.toString() + "'" + Error); - if (LinkInModule(M.get())) - return error("Cannot link file '" + File.toString() + "'" + Error); - - verbose("Linked in file '" + File.toString() + "'"); - } else { - return warning("File of unknown type '" + File.toString() + "' ignored."); + // If its an archive, try to link it in + std::string Magic; + File.getMagicNumber(Magic, 64); + switch (sys::IdentifyFileType(Magic.c_str(), 64)) { + default: assert(0 && "Bad file type identification"); + case sys::Unknown_FileType: + return warning("Supposed object file '" + File.toString() + + "' not recognized as such"); + + case sys::Archive_FileType: + // A user may specify an ar archive without -l, perhaps because it + // is not installed as a library. Detect that and link the archive. + verbose("Linking archive file '" + File.toString() + "'"); + if (LinkInArchive(File)) + return error("Cannot link archive '" + File.toString() + "'"); + break; + + case sys::Bytecode_FileType: + case sys::CompressedBytecode_FileType: { + verbose("Linking bytecode file '" + File.toString() + "'"); + std::auto_ptr M(LoadObject(File)); + if (M.get() == 0) + return error("Cannot load file '" + File.toString() + "'" + Error); + if (LinkInModule(M.get())) + return error("Cannot link file '" + File.toString() + "'" + Error); + + verbose("Linked in file '" + File.toString() + "'"); + break; + } + + case sys::ELF_FileType: + case sys::Mach_O_FileType: + case sys::COFF_FileType: + is_native = true; + break; } return false; } @@ -175,8 +204,9 @@ /// TRUE - Some error occurred. /// bool Linker::LinkInFiles(const std::vector &Files) { + bool is_native; for (unsigned i = 0; i < Files.size(); ++i) - if (LinkInFile(Files[i])) + if (LinkInFile(Files[i], is_native)) return true; return false; } From reid at x10sys.com Wed Apr 4 01:34:39 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 01:34:39 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/llvm-ld.cpp Message-ID: <200704040634.l346YdVU014965@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ld: llvm-ld.cpp updated: 1.49 -> 1.50 --- Log message: For PR1302: http://llvm.org/PR1302 : Rename LinkItems as NativeLinkItems since it is filled out by the Linker library to contain only those items deemed to be native. --- Diffs of the changes: (+13 -12) llvm-ld.cpp | 25 +++++++++++++------------ 1 files changed, 13 insertions(+), 12 deletions(-) Index: llvm/tools/llvm-ld/llvm-ld.cpp diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.49 llvm/tools/llvm-ld/llvm-ld.cpp:1.50 --- llvm/tools/llvm-ld/llvm-ld.cpp:1.49 Fri Feb 16 13:11:07 2007 +++ llvm/tools/llvm-ld/llvm-ld.cpp Wed Apr 4 01:34:22 2007 @@ -268,12 +268,12 @@ /// specified bytecode file. /// /// Inputs: -/// InputFilename - The name of the input bytecode file. -/// OutputFilename - The name of the file to generate. -/// LinkItems - The native libraries, files, code with which to link -/// LibPaths - The list of directories in which to find libraries. -/// gcc - The pathname to use for GGC. -/// envp - A copy of the process's current environment. +/// InputFilename - The name of the input bytecode file. +/// OutputFilename - The name of the file to generate. +/// NativeLinkItems - The native libraries, files, code with which to link +/// LibPaths - The list of directories in which to find libraries. +/// gcc - The pathname to use for GGC. +/// envp - A copy of the process's current environment. /// /// Outputs: /// None. @@ -446,8 +446,9 @@ // Construct a Linker (now that Verbose is set) Linker TheLinker(progname, OutputFilename, Verbose); - // Keep track of the native link items (vice the bytecode items) - Linker::ItemList LinkItems; + + // Keep track of the native link items (versus the bytecode items) + Linker::ItemList NativeLinkItems; // Add library paths to the linker TheLinker.addPaths(LibPaths); @@ -476,7 +477,7 @@ BuildLinkItems(Items, InputFilenames, Libraries); // Link all the items together - if (TheLinker.LinkInItems(Items,LinkItems) ) + if (TheLinker.LinkInItems(Items, NativeLinkItems) ) return 1; // Error already printed } @@ -563,7 +564,7 @@ if (Verbose) cout << "Generating Native Code\n"; if (0 != GenerateNative(OutputFilename, AssemblyFile.toString(), - LinkItems,gcc,envp,ErrMsg)) + NativeLinkItems, gcc, envp, ErrMsg)) PrintAndExit(ErrMsg); // Remove the assembly language file. @@ -595,8 +596,8 @@ if (Verbose) cout << "Generating Native Code\n"; - if (0 != GenerateNative(OutputFilename, CFile.toString(), LinkItems, - gcc, envp, ErrMsg)) + if (0 != GenerateNative(OutputFilename, CFile.toString(), + NativeLinkItems, gcc, envp, ErrMsg)) PrintAndExit(ErrMsg); // Remove the assembly language file. From baldrick at free.fr Wed Apr 4 01:43:02 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 4 Apr 2007 01:43:02 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704040643.l346h2E5015159@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.728 -> 1.729 --- Log message: Fix comment. --- Diffs of the changes: (+1 -1) InstructionCombining.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.728 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.729 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.728 Tue Apr 3 18:29:39 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Apr 4 01:42:45 2007 @@ -4903,7 +4903,7 @@ const APInt &RHSV = RHS->getValue(); switch (LHSI->getOpcode()) { - case Instruction::Xor: // (icmp pred (and X, XorCST), CI) + case Instruction::Xor: // (icmp pred (xor X, XorCST), CI) if (ConstantInt *XorCST = dyn_cast(LHSI->getOperand(1))) { // If this is a comparison that tests the signbit (X < 0) or (x > -1), // fold the xor. From reid at x10sys.com Wed Apr 4 01:44:35 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 01:44:35 -0500 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkItems.cpp Message-ID: <200704040644.l346iZEP015200@zion.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkItems.cpp updated: 1.10 -> 1.11 --- Log message: For PR1302: http://llvm.org/PR1302 : Use local variable names that match the function parameter name that it is passed to so the code is more clear, to wit: is_bytecode -> is_native --- Diffs of the changes: (+8 -8) LinkItems.cpp | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/lib/Linker/LinkItems.cpp diff -u llvm/lib/Linker/LinkItems.cpp:1.10 llvm/lib/Linker/LinkItems.cpp:1.11 --- llvm/lib/Linker/LinkItems.cpp:1.10 Wed Apr 4 01:33:17 2007 +++ llvm/lib/Linker/LinkItems.cpp Wed Apr 4 01:44:18 2007 @@ -32,10 +32,10 @@ I != E; ++I) { if (I->second) { // Link in the library suggested. - bool is_bytecode = true; - if (LinkInLibrary(I->first, is_bytecode)) + bool is_native = false; + if (LinkInLibrary(I->first, is_native)) return true; - if (!is_bytecode) + if (is_native) NativeItems.push_back(*I); } else { // Link in the file suggested @@ -52,10 +52,10 @@ // that module should also be aggregated with duplicates eliminated. This is // now the time to process the dependent libraries to resolve any remaining // symbols. - bool is_bytecode; + bool is_native; for (Module::lib_iterator I = Composite->lib_begin(), E = Composite->lib_end(); I != E; ++I) - if(LinkInLibrary(*I, is_bytecode)) + if(LinkInLibrary(*I, is_native)) return true; return false; @@ -113,9 +113,9 @@ bool Linker::LinkInLibraries(const std::vector &Libraries) { // Process the set of libraries we've been provided. - bool is_bytecode; + bool is_native = false; for (unsigned i = 0; i < Libraries.size(); ++i) - if (LinkInLibrary(Libraries[i], is_bytecode)) + if (LinkInLibrary(Libraries[i], is_native)) return true; // At this point we have processed all the libraries provided to us. Since @@ -126,7 +126,7 @@ const Module::LibraryListType& DepLibs = Composite->getLibraries(); for (Module::LibraryListType::const_iterator I = DepLibs.begin(), E = DepLibs.end(); I != E; ++I) - if (LinkInLibrary(*I, is_bytecode)) + if (LinkInLibrary(*I, is_native)) return true; return false; From reid at x10sys.com Wed Apr 4 01:59:54 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 01:59:54 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200704040659.l346xswM015508@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.66 -> 1.67 --- Log message: Revert this until the Date::Parse module can be installed on the nightly testers. --- Diffs of the changes: (+62 -147) NewNightlyTest.pl | 209 ++++++++++++++++-------------------------------------- 1 files changed, 62 insertions(+), 147 deletions(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.66 llvm/utils/NewNightlyTest.pl:1.67 --- llvm/utils/NewNightlyTest.pl:1.66 Tue Apr 3 03:28:44 2007 +++ llvm/utils/NewNightlyTest.pl Wed Apr 4 01:59:36 2007 @@ -1,7 +1,6 @@ #!/usr/bin/perl use POSIX qw(strftime); use File::Copy; -use Date::Parse; use Socket; # @@ -46,10 +45,6 @@ # -gccpath Path to gcc/g++ used to build LLVM # -cvstag Check out a specific CVS tag to build LLVM (useful for # testing release branches) -# -usesvn Check code out from a subversion repository. With no -# argument, use the standard repository. An argument specifies -# the repository URL to use. -# -svnurl Specify the SVN URL where LLVM can be found # -target Specify the target triplet # -cflags Next argument specifies that C compilation options that # override the default. @@ -96,8 +91,6 @@ # ############################################################## my $HOME = $ENV{'HOME'}; -my $SVNURL = $ENV{"SVNURL"}; -$SVNURL = 'svn://anon at hlvm.org:3691/llvm.svn' unless $SVNURL; my $CVSRootDir = $ENV{'CVSROOT'}; $CVSRootDir = "/home/vadve/shared/PublicCVS" unless $CVSRootDir; my $BuildDir = $ENV{'BUILDDIR'}; @@ -123,7 +116,6 @@ $CONFIGUREARGS=""; $nickname=""; $NOTEST=0; -$USESVN=0; $NORUNNINGTESTS=0; $MAKECMD="make"; $SUBMITSERVER = "llvm.org"; @@ -171,8 +163,6 @@ else { $GCCPATH=""; } if (/^-cvstag/) { $CVSCOOPT .= " -r $ARGV[0]"; shift; next; } else { $CVSCOOPT="";} - if (/^-usesvn/) { $USESVN = 1; } - if (/^-svnurl/) { $SVNURL = $ARGV[0]; shift; next; } if (/^-target/) { $CONFIGUREARGS .= " --target=$ARGV[0]"; shift; next; } if (/^-cflags/) { $MAKEOPTS = "$MAKEOPTS C.Flags=\'$ARGV[0]\'"; @@ -235,7 +225,7 @@ ############################################################## my $Prefix = "$WebDir/$DATE"; my $BuildLog = "$Prefix-Build-Log.txt"; -my $COLog = "$Prefix-CVS-Log.txt"; +my $CVSLog = "$Prefix-CVS-Log.txt"; my $OldenTestsLog = "$Prefix-Olden-tests.txt"; my $SingleSourceLog = "$Prefix-SingleSource-ProgramTest.txt.gz"; my $MultiSourceLog = "$Prefix-MultiSource-ProgramTest.txt.gz"; @@ -252,15 +242,11 @@ if ($VERBOSE) { print "INITIALIZED\n"; - if ($USESVN) { - print "SVN URL = $SVNURL\n"; - } else { - print "CVS Root = $CVSRootDir\n"; - } - print "COLog = $COLog\n"; + print "CVS Root = $CVSRootDir\n"; print "BuildDir = $BuildDir\n"; print "WebDir = $WebDir\n"; print "Prefix = $Prefix\n"; + print "CVSLog = $CVSLog\n"; print "BuildLog = $BuildLog\n"; } @@ -491,48 +477,39 @@ print "Build directory exists! Removing it\n"; } system "rm -rf $BuildDir"; - mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; + mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!"; } else { if ( $VERBOSE ) { print "Build directory exists!\n"; } } } else { - mkdir $BuildDir or die "Could not create checkout directory $BuildDir!"; + mkdir $BuildDir or die "Could not create CVS checkout directory $BuildDir!"; } } -ChangeDir( $BuildDir, "checkout directory" ); +ChangeDir( $BuildDir, "CVS checkout directory" ); ############################################################## # -# Check out the llvm tree, using either SVN or CVS +# Check out the llvm tree, saving CVS messages to the cvs log... # ############################################################## +my $CVSOPT = ""; +# Use compression if going over ssh. +$CVSOPT = "-z3" + if $CVSRootDir =~ /^:ext:/; +my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT"; if (!$NOCHECKOUT) { if ( $VERBOSE ) { print "CHECKOUT STAGE:\n"; + print "( time -p $CVSCMD llvm; cd llvm/projects ; $CVSCMD llvm-test ) " . + "> $CVSLog 2>&1\n"; } - if ($USESVN) { - my $SVNCMD = "$NICE svn co $SVNURL"; - if ($VERBOSE) { - print "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . - "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n"; - system "( time -p $SVNCMD/llvm/trunk llvm; cd llvm/projects ; " . - "$SVNCMD/llvm-test/trunk llvm-test ) > $COLog 2>&1\n"; - } - } else { - my $CVSOPT = ""; - $CVSOPT = "-z3" # Use compression if going over ssh. - if $CVSRootDir =~ /^:ext:/; - my $CVSCMD = "$NICE cvs $CVSOPT -d $CVSRootDir co -P $CVSCOOPT"; - print "( time -p $CVSCMD llvm; cd llvm/projects ; " . - "$CVSCMD llvm-test ) > $COLog 2>&1"; - system "( time -p $CVSCMD llvm; cd llvm/projects ; " . - "$CVSCMD llvm-test ) > $COLog 2>&1"; - } + system "( time -p $CVSCMD llvm; cd llvm/projects ; " . + "$CVSCMD llvm-test ) > $CVSLog 2>&1"; + ChangeDir( $BuildDir , "CVS Checkout directory") ; } -ChangeDir( $BuildDir , "Checkout directory") ; ChangeDir( "llvm" , "llvm source directory") ; ############################################################## @@ -542,20 +519,14 @@ # This can probably be put on the server side # ############################################################## -my $CheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $COLog`; -my $CheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $COLog`; -my $CheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $COLog`; -my $CheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; - -my $NumFilesInCVS = 0; -my $NumDirsInCVS = 0; -if ($USESVN) { - $NumFilesInCVS = `egrep '^A' $COLog | wc -l` + 0; - $NumDirsInCVS = `sed -e 's#/[^/]*$##' $COLog | sort | uniq | wc -l` + 0; -} else { - $NumFilesInCVS = `egrep '^U' $COLog | wc -l` + 0; - $NumDirsInCVS = `egrep '^cvs (checkout|server|update):' $COLog | wc -l` + 0; -} +my $CVSCheckoutTime_Wall = GetRegex "([0-9.]+)", `grep '^real' $CVSLog`; +my $CVSCheckoutTime_User = GetRegex "([0-9.]+)", `grep '^user' $CVSLog`; +my $CVSCheckoutTime_Sys = GetRegex "([0-9.]+)", `grep '^sys' $CVSLog`; +my $CVSCheckoutTime_CPU = $CVSCheckoutTime_User + $CVSCheckoutTime_Sys; + +my $NumFilesInCVS = `egrep '^U' $CVSLog | wc -l` + 0; +my $NumDirsInCVS = + `egrep '^cvs (checkout|server|update):' $CVSLog | wc -l` + 0; ############################################################## # @@ -567,103 +538,47 @@ my (%AddedFiles, %ModifiedFiles, %RemovedFiles, %UsersCommitted, %UsersUpdated); -if (!$NOCVSSTATS) { - if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; } - - if ($USESVN) { - my $delimiter = "----------------------------------------------------" . - "--------------------\n"; - @SVNHistory = split $delimiter, `svn log --verbose -r{$DATE}:HEAD`; - -# Skip very first entry. - shift @SVNHistory; - foreach $Record (@SVNHistory) { - my (@Lines, @Fields); - my ($Rev, $Author, $StrTime, $LogLines, $Time); - @Lines = split "\n", $Record; -# print join"\n", @Lines; - - ($Rev, $Author, $StrTime, $LogLines) = split ' \| ', $Lines[0]; - $Time = str2time($StrTime); - if (time() - $Time > 24*3600) { - next; - } - - $UsersCommitted{$Author} = 1; +if(!$NOCVSSTATS){ - #print $Rev, $Author, $Time, $LogLines, "\n"; + if ($VERBOSE) { print "CVS HISTORY ANALYSIS STAGE\n"; } + @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`; +#print join "\n", @CVSHistory; print "\n"; - my $i = 2; - while ($Lines[$i] ne '') { - my ($Type, $Filename, $FromFile, $FromRev); - #print $Lines[$i], "\n"; - - if ($Lines[$i] =~ / ([MAD]) ([^ ]+) \(from ([^ ]+):([^ ]+)\)/) { - ($Type, $Filename, $FromFile, $FromRev) = ($1, $2, $3, $4); - } elsif ($Lines[$i] =~ / ([MAD]) ([^ ]+)/) { - ($Type, $Filename, $FromFile, $FromRev) = ($1, $2, "", ""); - } else { - print "UNMATCHABLE: $Lines[$i]\n"; - } + my $DateRE = '[-/:0-9 ]+\+[0-9]+'; - if ($Type eq 'M') { # Modified - $ModifiedFiles{$Filename} = 1; - } elsif ($Type eq 'A') { # Added - if ($FromFile eq "") { # File was added - $AddedFiles{$Filename} = 1; - } else { #File was added from another file - moved or copied. - $MovedFiles{$Filename} = 1; +# Loop over every record from the CVS history, filling in the hashes. + foreach $File (@CVSHistory) { + my ($Type, $Date, $UID, $Rev, $Filename); + if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) { + ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5"); + } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) { + ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", ""); + } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) { + ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/"); + } else { + print "UNMATCHABLE: $File\n"; + next; + } + # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n"; + + if ($Filename =~ /^llvm/) { + if ($Type eq 'M') { # Modified + $ModifiedFiles{$Filename} = 1; + $UsersCommitted{$UID} = 1; + } elsif ($Type eq 'A') { # Added + $AddedFiles{$Filename} = 1; + $UsersCommitted{$UID} = 1; + } elsif ($Type eq 'R') { # Removed + $RemovedFiles{$Filename} = 1; + $UsersCommitted{$UID} = 1; + } else { + $UsersUpdated{$UID} = 1; } - } elsif ($Type eq 'D') { # Removed - $RemovedFiles{$Filename} = 1; - } else { - print "INVALID TYPE: $Type"; - } - - #print $Filename, "\n"; - #print $Type, $File, $FromFile, $FromRev, "\n"; - ++$i; } - } - } else { - @CVSHistory = split "\n", `cvs history -D '1 day ago' -a -xAMROCGUW`; -#print join "\n", @CVSHistory; print "\n"; - - my $DateRE = '[-/:0-9 ]+\+[0-9]+'; + } -# Loop over every record from the CVS history, filling in the hashes. - foreach $File (@CVSHistory) { - my ($Type, $Date, $UID, $Rev, $Filename); - if ($File =~ /([AMRUGC]) ($DateRE) ([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)/) { - ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, $4, "$6/$5"); - } elsif ($File =~ /([W]) ($DateRE) ([^ ]+)/) { - ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", ""); - } elsif ($File =~ /([O]) ($DateRE) ([^ ]+) +([^ ]+)/) { - ($Type, $Date, $UID, $Rev, $Filename) = ($1, $2, $3, "", "$4/"); - } else { - print "UNMATCHABLE: $File\n"; - next; - } - # print "$File\nTy = $Type Date = '$Date' UID=$UID Rev=$Rev File = '$Filename'\n"; - - if ($Filename =~ /^llvm/) { - if ($Type eq 'M') { # Modified - $ModifiedFiles{$Filename} = 1; - $UsersCommitted{$UID} = 1; - } elsif ($Type eq 'A') { # Added - $AddedFiles{$Filename} = 1; - $UsersCommitted{$UID} = 1; - } elsif ($Type eq 'R') { # Removed - $RemovedFiles{$Filename} = 1; - $UsersCommitted{$UID} = 1; - } else { - $UsersUpdated{$UID} = 1; - } - } - } + my $TestError = 1; - my $TestError = 1; - } #$USESVN }#!NOCVSSTATS my $CVSAddedFiles = join "\n", sort keys %AddedFiles; @@ -1029,7 +944,7 @@ my @CVS_DATA; my $cvs_data; - at CVS_DATA = ReadFile "$COLog"; + at CVS_DATA = ReadFile "$CVSLog"; $cvs_data = join("\n", @CVS_DATA); my @BUILD_DATA; @@ -1075,8 +990,8 @@ 'nickname' => $nickname, 'dejagnutime_wall' => $DejagnuWallTime, 'dejagnutime_cpu' => $DejagnuTime, - 'cvscheckouttime_wall' => $CheckoutTime_Wall, - 'cvscheckouttime_cpu' => $CheckoutTime_CPU, + 'cvscheckouttime_wall' => $CVSCheckoutTime_Wall, + 'cvscheckouttime_cpu' => $CVSCheckoutTime_CPU, 'configtime_wall' => $ConfigWallTime, 'configtime_cpu'=> $ConfigTime, 'buildtime_wall' => $BuildWallTime, From evan.cheng at apple.com Wed Apr 4 02:05:12 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 4 Apr 2007 02:05:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200704040705.l3475Cve015642@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.232 -> 1.233 --- Log message: Trivially re-materializable instructions have spill weights that are half of what it would be otherwise. --- Diffs of the changes: (+6 -6) LiveIntervalAnalysis.cpp | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.232 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.233 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.232 Mon Apr 2 13:49:18 2007 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Apr 4 02:04:55 2007 @@ -164,13 +164,13 @@ unsigned reg = rep(mop.getReg()); mii->getOperand(i).setReg(reg); - // If the definition instruction is re-materializable, its spill - // weight is zero. LiveInterval &RegInt = getInterval(reg); - if (!RegInt.remat) { - RegInt.weight += - (mop.isUse() + mop.isDef()) * pow(10.0F, (int)loopDepth); - } + float w = (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth); + // If the definition instruction is re-materializable, its spill + // weight is half of what it would have been normally. + if (RegInt.remat) + w /= 2; + RegInt.weight += w; } } ++mii; From evan.cheng at apple.com Wed Apr 4 02:38:53 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 4 Apr 2007 02:38:53 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineFrameInfo.h Message-ID: <200704040738.l347crV6025298@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineFrameInfo.h updated: 1.22 -> 1.23 --- Log message: Add isFixedObjectIndex. It returns true if the stack slot index is for a fixed stack object. --- Diffs of the changes: (+6 -0) MachineFrameInfo.h | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/CodeGen/MachineFrameInfo.h diff -u llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.22 llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.23 --- llvm/include/llvm/CodeGen/MachineFrameInfo.h:1.22 Fri Jan 26 15:22:27 2007 +++ llvm/include/llvm/CodeGen/MachineFrameInfo.h Wed Apr 4 02:38:25 2007 @@ -263,6 +263,12 @@ return -++NumFixedObjects; } + /// isFixedObjectIndex - Returns true if the specified index corresponds to a + /// fixed stack object. + bool isFixedObjectIndex(int ObjectIdx) const { + return ObjectIdx < 0 && (ObjectIdx >= -(int)NumFixedObjects); + } + /// CreateStackObject - Create a new statically sized stack object, returning /// a postive identifier to represent it. /// From evan.cheng at apple.com Wed Apr 4 02:40:18 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 4 Apr 2007 02:40:18 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp VirtRegMap.h VirtRegMap.cpp Message-ID: <200704040740.l347eI5d025357@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.233 -> 1.234 VirtRegMap.h updated: 1.27 -> 1.28 VirtRegMap.cpp updated: 1.108 -> 1.109 --- Log message: Re-materialize all loads from fixed stack slots. --- Diffs of the changes: (+34 -15) LiveIntervalAnalysis.cpp | 17 ++++++++++++----- VirtRegMap.cpp | 24 ++++++++++++++++++------ VirtRegMap.h | 8 ++++---- 3 files changed, 34 insertions(+), 15 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.233 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.234 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.233 Wed Apr 4 02:04:55 2007 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Apr 4 02:40:01 2007 @@ -167,8 +167,10 @@ LiveInterval &RegInt = getInterval(reg); float w = (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth); // If the definition instruction is re-materializable, its spill - // weight is half of what it would have been normally. - if (RegInt.remat) + // weight is half of what it would have been normally unless it's + // a load from fixed stack slot. + int Dummy; + if (RegInt.remat && !tii_->isLoadFromStackSlot(RegInt.remat, Dummy)) w /= 2; RegInt.weight += w; } @@ -430,8 +432,13 @@ // done once for the vreg. We use an empty interval to detect the first // time we see a vreg. if (interval.empty()) { - // Remember if the definition can be rematerialized. - if (vi.DefInst && tii_->isReMaterializable(vi.DefInst->getOpcode())) + // Remember if the definition can be rematerialized. All load's from fixed + // stack slots are re-materializable. + int FrameIdx = 0; + if (vi.DefInst && + (tii_->isReMaterializable(vi.DefInst->getOpcode()) || + (tii_->isLoadFromStackSlot(vi.DefInst, FrameIdx) && + mf_->getFrameInfo()->isFixedObjectIndex(FrameIdx)))) interval.remat = vi.DefInst; // Get the Idx of the defining instructions. @@ -509,7 +516,7 @@ } } else { - // Can't safely assume definition is rematierializable anymore. + // Can no longer safely assume definition is rematerializable. interval.remat = NULL; // If this is the second time we see a virtual register definition, it Index: llvm/lib/CodeGen/VirtRegMap.h diff -u llvm/lib/CodeGen/VirtRegMap.h:1.27 llvm/lib/CodeGen/VirtRegMap.h:1.28 --- llvm/lib/CodeGen/VirtRegMap.h:1.27 Tue Mar 20 03:13:50 2007 +++ llvm/lib/CodeGen/VirtRegMap.h Wed Apr 4 02:40:01 2007 @@ -31,8 +31,8 @@ public: enum { NO_PHYS_REG = 0, - NO_STACK_SLOT = ~0 >> 1, - MAX_STACK_SLOT = (1 << 18)-1 + NO_STACK_SLOT = (1L << 30)-1, + MAX_STACK_SLOT = (1L << 18)-1 }; enum ModRef { isRef = 1, isMod = 2, isModRef = 3 }; @@ -60,13 +60,13 @@ /// read/written by this instruction. MI2VirtMapTy MI2VirtMap; - /// ReMatMap - This is irtual register to re-materialized instruction + /// ReMatMap - This is virtual register to re-materialized instruction /// mapping. Each virtual register whose definition is going to be /// re-materialized has an entry in it. std::map ReMatMap; /// ReMatId - Instead of assigning a stack slot to a to be rematerialized - /// virtaul register, an unique id is being assinged. This keeps track of + /// virtual register, an unique id is being assigned. This keeps track of /// the highest id used so far. Note, this starts at (1<<18) to avoid /// conflicts with stack slot numbers. int ReMatId; Index: llvm/lib/CodeGen/VirtRegMap.cpp diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.108 llvm/lib/CodeGen/VirtRegMap.cpp:1.109 --- llvm/lib/CodeGen/VirtRegMap.cpp:1.108 Fri Mar 30 15:21:35 2007 +++ llvm/lib/CodeGen/VirtRegMap.cpp Wed Apr 4 02:40:01 2007 @@ -87,6 +87,9 @@ assert(MRegisterInfo::isVirtualRegister(virtReg)); assert(Virt2StackSlotMap[virtReg] == NO_STACK_SLOT && "attempt to assign stack slot to already spilled register"); + assert((frameIndex >= 0 || + (frameIndex >= MF.getFrameInfo()->getObjectIndexBegin())) && + "illegal fixed frame index"); Virt2StackSlotMap[virtReg] = frameIndex; } @@ -94,8 +97,14 @@ assert(MRegisterInfo::isVirtualRegister(virtReg)); assert(Virt2StackSlotMap[virtReg] == NO_STACK_SLOT && "attempt to assign re-mat id to already spilled register"); + const MachineInstr *DefMI = getReMaterializedMI(virtReg); + int FrameIdx; + if (TII.isLoadFromStackSlot((MachineInstr*)DefMI, FrameIdx)) { + // Load from stack slot is re-materialize as reload from the stack slot! + Virt2StackSlotMap[virtReg] = FrameIdx; + return FrameIdx; + } Virt2StackSlotMap[virtReg] = ReMatId; - ++NumReMats; return ReMatId++; } @@ -625,7 +634,6 @@ /// register allocator is done with them. If possible, avoid reloading vregs. void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM, std::vector &ReMatedMIs) { - DOUT << MBB.getBasicBlock()->getName() << ":\n"; // Spills - Keep track of which spilled values are available in physregs so @@ -656,7 +664,9 @@ const TargetInstrDescriptor *TID = MI.getInstrDescriptor(); // If this instruction is being rematerialized, just remove it! - if (TID->Flags & M_REMATERIALIZIBLE) { + int FrameIdx; + if ((TID->Flags & M_REMATERIALIZIBLE) || + TII->isLoadFromStackSlot(&MI, FrameIdx)) { bool Remove = true; for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); @@ -886,10 +896,13 @@ PhysRegsUsed[PhysReg] = true; ReusedOperands.markClobbered(PhysReg); - if (doReMat) + if (doReMat) { MRI->reMaterialize(MBB, &MI, PhysReg, VRM.getReMaterializedMI(VirtReg)); - else + ++NumReMats; + } else { MRI->loadRegFromStackSlot(MBB, &MI, PhysReg, StackSlot, RC); + ++NumLoads; + } // This invalidates PhysReg. Spills.ClobberPhysReg(PhysReg); @@ -901,7 +914,6 @@ // unless it's a two-address operand. if (TID->getOperandConstraint(i, TOI::TIED_TO) == -1) MI.getOperand(i).setIsKill(); - ++NumLoads; MI.getOperand(i).setReg(PhysReg); DOUT << '\t' << *prior(MII); } From evan.cheng at apple.com Wed Apr 4 02:41:13 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 4 Apr 2007 02:41:13 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/X86/2006-05-11-InstrSched.ll 2007-03-15-GEP-Idx-Sink.ll Message-ID: <200704040741.l347fDL8025389@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/X86: 2006-05-11-InstrSched.ll updated: 1.7 -> 1.8 2007-03-15-GEP-Idx-Sink.ll updated: 1.1 -> 1.2 --- Log message: These got better. --- Diffs of the changes: (+2 -2) 2006-05-11-InstrSched.ll | 2 +- 2007-03-15-GEP-Idx-Sink.ll | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/CodeGen/X86/2006-05-11-InstrSched.ll diff -u llvm/test/CodeGen/X86/2006-05-11-InstrSched.ll:1.7 llvm/test/CodeGen/X86/2006-05-11-InstrSched.ll:1.8 --- llvm/test/CodeGen/X86/2006-05-11-InstrSched.ll:1.7 Tue Mar 13 18:26:41 2007 +++ llvm/test/CodeGen/X86/2006-05-11-InstrSched.ll Wed Apr 4 02:40:55 2007 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 -stats 2>&1 |\ -; RUN: grep 'asm-printer' | grep 37 +; RUN: grep 'asm-printer' | grep 35 target datalayout = "e-p:32:32" define void @foo(i32* %mc, i32* %bp, i32* %ms, i32* %xmb, i32* %mpp, i32* %tpmm, i32* %ip, i32* %tpim, i32* %dpp, i32* %tpdm, i32* %bpi, i32 %M) { Index: llvm/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll diff -u llvm/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll:1.1 llvm/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll:1.2 --- llvm/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll:1.1 Fri Mar 30 16:22:46 2007 +++ llvm/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll Wed Apr 4 02:40:55 2007 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc && -; RUN: llvm-as < %s | llc -march=x86 -mtriple=i686-darwin | grep 'addl $20, %esp' +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i686-darwin | grep 'addl $16, %esp' define void @foo(i8** %buf, i32 %size, i32 %col, i8* %p) { entry: From evan.cheng at apple.com Wed Apr 4 02:41:32 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 4 Apr 2007 02:41:32 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll Message-ID: <200704040741.l347fWJ6025407@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/ARM: 2007-03-13-InstrSched.ll updated: 1.2 -> 1.3 --- Log message: These got better. --- Diffs of the changes: (+1 -1) 2007-03-13-InstrSched.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll diff -u llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll:1.2 llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll:1.3 --- llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll:1.2 Wed Mar 14 18:26:40 2007 +++ llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll Wed Apr 4 02:41:15 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin -relocation-model=pic -mattr=+v6 -stats 2>&1 | grep 'asm-printer' | grep 53 +; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin -relocation-model=pic -mattr=+v6 -stats 2>&1 | grep 'asm-printer' | grep 42 define void @test(i32 %tmp56222, i32 %tmp36224, i32 %tmp46223, i32 %i.0196.0.ph, i32 %tmp8, i32* %tmp1011, i32** %tmp1, i32* %d2.1.out, i32* %d3.1.out, i32* %d0.1.out, i32* %d1.1.out) { newFuncRoot: From evan.cheng at apple.com Wed Apr 4 02:41:50 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 4 Apr 2007 02:41:50 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/ARM/arm-negative-stride.ll Message-ID: <200704040741.l347forv025423@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/ARM: arm-negative-stride.ll updated: 1.1 -> 1.2 --- Log message: Fix test case. --- Diffs of the changes: (+1 -1) arm-negative-stride.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/CodeGen/ARM/arm-negative-stride.ll diff -u llvm/test/CodeGen/ARM/arm-negative-stride.ll:1.1 llvm/test/CodeGen/ARM/arm-negative-stride.ll:1.2 --- llvm/test/CodeGen/ARM/arm-negative-stride.ll:1.1 Mon Apr 2 19:13:16 2007 +++ llvm/test/CodeGen/ARM/arm-negative-stride.ll Wed Apr 4 02:41:33 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=arm | grep -F 'str r1, [r3, -r0, lsl #2]' +; RUN: llvm-as < %s | llc -march=arm | grep "str r1, \[r.*, -r.*, lsl #2]" define void @test(i32* %P, i32 %A, i32 %i) { entry: From evan.cheng at apple.com Wed Apr 4 03:49:27 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 4 Apr 2007 03:49:27 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll Message-ID: <200704040849.l348nRE2026963@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/ARM: 2007-03-13-InstrSched.ll updated: 1.3 -> 1.4 --- Log message: Better still. --- Diffs of the changes: (+1 -1) 2007-03-13-InstrSched.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll diff -u llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll:1.3 llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll:1.4 --- llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll:1.3 Wed Apr 4 02:41:15 2007 +++ llvm/test/CodeGen/ARM/2007-03-13-InstrSched.ll Wed Apr 4 03:49:10 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin -relocation-model=pic -mattr=+v6 -stats 2>&1 | grep 'asm-printer' | grep 42 +; RUN: llvm-as < %s | llc -mtriple=arm-apple-darwin -relocation-model=pic -mattr=+v6 -stats 2>&1 | grep 'asm-printer' | grep 41 define void @test(i32 %tmp56222, i32 %tmp36224, i32 %tmp46223, i32 %i.0196.0.ph, i32 %tmp8, i32* %tmp1011, i32** %tmp1, i32* %d2.1.out, i32* %d3.1.out, i32* %d0.1.out, i32* %d1.1.out) { newFuncRoot: From evan.cheng at apple.com Wed Apr 4 03:49:58 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 4 Apr 2007 03:49:58 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll Message-ID: <200704040849.l348nwbc026989@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/X86: 2007-03-15-GEP-Idx-Sink.ll updated: 1.2 -> 1.3 --- Log message: Better still. --- Diffs of the changes: (+1 -1) 2007-03-15-GEP-Idx-Sink.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll diff -u llvm/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll:1.2 llvm/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll:1.3 --- llvm/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll:1.2 Wed Apr 4 02:40:55 2007 +++ llvm/test/CodeGen/X86/2007-03-15-GEP-Idx-Sink.ll Wed Apr 4 03:49:40 2007 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc && -; RUN: llvm-as < %s | llc -march=x86 -mtriple=i686-darwin | grep 'addl $16, %esp' +; RUN: llvm-as < %s | llc -march=x86 -mtriple=i686-darwin | grep 'addl $12, %esp' define void @foo(i8** %buf, i32 %size, i32 %col, i8* %p) { entry: From criswell at cs.uiuc.edu Wed Apr 4 09:03:29 2007 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 4 Apr 2007 09:03:29 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704041403.JAA13780@choi.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.1 -> 1.2 --- Log message: Added Cray to company list. Added more research groups. Added a few education institutions. Removed class column from educational list as we only have that information for UIUC. --- Diffs of the changes: (+58 -3) Users.html | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 58 insertions(+), 3 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.1 llvm-www/Users.html:1.2 --- llvm-www/Users.html:1.1 Tue Apr 3 17:31:48 2007 +++ llvm-www/Users.html Wed Apr 4 09:02:52 2007 @@ -33,6 +33,12 @@ OpenGL Engine in MacOS X (Leopard) + + + Cray + Backend for x86/64 + + Hue AS @@ -71,6 +77,12 @@ Instrumentation of software + + Rice University + Keith Cooper's Research Group + + + New York University @@ -98,6 +110,14 @@ xPilot behavioral synthesis system + + + University of California, Los Angeles + + Jens Palsberg + + + @@ -108,6 +128,31 @@ All LLVM Group Research Projects + + + + University of Illinois at Urbana-Champaign + + Ravi Iyer's Research Group + Runtime monitoring for software reliability + + + + + University of Illinois at Urbana-Champaign + + David Padua's Research Group + Automatic replication for software reliability + + + + + University of Illinois at Urbana-Champaign + + Sanjay Patel's Research Group + Microarchitecture research + +
        @@ -121,14 +166,24 @@ - - + + + + + + + +
        OrganizationClass
        University of Illinois at Urbana-Champaign CS 426, CS 526, CS 433, CS 533
        + University of New South Wales, Australia +
        + University of California, Los Angeles +
        @@ -166,6 +221,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
        LLVM Development List
        - Last modified: $Date: 2007/04/03 22:31:48 $ + Last modified: $Date: 2007/04/04 14:02:52 $ From reid at x10sys.com Wed Apr 4 09:09:53 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 09:09:53 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704041409.l34E9rHe001429@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.2 -> 1.3 --- Log message: Add AutoESL --- Diffs of the changes: (+9 -4) Users.html | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.2 llvm-www/Users.html:1.3 --- llvm-www/Users.html:1.2 Wed Apr 4 09:02:52 2007 +++ llvm-www/Users.html Wed Apr 4 09:09:36 2007 @@ -21,16 +21,21 @@ Description + + + Apple Computer + OpenGL Engine in MacOS X (Leopard) + + Ascenium Compiler for reconfigurable processor - - Apple Computer - OpenGL Engine in MacOS X (Leopard) + AutoESL Design Technologies, Inc. + Electronic System Level (ESL) to Silicon @@ -221,6 +226,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
        LLVM Development List
        - Last modified: $Date: 2007/04/04 14:02:52 $ + Last modified: $Date: 2007/04/04 14:09:36 $ From criswell at cs.uiuc.edu Wed Apr 4 09:14:57 2007 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 4 Apr 2007 09:14:57 -0500 Subject: [llvm-commits] CVS: llvm-www/header.incl Message-ID: <200704041414.JAA13840@choi.cs.uiuc.edu> Changes in directory llvm-www: header.incl updated: 1.55 -> 1.56 --- Log message: Add the LLVM users page to the site map sidebar. Rename "LLVM People" to "LLVM Developers" to avoid confusion between Users page and Developers page. If others have suggestions for a different naming scheme, please let me know. --- Diffs of the changes: (+2 -1) header.incl | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm-www/header.incl diff -u llvm-www/header.incl:1.55 llvm-www/header.incl:1.56 --- llvm-www/header.incl:1.55 Tue Mar 20 15:06:19 2007 +++ llvm-www/header.incl Wed Apr 4 09:14:21 2007 @@ -29,7 +29,8 @@ LLVM Projects
        Open Projects
        News Articles
        -LLVM People
        +LLVM Users
        +LLVM Developers
        Bug Database
        From jeffc at jolt-lang.org Wed Apr 4 11:11:40 2007 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 4 Apr 2007 11:11:40 -0500 Subject: [llvm-commits] CVS: llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll Message-ID: <200704041611.l34GBetE003835@zion.cs.uiuc.edu> Changes in directory llvm/test/Transforms/InstCombine: 2007-04-04-BadFoldBitcastIntoMalloc.ll added (r1.1) --- Log message: Add new test. --- Diffs of the changes: (+19 -0) 2007-04-04-BadFoldBitcastIntoMalloc.ll | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll diff -c /dev/null llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll:1.1 *** /dev/null Wed Apr 4 11:11:33 2007 --- llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll Wed Apr 4 11:11:23 2007 *************** *** 0 **** --- 1,19 ---- + ; In the presence of a negative offset (the -8 below), a fold of a bitcast into + ; a malloc messes up the element count, causing an extra 4GB to be allocated on + ; 64-bit targets. + ; + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v '= add i32' + + target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" + target triple = "x86_64-unknown-freebsd6.2" + + define i1 @test(i32 %tmp141, double** %tmp145) + { + %tmp133 = add i32 %tmp141, 1 + %tmp134 = shl i32 %tmp133, 3 + %tmp135 = add i32 %tmp134, -8 + %tmp136 = malloc i8, i32 %tmp135 + %tmp137 = bitcast i8* %tmp136 to double* + store double* %tmp137, double** %tmp145 + ret i1 false + } From jeffc at jolt-lang.org Wed Apr 4 11:59:14 2007 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 4 Apr 2007 11:59:14 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704041659.l34GxEjm004794@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.729 -> 1.730 --- Log message: Fix 2007-04-04-BadFoldBitcastIntoMalloc.ll --- Diffs of the changes: (+5 -4) InstructionCombining.cpp | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.729 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.730 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.729 Wed Apr 4 01:42:45 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Apr 4 11:58:57 2007 @@ -5901,7 +5901,7 @@ /// X*Scale+Offset. /// static Value *DecomposeSimpleLinearExpr(Value *Val, unsigned &Scale, - unsigned &Offset) { + int &Offset) { assert(Val->getType() == Type::Int32Ty && "Unexpected allocation size type!"); if (ConstantInt *CI = dyn_cast(Val)) { Offset = CI->getZExtValue(); @@ -5985,7 +5985,8 @@ // See if we can satisfy the modulus by pulling a scale out of the array // size argument. - unsigned ArraySizeScale, ArrayOffset; + unsigned ArraySizeScale; + int ArrayOffset; Value *NumElements = // See if the array size is a decomposable linear expr. DecomposeSimpleLinearExpr(AI.getOperand(0), ArraySizeScale, ArrayOffset); @@ -6010,8 +6011,8 @@ } } - if (unsigned Offset = (AllocElTySize*ArrayOffset)/CastElTySize) { - Value *Off = ConstantInt::get(Type::Int32Ty, Offset); + if (int Offset = (AllocElTySize*ArrayOffset)/CastElTySize) { + Value *Off = ConstantInt::get(Type::Int32Ty, Offset, true); Instruction *Tmp = BinaryOperator::createAdd(Amt, Off, "tmp"); Amt = InsertNewInstBefore(Tmp, AI); } From sabre at nondot.org Wed Apr 4 12:24:45 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 4 Apr 2007 12:24:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/StringMap.cpp Message-ID: <200704041724.l34HOjlQ005408@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: StringMap.cpp updated: 1.12 -> 1.13 --- Log message: stringmap memory managed with malloc now --- Diffs of the changes: (+1 -1) StringMap.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Support/StringMap.cpp diff -u llvm/lib/Support/StringMap.cpp:1.12 llvm/lib/Support/StringMap.cpp:1.13 --- llvm/lib/Support/StringMap.cpp:1.12 Tue Apr 3 19:44:31 2007 +++ llvm/lib/Support/StringMap.cpp Wed Apr 4 12:24:28 2007 @@ -227,7 +227,7 @@ } } - delete[] TheTable; + free(TheTable); TheTable = NewTableArray; NumBuckets = NewSize; From bwendlin at apple.com Wed Apr 4 14:02:41 2007 From: bwendlin at apple.com (bwendlin at apple.com) Date: Wed, 4 Apr 2007 12:02:41 -0700 (PDT) Subject: [llvm-commits] [125717] Stop random segfaults. Message-ID: <20070404190241.DA3C4D1106C4@src> Revision: 125717 Author: bwendlin Date: 2007-04-04 12:02:41 -0700 (Wed, 04 Apr 2007) Log Message: ----------- Stop random segfaults. This explicitly sets the DYLD_LIBRARY_PATH to the stage# directories. Modified Paths: -------------- apple-local/branches/llvm/gcc/Makefile.in Modified: apple-local/branches/llvm/gcc/Makefile.in =================================================================== --- apple-local/branches/llvm/gcc/Makefile.in 2007-04-04 08:00:56 UTC (rev 125716) +++ apple-local/branches/llvm/gcc/Makefile.in 2007-04-04 19:02:41 UTC (rev 125717) @@ -1089,6 +1089,13 @@ # libraries change the tools should be relinked. LIBDEPS += $(LLVMLIBFILES) LLVMBACKENDFILES := $(LLVMLIBFILES) + +# APPLE LOCAL begin LLVM - set DYLD path +SET_DYLIB_PATH=0 + +# Set up library path if needed. + at set_gcc_lib_path@ +# APPLE LOCAL end LLVM - set DYLD path else # Remove scheduler files. @@ -1128,6 +1135,10 @@ # Make sure that 'make install' knows about the dylib. EXTRA_PROGRAMS += libllvmgcc.dylib +# APPLE LOCAL begin LLVM - set DYLD path +SET_DYLIB_PATH=1 +# APPLE LOCAL end LLVM - set DYLD path + endif endif # APPLE LOCAL end LLVM @@ -1217,8 +1228,10 @@ # language hooks, generated by configure @language_hooks@ +# APPLE LOCAL begin LLVM - Don't Set this for DYLIBs # Set up library path if needed. - at set_gcc_lib_path@ +##@set_gcc_lib_path@ +# APPLE LOCAL end LLVM - Don't Set this for DYLIBs # per-language makefile fragments ifneq ($(LANG_MAKEFRAGS),) @@ -4054,6 +4067,9 @@ # overrideable (for a bootstrap build stage1 also builds gcc.info). # The stage1 compiler is always built with checking enabled. stage1_build: + if test "${SET_DYLIB_PATH}" = "1"; then \ + DYLD_LIBRARY_PATH="`${PWD_COMMAND}`"; \ + fi; \ $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)" \ CFLAGS="$(STAGE1_CFLAGS) $(STAGE1_CHECKING)" \ MAKEINFO="$(MAKEINFO)" MAKEINFOFLAGS="$(MAKEINFOFLAGS)" \ @@ -4067,6 +4083,9 @@ echo stage2_build > stage_last stage2_build: stage1_copy + if test "${SET_DYLIB_PATH}" = "1"; then \ + DYLD_LIBRARY_PATH="`${PWD_COMMAND}`/stage1"; \ + fi; \ $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" \ STAGE_PREFIX=stage1/ \ $(POSTSTAGE1_FLAGS_TO_PASS) \ @@ -4080,6 +4099,9 @@ echo stage3_build > stage_last stageprofile_build: stage1_copy + if test "${SET_DYLIB_PATH}" = "1"; then \ + DYLD_LIBRARY_PATH="`${PWD_COMMAND}`/stage1"; \ + fi; \ $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" \ STAGE_PREFIX=stage1/ \ $(POSTSTAGE1_FLAGS_TO_PASS) \ @@ -4093,6 +4115,9 @@ echo stagefeedback_build > stage_last stage3_build: stage2_copy + if test "${SET_DYLIB_PATH}" = "1"; then \ + DYLD_LIBRARY_PATH="`${PWD_COMMAND}`/stage2"; \ + fi; \ $(MAKE) CC="$(STAGE_CC_WRAPPER) stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" \ STAGE_PREFIX=stage2/ \ $(POSTSTAGE1_FLAGS_TO_PASS) \ @@ -4101,6 +4126,9 @@ echo stage3_build > stage_last stagefeedback_build: stageprofile_copy stage1_copy + if test "${SET_DYLIB_PATH}" = "1"; then \ + DYLD_LIBRARY_PATH="`${PWD_COMMAND}`/stage1"; \ + fi; \ $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" \ STAGE_PREFIX=stage1/ \ $(POSTSTAGE1_FLAGS_TO_PASS) \ @@ -4120,6 +4148,9 @@ echo stage4_build > stage_last stage4_build: stage3_copy + if test "${SET_DYLIB_PATH}" = "1"; then \ + DYLD_LIBRARY_PATH="`${PWD_COMMAND}`/stage3"; \ + fi; \ $(MAKE) CC="$(STAGE_CC_WRAPPER) stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" CC_FOR_BUILD="$(STAGE_CC_WRAPPER) stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" \ STAGE_PREFIX=stage3/ \ $(POSTSTAGE1_FLAGS_TO_PASS) \ From reid at x10sys.com Wed Apr 4 14:16:16 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 14:16:16 -0500 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200704041916.l34JGG6h007588@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.226 -> 1.227 --- Log message: Remove the part_set intrinsic. It won't get implemented as an intrinsic. --- Diffs of the changes: (+1 -40) LangRef.html | 41 +---------------------------------------- 1 files changed, 1 insertion(+), 40 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.226 llvm/docs/LangRef.html:1.227 --- llvm/docs/LangRef.html:1.226 Wed Apr 4 00:46:04 2007 +++ llvm/docs/LangRef.html Wed Apr 4 14:15:59 2007 @@ -185,7 +185,6 @@
      5. 'llvm.ctlz.*' Intrinsic
      6. 'llvm.cttz.*' Intrinsic
      7. 'llvm.bit.part_select.*' Intrinsic
      8. -
      9. 'llvm.bit.part_set.*' Intrinsic
    1. Debugger intrinsics
    2. @@ -4642,44 +4641,6 @@
    - - - -
    - -
    Syntax:
    -

    This is an overloaded intrinsic. You can use llvm.bit.part_set on -any integer bit width. -

    -  declare i17 @llvm.bit.part_set.i17.i17.i9 (i17 %val, i32 %bit, i9 %newbits)
    -  declare i29 @llvm.bit.part_set.i29.i29.i13(i29 %val, i32 %bit, i13 %newbits)
    -
    - -
    Overview:
    -

    The 'llvm.bit.part_set' family of intrinsic functions sets a range -of bits in a given value to a new value and returns the result.

    - -
    Arguments:
    -

    The first argument and the result may be an integer type of any bit width but -they must have the same bit width. The second argument must be an i32. -The third argument may be any any bit width less than or equal to the bit width -of the first argument.

    - -
    Semantics:
    -

    The 'llvm.bit.part_set' intrinsic sets the value given by -%newbits into %val at the bit index given by %bit. -This is equivalent to the following sequence:

    -
      -
    1. The bits in %val starting at %bit and up to the width - of %newbits are cleared by ANDing them with a zero mask.
    2. -
    3. The bits in %newbits are shifted left by %bit bits. -
    4. The shifted %newbits value is OR'd into %val to produce - the result.
    5. -
    -
    -
    Debugger Intrinsics @@ -4718,7 +4679,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2007/04/04 05:46:04 $ + Last modified: $Date: 2007/04/04 19:15:59 $ From dalej at apple.com Wed Apr 4 14:16:59 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 4 Apr 2007 14:16:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704041916.l34JGx6V007613@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.730 -> 1.731 --- Log message: Prevent transformConstExprCastCall from generating conversions that assert elsewhere. --- Diffs of the changes: (+35 -0) InstructionCombining.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.730 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.731 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.730 Wed Apr 4 11:58:57 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Apr 4 14:16:42 2007 @@ -7469,6 +7469,7 @@ const Type *ParamTy = FT->getParamType(i); const Type *ActTy = (*AI)->getType(); ConstantInt *c = dyn_cast(*AI); + //Some conversions are safe even if we do not have a body. //Either we can cast directly, or we can upconvert the argument bool isConvertible = ActTy == ParamTy || (isa(ParamTy) && isa(ActTy)) || @@ -7477,6 +7478,40 @@ (c && ParamTy->getPrimitiveSizeInBits() >= ActTy->getPrimitiveSizeInBits() && c->getValue().isStrictlyPositive()); if (Callee->isDeclaration() && !isConvertible) return false; + + // Most other conversions can be done if we have a body, even if these + // lose information, e.g. int->short. + // Some conversions cannot be done at all, e.g. float to pointer. + // Logic here parallels CastInst::getCastOpcode (the design there + // requires legality checks like this be done before calling it). + if (ParamTy->isInteger()) { + if (const VectorType *VActTy = dyn_cast(ActTy)) { + if (VActTy->getBitWidth() != ParamTy->getPrimitiveSizeInBits()) + return false; + } + if (!ActTy->isInteger() && !ActTy->isFloatingPoint() && + !isa(ActTy)) + return false; + } else if (ParamTy->isFloatingPoint()) { + if (const VectorType *VActTy = dyn_cast(ActTy)) { + if (VActTy->getBitWidth() != ParamTy->getPrimitiveSizeInBits()) + return false; + } + if (!ActTy->isInteger() && !ActTy->isFloatingPoint()) + return false; + } else if (const VectorType *VParamTy = dyn_cast(ParamTy)) { + if (const VectorType *VActTy = dyn_cast(ActTy)) { + if (VActTy->getBitWidth() != VParamTy->getBitWidth()) + return false; + } + if (VParamTy->getBitWidth() != ActTy->getPrimitiveSizeInBits()) + return false; + } else if (isa(ParamTy)) { + if (!ActTy->isInteger() && !isa(ActTy)) + return false; + } else { + return false; + } } if (FT->getNumParams() < NumActualArgs && !FT->isVarArg() && From dalej at apple.com Wed Apr 4 14:18:33 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 4 Apr 2007 14:18:33 -0500 Subject: [llvm-commits] CVS: llvm/test/Transforms/InstCombine/call2.ll Message-ID: <200704041918.l34JIXsq007673@zion.cs.uiuc.edu> Changes in directory llvm/test/Transforms/InstCombine: call2.ll added (r1.1) --- Log message: Test for transformConstExprCastCall fix. --- Diffs of the changes: (+27 -0) call2.ll | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+) Index: llvm/test/Transforms/InstCombine/call2.ll diff -c /dev/null llvm/test/Transforms/InstCombine/call2.ll:1.1 *** /dev/null Wed Apr 4 14:18:26 2007 --- llvm/test/Transforms/InstCombine/call2.ll Wed Apr 4 14:18:16 2007 *************** *** 0 **** --- 1,27 ---- + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis + + ; This used to crash trying to do a double-to-pointer conversion + define i32 @bar() { + entry: + %retval = alloca i32, align 4 ; [#uses=1] + "alloca point" = bitcast i32 0 to i32 ; [#uses=0] + %tmp = call i32 (...)* bitcast (i32 (i8*)* @f to i32 (...)*)( double 3.000000e+00 ) ; [#uses=0] + br label %return + + return: ; preds = %entry + %retval1 = load i32* %retval ; [#uses=1] + ret i32 %retval1 + } + + define i32 @f(i8* %p) { + entry: + %p_addr = alloca i8* ; [#uses=1] + %retval = alloca i32, align 4 ; [#uses=1] + "alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i8* %p, i8** %p_addr + br label %return + + return: ; preds = %entry + %retval1 = load i32* %retval ; [#uses=1] + ret i32 %retval1 + } From jeffc at jolt-lang.org Wed Apr 4 15:35:59 2007 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 4 Apr 2007 15:35:59 -0500 Subject: [llvm-commits] CVS: llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll Message-ID: <200704042035.l34KZxXp027199@zion.cs.uiuc.edu> Changes in directory llvm/test/Transforms/InstCombine: 2007-04-04-BadFoldBitcastIntoMalloc.ll updated: 1.1 -> 1.2 --- Log message: Get it right... --- Diffs of the changes: (+2 -1) 2007-04-04-BadFoldBitcastIntoMalloc.ll | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll diff -u llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll:1.1 llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll:1.2 --- llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll:1.1 Wed Apr 4 11:11:23 2007 +++ llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll Wed Apr 4 15:35:31 2007 @@ -2,7 +2,8 @@ ; a malloc messes up the element count, causing an extra 4GB to be allocated on ; 64-bit targets. ; -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep -v '= add i32' +; RUN: llvm-as < %s | opt -instcombine -disable-output && +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep '= add i32' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" target triple = "x86_64-unknown-freebsd6.2" From jeffc at jolt-lang.org Wed Apr 4 15:41:01 2007 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 4 Apr 2007 15:41:01 -0500 Subject: [llvm-commits] CVS: llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll Message-ID: <200704042041.l34Kf1UR027334@zion.cs.uiuc.edu> Changes in directory llvm/test/Transforms/InstCombine: 2007-04-04-BadFoldBitcastIntoMalloc.ll updated: 1.2 -> 1.3 --- Log message: Any add is wrong, regardless of type. --- Diffs of the changes: (+1 -1) 2007-04-04-BadFoldBitcastIntoMalloc.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll diff -u llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll:1.2 llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll:1.3 --- llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll:1.2 Wed Apr 4 15:35:31 2007 +++ llvm/test/Transforms/InstCombine/2007-04-04-BadFoldBitcastIntoMalloc.ll Wed Apr 4 15:40:44 2007 @@ -3,7 +3,7 @@ ; 64-bit targets. ; ; RUN: llvm-as < %s | opt -instcombine -disable-output && -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep '= add i32' +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep '= add ' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" target triple = "x86_64-unknown-freebsd6.2" From asl at math.spbu.ru Wed Apr 4 16:15:11 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 4 Apr 2007 16:15:11 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGISel.h Message-ID: <200704042115.l34LFBt1028277@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGISel.h updated: 1.35 -> 1.36 --- Log message: Properly emit range comparisons for switch cases, where neighbour cases go to the same destination. Now we're producing really good code for switch-lower-feature.ll testcase --- Diffs of the changes: (+6 -4) SelectionDAGISel.h | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h diff -u llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.35 llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.36 --- llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.35 Sun Mar 25 10:07:15 2007 +++ llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Apr 4 16:14:49 2007 @@ -82,15 +82,17 @@ /// SDISel for the code generation of additional basic blocks needed by multi- /// case switch statements. struct CaseBlock { - CaseBlock(ISD::CondCode cc, Value *cmplhs, Value *cmprhs, + CaseBlock(ISD::CondCode cc, Value *cmplhs, Value *cmprhs, Value *cmpmiddle, MachineBasicBlock *truebb, MachineBasicBlock *falsebb, MachineBasicBlock *me) - : CC(cc), CmpLHS(cmplhs), CmpRHS(cmprhs), + : CC(cc), CmpLHS(cmplhs), CmpMHS(cmpmiddle), CmpRHS(cmprhs), TrueBB(truebb), FalseBB(falsebb), ThisBB(me) {} // CC - the condition code to use for the case block's setcc node ISD::CondCode CC; - // CmpLHS/CmpRHS - The LHS/RHS of the comparison to emit. - Value *CmpLHS, *CmpRHS; + // CmpLHS/CmpRHS/CmpMHS - The LHS/MHS/RHS of the comparison to emit. + // Emit by default LHS op RHS. MHS is used for range comparisons: + // If MHS is not null: (LHS <= MHS) and (MHS <= RHS). + Value *CmpLHS, *CmpMHS, *CmpRHS; // TrueBB/FalseBB - the block to branch to if the setcc is true/false. MachineBasicBlock *TrueBB, *FalseBB; // ThisBB - the block into which to emit the code for the setcc and branches From asl at math.spbu.ru Wed Apr 4 16:15:13 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 4 Apr 2007 16:15:13 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/BitVector.h Message-ID: <200704042115.l34LFDLG028283@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: BitVector.h updated: 1.18 -> 1.19 --- Log message: Properly emit range comparisons for switch cases, where neighbour cases go to the same destination. Now we're producing really good code for switch-lower-feature.ll testcase --- Diffs of the changes: (+2 -0) BitVector.h | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/include/llvm/ADT/BitVector.h diff -u llvm/include/llvm/ADT/BitVector.h:1.18 llvm/include/llvm/ADT/BitVector.h:1.19 --- llvm/include/llvm/ADT/BitVector.h:1.18 Mon Mar 19 21:10:56 2007 +++ llvm/include/llvm/ADT/BitVector.h Wed Apr 4 16:14:49 2007 @@ -15,6 +15,8 @@ #define LLVM_ADT_BITVECTOR_H #include "llvm/Support/MathExtras.h" +#include +#include namespace llvm { From asl at math.spbu.ru Wed Apr 4 16:15:13 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 4 Apr 2007 16:15:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200704042115.l34LFD5R028288@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.401 -> 1.402 --- Log message: Properly emit range comparisons for switch cases, where neighbour cases go to the same destination. Now we're producing really good code for switch-lower-feature.ll testcase --- Diffs of the changes: (+181 -71) SelectionDAGISel.cpp | 252 ++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 181 insertions(+), 71 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.401 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.402 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.401 Sun Apr 1 02:34:11 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Apr 4 16:14:49 2007 @@ -12,9 +12,11 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "isel" +#include "llvm/ADT/BitVector.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/CodeGen/ScheduleDAG.h" +#include "llvm/Constants.h" #include "llvm/CallingConv.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" @@ -358,11 +360,26 @@ /// analysis. std::vector PendingLoads; - /// Case - A pair of values to record the Value for a switch case, and the - /// case's target basic block. - typedef std::pair Case; - typedef std::vector::iterator CaseItr; - typedef std::pair CaseRange; + /// Case - A struct to record the Value for a switch case, and the + /// case's target basic block. + struct Case { + Constant* Low; + Constant* High; + MachineBasicBlock* BB; + + Case() : Low(0), High(0), BB(0) { } + Case(Constant* low, Constant* high, MachineBasicBlock* bb) : + Low(low), High(high), BB(bb) { } + uint64_t size() const { + uint64_t rHigh = cast(High)->getSExtValue(); + uint64_t rLow = cast(Low)->getSExtValue(); + return (rHigh - rLow + 1ULL); + } + }; + + typedef std::vector CaseVector; + typedef CaseVector::iterator CaseItr; + typedef std::pair CaseRange; /// CaseRec - A struct with ctor used in lowering switches to a binary tree /// of conditional branches. @@ -382,15 +399,21 @@ }; typedef std::vector CaseRecVector; - - /// The comparison function for sorting Case values. + + /// The comparison function for sorting the switch case values in the vector. + /// WARNING: Case ranges should be disjoint! struct CaseCmp { - bool operator () (const Case& C1, const Case& C2) { - assert(isa(C1.first) && isa(C2.first)); - return cast(C1.first)->getSExtValue() < - cast(C2.first)->getSExtValue(); + bool operator () (const Case& C1, + const Case& C2) { + + assert(isa(C1.Low) && isa(C2.High)); + const ConstantInt* CI1 = cast(C1.Low); + const ConstantInt* CI2 = cast(C2.High); + return CI1->getValue().slt(CI2->getValue()); } }; + + unsigned Clusterify(CaseVector& Cases, const SwitchInst &SI); public: // TLI - This is information that describes the available target features we @@ -912,14 +935,14 @@ } SelectionDAGISel::CaseBlock CB(Condition, BOp->getOperand(0), - BOp->getOperand(1), TBB, FBB, CurBB); + BOp->getOperand(1), NULL, TBB, FBB, CurBB); SwitchCases.push_back(CB); return; } // Create a CaseBlock record representing this branch. SelectionDAGISel::CaseBlock CB(ISD::SETEQ, Cond, ConstantInt::getTrue(), - TBB, FBB, CurBB); + NULL, TBB, FBB, CurBB); SwitchCases.push_back(CB); return; } @@ -1058,7 +1081,7 @@ // Create a CaseBlock record representing this branch. SelectionDAGISel::CaseBlock CB(ISD::SETEQ, CondVal, ConstantInt::getTrue(), - Succ0MBB, Succ1MBB, CurMBB); + NULL, Succ0MBB, Succ1MBB, CurMBB); // Use visitSwitchCase to actually insert the fast branch sequence for this // cond branch. visitSwitchCase(CB); @@ -1070,16 +1093,36 @@ SDOperand Cond; SDOperand CondLHS = getValue(CB.CmpLHS); - // Build the setcc now, fold "(X == true)" to X and "(X == false)" to !X to - // handle common cases produced by branch lowering. - if (CB.CmpRHS == ConstantInt::getTrue() && CB.CC == ISD::SETEQ) - Cond = CondLHS; - else if (CB.CmpRHS == ConstantInt::getFalse() && CB.CC == ISD::SETEQ) { - SDOperand True = DAG.getConstant(1, CondLHS.getValueType()); - Cond = DAG.getNode(ISD::XOR, CondLHS.getValueType(), CondLHS, True); - } else - Cond = DAG.getSetCC(MVT::i1, CondLHS, getValue(CB.CmpRHS), CB.CC); + // Build the setcc now. + if (CB.CmpMHS == NULL) { + // Fold "(X == true)" to X and "(X == false)" to !X to + // handle common cases produced by branch lowering. + if (CB.CmpRHS == ConstantInt::getTrue() && CB.CC == ISD::SETEQ) + Cond = CondLHS; + else if (CB.CmpRHS == ConstantInt::getFalse() && CB.CC == ISD::SETEQ) { + SDOperand True = DAG.getConstant(1, CondLHS.getValueType()); + Cond = DAG.getNode(ISD::XOR, CondLHS.getValueType(), CondLHS, True); + } else + Cond = DAG.getSetCC(MVT::i1, CondLHS, getValue(CB.CmpRHS), CB.CC); + } else { + assert(CB.CC == ISD::SETLE && "Can handle only LE ranges now"); + + uint64_t Low = cast(CB.CmpLHS)->getSExtValue(); + uint64_t High = cast(CB.CmpRHS)->getSExtValue(); + + SDOperand CmpOp = getValue(CB.CmpMHS); + MVT::ValueType VT = CmpOp.getValueType(); + if (cast(CB.CmpLHS)->isMinValue(true)) { + Cond = DAG.getSetCC(MVT::i1, CmpOp, DAG.getConstant(High, VT), ISD::SETLE); + } else { + SDOperand SUB = DAG.getNode(ISD::SUB, VT, CmpOp, DAG.getConstant(Low, VT)); + Cond = DAG.getSetCC(MVT::i1, SUB, + DAG.getConstant(High-Low, VT), ISD::SETULE); + } + + } + // Set NextBlock to be the MBB immediately after the current one, if any. // This is used to avoid emitting unnecessary branches to the next block. MachineBasicBlock *NextBlock = 0; @@ -1218,7 +1261,7 @@ void SelectionDAGLowering::visitUnwind(UnwindInst &I) { } -/// handleSmaaSwitchCaseRange - Emit a series of specific tests (suitable for +/// handleSmallSwitchCaseRange - Emit a series of specific tests (suitable for /// small case ranges). bool SelectionDAGLowering::handleSmallSwitchRange(CaseRec& CR, CaseRecVector& WorkList, @@ -1230,7 +1273,7 @@ unsigned Size = CR.Range.second - CR.Range.first; if (Size >=3) return false; - + // Get the MachineFunction which holds the current MBB. This is used when // inserting any additional MBBs necessary to represent the switch. MachineFunction *CurMF = CurMBB->getParent(); @@ -1248,11 +1291,11 @@ // "if (X == 6 || X == 4)" -> "if ((X|2) == 6)" // Rearrange the case blocks so that the last one falls through if possible. - if (NextBlock && Default != NextBlock && BackCase.second != NextBlock) { + if (NextBlock && Default != NextBlock && BackCase.BB != NextBlock) { // The last case block won't fall through into 'NextBlock' if we emit the // branches in this order. See if rearranging a case value would help. for (CaseItr I = CR.Range.first, E = CR.Range.second-1; I != E; ++I) { - if (I->second == NextBlock) { + if (I->BB == NextBlock) { std::swap(*I, BackCase); break; } @@ -1272,9 +1315,19 @@ // If the last case doesn't match, go to the default block. FallThrough = Default; } - - SelectionDAGISel::CaseBlock CB(ISD::SETEQ, SV, I->first, - I->second, FallThrough, CurBlock); + + Value *RHS, *LHS, *MHS; + ISD::CondCode CC; + if (I->High == I->Low) { + // This is just small small case range :) containing exactly 1 case + CC = ISD::SETEQ; + LHS = SV; RHS = I->High; MHS = NULL; + } else { + CC = ISD::SETLE; + LHS = I->Low; MHS = SV; RHS = I->High; + } + SelectionDAGISel::CaseBlock CB(CC, LHS, RHS, MHS, + I->BB, FallThrough, CurBlock); // If emitting the first comparison, just call visitSwitchCase to emit the // code into the current block. Otherwise, push the CaseBlock onto the @@ -1302,18 +1355,27 @@ // Size is the number of Cases represented by this range. unsigned Size = CR.Range.second - CR.Range.first; - uint64_t First = cast(FrontCase.first)->getSExtValue(); - uint64_t Last = cast(BackCase.first)->getSExtValue(); + int64_t First = cast(FrontCase.Low)->getSExtValue(); + int64_t Last = cast(BackCase.High)->getSExtValue(); + + uint64_t TSize = 0; + for (CaseItr I = CR.Range.first, E = CR.Range.second; + I!=E; ++I) + TSize += I->size(); if ((!TLI.isOperationLegal(ISD::BR_JT, MVT::Other) && !TLI.isOperationLegal(ISD::BRIND, MVT::Other)) || Size <= 5) return false; - double Density = (double)Size / (double)((Last - First) + 1ULL); - if (Density < 0.3125) + double Density = (double)TSize / (double)((Last - First) + 1ULL); + if (Density < 0.4) return false; + DOUT << "Lowering jump table\n" + << "First entry: " << First << ". Last entry: " << Last << "\n" + << "Size: " << TSize << ". Density: " << Density << "\n"; + // Get the MachineFunction which holds the current MBB. This is used when // inserting any additional MBBs necessary to represent the switch. MachineFunction *CurMF = CurMBB->getParent(); @@ -1342,19 +1404,21 @@ // the default BB. std::vector DestBBs; int64_t TEI = First; - for (CaseItr I = CR.Range.first, E = CR.Range.second; I != E; ++TEI) - if (cast(I->first)->getSExtValue() == TEI) { - DestBBs.push_back(I->second); - ++I; + for (CaseItr I = CR.Range.first, E = CR.Range.second; I != E; ++TEI) { + int64_t Low = cast(I->Low)->getSExtValue(); + int64_t High = cast(I->High)->getSExtValue(); + + if ((Low <= TEI) && (TEI <= High)) { + DestBBs.push_back(I->BB); + if (TEI==High) + ++I; } else { DestBBs.push_back(Default); } + } // Update successor info. Add one edge to each unique successor. - // Vector bool would be better, but vector is really slow. - std::vector SuccsHandled; - SuccsHandled.resize(CR.CaseBB->getParent()->getNumBlockIDs()); - + BitVector SuccsHandled(CR.CaseBB->getParent()->getNumBlockIDs()); for (std::vector::iterator I = DestBBs.begin(), E = DestBBs.end(); I != E; ++I) { if (!SuccsHandled[(*I)->getNumber()]) { @@ -1404,30 +1468,38 @@ // Size is the number of Cases represented by this range. unsigned Size = CR.Range.second - CR.Range.first; - uint64_t First = cast(FrontCase.first)->getSExtValue(); - uint64_t Last = cast(BackCase.first)->getSExtValue(); + int64_t First = cast(FrontCase.Low)->getSExtValue(); + int64_t Last = cast(BackCase.High)->getSExtValue(); double Density = 0; - CaseItr Pivot; + CaseItr Pivot = CR.Range.first + Size/2; // Select optimal pivot, maximizing sum density of LHS and RHS. This will // (heuristically) allow us to emit JumpTable's later. - unsigned LSize = 1; - unsigned RSize = Size-1; + uint64_t TSize = 0; + for (CaseItr I = CR.Range.first, E = CR.Range.second; + I!=E; ++I) + TSize += I->size(); + + uint64_t LSize = FrontCase.size(); + uint64_t RSize = TSize-LSize; for (CaseItr I = CR.Range.first, J=I+1, E = CR.Range.second; - J!=E; ++I, ++J, ++LSize, --RSize) { - uint64_t LEnd = cast(I->first)->getSExtValue(); - uint64_t RBegin = cast(J->first)->getSExtValue(); + J!=E; ++I, ++J) { + int64_t LEnd = cast(I->High)->getSExtValue(); + int64_t RBegin = cast(J->Low)->getSExtValue(); double LDensity = (double)LSize / (double)((LEnd - First) + 1ULL); double RDensity = (double)RSize / (double)((Last - RBegin) + 1ULL); if (Density < (LDensity + RDensity)) { Pivot = J; Density = LDensity + RDensity; } + + LSize += J->size(); + RSize -= J->size(); } CaseRange LHSR(CR.Range.first, Pivot); CaseRange RHSR(Pivot, CR.Range.second); - Constant *C = Pivot->first; + Constant *C = Pivot->Low; MachineBasicBlock *FalseBB = 0, *TrueBB = 0; // We know that we branch to the LHS if the Value being switched on is @@ -1437,10 +1509,10 @@ // Pivot's Value, then we can branch directly to the LHS's Target, // rather than creating a leaf node for it. if ((LHSR.second - LHSR.first) == 1 && - LHSR.first->first == CR.GE && - cast(C)->getZExtValue() == - (cast(CR.GE)->getZExtValue() + 1ULL)) { - TrueBB = LHSR.first->second; + LHSR.first->High == CR.GE && + cast(C)->getSExtValue() == + (cast(CR.GE)->getSExtValue() + 1LL)) { + TrueBB = LHSR.first->BB; } else { TrueBB = new MachineBasicBlock(LLVMBB); CurMF->getBasicBlockList().insert(BBI, TrueBB); @@ -1452,9 +1524,9 @@ // is CR.LT - 1, then we can branch directly to the target block for // the current Case Value, rather than emitting a RHS leaf node for it. if ((RHSR.second - RHSR.first) == 1 && CR.LT && - cast(RHSR.first->first)->getZExtValue() == - (cast(CR.LT)->getZExtValue() - 1ULL)) { - FalseBB = RHSR.first->second; + cast(RHSR.first->Low)->getSExtValue() == + (cast(CR.LT)->getSExtValue() - 1LL)) { + FalseBB = RHSR.first->BB; } else { FalseBB = new MachineBasicBlock(LLVMBB); CurMF->getBasicBlockList().insert(BBI, FalseBB); @@ -1464,8 +1536,8 @@ // Create a CaseBlock record representing a conditional branch to // the LHS node if the value being switched on SV is less than C. // Otherwise, branch to LHS. - SelectionDAGISel::CaseBlock CB(ISD::SETLT, SV, C, TrueBB, FalseBB, - CR.CaseBB); + SelectionDAGISel::CaseBlock CB(ISD::SETLT, SV, C, NULL, + TrueBB, FalseBB, CR.CaseBB); if (CR.CaseBB == CurMBB) visitSwitchCase(CB); @@ -1475,16 +1547,57 @@ return true; } -void SelectionDAGLowering::visitSwitch(SwitchInst &I) { +// Clusterify - Transform simple list of Cases into list of CaseRange's +unsigned SelectionDAGLowering::Clusterify(CaseVector& Cases, + const SwitchInst& SI) { + unsigned numCmps = 0; + + // Start with "simple" cases + for (unsigned i = 1; i < SI.getNumSuccessors(); ++i) { + MachineBasicBlock *SMBB = FuncInfo.MBBMap[SI.getSuccessor(i)]; + Cases.push_back(Case(SI.getSuccessorValue(i), + SI.getSuccessorValue(i), + SMBB)); + } + sort(Cases.begin(), Cases.end(), CaseCmp()); + + // Merge case into clusters + if (Cases.size()>=2) + for (CaseItr I=Cases.begin(), J=++(Cases.begin()), E=Cases.end(); J!=E; ) { + int64_t nextValue = cast(J->Low)->getSExtValue(); + int64_t currentValue = cast(I->High)->getSExtValue(); + MachineBasicBlock* nextBB = J->BB; + MachineBasicBlock* currentBB = I->BB; + + // If the two neighboring cases go to the same destination, merge them + // into a single case. + if ((nextValue-currentValue==1) && (currentBB == nextBB)) { + I->High = J->High; + J = Cases.erase(J); + } else { + I = J++; + } + } + + for (CaseItr I=Cases.begin(), E=Cases.end(); I!=E; ++I, ++numCmps) { + if (I->Low != I->High) + // A range counts double, since it requires two compares. + ++numCmps; + } + + return numCmps; +} + +void SelectionDAGLowering::visitSwitch(SwitchInst &SI) { // Figure out which block is immediately after the current one. MachineBasicBlock *NextBlock = 0; MachineFunction::iterator BBI = CurMBB; - MachineBasicBlock *Default = FuncInfo.MBBMap[I.getDefaultDest()]; + MachineBasicBlock *Default = FuncInfo.MBBMap[SI.getDefaultDest()]; // If there is only the default destination, branch to it if it is not the // next basic block. Otherwise, just fall through. - if (I.getNumOperands() == 2) { + if (SI.getNumOperands() == 2) { // Update machine-CFG edges. // If this is not a fall-through branch, emit the branch. @@ -1499,18 +1612,15 @@ // If there are any non-default case statements, create a vector of Cases // representing each one, and sort the vector so that we can efficiently // create a binary search tree from them. - std::vector Cases; + CaseVector Cases; + unsigned numCmps = Clusterify(Cases, SI); + DOUT << "Clusterify finished. Total clusters: " << Cases.size() + << ". Total compares: " << numCmps << "\n"; - for (unsigned i = 1; i < I.getNumSuccessors(); ++i) { - MachineBasicBlock *SMBB = FuncInfo.MBBMap[I.getSuccessor(i)]; - Cases.push_back(Case(I.getSuccessorValue(i), SMBB)); - } - std::sort(Cases.begin(), Cases.end(), CaseCmp()); - // Get the Value to be switched on and default basic blocks, which will be // inserted into CaseBlock records, representing basic blocks in the binary // search tree. - Value *SV = I.getOperand(0); + Value *SV = SI.getOperand(0); // Push the initial CaseRec onto the worklist CaseRecVector WorkList; From asl at math.spbu.ru Wed Apr 4 16:15:16 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 4 Apr 2007 16:15:16 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/Generic/switch-lower-feature-2.ll switch-lower-feature.ll Message-ID: <200704042115.l34LFGeU028295@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/Generic: switch-lower-feature-2.ll added (r1.1) switch-lower-feature.ll updated: 1.1 -> 1.2 --- Log message: Properly emit range comparisons for switch cases, where neighbour cases go to the same destination. Now we're producing really good code for switch-lower-feature.ll testcase --- Diffs of the changes: (+51 -4) switch-lower-feature-2.ll | 47 ++++++++++++++++++++++++++++++++++++++++++++++ switch-lower-feature.ll | 8 +++---- 2 files changed, 51 insertions(+), 4 deletions(-) Index: llvm/test/CodeGen/Generic/switch-lower-feature-2.ll diff -c /dev/null llvm/test/CodeGen/Generic/switch-lower-feature-2.ll:1.1 *** /dev/null Wed Apr 4 16:14:59 2007 --- llvm/test/CodeGen/Generic/switch-lower-feature-2.ll Wed Apr 4 16:14:49 2007 *************** *** 0 **** --- 1,47 ---- + ; RUN: llvm-as < %s | llc -march=x86 -o - | grep jb | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=x86 -o - | grep \$6 | wc -l | grep 2 && + ; RUN: llvm-as < %s | llc -march=x86 -o - | grep 1024 | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=x86 -o - | grep 1023 | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=x86 -o - | grep 119 | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=x86 -o - | grep JTI | wc -l | grep 2 && + ; RUN: llvm-as < %s | llc -march=x86 -o - | grep jg | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=x86 -o - | grep ja | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=x86 -o - | grep js | wc -l | grep 1 + + define i32 @main(i32 %tmp158) { + entry: + switch i32 %tmp158, label %bb336 [ + i32 -2147483648, label %bb338 + i32 -2147483647, label %bb338 + i32 -2147483646, label %bb338 + i32 120, label %bb338 + i32 121, label %bb339 + i32 122, label %bb340 + i32 123, label %bb341 + i32 124, label %bb342 + i32 125, label %bb343 + i32 126, label %bb336 + i32 1024, label %bb338 + i32 0, label %bb338 + i32 1, label %bb338 + i32 2, label %bb338 + i32 3, label %bb338 + i32 4, label %bb338 + i32 5, label %bb338 + ] + bb336: + ret i32 10 + bb338: + ret i32 11 + bb339: + ret i32 12 + bb340: + ret i32 13 + bb341: + ret i32 14 + bb342: + ret i32 15 + bb343: + ret i32 18 + + } Index: llvm/test/CodeGen/Generic/switch-lower-feature.ll diff -u llvm/test/CodeGen/Generic/switch-lower-feature.ll:1.1 llvm/test/CodeGen/Generic/switch-lower-feature.ll:1.2 --- llvm/test/CodeGen/Generic/switch-lower-feature.ll:1.1 Sun Mar 25 17:01:14 2007 +++ llvm/test/CodeGen/Generic/switch-lower-feature.ll Wed Apr 4 16:14:49 2007 @@ -1,10 +1,10 @@ -; RUN: llvm-as < %s | llc -march=x86 -o - | grep \$5 | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=x86 -o - | grep \$7 | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=x86 -o - | grep \$6 | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=x86 -o - | grep 1024 | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=x86 -o - | grep 1023 | wc -l | grep 1 && -; RUN: llvm-as < %s | llc -march=x86 -o - | grep 1024 | wc -l | grep 1 && -; RUN: llvm-as < %s | llc -march=x86 -o - | grep jg | wc -l | grep 2 && -; RUN: llvm-as < %s | llc -march=x86 -o - | grep ja | wc -l | grep 2 && +; RUN: llvm-as < %s | llc -march=x86 -o - | grep jg | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=x86 -o - | grep jb | wc -l | grep 1 && +; RUN: llvm-as < %s | llc -march=x86 -o - | grep jae | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=x86 -o - | grep je | wc -l | grep 1 define i32 @main(i32 %tmp158) { From asl at math.spbu.ru Wed Apr 4 16:28:53 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 4 Apr 2007 16:28:53 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/PowerPC/compare-simm.ll Message-ID: <200704042128.l34LSrRH028714@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/PowerPC: compare-simm.ll updated: 1.1 -> 1.2 --- Log message: Fix test --- Diffs of the changes: (+1 -1) compare-simm.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/CodeGen/PowerPC/compare-simm.ll diff -u llvm/test/CodeGen/PowerPC/compare-simm.ll:1.1 llvm/test/CodeGen/PowerPC/compare-simm.ll:1.2 --- llvm/test/CodeGen/PowerPC/compare-simm.ll:1.1 Mon Apr 2 00:57:59 2007 +++ llvm/test/CodeGen/PowerPC/compare-simm.ll Wed Apr 4 16:28:36 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=ppc32 | grep 'cmpwi cr0, r3, -1' +; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep 'cmpwi cr0, r3, -1' define i32 @test(i32 %x) { %c = icmp eq i32 %x, -1 From reid at x10sys.com Wed Apr 4 17:07:41 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 17:07:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCFrameInfo.h Message-ID: <200704042207.l34M7fiZ029470@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCFrameInfo.h updated: 1.14 -> 1.15 --- Log message: Squelch a warning about mismatch between sign of constant and sign of return type. --- Diffs of the changes: (+1 -1) PPCFrameInfo.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCFrameInfo.h diff -u llvm/lib/Target/PowerPC/PPCFrameInfo.h:1.14 llvm/lib/Target/PowerPC/PPCFrameInfo.h:1.15 --- llvm/lib/Target/PowerPC/PPCFrameInfo.h:1.14 Tue Apr 3 07:35:28 2007 +++ llvm/lib/Target/PowerPC/PPCFrameInfo.h Wed Apr 4 17:07:24 2007 @@ -48,7 +48,7 @@ // For ELF 32 ABI: // Save it right before the link register - return -4; + return -4U; } /// getLinkageSize - Return the size of the PowerPC ABI linkage area. From jeffc at jolt-lang.org Wed Apr 4 17:08:04 2007 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 4 Apr 2007 17:08:04 -0500 Subject: [llvm-commits] CVS: llvm/test/CFrontend/extern-weak.c Message-ID: <200704042208.l34M84pB029498@zion.cs.uiuc.edu> Changes in directory llvm/test/CFrontend: extern-weak.c updated: 1.3 -> 1.4 --- Log message: Fix some FreeBSD/amd64 regressions. --- Diffs of the changes: (+1 -1) extern-weak.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/CFrontend/extern-weak.c diff -u llvm/test/CFrontend/extern-weak.c:1.3 llvm/test/CFrontend/extern-weak.c:1.4 --- llvm/test/CFrontend/extern-weak.c:1.3 Sun Dec 3 10:40:08 2006 +++ llvm/test/CFrontend/extern-weak.c Wed Apr 4 17:07:44 2007 @@ -1,7 +1,7 @@ // RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep extern_weak && // RUN: %llvmgcc -O3 -S -o - -emit-llvm | llvm-as | llc -#ifndef __linux__ +#if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) void foo() __attribute__((weak_import)); #else void foo() __attribute__((weak)); From jeffc at jolt-lang.org Wed Apr 4 17:08:04 2007 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 4 Apr 2007 17:08:04 -0500 Subject: [llvm-commits] CVS: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp Message-ID: <200704042208.l34M84ZH029503@zion.cs.uiuc.edu> Changes in directory llvm/test/DebugInfo: 2006-11-06-StackTrace.cpp updated: 1.9 -> 1.10 --- Log message: Fix some FreeBSD/amd64 regressions. --- Diffs of the changes: (+1 -1) 2006-11-06-StackTrace.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/DebugInfo/2006-11-06-StackTrace.cpp diff -u llvm/test/DebugInfo/2006-11-06-StackTrace.cpp:1.9 llvm/test/DebugInfo/2006-11-06-StackTrace.cpp:1.10 --- llvm/test/DebugInfo/2006-11-06-StackTrace.cpp:1.9 Sat Nov 11 16:14:46 2006 +++ llvm/test/DebugInfo/2006-11-06-StackTrace.cpp Wed Apr 4 17:07:44 2007 @@ -6,7 +6,7 @@ // RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) > Output/StackTrace.gdbin // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | tee Output/StackTrace.out | grep '#0 DeepStack::deepest.*(this=.*,.*x=33)' // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | grep '#7 0x.* in main.*(argc=[12],.*argv=.*)' -// XFAIL: i[1-9]86|alpha|ia64|arm +// XFAIL: i[1-9]86|alpha|ia64|arm|x86_64 #include From lauro.venancio at gmail.com Wed Apr 4 17:13:56 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Wed, 4 Apr 2007 17:13:56 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/BitVector.h Message-ID: <200704042213.l34MDuEh029612@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: BitVector.h updated: 1.19 -> 1.20 --- Log message: Fix release build. --- Diffs of the changes: (+1 -0) BitVector.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/ADT/BitVector.h diff -u llvm/include/llvm/ADT/BitVector.h:1.19 llvm/include/llvm/ADT/BitVector.h:1.20 --- llvm/include/llvm/ADT/BitVector.h:1.19 Wed Apr 4 16:14:49 2007 +++ llvm/include/llvm/ADT/BitVector.h Wed Apr 4 17:13:39 2007 @@ -17,6 +17,7 @@ #include "llvm/Support/MathExtras.h" #include #include +#include namespace llvm { From reid at x10sys.com Wed Apr 4 17:47:55 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 17:47:55 -0500 Subject: [llvm-commits] CVS: llvm/test/BugPoint/.cvsignore Message-ID: <200704042247.l34Mltgq030380@zion.cs.uiuc.edu> Changes in directory llvm/test/BugPoint: .cvsignore updated: 1.1 -> 1.2 --- Log message: Ignore some things generated by bugpoint. --- Diffs of the changes: (+1 -0) .cvsignore | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/BugPoint/.cvsignore diff -u llvm/test/BugPoint/.cvsignore:1.1 llvm/test/BugPoint/.cvsignore:1.2 --- llvm/test/BugPoint/.cvsignore:1.1 Thu Mar 23 17:41:54 2006 +++ llvm/test/BugPoint/.cvsignore Wed Apr 4 17:47:38 2007 @@ -2,3 +2,4 @@ *.log *.sum *.bc +*.bc.cbe.c From reid at x10sys.com Wed Apr 4 18:01:32 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 18:01:32 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704042301.l34N1Wu7030752@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.44 -> 1.45 --- Log message: Add Julien Lerouge. --- Diffs of the changes: (+6 -5) DevMtgMay2007.html | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.44 llvm-www/DevMtgMay2007.html:1.45 --- llvm-www/DevMtgMay2007.html:1.44 Tue Apr 3 23:15:45 2007 +++ llvm-www/DevMtgMay2007.html Wed Apr 4 18:01:15 2007 @@ -229,7 +229,7 @@ - + @@ -244,13 +244,14 @@ -
    Confirmed Attendees (A-L)
    Confirmed Attendees (A-Len)
    NameOrganization
    Vikram AdveUIUC
    Bob ArcherAdobe Systems Incorporated.
    Christopher LambAgeia Technologies, Inc.
    Chris LattnerApple, Inc.
    Andrew LenharthUIUC
    Nick LewyckyIndependent
    - + + + @@ -267,7 +268,7 @@
    Confirmed Attendees (M-Z)
    Confirmed Attendees (Ler-Z)
    NameOrganization
    Julien LerougeApple, Inc.
    Nick LewyckyIndependent
    Gabe McArthurIndependent
    Paul McJonesAdobe Systems Incorporated.
    Scott MichelAerospace
    -

    Total confirmed: 26

    +

    Total confirmed: 27

    @@ -285,6 +286,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!">Valid HTML 4.01! -
    Last modified: $Date: 2007/04/04 04:15:45 $ +
    Last modified: $Date: 2007/04/04 23:01:15 $ From reid at x10sys.com Wed Apr 4 18:48:49 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 18:48:49 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Intrinsics.td Message-ID: <200704042348.l34NmnEH031670@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Intrinsics.td updated: 1.52 -> 1.53 --- Log message: Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. --- Diffs of the changes: (+3 -1) Intrinsics.td | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Intrinsics.td diff -u llvm/include/llvm/Intrinsics.td:1.52 llvm/include/llvm/Intrinsics.td:1.53 --- llvm/include/llvm/Intrinsics.td:1.52 Sun Apr 1 02:30:57 2007 +++ llvm/include/llvm/Intrinsics.td Wed Apr 4 18:48:25 2007 @@ -203,11 +203,13 @@ // None of these intrinsics accesses memory at all. let Properties = [IntrNoMem] in { + def int_bit_part_select : + Intrinsic<[llvm_int_ty, llvm_int_ty, llvm_i32_ty, llvm_i32_ty]>; def int_bswap: Intrinsic<[llvm_int_ty, llvm_int_ty]>; def int_ctpop: Intrinsic<[llvm_i32_ty, llvm_int_ty]>; def int_ctlz : Intrinsic<[llvm_i32_ty, llvm_int_ty]>; def int_cttz : Intrinsic<[llvm_i32_ty, llvm_int_ty]>; -} +} //===------------------------ Debugger Intrinsics -------------------------===// // From reid at x10sys.com Wed Apr 4 18:48:53 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 18:48:53 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/Generic/bit-intrinsics.ll Message-ID: <200704042348.l34NmrUf031677@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/Generic: bit-intrinsics.ll added (r1.1) --- Log message: Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. --- Diffs of the changes: (+14 -0) bit-intrinsics.ll | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm/test/CodeGen/Generic/bit-intrinsics.ll diff -c /dev/null llvm/test/CodeGen/Generic/bit-intrinsics.ll:1.1 *** /dev/null Wed Apr 4 18:48:35 2007 --- llvm/test/CodeGen/Generic/bit-intrinsics.ll Wed Apr 4 18:48:25 2007 *************** *** 0 **** --- 1,14 ---- + ; Make sure this testcase is supported by all code generators. Either the + ; intrinsic is supported natively or IntrinsicLowering provides it. + ; RUN: llvm-as < %s | llc + + + declare i32 @llvm.bit.part.select.i32.i32(i32 %x, i32 %hi, i32 %lo) + declare i16 @llvm.bit.part.select.i16.i16(i16 %x, i32 %hi, i32 %lo) + define i32 @bit_part_select(i32 %A, i16 %B) { + %a = call i32 @llvm.bit.part.select.i32.i32(i32 %A, i32 8, i32 0) + %b = call i16 @llvm.bit.part.select.i16.i16(i16 %B, i32 8, i32 0) + %c = zext i16 %b to i32 + %d = add i32 %a, %c + ret i32 %d + } From reid at x10sys.com Wed Apr 4 18:48:55 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 18:48:55 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200704042348.l34Nmt8s031682@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.402 -> 1.403 --- Log message: Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. --- Diffs of the changes: (+5 -0) SelectionDAGISel.cpp | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.402 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.403 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.402 Wed Apr 4 16:14:49 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Apr 4 18:48:25 2007 @@ -2438,6 +2438,11 @@ DAG.setRoot(Tmp.getValue(1)); return 0; } + case Intrinsic::bit_part_select: { + MVT::ValueType Ty = getValue(I.getOperand(1)).getValueType(); + setValue(&I, DAG.getTargetConstant(0, Ty)); + return 0; + } case Intrinsic::bswap: setValue(&I, DAG.getNode(ISD::BSWAP, getValue(I.getOperand(1)).getValueType(), From reid at x10sys.com Wed Apr 4 18:48:56 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 18:48:56 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200704042348.l34Nmu9j031685@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.198 -> 1.199 --- Log message: Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. --- Diffs of the changes: (+2 -0) Verifier.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.198 llvm/lib/VMCore/Verifier.cpp:1.199 --- llvm/lib/VMCore/Verifier.cpp:1.198 Sun Apr 1 02:22:57 2007 +++ llvm/lib/VMCore/Verifier.cpp Wed Apr 4 18:48:25 2007 @@ -1027,6 +1027,8 @@ case Intrinsic::bswap: if (GotBits < 16 || GotBits % 16 != 0) CheckFailed("Intrinsic requires even byte width argument", F); + /* FALL THROUGH */ + case Intrinsic::bit_part_select: if (ArgNo == 1) { unsigned ResultBits = cast(FTy->getReturnType())->getBitWidth(); From reid at x10sys.com Wed Apr 4 18:48:56 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 18:48:56 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp Message-ID: <200704042348.l34Nmudh031692@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.74 -> 1.75 --- Log message: Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. --- Diffs of the changes: (+175 -0) IntrinsicLowering.cpp | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 175 insertions(+) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.74 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.75 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.74 Sun Apr 1 20:01:49 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Wed Apr 4 18:48:25 2007 @@ -236,6 +236,177 @@ return LowerCTPOP(V, IP); } +/// Convert the llvm.bit.part_select.iX.iY.iZ intrinsic. This intrinsic takes +/// three integer operands of arbitrary bit width. The first operand is the +/// value from which to select the bits. The second and third operands define a +/// range of bits to select. The result is the bits selected and has a +/// corresponding width of Left-Right (second operand - third operand). +/// @see IEEE 1666-2005, System C, Section 7.2.6, pg 175. +/// @brief Lowering of llvm.bit.part_select intrinsic. +static Instruction *LowerBitPartSelect(CallInst *CI) { + // Make sure we're dealing with a part select intrinsic here + Function *F = CI->getCalledFunction(); + const FunctionType *FT = F->getFunctionType(); + if (!F->isDeclaration() || !FT->getReturnType()->isInteger() || + FT->getNumParams() != 3 || !FT->getParamType(0)->isInteger() || + !FT->getParamType(1)->isInteger() || !FT->getParamType(2)->isInteger()) + return CI; + + // Get the intrinsic implementation function by converting all the . to _ + // in the intrinsic's function name and then reconstructing the function + // declaration. + std::string Name(F->getName()); + for (unsigned i = 4; i < Name.length(); ++i) + if (Name[i] == '.') + Name[i] = '_'; + Module* M = F->getParent(); + F = cast(M->getOrInsertFunction(Name, FT)); + F->setLinkage(GlobalValue::InternalLinkage); + + // If we haven't defined the impl function yet, do so now + if (F->isDeclaration()) { + + // Get the arguments to the function + Value* Val = F->getOperand(0); + Value* Left = F->getOperand(1); + Value* Right = F->getOperand(2); + + // We want to select a range of bits here such that [Left, Right] is shifted + // down to the low bits. However, it is quite possible that Left is smaller + // than Right in which case the bits have to be reversed. + + // Create the blocks we will need for the two cases (forward, reverse) + BasicBlock* CurBB = new BasicBlock("entry", F); + BasicBlock *RevSize = new BasicBlock("revsize", CurBB->getParent()); + BasicBlock *FwdSize = new BasicBlock("fwdsize", CurBB->getParent()); + BasicBlock *Compute = new BasicBlock("compute", CurBB->getParent()); + BasicBlock *Reverse = new BasicBlock("reverse", CurBB->getParent()); + BasicBlock *RsltBlk = new BasicBlock("result", CurBB->getParent()); + + // Cast Left and Right to the size of Val so the widths are all the same + if (Left->getType() != Val->getType()) + Left = CastInst::createIntegerCast(Left, Val->getType(), false, + "tmp", CurBB); + if (Right->getType() != Val->getType()) + Right = CastInst::createIntegerCast(Right, Val->getType(), false, + "tmp", CurBB); + + // Compute a few things that both cases will need, up front. + Constant* Zero = ConstantInt::get(Val->getType(), 0); + Constant* One = ConstantInt::get(Val->getType(), 1); + Constant* AllOnes = ConstantInt::getAllOnesValue(Val->getType()); + + // Compare the Left and Right bit positions. This is used to determine + // which case we have (forward or reverse) + ICmpInst *Cmp = new ICmpInst(ICmpInst::ICMP_ULT, Left, Right, "less",CurBB); + new BranchInst(RevSize, FwdSize, Cmp, CurBB); + + // First, copmute the number of bits in the forward case. + Instruction* FBitSize = + BinaryOperator::createSub(Left, Right,"fbits", FwdSize); + new BranchInst(Compute, FwdSize); + + // Second, compute the number of bits in the reverse case. + Instruction* RBitSize = + BinaryOperator::createSub(Right, Left, "rbits", RevSize); + new BranchInst(Compute, RevSize); + + // Now, compute the bit range. Start by getting the bitsize and the shift + // amount (either Left or Right) from PHI nodes. Then we compute a mask for + // the number of bits we want in the range. We shift the bits down to the + // least significant bits, apply the mask to zero out unwanted high bits, + // and we have computed the "forward" result. It may still need to be + // reversed. + + // Get the BitSize from one of the two subtractions + PHINode *BitSize = new PHINode(Val->getType(), "bits", Compute); + BitSize->reserveOperandSpace(2); + BitSize->addIncoming(FBitSize, FwdSize); + BitSize->addIncoming(RBitSize, RevSize); + + // Get the ShiftAmount as the smaller of Left/Right + PHINode *ShiftAmt = new PHINode(Val->getType(), "shiftamt", Compute); + ShiftAmt->reserveOperandSpace(2); + ShiftAmt->addIncoming(Right, FwdSize); + ShiftAmt->addIncoming(Left, RevSize); + + // Increment the bit size + Instruction *BitSizePlusOne = + BinaryOperator::createAdd(BitSize, One, "bits", Compute); + + // Create a Mask to zero out the high order bits. + Instruction* Mask = + BinaryOperator::createShl(AllOnes, BitSizePlusOne, "mask", Compute); + Mask = BinaryOperator::createNot(Mask, "mask", Compute); + + // Shift the bits down and apply the mask + Instruction* FRes = + BinaryOperator::createLShr(Val, ShiftAmt, "fres", Compute); + FRes = BinaryOperator::createAnd(FRes, Mask, "fres", Compute); + new BranchInst(Reverse, RsltBlk, Cmp, Compute); + + // In the Reverse block we have the mask already in FRes but we must reverse + // it by shifting FRes bits right and putting them in RRes by shifting them + // in from left. + + // First set up our loop counters + PHINode *Count = new PHINode(Val->getType(), "count", Reverse); + Count->reserveOperandSpace(2); + Count->addIncoming(BitSizePlusOne, Compute); + + // Next, get the value that we are shifting. + PHINode *BitsToShift = new PHINode(Val->getType(), "val", Reverse); + BitsToShift->reserveOperandSpace(2); + BitsToShift->addIncoming(FRes, Compute); + + // Finally, get the result of the last computation + PHINode *RRes = new PHINode(Val->getType(), "rres", Reverse); + RRes->reserveOperandSpace(2); + RRes->addIncoming(Zero, Compute); + + // Decrement the counter + Instruction *Decr = BinaryOperator::createSub(Count, One, "decr", Reverse); + Count->addIncoming(Decr, Reverse); + + // Compute the Bit that we want to move + Instruction *Bit = + BinaryOperator::createAnd(BitsToShift, One, "bit", Reverse); + + // Compute the new value for next iteration. + Instruction *NewVal = + BinaryOperator::createLShr(BitsToShift, One, "rshift", Reverse); + BitsToShift->addIncoming(NewVal, Reverse); + + // Shift the bit into the low bits of the result. + Instruction *NewRes = + BinaryOperator::createShl(RRes, One, "lshift", Reverse); + NewRes = BinaryOperator::createOr(NewRes, Bit, "addbit", Reverse); + RRes->addIncoming(NewRes, Reverse); + + // Terminate loop if we've moved all the bits. + ICmpInst *Cond = + new ICmpInst(ICmpInst::ICMP_EQ, Decr, Zero, "cond", Reverse); + new BranchInst(RsltBlk, Reverse, Cond, Reverse); + + // Finally, in the result block, select one of the two results with a PHI + // node and return the result; + CurBB = RsltBlk; + PHINode *BitSelect = new PHINode(Val->getType(), "part_select", CurBB); + BitSelect->reserveOperandSpace(2); + BitSelect->addIncoming(FRes, Compute); + BitSelect->addIncoming(NewRes, Reverse); + new ReturnInst(BitSelect, CurBB); + } + + // Return a call to the implementation function + Value *Args[3]; + Args[0] = CI->getOperand(0); + Args[1] = CI->getOperand(1); + Args[2] = CI->getOperand(2); + return new CallInst(F, Args, 3, CI->getName(), CI); +} + + void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { Function *Callee = CI->getCalledFunction(); assert(Callee && "Cannot lower an indirect call!"); @@ -304,6 +475,10 @@ break; } + case Intrinsic::bit_part_select: + CI->replaceAllUsesWith(LowerBitPartSelect(CI)); + break; + case Intrinsic::stacksave: case Intrinsic::stackrestore: { static bool Warned = false; From clattner at apple.com Wed Apr 4 19:37:55 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 4 Apr 2007 17:37:55 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp In-Reply-To: <200704042348.l34Nmt8s031682@zion.cs.uiuc.edu> References: <200704042348.l34Nmt8s031682@zion.cs.uiuc.edu> Message-ID: <96B9473E-8ABD-45FD-9D5A-29D2003F79A1@apple.com> > Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. Urr? This is obviously incorrect. I'd much rather have the code generator assert and die on an unsupported intrinsic than to miscompile it silently. -Chris > > --- > Diffs of the changes: (+5 -0) > > SelectionDAGISel.cpp | 5 +++++ > 1 files changed, 5 insertions(+) > > > Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.402 > llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.403 > --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.402 Wed > Apr 4 16:14:49 2007 > +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Apr 4 > 18:48:25 2007 > @@ -2438,6 +2438,11 @@ > DAG.setRoot(Tmp.getValue(1)); > return 0; > } > + case Intrinsic::bit_part_select: { > + MVT::ValueType Ty = getValue(I.getOperand(1)).getValueType(); > + setValue(&I, DAG.getTargetConstant(0, Ty)); > + return 0; > + } > case Intrinsic::bswap: > setValue(&I, DAG.getNode(ISD::BSWAP, > getValue(I.getOperand(1)).getValueType > (), > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Apr 4 19:38:31 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 4 Apr 2007 17:38:31 -0700 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp In-Reply-To: <200704042348.l34Nmu9j031685@zion.cs.uiuc.edu> References: <200704042348.l34Nmu9j031685@zion.cs.uiuc.edu> Message-ID: <4748F0CB-D4B4-48F9-8642-F63F024C5BBF@apple.com> > Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. Should this check that the third type is smaller than the other two? -Chris > > --- > Diffs of the changes: (+2 -0) > > Verifier.cpp | 2 ++ > 1 files changed, 2 insertions(+) > > > Index: llvm/lib/VMCore/Verifier.cpp > diff -u llvm/lib/VMCore/Verifier.cpp:1.198 llvm/lib/VMCore/ > Verifier.cpp:1.199 > --- llvm/lib/VMCore/Verifier.cpp:1.198 Sun Apr 1 02:22:57 2007 > +++ llvm/lib/VMCore/Verifier.cpp Wed Apr 4 18:48:25 2007 > @@ -1027,6 +1027,8 @@ > case Intrinsic::bswap: > if (GotBits < 16 || GotBits % 16 != 0) > CheckFailed("Intrinsic requires even byte width > argument", F); > + /* FALL THROUGH */ > + case Intrinsic::bit_part_select: > if (ArgNo == 1) { > unsigned ResultBits = > cast(FTy->getReturnType())->getBitWidth(); > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From reid at x10sys.com Wed Apr 4 19:54:05 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 04 Apr 2007 17:54:05 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp In-Reply-To: <96B9473E-8ABD-45FD-9D5A-29D2003F79A1@apple.com> References: <200704042348.l34Nmt8s031682@zion.cs.uiuc.edu> <96B9473E-8ABD-45FD-9D5A-29D2003F79A1@apple.com> Message-ID: <1175734445.9947.171.camel@bashful.x10sys.com> On Wed, 2007-04-04 at 17:37 -0700, Chris Lattner wrote: > > Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. > > Urr? This is obviously incorrect. I'd much rather have the code > generator assert and die on an unsupported intrinsic than to > miscompile it silently. Okay, but you DID approve this in the plan. > > -Chris > > > > > --- > > Diffs of the changes: (+5 -0) > > > > SelectionDAGISel.cpp | 5 +++++ > > 1 files changed, 5 insertions(+) > > > > > > Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > > diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.402 > > llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.403 > > --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.402 Wed > > Apr 4 16:14:49 2007 > > +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Apr 4 > > 18:48:25 2007 > > @@ -2438,6 +2438,11 @@ > > DAG.setRoot(Tmp.getValue(1)); > > return 0; > > } > > + case Intrinsic::bit_part_select: { > > + MVT::ValueType Ty = getValue(I.getOperand(1)).getValueType(); > > + setValue(&I, DAG.getTargetConstant(0, Ty)); > > + return 0; > > + } > > case Intrinsic::bswap: > > setValue(&I, DAG.getNode(ISD::BSWAP, > > getValue(I.getOperand(1)).getValueType > > (), > > > > > > > > _______________________________________________ > > llvm-commits mailing list > > llvm-commits at cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070404/47dd4646/attachment.bin From reid at x10sys.com Wed Apr 4 19:57:28 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 04 Apr 2007 17:57:28 -0700 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp In-Reply-To: <4748F0CB-D4B4-48F9-8642-F63F024C5BBF@apple.com> References: <200704042348.l34Nmu9j031685@zion.cs.uiuc.edu> <4748F0CB-D4B4-48F9-8642-F63F024C5BBF@apple.com> Message-ID: <1175734648.9947.174.camel@bashful.x10sys.com> On Wed, 2007-04-04 at 17:38 -0700, Chris Lattner wrote: > > Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. > > Should this check that the third type is smaller than the other two? No, because that commit comment is in error. I was thinking of the prototype for part_set (which I deleted from the implementation just before commit). The prototype is actually like this: declare i17 @llvm.bit.part_select.i17.i17 (i17 %val, i32 %loBit, i32 % hiBit) which only has two variable parts: result, 1st arg. And those two must be the same width which is what this patch does. The other parameters are i32. Reid. > > -Chris > > > > > --- > > Diffs of the changes: (+2 -0) > > > > Verifier.cpp | 2 ++ > > 1 files changed, 2 insertions(+) > > > > > > Index: llvm/lib/VMCore/Verifier.cpp > > diff -u llvm/lib/VMCore/Verifier.cpp:1.198 llvm/lib/VMCore/ > > Verifier.cpp:1.199 > > --- llvm/lib/VMCore/Verifier.cpp:1.198 Sun Apr 1 02:22:57 2007 > > +++ llvm/lib/VMCore/Verifier.cpp Wed Apr 4 18:48:25 2007 > > @@ -1027,6 +1027,8 @@ > > case Intrinsic::bswap: > > if (GotBits < 16 || GotBits % 16 != 0) > > CheckFailed("Intrinsic requires even byte width > > argument", F); > > + /* FALL THROUGH */ > > + case Intrinsic::bit_part_select: > > if (ArgNo == 1) { > > unsigned ResultBits = > > cast(FTy->getReturnType())->getBitWidth(); > > > > > > > > _______________________________________________ > > llvm-commits mailing list > > llvm-commits at cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070404/4c9dacb6/attachment.bin From sabre at nondot.org Wed Apr 4 19:58:30 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 4 Apr 2007 19:58:30 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704050058.l350wUFX000392@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.45 -> 1.46 --- Log message: minor edits to appease marketing --- Diffs of the changes: (+3 -3) DevMtgMay2007.html | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.45 llvm-www/DevMtgMay2007.html:1.46 --- llvm-www/DevMtgMay2007.html:1.45 Wed Apr 4 18:01:15 2007 +++ llvm-www/DevMtgMay2007.html Wed Apr 4 19:58:13 2007 @@ -123,7 +123,7 @@
    Unconfirmed Attendees
    NameOrganization
    - + -
    SpeakerTopic
    Chris Lattner, Apple, Inc.Using LLVM to improve the Apple OpenGL implementationUsing LLVM to improve OpenGL
    Sarah Thompson, NASA, Ames Research Center Using LLVM to support model checking, symbolic execution and static @@ -215,7 +215,7 @@
    -

    Lunch: Lunch will be catered by Apple. Thank you, Apple!

    +

    Lunch: Lunch will be catered!

    Dinner: Dinner is optional. We'll go to a local restaurant (TBD) after the meeting. We'll be "going Dutch" for this so you'll need to buy your own meal. We'll pick the restaurant the day of the meeting.

    @@ -286,6 +286,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/04/04 23:01:15 $ +
    Last modified: $Date: 2007/04/05 00:58:13 $ From clattner at apple.com Wed Apr 4 20:06:28 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 4 Apr 2007 18:06:28 -0700 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp In-Reply-To: <1175734648.9947.174.camel@bashful.x10sys.com> References: <200704042348.l34Nmu9j031685@zion.cs.uiuc.edu> <4748F0CB-D4B4-48F9-8642-F63F024C5BBF@apple.com> <1175734648.9947.174.camel@bashful.x10sys.com> Message-ID: <81394F88-A67F-46EA-8570-059337822930@apple.com> On Apr 4, 2007, at 5:57 PM, Reid Spencer wrote: > On Wed, 2007-04-04 at 17:38 -0700, Chris Lattner wrote: >>> Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. >> >> Should this check that the third type is smaller than the other two? > > No, because that commit comment is in error. I was thinking of the > prototype for part_set (which I deleted from the implementation just > before commit). The prototype is actually like this: > > declare i17 @llvm.bit.part_select.i17.i17 (i17 %val, i32 %loBit, i32 % > hiBit) > > which only has two variable parts: result, 1st arg. And those two must > be the same width which is what this patch does. The other parameters > are i32. Gotcha, ok. -Chris From clattner at apple.com Wed Apr 4 20:06:53 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 4 Apr 2007 18:06:53 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp In-Reply-To: <1175734445.9947.171.camel@bashful.x10sys.com> References: <200704042348.l34Nmt8s031682@zion.cs.uiuc.edu> <96B9473E-8ABD-45FD-9D5A-29D2003F79A1@apple.com> <1175734445.9947.171.camel@bashful.x10sys.com> Message-ID: <9E6EF421-AA32-463A-87C2-351EB36D7925@apple.com> On Apr 4, 2007, at 5:54 PM, Reid Spencer wrote: > On Wed, 2007-04-04 at 17:37 -0700, Chris Lattner wrote: >>> Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. >> >> Urr? This is obviously incorrect. I'd much rather have the code >> generator assert and die on an unsupported intrinsic than to >> miscompile it silently. > > Okay, but you DID approve this in the plan. I did not approve silently miscompiling the code. I'm fine with it aborting if you don't want to implement the lowering code. -Chris From reid at x10sys.com Wed Apr 4 20:17:12 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 04 Apr 2007 18:17:12 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp In-Reply-To: <9E6EF421-AA32-463A-87C2-351EB36D7925@apple.com> References: <200704042348.l34Nmt8s031682@zion.cs.uiuc.edu> <96B9473E-8ABD-45FD-9D5A-29D2003F79A1@apple.com> <1175734445.9947.171.camel@bashful.x10sys.com> <9E6EF421-AA32-463A-87C2-351EB36D7925@apple.com> Message-ID: <1175735832.9947.180.camel@bashful.x10sys.com> On Wed, 2007-04-04 at 18:06 -0700, Chris Lattner wrote: > On Apr 4, 2007, at 5:54 PM, Reid Spencer wrote: > > > On Wed, 2007-04-04 at 17:37 -0700, Chris Lattner wrote: > >>> Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic. > >> > >> Urr? This is obviously incorrect. I'd much rather have the code > >> generator assert and die on an unsupported intrinsic than to > >> miscompile it silently. > > > > Okay, but you DID approve this in the plan. > > I did not approve silently miscompiling the code. You most certainly did. You agreed with the plan and it stated: I will *not* write lowering code for part_select in the SDISel because no known target can do anything with it and it expands to an entire function. If, at some point, it needs to be implemented on the "normal" targets, we can do so at that time. *****To avoid having SDISel assert out, I will have this intrinsic simply generate a 0 for now.***** This is mostly a time saving thing for right now. I will probably revisit after AutoESL's Phase 3 is over so we don't leave a rare but bad code gen bug in LLVM. > > I'm fine with it aborting if you don't want to implement the lowering > code. As you'd rather have an abort, I'll change it. > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070404/550a7623/attachment.bin From reid at x10sys.com Wed Apr 4 20:20:35 2007 From: reid at x10sys.com (Reid Spencer) Date: Wed, 4 Apr 2007 20:20:35 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200704050120.l351KZ2s000859@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.403 -> 1.404 --- Log message: Change the bit_part_select (non)implementation from "return 0" to abort. --- Diffs of the changes: (+5 -3) SelectionDAGISel.cpp | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.403 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.404 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.403 Wed Apr 4 18:48:25 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Apr 4 20:20:18 2007 @@ -2439,9 +2439,11 @@ return 0; } case Intrinsic::bit_part_select: { - MVT::ValueType Ty = getValue(I.getOperand(1)).getValueType(); - setValue(&I, DAG.getTargetConstant(0, Ty)); - return 0; + // MVT::ValueType Ty = getValue(I.getOperand(1)).getValueType(); + // setValue(&I, DAG.getTargetConstant(0, Ty)); + // Currently not implemented: just abort + assert(0 && "bit_part_select intrinsic not implemented"); + abort(); } case Intrinsic::bswap: setValue(&I, DAG.getNode(ISD::BSWAP, From clattner at apple.com Wed Apr 4 20:26:21 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 4 Apr 2007 18:26:21 -0700 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp In-Reply-To: <1175735832.9947.180.camel@bashful.x10sys.com> References: <200704042348.l34Nmt8s031682@zion.cs.uiuc.edu> <96B9473E-8ABD-45FD-9D5A-29D2003F79A1@apple.com> <1175734445.9947.171.camel@bashful.x10sys.com> <9E6EF421-AA32-463A-87C2-351EB36D7925@apple.com> <1175735832.9947.180.camel@bashful.x10sys.com> Message-ID: On Apr 4, 2007, at 6:17 PM, Reid Spencer wrote: >> >> I'm fine with it aborting if you don't want to implement the lowering >> code. > > As you'd rather have an abort, I'll change it. > Thank you, -Chris From sabre at nondot.org Wed Apr 4 20:27:19 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 4 Apr 2007 20:27:19 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/SimplifyCFG.cpp Message-ID: <200704050127.l351RJ7Z001028@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: SimplifyCFG.cpp updated: 1.20 -> 1.21 --- Log message: Use a worklist-driven algorithm instead of a recursive one. --- Diffs of the changes: (+36 -27) SimplifyCFG.cpp | 63 ++++++++++++++++++++++++++++++++------------------------ 1 files changed, 36 insertions(+), 27 deletions(-) Index: llvm/lib/Transforms/Scalar/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Scalar/SimplifyCFG.cpp:1.20 llvm/lib/Transforms/Scalar/SimplifyCFG.cpp:1.21 --- llvm/lib/Transforms/Scalar/SimplifyCFG.cpp:1.20 Sat Mar 3 22:20:48 2007 +++ llvm/lib/Transforms/Scalar/SimplifyCFG.cpp Wed Apr 4 20:27:02 2007 @@ -47,36 +47,45 @@ static bool MarkAliveBlocks(BasicBlock *BB, SmallPtrSet &Reachable) { - if (!Reachable.insert(BB)) return false; - - // Do a quick scan of the basic block, turning any obviously unreachable - // instructions into LLVM unreachable insts. The instruction combining pass - // canonnicalizes unreachable insts into stores to null or undef. - for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ++BBI) - if (StoreInst *SI = dyn_cast(BBI)) - if (isa(SI->getOperand(1)) || - isa(SI->getOperand(1))) { - // Loop over all of the successors, removing BB's entry from any PHI - // nodes. - for (succ_iterator I = succ_begin(BB), SE = succ_end(BB); I != SE; ++I) - (*I)->removePredecessor(BB); - - new UnreachableInst(SI); - - // All instructions after this are dead. - for (; BBI != E; ) { - if (!BBI->use_empty()) - BBI->replaceAllUsesWith(UndefValue::get(BBI->getType())); - BB->getInstList().erase(BBI++); + + std::vector Worklist; + Worklist.push_back(BB); + bool Changed = false; + while (!Worklist.empty()) { + BB = Worklist.back(); + Worklist.pop_back(); + + if (!Reachable.insert(BB)) + continue; + + // Do a quick scan of the basic block, turning any obviously unreachable + // instructions into LLVM unreachable insts. The instruction combining pass + // canonnicalizes unreachable insts into stores to null or undef. + for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ++BBI) + if (StoreInst *SI = dyn_cast(BBI)) + if (isa(SI->getOperand(1)) || + isa(SI->getOperand(1))) { + // Loop over all of the successors, removing BB's entry from any PHI + // nodes. + for (succ_iterator I = succ_begin(BB), SE = succ_end(BB); I != SE;++I) + (*I)->removePredecessor(BB); + + new UnreachableInst(SI); + + // All instructions after this are dead. + while (BBI != E) { + if (!BBI->use_empty()) + BBI->replaceAllUsesWith(UndefValue::get(BBI->getType())); + BB->getInstList().erase(BBI++); + } + break; } - break; - } - bool Changed = ConstantFoldTerminator(BB); - for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI) - Changed |= MarkAliveBlocks(*SI, Reachable); - + Changed |= ConstantFoldTerminator(BB); + for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); SI != SE; ++SI) + Worklist.push_back(*SI); + } return Changed; } From resistor at mac.com Wed Apr 4 22:54:19 2007 From: resistor at mac.com (Owen Anderson) Date: Wed, 4 Apr 2007 22:54:19 -0500 Subject: [llvm-commits] CVS: llvm-www/OpenProjects.html Message-ID: <200704050354.l353sJfU003892@zion.cs.uiuc.edu> Changes in directory llvm-www: OpenProjects.html updated: 1.23 -> 1.24 --- Log message: Add an idea about code-size optimization. --- Diffs of the changes: (+17 -1) OpenProjects.html | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletion(-) Index: llvm-www/OpenProjects.html diff -u llvm-www/OpenProjects.html:1.23 llvm-www/OpenProjects.html:1.24 --- llvm-www/OpenProjects.html:1.23 Fri Mar 23 18:49:13 2007 +++ llvm-www/OpenProjects.html Wed Apr 4 22:54:01 2007 @@ -19,6 +19,7 @@
  • Implementing new feature PRs
  • Pointer and Alias Analysis
  • Profile-Guided Optimization
  • +
  • Code Compaction
  • New Transformations and Analyses
  • Code Generator Improvements
  • Miscellaneous Additions
  • @@ -294,6 +295,21 @@ + +
    +LLVM aggressively optimizes for performace, but does not yet optimize for code size. +With a new ARM backend, there is increasing interest in using LLVM for embedded systems +where code size is more of an issue. + +Someone interested in working on implementing code compaction in LLVM might want to read +this article, describing using +link-time optimizations for code size optimization. +
    + + + @@ -387,7 +403,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2007/03/23 23:49:13 $ + Last modified: $Date: 2007/04/05 03:54:01 $ From resistor at mac.com Wed Apr 4 22:55:39 2007 From: resistor at mac.com (Owen Anderson) Date: Wed, 4 Apr 2007 22:55:39 -0500 Subject: [llvm-commits] CVS: llvm-www/OpenProjects.html Message-ID: <200704050355.l353tdFU003973@zion.cs.uiuc.edu> Changes in directory llvm-www: OpenProjects.html updated: 1.24 -> 1.25 --- Log message: Fix formatting and typoes. --- Diffs of the changes: (+6 -3) OpenProjects.html | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm-www/OpenProjects.html diff -u llvm-www/OpenProjects.html:1.24 llvm-www/OpenProjects.html:1.25 --- llvm-www/OpenProjects.html:1.24 Wed Apr 4 22:54:01 2007 +++ llvm-www/OpenProjects.html Wed Apr 4 22:55:22 2007 @@ -299,13 +299,16 @@
    -LLVM aggressively optimizes for performace, but does not yet optimize for code size. +

    LLVM aggressively optimizes for performance, but does not yet optimize for code size. With a new ARM backend, there is increasing interest in using LLVM for embedded systems where code size is more of an issue. +

    -Someone interested in working on implementing code compaction in LLVM might want to read +

    Someone interested in working on implementing code compaction in LLVM might want to read this article, describing using link-time optimizations for code size optimization. +

    +
    @@ -403,7 +406,7 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> LLVM Compiler Infrastructure
    - Last modified: $Date: 2007/04/05 03:54:01 $ + Last modified: $Date: 2007/04/05 03:55:22 $ From sabre at nondot.org Thu Apr 5 00:20:28 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 5 Apr 2007 00:20:28 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/APSInt.h Message-ID: <200704050520.l355KSRd005372@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: APSInt.h added (r1.1) --- Log message: Add a helper class (APSInt) which can represent an APInt along with sign information. This is useful when a value does have a sign associated with it. This shouldn't be used generally in LLVM for mid-level optimizer stuff. --- Diffs of the changes: (+101 -0) APSInt.h | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 101 insertions(+) Index: llvm/include/llvm/ADT/APSInt.h diff -c /dev/null llvm/include/llvm/ADT/APSInt.h:1.1 *** /dev/null Thu Apr 5 00:20:21 2007 --- llvm/include/llvm/ADT/APSInt.h Thu Apr 5 00:20:11 2007 *************** *** 0 **** --- 1,101 ---- + //===-- llvm/Support/APSInt.h - Arbitrary Precision Signed Int -*- C++ -*--===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Chris Lattner and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the APSInt class, which is a simple class that + // represents an arbitrary sized integer that knows its signedness. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_APSINT_H + #define LLVM_APSINT_H + + #include "llvm/ADT/APInt.h" + + namespace llvm { + + + class APSInt : public APInt { + bool IsUnsigned; + public: + /// APSInt ctor - Create an APSInt with the specified width, default to + /// unsigned. + explicit APSInt(unsigned BitWidth) : APInt(BitWidth, 0), IsUnsigned(true) {} + APSInt(const APInt &I) : APInt(I), IsUnsigned(true) {} + + APSInt &operator=(const APSInt &RHS) { + APInt::operator=(RHS); + IsUnsigned = RHS.IsUnsigned; + return *this; + } + + APSInt &operator=(const APInt &RHS) { + // Retain our current sign. + APInt::operator=(RHS); + return *this; + } + + APSInt &operator=(uint64_t RHS) { + // Retain our current sign. + APInt::operator=(RHS); + return *this; + } + + // Query sign information. + bool isSigned() const { return !IsUnsigned; } + bool isUnsigned() const { return IsUnsigned; } + void setIsUnsigned(bool Val) { IsUnsigned = Val; } + + + const APSInt &operator%=(const APSInt &RHS) { + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); + if (IsUnsigned) + *this = urem(RHS); + else + *this = srem(RHS); + return *this; + } + const APSInt &operator/=(const APSInt &RHS) { + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); + if (IsUnsigned) + *this = udiv(RHS); + else + *this = sdiv(RHS); + return *this; + } + + const APSInt &operator>>=(unsigned Amt) { + *this = *this >> Amt; + return *this; + } + + APSInt operator>>(unsigned Amt) { + return IsUnsigned ? lshr(Amt) : ashr(Amt); + } + + inline bool operator<(const APSInt& RHS) const { + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); + return IsUnsigned ? ult(RHS) : slt(RHS); + } + inline bool operator>(const APSInt& RHS) const { + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); + return IsUnsigned ? ugt(RHS) : sgt(RHS); + } + inline bool operator<=(const APSInt& RHS) const { + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); + return IsUnsigned ? ule(RHS) : sle(RHS); + } + inline bool operator>=(const APSInt& RHS) const { + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); + return IsUnsigned ? uge(RHS) : sge(RHS); + } + }; + + } // end namespace llvm + + #endif From rspencer at reidspencer.com Thu Apr 5 10:40:30 2007 From: rspencer at reidspencer.com (Reid Spencer) Date: Thu, 05 Apr 2007 15:40:30 +0000 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/APSInt.h In-Reply-To: <200704050520.l355KSRd005372@zion.cs.uiuc.edu> References: <200704050520.l355KSRd005372@zion.cs.uiuc.edu> Message-ID: <1175787630.9947.219.camel@bashful.x10sys.com> On Thu, 2007-04-05 at 00:20 -0500, Chris Lattner wrote: > > Changes in directory llvm/include/llvm/ADT: > > APSInt.h added (r1.1) > --- > Log message: > > Add a helper class (APSInt) which can represent an APInt along with sign > information. This is useful when a value does have a sign associated with > it. This shouldn't be used generally in LLVM for mid-level optimizer stuff. Do we really need this? I didn't see you use it in any subsequent commits. What's the use case you have in mind? Reid. > > > --- > Diffs of the changes: (+101 -0) > > APSInt.h | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 101 insertions(+) > > > Index: llvm/include/llvm/ADT/APSInt.h > diff -c /dev/null llvm/include/llvm/ADT/APSInt.h:1.1 > *** /dev/null Thu Apr 5 00:20:21 2007 > --- llvm/include/llvm/ADT/APSInt.h Thu Apr 5 00:20:11 2007 > *************** > *** 0 **** > --- 1,101 ---- > + //===-- llvm/Support/APSInt.h - Arbitrary Precision Signed Int -*- C++ -*--===// > + // > + // The LLVM Compiler Infrastructure > + // > + // This file was developed by Chris Lattner and is distributed under the > + // University of Illinois Open Source License. See LICENSE.TXT for details. > + // > + //===----------------------------------------------------------------------===// > + // > + // This file implements the APSInt class, which is a simple class that > + // represents an arbitrary sized integer that knows its signedness. > + // > + //===----------------------------------------------------------------------===// > + > + #ifndef LLVM_APSINT_H > + #define LLVM_APSINT_H > + > + #include "llvm/ADT/APInt.h" > + > + namespace llvm { > + > + > + class APSInt : public APInt { > + bool IsUnsigned; > + public: > + /// APSInt ctor - Create an APSInt with the specified width, default to > + /// unsigned. > + explicit APSInt(unsigned BitWidth) : APInt(BitWidth, 0), IsUnsigned(true) {} > + APSInt(const APInt &I) : APInt(I), IsUnsigned(true) {} > + > + APSInt &operator=(const APSInt &RHS) { > + APInt::operator=(RHS); > + IsUnsigned = RHS.IsUnsigned; > + return *this; > + } > + > + APSInt &operator=(const APInt &RHS) { > + // Retain our current sign. > + APInt::operator=(RHS); > + return *this; > + } > + > + APSInt &operator=(uint64_t RHS) { > + // Retain our current sign. > + APInt::operator=(RHS); > + return *this; > + } > + > + // Query sign information. > + bool isSigned() const { return !IsUnsigned; } > + bool isUnsigned() const { return IsUnsigned; } > + void setIsUnsigned(bool Val) { IsUnsigned = Val; } > + > + > + const APSInt &operator%=(const APSInt &RHS) { > + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); > + if (IsUnsigned) > + *this = urem(RHS); > + else > + *this = srem(RHS); > + return *this; > + } > + const APSInt &operator/=(const APSInt &RHS) { > + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); > + if (IsUnsigned) > + *this = udiv(RHS); > + else > + *this = sdiv(RHS); > + return *this; > + } > + > + const APSInt &operator>>=(unsigned Amt) { > + *this = *this >> Amt; > + return *this; > + } > + > + APSInt operator>>(unsigned Amt) { > + return IsUnsigned ? lshr(Amt) : ashr(Amt); > + } > + > + inline bool operator<(const APSInt& RHS) const { > + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); > + return IsUnsigned ? ult(RHS) : slt(RHS); > + } > + inline bool operator>(const APSInt& RHS) const { > + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); > + return IsUnsigned ? ugt(RHS) : sgt(RHS); > + } > + inline bool operator<=(const APSInt& RHS) const { > + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); > + return IsUnsigned ? ule(RHS) : sle(RHS); > + } > + inline bool operator>=(const APSInt& RHS) const { > + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); > + return IsUnsigned ? uge(RHS) : sge(RHS); > + } > + }; > + > + } // end namespace llvm > + > + #endif > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From reid at x10sys.com Thu Apr 5 11:19:42 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 5 Apr 2007 11:19:42 -0500 Subject: [llvm-commits] CVS: llvm-stacker/Makefile.common.in Message-ID: <200704051619.l35GJgQO000758@zion.cs.uiuc.edu> Changes in directory llvm-stacker: Makefile.common.in updated: 1.4 -> 1.5 --- Log message: Make this compile again by abandoning partially completed makefile work. --- Diffs of the changes: (+1 -1) Makefile.common.in | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-stacker/Makefile.common.in diff -u llvm-stacker/Makefile.common.in:1.4 llvm-stacker/Makefile.common.in:1.5 --- llvm-stacker/Makefile.common.in:1.4 Thu Mar 29 14:05:44 2007 +++ llvm-stacker/Makefile.common.in Thu Apr 5 11:19:25 2007 @@ -26,4 +26,4 @@ PROJ_INSTALL_ROOT := @prefix@ # Include LLVM's Master Makefile. -include $(LLVM_OBJ_ROOT)/Makefile.config +include $(LLVM_OBJ_ROOT)/Makefile.common From reid at x10sys.com Thu Apr 5 11:19:45 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 5 Apr 2007 11:19:45 -0500 Subject: [llvm-commits] CVS: llvm-stacker/lib/compiler/Makefile Message-ID: <200704051619.l35GJjCH000764@zion.cs.uiuc.edu> Changes in directory llvm-stacker/lib/compiler: Makefile updated: 1.12 -> 1.13 --- Log message: Make this compile again by abandoning partially completed makefile work. --- Diffs of the changes: (+0 -1) Makefile | 1 - 1 files changed, 1 deletion(-) Index: llvm-stacker/lib/compiler/Makefile diff -u llvm-stacker/lib/compiler/Makefile:1.12 llvm-stacker/lib/compiler/Makefile:1.13 --- llvm-stacker/lib/compiler/Makefile:1.12 Thu Mar 29 14:05:44 2007 +++ llvm-stacker/lib/compiler/Makefile Thu Apr 5 11:19:25 2007 @@ -14,7 +14,6 @@ REQUIRES_EH := 1 include $(LEVEL)/Makefile.common -include $(LLVMMAKE)/archive ifdef PARSE_DEBUG INCLUDES += -DPARSE_DEBUG From clattner at apple.com Thu Apr 5 11:27:11 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 5 Apr 2007 09:27:11 -0700 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/APSInt.h In-Reply-To: <1175787630.9947.219.camel@bashful.x10sys.com> References: <200704050520.l355KSRd005372@zion.cs.uiuc.edu> <1175787630.9947.219.camel@bashful.x10sys.com> Message-ID: <943A1F7E-39C3-4FAE-A605-FDF21FF3C2D6@apple.com> On Apr 5, 2007, at 8:40 AM, Reid Spencer wrote: >> Add a helper class (APSInt) which can represent an APInt along >> with sign >> information. This is useful when a value does have a sign >> associated with >> it. This shouldn't be used generally in LLVM for mid-level >> optimizer stuff. > > Do we really need this? I didn't see you use it in any subsequent > commits. What's the use case you have in mind? I'm playing with a little interpreter, which wants to think of values as signed. It is a toy and nothing will probably come of it, but it made more sense to have a class to represent arbitrary-width signed values than use a pair everywhere. Perhaps it will be useful for other people too. -Chris From asl at math.spbu.ru Thu Apr 5 11:43:27 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Thu, 5 Apr 2007 11:43:27 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/Generic/switch-lower-feature-2.ll Message-ID: <200704051643.l35GhRpL001268@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/Generic: switch-lower-feature-2.ll updated: 1.1 -> 1.2 --- Log message: Fix test --- Diffs of the changes: (+2 -0) switch-lower-feature-2.ll | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/test/CodeGen/Generic/switch-lower-feature-2.ll diff -u llvm/test/CodeGen/Generic/switch-lower-feature-2.ll:1.1 llvm/test/CodeGen/Generic/switch-lower-feature-2.ll:1.2 --- llvm/test/CodeGen/Generic/switch-lower-feature-2.ll:1.1 Wed Apr 4 16:14:49 2007 +++ llvm/test/CodeGen/Generic/switch-lower-feature-2.ll Thu Apr 5 11:43:09 2007 @@ -8,6 +8,8 @@ ; RUN: llvm-as < %s | llc -march=x86 -o - | grep ja | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=x86 -o - | grep js | wc -l | grep 1 +target triple = "i686-pc-linux-gnu" + define i32 @main(i32 %tmp158) { entry: switch i32 %tmp158, label %bb336 [ From dpatel at apple.com Thu Apr 5 11:48:14 2007 From: dpatel at apple.com (dpatel at apple.com) Date: Thu, 5 Apr 2007 09:48:14 -0700 (PDT) Subject: [llvm-commits] [125745] Improve Packed structure support by used Message-ID: <20070405164814.473AED442614@src> Revision: 125745 Author: dpatel Date: 2007-04-05 09:48:13 -0700 (Thu, 05 Apr 2007) Log Message: ----------- Improve Packed structure support by used Packed StructType. Original version of this patch was written by Andrew Lenharth. Later this patch was updated by Duncan Sands. I updated packed bit field support in this patch. Modified Paths: -------------- apple-local/branches/llvm/gcc/llvm-convert.cpp apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-04-05 14:21:17 UTC (rev 125744) +++ apple-local/branches/llvm/gcc/llvm-convert.cpp 2007-04-05 16:48:13 UTC (rev 125745) @@ -4780,6 +4780,10 @@ // the size of the field. To get the pointer close enough, add some // number of alignment units to the pointer. unsigned ByteAlignment = TD.getABITypeAlignment(FieldTy); + // It is possible that an individual field is Packed. This information is + // not reflected in FieldTy. Check DECL_PACKED here. + if (DECL_PACKED(FieldDecl)) + ByteAlignment = 1; assert(ByteAlignment*8 <= LLVMValueBitSize && "Unknown overlap case!"); unsigned NumAlignmentUnits = BitStart/(ByteAlignment*8); assert(NumAlignmentUnits && "Not adjusting pointer?"); @@ -5560,7 +5564,7 @@ if (ResultElts[i] == 0) ResultElts[i] = Constant::getNullValue(STy->getElementType(i)); - return ConstantStruct::get(ResultElts, false); + return ConstantStruct::get(ResultElts, STy->isPacked()); } Constant *TreeConstantToLLVM::ConvertUnionCONSTRUCTOR(tree exp) { Modified: apple-local/branches/llvm/gcc/llvm-types.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-types.cpp 2007-04-05 14:21:17 UTC (rev 125744) +++ apple-local/branches/llvm/gcc/llvm-types.cpp 2007-04-05 16:48:13 UTC (rev 125745) @@ -845,10 +845,27 @@ std::vector ElementSizeInBytes; const TargetData &TD; unsigned GCCStructAlignmentInBytes; + bool Packed; // True if struct is packed + bool LastFieldStartsAtNonByteBoundry; + unsigned ExtraBitsAvailable; // Non-zero if last field is bit field and it + // does not use all allocated bits - StructTypeConversionInfo(TargetMachine &TM, unsigned GCCAlign) - : TD(*TM.getTargetData()), GCCStructAlignmentInBytes(GCCAlign) {} + StructTypeConversionInfo(TargetMachine &TM, unsigned GCCAlign, bool P) + : TD(*TM.getTargetData()), GCCStructAlignmentInBytes(GCCAlign), + Packed(P), LastFieldStartsAtNonByteBoundry(false), ExtraBitsAvailable(0) {} + void lastFieldStartsAtNonByteBoundry(bool value) { + LastFieldStartsAtNonByteBoundry = value; + } + + void extraBitsAvailable (unsigned E) { + ExtraBitsAvailable = E; + } + + void markAsPacked() { + Packed = true; + } + unsigned getGCCStructAlignmentInBytes() const { return GCCStructAlignmentInBytes; } @@ -856,7 +873,7 @@ /// getTypeAlignment - Return the alignment of the specified type in bytes. /// unsigned getTypeAlignment(const Type *Ty) const { - return TD.getABITypeAlignment(Ty); + return Packed ? 1 : TD.getABITypeAlignment(Ty); } /// getTypeSize - Return the size of the specified type in bytes. @@ -868,7 +885,7 @@ /// getLLVMType - Return the LLVM type for the specified object. /// const Type *getLLVMType() const { - return StructType::get(Elements, false); + return StructType::get(Elements, Packed); } /// getSizeAsLLVMStruct - Return the size of this struct if it were converted @@ -877,25 +894,103 @@ uint64_t getSizeAsLLVMStruct() const { if (Elements.empty()) return 0; unsigned MaxAlign = 1; - for (unsigned i = 0, e = Elements.size(); i != e; ++i) - MaxAlign = std::max(MaxAlign, getTypeAlignment(Elements[i])); + if (!Packed) + for (unsigned i = 0, e = Elements.size(); i != e; ++i) + MaxAlign = std::max(MaxAlign, getTypeAlignment(Elements[i])); uint64_t Size = ElementOffsetInBytes.back()+ElementSizeInBytes.back(); return (Size+MaxAlign-1) & ~(MaxAlign-1); } - - /// RemoveLastElementIfOverlapsWith - If the last element in the struct - /// includes the specified byte, remove it. - void RemoveLastElementIfOverlapsWith(uint64_t ByteOffset) { - if (Elements.empty()) return; - assert(ElementOffsetInBytes.back() <= ByteOffset && - "Cannot go backwards in struct"); - if (ElementOffsetInBytes.back()+ElementSizeInBytes.back() > ByteOffset) { - // The last element overlapped with this one, remove it. - Elements.pop_back(); - ElementOffsetInBytes.pop_back(); - ElementSizeInBytes.pop_back(); + + // If this is a Packed struct and ExtraBitsAvailable is not zero then + // remove Extra bytes if ExtraBitsAvailable > 8. + void RemoveExtraBytes () { + + unsigned NoOfBytesToRemove = ExtraBitsAvailable/8; + + if (!Packed) + return; + + if (NoOfBytesToRemove == 0) + return; + + const Type *LastType = Elements.back(); + unsigned PadBytes = 0; + + if (LastType == Type::Int8Ty) + PadBytes = 1 - NoOfBytesToRemove; + else if (LastType == Type::Int16Ty) + PadBytes = 2 - NoOfBytesToRemove; + else if (LastType == Type::Int32Ty) + PadBytes = 4 - NoOfBytesToRemove; + else if (LastType == Type::Int64Ty) + PadBytes = 8 - NoOfBytesToRemove; + else + return; + + assert (PadBytes > 0 && "Unable to remove extra bytes"); + + // Update last element type and size, element offset is unchanged. + const Type *Pad = ArrayType::get(Type::Int8Ty, PadBytes); + Elements.pop_back(); + Elements.push_back(Pad); + + unsigned OriginalSize = ElementSizeInBytes.back(); + ElementSizeInBytes.pop_back(); + ElementSizeInBytes.push_back(OriginalSize - NoOfBytesToRemove); + } + + /// ResizeLastElementIfOverlapsWith - If the last element in the struct + /// includes the specified byte, remove it. Return true struct + /// layout is sized properly. Return false if unable to handle ByteOffset. + /// In this case caller should redo this struct as a packed structure. + bool ResizeLastElementIfOverlapsWith(uint64_t ByteOffset, tree Field, + const Type *Ty) { + const Type *SavedTy = NULL; + + if (!Elements.empty()) { + assert(ElementOffsetInBytes.back() <= ByteOffset && + "Cannot go backwards in struct"); + + SavedTy = Elements.back(); + if (ElementOffsetInBytes.back()+ElementSizeInBytes.back() > ByteOffset) { + // The last element overlapped with this one, remove it. + Elements.pop_back(); + ElementOffsetInBytes.pop_back(); + ElementSizeInBytes.pop_back(); + } } + + // Get the LLVM type for the field. If this field is a bitfield, use the + // declared type, not the shrunk-to-fit type that GCC gives us in TREE_TYPE. + unsigned ByteAlignment = getTypeAlignment(Ty); + unsigned NextByteOffset = getNewElementByteOffset(ByteAlignment); + if (NextByteOffset > ByteOffset || + ByteAlignment > getGCCStructAlignmentInBytes()) { + // LLVM disagrees as to where this field should go in the natural field + // ordering. Therefore convert to a packed struct and try again. + return false; + } + + // If alignment won't round us up to the right boundary, insert explicit + // padding. + if (NextByteOffset < ByteOffset) { + unsigned CurOffset = getNewElementByteOffset(1); + const Type *Pad = Type::Int8Ty; + if (SavedTy && LastFieldStartsAtNonByteBoundry) + // We want to reuse SavedType to access this bit field. + // e.g. struct __attribute__((packed)) { + // unsigned int A, + // unsigned short B : 6, + // C : 15; + // char D; }; + // In this example, previous field is C and D is current field. + addElement(SavedTy, CurOffset, ByteOffset - CurOffset); + else if (ByteOffset - CurOffset != 1) + Pad = ArrayType::get(Pad, ByteOffset - CurOffset); + addElement(Pad, CurOffset, ByteOffset - CurOffset); + } + return true; } /// FieldNo - Remove the specified field and all of the fields that come after @@ -924,6 +1019,8 @@ Elements.push_back(Ty); ElementOffsetInBytes.push_back(Offset); ElementSizeInBytes.push_back(Size); + lastFieldStartsAtNonByteBoundry(false); + ExtraBitsAvailable = 0; } /// getFieldEndOffsetInBytes - Return the byte offset of the byte immediately @@ -984,10 +1081,71 @@ assert(0 && "Could not find field!"); return ~0U; } + + void addNewBitField(unsigned Size, unsigned FirstUnallocatedByte); + + void convertToPacked(); void dump() const; }; +// LLVM disagrees as to where to put field natural field ordering. +// ordering. Therefore convert to a packed struct. +void StructTypeConversionInfo::convertToPacked() { + assert (!Packed && "Packing a packed struct!"); + Packed = true; + + // Fill the padding that existed from alignment restrictions + // with byte arrays to ensure the same layout when converting + // to a packed struct. + for (unsigned x = 1; x < ElementOffsetInBytes.size(); ++x) { + if (ElementOffsetInBytes[x-1] + ElementSizeInBytes[x-1] + < ElementOffsetInBytes[x]) { + uint64_t padding = ElementOffsetInBytes[x] + - ElementOffsetInBytes[x-1] - ElementSizeInBytes[x-1]; + const Type *Pad = Type::Int8Ty; + Pad = ArrayType::get(Pad, padding); + ElementOffsetInBytes.insert(ElementOffsetInBytes.begin() + x, + ElementOffsetInBytes[x-1] + ElementSizeInBytes[x-1]); + ElementSizeInBytes.insert(ElementSizeInBytes.begin() + x, padding); + Elements.insert(Elements.begin() + x, Pad); + } + } +} + +// Add new element which is a bit field. Size is not the size of bit filed, +// but size of bits required to determine type of new Field which will be +// used to access this bit field. +void StructTypeConversionInfo::addNewBitField(unsigned Size, + unsigned FirstUnallocatedByte) { + + // Figure out the LLVM type that we will use for the new field. + // Note, Size is not necessarily size of the new field. It indicates + // additional bits required after FirstunallocatedByte to cover new field. + const Type *NewFieldTy; + if (Size <= 8) + NewFieldTy = Type::Int8Ty; + else if (Size <= 16) + NewFieldTy = Type::Int16Ty; + else if (Size <= 32) + NewFieldTy = Type::Int32Ty; + else { + assert(Size <= 64 && "Bitfield too large!"); + NewFieldTy = Type::Int64Ty; + } + + // Check that the alignment of NewFieldTy won't cause a gap in the structure! + unsigned ByteAlignment = getTypeAlignment(NewFieldTy); + if (FirstUnallocatedByte & (ByteAlignment-1)) { + // Instead of inserting a nice whole field, insert a small array of ubytes. + NewFieldTy = ArrayType::get(Type::Int8Ty, (Size+7)/8); + } + + // Finally, add the new field. + addElement(NewFieldTy, FirstUnallocatedByte, getTypeSize(NewFieldTy)); + ExtraBitsAvailable = NewFieldTy->getPrimitiveSizeInBits() - Size; +} + void StructTypeConversionInfo::dump() const { std::cerr << "Info has " << Elements.size() << " fields:\n"; for (unsigned i = 0, e = Elements.size(); i != e; ++i) { @@ -1029,36 +1187,18 @@ assert((StartOffsetInBits & 7) == 0 && "Non-bit-field has non-byte offset!"); unsigned StartOffsetInBytes = StartOffsetInBits/8; + const Type *Ty = ConvertType(TREE_TYPE(Field)); + // Pop any previous elements out of the struct if they overlap with this one. // This can happen when the C++ front-end overlaps fields with tail padding in // C++ classes. - Info.RemoveLastElementIfOverlapsWith(StartOffsetInBytes); - - // Get the LLVM type for the field. If this field is a bitfield, use the - // declared type, not the shrunk-to-fit type that GCC gives us in TREE_TYPE. - const Type *Ty = ConvertType(TREE_TYPE(Field)); - unsigned ByteAlignment = Info.getTypeAlignment(Ty); - unsigned NextByteOffset = Info.getNewElementByteOffset(ByteAlignment); - if (NextByteOffset > StartOffsetInBytes || - ByteAlignment > Info.getGCCStructAlignmentInBytes()) { - // If the LLVM type is aligned more than the GCC type, we cannot use this - // LLVM type for the field. Instead, insert the field as an array of bytes, - // which we know will have the least alignment possible. - Ty = ArrayType::get(Type::Int8Ty, Info.getTypeSize(Ty)); - ByteAlignment = 1; - NextByteOffset = Info.getNewElementByteOffset(ByteAlignment); + if (!Info.ResizeLastElementIfOverlapsWith(StartOffsetInBytes, Field, Ty)) { + // LLVM disagrees as to where this field should go in the natural field + // ordering. Therefore convert to a packed struct and try again. + Info.convertToPacked(); + DecodeStructFields(Field, Info); } - - // If alignment won't round us up to the right boundary, insert explicit - // padding. - if (NextByteOffset < StartOffsetInBytes) { - unsigned CurOffset = Info.getNewElementByteOffset(1); - const Type *Pad = Type::Int8Ty; - if (StartOffsetInBytes-CurOffset != 1) - Pad = ArrayType::get(Pad, StartOffsetInBytes-CurOffset); - Info.addElement(Pad, CurOffset, StartOffsetInBytes-CurOffset); - } - + // At this point, we know that adding the element will happen at the right // offset. Add it. Info.addElement(Ty, StartOffsetInBytes, Info.getTypeSize(Ty)); @@ -1076,6 +1216,11 @@ void TypeConverter::DecodeStructBitField(tree_node *Field, StructTypeConversionInfo &Info) { unsigned FieldSizeInBits = TREE_INT_CST_LOW(DECL_SIZE(Field)); + + if (DECL_PACKED(Field)) + // Individual fields can be packed. + Info.markAsPacked(); + if (FieldSizeInBits == 0) // Ignore 'int:0', which just affects layout. return; @@ -1093,8 +1238,12 @@ assert(LastFieldBitOffset < StartOffsetInBits && "This bitfield isn't part of the last field!"); if (EndBitOffset <= LastFieldBitOffset+LastFieldBitSize && - LastFieldBitOffset+LastFieldBitSize >= StartOffsetInBits) - return; // Already contained in previous field! + LastFieldBitOffset+LastFieldBitSize >= StartOffsetInBits) { + // Already contained in previous field. Update remaining extra bits that + // are available. + Info.extraBitsAvailable(Info.getEndUnallocatedByte()*8 - EndBitOffset); + return; + } } // Otherwise, this bitfield lives (potentially) partially in the preceeding @@ -1105,47 +1254,65 @@ // Compute the number of bits that we need to add to this struct to cover // this field. - unsigned NumBitsToAdd = FieldSizeInBits; unsigned FirstUnallocatedByte = Info.getEndUnallocatedByte(); - // If there are any, subtract off bits that go in the previous field. + unsigned StartOffsetFromByteBoundry = StartOffsetInBits & 7; + if (StartOffsetInBits < FirstUnallocatedByte*8) { - NumBitsToAdd -= FirstUnallocatedByte*8-StartOffsetInBits; - } else if (StartOffsetInBits > FirstUnallocatedByte*8) { + + // This field's starting point is already allocated. + if (StartOffsetFromByteBoundry == 0) { + // This field starts at byte boundry. Need to allocate space + // for additional bytes not yet allocated. + unsigned AvailableBits = FirstUnallocatedByte * 8 - StartOffsetInBits; + unsigned NumBitsToAdd = FieldSizeInBits - AvailableBits; + Info.addNewBitField(NumBitsToAdd, FirstUnallocatedByte); + return; + } + + // Otherwise, this field's starting point is inside previously used byte. + // This happens with Packed bit fields. In this case one LLVM Field is + // used to access previous field and current field. + + unsigned prevFieldTypeSizeInBits = + Info.Elements.back()->getPrimitiveSizeInBits(); + unsigned NumBitsRequired = FieldSizeInBits + + (prevFieldTypeSizeInBits/8 - 1)*8 + StartOffsetFromByteBoundry; + + // If type used to access previous field is not large enough then + // remove previous field and insert new field that is large enough to + // hold both fields. + Info.RemoveFieldsAfter(Info.Elements.size() - 1); + for (unsigned idx = 0; idx < (prevFieldTypeSizeInBits/8); ++idx) + FirstUnallocatedByte--; + Info.addNewBitField(NumBitsRequired, FirstUnallocatedByte); + // Do this after adding Field. + Info.lastFieldStartsAtNonByteBoundry(true); + return; + } + + if (StartOffsetInBits > FirstUnallocatedByte*8) { // If there is padding between the last field and the struct, insert // explicit bytes into the field to represent it. - assert((StartOffsetInBits & 7) == 0 && - "Next field starts on a non-byte boundary!"); - unsigned PadBytes = StartOffsetInBits/8-FirstUnallocatedByte; + unsigned PadBytes = 0; + unsigned PadBits = 0; + if (StartOffsetFromByteBoundry != 0) { + // New field does not start at byte boundry. + PadBits = StartOffsetInBits - (FirstUnallocatedByte*8); + PadBytes = PadBits/8 + 1; + } + + PadBytes += StartOffsetInBits/8-FirstUnallocatedByte; const Type *Pad = Type::Int8Ty; if (PadBytes != 1) Pad = ArrayType::get(Pad, PadBytes); Info.addElement(Pad, FirstUnallocatedByte, PadBytes); FirstUnallocatedByte = StartOffsetInBits/8; + // This field will use some of the bits from this PadBytes. + FieldSizeInBits = FieldSizeInBits - (PadBytes*8 - PadBits); } - // Figure out the LLVM type that we will use for the new field. - const Type *NewFieldTy; - if (NumBitsToAdd <= 8) - NewFieldTy = Type::Int8Ty; - else if (NumBitsToAdd <= 16) - NewFieldTy = Type::Int16Ty; - else if (NumBitsToAdd <= 32) - NewFieldTy = Type::Int32Ty; - else { - assert(NumBitsToAdd <= 64 && "Bitfield too large!"); - NewFieldTy = Type::Int64Ty; - } - - // Check that the alignment of NewFieldTy won't cause a gap in the structure! - unsigned ByteAlignment = Info.getTypeAlignment(NewFieldTy); - if (FirstUnallocatedByte & (ByteAlignment-1)) { - // Instead of inserting a nice whole field, insert a small array of ubytes. - NewFieldTy = ArrayType::get(Type::Int8Ty, (NumBitsToAdd+7)/8); - } - - // Finally, add the new field. - Info.addElement(NewFieldTy, FirstUnallocatedByte, - Info.getTypeSize(NewFieldTy)); + // Now, Field starts at FirstUnallocatedByte and everything is aligned. + Info.addNewBitField(FieldSizeInBits, FirstUnallocatedByte); } @@ -1176,12 +1343,14 @@ ConvertType(BINFO_TYPE(BINFO_BASE_BINFO(binfo, i))); } - StructTypeConversionInfo Info(*TheTarget, TYPE_ALIGN_UNIT(type)); + StructTypeConversionInfo Info(*TheTarget, TYPE_ALIGN_UNIT(type), + TYPE_PACKED(type)); // Convert over all of the elements of the struct. for (tree Field = TYPE_FIELDS(type); Field; Field = TREE_CHAIN(Field)) DecodeStructFields(Field, Info); - + + Info.RemoveExtraBytes(); // If the LLVM struct requires explicit tail padding to be the same size as // the GCC struct, insert tail padding now. This handles, e.g., "{}" in C++. if (TYPE_SIZE(type) && TREE_CODE(TYPE_SIZE(type)) == INTEGER_CST) { From sabre at nondot.org Thu Apr 5 11:50:37 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 5 Apr 2007 11:50:37 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/Optimize.cpp Message-ID: <200704051650.l35GobaC001421@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ld: Optimize.cpp updated: 1.18 -> 1.19 --- Log message: run a late dce pass to clean up extra cruft. --- Diffs of the changes: (+1 -0) Optimize.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/tools/llvm-ld/Optimize.cpp diff -u llvm/tools/llvm-ld/Optimize.cpp:1.18 llvm/tools/llvm-ld/Optimize.cpp:1.19 --- llvm/tools/llvm-ld/Optimize.cpp:1.18 Tue Mar 6 22:41:30 2007 +++ llvm/tools/llvm-ld/Optimize.cpp Thu Apr 5 11:50:20 2007 @@ -201,6 +201,7 @@ if (!DisableOptimizations) { addPass(Passes, createInstructionCombiningPass()); addPass(Passes, createCFGSimplificationPass()); + addPass(Passes, createDeadCodeEliminationPass()); addPass(Passes, createGlobalDCEPass()); } From dpatel at apple.com Thu Apr 5 12:08:06 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 5 Apr 2007 12:08:06 -0500 Subject: [llvm-commits] CVS: llvm/test/CFrontend/2007-04-05-PackedBitFields-2.c 2007-04-05-PackedBitFields.c 2007-04-05-PackedStruct.c 2007-04-05-UnPackedStruct.c Message-ID: <200704051708.l35H86is001739@zion.cs.uiuc.edu> Changes in directory llvm/test/CFrontend: 2007-04-05-PackedBitFields-2.c added (r1.1) 2007-04-05-PackedBitFields.c added (r1.1) 2007-04-05-PackedStruct.c added (r1.1) 2007-04-05-UnPackedStruct.c added (r1.1) --- Log message: New tests for Packed structs. --- Diffs of the changes: (+66 -0) 2007-04-05-PackedBitFields-2.c | 16 ++++++++++++++++ 2007-04-05-PackedBitFields.c | 16 ++++++++++++++++ 2007-04-05-PackedStruct.c | 18 ++++++++++++++++++ 2007-04-05-UnPackedStruct.c | 16 ++++++++++++++++ 4 files changed, 66 insertions(+) Index: llvm/test/CFrontend/2007-04-05-PackedBitFields-2.c diff -c /dev/null llvm/test/CFrontend/2007-04-05-PackedBitFields-2.c:1.1 *** /dev/null Thu Apr 5 12:07:59 2007 --- llvm/test/CFrontend/2007-04-05-PackedBitFields-2.c Thu Apr 5 12:07:48 2007 *************** *** 0 **** --- 1,16 ---- + // RUN: %llvmgcc %s -S -o - + + # define pck __attribute__((packed)) + + + struct pck F { + unsigned long long i : 12, + j : 23, + k : 27, + l; + }; + struct F f1; + + void foo() { + f1.l = 5; + } Index: llvm/test/CFrontend/2007-04-05-PackedBitFields.c diff -c /dev/null llvm/test/CFrontend/2007-04-05-PackedBitFields.c:1.1 *** /dev/null Thu Apr 5 12:08:06 2007 --- llvm/test/CFrontend/2007-04-05-PackedBitFields.c Thu Apr 5 12:07:48 2007 *************** *** 0 **** --- 1,16 ---- + // RUN: %llvmgcc %s -S -o - + + # define pck __attribute__((packed)) + + + struct pck E { + unsigned long long l, + i : 12, + j : 23, + k : 29; }; + + struct E e1; + + void foo() { + e1.k = 5; + } Index: llvm/test/CFrontend/2007-04-05-PackedStruct.c diff -c /dev/null llvm/test/CFrontend/2007-04-05-PackedStruct.c:1.1 *** /dev/null Thu Apr 5 12:08:06 2007 --- llvm/test/CFrontend/2007-04-05-PackedStruct.c Thu Apr 5 12:07:48 2007 *************** *** 0 **** --- 1,18 ---- + // RUN: %llvmgcc %s -S -o - + + #pragma pack(push, 2) + + enum { + tA = 0, + tB = 1 + }; + + struct MyStruct { + unsigned long A; + char C; + void * B; + }; + + void bar(){ + struct MyStruct MS = { tB, 0 }; + } Index: llvm/test/CFrontend/2007-04-05-UnPackedStruct.c diff -c /dev/null llvm/test/CFrontend/2007-04-05-UnPackedStruct.c:1.1 *** /dev/null Thu Apr 5 12:08:06 2007 --- llvm/test/CFrontend/2007-04-05-UnPackedStruct.c Thu Apr 5 12:07:48 2007 *************** *** 0 **** --- 1,16 ---- + // RUN: %llvmgcc %s -S -o - + + + enum { + tA = 0, + tB = 1 + }; + + struct MyStruct { + unsigned long A; + void * B; + }; + + void bar(){ + struct MyStruct MS = { tB, 0 }; + } From clattner at apple.com Thu Apr 5 12:10:54 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 5 Apr 2007 10:10:54 -0700 Subject: [llvm-commits] CVS: llvm/test/CFrontend/2007-04-05-PackedBitFields-2.c 2007-04-05-PackedBitFields.c 2007-04-05-PackedStruct.c 2007-04-05-UnPackedStruct.c In-Reply-To: <200704051708.l35H86is001739@zion.cs.uiuc.edu> References: <200704051708.l35H86is001739@zion.cs.uiuc.edu> Message-ID: <2E2A3A29-D8F6-4908-882A-EE9ACA801598@apple.com> > > New tests for Packed structs. Woot, thanks Devang, Duncan and Andrew! :) -Chris > > --- > Diffs of the changes: (+66 -0) > > 2007-04-05-PackedBitFields-2.c | 16 ++++++++++++++++ > 2007-04-05-PackedBitFields.c | 16 ++++++++++++++++ > 2007-04-05-PackedStruct.c | 18 ++++++++++++++++++ > 2007-04-05-UnPackedStruct.c | 16 ++++++++++++++++ > 4 files changed, 66 insertions(+) > > > Index: llvm/test/CFrontend/2007-04-05-PackedBitFields-2.c > diff -c /dev/null llvm/test/CFrontend/2007-04-05- > PackedBitFields-2.c:1.1 > *** /dev/null Thu Apr 5 12:07:59 2007 > --- llvm/test/CFrontend/2007-04-05-PackedBitFields-2.c Thu Apr 5 > 12:07:48 2007 > *************** > *** 0 **** > --- 1,16 ---- > + // RUN: %llvmgcc %s -S -o - > + > + # define pck __attribute__((packed)) > + > + > + struct pck F { > + unsigned long long i : 12, > + j : 23, > + k : 27, > + l; > + }; > + struct F f1; > + > + void foo() { > + f1.l = 5; > + } > > > Index: llvm/test/CFrontend/2007-04-05-PackedBitFields.c > diff -c /dev/null llvm/test/CFrontend/2007-04-05-PackedBitFields.c:1.1 > *** /dev/null Thu Apr 5 12:08:06 2007 > --- llvm/test/CFrontend/2007-04-05-PackedBitFields.c Thu Apr 5 > 12:07:48 2007 > *************** > *** 0 **** > --- 1,16 ---- > + // RUN: %llvmgcc %s -S -o - > + > + # define pck __attribute__((packed)) > + > + > + struct pck E { > + unsigned long long l, > + i : 12, > + j : 23, > + k : 29; }; > + > + struct E e1; > + > + void foo() { > + e1.k = 5; > + } > > > Index: llvm/test/CFrontend/2007-04-05-PackedStruct.c > diff -c /dev/null llvm/test/CFrontend/2007-04-05-PackedStruct.c:1.1 > *** /dev/null Thu Apr 5 12:08:06 2007 > --- llvm/test/CFrontend/2007-04-05-PackedStruct.c Thu Apr 5 > 12:07:48 2007 > *************** > *** 0 **** > --- 1,18 ---- > + // RUN: %llvmgcc %s -S -o - > + > + #pragma pack(push, 2) > + > + enum { > + tA = 0, > + tB = 1 > + }; > + > + struct MyStruct { > + unsigned long A; > + char C; > + void * B; > + }; > + > + void bar(){ > + struct MyStruct MS = { tB, 0 }; > + } > > > Index: llvm/test/CFrontend/2007-04-05-UnPackedStruct.c > diff -c /dev/null llvm/test/CFrontend/2007-04-05-UnPackedStruct.c:1.1 > *** /dev/null Thu Apr 5 12:08:06 2007 > --- llvm/test/CFrontend/2007-04-05-UnPackedStruct.c Thu Apr 5 > 12:07:48 2007 > *************** > *** 0 **** > --- 1,16 ---- > + // RUN: %llvmgcc %s -S -o - > + > + > + enum { > + tA = 0, > + tB = 1 > + }; > + > + struct MyStruct { > + unsigned long A; > + void * B; > + }; > + > + void bar(){ > + struct MyStruct MS = { tB, 0 }; > + } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dpatel at apple.com Thu Apr 5 12:14:38 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 5 Apr 2007 12:14:38 -0500 Subject: [llvm-commits] CVS: llvm/test/C++Frontend/2007-04-05-PackedBitFields-1.cpp 2007-04-05-PackedBitFieldsOverlap-2.cpp 2007-04-05-PackedBitFieldsOverlap.cpp 2007-04-05-PackedBitFieldsSmall.cpp 2007-04-05-StructPackedFieldUnpacked.cpp Message-ID: <200704051714.l35HEcbs001924@zion.cs.uiuc.edu> Changes in directory llvm/test/C++Frontend: 2007-04-05-PackedBitFields-1.cpp added (r1.1) 2007-04-05-PackedBitFieldsOverlap-2.cpp added (r1.1) 2007-04-05-PackedBitFieldsOverlap.cpp added (r1.1) 2007-04-05-PackedBitFieldsSmall.cpp added (r1.1) 2007-04-05-StructPackedFieldUnpacked.cpp added (r1.1) --- Log message: New tests for Packed structs. --- Diffs of the changes: (+123 -0) 2007-04-05-PackedBitFields-1.cpp | 23 +++++++++++++++++++++++ 2007-04-05-PackedBitFieldsOverlap-2.cpp | 24 ++++++++++++++++++++++++ 2007-04-05-PackedBitFieldsOverlap.cpp | 24 ++++++++++++++++++++++++ 2007-04-05-PackedBitFieldsSmall.cpp | 27 +++++++++++++++++++++++++++ 2007-04-05-StructPackedFieldUnpacked.cpp | 25 +++++++++++++++++++++++++ 5 files changed, 123 insertions(+) Index: llvm/test/C++Frontend/2007-04-05-PackedBitFields-1.cpp diff -c /dev/null llvm/test/C++Frontend/2007-04-05-PackedBitFields-1.cpp:1.1 *** /dev/null Thu Apr 5 12:14:31 2007 --- llvm/test/C++Frontend/2007-04-05-PackedBitFields-1.cpp Thu Apr 5 12:14:21 2007 *************** *** 0 **** --- 1,23 ---- + // RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + + #ifdef PACKED + #define P __attribute__((packed)) + #else + #define P + #endif + + struct P M_Packed { + unsigned int l_Packed; + unsigned short k_Packed : 6, + i_Packed : 15, + j_Packed : 11; + + }; + + struct M_Packed sM_Packed; + + int testM_Packed (void) { + struct M_Packed x; + return (x.i_Packed != 0); + } + Index: llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap-2.cpp diff -c /dev/null llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap-2.cpp:1.1 *** /dev/null Thu Apr 5 12:14:38 2007 --- llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap-2.cpp Thu Apr 5 12:14:21 2007 *************** *** 0 **** --- 1,24 ---- + // RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + + #ifdef PACKED + #define P __attribute__((packed)) + #else + #define P + #endif + + struct P M_Packed { + unsigned long sorted : 1; + unsigned long from_array : 1; + unsigned long mixed_encoding : 1; + unsigned long encoding : 8; + unsigned long count : 21; + + }; + + struct M_Packed sM_Packed; + + int testM_Packed (void) { + struct M_Packed x; + return (x.count != 0); + } + Index: llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap.cpp diff -c /dev/null llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap.cpp:1.1 *** /dev/null Thu Apr 5 12:14:38 2007 --- llvm/test/C++Frontend/2007-04-05-PackedBitFieldsOverlap.cpp Thu Apr 5 12:14:21 2007 *************** *** 0 **** --- 1,24 ---- + // RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + + + #ifdef PACKED + #define P __attribute__((packed)) + #else + #define P + #endif + + struct P M_Packed { + unsigned int l_Packed; + unsigned short k_Packed : 6, + i_Packed : 15; + char c; + + }; + + struct M_Packed sM_Packed; + + int testM_Packed (void) { + struct M_Packed x; + return (x.i_Packed != 0); + } + Index: llvm/test/C++Frontend/2007-04-05-PackedBitFieldsSmall.cpp diff -c /dev/null llvm/test/C++Frontend/2007-04-05-PackedBitFieldsSmall.cpp:1.1 *** /dev/null Thu Apr 5 12:14:38 2007 --- llvm/test/C++Frontend/2007-04-05-PackedBitFieldsSmall.cpp Thu Apr 5 12:14:21 2007 *************** *** 0 **** --- 1,27 ---- + // RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + + + #ifdef PACKED + // This is an example where size of Packed struct is smaller then + // the size of bit field type. + #define P __attribute__((packed)) + #else + #define P + #endif + + struct P M_Packed { + unsigned long long X:50; + unsigned Y:2; + }; + + struct M_Packed sM_Packed; + + int testM_Packed (void) { + struct M_Packed x; + return (0 != x.Y); + } + + int testM_Packed2 (void) { + struct M_Packed x; + return (0 != x.X); + } Index: llvm/test/C++Frontend/2007-04-05-StructPackedFieldUnpacked.cpp diff -c /dev/null llvm/test/C++Frontend/2007-04-05-StructPackedFieldUnpacked.cpp:1.1 *** /dev/null Thu Apr 5 12:14:38 2007 --- llvm/test/C++Frontend/2007-04-05-StructPackedFieldUnpacked.cpp Thu Apr 5 12:14:21 2007 *************** *** 0 **** --- 1,25 ---- + // RUN: %llvmgxx -S %s -o - | llvm-as -f -o /dev/null + + #ifdef PACKED + #define P __attribute__((packed)) + #else + #define P + #endif + + struct UnPacked { + int X; + int Y; + }; + + struct P M_Packed { + unsigned char A; + struct UnPacked B; + }; + + struct M_Packed sM_Packed; + + int testM_Packed (void) { + struct M_Packed x; + return (x.B.Y != 0); + } + From sabre at nondot.org Thu Apr 5 13:43:16 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 5 Apr 2007 13:43:16 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704051843.l35IhGbl004308@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.46 -> 1.47 --- Log message: update, the mtg will be in a room at the Cupertino Inn. --- Diffs of the changes: (+7 -7) DevMtgMay2007.html | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.46 llvm-www/DevMtgMay2007.html:1.47 --- llvm-www/DevMtgMay2007.html:1.46 Wed Apr 4 19:58:13 2007 +++ llvm-www/DevMtgMay2007.html Thu Apr 5 13:42:59 2007 @@ -30,8 +30,7 @@
  • Why: To get acquainted, learn how LLVM is used, and exchange ideas.
  • -
  • Where: Apple, Inc., 1 Infinite Loop, Cupertino, CA 95014, - 408.996.1010
  • +
  • Where: Cupertino Inn - 10889 N De Anza Blvd, Cupertino, 95014 - across the street from Apple
  • When: May 25, 2007, 8:00am to 6:00pm
  • Who: Everyone is invited to participate and present. If you would like to present, please send your ideas to @@ -203,14 +202,15 @@ to find hotels near the meeting.

    If there is sufficient interest, we may try to set up a discount price at one hotel. Please contact Reid if you are interested.

    +

    Tanya Lattner reports:

    +

    I have stayed at both the Cupertino Inn and Hilton Garden Inn. + The Hilton is nicer but the Cupertino Inn is acceptable and within walking + distance. The Hilton may have a shuttle. The meeting is actually being + held in a room at the Cupertino Inn this year.

    Bill Wendling reports:

    The Cypress Hotel is very close to the Apple campus. It's pretty swank, so I'm not sure how pricey it is.

    -

    Tanya Lattner reports:

    -

    I have stayed at both the Cupertino Inn and Hilton Garden Inn. - The Hilton is nicer but the Cupertino Inn is acceptable and within walking - distance. The Hilton may have a shuttle.

    @@ -286,6 +286,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/04/05 00:58:13 $ +
    Last modified: $Date: 2007/04/05 18:42:59 $ From sabre at nondot.org Thu Apr 5 13:47:01 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 5 Apr 2007 13:47:01 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704051847.l35Il1Ns004412@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.47 -> 1.48 --- Log message: Minor updates, linkify the location --- Diffs of the changes: (+7 -6) DevMtgMay2007.html | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.47 llvm-www/DevMtgMay2007.html:1.48 --- llvm-www/DevMtgMay2007.html:1.47 Thu Apr 5 13:42:59 2007 +++ llvm-www/DevMtgMay2007.html Thu Apr 5 13:46:44 2007 @@ -30,7 +30,8 @@
  • Why: To get acquainted, learn how LLVM is used, and exchange ideas.
  • -
  • Where: Cupertino Inn - 10889 N De Anza Blvd, Cupertino, 95014 - across the street from Apple
  • +
  • Where: Cupertino Inn + - 10889 N De Anza Blvd, Cupertino, CA, 95014 - across the street from Apple
  • When: May 25, 2007, 8:00am to 6:00pm
  • Who: Everyone is invited to participate and present. If you would like to present, please send your ideas to @@ -121,10 +122,10 @@

    - + - + @@ -204,8 +205,8 @@ one hotel. Please contact Reid if you are interested.

    Tanya Lattner reports:

    I have stayed at both the Cupertino Inn and Hilton Garden Inn. - The Hilton is nicer but the Cupertino Inn is acceptable and within walking - distance. The Hilton may have a shuttle. The meeting is actually being + The Hilton is nicer but the Cupertino Inn is acceptable. The Hilton may + have a shuttle. The meeting is actually being held in a room at the Cupertino Inn this year.

    Bill Wendling reports:

    The Cypress Hotel @@ -286,6 +287,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/04/05 18:42:59 $ +
    Last modified: $Date: 2007/04/05 18:46:44 $ From dalej at apple.com Thu Apr 5 14:06:00 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 5 Apr 2007 14:06:00 -0500 Subject: [llvm-commits] CVS: llvm/test/CFrontend/2007-04-05-PadBeforeZeroLengthField.c Message-ID: <200704051906.l35J60wc004796@zion.cs.uiuc.edu> Changes in directory llvm/test/CFrontend: 2007-04-05-PadBeforeZeroLengthField.c added (r1.1) --- Log message: testcase for padding before zero-length fields. --- Diffs of the changes: (+9 -0) 2007-04-05-PadBeforeZeroLengthField.c | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/test/CFrontend/2007-04-05-PadBeforeZeroLengthField.c diff -c /dev/null llvm/test/CFrontend/2007-04-05-PadBeforeZeroLengthField.c:1.1 *** /dev/null Thu Apr 5 14:05:53 2007 --- llvm/test/CFrontend/2007-04-05-PadBeforeZeroLengthField.c Thu Apr 5 14:05:43 2007 *************** *** 0 **** --- 1,9 ---- + // RUN: %llvmgcc %s -S -o - + struct c__ { unsigned int type:4; }; + union A { struct c__ c; } __attribute__((aligned(8))); + struct B { + unsigned int retainCount; + union A objects[]; + }; + void foo(union A * objects, struct B *array, unsigned long k) + { array->objects[k] = objects[k]; } From johannes at apple.com Thu Apr 5 14:09:17 2007 From: johannes at apple.com (johannes at apple.com) Date: Thu, 5 Apr 2007 12:09:17 -0700 (PDT) Subject: [llvm-commits] [125748] Handle padding before zero-length fields. Message-ID: <20070405190917.A1597D4DB7C1@src> Revision: 125748 Author: johannes Date: 2007-04-05 12:09:17 -0700 (Thu, 05 Apr 2007) Log Message: ----------- Handle padding before zero-length fields. Handle consecutive zero-length fields as the comment indicates they should be. Modified Paths: -------------- apple-local/branches/llvm/gcc/llvm-types.cpp Modified: apple-local/branches/llvm/gcc/llvm-types.cpp =================================================================== --- apple-local/branches/llvm/gcc/llvm-types.cpp 2007-04-05 18:56:15 UTC (rev 125747) +++ apple-local/branches/llvm/gcc/llvm-types.cpp 2007-04-05 19:09:17 UTC (rev 125748) @@ -1063,12 +1063,23 @@ return ~0U; } - // Handle zero sized fields now. If the next field is zero sized, return - // it. This is a nicety that causes us to assign C fields different LLVM - // fields in cases like struct X {}; struct Y { struct X a, b, c }; + // Handle zero sized fields now. + + // Skip over LLVM fields that start and end before the GCC field starts. + // Such fields are always nonzero sized, and we don't want to skip past + // zero sized ones as well, which happens if you use only the Offset + // comparison. + while (CurFieldNo < ElementOffsetInBytes.size() && + getFieldEndOffsetInBytes(CurFieldNo)*8 <= FieldOffsetInBits && + ElementSizeInBytes[CurFieldNo] != 0) + ++CurFieldNo; + + // If the next field is zero sized, advance past this one. This is a nicety + // that causes us to assign C fields different LLVM fields in cases like + // struct X {}; struct Y { struct X a, b, c }; if (CurFieldNo+1 < ElementOffsetInBytes.size() && ElementSizeInBytes[CurFieldNo+1] == 0) { - return ++CurFieldNo; + return CurFieldNo++; } // Otherwise, if this is a zero sized field, return it. From reid at x10sys.com Thu Apr 5 16:07:39 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 5 Apr 2007 16:07:39 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704052107.l35L7dwt007214@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.48 -> 1.49 --- Log message: Add Scott Michel's talk. --- Diffs of the changes: (+3 -1) DevMtgMay2007.html | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.48 llvm-www/DevMtgMay2007.html:1.49 --- llvm-www/DevMtgMay2007.html:1.48 Thu Apr 5 13:46:44 2007 +++ llvm-www/DevMtgMay2007.html Thu Apr 5 16:07:22 2007 @@ -129,6 +129,8 @@

    +
    SpeakerTopic
    Chris Lattner, Apple, Inc.
    Chris Lattner - Apple, Inc. Using LLVM to improve OpenGL
    Sarah Thompson, NASA, Ames Research Center
    Sarah Thompson - NASA, Ames Research Center Using LLVM to support model checking, symbolic execution and static analysis
    Using LLVM to support model checking, symbolic execution and static analysis
    Scott MichelBuilding The Cell BE Symbiotic Processor Element + Backend: Practice and Experience
    @@ -287,6 +289,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/04/05 18:46:44 $ +
    Last modified: $Date: 2007/04/05 21:07:22 $ From sabre at nondot.org Thu Apr 5 16:09:47 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 5 Apr 2007 16:09:47 -0500 Subject: [llvm-commits] CVS: llvm/test/Transforms/GlobalOpt/2007-04-05-Crash.ll Message-ID: <200704052109.l35L9lIN007325@zion.cs.uiuc.edu> Changes in directory llvm/test/Transforms/GlobalOpt: 2007-04-05-Crash.ll added (r1.1) --- Log message: new testcase that crashes globalopt --- Diffs of the changes: (+34 -0) 2007-04-05-Crash.ll | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+) Index: llvm/test/Transforms/GlobalOpt/2007-04-05-Crash.ll diff -c /dev/null llvm/test/Transforms/GlobalOpt/2007-04-05-Crash.ll:1.1 *** /dev/null Thu Apr 5 16:09:39 2007 --- llvm/test/Transforms/GlobalOpt/2007-04-05-Crash.ll Thu Apr 5 16:09:29 2007 *************** *** 0 **** --- 1,34 ---- + ; RUN: llvm-as < %s | opt -globalopt -disable-output + + target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:64:64-v128:128:128-a0:0:32" + target triple = "thumb-apple-darwin8" + @replacementUnichar = internal global i16 -3 ; [#uses=2] + @"L_OBJC_IMAGE_INFO" = internal global [2 x i32] zeroinitializer ; <[2 x i32]*> [#uses=1] + @llvm.used = appending global [1 x i8*] [ i8* bitcast ([2 x i32]* @"L_OBJC_IMAGE_INFO" to i8*) ] ; <[1 x i8*]*> [#uses=0] + + define i16 @__NSCharToUnicharCFWrapper(i8 zext %ch) zext { + entry: + %iftmp.0.0.in.in = select i1 false, i16* @replacementUnichar, i16* null ; [#uses=1] + %iftmp.0.0.in = load i16* %iftmp.0.0.in.in ; [#uses=1] + ret i16 %iftmp.0.0.in + } + + define void @__NSASCIICharToUnichar() { + entry: + ret void + } + + define void @_NSDefaultCStringEncoding() { + entry: + call void @__NSSetCStringCharToUnichar( ) + br i1 false, label %cond_true6, label %cond_next8 + + cond_true6: ; preds = %entry + store i16 -2, i16* @replacementUnichar + ret void + + cond_next8: ; preds = %entry + ret void + } + + declare void @__NSSetCStringCharToUnichar() From sabre at nondot.org Thu Apr 5 16:09:59 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 5 Apr 2007 16:09:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200704052109.l35L9xlK007338@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.99 -> 1.100 --- Log message: Fix Transforms/GlobalOpt/2007-04-05-Crash.ll --- Diffs of the changes: (+1 -1) GlobalOpt.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.99 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.100 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.99 Thu Mar 1 18:28:51 2007 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Thu Apr 5 16:09:42 2007 @@ -1347,7 +1347,7 @@ if (GV->getType()->getElementType() != Type::Int1Ty && !GV->getType()->getElementType()->isFloatingPoint() && !isa(GV->getType()->getElementType()) && - !GS.HasPHIUser) { + !GS.HasPHIUser && !GS.isNotSuitableForSRA) { DOUT << " *** SHRINKING TO BOOL: " << *GV; ShrinkGlobalToBoolean(GV, SOVConstant); ++NumShrunkToBool; From sabre at nondot.org Thu Apr 5 16:58:35 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 5 Apr 2007 16:58:35 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/CommandLine.h Message-ID: <200704052158.l35LwZBZ008368@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: CommandLine.h updated: 1.58 -> 1.59 --- Log message: remove the dead removeArgument method, rename Options to OptionsMap. --- Diffs of the changes: (+0 -1) CommandLine.h | 1 - 1 files changed, 1 deletion(-) Index: llvm/include/llvm/Support/CommandLine.h diff -u llvm/include/llvm/Support/CommandLine.h:1.58 llvm/include/llvm/Support/CommandLine.h:1.59 --- llvm/include/llvm/Support/CommandLine.h:1.58 Wed Jan 31 19:43:37 2007 +++ llvm/include/llvm/Support/CommandLine.h Thu Apr 5 16:58:17 2007 @@ -219,7 +219,6 @@ // occurrences of -ArgStr on the command line. // void addArgument(const char *ArgStr); - void removeArgument(const char *ArgStr); // Return the width of the option tag for printing... virtual unsigned getOptionWidth() const = 0; From sabre at nondot.org Thu Apr 5 16:58:36 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 5 Apr 2007 16:58:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp Message-ID: <200704052158.l35LwasU008373@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: CommandLine.cpp updated: 1.82 -> 1.83 --- Log message: remove the dead removeArgument method, rename Options to OptionsMap. --- Diffs of the changes: (+30 -61) CommandLine.cpp | 91 ++++++++++++++++++-------------------------------------- 1 files changed, 30 insertions(+), 61 deletions(-) Index: llvm/lib/Support/CommandLine.cpp diff -u llvm/lib/Support/CommandLine.cpp:1.82 llvm/lib/Support/CommandLine.cpp:1.83 --- llvm/lib/Support/CommandLine.cpp:1.82 Wed Jan 31 19:43:37 2007 +++ llvm/lib/Support/CommandLine.cpp Thu Apr 5 16:58:17 2007 @@ -75,12 +75,12 @@ // Basic, shared command line option processing machinery. // -static ManagedStatic > Options; +static ManagedStatic > OptionsMap; static ManagedStatic > PositionalOptions; static Option *getOption(const std::string &Str) { - std::map::iterator I = Options->find(Str); - return I != Options->end() ? I->second : 0; + std::map::iterator I = OptionsMap->find(Str); + return I != OptionsMap->end() ? I->second : 0; } static void AddArgument(const char *ArgName, Option *Opt) { @@ -89,23 +89,31 @@ << ArgName << "' defined more than once!\n"; } else { // Add argument to the argument map! - (*Options)[ArgName] = Opt; + (*OptionsMap)[ArgName] = Opt; } } -// RemoveArgument - It's possible that the argument is no longer in the map if -// options have already been processed and the map has been deleted! -// -static void RemoveArgument(const char *ArgName, Option *Opt) { - if (Options->empty()) return; - -#ifndef NDEBUG - // This disgusting HACK is brought to you courtesy of GCC 3.3.2, which ICE's - // If we pass ArgName directly into getOption here. - std::string Tmp = ArgName; - assert(getOption(Tmp) == Opt && "Arg not in map!"); -#endif - Options->erase(ArgName); +/// LookupOption - Lookup the option specified by the specified option on the +/// command line. If there is a value specified (after an equal sign) return +/// that as well. +static Option *LookupOption(const char *&Arg, const char *&Value) { + while (*Arg == '-') ++Arg; // Eat leading dashes + + const char *ArgEnd = Arg; + while (*ArgEnd && *ArgEnd != '=') + ++ArgEnd; // Scan till end of argument name. + + if (*ArgEnd == '=') // If we have an equals sign... + Value = ArgEnd+1; // Get the value, not the equals + + + if (*Arg == 0) return 0; + + // Look up the option. + std::map &Opts = *OptionsMap; + std::map::iterator I = + Opts.find(std::string(Arg, ArgEnd)); + return (I != Opts.end()) ? I->second : 0; } static inline bool ProvideOption(Option *Handler, const char *ArgName, @@ -276,32 +284,9 @@ free (*i); } -/// LookupOption - Lookup the option specified by the specified option on the -/// command line. If there is a value specified (after an equal sign) return -/// that as well. -static Option *LookupOption(const char *&Arg, const char *&Value) { - while (*Arg == '-') ++Arg; // Eat leading dashes - - const char *ArgEnd = Arg; - while (*ArgEnd && *ArgEnd != '=') - ++ArgEnd; // Scan till end of argument name. - - if (*ArgEnd == '=') // If we have an equals sign... - Value = ArgEnd+1; // Get the value, not the equals - - - if (*Arg == 0) return 0; - - // Look up the option. - std::map &Opts = *Options; - std::map::iterator I = - Opts.find(std::string(Arg, ArgEnd)); - return (I != Opts.end()) ? I->second : 0; -} - void cl::ParseCommandLineOptions(int &argc, char **argv, const char *Overview) { - assert((!Options->empty() || !PositionalOptions->empty()) && + assert((!OptionsMap->empty() || !PositionalOptions->empty()) && "No options specified, or ParseCommandLineOptions called more" " than once!"); sys::Path progname(argv[0]); @@ -314,7 +299,7 @@ ProgramOverview = Overview; bool ErrorParsing = false; - std::map &Opts = *Options; + std::map &Opts = *OptionsMap; std::vector &PositionalOpts = *PositionalOptions; // Check out the positional arguments to collect information about them. @@ -665,22 +650,6 @@ } } -void Option::removeArgument(const char *ArgStr) { - if (ArgStr[0]) - RemoveArgument(ArgStr, this); - - if (getFormattingFlag() == Positional) { - std::vector::iterator I = - std::find(PositionalOptions->begin(), PositionalOptions->end(), this); - assert(I != PositionalOptions->end() && "Arg not registered!"); - PositionalOptions->erase(I); - } else if (getNumOccurrencesFlag() == ConsumeAfter) { - assert(!PositionalOptions->empty() && (*PositionalOptions)[0] == this && - "Arg not registered correctly!"); - PositionalOptions->erase(PositionalOptions->begin()); - } -} - // getValueStr - Get the value description string, using "DefaultMsg" if nothing // has been specified yet. @@ -900,7 +869,7 @@ // Copy Options into a vector so we can sort them as we like... std::vector > Opts; - copy(Options->begin(), Options->end(), std::back_inserter(Opts)); + copy(OptionsMap->begin(), OptionsMap->end(), std::back_inserter(Opts)); // Eliminate Hidden or ReallyHidden arguments, depending on ShowHidden Opts.erase(std::remove_if(Opts.begin(), Opts.end(), @@ -955,7 +924,7 @@ MoreHelp->clear(); // Halt the program since help information was printed - Options->clear(); // Don't bother making option dtors remove from map. + OptionsMap->clear(); // Don't bother making option dtors remove from map. exit(1); } }; @@ -1001,7 +970,7 @@ if (OptionWasSpecified) { if (OverrideVersionPrinter == 0) { print(); - Options->clear(); // Don't bother making option dtors remove from map. + OptionsMap->clear();// Don't bother making option dtors remove from map. exit(1); } else { (*OverrideVersionPrinter)(); From sabre at nondot.org Thu Apr 5 17:21:56 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 5 Apr 2007 17:21:56 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/CommandLine.h Message-ID: <200704052221.l35MLuJj009239@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: CommandLine.h updated: 1.59 -> 1.60 --- Log message: eliminate a virtual method --- Diffs of the changes: (+39 -42) CommandLine.h | 81 +++++++++++++++++++++++++++------------------------------- 1 files changed, 39 insertions(+), 42 deletions(-) Index: llvm/include/llvm/Support/CommandLine.h diff -u llvm/include/llvm/Support/CommandLine.h:1.59 llvm/include/llvm/Support/CommandLine.h:1.60 --- llvm/include/llvm/Support/CommandLine.h:1.59 Thu Apr 5 16:58:17 2007 +++ llvm/include/llvm/Support/CommandLine.h Thu Apr 5 17:21:39 2007 @@ -138,9 +138,6 @@ virtual bool handleOccurrence(unsigned pos, const char *ArgName, const std::string &Arg) = 0; - virtual enum NumOccurrences getNumOccurrencesFlagDefault() const { - return Optional; - } virtual enum ValueExpected getValueExpectedFlagDefault() const { return ValueOptional; } @@ -163,9 +160,7 @@ const char *ValueStr; // String describing what the value of this option is inline enum NumOccurrences getNumOccurrencesFlag() const { - int NO = Flags & OccurrencesMask; - return NO ? static_cast(NO) - : getNumOccurrencesFlagDefault(); + return (enum NumOccurrences)(Flags & OccurrencesMask); } inline enum ValueExpected getValueExpectedFlag() const { int VE = Flags & ValueMask; @@ -211,8 +206,9 @@ void setMiscFlag(enum MiscFlags M) { setFlag(M, M); } void setPosition(unsigned pos) { Position = pos; } protected: - Option() : NumOccurrences(0), Flags(0), Position(0), - ArgStr(""), HelpStr(""), ValueStr("") {} + Option(enum NumOccurrences DefaultOccFlag) + : NumOccurrences(0), Flags(DefaultOccFlag), Position(0), + ArgStr(""), HelpStr(""), ValueStr("") {} public: // addArgument - Tell the system that this Option subclass will handle all @@ -809,34 +805,35 @@ // One option... template - opt(const M0t &M0) { + opt(const M0t &M0) : Option(Optional) { apply(M0, this); done(); } // Two options... template - opt(const M0t &M0, const M1t &M1) { + opt(const M0t &M0, const M1t &M1) : Option(Optional) { apply(M0, this); apply(M1, this); done(); } // Three options... template - opt(const M0t &M0, const M1t &M1, const M2t &M2) { + opt(const M0t &M0, const M1t &M1, const M2t &M2) : Option(Optional) { apply(M0, this); apply(M1, this); apply(M2, this); done(); } // Four options... template - opt(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3) { + opt(const M0t &M0, const M1t &M1, const M2t &M2, + const M3t &M3) : Option(Optional) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); done(); } // Five options... template opt(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4) { + const M4t &M4) : Option(Optional) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); done(); @@ -845,7 +842,7 @@ template opt(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5) { + const M4t &M4, const M5t &M5) : Option(Optional) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); done(); @@ -854,7 +851,7 @@ template opt(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5, const M6t &M6) { + const M4t &M4, const M5t &M5, const M6t &M6) : Option(Optional) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); done(); @@ -863,7 +860,8 @@ template opt(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5, const M6t &M6, const M7t &M7) { + const M4t &M4, const M5t &M5, const M6t &M6, + const M7t &M7) : Option(Optional) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); apply(M7, this); done(); @@ -926,9 +924,6 @@ std::vector Positions; ParserClass Parser; - virtual enum NumOccurrences getNumOccurrencesFlagDefault() const { - return ZeroOrMore; - } virtual enum ValueExpected getValueExpectedFlagDefault() const { return Parser.getValueExpectedFlagDefault(); } @@ -965,32 +960,33 @@ // One option... template - list(const M0t &M0) { + list(const M0t &M0) : Option(ZeroOrMore) { apply(M0, this); done(); } // Two options... template - list(const M0t &M0, const M1t &M1) { + list(const M0t &M0, const M1t &M1) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); done(); } // Three options... template - list(const M0t &M0, const M1t &M1, const M2t &M2) { + list(const M0t &M0, const M1t &M1, const M2t &M2) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); done(); } // Four options... template - list(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3) { + list(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3) + : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); done(); } // Five options... template list(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4) { + const M4t &M4) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); done(); @@ -999,7 +995,7 @@ template list(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5) { + const M4t &M4, const M5t &M5) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); done(); @@ -1008,7 +1004,7 @@ template list(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5, const M6t &M6) { + const M4t &M4, const M5t &M5, const M6t &M6) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); done(); @@ -1017,7 +1013,8 @@ template list(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5, const M6t &M6, const M7t &M7) { + const M4t &M4, const M5t &M5, const M6t &M6, + const M7t &M7) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); apply(M7, this); done(); @@ -1108,9 +1105,6 @@ std::vector Positions; ParserClass Parser; - virtual enum NumOccurrences getNumOccurrencesFlagDefault() const { - return ZeroOrMore; - } virtual enum ValueExpected getValueExpectedFlagDefault() const { return Parser.getValueExpectedFlagDefault(); } @@ -1147,32 +1141,33 @@ // One option... template - bits(const M0t &M0) { + bits(const M0t &M0) : Option(ZeroOrMore) { apply(M0, this); done(); } // Two options... template - bits(const M0t &M0, const M1t &M1) { + bits(const M0t &M0, const M1t &M1) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); done(); } // Three options... template - bits(const M0t &M0, const M1t &M1, const M2t &M2) { + bits(const M0t &M0, const M1t &M1, const M2t &M2) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); done(); } // Four options... template - bits(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3) { + bits(const M0t &M0, const M1t &M1, const M2t &M2, + const M3t &M3) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); done(); } // Five options... template bits(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4) { + const M4t &M4) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); done(); @@ -1181,7 +1176,7 @@ template bits(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5) { + const M4t &M4, const M5t &M5) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); done(); @@ -1190,7 +1185,7 @@ template bits(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5, const M6t &M6) { + const M4t &M4, const M5t &M5, const M6t &M6) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); done(); @@ -1199,7 +1194,8 @@ template bits(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5, const M6t &M6, const M7t &M7) { + const M4t &M4, const M5t &M5, const M6t &M6, + const M7t &M7) : Option(ZeroOrMore) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); apply(M7, this); done(); @@ -1239,26 +1235,27 @@ // One option... template - alias(const M0t &M0) : AliasFor(0) { + alias(const M0t &M0) : Option(Optional), AliasFor(0) { apply(M0, this); done(); } // Two options... template - alias(const M0t &M0, const M1t &M1) : AliasFor(0) { + alias(const M0t &M0, const M1t &M1) : Option(Optional), AliasFor(0) { apply(M0, this); apply(M1, this); done(); } // Three options... template - alias(const M0t &M0, const M1t &M1, const M2t &M2) : AliasFor(0) { + alias(const M0t &M0, const M1t &M1, const M2t &M2) + : Option(Optional), AliasFor(0) { apply(M0, this); apply(M1, this); apply(M2, this); done(); } // Four options... template alias(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3) - : AliasFor(0) { + : Option(Optional), AliasFor(0) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); done(); } From nicholas at mxc.ca Thu Apr 5 17:42:33 2007 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 05 Apr 2007 18:42:33 -0400 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/Optimize.cpp In-Reply-To: <200704051650.l35GobaC001421@zion.cs.uiuc.edu> References: <200704051650.l35GobaC001421@zion.cs.uiuc.edu> Message-ID: <46157B59.4060900@mxc.ca> Huh? What is the DCE pass doing that the global-dce isn't? Chris Lattner wrote: > > Changes in directory llvm/tools/llvm-ld: > > Optimize.cpp updated: 1.18 -> 1.19 > --- > Log message: > > run a late dce pass to clean up extra cruft. > > > --- > Diffs of the changes: (+1 -0) > > Optimize.cpp | 1 + > 1 files changed, 1 insertion(+) > > > Index: llvm/tools/llvm-ld/Optimize.cpp > diff -u llvm/tools/llvm-ld/Optimize.cpp:1.18 llvm/tools/llvm-ld/Optimize.cpp:1.19 > --- llvm/tools/llvm-ld/Optimize.cpp:1.18 Tue Mar 6 22:41:30 2007 > +++ llvm/tools/llvm-ld/Optimize.cpp Thu Apr 5 11:50:20 2007 > @@ -201,6 +201,7 @@ > if (!DisableOptimizations) { > addPass(Passes, createInstructionCombiningPass()); > addPass(Passes, createCFGSimplificationPass()); > + addPass(Passes, createDeadCodeEliminationPass()); > addPass(Passes, createGlobalDCEPass()); > } > > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > From reid at x10sys.com Thu Apr 5 17:58:02 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 5 Apr 2007 17:58:02 -0500 Subject: [llvm-commits] CVS: llvm/test/CodeGen/Generic/bit-intrinsics.ll Message-ID: <200704052258.l35Mw2vd010059@zion.cs.uiuc.edu> Changes in directory llvm/test/CodeGen/Generic: bit-intrinsics.ll updated: 1.1 -> 1.2 --- Log message: XFAIL this test for now. It will be a while before I can implement this intrinsic properly in SDISel. --- Diffs of the changes: (+1 -0) bit-intrinsics.ll | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/CodeGen/Generic/bit-intrinsics.ll diff -u llvm/test/CodeGen/Generic/bit-intrinsics.ll:1.1 llvm/test/CodeGen/Generic/bit-intrinsics.ll:1.2 --- llvm/test/CodeGen/Generic/bit-intrinsics.ll:1.1 Wed Apr 4 18:48:25 2007 +++ llvm/test/CodeGen/Generic/bit-intrinsics.ll Thu Apr 5 17:57:45 2007 @@ -1,6 +1,7 @@ ; Make sure this testcase is supported by all code generators. Either the ; intrinsic is supported natively or IntrinsicLowering provides it. ; RUN: llvm-as < %s | llc +; XFAIL: * declare i32 @llvm.bit.part.select.i32.i32(i32 %x, i32 %hi, i32 %lo) From sabre at nondot.org Thu Apr 5 19:09:56 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 5 Apr 2007 17:09:56 -0700 (PDT) Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/Optimize.cpp In-Reply-To: <46157B59.4060900@mxc.ca> References: <200704051650.l35GobaC001421@zion.cs.uiuc.edu> <46157B59.4060900@mxc.ca> Message-ID: On Thu, 5 Apr 2007, Nick Lewycky wrote: > Huh? What is the DCE pass doing that the global-dce isn't? globaldce deletes globals and functions, not code within functions. -Chris > Chris Lattner wrote: >> >> Changes in directory llvm/tools/llvm-ld: >> >> Optimize.cpp updated: 1.18 -> 1.19 >> --- >> Log message: >> >> run a late dce pass to clean up extra cruft. >> >> >> --- >> Diffs of the changes: (+1 -0) >> >> Optimize.cpp | 1 + >> 1 files changed, 1 insertion(+) >> >> >> Index: llvm/tools/llvm-ld/Optimize.cpp >> diff -u llvm/tools/llvm-ld/Optimize.cpp:1.18 llvm/tools/llvm-ld/Optimize.cpp:1.19 >> --- llvm/tools/llvm-ld/Optimize.cpp:1.18 Tue Mar 6 22:41:30 2007 >> +++ llvm/tools/llvm-ld/Optimize.cpp Thu Apr 5 11:50:20 2007 >> @@ -201,6 +201,7 @@ >> if (!DisableOptimizations) { >> addPass(Passes, createInstructionCombiningPass()); >> addPass(Passes, createCFGSimplificationPass()); >> + addPass(Passes, createDeadCodeEliminationPass()); >> addPass(Passes, createGlobalDCEPass()); >> } >> >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> > -Chris -- http://nondot.org/sabre/ http://llvm.org/ From reid at x10sys.com Thu Apr 5 19:05:25 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 5 Apr 2007 19:05:25 -0500 Subject: [llvm-commits] CVS: llvm-www/InTheNews.html Message-ID: <200704060005.l3605PKT011148@zion.cs.uiuc.edu> Changes in directory llvm-www: InTheNews.html updated: 1.14 -> 1.15 --- Log message: Add CliffHacks: Experimenting with LLVM. --- Diffs of the changes: (+3 -1) InTheNews.html | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm-www/InTheNews.html diff -u llvm-www/InTheNews.html:1.14 llvm-www/InTheNews.html:1.15 --- llvm-www/InTheNews.html:1.14 Sat Mar 24 02:08:03 2007 +++ llvm-www/InTheNews.html Thu Apr 5 19:05:08 2007 @@ -75,6 +75,8 @@ Info
  • FRESHports LLVM page +
  • + CliffHacks: Experimenting with LLVM
  • Technorati Tag LLVM
  • @@ -90,6 +92,6 @@ Valid HTML 4.01!
    - Last modified: $Date: 2007/03/24 07:08:03 $ + Last modified: $Date: 2007/04/06 00:05:08 $ From reid at x10sys.com Thu Apr 5 19:50:41 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 5 Apr 2007 19:50:41 -0500 Subject: [llvm-commits] CVS: llvm-www/InTheNews.html Message-ID: <200704060050.l360of9n011885@zion.cs.uiuc.edu> Changes in directory llvm-www: InTheNews.html updated: 1.15 -> 1.16 --- Log message: Use sections. Add section for bloggers. --- Diffs of the changes: (+30 -13) InTheNews.html | 43 ++++++++++++++++++++++++++++++------------- 1 files changed, 30 insertions(+), 13 deletions(-) Index: llvm-www/InTheNews.html diff -u llvm-www/InTheNews.html:1.15 llvm-www/InTheNews.html:1.16 --- llvm-www/InTheNews.html:1.15 Thu Apr 5 19:05:08 2007 +++ llvm-www/InTheNews.html Thu Apr 5 19:50:24 2007 @@ -12,6 +12,7 @@ +
    News Articles

    2007

    • 2007-03-20, @@ -61,22 +62,38 @@ Lambda the Ultimate, "Udell at OSCON: IronPython news", Ehud Lamm.
    +
    Blog Sites
    +

    Here are some blog sites that discuss LLVM

    + +
    LLVM In Distributions
    +

    The links below reference the status of LLVM in various operating system + distributions.

    +

    +

    Other LLVM References

    Here are some other links about LLVM, of general interest.

    • Wikipedia Article
    • -
    • LLVM's FreshMeat Page -
    • -
    • Google - BlogSearch For LLVM
    • -
    • Debian Package - Info
    • -
    • Ubuntu Package - Info
    • - FRESHports LLVM page - -
    • - CliffHacks: Experimenting with LLVM
    • +
    • LLVM's FreshMeat Page
    • Technorati Tag LLVM
    • @@ -92,6 +109,6 @@ Valid HTML 4.01!
      - Last modified: $Date: 2007/04/06 00:05:08 $ + Last modified: $Date: 2007/04/06 00:50:24 $ From reid at x10sys.com Thu Apr 5 21:02:42 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 5 Apr 2007 21:02:42 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp Message-ID: <200704060202.l3622gKN013155@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.177 -> 1.178 --- Log message: For PR1209: http://llvm.org/PR1209 : Implement Type class's ContainedTys without using a std::vector. --- Diffs of the changes: (+63 -17) Type.cpp | 80 +++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 63 insertions(+), 17 deletions(-) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.177 llvm/lib/VMCore/Type.cpp:1.178 --- llvm/lib/VMCore/Type.cpp:1.177 Wed Mar 21 21:14:48 2007 +++ llvm/lib/VMCore/Type.cpp Thu Apr 5 21:02:20 2007 @@ -63,11 +63,52 @@ std::string> > AbstractTypeDescriptions; Type::Type(const char *Name, TypeID id) - : ID(id), Abstract(false), SubclassData(0), RefCount(0), ForwardType(0) { + : ID(id), Abstract(false), SubclassData(0), RefCount(0), ForwardType(0), + NumContainedTys(0), ContainedTys(0) { assert(Name && Name[0] && "Should use other ctor if no name!"); (*ConcreteTypeDescriptions)[this] = Name; } +/// Because of the way Type subclasses are allocated, this function is necessary +/// to use the correct kind of "delete" operator to deallocate the Type object. +/// Some type objects (FunctionTy, StructTy) allocate additional space after +/// the space for their derived type to hold the contained types array of +/// PATypeHandles. Using this allocation scheme means all the PATypeHandles are +/// allocated with the type object, decreasing allocations and eliminating the +/// need for a std::vector to be used in the Type class itself. +/// @brief Type destruction function +void Type::destroy() const { + + // Structures and Functions allocate their contained types past the end of + // the type object itself. These need to be destroyed differently than the + // other types. + if (isa(this) || isa(this)) { + // First, make sure we destruct any PATypeHandles allocated by these + // subclasses. They must be manually destructed. + for (unsigned i = 0; i < NumContainedTys; ++i) + ContainedTys[i].PATypeHandle::~PATypeHandle(); + + // Now call the destructor for the subclass directly because we're going + // to delete this as an array of char. + if (isa(this)) + ((FunctionType*)this)->FunctionType::~FunctionType(); + else + ((StructType*)this)->StructType::~StructType(); + + // Finally, remove the memory as an array deallocation of the chars it was + // constructed from. + delete [] reinterpret_cast(this); + + return; + } + + // For all the other type subclasses, there is either no contained types or + // just one (all Sequentials). For Sequentials, the PATypeHandle is not + // allocated past the type object, its included directly in the SequentialType + // class. This means we can safely just do "normal" delete of this object and + // all the destructors that need to run will be run. + delete this; +} const Type *Type::getPrimitiveType(TypeID IDNumber) { switch (IDNumber) { @@ -330,7 +371,7 @@ // Structure indexes require 32-bit integer constants. if (V->getType() == Type::Int32Ty) if (const ConstantInt *CU = dyn_cast(V)) - return CU->getZExtValue() < ContainedTys.size(); + return CU->getZExtValue() < NumContainedTys; return false; } @@ -371,19 +412,19 @@ FunctionType::FunctionType(const Type *Result, const std::vector &Params, bool IsVarArgs, const ParamAttrsList &Attrs) - : DerivedType(FunctionTyID), isVarArgs(IsVarArgs) { + : DerivedType(FunctionTyID), isVarArgs(IsVarArgs), ParamAttrs(0) { + ContainedTys = reinterpret_cast(this+1); + NumContainedTys = Params.size() + 1; // + 1 for result type assert((Result->isFirstClassType() || Result == Type::VoidTy || isa(Result)) && "LLVM functions cannot return aggregates"); bool isAbstract = Result->isAbstract(); - ContainedTys.reserve(Params.size()+1); - ContainedTys.push_back(PATypeHandle(Result, this)); + new (&ContainedTys[0]) PATypeHandle(Result, this); for (unsigned i = 0; i != Params.size(); ++i) { assert((Params[i]->isFirstClassType() || isa(Params[i])) && "Function arguments must be value types!"); - - ContainedTys.push_back(PATypeHandle(Params[i], this)); + new (&ContainedTys[i+1]) PATypeHandle(Params[i],this); isAbstract |= Params[i]->isAbstract(); } @@ -400,12 +441,13 @@ StructType::StructType(const std::vector &Types, bool isPacked) : CompositeType(StructTyID) { + ContainedTys = reinterpret_cast(this + 1); + NumContainedTys = Types.size(); setSubclassData(isPacked); - ContainedTys.reserve(Types.size()); bool isAbstract = false; for (unsigned i = 0; i < Types.size(); ++i) { assert(Types[i] != Type::VoidTy && "Void type for structure field!!"); - ContainedTys.push_back(PATypeHandle(Types[i], this)); + new (&ContainedTys[i]) PATypeHandle(Types[i], this); isAbstract |= Types[i]->isAbstract(); } @@ -449,17 +491,17 @@ // another (more concrete) type, we must eliminate all references to other // types, to avoid some circular reference problems. void DerivedType::dropAllTypeUses() { - if (!ContainedTys.empty()) { + if (NumContainedTys != 0) { // The type must stay abstract. To do this, we insert a pointer to a type // that will never get resolved, thus will always be abstract. static Type *AlwaysOpaqueTy = OpaqueType::get(); static PATypeHolder Holder(AlwaysOpaqueTy); ContainedTys[0] = AlwaysOpaqueTy; - // Change the rest of the types to be intty's. It doesn't matter what we + // Change the rest of the types to be Int32Ty's. It doesn't matter what we // pick so long as it doesn't point back to this type. We choose something // concrete to avoid overhead for adding to AbstracTypeUser lists and stuff. - for (unsigned i = 1, e = ContainedTys.size(); i != e; ++i) + for (unsigned i = 1, e = NumContainedTys; i != e; ++i) ContainedTys[i] = Type::Int32Ty; } } @@ -812,7 +854,7 @@ unsigned OldTypeHash = ValType::hashTypeStructure(Ty); // Find the type element we are refining... and change it now! - for (unsigned i = 0, e = Ty->ContainedTys.size(); i != e; ++i) + for (unsigned i = 0, e = Ty->getNumContainedTypes(); i != e; ++i) if (Ty->ContainedTys[i] == OldType) Ty->ContainedTys[i] = NewType; unsigned NewTypeHash = ValType::hashTypeStructure(Ty); @@ -1047,7 +1089,9 @@ FunctionType *MT = FunctionTypes->get(VT); if (MT) return MT; - MT = new FunctionType(ReturnType, Params, isVarArg, *TheAttrs); + MT = (FunctionType*) new char[sizeof(FunctionType) + + sizeof(PATypeHandle)*(Params.size()+1)]; + new (MT) FunctionType(ReturnType, Params, isVarArg, *TheAttrs); FunctionTypes->add(VT, MT); #ifdef DEBUG_MERGE_TYPES @@ -1214,7 +1258,10 @@ if (ST) return ST; // Value not found. Derive a new type! - StructTypes->add(STV, ST = new StructType(ETypes, isPacked)); + ST = (StructType*) new char[sizeof(StructType) + + sizeof(PATypeHandle) * ETypes.size()]; + new (ST) StructType(ETypes, isPacked); + StructTypes->add(STV, ST); #ifdef DEBUG_MERGE_TYPES DOUT << "Derived new type: " << *ST << "\n"; @@ -1304,11 +1351,10 @@ DOUT << "DELETEing unused abstract type: <" << *this << ">[" << (void*)this << "]" << "\n"; #endif - delete this; // No users of this abstract type! + this->destroy(); } } - // refineAbstractTypeTo - This function is used when it is discovered that // the 'this' abstract type is actually equivalent to the NewType specified. // This causes all users of 'this' to switch to reference the more concrete type From reid at x10sys.com Thu Apr 5 21:02:42 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 5 Apr 2007 21:02:42 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/DerivedTypes.h Type.h Message-ID: <200704060202.l3622gCJ013153@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: DerivedTypes.h updated: 1.89 -> 1.90 Type.h updated: 1.105 -> 1.106 --- Log message: For PR1209: http://llvm.org/PR1209 : Implement Type class's ContainedTys without using a std::vector. --- Diffs of the changes: (+50 -30) DerivedTypes.h | 27 +++++++++++++++------------ Type.h | 53 +++++++++++++++++++++++++++++++++++------------------ 2 files changed, 50 insertions(+), 30 deletions(-) Index: llvm/include/llvm/DerivedTypes.h diff -u llvm/include/llvm/DerivedTypes.h:1.89 llvm/include/llvm/DerivedTypes.h:1.90 --- llvm/include/llvm/DerivedTypes.h:1.89 Fri Mar 23 13:44:11 2007 +++ llvm/include/llvm/DerivedTypes.h Thu Apr 5 21:02:19 2007 @@ -163,6 +163,7 @@ bool IsVarArgs, const ParamAttrsList &Attrs); public: + virtual ~FunctionType() { delete ParamAttrs; } /// FunctionType::get - This static method is the primary way of constructing /// a FunctionType. /// @@ -179,9 +180,9 @@ inline bool isVarArg() const { return isVarArgs; } inline const Type *getReturnType() const { return ContainedTys[0]; } - typedef std::vector::const_iterator param_iterator; - param_iterator param_begin() const { return ContainedTys.begin()+1; } - param_iterator param_end() const { return ContainedTys.end(); } + typedef Type::subtype_iterator param_iterator; + param_iterator param_begin() const { return ContainedTys + 1; } + param_iterator param_end() const { return &ContainedTys[NumContainedTys]; } // Parameter type accessors... const Type *getParamType(unsigned i) const { return ContainedTys[i+1]; } @@ -189,7 +190,7 @@ /// getNumParams - Return the number of fixed parameters this function type /// requires. This does not consider varargs. /// - unsigned getNumParams() const { return unsigned(ContainedTys.size()-1); } + unsigned getNumParams() const { return NumContainedTys - 1; } bool isStructReturn() const { return (getNumParams() && paramHasAttr(1, StructRetAttribute)); @@ -265,14 +266,14 @@ bool isPacked=false); // Iterator access to the elements - typedef std::vector::const_iterator element_iterator; - element_iterator element_begin() const { return ContainedTys.begin(); } - element_iterator element_end() const { return ContainedTys.end(); } + typedef Type::subtype_iterator element_iterator; + element_iterator element_begin() const { return ContainedTys; } + element_iterator element_end() const { return &ContainedTys[NumContainedTys];} // Random access to the elements - unsigned getNumElements() const { return unsigned(ContainedTys.size()); } + unsigned getNumElements() const { return NumContainedTys; } const Type *getElementType(unsigned N) const { - assert(N < ContainedTys.size() && "Element number out of range!"); + assert(N < NumContainedTys && "Element number out of range!"); return ContainedTys[N]; } @@ -305,12 +306,14 @@ /// components out in memory identically. /// class SequentialType : public CompositeType { + PATypeHandle ContainedType; ///< Storage for the single contained type SequentialType(const SequentialType &); // Do not implement! const SequentialType &operator=(const SequentialType &); // Do not implement! protected: - SequentialType(TypeID TID, const Type *ElType) : CompositeType(TID) { - ContainedTys.reserve(1); - ContainedTys.push_back(PATypeHandle(ElType, this)); + SequentialType(TypeID TID, const Type *ElType) + : CompositeType(TID), ContainedType(ElType, this) { + ContainedTys = &ContainedType; + NumContainedTys = 1; } public: Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.105 llvm/include/llvm/Type.h:1.106 --- llvm/include/llvm/Type.h:1.105 Fri Mar 23 13:44:11 2007 +++ llvm/include/llvm/Type.h Thu Apr 5 21:02:19 2007 @@ -101,12 +101,18 @@ mutable unsigned RefCount; const Type *getForwardedTypeInternal() const; + + // Some Type instances are allocated as arrays, some aren't. So we provide + // this method to get the right kind of destruction for the type of Type. + void destroy() const; // const is a lie, this does "delete this"! + protected: Type(const char *Name, TypeID id); explicit Type(TypeID id) : ID(id), Abstract(false), SubclassData(0), - RefCount(0), ForwardType(0) {} + RefCount(0), ForwardType(0), NumContainedTys(0), + ContainedTys(0) {} virtual ~Type() { - assert(AbstractTypeUsers.empty()); + assert(AbstractTypeUsers.empty() && "Abstract types remain"); } /// Types can become nonabstract later, if they are refined. @@ -123,19 +129,31 @@ /// to the more refined type. Only abstract types can be forwarded. mutable const Type *ForwardType; - /// ContainedTys - The list of types contained by this one. For example, this - /// includes the arguments of a function type, the elements of the structure, - /// the pointee of a pointer, etc. Note that keeping this vector in the Type - /// class wastes some space for types that do not contain anything (such as - /// primitive types). However, keeping it here allows the subtype_* members - /// to be implemented MUCH more efficiently, and dynamically very few types do - /// not contain any elements (most are derived). - std::vector ContainedTys; /// AbstractTypeUsers - Implement a list of the users that need to be notified /// if I am a type, and I get resolved into a more concrete type. /// mutable std::vector AbstractTypeUsers; + + /// NumContainedTys - Keeps track of how many PATypeHandle instances there + /// are at the end of this type instance for the list of contained types. It + /// is the subclasses responsibility to set this up. Set to 0 if there are no + /// contained types in this type. + unsigned NumContainedTys; + + /// ContainedTys - A pointer to the array of Types (PATypeHandle) contained + /// by this Type. For example, this includes the arguments of a function + /// type, the elements of a structure, the pointee of a pointer, the element + /// type of an array, etc. This pointer may be 0 for types that don't + /// contain other types (Integer, Double, Float). In general, the subclass + /// should arrange for space for the PATypeHandles to be included in the + /// allocation of the type object and set this pointer to the address of the + /// first element. This allows the Type class to manipulate the ContainedTys + /// without understanding the subclass's placement for this array. keeping + /// it here also allows the subtype_* members to be implemented MUCH more + /// efficiently, and dynamically very few types do not contain any elements. + PATypeHandle *ContainedTys; + public: void print(std::ostream &O) const; void print(std::ostream *O) const { if (O) print(*O); } @@ -235,23 +253,22 @@ //===--------------------------------------------------------------------===// // Type Iteration support // - typedef std::vector::const_iterator subtype_iterator; - subtype_iterator subtype_begin() const { return ContainedTys.begin(); } - subtype_iterator subtype_end() const { return ContainedTys.end(); } + typedef PATypeHandle *subtype_iterator; + subtype_iterator subtype_begin() const { return ContainedTys; } + subtype_iterator subtype_end() const { return &ContainedTys[NumContainedTys];} /// getContainedType - This method is used to implement the type iterator /// (defined a the end of the file). For derived types, this returns the /// types 'contained' in the derived type. /// const Type *getContainedType(unsigned i) const { - assert(i < ContainedTys.size() && "Index out of range!"); - return ContainedTys[i]; + assert(i < NumContainedTys && "Index out of range!"); + return ContainedTys[i].get(); } /// getNumContainedTypes - Return the number of types in the derived type. /// - typedef std::vector::size_type size_type; - size_type getNumContainedTypes() const { return ContainedTys.size(); } + unsigned getNumContainedTypes() const { return NumContainedTys; } //===--------------------------------------------------------------------===// // Static members exported by the Type class itself. Useful for getting @@ -282,7 +299,7 @@ // If this is the last PATypeHolder using this object, and there are no // PATypeHandles using it, the type is dead, delete it now. if (--RefCount == 0 && AbstractTypeUsers.empty()) - delete this; + this->destroy(); } /// addAbstractTypeUser - Notify an abstract type that there is a new user of From reid at x10sys.com Thu Apr 5 21:32:27 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 5 Apr 2007 21:32:27 -0500 Subject: [llvm-commits] CVS: llvm-www/InTheNews.html Message-ID: <200704060232.l362WRYj013723@zion.cs.uiuc.edu> Changes in directory llvm-www: InTheNews.html updated: 1.16 -> 1.17 --- Log message: Add more blogs. --- Diffs of the changes: (+6 -12) InTheNews.html | 18 ++++++------------ 1 files changed, 6 insertions(+), 12 deletions(-) Index: llvm-www/InTheNews.html diff -u llvm-www/InTheNews.html:1.16 llvm-www/InTheNews.html:1.17 --- llvm-www/InTheNews.html:1.16 Thu Apr 5 19:50:24 2007 +++ llvm-www/InTheNews.html Thu Apr 5 21:32:10 2007 @@ -63,7 +63,6 @@ Lamm.
    Blog Sites
    -

    Here are some blog sites that discuss LLVM

  • -
  • CliffHacks (Cliff L. Biffle) -
  • +
  • WWDC: LLVM & 3D on the Mac
  • +
  • Homebrew LLVM 1.8 VC8 patch
  • -
    LLVM In Distributions
    -

    The links below reference the status of LLVM in various operating system - distributions.

    +
    Distributions
    -

    -

    Other LLVM References
    -

    Here are some other links about LLVM, of general interest.

    +
    Other References
    • Wikipedia Article
    • LLVM's FreshMeat Page
    • @@ -109,6 +103,6 @@ Valid HTML 4.01!
      - Last modified: $Date: 2007/04/06 00:50:24 $ + Last modified: $Date: 2007/04/06 02:32:10 $ From reid at x10sys.com Thu Apr 5 21:55:42 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 5 Apr 2007 21:55:42 -0500 Subject: [llvm-commits] CVS: llvm-www/SVNMigration.html Message-ID: <200704060255.l362tgg6014096@zion.cs.uiuc.edu> Changes in directory llvm-www: SVNMigration.html updated: 1.4 -> 1.5 --- Log message: Update status about SVN Migration. --- Diffs of the changes: (+8 -1) SVNMigration.html | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletion(-) Index: llvm-www/SVNMigration.html diff -u llvm-www/SVNMigration.html:1.4 llvm-www/SVNMigration.html:1.5 --- llvm-www/SVNMigration.html:1.4 Tue Apr 3 00:02:58 2007 +++ llvm-www/SVNMigration.html Thu Apr 5 21:55:25 2007 @@ -4,6 +4,13 @@

      This document contains notes about the planned migration of the CVS code repository to Subversion.

      +

      Current Status as 04.05.2007
      The migration is awaiting some + research that needs to be done by UIUC's Technical Services Group. A few + issues were raised that could lead to loss of functionality for the project if + not addressed carefully. We have been building a Subversion repository on a + test machine every night for a week now and that automated process seems to be + working smoothly. The nightly test with check-out from Subversion is also + working smoothly.

      @@ -147,6 +154,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
      Last modified: $Date: 2007/04/03 05:02:58 $ +
      Last modified: $Date: 2007/04/06 02:55:25 $ From reid at x10sys.com Thu Apr 5 22:20:04 2007 From: reid at x10sys.com (Reid Spencer) Date: Thu, 5 Apr 2007 22:20:04 -0500 Subject: [llvm-commits] CVS: llvm-www/SVNMigration.html Message-ID: <200704060320.l363K4ZV014508@zion.cs.uiuc.edu> Changes in directory llvm-www: SVNMigration.html updated: 1.5 -> 1.6 --- Log message: The Adaptive repository won't be migrated. --- Diffs of the changes: (+1 -2) SVNMigration.html | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm-www/SVNMigration.html diff -u llvm-www/SVNMigration.html:1.5 llvm-www/SVNMigration.html:1.6 --- llvm-www/SVNMigration.html:1.5 Thu Apr 5 21:55:25 2007 +++ llvm-www/SVNMigration.html Thu Apr 5 22:19:47 2007 @@ -30,7 +30,6 @@
    llvm-javajava
    llvm-tvtelevision
    llvm-poolallocpoolalloc
    Adaptiveadaptive
    nightlytest-serversidenightly-test

    NOTE: Due to synchronization of commits in the conversion process, @@ -154,6 +153,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/04/06 02:55:25 $ +
    Last modified: $Date: 2007/04/06 03:19:47 $ From sabre at nondot.org Thu Apr 5 23:04:15 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 5 Apr 2007 23:04:15 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704060404.l3644Fpd015236@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.3 -> 1.4 --- Log message: Yes it is silly, but we can't talk about "unreleased products" --- Diffs of the changes: (+2 -2) Users.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.3 llvm-www/Users.html:1.4 --- llvm-www/Users.html:1.3 Wed Apr 4 09:09:36 2007 +++ llvm-www/Users.html Thu Apr 5 23:03:58 2007 @@ -24,7 +24,7 @@ Apple Computer - OpenGL Engine in MacOS X (Leopard) + OpenGL Engine @@ -226,6 +226,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
    LLVM Development List
    - Last modified: $Date: 2007/04/04 14:09:36 $ + Last modified: $Date: 2007/04/06 04:03:58 $ From sabre at nondot.org Fri Apr 6 00:30:27 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 00:30:27 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704060530.l365URn7017083@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.4 -> 1.5 --- Log message: contrary to popular believe, llvm.org is not vikram's research group web page. --- Diffs of the changes: (+2 -2) Users.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.4 llvm-www/Users.html:1.5 --- llvm-www/Users.html:1.4 Thu Apr 5 23:03:58 2007 +++ llvm-www/Users.html Fri Apr 6 00:30:10 2007 @@ -129,7 +129,7 @@ University of Illinois at Urbana-Champaign - Vikram Adve's Research Group + Vikram Adve's Research Group All LLVM Group Research Projects @@ -226,6 +226,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
    LLVM Development List
    - Last modified: $Date: 2007/04/06 04:03:58 $ + Last modified: $Date: 2007/04/06 05:30:10 $ From sabre at nondot.org Fri Apr 6 00:41:29 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 00:41:29 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704060541.l365fTuC017331@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.5 -> 1.6 --- Log message: comment this out for now --- Diffs of the changes: (+3 -4) Users.html | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.5 llvm-www/Users.html:1.6 --- llvm-www/Users.html:1.5 Fri Apr 6 00:30:10 2007 +++ llvm-www/Users.html Fri Apr 6 00:41:11 2007 @@ -38,11 +38,11 @@ Electronic System Level (ESL) to Silicon - + @@ -123,7 +123,6 @@ - University of Illinois at Urbana-Champaign @@ -226,6 +225,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
    LLVM Development List
    - Last modified: $Date: 2007/04/06 05:30:10 $ + Last modified: $Date: 2007/04/06 05:41:11 $ From sabre at nondot.org Fri Apr 6 01:18:11 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 01:18:11 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704060618.l366IB1c017981@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.49 -> 1.50 --- Log message: no comma --- Diffs of the changes: (+10 -10) DevMtgMay2007.html | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.49 llvm-www/DevMtgMay2007.html:1.50 --- llvm-www/DevMtgMay2007.html:1.49 Thu Apr 5 16:07:22 2007 +++ llvm-www/DevMtgMay2007.html Fri Apr 6 01:17:54 2007 @@ -122,7 +122,7 @@

    - + @@ -238,14 +238,14 @@ - + - + - + - +
    SpeakerTopic
    Chris Lattner - Apple, Inc.
    Chris Lattner - Apple Inc. Using LLVM to improve OpenGL
    Sarah Thompson - NASA, Ames Research Center
    Bob ArcherAdobe Systems Incorporated.
    Owen AndersonIndependent
    Ryan BrownGoogle
    Evan ChengApple, Inc.
    Evan ChengApple Inc.
    Jeff CohenIndependent
    Han GaoAdobe Systems Incorporated.
    Stuart HastingsApple, Inc.
    Stuart HastingsApple Inc.
    Robert HundtGoogle
    Dale JohannesenApple, Inc.
    Dale JohannesenApple Inc.
    Christopher LambAgeia Technologies, Inc.
    Chris LattnerApple, Inc.
    Chris LattnerApple Inc.
    Andrew LenharthUIUC
    @@ -253,19 +253,19 @@ - + - - + + - +
    Confirmed Attendees (Ler-Z)
    NameOrganization
    Julien LerougeApple, Inc.
    Julien LerougeApple Inc.
    Nick LewyckyIndependent
    Gabe McArthurIndependent
    Paul McJonesAdobe Systems Incorporated.
    Scott MichelAerospace
    Steve NaroffApple, Inc.
    Devang PatelApple, Inc.
    Steve NaroffApple Inc.
    Devang PatelApple Inc.
    Fernando Magno Quintao PereiraUCLA
    Chuck RoseAdobe Systems Incorporated.
    Mark SchimmelWind River
    Reid SpencerIndependent
    Sarah ThompsonNASA, Ames Research Center
    Bill WendlingApple, Inc.
    Bill WendlingApple Inc.
    Marcel WeiherMetaObject
    @@ -289,6 +289,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/04/05 21:07:22 $ +
    Last modified: $Date: 2007/04/06 06:17:54 $ From sabre at nondot.org Fri Apr 6 01:21:59 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 01:21:59 -0500 Subject: [llvm-commits] CVS: llvm-www/InTheNews.html Message-ID: <200704060621.l366Lx0l018128@zion.cs.uiuc.edu> Changes in directory llvm-www: InTheNews.html updated: 1.17 -> 1.18 --- Log message: Remove the obviously wrong articles for now. --- Diffs of the changes: (+7 -7) InTheNews.html | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) Index: llvm-www/InTheNews.html diff -u llvm-www/InTheNews.html:1.17 llvm-www/InTheNews.html:1.18 --- llvm-www/InTheNews.html:1.17 Thu Apr 5 21:32:10 2007 +++ llvm-www/InTheNews.html Fri Apr 6 01:21:42 2007 @@ -18,14 +18,14 @@
  • 2007-03-20, ars technica, "Apple putting LLVM to good use" (Bossa Conference), Erik Kennedy.
  • -
  • 2007-02-01, + + +
  • 2007-01-23, free pascal community, "What About LLVM?", Nicola Lugato
  • 2007-01-22, @@ -103,6 +103,6 @@ Valid HTML 4.01!
    - Last modified: $Date: 2007/04/06 02:32:10 $ + Last modified: $Date: 2007/04/06 06:21:42 $ From sabre at nondot.org Fri Apr 6 01:51:29 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 01:51:29 -0500 Subject: [llvm-commits] CVS: llvm-test/External/Nurbs/Makefile Message-ID: <200704060651.l366pTIT018792@zion.cs.uiuc.edu> Changes in directory llvm-test/External/Nurbs: Makefile updated: 1.1 -> 1.2 --- Log message: After changing this from an i/o bound app to a cpu bound app, we need to increase the problem size :) --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/External/Nurbs/Makefile diff -u llvm-test/External/Nurbs/Makefile:1.1 llvm-test/External/Nurbs/Makefile:1.2 --- llvm-test/External/Nurbs/Makefile:1.1 Mon Apr 17 02:59:47 2006 +++ llvm-test/External/Nurbs/Makefile Fri Apr 6 01:51:12 2007 @@ -9,6 +9,6 @@ LDFLAGS = -lstdc++ LIBS += -lstdc++ -RUN_OPTIONS = /k all timed /t 500 /vsteps 64 /usteps 64 /vcp 20 /ucp 20 +RUN_OPTIONS = /k all timed /t 500 /vsteps 192 /usteps 192 /vcp 20 /ucp 20 include $(LEVEL)/MultiSource/Makefile.multisrc From criswell at cs.uiuc.edu Fri Apr 6 10:14:20 2007 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 6 Apr 2007 10:14:20 -0500 Subject: [llvm-commits] [see] CVS: llvm/lib/Transforms/IPO/Inliner.cpp Message-ID: <200704061514.l36FEKhR004145@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: Inliner.cpp updated: 1.30.2.1 -> 1.30.2.1.2.1 --- Log message: Adde dthe no-inline option to force the inliner not to inline specified functions. --- Diffs of the changes: (+25 -1) Inliner.cpp | 26 +++++++++++++++++++++++++- 1 files changed, 25 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/IPO/Inliner.cpp diff -u llvm/lib/Transforms/IPO/Inliner.cpp:1.30.2.1 llvm/lib/Transforms/IPO/Inliner.cpp:1.30.2.1.2.1 --- llvm/lib/Transforms/IPO/Inliner.cpp:1.30.2.1 Thu Nov 9 18:06:24 2006 +++ llvm/lib/Transforms/IPO/Inliner.cpp Fri Apr 6 10:14:03 2007 @@ -33,9 +33,24 @@ cl::opt // FIXME: 200 is VERY conservative InlineLimit("inline-threshold", cl::Hidden, cl::init(200), cl::desc("Control the amount of inlining to perform (default = 200)")); + + // NoInlineList - A list of functions that should *not* be inlined, + // regardless of inlining policy + cl::list + NoInlineList("no-inline", cl::value_desc("list"), + cl::desc("A list of functions that should not be inlined"), + cl::CommaSeparated); + + // A set of the functions to preserve + std::set PreserveFuncs; } -Inliner::Inliner() : InlineThreshold(InlineLimit) {} +Inliner::Inliner() : InlineThreshold(InlineLimit) { + // Create a set that contains a list of the functions that will not be + // inlined. + if (!(NoInlineList.empty())) + PreserveFuncs.insert (NoInlineList.begin(), NoInlineList.end()); +} // InlineCallIfPossible - If it is possible to inline the specified call site, // do so and update the CallGraph for this operation. @@ -123,6 +138,15 @@ continue; } + // Do not inline functions that we have explicity said we don't want to + // inline. + if (!PreserveFuncs.count ((Callee->getName()))) { + std::swap(CallSites[CSi], CallSites.back()); + CallSites.pop_back(); + --CSi; + continue; + } + // If the policy determines that we should inline this function, // try to do so. CallSite CS = CallSites[CSi]; From reid at x10sys.com Fri Apr 6 10:43:27 2007 From: reid at x10sys.com (Reid Spencer) Date: Fri, 6 Apr 2007 10:43:27 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704061543.l36FhRCC004645@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.6 -> 1.7 --- Log message: Add a link that Kenneth Hoste requested. --- Diffs of the changes: (+2 -2) Users.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.6 llvm-www/Users.html:1.7 --- llvm-www/Users.html:1.6 Fri Apr 6 00:41:11 2007 +++ llvm-www/Users.html Fri Apr 6 10:43:10 2007 @@ -78,7 +78,7 @@ Ghent University - Kenneth Hoste + Kenneth Hoste Instrumentation of software @@ -225,6 +225,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
    LLVM Development List
    - Last modified: $Date: 2007/04/06 05:41:11 $ + Last modified: $Date: 2007/04/06 15:43:10 $ From reid at x10sys.com Fri Apr 6 10:49:17 2007 From: reid at x10sys.com (Reid Spencer) Date: Fri, 6 Apr 2007 10:49:17 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704061549.l36FnHIh004841@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.7 -> 1.8 --- Log message: Add Bram Adams and his project. --- Diffs of the changes: (+7 -1) Users.html | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.7 llvm-www/Users.html:1.8 --- llvm-www/Users.html:1.7 Fri Apr 6 10:43:10 2007 +++ llvm-www/Users.html Fri Apr 6 10:49:00 2007 @@ -83,6 +83,12 @@ + GH-SEL, INTEC, Ghent University + Bram Adams + Aspect weaver for an AOP-language for C called Aspicere2 + + + Rice University Keith Cooper's Research Group @@ -225,6 +231,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
    LLVM Development List
    - Last modified: $Date: 2007/04/06 15:43:10 $ + Last modified: $Date: 2007/04/06 15:49:00 $ From djg at cray.com Fri Apr 6 11:01:42 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 6 Apr 2007 11:01:42 -0500 Subject: [llvm-commits] [patch] minor instcombine+bitcast improvement Message-ID: <20070406160142.GU15678@village.us.cray.com> This patch makes instcombine convert this: %t = getelementptr float* cast ([2 x i32]* %str to float*), i32 %V into this: %t = getelementptr float* cast ([2 x i32]* %str to [2 x float]*), i32 0, i32 %V instead of this: %s = getelementptr [2 x i32]* %str, i32 0, i32 %V %t = bitcast i32* %s to float* I'm not yet familiar with instcombine's canonicalization style; is this a desireable change? It doesn't cause any regressions for me. Dan -- Dan Gohman, Cray Inc. -------------- next part -------------- Index: InstructionCombining.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/InstructionCombining.cpp,v retrieving revision 1.731 diff -t -d -u -p -5 -r1.731 InstructionCombining.cpp --- InstructionCombining.cpp +++ InstructionCombining.cpp @@ -8113,23 +8113,24 @@ Instruction *InstCombiner::visitGetEleme // is a leading zero) we can fold the cast into this GEP. GEP.setOperand(0, X); return &GEP; } } else if (GEP.getNumOperands() == 2) { - // Transform things like: - // %t = getelementptr ubyte* cast ([2 x int]* %str to uint*), uint %V - // into: %t1 = getelementptr [2 x int*]* %str, int 0, uint %V; cast + // transform: GEP cast ([2 x int]* %str to float*), uint %V + // into : GEP cast ([2 x int]* %str to [2 x float]*), int 0, uint %V const Type *SrcElTy = cast(X->getType())->getElementType(); const Type *ResElTy=cast(PtrOp->getType())->getElementType(); if (isa(SrcElTy) && TD->getTypeSize(cast(SrcElTy)->getElementType()) == TD->getTypeSize(ResElTy)) { + const Type *NewArrayTy = + ArrayType::get(ResElTy, + cast(SrcElTy)->getNumElements()); Value *V = InsertNewInstBefore( - new GetElementPtrInst(X, Constant::getNullValue(Type::Int32Ty), - GEP.getOperand(1), GEP.getName()), GEP); - // V and GEP are both pointer types --> BitCast - return new BitCastInst(V, GEP.getType()); + new BitCastInst(X, PointerType::get(NewArrayTy)), GEP); + return new GetElementPtrInst(V, Constant::getNullValue(Type::Int32Ty), + GEP.getOperand(1), GEP.getName()); } // Transform things like: // getelementptr sbyte* cast ([100 x double]* X to sbyte*), int %tmp // (where tmp = 8*tmp2) into: From sabre at nondot.org Fri Apr 6 11:53:08 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 11:53:08 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704061653.l36Gr8NW006050@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.50 -> 1.51 --- Log message: update directions to go to cupertino inn instead of apple --- Diffs of the changes: (+7 -7) DevMtgMay2007.html | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.50 llvm-www/DevMtgMay2007.html:1.51 --- llvm-www/DevMtgMay2007.html:1.50 Fri Apr 6 01:17:54 2007 +++ llvm-www/DevMtgMay2007.html Fri Apr 6 11:52:51 2007 @@ -190,12 +190,12 @@ @@ -289,6 +289,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"> Valid HTML 4.01! -
    Last modified: $Date: 2007/04/06 06:17:54 $ +
    Last modified: $Date: 2007/04/06 16:52:51 $ From reid at x10sys.com Fri Apr 6 12:39:59 2007 From: reid at x10sys.com (Reid Spencer) Date: Fri, 6 Apr 2007 12:39:59 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704061739.l36HdxPm007210@zion.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.8 -> 1.9 --- Log message: Update links per Bram Adams' request. --- Diffs of the changes: (+5 -4) Users.html | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.8 llvm-www/Users.html:1.9 --- llvm-www/Users.html:1.8 Fri Apr 6 10:49:00 2007 +++ llvm-www/Users.html Fri Apr 6 12:39:42 2007 @@ -83,9 +83,10 @@ - GH-SEL, INTEC, Ghent University - Bram Adams - Aspect weaver for an AOP-language for C called Aspicere2 + GH-SEL, INTEC, Ghent University + Bram Adams + Aspect weaver for an AOP-language for C called + Aspicere2 @@ -231,6 +232,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
    LLVM Development List
    - Last modified: $Date: 2007/04/06 15:49:00 $ + Last modified: $Date: 2007/04/06 17:39:42 $ From clattner at apple.com Fri Apr 6 12:45:19 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 6 Apr 2007 10:45:19 -0700 Subject: [llvm-commits] [patch] minor instcombine+bitcast improvement In-Reply-To: <20070406160142.GU15678@village.us.cray.com> References: <20070406160142.GU15678@village.us.cray.com> Message-ID: <01C490A0-3495-4DD0-86EA-A9EA08D06F2F@apple.com> On Apr 6, 2007, at 9:01 AM, Dan Gohman wrote: > This patch makes instcombine convert this: > > %t = getelementptr float* cast ([2 x i32]* %str to float*), > i32 %V > > into this: > > %t = getelementptr float* cast ([2 x i32]* %str to [2 x float] > *), i32 0, i32 %V > > instead of this: > > %s = getelementptr [2 x i32]* %str, i32 0, i32 %V > %t = bitcast i32* %s to float* > > I'm not yet familiar with instcombine's canonicalization style; is > this > a desireable change? It doesn't cause any regressions for me. I don't have a strong preference either way. Is there a reason that you prefer this style to the previous one? -Chris From sabre at nondot.org Fri Apr 6 12:47:31 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 12:47:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200704061747.l36HlV2x007482@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.404 -> 1.405 --- Log message: minor comment fix --- Diffs of the changes: (+1 -1) SelectionDAGISel.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.404 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.405 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.404 Wed Apr 4 20:20:18 2007 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Apr 6 12:47:14 2007 @@ -2840,7 +2840,7 @@ // Okay, this register is good, we can use it. ++NumAllocated; - // If we allocated enough consecutive + // If we allocated enough consecutive registers, succeed. if (NumAllocated == NumRegs) { unsigned RegStart = (i-NumAllocated)+1; unsigned RegEnd = i+1; From rspencer at reidspencer.com Fri Apr 6 12:51:42 2007 From: rspencer at reidspencer.com (Reid Spencer) Date: Fri, 06 Apr 2007 17:51:42 +0000 Subject: [llvm-commits] [patch] minor instcombine+bitcast improvement In-Reply-To: <01C490A0-3495-4DD0-86EA-A9EA08D06F2F@apple.com> References: <20070406160142.GU15678@village.us.cray.com> <01C490A0-3495-4DD0-86EA-A9EA08D06F2F@apple.com> Message-ID: <1175881902.9947.308.camel@bashful.x10sys.com> On Fri, 2007-04-06 at 10:45 -0700, Chris Lattner wrote: > On Apr 6, 2007, at 9:01 AM, Dan Gohman wrote: > > > This patch makes instcombine convert this: > > > > %t = getelementptr float* cast ([2 x i32]* %str to float*), > > i32 %V > > > > into this: > > > > %t = getelementptr float* cast ([2 x i32]* %str to [2 x float] > > *), i32 0, i32 %V > > > > instead of this: > > > > %s = getelementptr [2 x i32]* %str, i32 0, i32 %V > > %t = bitcast i32* %s to float* > > > > I'm not yet familiar with instcombine's canonicalization style; is > > this > > a desireable change? It doesn't cause any regressions for me. > > I don't have a strong preference either way. Is there a reason that > you prefer this style to the previous one? That was my take too. I don't think this affects code gen at all so the only question is, what else does it improve? It doesn't improve readability in my opinion but that's not a high priority. Using the cast constant expression instead of the cast instruction might be smaller but I'm not sure. So, I have the same question: "What's the benefit to this transform?" Reid. > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Fri Apr 6 12:58:46 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 6 Apr 2007 10:58:46 -0700 Subject: [llvm-commits] [patch] minor instcombine+bitcast improvement In-Reply-To: <1175881902.9947.308.camel@bashful.x10sys.com> References: <20070406160142.GU15678@village.us.cray.com> <01C490A0-3495-4DD0-86EA-A9EA08D06F2F@apple.com> <1175881902.9947.308.camel@bashful.x10sys.com> Message-ID: <504C23EA-2DD8-442A-B79C-B5369402D45A@apple.com> On Apr 6, 2007, at 10:51 AM, Reid Spencer wrote: > On Fri, 2007-04-06 at 10:45 -0700, Chris Lattner wrote: >> On Apr 6, 2007, at 9:01 AM, Dan Gohman wrote: >>> This patch makes instcombine convert this: >>> %t = getelementptr float* cast ([2 x i32]* %str to float*), >>> i32 %V >>> >>> into this: >>> >>> %t = getelementptr float* cast ([2 x i32]* %str to [2 x float] >>> *), i32 0, i32 %V >>> >>> instead of this: >>> >>> %s = getelementptr [2 x i32]* %str, i32 0, i32 %V >>> %t = bitcast i32* %s to float* >>> >>> I'm not yet familiar with instcombine's canonicalization style; is >>> this >>> a desireable change? It doesn't cause any regressions for me. >> >> I don't have a strong preference either way. Is there a reason that >> you prefer this style to the previous one? > > That was my take too. > > I don't think this affects code gen at all so the only question is, > what > else does it improve? It doesn't improve readability in my opinion but > that's not a high priority. Using the cast constant expression > instead > of the cast instruction might be smaller but I'm not sure. So, I have > the same question: "What's the benefit to this transform?" The transform in CVS allows us to turn: %t = getelementptr float* cast ([2 x i32]* %str to float*), i32 %V %u = bitcast float* to i32* into this: %s = getelementptr [2 x i32]* %str, i32 0, i32 %V %t = bitcast i32* %s to float* %u = bitcast float* to i32* into this: %u = getelementptr [2 x i32]* %str, i32 0, i32 %V -Chris From sabre at nondot.org Fri Apr 6 13:06:44 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 13:06:44 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/CommandLine.h Message-ID: <200704061806.l36I6iZv007872@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: CommandLine.h updated: 1.60 -> 1.61 --- Log message: Eliminate unneeded virtual methods --- Diffs of the changes: (+44 -49) CommandLine.h | 93 +++++++++++++++++++++++++++------------------------------- 1 files changed, 44 insertions(+), 49 deletions(-) Index: llvm/include/llvm/Support/CommandLine.h diff -u llvm/include/llvm/Support/CommandLine.h:1.60 llvm/include/llvm/Support/CommandLine.h:1.61 --- llvm/include/llvm/Support/CommandLine.h:1.60 Thu Apr 5 17:21:39 2007 +++ llvm/include/llvm/Support/CommandLine.h Fri Apr 6 13:06:27 2007 @@ -141,13 +141,6 @@ virtual enum ValueExpected getValueExpectedFlagDefault() const { return ValueOptional; } - virtual enum OptionHidden getOptionHiddenFlagDefault() const { - return NotHidden; - } - virtual enum FormattingFlags getFormattingFlagDefault() const { - return NormalFormatting; - } - // Out of line virtual function to provide home for the class. virtual void anchor(); @@ -160,7 +153,7 @@ const char *ValueStr; // String describing what the value of this option is inline enum NumOccurrences getNumOccurrencesFlag() const { - return (enum NumOccurrences)(Flags & OccurrencesMask); + return static_cast(Flags & OccurrencesMask); } inline enum ValueExpected getValueExpectedFlag() const { int VE = Flags & ValueMask; @@ -168,14 +161,10 @@ : getValueExpectedFlagDefault(); } inline enum OptionHidden getOptionHiddenFlag() const { - int OH = Flags & HiddenMask; - return OH ? static_cast(OH) - : getOptionHiddenFlagDefault(); + return static_cast(Flags & HiddenMask); } inline enum FormattingFlags getFormattingFlag() const { - int OH = Flags & FormattingMask; - return OH ? static_cast(OH) - : getFormattingFlagDefault(); + return static_cast(Flags & FormattingMask); } inline unsigned getMiscFlags() const { return Flags & MiscMask; @@ -206,9 +195,12 @@ void setMiscFlag(enum MiscFlags M) { setFlag(M, M); } void setPosition(unsigned pos) { Position = pos; } protected: - Option(enum NumOccurrences DefaultOccFlag) - : NumOccurrences(0), Flags(DefaultOccFlag), Position(0), - ArgStr(""), HelpStr(""), ValueStr("") {} + Option(unsigned DefaultFlags) + : NumOccurrences(0), Flags(DefaultFlags | NormalFormatting), Position(0), + ArgStr(""), HelpStr(""), ValueStr("") { + assert(getNumOccurrencesFlag() != 0 && + getOptionHiddenFlag() != 0 && "Not all default flags specified!"); + } public: // addArgument - Tell the system that this Option subclass will handle all @@ -805,35 +797,36 @@ // One option... template - opt(const M0t &M0) : Option(Optional) { + opt(const M0t &M0) : Option(Optional | NotHidden) { apply(M0, this); done(); } // Two options... template - opt(const M0t &M0, const M1t &M1) : Option(Optional) { + opt(const M0t &M0, const M1t &M1) : Option(Optional | NotHidden) { apply(M0, this); apply(M1, this); done(); } // Three options... template - opt(const M0t &M0, const M1t &M1, const M2t &M2) : Option(Optional) { + opt(const M0t &M0, const M1t &M1, + const M2t &M2) : Option(Optional | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); done(); } // Four options... template opt(const M0t &M0, const M1t &M1, const M2t &M2, - const M3t &M3) : Option(Optional) { + const M3t &M3) : Option(Optional | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); done(); } // Five options... template opt(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4) : Option(Optional) { + const M4t &M4) : Option(Optional | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); done(); @@ -842,7 +835,7 @@ template opt(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5) : Option(Optional) { + const M4t &M4, const M5t &M5) : Option(Optional | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); done(); @@ -851,7 +844,8 @@ template opt(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5, const M6t &M6) : Option(Optional) { + const M4t &M4, const M5t &M5, + const M6t &M6) : Option(Optional | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); done(); @@ -861,7 +855,7 @@ class M4t, class M5t, class M6t, class M7t> opt(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, const M4t &M4, const M5t &M5, const M6t &M6, - const M7t &M7) : Option(Optional) { + const M7t &M7) : Option(Optional | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); apply(M7, this); done(); @@ -960,33 +954,34 @@ // One option... template - list(const M0t &M0) : Option(ZeroOrMore) { + list(const M0t &M0) : Option(ZeroOrMore | NotHidden) { apply(M0, this); done(); } // Two options... template - list(const M0t &M0, const M1t &M1) : Option(ZeroOrMore) { + list(const M0t &M0, const M1t &M1) : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); done(); } // Three options... template - list(const M0t &M0, const M1t &M1, const M2t &M2) : Option(ZeroOrMore) { + list(const M0t &M0, const M1t &M1, const M2t &M2) + : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); done(); } // Four options... template list(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3) - : Option(ZeroOrMore) { + : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); done(); } // Five options... template list(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4) : Option(ZeroOrMore) { + const M4t &M4) : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); done(); @@ -995,7 +990,7 @@ template list(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5) : Option(ZeroOrMore) { + const M4t &M4, const M5t &M5) : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); done(); @@ -1004,7 +999,8 @@ template list(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5, const M6t &M6) : Option(ZeroOrMore) { + const M4t &M4, const M5t &M5, const M6t &M6) + : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); done(); @@ -1014,7 +1010,7 @@ class M4t, class M5t, class M6t, class M7t> list(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, const M4t &M4, const M5t &M5, const M6t &M6, - const M7t &M7) : Option(ZeroOrMore) { + const M7t &M7) : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); apply(M7, this); done(); @@ -1141,33 +1137,34 @@ // One option... template - bits(const M0t &M0) : Option(ZeroOrMore) { + bits(const M0t &M0) : Option(ZeroOrMore | NotHidden) { apply(M0, this); done(); } // Two options... template - bits(const M0t &M0, const M1t &M1) : Option(ZeroOrMore) { + bits(const M0t &M0, const M1t &M1) : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); done(); } // Three options... template - bits(const M0t &M0, const M1t &M1, const M2t &M2) : Option(ZeroOrMore) { + bits(const M0t &M0, const M1t &M1, const M2t &M2) + : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); done(); } // Four options... template - bits(const M0t &M0, const M1t &M1, const M2t &M2, - const M3t &M3) : Option(ZeroOrMore) { + bits(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3) + : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); done(); } // Five options... template bits(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4) : Option(ZeroOrMore) { + const M4t &M4) : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); done(); @@ -1176,7 +1173,7 @@ template bits(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5) : Option(ZeroOrMore) { + const M4t &M4, const M5t &M5) : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); done(); @@ -1185,7 +1182,8 @@ template bits(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, - const M4t &M4, const M5t &M5, const M6t &M6) : Option(ZeroOrMore) { + const M4t &M4, const M5t &M5, const M6t &M6) + : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); done(); @@ -1195,7 +1193,7 @@ class M4t, class M5t, class M6t, class M7t> bits(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3, const M4t &M4, const M5t &M5, const M6t &M6, - const M7t &M7) : Option(ZeroOrMore) { + const M7t &M7) : Option(ZeroOrMore | NotHidden) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); apply(M4, this); apply(M5, this); apply(M6, this); apply(M7, this); done(); @@ -1212,9 +1210,6 @@ const std::string &Arg) { return AliasFor->handleOccurrence(pos, AliasFor->ArgStr, Arg); } - // Aliases default to be hidden... - virtual enum OptionHidden getOptionHiddenFlagDefault() const {return Hidden;} - // Handle printing stuff... virtual unsigned getOptionWidth() const; virtual void printOptionInfo(unsigned GlobalWidth) const; @@ -1235,27 +1230,27 @@ // One option... template - alias(const M0t &M0) : Option(Optional), AliasFor(0) { + alias(const M0t &M0) : Option(Optional | Hidden), AliasFor(0) { apply(M0, this); done(); } // Two options... template - alias(const M0t &M0, const M1t &M1) : Option(Optional), AliasFor(0) { + alias(const M0t &M0, const M1t &M1) : Option(Optional | Hidden), AliasFor(0) { apply(M0, this); apply(M1, this); done(); } // Three options... template alias(const M0t &M0, const M1t &M1, const M2t &M2) - : Option(Optional), AliasFor(0) { + : Option(Optional | Hidden), AliasFor(0) { apply(M0, this); apply(M1, this); apply(M2, this); done(); } // Four options... template alias(const M0t &M0, const M1t &M1, const M2t &M2, const M3t &M3) - : Option(Optional), AliasFor(0) { + : Option(Optional | Hidden), AliasFor(0) { apply(M0, this); apply(M1, this); apply(M2, this); apply(M3, this); done(); } From sabre at nondot.org Fri Apr 6 13:36:46 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 13:36:46 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/CommandLine.h Message-ID: <200704061836.l36Iakue008452@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: CommandLine.h updated: 1.61 -> 1.62 --- Log message: Switch some vectors to smallvectors. This reduces amount of malloc'd memory that occurs before main starts from 5104 to 4864 bytes with a dummy example app. --- Diffs of the changes: (+8 -6) CommandLine.h | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) Index: llvm/include/llvm/Support/CommandLine.h diff -u llvm/include/llvm/Support/CommandLine.h:1.61 llvm/include/llvm/Support/CommandLine.h:1.62 --- llvm/include/llvm/Support/CommandLine.h:1.61 Fri Apr 6 13:06:27 2007 +++ llvm/include/llvm/Support/CommandLine.h Fri Apr 6 13:36:18 2007 @@ -23,6 +23,7 @@ #include "llvm/Support/type_traits.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/Compiler.h" +#include "llvm/ADT/SmallVector.h" #include #include #include @@ -303,7 +304,7 @@ // Use a vector instead of a map, because the lists should be short, // the overhead is less, and most importantly, it keeps them in the order // inserted so we can print our option out nicely. - std::vector > > Values; + SmallVector >,4> Values; void processValues(va_list Vals); public: ValuesClass(const char *EnumName, DataType Val, const char *Desc, @@ -424,8 +425,8 @@ template class parser : public generic_parser_base { protected: - std::vector > > Values; + SmallVector >, 8> Values; public: typedef DataType parser_data_type; @@ -454,7 +455,8 @@ return O.error(": Cannot find option named '" + ArgVal + "'!"); } - // addLiteralOption - Add an entry to the mapping table... + /// addLiteralOption - Add an entry to the mapping table. + /// template void addLiteralOption(const char *Name, const DT &V, const char *HelpStr) { assert(findOption(Name) == Values.size() && "Option already exists!"); @@ -462,8 +464,8 @@ std::make_pair(static_cast(V),HelpStr))); } - // removeLiteralOption - Remove the specified option. - // + /// removeLiteralOption - Remove the specified option. + /// void removeLiteralOption(const char *Name) { unsigned N = findOption(Name); assert(N != Values.size() && "Option not found!"); From sabre at nondot.org Fri Apr 6 13:57:12 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 13:57:12 -0500 Subject: [llvm-commits] CVS: llvm/test/Transforms/InstCombine/malloc2.ll malloc.ll Message-ID: <200704061857.l36IvCm3009409@zion.cs.uiuc.edu> Changes in directory llvm/test/Transforms/InstCombine: malloc2.ll added (r1.1) malloc.ll updated: 1.4 -> 1.5 --- Log message: new testcase, update old one. --- Diffs of the changes: (+23 -4) malloc.ll | 8 ++++---- malloc2.ll | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) Index: llvm/test/Transforms/InstCombine/malloc2.ll diff -c /dev/null llvm/test/Transforms/InstCombine/malloc2.ll:1.1 *** /dev/null Fri Apr 6 13:57:04 2007 --- llvm/test/Transforms/InstCombine/malloc2.ll Fri Apr 6 13:56:54 2007 *************** *** 0 **** --- 1,19 ---- + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'ret i32 0' && + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep malloc + ; PR1313 + + define i32 @test1(i32 %argc, i8* %argv, i8* %envp) { + %tmp15.i.i.i23 = malloc [2564 x i32] ; <[2564 x i32]*> [#uses=1] + %c = icmp eq [2564 x i32]* %tmp15.i.i.i23, null ; :0 [#uses=1] + %retval = zext i1 %c to i32 ; [#uses=1] + ret i32 %retval + } + + define i32 @test2(i32 %argc, i8* %argv, i8* %envp) { + %tmp15.i.i.i23 = malloc [2564 x i32] ; <[2564 x i32]*> [#uses=1] + %X = bitcast [2564 x i32]* %tmp15.i.i.i23 to i32* + %c = icmp ne i32* %X, null + %retval = zext i1 %c to i32 ; [#uses=1] + ret i32 %retval + } + Index: llvm/test/Transforms/InstCombine/malloc.ll diff -u llvm/test/Transforms/InstCombine/malloc.ll:1.4 llvm/test/Transforms/InstCombine/malloc.ll:1.5 --- llvm/test/Transforms/InstCombine/malloc.ll:1.4 Fri Dec 1 22:23:09 2006 +++ llvm/test/Transforms/InstCombine/malloc.ll Fri Apr 6 13:56:54 2007 @@ -1,7 +1,7 @@ ; test that malloc's with a constant argument are promoted to array allocations -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep getelementptr +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep getelementptr -int* %test() { - %X = malloc int, uint 4 - ret int* %X +define i32* @test() { + %X = malloc i32, i32 4 + ret i32* %X } From sabre at nondot.org Fri Apr 6 13:57:51 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 13:57:51 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200704061857.l36IvpAD009454@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.731 -> 1.732 --- Log message: implement Transforms/InstCombine/malloc2.ll and PR1313: http://llvm.org/PR1313 --- Diffs of the changes: (+11 -1) InstructionCombining.cpp | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.731 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.732 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.731 Wed Apr 4 14:16:42 2007 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Apr 6 13:57:34 2007 @@ -4744,7 +4744,7 @@ if (Instruction *NV = FoldOpIntoPhi(I)) return NV; break; - case Instruction::Select: + case Instruction::Select: { // If either operand of the select is a constant, we can fold the // comparison into the select arms, which will cause one to be // constant folded and the select turned into a bitwise or. @@ -4771,6 +4771,16 @@ return new SelectInst(LHSI->getOperand(0), Op1, Op2); break; } + case Instruction::Malloc: + // If we have (malloc != null), and if the malloc has a single use, we + // can assume it is successful and remove the malloc. + if (LHSI->hasOneUse() && isa(RHSC)) { + AddToWorkList(LHSI); + return ReplaceInstUsesWith(I, ConstantInt::get(Type::Int1Ty, + !isTrueWhenEqual(I))); + } + break; + } } // If we can optimize a 'icmp GEP, P' or 'icmp P, GEP', do so now. From criswell at cs.uiuc.edu Fri Apr 6 15:18:37 2007 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 6 Apr 2007 15:18:37 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704062018.PAA20868@choi.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.9 -> 1.10 --- Log message: Added Ageia. --- Diffs of the changes: (+7 -1) Users.html | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.9 llvm-www/Users.html:1.10 --- llvm-www/Users.html:1.9 Fri Apr 6 12:39:42 2007 +++ llvm-www/Users.html Fri Apr 6 15:17:48 2007 @@ -33,6 +33,12 @@ Compiler for reconfigurable processor + + + Ageia Technoogies + Optimizer and back end for custom processor + + AutoESL Design Technologies, Inc. Electronic System Level (ESL) to Silicon @@ -232,6 +238,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
    LLVM Development List
    - Last modified: $Date: 2007/04/06 17:39:42 $ + Last modified: $Date: 2007/04/06 20:17:48 $ From criswell at cs.uiuc.edu Fri Apr 6 15:19:03 2007 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 6 Apr 2007 15:19:03 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704062019.PAA20886@choi.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.10 -> 1.11 --- Log message: Fix spelling. --- Diffs of the changes: (+2 -2) Users.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.10 llvm-www/Users.html:1.11 --- llvm-www/Users.html:1.10 Fri Apr 6 15:17:48 2007 +++ llvm-www/Users.html Fri Apr 6 15:18:36 2007 @@ -35,7 +35,7 @@ - Ageia Technoogies + Ageia Technologies Optimizer and back end for custom processor @@ -238,6 +238,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
    LLVM Development List
    - Last modified: $Date: 2007/04/06 20:17:48 $ + Last modified: $Date: 2007/04/06 20:18:36 $ From reid at x10sys.com Fri Apr 6 15:19:24 2007 From: reid at x10sys.com (Reid Spencer) Date: Fri, 6 Apr 2007 15:19:24 -0500 Subject: [llvm-commits] CVS: llvm-www/DevMtgMay2007.html Message-ID: <200704062019.l36KJO15011216@zion.cs.uiuc.edu> Changes in directory llvm-www: DevMtgMay2007.html updated: 1.51 -> 1.52 --- Log message: Add Dan Gohman and colleague. --- Diffs of the changes: (+3 -2) DevMtgMay2007.html | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm-www/DevMtgMay2007.html diff -u llvm-www/DevMtgMay2007.html:1.51 llvm-www/DevMtgMay2007.html:1.52 --- llvm-www/DevMtgMay2007.html:1.51 Fri Apr 6 11:52:51 2007 +++ llvm-www/DevMtgMay2007.html Fri Apr 6 15:19:07 2007 @@ -241,6 +241,7 @@ Evan ChengApple Inc. Jeff CohenIndependent Han GaoAdobe Systems Incorporated. + Dan Gohman + 1Cray Inc. Stuart HastingsApple Inc. Robert HundtGoogle Dale JohannesenApple Inc. @@ -271,7 +272,7 @@ -

    Total confirmed: 27

    +

    Total confirmed: 29

    @@ -289,6 +290,6 @@ src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!">Valid HTML 4.01! -
    Last modified: $Date: 2007/04/06 16:52:51 $ +
    Last modified: $Date: 2007/04/06 20:19:07 $ From rspencer at reidspencer.com Fri Apr 6 15:20:17 2007 From: rspencer at reidspencer.com (Reid Spencer) Date: Fri, 06 Apr 2007 20:20:17 +0000 Subject: [llvm-commits] CVS: llvm-www/Users.html In-Reply-To: <200704062018.PAA20868@choi.cs.uiuc.edu> References: <200704062018.PAA20868@choi.cs.uiuc.edu> Message-ID: <1175890817.9947.352.camel@bashful.x10sys.com> On Fri, 2007-04-06 at 15:18 -0500, John Criswell wrote: > > > Added Ageia. > > > + > + > + I'm pretty certain they don't spell it like that :) > + > + > + > > > > @@ -232,6 +238,6 @@ > src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> > >
    LLVM Development List
    > - Last modified: $Date: 2007/04/06 17:39:42 $ > + Last modified: $Date: 2007/04/06 20:17:48 $ > > > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From criswell at cs.uiuc.edu Fri Apr 6 15:24:19 2007 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 6 Apr 2007 15:24:19 -0500 Subject: [llvm-commits] CVS: llvm-www/Users.html Message-ID: <200704062024.PAA20939@choi.cs.uiuc.edu> Changes in directory llvm-www: Users.html updated: 1.11 -> 1.12 --- Log message: Put companies in alphabetical order. --- Diffs of the changes: (+7 -7) Users.html | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) Index: llvm-www/Users.html diff -u llvm-www/Users.html:1.11 llvm-www/Users.html:1.12 --- llvm-www/Users.html:1.11 Fri Apr 6 15:18:36 2007 +++ llvm-www/Users.html Fri Apr 6 15:23:32 2007 @@ -21,6 +21,12 @@ + + + + + + @@ -33,12 +39,6 @@ - - - - - - @@ -238,6 +238,6 @@ src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!">
    LLVM Development List
    - Last modified: $Date: 2007/04/06 20:18:36 $ + Last modified: $Date: 2007/04/06 20:23:32 $ From gordonhenriksen at mac.com Fri Apr 6 15:46:50 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Fri, 6 Apr 2007 16:46:50 -0400 Subject: [llvm-commits] CVS: llvm-www/Users.html In-Reply-To: <200704062019.PAA20886@choi.cs.uiuc.edu> References: <200704062019.PAA20886@choi.cs.uiuc.edu> Message-ID: <2F513240-0F56-4947-9305-5584A3771BD0@mac.com> On 2007-04-06, at 16:19, John Criswell wrote: > - > + Best typo ever. ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070406/8300af08/attachment.html From sabre at nondot.org Fri Apr 6 16:07:17 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 6 Apr 2007 16:07:17 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/CommandLine.cpp Message-ID: <200704062107.l36L7HUi012025@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: CommandLine.cpp updated: 1.83 -> 1.84 --- Log message: rearchitect the registration mechanism used by the command line option stuff. This dramatically reduce the amount of memory allocated by the commandline stuff at static init time, changing it to build local data structures when ParseCommandLineOptions is called. In a dummy empty program that links some llvm libraries, this reduces the number of malloc'd bytes from 4864 to 3360 on entry to main. Most of that memory is now allocated by non-commandline related stuff. --- Diffs of the changes: (+84 -65) CommandLine.cpp | 149 +++++++++++++++++++++++++++++++------------------------- 1 files changed, 84 insertions(+), 65 deletions(-) Index: llvm/lib/Support/CommandLine.cpp diff -u llvm/lib/Support/CommandLine.cpp:1.83 llvm/lib/Support/CommandLine.cpp:1.84 --- llvm/lib/Support/CommandLine.cpp:1.83 Thu Apr 5 16:58:17 2007 +++ llvm/lib/Support/CommandLine.cpp Fri Apr 6 16:06:55 2007 @@ -71,32 +71,63 @@ MoreHelp->push_back(Help); } +/// RegisteredOptionList - This is the list of the command line options that +/// have statically constructed themselves. +static Option *RegisteredOptionList = 0; + +void Option::addArgument() { + assert(NextRegistered == 0 && "argument multiply registered!"); + + NextRegistered = RegisteredOptionList; + RegisteredOptionList = this; +} + //===----------------------------------------------------------------------===// // Basic, shared command line option processing machinery. // -static ManagedStatic > OptionsMap; -static ManagedStatic > PositionalOptions; - -static Option *getOption(const std::string &Str) { - std::map::iterator I = OptionsMap->find(Str); - return I != OptionsMap->end() ? I->second : 0; -} - -static void AddArgument(const char *ArgName, Option *Opt) { - if (getOption(ArgName)) { - cerr << ProgramName << ": CommandLine Error: Argument '" - << ArgName << "' defined more than once!\n"; - } else { - // Add argument to the argument map! - (*OptionsMap)[ArgName] = Opt; +/// GetOptionInfo - Scan the list of registered options, turning them into data +/// structures that are easier to handle. +static void GetOptionInfo(std::vector &PositionalOpts, + std::map &OptionsMap) { + std::vector OptionNames; + for (Option *O = RegisteredOptionList; O; O = O->getNextRegisteredOption()) { + // If this option wants to handle multiple option names, get the full set. + // This handles enum options like "-O1 -O2" etc. + O->getExtraOptionNames(OptionNames); + if (O->ArgStr[0]) + OptionNames.push_back(O->ArgStr); + + // Handle named options. + for (unsigned i = 0, e = OptionNames.size(); i != e; ++i) { + // Add argument to the argument map! + if (!OptionsMap.insert(std::pair(OptionNames[i], + O)).second) { + cerr << ProgramName << ": CommandLine Error: Argument '" + << OptionNames[0] << "' defined more than once!\n"; + } + } + + OptionNames.clear(); + + // Remember information about positional options. + if (O->getFormattingFlag() == cl::Positional) + PositionalOpts.push_back(O); + else if (O->getNumOccurrencesFlag() == cl::ConsumeAfter) { + if (!PositionalOpts.empty() && + PositionalOpts.front()->getNumOccurrencesFlag() == cl::ConsumeAfter) + O->error("Cannot specify more than one option with cl::ConsumeAfter!"); + PositionalOpts.insert(PositionalOpts.begin(), O); + } } } + /// LookupOption - Lookup the option specified by the specified option on the /// command line. If there is a value specified (after an equal sign) return /// that as well. -static Option *LookupOption(const char *&Arg, const char *&Value) { +static Option *LookupOption(const char *&Arg, const char *&Value, + std::map &OptionsMap) { while (*Arg == '-') ++Arg; // Eat leading dashes const char *ArgEnd = Arg; @@ -110,10 +141,9 @@ if (*Arg == 0) return 0; // Look up the option. - std::map &Opts = *OptionsMap; std::map::iterator I = - Opts.find(std::string(Arg, ArgEnd)); - return (I != Opts.end()) ? I->second : 0; + OptionsMap.find(std::string(Arg, ArgEnd)); + return I != OptionsMap.end() ? I->second : 0; } static inline bool ProvideOption(Option *Handler, const char *ArgName, @@ -171,27 +201,28 @@ // otherwise return null. // static Option *getOptionPred(std::string Name, unsigned &Length, - bool (*Pred)(const Option*)) { + bool (*Pred)(const Option*), + std::map &OptionsMap) { - Option *Op = getOption(Name); - if (Op && Pred(Op)) { + std::map::iterator OMI = OptionsMap.find(Name); + if (OMI != OptionsMap.end() && Pred(OMI->second)) { Length = Name.length(); - return Op; + return OMI->second; } if (Name.size() == 1) return 0; do { Name.erase(Name.end()-1, Name.end()); // Chop off the last character... - Op = getOption(Name); + OMI = OptionsMap.find(Name); // Loop while we haven't found an option and Name still has at least two // characters in it (so that the next iteration will not be the empty // string... - } while ((Op == 0 || !Pred(Op)) && Name.size() > 1); + } while ((OMI == OptionsMap.end() || !Pred(OMI->second)) && Name.size() > 1); - if (Op && Pred(Op)) { + if (OMI != OptionsMap.end() && Pred(OMI->second)) { Length = Name.length(); - return Op; // Found one! + return OMI->second; // Found one! } return 0; // No option found! } @@ -286,9 +317,13 @@ void cl::ParseCommandLineOptions(int &argc, char **argv, const char *Overview) { - assert((!OptionsMap->empty() || !PositionalOptions->empty()) && - "No options specified, or ParseCommandLineOptions called more" - " than once!"); + // Process all registered options. + std::vector PositionalOpts; + std::map Opts; + GetOptionInfo(PositionalOpts, Opts); + + assert((!Opts.empty() || !PositionalOp
    Unconfirmed Attendees
    NameOrganization
    Ageia TechnoogiesOptimizer and back end for custom processor
    AutoESL Design Technologies, Inc.Electronic System Level (ESL) to SiliconDescription
    Ageia TechnologiesOptimizer and back end for custom processor
    Apple ComputerCompiler for reconfigurable processor
    Ageia TechnologiesOptimizer and back end for custom processor
    AutoESL Design Technologies, Inc. Electronic System Level (ESL) to Silicon Ageia TechnoogiesAgeia Technologies