[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.87 - 1.88 --- Log message: Codegen support (stripped out) for the annotate attribute. --- Diffs of the changes: (+3 -0) IntrinsicLowering.cpp |3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.87 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.88 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.87 Mon Jun 11 18:16:16 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Fri Jun 15 17:26:58 2007 @@ -711,6 +711,9 @@ case Intrinsic::eh_filter: break;// Simply strip out debugging and eh intrinsics + case Intrinsic::var_annotation: +break; // Strip out annotate intrinsic + case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: { static Constant *MemcpyFCache = 0; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.86 - 1.87 --- Log message: Fix a typo in bswap lowering. --- Diffs of the changes: (+1 -1) IntrinsicLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.86 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.87 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.86 Fri Jun 1 23:10:33 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Jun 11 18:16:16 2007 @@ -144,7 +144,7 @@ bswap.and2, IP); Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, bswap.or1, IP); Tmp2 = BinaryOperator::createOr(Tmp2, Tmp1, bswap.or2, IP); -V = BinaryOperator::createOr(Tmp4, Tmp3, bswap.i32, IP); +V = BinaryOperator::createOr(Tmp4, Tmp2, bswap.i32, IP); break; } case 64: { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.85 - 1.86 --- Log message: Make LowerCTPOP() support arbitrary bitwidth integer type. --- Diffs of the changes: (+22 -9) IntrinsicLowering.cpp | 31 ++- 1 files changed, 22 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.85 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.86 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.85 Fri May 25 22:43:13 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Fri Jun 1 23:10:33 2007 @@ -208,17 +208,30 @@ }; unsigned BitSize = V-getType()-getPrimitiveSizeInBits(); + unsigned WordSize = (BitSize + 63) / 64; + Value *Count = ConstantInt::get(V-getType(), 0); - for (unsigned i = 1, ct = 0; i != BitSize; i = 1, ++ct) { -Value *MaskCst = ConstantInt::get(V-getType(), MaskValues[ct]); -Value *LHS = BinaryOperator::createAnd(V, MaskCst, cppop.and1, IP); -Value *VShift = BinaryOperator::createLShr(V, - ConstantInt::get(V-getType(), i), ctpop.sh, IP); -Value *RHS = BinaryOperator::createAnd(VShift, MaskCst, cppop.and2, IP); -V = BinaryOperator::createAdd(LHS, RHS, ctpop.step, IP); + for (unsigned n = 0; n WordSize; ++n) { +Value *PartValue = V; +for (unsigned i = 1, ct = 0; i (BitSize64 ? 64 : BitSize); + i = 1, ++ct) { + Value *MaskCst = ConstantInt::get(V-getType(), MaskValues[ct]); + Value *LHS = BinaryOperator::createAnd( + PartValue, MaskCst, cppop.and1, IP); + Value *VShift = BinaryOperator::createLShr(PartValue, +ConstantInt::get(V-getType(), i), ctpop.sh, IP); + Value *RHS = BinaryOperator::createAnd(VShift, MaskCst, cppop.and2, IP); + PartValue = BinaryOperator::createAdd(LHS, RHS, ctpop.step, IP); +} +Count = BinaryOperator::createAdd(PartValue, Count, ctpop.part, IP); +if (BitSize 64) { + V = BinaryOperator::createLShr(V, ConstantInt::get(V-getType(), 64), + ctpop.part.sh, IP); + BitSize -= 64; +} } - return CastInst::createIntegerCast(V, Type::Int32Ty, false, ctpop, IP); + return CastInst::createIntegerCast(Count, Type::Int32Ty, false, ctpop, IP); } /// LowerCTLZ - Emit the code to lower ctlz of V before the specified @@ -226,7 +239,7 @@ static Value *LowerCTLZ(Value *V, Instruction *IP) { unsigned BitSize = V-getType()-getPrimitiveSizeInBits(); - for (unsigned i = 1; i != BitSize; i = 1) { + for (unsigned i = 1; i BitSize; i = 1) { Value *ShVal = ConstantInt::get(V-getType(), i); ShVal = BinaryOperator::createLShr(V, ShVal, ctlz.sh, IP); V = BinaryOperator::createOr(V, ShVal, ctlz.step, IP); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.84 - 1.85 --- Log message: Correct the logic in LowerPartSet which cleared the bits from 0 to low-1. --- Diffs of the changes: (+7 -5) IntrinsicLowering.cpp | 12 +++- 1 files changed, 7 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.84 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.85 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.84 Mon May 14 21:26:52 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Fri May 25 22:43:13 2007 @@ -557,11 +557,13 @@ Rplcmnt-addIncoming(NewRes, reverse); Rplcmnt-addIncoming(Rep4, small); Value* t0 = CastInst::createIntegerCast(NumBits,ValTy,false,,result); -Value* t1 = BinaryOperator::createShl(ValMask, t0, , result); -Value* t2 = BinaryOperator::createShl(t1, Lo, , result); -Value* t3 = BinaryOperator::createAnd(t2, Val, , result); -Value* t4 = BinaryOperator::createShl(Rplcmnt, Lo, , result); -Value* Rslt = BinaryOperator::createOr(t3, t4, part_set, result); +Value* t1 = BinaryOperator::createShl(ValMask, Lo, , result); +Value* t2 = BinaryOperator::createNot(t1, , result); +Value* t3 = BinaryOperator::createShl(t1, t0, , result); +Value* t4 = BinaryOperator::createOr(t2, t3, , result); +Value* t5 = BinaryOperator::createAnd(t4, Val, , result); +Value* t6 = BinaryOperator::createShl(Rplcmnt, Lo, , result); +Value* Rslt = BinaryOperator::createOr(t5, t6, part_set, result); new ReturnInst(Rslt, result); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.82 - 1.83 --- Log message: Give names to the final result values of the part_set computations. This just aids in readability and debugability of the output. No functional change. --- Diffs of the changes: (+2 -2) IntrinsicLowering.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.82 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.83 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.82 Sat May 12 06:07:40 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon May 14 12:21:17 2007 @@ -568,7 +568,7 @@ Value* nott2 = BinaryOperator::createXor(t2, ValMask, , forward); Value* t3= BinaryOperator::createShl(Rep4, Lo, , forward); Value* t4= BinaryOperator::createAnd(nott2, Val, , forward); -Value* FRslt = BinaryOperator::createOr(t3, t4, , forward); +Value* FRslt = BinaryOperator::createOr(t3, t4, part_set_fwd, forward); new ReturnInst(FRslt, forward); // Block reverse @@ -587,7 +587,7 @@ Value* t11 = BinaryOperator::createSub(RepBitWidth, Hi, , reverse); Value* t13 = BinaryOperator::createLShr(Rep4, t11, ,reverse); Value* t14 = BinaryOperator::createOr(t10, t9, , reverse); -Value* RRslt = BinaryOperator::createOr(t14, t13, , reverse); +Value* RRslt = BinaryOperator::createOr(t14, t13, part_set_rvrs, reverse); new ReturnInst(RRslt, reverse); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.83 - 1.84 --- Log message: Un-brain-dead-ify the lowering of part set for the reverse case. --- Diffs of the changes: (+72 -98) IntrinsicLowering.cpp | 170 +- 1 files changed, 72 insertions(+), 98 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.83 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.84 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.83 Mon May 14 12:21:17 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon May 14 21:26:52 2007 @@ -442,57 +442,6 @@ // If we haven't defined the impl function yet, do so now if (F-isDeclaration()) { -// Note: the following code is based on code generated by llvm2cpp with -// the following input. This is just *one* example of a generated function. -// The functions vary by bit width of result and first two arguments. -// The generated code has been changed to deal with any bit width not just -// the 32/64 bitwidths used in the above sample. -// -// define i64 @part_set(i64 %Val, i32 %Rep, i32 %Lo, i32 %Hi) { -// entry: -// %is_forward = icmp ult i32 %Lo, %Hi -// %Lo.pn = select i1 %is_forward, i32 %Hi, i32 %Lo -// %Hi.pn = select i1 %is_forward, i32 %Lo, i32 %Hi -// %iftmp.16.0 = sub i32 %Lo.pn, %Hi.pn -// icmp ult i32 %iftmp.16.0, 32 -// br i1 %1, label %cond_true11, label %cond_next19 -// cond_true11: -// %tmp13 = sub i32 32, %iftmp.16.0 -// %tmp14 = lshr i32 -1, %tmp13 -// %tmp16 = and i32 %tmp14, %Rep -// br label %cond_next19 -// cond_next19: -// %iftmp.17.0 = phi i32 [ %tmp16, %cond_true11 ], [ %Rep, %entry ] -// %tmp2021 = zext i32 %iftmp.17.0 to i64 -// icmp ugt i32 %Lo, %Hi -// br i1 %2, label %cond_next60, label %cond_true24 -// cond_true24: -// %tmp25.cast = zext i32 %Hi to i64 -// %tmp26 = lshr i64 -1, %tmp25.cast -// %tmp27.cast = zext i32 %Lo to i64 -// %tmp28 = shl i64 %tmp26, %tmp27.cast -// %tmp28not = xor i64 %tmp28, -1 -// %tmp31 = shl i64 %tmp2021, %tmp27.cast -// %tmp34 = and i64 %tmp28not, %Val -// %Val_addr.064 = or i64 %tmp31, %tmp34 -// ret i64 %Val_addr.064 -// cond_next60: -// %tmp39.cast = zext i32 %Lo to i64 -// %tmp40 = shl i64 -1, %tmp39.cast -// %tmp41.cast = zext i32 %Hi to i64 -// %tmp42 = shl i64 -1, %tmp41.cast -// %tmp45.demorgan = or i64 %tmp42, %tmp40 -// %tmp45 = xor i64 %tmp45.demorgan, -1 -// %tmp47 = and i64 %tmp45, %Val -// %tmp50 = shl i64 %tmp2021, %tmp39.cast -// %tmp52 = sub i32 32, %Hi -// %tmp52.cast = zext i32 %tmp52 to i64 -// %tmp54 = lshr i64 %tmp2021, %tmp52.cast -// %tmp57 = or i64 %tmp50, %tmp47 -// %Val_addr.0 = or i64 %tmp57, %tmp54 -// ret i64 %Val_addr.0 -// } - // Get the arguments for the function. Function::arg_iterator args = F-arg_begin(); Value* Val = args++; Val-setName(Val); @@ -510,27 +459,31 @@ ConstantInt* RepBitWidth = ConstantInt::get(Type::Int32Ty, RepBits); ConstantInt* RepMask = ConstantInt::getAllOnesValue(RepTy); ConstantInt* ValMask = ConstantInt::getAllOnesValue(ValTy); +ConstantInt* One = ConstantInt::get(Type::Int32Ty, 1); +ConstantInt* ValOne = ConstantInt::get(ValTy, 1); +ConstantInt* Zero = ConstantInt::get(Type::Int32Ty, 0); +ConstantInt* ValZero = ConstantInt::get(ValTy, 0); + +// Basic blocks we fill in below. +BasicBlock* entry = new BasicBlock(entry, F, 0); +BasicBlock* large = new BasicBlock(large, F, 0); +BasicBlock* small = new BasicBlock(small, F, 0); +BasicBlock* reverse = new BasicBlock(reverse, F, 0); +BasicBlock* result = new BasicBlock(result, F, 0); -BasicBlock* entry = new BasicBlock(entry,F,0); -BasicBlock* large = new BasicBlock(large,F,0); -BasicBlock* small = new BasicBlock(small,F,0); -BasicBlock* forward = new BasicBlock(forward,F,0); -BasicBlock* reverse = new BasicBlock(reverse,F,0); - -// Block entry (entry) +// BASIC BLOCK: entry // First, get the number of bits that we're placing as an i32 ICmpInst* is_forward = new ICmpInst(ICmpInst::ICMP_ULT, Lo, Hi, , entry); -SelectInst* Lo_pn = new SelectInst(is_forward, Hi, Lo, , entry); -SelectInst* Hi_pn = new SelectInst(is_forward, Lo, Hi, , entry); -BinaryOperator* NumBits = BinaryOperator::createSub(Lo_pn, Hi_pn, ,entry); +SelectInst* Hi_pn = new SelectInst(is_forward, Hi, Lo, , entry); +SelectInst* Lo_pn = new SelectInst(is_forward, Lo, Hi, , entry); +BinaryOperator* NumBits = BinaryOperator::createSub(Hi_pn, Lo_pn, ,entry); +NumBits = BinaryOperator::createAdd(NumBits, One, , entry); // Now, convert Lo and Hi to ValTy bit width if (ValBits 32) { - Hi = new ZExtInst(Hi, ValTy, ,
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.81 - 1.82 --- Log message: Get the size of auto arrays right, regardless of its changing size. --- Diffs of the changes: (+13 -11) IntrinsicLowering.cpp | 24 +--- 1 files changed, 13 insertions(+), 11 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.81 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.82 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.81 Mon Apr 16 17:21:14 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Sat May 12 06:07:40 2007 @@ -403,11 +403,12 @@ } // Return a call to the implementation function - Value *Args[3]; - Args[0] = CI-getOperand(1); - Args[1] = CI-getOperand(2); - Args[2] = CI-getOperand(3); - return new CallInst(F, Args, 3, CI-getName(), CI); + Value *Args[] = { +CI-getOperand(1), +CI-getOperand(2), +CI-getOperand(3) + }; + return new CallInst(F, Args, sizeof(Args)/sizeof(Args[0]), CI-getName(), CI); } /// Convert the llvm.part.set.iX.iY.iZ intrinsic. This intrinsic takes @@ -591,12 +592,13 @@ } // Return a call to the implementation function - Value *Args[3]; - Args[0] = CI-getOperand(1); - Args[1] = CI-getOperand(2); - Args[2] = CI-getOperand(3); - Args[3] = CI-getOperand(4); - return new CallInst(F, Args, 4, CI-getName(), CI); + Value *Args[] = { +CI-getOperand(1), +CI-getOperand(2), +CI-getOperand(3), +CI-getOperand(4) + }; + return new CallInst(F, Args, sizeof(Args)/sizeof(Args[0]), CI-getName(), CI); } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.80 - 1.81 --- Log message: Fix problems in the PartSet lowering having to do with incorrect bit width. --- Diffs of the changes: (+5 -3) IntrinsicLowering.cpp |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.80 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.81 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.80 Thu Apr 12 16:53:38 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Apr 16 17:21:14 2007 @@ -538,8 +538,10 @@ new BranchInst(large, small, is_large, entry); // Block large -BinaryOperator* MaskBits = +Instruction* MaskBits = BinaryOperator::createSub(RepBitWidth, NumBits, , large); +MaskBits = CastInst::createIntegerCast(MaskBits, RepMask-getType(), + false, , large); BinaryOperator* Mask1 = BinaryOperator::createLShr(RepMask, MaskBits, , large); BinaryOperator* Rep2 = BinaryOperator::createAnd(Mask1, Rep, , large); @@ -575,10 +577,10 @@ Value* t8= BinaryOperator::createXor(t7, ValMask, , reverse); Value* t9= BinaryOperator::createAnd(t8, Val, , reverse); Value* t10 = BinaryOperator::createShl(Rep4, Lo, , reverse); -if (RepBits ValBits) +if (32 ValBits) RepBitWidth = castConstantInt(ConstantExpr::getZExt(RepBitWidth, ValTy)); -else if (RepBits ValBits) +else if (32 ValBits) RepBitWidth = castConstantInt(ConstantExpr::getTrunc(RepBitWidth, ValTy)); Value* t11 = BinaryOperator::createSub(RepBitWidth, Hi, , reverse); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.78 - 1.79 --- Log message: Fix bugs in generated code for part_select and part_set so that llc doesn't barf when CBE is run with a program that contains these intrinsics. --- Diffs of the changes: (+45 -36) IntrinsicLowering.cpp | 81 +++--- 1 files changed, 45 insertions(+), 36 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.78 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.79 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.78 Thu Apr 12 07:46:33 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Apr 12 08:30:14 2007 @@ -270,13 +270,14 @@ if (F-isDeclaration()) { // Get the arguments to the function -Value* Val = F-getOperand(0); -Value* Right = F-getOperand(1); -Value* Left = 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. +Function::arg_iterator args = F-arg_begin(); +Value* Val = args++; Val-setName(Val); +Value* Lo = args++; Lo-setName(Lo); +Value* Hi = args++; Hi-setName(High); + +// We want to select a range of bits here such that [Hi, Lo] is shifted +// down to the low bits. However, it is quite possible that Hi is smaller +// than Lo 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); @@ -286,12 +287,12 @@ 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, +// Cast Hi and Lo to the size of Val so the widths are all the same +if (Hi-getType() != Val-getType()) + Hi = CastInst::createIntegerCast(Hi, Val-getType(), false, tmp, CurBB); -if (Right-getType() != Val-getType()) - Right = CastInst::createIntegerCast(Right, Val-getType(), false, +if (Lo-getType() != Val-getType()) + Lo = CastInst::createIntegerCast(Lo, Val-getType(), false, tmp, CurBB); // Compute a few things that both cases will need, up front. @@ -299,23 +300,23 @@ 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 +// Compare the Hi and Lo 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); +ICmpInst *Cmp = new ICmpInst(ICmpInst::ICMP_ULT, Hi, Lo, 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); + BinaryOperator::createSub(Hi, Lo,fbits, FwdSize); new BranchInst(Compute, FwdSize); // Second, compute the number of bits in the reverse case. Instruction* RBitSize = - BinaryOperator::createSub(Right, Left, rbits, RevSize); + BinaryOperator::createSub(Lo, Hi, 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 +// amount (either Hi or Lo) 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 @@ -327,11 +328,11 @@ BitSize-addIncoming(FBitSize, FwdSize); BitSize-addIncoming(RBitSize, RevSize); -// Get the ShiftAmount as the smaller of Left/Right +// Get the ShiftAmount as the smaller of Hi/Lo PHINode *ShiftAmt = new PHINode(Val-getType(), shiftamt, Compute); ShiftAmt-reserveOperandSpace(2); -ShiftAmt-addIncoming(Right, FwdSize); -ShiftAmt-addIncoming(Left, RevSize); +ShiftAmt-addIncoming(Lo, FwdSize); +ShiftAmt-addIncoming(Hi, RevSize); // Increment the bit size Instruction *BitSizePlusOne = @@ -403,9 +404,9 @@ // 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); + Args[0] = CI-getOperand(1); + Args[1] = CI-getOperand(2); + Args[2] = CI-getOperand(3);
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.79 - 1.80 --- Log message: Make sure intrinsics that are lowered to functions make the function weak linkage so we only end up with one of them in a program. These are, after all overloaded and templatish in nature. --- Diffs of the changes: (+2 -2) IntrinsicLowering.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.79 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.80 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.79 Thu Apr 12 08:30:14 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Apr 12 16:53:38 2007 @@ -264,7 +264,7 @@ Name[i] = '_'; Module* M = F-getParent(); F = castFunction(M-getOrInsertFunction(Name, FT)); - F-setLinkage(GlobalValue::InternalLinkage); + F-setLinkage(GlobalValue::WeakLinkage); // If we haven't defined the impl function yet, do so now if (F-isDeclaration()) { @@ -437,7 +437,7 @@ Name[i] = '_'; Module* M = F-getParent(); F = castFunction(M-getOrInsertFunction(Name, FT)); - F-setLinkage(GlobalValue::InternalLinkage); + F-setLinkage(GlobalValue::WeakLinkage); // If we haven't defined the impl function yet, do so now if (F-isDeclaration()) { ___ llvm-commits mailing list [EMAIL PROTECTED] http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.76 - 1.77 --- Log message: For PR1284: http://llvm.org/PR1284 : Implement the part_set intrinsic. --- Diffs of the changes: (+193 -11) IntrinsicLowering.cpp | 204 +++--- 1 files changed, 193 insertions(+), 11 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.76 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.77 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.76 Mon Apr 9 22:20:39 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Wed Apr 11 21:48:46 2007 @@ -236,14 +236,17 @@ 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) { +/// Convert the llvm.part.select.iX.iY intrinsic. This intrinsic takes +/// three integer arguments. The first argument is the Value from which the +/// bits will be selected. It may be of any bit width. The second and third +/// arguments specify a range of bits to select with the second argument +/// specifying the low bit and the third argument specifying the high bit. Both +/// must be type i32. The result is the corresponding selected bits from the +/// Value in the same width as the Value (first argument). If the low bit index +/// is higher than the high bit index then the inverse selection is done and +/// the bits are returned in inverse order. +/// @brief Lowering of llvm.part.select intrinsic. +static Instruction *LowerPartSelect(CallInst *CI) { // Make sure we're dealing with a part select intrinsic here Function *F = CI-getCalledFunction(); const FunctionType *FT = F-getFunctionType(); @@ -268,8 +271,8 @@ // Get the arguments to the function Value* Val = F-getOperand(0); -Value* Left = F-getOperand(1); -Value* Right = F-getOperand(2); +Value* Right = F-getOperand(1); +Value* Left = 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 @@ -406,6 +409,181 @@ return new CallInst(F, Args, 3, CI-getName(), CI); } +/// Convert the llvm.part.set.iX.iY.iZ intrinsic. This intrinsic takes +/// four integer arguments (iAny %Value, iAny %Replacement, i32 %Low, i32 %High) +/// The first two arguments can be any bit width. The result is the same width +/// as %Value. The operation replaces bits between %Low and %High with the value +/// in %Replacement. If %Replacement is not the same width, it is truncated or +/// zero extended as appropriate to fit the bits being replaced. If %Low is +/// greater than %High then the inverse set of bits are replaced. +/// @brief Lowering of llvm.bit.part.set intrinsic. +static Instruction *LowerPartSet(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() != 4 || !FT-getParamType(0)-isInteger() || + !FT-getParamType(1)-isInteger() || !FT-getParamType(2)-isInteger() || + !FT-getParamType(3)-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 = castFunction(M-getOrInsertFunction(Name, FT)); + F-setLinkage(GlobalValue::InternalLinkage); + + // If we haven't defined the impl function yet, do so now + if (F-isDeclaration()) { +// Note: the following code is based on code generated by llvm2cpp with +// the following input. This is just *one* example of a generated function. +// The functions vary by bit width of result and first two arguments. +// The generated code has been changed to deal with any bit width not just +// the 32/64 bitwidths used in the above sample. +// +// define i64 @part_set(i64 %Val, i32 %Rep, i32 %Lo, i32 %Hi) { +// entry: +// %is_forward = icmp ult i32 %Lo, %Hi +// %Lo.pn = select i1 %is_forward, i32 %Hi, i32 %Lo +// %Hi.pn = select i1 %is_forward, i32 %Lo, i32 %Hi +// %iftmp.16.0 = sub i32 %Lo.pn, %Hi.pn +// icmp ult i32 %iftmp.16.0, 32 +// br i1 %1, label
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.75 - 1.76 --- Log message: apparently some people commit without building the tree, or they forget to commit a LOT of files. --- Diffs of the changes: (+1 -1) IntrinsicLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.75 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.76 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.75 Wed Apr 4 18:48:25 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Apr 9 22:20:39 2007 @@ -475,7 +475,7 @@ break; } - case Intrinsic::bit_part_select: + case Intrinsic::part_select: CI-replaceAllUsesWith(LowerBitPartSelect(CI)); break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
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 = castFunction(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,
Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
This is incorrect for the changes you made to the ctpop (etc) prototypes. They will assert in RAUW. -Chris On Apr 1, 2007, at 12:35 AM, Reid Spencer wrote: Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.72 - 1.73 --- Log message: For PR1297: http://llvm.org/PR1297 : Support overloaded intrinsics bswap, ctpop, cttz, ctlz. --- Diffs of the changes: (+4 -17) IntrinsicLowering.cpp | 21 - 1 files changed, 4 insertions(+), 17 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.72 llvm/lib/ CodeGen/IntrinsicLowering.cpp:1.73 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.72 Thu Mar 1 14:24:30 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cppSun Apr 1 02:35:23 2007 @@ -236,8 +236,6 @@ return LowerCTPOP(V, IP); } - - void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { Function *Callee = CI-getCalledFunction(); assert(Callee Cannot lower an indirect call!); @@ -283,30 +281,19 @@ Type::VoidTy, AbortFCache); break; } - case Intrinsic::ctpop_i8: - case Intrinsic::ctpop_i16: - case Intrinsic::ctpop_i32: - case Intrinsic::ctpop_i64: + case Intrinsic::ctpop: CI-replaceAllUsesWith(LowerCTPOP(CI-getOperand(1), CI)); break; - case Intrinsic::bswap_i16: - case Intrinsic::bswap_i32: - case Intrinsic::bswap_i64: + case Intrinsic::bswap: CI-replaceAllUsesWith(LowerBSWAP(CI-getOperand(1), CI)); break; - case Intrinsic::ctlz_i8: - case Intrinsic::ctlz_i16: - case Intrinsic::ctlz_i32: - case Intrinsic::ctlz_i64: + case Intrinsic::ctlz: CI-replaceAllUsesWith(LowerCTLZ(CI-getOperand(1), CI)); break; - case Intrinsic::cttz_i8: - case Intrinsic::cttz_i16: - case Intrinsic::cttz_i32: - case Intrinsic::cttz_i64: { + case Intrinsic::cttz: { // cttz(x) - ctpop(~X (X-1)) Value *Src = CI-getOperand(1); Value *NotSrc = BinaryOperator::createNot(Src, Src-getName() +.not, CI); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.73 - 1.74 --- Log message: For PR1297: http://llvm.org/PR1297 : Make sure that the CTPOP result is casted to i32 as the bit counting intrinsics all return i32 now (this affects CTLZ and CTTZ as well). --- Diffs of the changes: (+1 -1) IntrinsicLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.73 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.74 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.73 Sun Apr 1 02:35:23 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Sun Apr 1 20:01:49 2007 @@ -218,7 +218,7 @@ V = BinaryOperator::createAdd(LHS, RHS, ctpop.step, IP); } - return V; + return CastInst::createIntegerCast(V, Type::Int32Ty, false, ctpop, IP); } /// LowerCTLZ - Emit the code to lower ctlz of V before the specified ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.70 - 1.71 --- Log message: Provide a more meaningful name. --- Diffs of the changes: (+1 -1) IntrinsicLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.70 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.71 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.70 Thu Feb 22 12:51:19 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Wed Feb 28 12:37:50 2007 @@ -357,7 +357,7 @@ case Intrinsic::dbg_func_start: case Intrinsic::dbg_declare: case Intrinsic::eh_exception: - case Intrinsic::eh_handlers: + case Intrinsic::eh_selector: break;// Simply strip out debugging and eh intrinsics case Intrinsic::memcpy_i32: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.68 - 1.69 --- Log message: Remove assertion. --- Diffs of the changes: (+1 -4) IntrinsicLowering.cpp |5 + 1 files changed, 1 insertion(+), 4 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.68 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.69 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.68 Wed Feb 21 16:53:45 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Feb 22 10:12:17 2007 @@ -356,12 +356,9 @@ case Intrinsic::dbg_region_end: case Intrinsic::dbg_func_start: case Intrinsic::dbg_declare: -break;// Simply strip out debugging intrinsics - case Intrinsic::eh_exception: case Intrinsic::eh_handlers: -assert(0 Should not have leaked through); -break; +break;// Simply strip out debugging intrinsics case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.69 - 1.70 --- Log message: Update comment. --- Diffs of the changes: (+1 -1) IntrinsicLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.69 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.70 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.69 Thu Feb 22 10:12:17 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Feb 22 12:51:19 2007 @@ -358,7 +358,7 @@ case Intrinsic::dbg_declare: case Intrinsic::eh_exception: case Intrinsic::eh_handlers: -break;// Simply strip out debugging intrinsics +break;// Simply strip out debugging and eh intrinsics case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.67 - 1.68 --- Log message: Selection and lowering for exception handling. --- Diffs of the changes: (+5 -0) IntrinsicLowering.cpp |5 + 1 files changed, 5 insertions(+) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.67 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.68 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.67 Tue Feb 13 00:01:22 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Wed Feb 21 16:53:45 2007 @@ -357,6 +357,11 @@ case Intrinsic::dbg_func_start: case Intrinsic::dbg_declare: break;// Simply strip out debugging intrinsics + + case Intrinsic::eh_exception: + case Intrinsic::eh_handlers: +assert(0 Should not have leaked through); +break; case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.66 - 1.67 --- Log message: eliminate vector-related allocations --- Diffs of the changes: (+4 -2) IntrinsicLowering.cpp |6 -- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.66 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.67 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.66 Tue Feb 6 13:06:38 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Tue Feb 13 00:01:22 2007 @@ -19,6 +19,7 @@ #include llvm/CodeGen/IntrinsicLowering.h #include llvm/Support/Streams.h #include llvm/Target/TargetData.h +#include llvm/ADT/SmallVector.h using namespace llvm; template class ArgIt @@ -52,8 +53,9 @@ FunctionType::get(RetTy, ParamTys, false)); } - std::vectorValue* Operands(ArgBegin, ArgEnd); - CallInst *NewCI = new CallInst(FCache, Operands, CI-getName(), CI); + SmallVectorValue*, 8 Operands(ArgBegin, ArgEnd); + CallInst *NewCI = new CallInst(FCache, Operands[0], Operands.size(), + CI-getName(), CI); if (!CI-use_empty()) CI-replaceAllUsesWith(NewCI); return NewCI; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.65 - 1.66 --- Log message: Two fixes: 1. Memset takes an i32 for the value to set, not i8. This was causing GCC to ICE all over the place (PR1183: http://llvm.org/PR1183 ). 2. memcpy/memmove were not properly zext/trunc'ing the size in some cases. --- Diffs of the changes: (+33 -38) IntrinsicLowering.cpp | 71 +++--- 1 files changed, 33 insertions(+), 38 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.65 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.66 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.65 Tue Feb 6 00:07:51 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Tue Feb 6 13:06:38 2007 @@ -356,45 +356,29 @@ case Intrinsic::dbg_declare: break;// Simply strip out debugging intrinsics - case Intrinsic::memcpy_i32: { -static Constant *MemcpyFCache = 0; -Value * Size = castValue(CI-op_end()-1); -if (Size-getType() != TD.getIntPtrType()) - Size-replaceAllUsesWith(new ZExtInst(Size, TD.getIntPtrType())); -ReplaceCallWith(memcpy, CI, CI-op_begin()+1, CI-op_end()-1, -(*(CI-op_begin()+1))-getType(), MemcpyFCache); -break; - } + case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: { static Constant *MemcpyFCache = 0; -Value * Size = castValue(CI-op_end()-1); -if (Size-getType() != TD.getIntPtrType()) - Size-replaceAllUsesWith(new TruncInst(Size, TD.getIntPtrType())); -ReplaceCallWith(memcpy, CI, CI-op_begin()+1, CI-op_end()-1, - (*(CI-op_begin()+1))-getType(), MemcpyFCache); -break; - } - case Intrinsic::memmove_i32: { -static Constant *MemmoveFCache = 0; -Value * Size = castValue(CI-op_end()-1); -if (Size-getType() != TD.getIntPtrType()) - Size-replaceAllUsesWith(new ZExtInst(Size, TD.getIntPtrType())); -ReplaceCallWith(memmove, CI, CI-op_begin()+1, CI-op_end()-1, -(*(CI-op_begin()+1))-getType(), MemmoveFCache); +Value *Size = CI-getOperand(3); +const Type *IntPtr = TD.getIntPtrType(); +if (Size-getType()-getPrimitiveSizeInBits() +IntPtr-getPrimitiveSizeInBits()) + Size = new ZExtInst(Size, IntPtr, , CI); +else if (Size-getType()-getPrimitiveSizeInBits() + IntPtr-getPrimitiveSizeInBits()) + Size = new TruncInst(Size, IntPtr, , CI); +Value *Ops[3]; +Ops[0] = CI-getOperand(1); +Ops[1] = CI-getOperand(2); +Ops[2] = Size; +ReplaceCallWith(memcpy, CI, Ops, Ops+3, CI-getOperand(1)-getType(), +MemcpyFCache); break; } + case Intrinsic::memmove_i32: case Intrinsic::memmove_i64: { static Constant *MemmoveFCache = 0; -Value * Size = castValue(CI-op_end()-1); -if (Size-getType() != TD.getIntPtrType()) - Size-replaceAllUsesWith(new TruncInst(Size, TD.getIntPtrType())); -ReplaceCallWith(memmove, CI, CI-op_begin()+1, CI-op_end()-1, -(*(CI-op_begin()+1))-getType(), MemmoveFCache); -break; - } - case Intrinsic::memset_i32: { -static Constant *MemsetFCache = 0; -Value *Size = castValue(CI-op_end()-1); +Value *Size = CI-getOperand(3); const Type *IntPtr = TD.getIntPtrType(); if (Size-getType()-getPrimitiveSizeInBits() IntPtr-getPrimitiveSizeInBits()) @@ -402,12 +386,18 @@ else if (Size-getType()-getPrimitiveSizeInBits() IntPtr-getPrimitiveSizeInBits()) Size = new TruncInst(Size, IntPtr, , CI); -ReplaceCallWith(memset, CI, CI-op_begin()+1, CI-op_end()-1, -(*(CI-op_begin()+1))-getType(), MemsetFCache); +Value *Ops[3]; +Ops[0] = CI-getOperand(1); +Ops[1] = CI-getOperand(2); +Ops[2] = Size; +ReplaceCallWith(memmove, CI, Ops, Ops+3, CI-getOperand(1)-getType(), +MemmoveFCache); +break; } + case Intrinsic::memset_i32: case Intrinsic::memset_i64: { static Constant *MemsetFCache = 0; -Value *Size = castValue(CI-op_end()-1); +Value *Size = CI-getOperand(3); const Type *IntPtr = TD.getIntPtrType(); if (Size-getType()-getPrimitiveSizeInBits() IntPtr-getPrimitiveSizeInBits()) @@ -415,8 +405,13 @@ else if (Size-getType()-getPrimitiveSizeInBits() IntPtr-getPrimitiveSizeInBits()) Size = new TruncInst(Size, IntPtr, , CI); -ReplaceCallWith(memset, CI, CI-op_begin()+1, CI-op_end()-1, -(*(CI-op_begin()+1))-getType(), MemsetFCache); +Value *Ops[3]; +Ops[0] = CI-getOperand(1); +// Extend the amount to i32. +Ops[1] = new ZExtInst(CI-getOperand(2), Type::Int32Ty, , CI); +Ops[2] = Size; +ReplaceCallWith(memset, CI, Ops, Ops+3, CI-getOperand(1)-getType(), +MemsetFCache); break; } case Intrinsic::sqrt_f32: { ___ llvm-commits mailing list
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.62 - 1.63 --- Log message: Changes to support making the shift instructions be true BinaryOperators. This feature is needed in order to support shifts of more than 255 bits on large integer types. This changes the syntax for llvm assembly to make shl, ashr and lshr instructions look like a binary operator: shl i32 %X, 1 instead of shl i32 %X, i8 1 Additionally, this should help a few passes perform additional optimizations. --- Diffs of the changes: (+32 -32) IntrinsicLowering.cpp | 64 +- 1 files changed, 32 insertions(+), 32 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.62 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.63 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.62 Tue Jan 30 14:08:37 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Feb 1 20:16:22 2007 @@ -118,22 +118,22 @@ switch(BitSize) { default: assert(0 Unhandled type size of value to byteswap!); case 16: { -Value *Tmp1 = new ShiftInst(Instruction::Shl, V, -ConstantInt::get(Type::Int8Ty,8),bswap.2,IP); -Value *Tmp2 = new ShiftInst(Instruction::LShr, V, -ConstantInt::get(Type::Int8Ty,8),bswap.1,IP); +Value *Tmp1 = BinaryOperator::create(Instruction::Shl, V, +ConstantInt::get(V-getType(),8),bswap.2,IP); +Value *Tmp2 = BinaryOperator::create(Instruction::LShr, V, +ConstantInt::get(V-getType(),8),bswap.1,IP); V = BinaryOperator::createOr(Tmp1, Tmp2, bswap.i16, IP); break; } case 32: { -Value *Tmp4 = new ShiftInst(Instruction::Shl, V, - ConstantInt::get(Type::Int8Ty,24),bswap.4, IP); -Value *Tmp3 = new ShiftInst(Instruction::Shl, V, - ConstantInt::get(Type::Int8Ty,8),bswap.3,IP); -Value *Tmp2 = new ShiftInst(Instruction::LShr, V, - ConstantInt::get(Type::Int8Ty,8),bswap.2,IP); -Value *Tmp1 = new ShiftInst(Instruction::LShr, V, - ConstantInt::get(Type::Int8Ty,24),bswap.1, IP); +Value *Tmp4 = BinaryOperator::create(Instruction::Shl, V, + ConstantInt::get(V-getType(),24),bswap.4, IP); +Value *Tmp3 = BinaryOperator::create(Instruction::Shl, V, + ConstantInt::get(V-getType(),8),bswap.3,IP); +Value *Tmp2 = BinaryOperator::create(Instruction::LShr, V, + ConstantInt::get(V-getType(),8),bswap.2,IP); +Value *Tmp1 = BinaryOperator::create(Instruction::LShr, V, + ConstantInt::get(V-getType(),24),bswap.1, IP); Tmp3 = BinaryOperator::createAnd(Tmp3, ConstantInt::get(Type::Int32Ty, 0xFF), bswap.and3, IP); @@ -146,22 +146,22 @@ break; } case 64: { -Value *Tmp8 = new ShiftInst(Instruction::Shl, V, - ConstantInt::get(Type::Int8Ty,56),bswap.8, IP); -Value *Tmp7 = new ShiftInst(Instruction::Shl, V, - ConstantInt::get(Type::Int8Ty,40),bswap.7, IP); -Value *Tmp6 = new ShiftInst(Instruction::Shl, V, - ConstantInt::get(Type::Int8Ty,24),bswap.6, IP); -Value *Tmp5 = new ShiftInst(Instruction::Shl, V, - ConstantInt::get(Type::Int8Ty,8),bswap.5, IP); -Value* Tmp4 = new ShiftInst(Instruction::LShr, V, - ConstantInt::get(Type::Int8Ty,8),bswap.4, IP); -Value* Tmp3 = new ShiftInst(Instruction::LShr, V, - ConstantInt::get(Type::Int8Ty,24),bswap.3, IP); -Value* Tmp2 = new ShiftInst(Instruction::LShr, V, - ConstantInt::get(Type::Int8Ty,40),bswap.2, IP); -Value* Tmp1 = new ShiftInst(Instruction::LShr, V, - ConstantInt::get(Type::Int8Ty,56),bswap.1, IP); +Value *Tmp8 = BinaryOperator::create(Instruction::Shl, V, + ConstantInt::get(V-getType(),56),bswap.8, IP); +Value *Tmp7 = BinaryOperator::create(Instruction::Shl, V, + ConstantInt::get(V-getType(),40),bswap.7, IP); +Value *Tmp6 = BinaryOperator::create(Instruction::Shl, V, + ConstantInt::get(V-getType(),24),bswap.6, IP); +Value *Tmp5 = BinaryOperator::create(Instruction::Shl, V, + ConstantInt::get(V-getType(),8),bswap.5, IP); +Value* Tmp4 = BinaryOperator::create(Instruction::LShr, V, + ConstantInt::get(V-getType(),8),bswap.4, IP); +Value* Tmp3 = BinaryOperator::create(Instruction::LShr, V, + ConstantInt::get(V-getType(),24),bswap.3, IP); +Value* Tmp2 =
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.61 - 1.62 --- Log message: For PR1136: http://llvm.org/PR1136 : Rename GlobalVariable::isExternal as isDeclaration to avoid confusion with external linkage types. --- Diffs of the changes: (+1 -1) IntrinsicLowering.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.61 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.62 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.61 Mon Jan 29 11:42:06 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Tue Jan 30 14:08:37 2007 @@ -61,7 +61,7 @@ void IntrinsicLowering::AddPrototypes(Module M) { for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) -if (I-isExternal() !I-use_empty()) +if (I-isDeclaration() !I-use_empty()) switch (I-getIntrinsicID()) { default: break; case Intrinsic::setjmp: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.60 - 1.61 --- Log message: Use TargetData to obtain the correct size of the size_t argument for functions like memcpy, memmove and memset. Ensure only one prototype is used for these functions and that it matches the system definition by using the appropriate type for the size argument. --- Diffs of the changes: (+24 -9) IntrinsicLowering.cpp | 33 - 1 files changed, 24 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.60 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.61 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.60 Sun Jan 28 16:28:00 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Jan 29 11:42:06 2007 @@ -18,6 +18,7 @@ #include llvm/Type.h #include llvm/CodeGen/IntrinsicLowering.h #include llvm/Support/Streams.h +#include llvm/Target/TargetData.h using namespace llvm; template class ArgIt @@ -79,22 +80,21 @@ case Intrinsic::memcpy_i64: M.getOrInsertFunction(memcpy, PointerType::get(Type::Int8Ty), PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), Type::Int32Ty, - (Type *)0); + PointerType::get(Type::Int8Ty), + TD.getIntPtrType(), (Type *)0); break; case Intrinsic::memmove_i32: case Intrinsic::memmove_i64: M.getOrInsertFunction(memmove, PointerType::get(Type::Int8Ty), PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), Type::Int32Ty, - (Type *)0); + PointerType::get(Type::Int8Ty), + TD.getIntPtrType(), (Type *)0); break; case Intrinsic::memset_i32: case Intrinsic::memset_i64: M.getOrInsertFunction(memset, PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), - Type::Int32Ty, (--(--I-arg_end()))-getType(), - (Type *)0); + PointerType::get(Type::Int8Ty), Type::Int32Ty, + TD.getIntPtrType(), (Type *)0); break; case Intrinsic::sqrt_f32: case Intrinsic::sqrt_f64: @@ -358,6 +358,9 @@ case Intrinsic::memcpy_i32: { static Constant *MemcpyFCache = 0; +Value * Size = castValue(CI-op_end()-1); +if (Size-getType() != TD.getIntPtrType()) + Size-replaceAllUsesWith(new ZExtInst(Size, TD.getIntPtrType())); ReplaceCallWith(memcpy, CI, CI-op_begin()+1, CI-op_end()-1, (*(CI-op_begin()+1))-getType(), MemcpyFCache); break; @@ -365,31 +368,43 @@ case Intrinsic::memcpy_i64: { static Constant *MemcpyFCache = 0; Value * Size = castValue(CI-op_end()-1); -if (Size-getType() != Type::Int32Ty) - Size-replaceAllUsesWith(new TruncInst(Size, Type::Int32Ty)); +if (Size-getType() != TD.getIntPtrType()) + Size-replaceAllUsesWith(new TruncInst(Size, TD.getIntPtrType())); ReplaceCallWith(memcpy, CI, CI-op_begin()+1, CI-op_end()-1, (*(CI-op_begin()+1))-getType(), MemcpyFCache); break; } case Intrinsic::memmove_i32: { static Constant *MemmoveFCache = 0; +Value * Size = castValue(CI-op_end()-1); +if (Size-getType() != TD.getIntPtrType()) + Size-replaceAllUsesWith(new ZExtInst(Size, TD.getIntPtrType())); ReplaceCallWith(memmove, CI, CI-op_begin()+1, CI-op_end()-1, (*(CI-op_begin()+1))-getType(), MemmoveFCache); break; } case Intrinsic::memmove_i64: { static Constant *MemmoveFCache = 0; +Value * Size = castValue(CI-op_end()-1); +if (Size-getType() != TD.getIntPtrType()) + Size-replaceAllUsesWith(new TruncInst(Size, TD.getIntPtrType())); ReplaceCallWith(memmove, CI, CI-op_begin()+1, CI-op_end()-1, (*(CI-op_begin()+1))-getType(), MemmoveFCache); break; } case Intrinsic::memset_i32: { static Constant *MemsetFCache = 0; +Value * Size = castValue(CI-op_end()-1); +if (Size-getType() != TD.getIntPtrType()) + Size-replaceAllUsesWith(new ZExtInst(Size, TD.getIntPtrType())); ReplaceCallWith(memset, CI, CI-op_begin()+1, CI-op_end()-1, (*(CI-op_begin()+1))-getType(), MemsetFCache); } case Intrinsic::memset_i64: { static Constant *MemsetFCache = 0; +Value * Size = castValue(CI-op_end()-1); +if (Size-getType() != TD.getIntPtrType()) + Size-replaceAllUsesWith(new TruncInst(Size, TD.getIntPtrType())); ReplaceCallWith(memset, CI, CI-op_begin()+1, CI-op_end()-1, (*(CI-op_begin()+1))-getType(), MemsetFCache); break;
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.59 - 1.60 --- Log message: For PR1138: http://llvm.org/PR1138 : Force memcpy to be the 32-bit variant. Since this is only used with CBE and lli which both target 32-bit machines, this should be okay. --- Diffs of the changes: (+11 -4) IntrinsicLowering.cpp | 15 +++ 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.59 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.60 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.59 Sun Jan 14 20:27:26 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Sun Jan 28 16:28:00 2007 @@ -77,13 +77,17 @@ break; case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: -EnsureFunctionExists(M, memcpy, I-arg_begin(), --I-arg_end(), - I-arg_begin()-getType()); +M.getOrInsertFunction(memcpy, PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), Type::Int32Ty, + (Type *)0); break; case Intrinsic::memmove_i32: case Intrinsic::memmove_i64: -EnsureFunctionExists(M, memmove, I-arg_begin(), --I-arg_end(), - I-arg_begin()-getType()); +M.getOrInsertFunction(memmove, PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), Type::Int32Ty, + (Type *)0); break; case Intrinsic::memset_i32: case Intrinsic::memset_i64: @@ -360,6 +364,9 @@ } case Intrinsic::memcpy_i64: { static Constant *MemcpyFCache = 0; +Value * Size = castValue(CI-op_end()-1); +if (Size-getType() != Type::Int32Ty) + Size-replaceAllUsesWith(new TruncInst(Size, Type::Int32Ty)); ReplaceCallWith(memcpy, CI, CI-op_begin()+1, CI-op_end()-1, (*(CI-op_begin()+1))-getType(), MemcpyFCache); break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
On Sun, 2007-01-28 at 16:04 -0800, Chris Lattner wrote: For PR1138: http://llvm.org/PR1138 : Force memcpy to be the 32-bit variant. Since this is only used with CBE and lli which both target 32-bit machines, this should be okay. What do you mean, which both target 32-bit machines? CBE supports Alpha, sparcv9, x86-64, and ppc64. Just going on statements you made in IRC about CBE targeting only 32-bit machines. -Chris --- Diffs of the changes: (+11 -4) IntrinsicLowering.cpp | 15 +++ 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.59 llvm/lib/ CodeGen/IntrinsicLowering.cpp:1.60 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.59 Sun Jan 14 20:27:26 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Sun Jan 28 16:28:00 2007 @@ -77,13 +77,17 @@ break; case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: -EnsureFunctionExists(M, memcpy, I-arg_begin(), --I- arg_end(), - I-arg_begin()-getType()); +M.getOrInsertFunction(memcpy, PointerType::get (Type::Int8Ty), + PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), Type::Int32Ty, + (Type *)0); break; case Intrinsic::memmove_i32: case Intrinsic::memmove_i64: -EnsureFunctionExists(M, memmove, I-arg_begin(), --I- arg_end(), - I-arg_begin()-getType()); +M.getOrInsertFunction(memmove, PointerType::get (Type::Int8Ty), + PointerType::get(Type::Int8Ty), + PointerType::get(Type::Int8Ty), Type::Int32Ty, + (Type *)0); break; case Intrinsic::memset_i32: case Intrinsic::memset_i64: @@ -360,6 +364,9 @@ } case Intrinsic::memcpy_i64: { static Constant *MemcpyFCache = 0; +Value * Size = castValue(CI-op_end()-1); +if (Size-getType() != Type::Int32Ty) + Size-replaceAllUsesWith(new TruncInst(Size, Type::Int32Ty)); ReplaceCallWith(memcpy, CI, CI-op_begin()+1, CI-op_end()-1, (*(CI-op_begin()+1))-getType(), MemcpyFCache); break; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
On Jan 28, 2007, at 7:52 PM, Reid Spencer wrote: On Sun, 2007-01-28 at 16:04 -0800, Chris Lattner wrote: For PR1138: http://llvm.org/PR1138 : Force memcpy to be the 32-bit variant. Since this is only used with CBE and lli which both target 32-bit machines, this should be okay. What do you mean, which both target 32-bit machines? CBE supports Alpha, sparcv9, x86-64, and ppc64. Just going on statements you made in IRC about CBE targeting only 32-bit machines. I don't recall making that the statement, but even if I did, it is certainly not true :) -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
On Sun, 2007-01-28 at 20:31 -0800, Chris Lattner wrote: On Jan 28, 2007, at 7:52 PM, Reid Spencer wrote: On Sun, 2007-01-28 at 16:04 -0800, Chris Lattner wrote: For PR1138: http://llvm.org/PR1138 : Force memcpy to be the 32-bit variant. Since this is only used with CBE and lli which both target 32-bit machines, this should be okay. What do you mean, which both target 32-bit machines? CBE supports Alpha, sparcv9, x86-64, and ppc64. Just going on statements you made in IRC about CBE targeting only 32-bit machines. I don't recall making that the statement, but even if I did, it is certainly not true :) I gathered that :) I'll use TD to get the right size and trunc or zext up to deal with 32/64 mismatches. However, this will take a bit. IntrinsicLowering doesn't have TargetData so I have to pass it in from the callers. If I don't get to it tonight, I'll do it tomorrow. -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
I don't recall making that the statement, but even if I did, it is certainly not true :) I gathered that :) I'll use TD to get the right size and trunc or zext up to deal with 32/64 mismatches. However, this will take a bit. IntrinsicLowering doesn't have TargetData so I have to pass it in from the callers. If I don't get to it tonight, I'll do it tomorrow. Okay, thanks Reid! -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.57 - 1.58 --- Log message: eliminate calls to Type::isInteger, preferring isIntegral instead. --- Diffs of the changes: (+2 -2) IntrinsicLowering.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.57 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.58 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.57 Sun Jan 7 02:52:43 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Sun Jan 14 20:03:16 2007 @@ -107,7 +107,7 @@ /// LowerBSWAP - Emit the code to lower bswap of V before the specified /// instruction IP. static Value *LowerBSWAP(Value *V, Instruction *IP) { - assert(V-getType()-isInteger() Can't bswap a non-integer type!); + assert(V-getType()-isIntegral() Can't bswap a non-integer type!); unsigned BitSize = V-getType()-getPrimitiveSizeInBits(); @@ -193,7 +193,7 @@ /// LowerCTPOP - Emit the code to lower ctpop of V before the specified /// instruction IP. static Value *LowerCTPOP(Value *V, Instruction *IP) { - assert(V-getType()-isInteger() Can't ctpop a non-integer type!); + assert(V-getType()-isIntegral() Can't ctpop a non-integer type!); static const uint64_t MaskValues[6] = { 0xULL, 0xULL, ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.55 - 1.56 --- Log message: Change the interface to Module::getOrInsertFunction to be easier to use,to resolve PR1088: http://llvm.org/PR1088 , and to help PR411: http://llvm.org/PR411 . This simplifies many clients also --- Diffs of the changes: (+40 -75) IntrinsicLowering.cpp | 115 +- 1 files changed, 40 insertions(+), 75 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.55 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.56 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.55 Sat Dec 30 23:55:36 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Sun Jan 7 02:12:01 2007 @@ -21,15 +21,14 @@ using namespace llvm; template class ArgIt -static Function *EnsureFunctionExists(Module M, const char *Name, - ArgIt ArgBegin, ArgIt ArgEnd, - const Type *RetTy) { - if (Function *F = M.getNamedFunction(Name)) return F; - // It doesn't already exist in the program, insert a new definition now. +static void EnsureFunctionExists(Module M, const char *Name, + ArgIt ArgBegin, ArgIt ArgEnd, + const Type *RetTy) { + // Insert a correctly-typed definition now. std::vectorconst Type * ParamTys; for (ArgIt I = ArgBegin; I != ArgEnd; ++I) ParamTys.push_back(I-getType()); - return M.getOrInsertFunction(Name, FunctionType::get(RetTy, ParamTys, false)); + M.getOrInsertFunction(Name, FunctionType::get(RetTy, ParamTys, false)); } /// ReplaceCallWith - This function is used when we want to lower an intrinsic @@ -38,53 +37,24 @@ /// prototype doesn't match the arguments we expect to pass in. template class ArgIt static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI, - ArgIt ArgBegin, ArgIt ArgEnd, bool isSigned, - const Type *RetTy, Function *FCache) { + ArgIt ArgBegin, ArgIt ArgEnd, + const Type *RetTy, Constant *FCache) { if (!FCache) { // If we haven't already looked up this function, check to see if the // program already contains a function with this name. Module *M = CI-getParent()-getParent()-getParent(); -FCache = M-getNamedFunction(NewFn); -if (!FCache) { - // It doesn't already exist in the program, insert a new definition now. - std::vectorconst Type * ParamTys; - for (ArgIt I = ArgBegin; I != ArgEnd; ++I) -ParamTys.push_back((*I)-getType()); - FCache = M-getOrInsertFunction(NewFn, - FunctionType::get(RetTy, ParamTys, false)); -} - } - - const FunctionType *FT = FCache-getFunctionType(); - std::vectorValue* Operands; - unsigned ArgNo = 0; - for (ArgIt I = ArgBegin; I != ArgEnd ArgNo != FT-getNumParams(); - ++I, ++ArgNo) { -Value *Arg = *I; -if (Arg-getType() != FT-getParamType(ArgNo)) { - Instruction::CastOps opcode = CastInst::getCastOpcode(Arg, isSigned, - FT-getParamType(ArgNo), isSigned); - Arg = CastInst::create(opcode, Arg, FT-getParamType(ArgNo), - Arg-getName(), CI); -} -Operands.push_back(Arg); - } - // Pass nulls into any additional arguments... - for (; ArgNo != FT-getNumParams(); ++ArgNo) -Operands.push_back(Constant::getNullValue(FT-getParamType(ArgNo))); - - std::string Name = CI-getName(); CI-setName(); - if (FT-getReturnType() == Type::VoidTy) Name.clear(); - CallInst *NewCI = new CallInst(FCache, Operands, Name, CI); - if (!CI-use_empty()) { -Value *V = NewCI; -if (CI-getType() != NewCI-getType()) { - Instruction::CastOps opcode = CastInst::getCastOpcode(NewCI, isSigned, - CI-getType(), isSigned); - V = CastInst::create(opcode, NewCI, CI-getType(), Name, CI); -} -CI-replaceAllUsesWith(V); +// Get or insert the definition now. +std::vectorconst Type * ParamTys; +for (ArgIt I = ArgBegin; I != ArgEnd; ++I) + ParamTys.push_back((*I)-getType()); +FCache = M-getOrInsertFunction(NewFn, +FunctionType::get(RetTy, ParamTys, false)); } + + std::vectorValue* Operands(ArgBegin, ArgEnd); + CallInst *NewCI = new CallInst(FCache, Operands, CI-getName(), CI); + if (!CI-use_empty()) +CI-replaceAllUsesWith(NewCI); return NewCI; } @@ -286,10 +256,9 @@ // by the lowerinvoke pass. In both cases, the right thing to do is to // convert the call to an explicit setjmp or longjmp call. case Intrinsic::setjmp: { -static Function *SetjmpFCache = 0; -static const unsigned castOpcodes[] = { Instruction::BitCast }; +static Constant *SetjmpFCache = 0; Value *V = ReplaceCallWith(setjmp, CI, CI-op_begin()+1, CI-op_end(), -
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.56 - 1.57 --- Log message: llvm 2.0 doesn't support llvm.isunordered.* --- Diffs of the changes: (+0 -17) IntrinsicLowering.cpp | 17 - 1 files changed, 17 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.56 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.57 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.56 Sun Jan 7 02:12:01 2007 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Sun Jan 7 02:52:43 2007 @@ -92,11 +92,6 @@ Type::Int32Ty, (--(--I-arg_end()))-getType(), (Type *)0); break; - case Intrinsic::isunordered_f32: - case Intrinsic::isunordered_f64: -EnsureFunctionExists(M, isunordered, I-arg_begin(), I-arg_end(), - Type::BoolTy); -break; case Intrinsic::sqrt_f32: case Intrinsic::sqrt_f64: if(I-arg_begin()-getType() == Type::FloatTy) @@ -392,18 +387,6 @@ (*(CI-op_begin()+1))-getType(), MemsetFCache); break; } - case Intrinsic::isunordered_f32: - case Intrinsic::isunordered_f64: { -Value *L = CI-getOperand(1); -Value *R = CI-getOperand(2); - -Value *LIsNan = new FCmpInst(FCmpInst::FCMP_ONE, L, L, LIsNan, CI); -Value *RIsNan = new FCmpInst(FCmpInst::FCMP_ONE, R, R, RIsNan, CI); -CI-replaceAllUsesWith( - BinaryOperator::create(Instruction::Or, LIsNan, RIsNan, - isunordered, CI)); -break; - } case Intrinsic::sqrt_f32: { static Constant *sqrtfFCache = 0; ReplaceCallWith(sqrtf, CI, CI-op_begin()+1, CI-op_end(), ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.53 - 1.54 --- Log message: For PR950: http://llvm.org/PR950 : This patch removes the SetCC instructions and replaces them with the ICmp and FCmp instructions. The SetCondInst instruction has been removed and been replaced with ICmpInst and FCmpInst. --- Diffs of the changes: (+2 -2) IntrinsicLowering.cpp |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.53 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.54 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.53 Thu Dec 21 02:28:31 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Sat Dec 23 00:05:40 2006 @@ -432,8 +432,8 @@ Value *L = CI-getOperand(1); Value *R = CI-getOperand(2); -Value *LIsNan = new SetCondInst(Instruction::SetNE, L, L, LIsNan, CI); -Value *RIsNan = new SetCondInst(Instruction::SetNE, R, R, RIsNan, CI); +Value *LIsNan = new FCmpInst(FCmpInst::FCMP_ONE, L, L, LIsNan, CI); +Value *RIsNan = new FCmpInst(FCmpInst::FCMP_ONE, R, R, RIsNan, CI); CI-replaceAllUsesWith( BinaryOperator::create(Instruction::Or, LIsNan, RIsNan, isunordered, CI)); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.52 - 1.53 --- Log message: Simplify all the casting business and get rid of isSigned(). --- Diffs of the changes: (+18 -64) IntrinsicLowering.cpp | 82 ++ 1 files changed, 18 insertions(+), 64 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.52 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.53 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.52 Mon Dec 18 02:47:13 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Dec 21 02:28:31 2006 @@ -38,8 +38,7 @@ /// prototype doesn't match the arguments we expect to pass in. template class ArgIt static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI, - ArgIt ArgBegin, ArgIt ArgEnd, - const unsigned *castOpcodes, + ArgIt ArgBegin, ArgIt ArgEnd, bool isSigned, const Type *RetTy, Function *FCache) { if (!FCache) { // If we haven't already looked up this function, check to see if the @@ -59,20 +58,15 @@ const FunctionType *FT = FCache-getFunctionType(); std::vectorValue* Operands; unsigned ArgNo = 0; - for (ArgIt I = ArgBegin; I != ArgEnd ArgNo != FT-getNumParams(); + for (ArgIt I = ArgBegin; I != ArgEnd ArgNo != FT-getNumParams(); ++I, ++ArgNo) { Value *Arg = *I; -if (Arg-getType() != FT-getParamType(ArgNo)) - if (castOpcodes[ArgNo]) -Arg = CastInst::create(Instruction::CastOps(castOpcodes[ArgNo]), - Arg, FT-getParamType(ArgNo), Arg-getName(), CI); - else { -Instruction::CastOps opcode = CastInst::getCastOpcode(Arg, -Arg-getType()-isSigned(), FT-getParamType(ArgNo), -FT-getParamType(ArgNo)-isSigned()); -Arg = CastInst::create(opcode, Arg, FT-getParamType(ArgNo), - Arg-getName(), CI); - } +if (Arg-getType() != FT-getParamType(ArgNo)) { + Instruction::CastOps opcode = CastInst::getCastOpcode(Arg, isSigned, + FT-getParamType(ArgNo), isSigned); + Arg = CastInst::create(opcode, Arg, FT-getParamType(ArgNo), + Arg-getName(), CI); +} Operands.push_back(Arg); } // Pass nulls into any additional arguments... @@ -85,9 +79,8 @@ if (!CI-use_empty()) { Value *V = NewCI; if (CI-getType() != NewCI-getType()) { - Instruction::CastOps opcode = CastInst::getCastOpcode(NewCI, - NewCI-getType()-isSigned(), CI-getType(), - CI-getType()-isSigned()); + Instruction::CastOps opcode = CastInst::getCastOpcode(NewCI, isSigned, + CI-getType(), isSigned); V = CastInst::create(opcode, NewCI, CI-getType(), Name, CI); } CI-replaceAllUsesWith(V); @@ -400,75 +393,38 @@ break;// Simply strip out debugging intrinsics case Intrinsic::memcpy_i32: { -// The memcpy intrinsic take an extra alignment argument that the memcpy -// libc function does not. -static unsigned opcodes[] = - { Instruction::BitCast, Instruction::BitCast, Instruction::BitCast }; -// FIXME: -// if (target_is_64_bit) opcodes[2] = Instruction::ZExt; -// else opcodes[2] = Instruction::BitCast; static Function *MemcpyFCache = 0; ReplaceCallWith(memcpy, CI, CI-op_begin()+1, CI-op_end()-1, -opcodes, (*(CI-op_begin()+1))-getType(), MemcpyFCache); +false, (*(CI-op_begin()+1))-getType(), MemcpyFCache); break; } case Intrinsic::memcpy_i64: { -static unsigned opcodes[] = - { Instruction::BitCast, Instruction::BitCast, Instruction::Trunc }; -// FIXME: -// if (target_is_64_bit) opcodes[2] = Instruction::BitCast; -// else opcodes[2] = Instruction::Trunc; static Function *MemcpyFCache = 0; ReplaceCallWith(memcpy, CI, CI-op_begin()+1, CI-op_end()-1, - opcodes, (*(CI-op_begin()+1))-getType(), MemcpyFCache); + false, (*(CI-op_begin()+1))-getType(), MemcpyFCache); break; } case Intrinsic::memmove_i32: { -// The memmove intrinsic take an extra alignment argument that the memmove -// libc function does not. -static unsigned opcodes[] = - { Instruction::BitCast, Instruction::BitCast, Instruction::BitCast }; -// FIXME: -// if (target_is_64_bit) opcodes[2] = Instruction::ZExt; -// else opcodes[2] = Instruction::BitCast; static Function *MemmoveFCache = 0; ReplaceCallWith(memmove, CI, CI-op_begin()+1, CI-op_end()-1, -opcodes, (*(CI-op_begin()+1))-getType(), MemmoveFCache); +false, (*(CI-op_begin()+1))-getType(), MemmoveFCache); break; } case Intrinsic::memmove_i64: { -// The memmove intrinsic take an extra alignment argument that the memmove -// libc function does not. -static
Re: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Convert the last uses of CastInst::createInferredCast to a normal cast creation. These changes are still temporary but at least this pushes knowledge of signedness out closer to where it can be determined properly and allows signedness to be removed from VMCore. Ah, ok, I get it now :) -Chris ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.50 - 1.51 --- Log message: This case isn't needed with recent changes to ConstantInt::get --- Diffs of the changes: (+1 -3) IntrinsicLowering.cpp |4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.50 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.51 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.50 Mon Dec 11 19:17:40 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Dec 11 23:19:46 2006 @@ -238,9 +238,7 @@ unsigned BitSize = V-getType()-getPrimitiveSizeInBits(); for (unsigned i = 1, ct = 0; i != BitSize; i = 1, ++ct) { -Value *MaskCst = - ConstantExpr::getTruncOrBitCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]), - V-getType()); +Value *MaskCst = ConstantInt::get(V-getType(), MaskValues[ct]); Value *LHS = BinaryOperator::createAnd(V, MaskCst, cppop.and1, IP); Value *VShift = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy, i), ctpop.sh, IP); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp LiveInterval.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.47 - 1.48 LiveInterval.cpp updated: 1.36 - 1.37 --- Log message: Changed to using llvm streams. --- Diffs of the changes: (+14 -15) IntrinsicLowering.cpp | 19 +-- LiveInterval.cpp | 10 +- 2 files changed, 14 insertions(+), 15 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.47 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.48 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.47 Sun Nov 26 19:05:09 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Nov 27 20:08:17 2006 @@ -11,14 +11,13 @@ // //===--===// -#include llvm/CodeGen/IntrinsicLowering.h #include llvm/Constants.h #include llvm/DerivedTypes.h #include llvm/Module.h #include llvm/Instructions.h #include llvm/Type.h -#include iostream - +#include llvm/CodeGen/IntrinsicLowering.h +#include llvm/Support/Streams.h using namespace llvm; template class ArgIt @@ -275,11 +274,11 @@ switch (Callee-getIntrinsicID()) { case Intrinsic::not_intrinsic: -std::cerr Cannot lower a call to a non-intrinsic function ' +llvm_cerr Cannot lower a call to a non-intrinsic function ' Callee-getName() '!\n; abort(); default: -std::cerr Error: Code generator does not support intrinsic function ' +llvm_cerr Error: Code generator does not support intrinsic function ' Callee-getName() '!\n; abort(); @@ -357,9 +356,9 @@ case Intrinsic::stackrestore: { static bool Warned = false; if (!Warned) - std::cerr WARNING: this target does not support the llvm.stack -(Callee-getIntrinsicID() == Intrinsic::stacksave ? - save : restore) intrinsic.\n; + llvm_cerr WARNING: this target does not support the llvm.stack + (Callee-getIntrinsicID() == Intrinsic::stacksave ? +save : restore) intrinsic.\n; Warned = true; if (Callee-getIntrinsicID() == Intrinsic::stacksave) CI-replaceAllUsesWith(Constant::getNullValue(CI-getType())); @@ -368,7 +367,7 @@ case Intrinsic::returnaddress: case Intrinsic::frameaddress: -std::cerr WARNING: this target does not support the llvm. +llvm_cerr WARNING: this target does not support the llvm. (Callee-getIntrinsicID() == Intrinsic::returnaddress ? return : frame) address intrinsic.\n; CI-replaceAllUsesWith(ConstantPointerNull::get( @@ -381,7 +380,7 @@ case Intrinsic::pcmarker: break;// Simply strip out pcmarker on unsupported architectures case Intrinsic::readcyclecounter: { -std::cerr WARNING: this target does not support the llvm.readcyclecoun +llvm_cerr WARNING: this target does not support the llvm.readcyclecoun ter intrinsic. It is being lowered to a constant 0\n; CI-replaceAllUsesWith(ConstantInt::get(Type::ULongTy, 0)); break; Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.36 llvm/lib/CodeGen/LiveInterval.cpp:1.37 --- llvm/lib/CodeGen/LiveInterval.cpp:1.36 Thu Nov 2 14:25:49 2006 +++ llvm/lib/CodeGen/LiveInterval.cpp Mon Nov 27 20:08:17 2006 @@ -18,8 +18,9 @@ // //===--===// -#include llvm/CodeGen/LiveInterval.h #include llvm/ADT/STLExtras.h +#include llvm/CodeGen/LiveInterval.h +#include llvm/Support/Streams.h #include llvm/Target/MRegisterInfo.h #include algorithm #include iostream @@ -466,16 +467,15 @@ } } - std::ostream llvm::operator(std::ostream os, const LiveRange LR) { return os '[' LR.start ',' LR.end ':' LR.ValId ); } void LiveRange::dump() const { - std::cerr *this \n; + llvm_cerr *this \n; } -void LiveInterval::print(std::ostream OS, const MRegisterInfo *MRI) const { +void LiveInterval::print(llvm_ostream OS, const MRegisterInfo *MRI) const { if (MRI MRegisterInfo::isPhysicalRegister(reg)) OS MRI-getName(reg); else @@ -508,5 +508,5 @@ } void LiveInterval::dump() const { - std::cerr *this \n; + llvm_cerr *this \n; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.45 - 1.46 --- Log message: Simplify IntrinsicLowering and clarify that it is only for use by the CBE and interpreter. --- Diffs of the changes: (+3 -3) IntrinsicLowering.cpp |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.45 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.46 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.45 Wed Nov 8 00:47:33 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Wed Nov 15 12:00:10 2006 @@ -7,7 +7,7 @@ // //===--===// // -// This file implements the default intrinsic lowering implementation. +// This file implements the IntrinsicLowering class. // //===--===// @@ -82,7 +82,7 @@ return NewCI; } -void DefaultIntrinsicLowering::AddPrototypes(Module M) { +void IntrinsicLowering::AddPrototypes(Module M) { for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (I-isExternal() !I-use_empty()) switch (I-getIntrinsicID()) { @@ -263,7 +263,7 @@ -void DefaultIntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { +void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { Function *Callee = CI-getCalledFunction(); assert(Callee Cannot lower an indirect call!); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.44 - 1.45 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+14 -38) IntrinsicLowering.cpp | 52 +- 1 files changed, 14 insertions(+), 38 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.44 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.45 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.44 Fri Oct 20 02:07:24 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Wed Nov 8 00:47:33 2006 @@ -138,12 +138,6 @@ static Value *LowerBSWAP(Value *V, Instruction *IP) { assert(V-getType()-isInteger() Can't bswap a non-integer type!); - const Type *DestTy = V-getType(); - - // Force to unsigned so that the shift rights are logical. - if (DestTy-isSigned()) -V = new CastInst(V, DestTy-getUnsignedVersion(), V-getName(), IP); - unsigned BitSize = V-getType()-getPrimitiveSizeInBits(); switch(BitSize) { @@ -151,7 +145,7 @@ case 16: { Value *Tmp1 = new ShiftInst(Instruction::Shl, V, ConstantInt::get(Type::UByteTy,8),bswap.2,IP); -Value *Tmp2 = new ShiftInst(Instruction::Shr, V, +Value *Tmp2 = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy,8),bswap.1,IP); V = BinaryOperator::createOr(Tmp1, Tmp2, bswap.i16, IP); break; @@ -160,10 +154,10 @@ Value *Tmp4 = new ShiftInst(Instruction::Shl, V, ConstantInt::get(Type::UByteTy,24),bswap.4, IP); Value *Tmp3 = new ShiftInst(Instruction::Shl, V, - ConstantInt::get(Type::UByteTy,8),bswap.3,IP); -Value *Tmp2 = new ShiftInst(Instruction::Shr, V, - ConstantInt::get(Type::UByteTy,8),bswap.2,IP); -Value *Tmp1 = new ShiftInst(Instruction::Shr, V, + ConstantInt::get(Type::UByteTy,8),bswap.3,IP); +Value *Tmp2 = new ShiftInst(Instruction::LShr, V, + ConstantInt::get(Type::UByteTy,8),bswap.2,IP); +Value *Tmp1 = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy,24),bswap.1, IP); Tmp3 = BinaryOperator::createAnd(Tmp3, ConstantInt::get(Type::UIntTy, 0xFF), @@ -184,14 +178,14 @@ Value *Tmp6 = new ShiftInst(Instruction::Shl, V, ConstantInt::get(Type::UByteTy,24),bswap.6, IP); Value *Tmp5 = new ShiftInst(Instruction::Shl, V, - ConstantInt::get(Type::UByteTy,8),bswap.5,IP); -Value *Tmp4 = new ShiftInst(Instruction::Shr, V, - ConstantInt::get(Type::UByteTy,8),bswap.4,IP); -Value *Tmp3 = new ShiftInst(Instruction::Shr, V, + ConstantInt::get(Type::UByteTy,8),bswap.5, IP); +Value* Tmp4 = new ShiftInst(Instruction::LShr, V, + ConstantInt::get(Type::UByteTy,8),bswap.4, IP); +Value* Tmp3 = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy,24),bswap.3, IP); -Value *Tmp2 = new ShiftInst(Instruction::Shr, V, +Value* Tmp2 = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy,40),bswap.2, IP); -Value *Tmp1 = new ShiftInst(Instruction::Shr, V, +Value* Tmp1 = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy,56),bswap.1, IP); Tmp7 = BinaryOperator::createAnd(Tmp7, ConstantInt::get(Type::ULongTy, @@ -222,9 +216,6 @@ break; } } - - if (V-getType() != DestTy) -V = new CastInst(V, DestTy, V-getName(), IP); return V; } @@ -239,48 +230,33 @@ 0xULL, 0xULL }; - const Type *DestTy = V-getType(); - - // Force to unsigned so that the shift rights are logical. - if (DestTy-isSigned()) -V = new CastInst(V, DestTy-getUnsignedVersion(), V-getName(), IP); - unsigned BitSize = V-getType()-getPrimitiveSizeInBits(); + for (unsigned i = 1, ct = 0; i != BitSize; i = 1, ++ct) { Value *MaskCst = ConstantExpr::getCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]), V-getType()); Value *LHS = BinaryOperator::createAnd(V, MaskCst, cppop.and1, IP); -Value *VShift = new ShiftInst(Instruction::Shr, V, +Value *VShift = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy, i), ctpop.sh, IP); Value *RHS = BinaryOperator::createAnd(VShift, MaskCst, cppop.and2, IP); V =
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.42 - 1.43 --- Log message: Handle new forms of llvm.dbg intrinsics. --- Diffs of the changes: (+1 -0) IntrinsicLowering.cpp |1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.42 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.43 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.42 Mon Mar 13 07:07:37 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Mar 23 12:06:46 2006 @@ -403,6 +403,7 @@ case Intrinsic::dbg_region_start: case Intrinsic::dbg_region_end: case Intrinsic::dbg_func_start: + case Intrinsic::dbg_declare: break;// Simply strip out debugging intrinsics case Intrinsic::memcpy_i32: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.41 - 1.42 --- Log message: Handle the removal of the debug chain. --- Diffs of the changes: (+0 -2) IntrinsicLowering.cpp |2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.41 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.42 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.41 Thu Mar 9 14:02:42 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Mar 13 07:07:37 2006 @@ -403,8 +403,6 @@ case Intrinsic::dbg_region_start: case Intrinsic::dbg_region_end: case Intrinsic::dbg_func_start: -if (CI-getType() != Type::VoidTy) - CI-replaceAllUsesWith(Constant::getNullValue(CI-getType())); break;// Simply strip out debugging intrinsics case Intrinsic::memcpy_i32: ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.40 - 1.41 --- Log message: remove dbg_declare, it's not used yet. --- Diffs of the changes: (+0 -1) IntrinsicLowering.cpp |1 - 1 files changed, 1 deletion(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.40 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.41 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.40 Thu Mar 2 18:00:25 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Mar 9 14:02:42 2006 @@ -402,7 +402,6 @@ case Intrinsic::dbg_stoppoint: case Intrinsic::dbg_region_start: case Intrinsic::dbg_region_end: - case Intrinsic::dbg_declare: case Intrinsic::dbg_func_start: if (CI-getType() != Type::VoidTy) CI-replaceAllUsesWith(Constant::getNullValue(CI-getType())); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.37 - 1.38 --- Log message: Add BSWAP stuff to intrinsic lowering for CBE friends. --- Diffs of the changes: (+106 -2) IntrinsicLowering.cpp | 108 +- 1 files changed, 106 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.37 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.38 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.37 Thu Jan 12 20:22:08 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Jan 16 01:57:00 2006 @@ -128,8 +128,102 @@ } } +/// LowerBSWAP - Emit the code to lower bswap of V before the specified +/// instruction IP. +static Value *LowerBSWAP(Value *V, Instruction *IP) { + assert(V-getType()-isInteger() Can't bswap a non-integer type!); + + const Type *DestTy = V-getType(); + + // Force to unsigned so that the shift rights are logical. + if (DestTy-isSigned()) +V = new CastInst(V, DestTy-getUnsignedVersion(), V-getName(), IP); + + unsigned BitSize = V-getType()-getPrimitiveSizeInBits(); + + switch(BitSize) { + default: assert(0 Unhandled type size of value to byteswap!); + case 16: { +Value *Tmp1 = new ShiftInst(Instruction::Shl, V, + ConstantInt::get(Type::UByteTy,8),bswap.2,IP); +Value *Tmp2 = new ShiftInst(Instruction::Shr, V, + ConstantInt::get(Type::UByteTy,8),bswap.1,IP); +V = BinaryOperator::createOr(Tmp1, Tmp2, bswap.i16, IP); +break; + } + case 32: { +Value *Tmp4 = new ShiftInst(Instruction::Shl, V, + ConstantInt::get(Type::UByteTy,24),bswap.4, IP); +Value *Tmp3 = new ShiftInst(Instruction::Shl, V, + ConstantInt::get(Type::UByteTy,8),bswap.3,IP); +Value *Tmp2 = new ShiftInst(Instruction::Shr, V, + ConstantInt::get(Type::UByteTy,8),bswap.2,IP); +Value *Tmp1 = new ShiftInst(Instruction::Shr, V, + ConstantInt::get(Type::UByteTy,24),bswap.1, IP); +Tmp3 = BinaryOperator::createAnd(Tmp3, + ConstantUInt::get(Type::UIntTy, 0xFF), + bswap.and3, IP); +Tmp2 = BinaryOperator::createAnd(Tmp2, + ConstantUInt::get(Type::UIntTy, 0xFF00), + bswap.and2, IP); +Tmp4 = BinaryOperator::createOr(Tmp4, Tmp3, bswap.or1, IP); +Tmp2 = BinaryOperator::createOr(Tmp2, Tmp1, bswap.or2, IP); +V = BinaryOperator::createOr(Tmp4, Tmp3, bswap.i32, IP); +break; + } + case 64: { +Value *Tmp8 = new ShiftInst(Instruction::Shl, V, + ConstantInt::get(Type::UByteTy,56),bswap.8, IP); +Value *Tmp7 = new ShiftInst(Instruction::Shl, V, + ConstantInt::get(Type::UByteTy,40),bswap.7, IP); +Value *Tmp6 = new ShiftInst(Instruction::Shl, V, + ConstantInt::get(Type::UByteTy,24),bswap.6, IP); +Value *Tmp5 = new ShiftInst(Instruction::Shl, V, + ConstantInt::get(Type::UByteTy,8),bswap.5,IP); +Value *Tmp4 = new ShiftInst(Instruction::Shr, V, + ConstantInt::get(Type::UByteTy,8),bswap.4,IP); +Value *Tmp3 = new ShiftInst(Instruction::Shr, V, + ConstantInt::get(Type::UByteTy,24),bswap.3, IP); +Value *Tmp2 = new ShiftInst(Instruction::Shr, V, + ConstantInt::get(Type::UByteTy,40),bswap.2, IP); +Value *Tmp1 = new ShiftInst(Instruction::Shr, V, + ConstantInt::get(Type::UByteTy,56),bswap.1, IP); +Tmp7 = BinaryOperator::createAnd(Tmp7, + ConstantUInt::get(Type::ULongTy, 0xFFULL), + bswap.and7, IP); +Tmp6 = BinaryOperator::createAnd(Tmp6, +ConstantUInt::get(Type::ULongTy, 0xFF00ULL), +bswap.and6, IP); +Tmp5 = BinaryOperator::createAnd(Tmp5, + ConstantUInt::get(Type::ULongTy, 0xFFULL), + bswap.and5, IP); +Tmp4 = BinaryOperator::createAnd(Tmp4, +ConstantUInt::get(Type::ULongTy, 0xFF00ULL), +bswap.and4, IP); +Tmp3 = BinaryOperator::createAnd(Tmp3, + ConstantUInt::get(Type::ULongTy, 0xFFULL), + bswap.and3, IP); +Tmp2 = BinaryOperator::createAnd(Tmp2, +ConstantUInt::get(Type::ULongTy, 0xFF00ULL), +bswap.and2, IP); +Tmp8 = BinaryOperator::createOr(Tmp8, Tmp7, bswap.or1, IP); +Tmp6 = BinaryOperator::createOr(Tmp6, Tmp5, bswap.or2, IP);
[llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp
Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.36 - 1.37 --- Log message: Add support for the llvm.stacksave/stackrestore intrinsics, this is used by the C backend. --- Diffs of the changes: (+15 -2) IntrinsicLowering.cpp | 17 +++-- 1 files changed, 15 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.36 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.37 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.36 Fri Nov 11 10:46:18 2005 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Thu Jan 12 20:22:08 2006 @@ -248,6 +248,19 @@ break; } + case Intrinsic::stacksave: + case Intrinsic::stackrestore: { +static bool Warned = false; +if (!Warned) + std::cerr WARNING: this target does not support the llvm.stack +(Callee-getIntrinsicID() == Intrinsic::stacksave ? + save : restore) intrinsic.\n; +Warned = true; +if (Callee-getIntrinsicID() == Intrinsic::stacksave) + CI-replaceAllUsesWith(Constant::getNullValue(CI-getType())); +break; + } + case Intrinsic::returnaddress: case Intrinsic::frameaddress: std::cerr WARNING: this target does not support the llvm. @@ -263,8 +276,8 @@ case Intrinsic::pcmarker: break;// Simply strip out pcmarker on unsupported architectures case Intrinsic::readcyclecounter: { -std::cerr WARNING: this target does not support the llvm.readcyclecounter -intrinsic. It is being lowered to a constant 0\n; +std::cerr WARNING: this target does not support the llvm.readcyclecoun + ter intrinsic. It is being lowered to a constant 0\n; CI-replaceAllUsesWith(ConstantUInt::get(Type::ULongTy, 0)); break; } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits