From evan.cheng at apple.com Mon Dec 11 00:25:41 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 11 Dec 2006 00:25:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612110625.kBB6Pfwo014580@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.424 -> 1.425 --- Log message: Clean up some bad code. --- Diffs of the changes: (+3 -5) LegalizeDAG.cpp | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.424 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.425 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.424 Sun Dec 10 20:23:46 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 00:25:26 2006 @@ -4567,12 +4567,10 @@ Tmp = TLI.LowerOperation(DAG.getNode(ISD::BIT_CONVERT, VT, Tmp), DAG); } - MVT::ValueType NVT = Node->getValueType(0); // f32 / f64 must be expanded to i32 / i64. - if (NVT == MVT::f32 || NVT == MVT::f64) { - Lo = DAG.getNode(ISD::BIT_CONVERT, TLI.getTypeToTransformTo(NVT), - Node->getOperand(0)); - Hi = DAG.getConstant(0, TLI.getTypeToTransformTo(NVT)); + if (VT == MVT::f32 || VT == MVT::f64) { + Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0)); + Hi = DAG.getConstant(0, NVT); break; } From evan.cheng at apple.com Mon Dec 11 00:50:19 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 11 Dec 2006 00:50:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612110650.kBB6oJKR014973@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.425 -> 1.426 --- Log message: f32 / f64 node is expanded to one i32 / i64 node. --- Diffs of the changes: (+12 -5) LegalizeDAG.cpp | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.425 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.426 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.425 Mon Dec 11 00:25:26 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 00:50:04 2006 @@ -1547,7 +1547,10 @@ if (Tmp2.getValueType() != MVT::Vector) { SDOperand Lo, Hi; ExpandOp(Tmp2, Lo, Hi); - Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3, Hi, Tmp3); + if (Hi.Val) + Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3, Hi,Tmp3); + else + Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3); Result = LegalizeOp(Result); } else { SDNode *InVal = Tmp2.Val; @@ -1609,8 +1612,10 @@ ExpandOp(Node->getOperand(i), Lo, Hi); NewValues.push_back(Lo); NewValues.push_back(Node->getOperand(i+1)); - NewValues.push_back(Hi); - NewValues.push_back(Node->getOperand(i+1)); + if (Hi.Val) { + NewValues.push_back(Hi); + NewValues.push_back(Node->getOperand(i+1)); + } break; } case Promote: @@ -4570,7 +4575,7 @@ // f32 / f64 must be expanded to i32 / i64. if (VT == MVT::f32 || VT == MVT::f64) { Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0)); - Hi = DAG.getConstant(0, NVT); + Hi = SDOperand(); break; } @@ -4873,7 +4878,9 @@ // is a type that requires multi-step expansion. if (getTypeAction(NVT) != Expand && NVT != MVT::isVoid) { Lo = LegalizeOp(Lo); - Hi = LegalizeOp(Hi); + if (Hi.Val) + // Don't legalize the high part if it is expanded to a single node. + Hi = LegalizeOp(Hi); } // Remember in a map if the values will be reused later. From evan.cheng at apple.com Mon Dec 11 11:25:41 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 11 Dec 2006 11:25:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200612111725.kBBHPfKP022852@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.259 -> 1.260 --- Log message: Don't convert store double C, Ptr to store long C, Ptr if i64 is not a legal type. --- Diffs of the changes: (+12 -9) DAGCombiner.cpp | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.259 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.260 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.259 Sun Dec 10 20:23:46 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Dec 11 11:25:19 2006 @@ -3035,17 +3035,20 @@ } // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr' - // FIXME: We shouldn't do this for TargetConstantFP's. if (ConstantFPSDNode *CFP = dyn_cast(Value)) { - SDOperand Tmp; - if (CFP->getValueType(0) == MVT::f32) { - Tmp = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32); - } else { - assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); - Tmp = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64); + if (Value.getOpcode() != ISD::TargetConstantFP) { + SDOperand Tmp; + if (CFP->getValueType(0) == MVT::f32) { + Tmp = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32); + return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), + ST->getSrcValueOffset()); + } else if (TLI.isTypeLegal(MVT::i64)) { + assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); + Tmp = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64); + return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), + ST->getSrcValueOffset()); + } } - return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), - ST->getSrcValueOffset()); } if (CombinerAA) { From reid at x10sys.com Mon Dec 11 11:42:27 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 11:42:27 -0600 Subject: [llvm-commits] CVS: llvm/utils/findoptdiff Message-ID: <200612111742.kBBHgRV3023106@zion.cs.uiuc.edu> Changes in directory llvm/utils: findoptdiff added (r1.1) --- Log message: Provide a script that can track down which optimization pass causes different code to be produced between two llvm builds that differe slightly. This is useful in tracking down mis-optimization bugs. --- Diffs of the changes: (+99 -0) findoptdiff | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 99 insertions(+) Index: llvm/utils/findoptdiff diff -c /dev/null llvm/utils/findoptdiff:1.1 *** /dev/null Mon Dec 11 11:42:22 2006 --- llvm/utils/findoptdiff Mon Dec 11 11:42:12 2006 *************** *** 0 **** --- 1,99 ---- + #!/bin/bash + # + # findoptdiff + # + # This script helps find the optimization difference between two llvm + # builds. It is useful when you have a build that is known to work and + # one that exhibits an optimization problem. Identifying the difference + # between the two builds can lead to discovery of the source of a + # mis-optimization. + # + # The script takes two llvm build paths as arguments. These specify the + # the two llvm builds to compare. It is generally expected that they + # are "close cousins". That is, they are the same except that the + # second build contains some experimental optimization features that + # are suspected of producing a misoptimization. + # + # The script takes two bytecode files, one from each build. They are + # presumed to be a compilation of the same program or program fragment + # with the only difference being the builds. + # + # The script operates by iteratively applying the optimizations that gccas + # and gccld run until there is a difference in the assembly resulting + # from the optimization. The difference is then reported with the set of + # optimization passes that produce the difference. + # + # To work around differences in the assembly language format, the script + # can also take two filter arguments that post-process the assembly + # so they can be differenced without making false positives for known + # differences in the two builds. These filters are optional. + # + # Usage: + # findoptdiff llvm1 llvm2 bc1 bc2 filter1 filter2 + # + # Where: + # llvm1 + # is the path to the first llvm build dir + # llvm2 + # is the path to the second llvm build dir + # bc1 + # is the bytecode file for the first llvm environment + # bc2 + # is the bytecode file for the second llvm environment + # filter1 + # is an optional filter for filtering the llvm1 generated assembly + # filter2 + # is an optional filter for filtering the llvm2 generated assembly + # + llvm1=$1 + llvm2=$2 + bc1=$3 + bc2=$4 + filt1=$5 + if [ -z "$filt1" ] ; then + filt1="cat" + fi + filt2=$6 + if [ -z "$filt2" ] ; then + filt2="cat" + fi + opt1=opt.$bc1 + opt2=opt.$bc2 + ll1=${bc1}.ll + ll2=${bc2}.ll + dir1="/proj/llvm/llvm-test-1/External/SPEC/CINT2000/300.twolf" + opt1="/proj/llvm/llvm-1/Debug/bin/opt" + dis1="/proj/llvm/llvm-1/Debug/bin/llvm-dis" + dir2="/proj/llvm/llvm-test-2/External/SPEC/CINT2000/300.twolf" + opt2="/proj/llvm/llvm-2/Debug/bin/opt" + dis2="/proj/llvm/llvm-2/Debug/bin/llvm-dis" + bcfile="Output/300.twolf.linked.rbc" + optll="opt.ll" + + all_switches="-verify -lowersetjmp -funcresolve -raiseallocs -simplifycfg -mem2reg -globalopt -globaldce -ipconstprop -deadargelim -instcombine -simplifycfg -prune-eh -inline -simplify-libcalls -argpromotion -raise -tailduplicate -simplifycfg -scalarrepl -instcombine -predsimplify -condprop -tailcallelim -simplifycfg -reassociate -licm -loop-unswitch -instcombine -indvars -loop-unroll -instcombine -load-vn -gcse -sccp -instcombine -condprop -dse -dce -simplifycfg -deadtypeelim -constmerge -funcresolve -internalize -ipsccp -globalopt -constmerge -deadargelim -inline -prune-eh -globalopt -globaldce -argpromotion -instcombine -predsimplify -scalarrepl -globalsmodref-aa -licm -load-vn -gcse -dse -instcombine -simplifycfg -verify" + + function tryit { + switches_to_use="$1" + cd $dir1 + $opt1 $switches_to_use "$bcfile" -o - | $dis1 | $filt1 > "$optll" + cd $dir2 + $opt2 $switches_to_use "$bcfile" -o - | $dis2 | $filt2 > "$optll" + diff "$dir1/$optll" "$dir2/$optll" > /dev/null + if [ $? -ne 0 ] ; then + echo + echo "Diff fails with these switches:" + echo $switches + echo "Differences:" + diff "$dir1/$optll" "$dir2/$optll" | head + exit 1 + fi + return 1 + } + + for sw in $all_switches ; do + echo -n " $sw" + switches="$switches $sw" + if tryit "$switches" ; then + break; + fi + done From jlaskey at apple.com Mon Dec 11 12:11:09 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 11 Dec 2006 12:11:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCJITInfo.cpp Message-ID: <200612111811.kBBIB9vi023600@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCJITInfo.cpp updated: 1.35 -> 1.36 --- Log message: Layout proper frame for ppc64. --- Diffs of the changes: (+38 -28) PPCJITInfo.cpp | 66 ++++++++++++++++++++++++++++++++------------------------- 1 files changed, 38 insertions(+), 28 deletions(-) Index: llvm/lib/Target/PowerPC/PPCJITInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.35 llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.36 --- llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.35 Sun Dec 10 07:09:42 2006 +++ llvm/lib/Target/PowerPC/PPCJITInfo.cpp Mon Dec 11 12:10:54 2006 @@ -84,9 +84,14 @@ // FIXME: need to save v[0-19] for altivec? // FIXME: could shrink frame // Set up a proper stack frame - "stwu r1, -208(r1)\n" + // FIXME Layout + // PowerPC64 ABI linkage - 24 bytes + // parameters - 32 bytes + // 13 double registers - 104 bytes + // 8 int registers - 32 bytes "mflr r0\n" - "stw r0, 216(r1)\n" + "stw r0, 8(r1)\n" + "stwu r1, -208(r1)\n" // Save all int arg registers "stw r10, 204(r1)\n" "stw r9, 200(r1)\n" "stw r8, 196(r1)\n" "stw r7, 192(r1)\n" @@ -146,47 +151,52 @@ // Make space for 8 ints r[3-10] and 13 doubles f[1-13] and the // FIXME: need to save v[0-19] for altivec? // Set up a proper stack frame - "stdu r1, -208(r1)\n" + // Layout + // PowerPC64 ABI linkage - 48 bytes + // parameters - 64 bytes + // 13 double registers - 104 bytes + // 8 int registers - 64 bytes "mflr r0\n" - "std r0, 224(r1)\n" + "std r0, 16(r1)\n" + "stdu r1, -280(r1)\n" // Save all int arg registers - "std r10, 200(r1)\n" "std r9, 192(r1)\n" - "std r8, 184(r1)\n" "std r7, 176(r1)\n" - "std r6, 168(r1)\n" "std r5, 160(r1)\n" - "std r4, 152(r1)\n" "std r3, 144(r1)\n" + "std r10, 272(r1)\n" "std r9, 264(r1)\n" + "std r8, 256(r1)\n" "std r7, 248(r1)\n" + "std r6, 240(r1)\n" "std r5, 232(r1)\n" + "std r4, 224(r1)\n" "std r3, 216(r1)\n" // Save all call-clobbered FP regs. - "stfd f13, 136(r1)\n" "stfd f12, 128(r1)\n" - "stfd f11, 120(r1)\n" "stfd f10, 112(r1)\n" - "stfd f9, 104(r1)\n" "stfd f8, 96(r1)\n" - "stfd f7, 88(r1)\n" "stfd f6, 80(r1)\n" - "stfd f5, 72(r1)\n" "stfd f4, 64(r1)\n" - "stfd f3, 56(r1)\n" "stfd f2, 48(r1)\n" - "stfd f1, 40(r1)\n" + "stfd f13, 208(r1)\n" "stfd f12, 200(r1)\n" + "stfd f11, 192(r1)\n" "stfd f10, 184(r1)\n" + "stfd f9, 176(r1)\n" "stfd f8, 168(r1)\n" + "stfd f7, 160(r1)\n" "stfd f6, 152(r1)\n" + "stfd f5, 144(r1)\n" "stfd f4, 136(r1)\n" + "stfd f3, 128(r1)\n" "stfd f2, 120(r1)\n" + "stfd f1, 112(r1)\n" // Arguments to Compilation Callback: // r3 - our lr (address of the call instruction in stub plus 4) // r4 - stub's lr (address of instruction that called the stub plus 4) // r5 - is64Bit - always 1. "mr r3, r0\n" - "ld r2, 208(r1)\n" // stub's frame + "ld r2, 280(r1)\n" // stub's frame "ld r4, 16(r2)\n" // stub's lr "li r5, 1\n" // 1 == 64 bit "bl _PPCCompilationCallbackC\n" "mtctr r3\n" // Restore all int arg registers - "ld r10, 200(r1)\n" "ld r9, 192(r1)\n" - "ld r8, 184(r1)\n" "ld r7, 176(r1)\n" - "ld r6, 168(r1)\n" "ld r5, 160(r1)\n" - "ld r4, 152(r1)\n" "ld r3, 144(r1)\n" + "ld r10, 272(r1)\n" "ld r9, 264(r1)\n" + "ld r8, 256(r1)\n" "ld r7, 248(r1)\n" + "ld r6, 240(r1)\n" "ld r5, 232(r1)\n" + "ld r4, 224(r1)\n" "ld r3, 216(r1)\n" // Restore all FP arg registers - "lfd f13, 136(r1)\n" "lfd f12, 128(r1)\n" - "lfd f11, 120(r1)\n" "lfd f10, 112(r1)\n" - "lfd f9, 104(r1)\n" "lfd f8, 96(r1)\n" - "lfd f7, 88(r1)\n" "lfd f6, 80(r1)\n" - "lfd f5, 72(r1)\n" "lfd f4, 64(r1)\n" - "lfd f3, 56(r1)\n" "lfd f2, 48(r1)\n" - "lfd f1, 40(r1)\n" + "lfd f13, 208(r1)\n" "lfd f12, 200(r1)\n" + "lfd f11, 192(r1)\n" "lfd f10, 184(r1)\n" + "lfd f9, 176(r1)\n" "lfd f8, 168(r1)\n" + "lfd f7, 160(r1)\n" "lfd f6, 152(r1)\n" + "lfd f5, 144(r1)\n" "lfd f4, 136(r1)\n" + "lfd f3, 128(r1)\n" "lfd f2, 120(r1)\n" + "lfd f1, 112(r1)\n" // Pop 3 frames off the stack and branch to target - "ld r1, 208(r1)\n" + "ld r1, 280(r1)\n" "ld r2, 16(r1)\n" "mtlr r2\n" "bctr\n" From sabre at nondot.org Mon Dec 11 12:29:22 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 12:29:22 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ConstProp/bitcast.ll Message-ID: <200612111829.kBBITM1U024156@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ConstProp: bitcast.ll added (r1.1) --- Log message: constant folding of bitcast is broken. --- Diffs of the changes: (+4 -0) bitcast.ll | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/test/Regression/Transforms/ConstProp/bitcast.ll diff -c /dev/null llvm/test/Regression/Transforms/ConstProp/bitcast.ll:1.1 *** /dev/null Mon Dec 11 12:29:17 2006 --- llvm/test/Regression/Transforms/ConstProp/bitcast.ll Mon Dec 11 12:29:07 2006 *************** *** 0 **** --- 1,4 ---- + ; RUN: llvm-as < %s | llvm-dis && + ; RUN: llvm-as < %s | llvm-dis | grep 0x36A0000000000000 + + %A = global float bitcast (int 1 to float) From sabre at nondot.org Mon Dec 11 12:30:42 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 12:30:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Message-ID: <200612111830.kBBIUgNQ024217@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.111 -> 1.112 --- Log message: Implement correct constant folding of bitcast. This implements Transforms/ConstProp/bitcast.ll and fixes SingleSource/Regression/C/2003-10-12-GlobalVarInitializers --- Diffs of the changes: (+33 -15) ConstantFolding.cpp | 48 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 33 insertions(+), 15 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.111 llvm/lib/VMCore/ConstantFolding.cpp:1.112 --- llvm/lib/VMCore/ConstantFolding.cpp:1.111 Sun Dec 10 20:16:58 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Mon Dec 11 12:30:27 2006 @@ -828,10 +828,6 @@ const Type *DestTy) { const Type *SrcTy = V->getType(); - // Handle some simple cases - if (SrcTy == DestTy) - return (Constant*)V; // no-op cast - if (isa(V)) return UndefValue::get(DestTy); @@ -901,6 +897,8 @@ return ConstantIntegral::get(DestTy, CI->getZExtValue()); return 0; case Instruction::BitCast: + if (SrcTy == DestTy) return (Constant*)V; // no-op cast + // Check to see if we are casting a pointer to an aggregate to a pointer to // the first element. If so, return the appropriate GEP instruction. if (const PointerType *PTy = dyn_cast(V->getType())) @@ -960,18 +958,38 @@ } } - // Handle sign conversion for integer no-op casts. We need to cast the - // value to the correct signedness before we try to cast it to the - // destination type. Be careful to do this only for integer types. - if (isa(V) && SrcTy->isInteger()) { - if (SrcTy->isSigned()) - V = ConstantInt::get(SrcTy->getUnsignedVersion(), - cast(V)->getZExtValue()); - else - V = ConstantInt::get(SrcTy->getSignedVersion(), - cast(V)->getSExtValue()); + // Finally, implement bitcast folding now. The code below doesn't handle + // bitcast right. + if (isa(V)) // ptr->ptr cast. + return ConstantPointerNull::get(cast(DestTy)); + + // Handle integral constant input. + if (const ConstantInt *CI = dyn_cast(V)) { + // Integral -> Integral, must be changing sign. + if (DestTy->isIntegral()) + return ConstantInt::get(DestTy, CI->getZExtValue()); + + if (DestTy->isFloatingPoint()) { + if (DestTy == Type::FloatTy) + return ConstantFP::get(DestTy, BitsToFloat(CI->getZExtValue())); + assert(DestTy == Type::DoubleTy && "Unknown FP type!"); + return ConstantFP::get(DestTy, BitsToDouble(CI->getZExtValue())); + } + // Otherwise, can't fold this (packed?) + return 0; } - break; + + // Handle ConstantFP input. + if (const ConstantFP *FP = dyn_cast(V)) { + // FP -> Integral. + if (DestTy->isIntegral()) { + if (DestTy == Type::FloatTy) + return ConstantInt::get(DestTy, FloatToBits(FP->getValue())); + assert(DestTy == Type::DoubleTy && "Unknown FP type!"); + return ConstantInt::get(DestTy, DoubleToBits(FP->getValue())); + } + } + return 0; default: assert(!"Invalid CE CastInst opcode"); break; From jlaskey at apple.com Mon Dec 11 12:46:11 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 11 Dec 2006 12:46:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200612111846.kBBIkBgV024477@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.242 -> 1.243 --- Log message: Missing opcode. --- Diffs of the changes: (+1 -0) PPCISelLowering.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.242 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.243 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.242 Sun Dec 10 17:12:42 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Mon Dec 11 12:45:56 2006 @@ -310,6 +310,7 @@ case PPCISD::VPERM: return "PPCISD::VPERM"; case PPCISD::Hi: return "PPCISD::Hi"; case PPCISD::Lo: return "PPCISD::Lo"; + case PPCISD::DYNALLOC: return "PPCISD::DYNALLOC"; case PPCISD::GlobalBaseReg: return "PPCISD::GlobalBaseReg"; case PPCISD::SRL: return "PPCISD::SRL"; case PPCISD::SRA: return "PPCISD::SRA"; From sabre at nondot.org Mon Dec 11 12:53:55 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 12:53:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612111853.kBBIrt5X024867@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.426 -> 1.427 --- Log message: Revert changes that broke oggenc on ppc --- Diffs of the changes: (+9 -14) LegalizeDAG.cpp | 23 +++++++++-------------- 1 files changed, 9 insertions(+), 14 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.426 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.427 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.426 Mon Dec 11 00:50:04 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 12:53:38 2006 @@ -1547,10 +1547,7 @@ if (Tmp2.getValueType() != MVT::Vector) { SDOperand Lo, Hi; ExpandOp(Tmp2, Lo, Hi); - if (Hi.Val) - Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3, Hi,Tmp3); - else - Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3); + Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3, Hi, Tmp3); Result = LegalizeOp(Result); } else { SDNode *InVal = Tmp2.Val; @@ -1612,10 +1609,8 @@ ExpandOp(Node->getOperand(i), Lo, Hi); NewValues.push_back(Lo); NewValues.push_back(Node->getOperand(i+1)); - if (Hi.Val) { - NewValues.push_back(Hi); - NewValues.push_back(Node->getOperand(i+1)); - } + NewValues.push_back(Hi); + NewValues.push_back(Node->getOperand(i+1)); break; } case Promote: @@ -4572,10 +4567,12 @@ Tmp = TLI.LowerOperation(DAG.getNode(ISD::BIT_CONVERT, VT, Tmp), DAG); } + MVT::ValueType NVT = Node->getValueType(0); // f32 / f64 must be expanded to i32 / i64. - if (VT == MVT::f32 || VT == MVT::f64) { - Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0)); - Hi = SDOperand(); + if (NVT == MVT::f32 || NVT == MVT::f64) { + Lo = DAG.getNode(ISD::BIT_CONVERT, TLI.getTypeToTransformTo(NVT), + Node->getOperand(0)); + Hi = DAG.getConstant(0, TLI.getTypeToTransformTo(NVT)); break; } @@ -4878,9 +4875,7 @@ // is a type that requires multi-step expansion. if (getTypeAction(NVT) != Expand && NVT != MVT::isVoid) { Lo = LegalizeOp(Lo); - if (Hi.Val) - // Don't legalize the high part if it is expanded to a single node. - Hi = LegalizeOp(Hi); + Hi = LegalizeOp(Hi); } // Remember in a map if the values will be reused later. From criswell at cs.uiuc.edu Mon Dec 11 13:16:10 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Mon, 11 Dec 2006 13:16:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Message-ID: <200612111916.NAA27189@choi.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: ScheduleDAGSimple.cpp updated: 1.20 -> 1.21 --- Log message: It seems the llvm::OStream class does not handle stream manipulators. For now, just grab the stream and perform the output on it directly. --- Diffs of the changes: (+7 -7) ScheduleDAGSimple.cpp | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.20 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.21 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.20 Thu Dec 7 14:04:42 2006 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Mon Dec 11 13:15:36 2006 @@ -713,13 +713,13 @@ void ScheduleDAGSimple::printNI(OStream &O, NodeInfo *NI) const { #ifndef NDEBUG SDNode *Node = NI->Node; - O << " " - << std::hex << Node << std::dec - << ", Lat=" << NI->Latency - << ", Slot=" << NI->Slot - << ", ARITY=(" << Node->getNumOperands() << "," - << Node->getNumValues() << ")" - << " " << Node->getOperationName(&DAG); + *(O.stream()) << " " + << std::hex << Node << std::dec + << ", Lat=" << NI->Latency + << ", Slot=" << NI->Slot + << ", ARITY=(" << Node->getNumOperands() << "," + << Node->getNumValues() << ")" + << " " << Node->getOperationName(&DAG); if (isFlagDefiner(Node)) O << "<#"; if (isFlagUser(Node)) O << ">#"; #endif From evan.cheng at apple.com Mon Dec 11 13:27:29 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 11 Dec 2006 13:27:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612111927.kBBJRTJK002249@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.427 -> 1.428 --- Log message: Re-apply changes that were backed out and fix a naughty typo. --- Diffs of the changes: (+15 -10) LegalizeDAG.cpp | 25 +++++++++++++++---------- 1 files changed, 15 insertions(+), 10 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.427 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.428 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.427 Mon Dec 11 12:53:38 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 13:27:14 2006 @@ -1547,7 +1547,10 @@ if (Tmp2.getValueType() != MVT::Vector) { SDOperand Lo, Hi; ExpandOp(Tmp2, Lo, Hi); - Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3, Hi, Tmp3); + if (Hi.Val) + Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3, Hi,Tmp3); + else + Result = DAG.getNode(ISD::RET, MVT::Other, Tmp1, Lo, Tmp3); Result = LegalizeOp(Result); } else { SDNode *InVal = Tmp2.Val; @@ -1609,8 +1612,10 @@ ExpandOp(Node->getOperand(i), Lo, Hi); NewValues.push_back(Lo); NewValues.push_back(Node->getOperand(i+1)); - NewValues.push_back(Hi); - NewValues.push_back(Node->getOperand(i+1)); + if (Hi.Val) { + NewValues.push_back(Hi); + NewValues.push_back(Node->getOperand(i+1)); + } break; } case Promote: @@ -4567,18 +4572,16 @@ Tmp = TLI.LowerOperation(DAG.getNode(ISD::BIT_CONVERT, VT, Tmp), DAG); } - MVT::ValueType NVT = Node->getValueType(0); // f32 / f64 must be expanded to i32 / i64. - if (NVT == MVT::f32 || NVT == MVT::f64) { - Lo = DAG.getNode(ISD::BIT_CONVERT, TLI.getTypeToTransformTo(NVT), - Node->getOperand(0)); - Hi = DAG.getConstant(0, TLI.getTypeToTransformTo(NVT)); + if (VT == MVT::f32 || VT == MVT::f64) { + Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0)); + Hi = SDOperand(); break; } // Turn this into a load/store pair by default. if (Tmp.Val == 0) - Tmp = ExpandBIT_CONVERT(NVT, Node->getOperand(0)); + Tmp = ExpandBIT_CONVERT(VT, Node->getOperand(0)); ExpandOp(Tmp, Lo, Hi); break; @@ -4875,7 +4878,9 @@ // is a type that requires multi-step expansion. if (getTypeAction(NVT) != Expand && NVT != MVT::isVoid) { Lo = LegalizeOp(Lo); - Hi = LegalizeOp(Hi); + if (Hi.Val) + // Don't legalize the high part if it is expanded to a single node. + Hi = LegalizeOp(Hi); } // Remember in a map if the values will be reused later. From isanbard at gmail.com Mon Dec 11 13:45:59 2006 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 11 Dec 2006 11:45:59 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp In-Reply-To: <200612111916.NAA27189@choi.cs.uiuc.edu> References: <200612111916.NAA27189@choi.cs.uiuc.edu> Message-ID: <48AC13CB-B4B3-4E03-8259-34D5FD5C9A68@gmail.com> Hi John, Could you please file a bug on this and assign it to me? Thanks! -bw On Dec 11, 2006, at 11:16 AM, John Criswell wrote: > > > Changes in directory llvm/lib/CodeGen/SelectionDAG: > > ScheduleDAGSimple.cpp updated: 1.20 -> 1.21 > --- > Log message: > > It seems the llvm::OStream class does not handle stream manipulators. > For now, just grab the stream and perform the output on it directly. > > > --- > Diffs of the changes: (+7 -7) > > ScheduleDAGSimple.cpp | 14 +++++++------- > 1 files changed, 7 insertions(+), 7 deletions(-) > > > Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp > diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.20 > llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.21 > --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.20 Thu > Dec 7 14:04:42 2006 > +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Mon Dec 11 > 13:15:36 2006 > @@ -713,13 +713,13 @@ > void ScheduleDAGSimple::printNI(OStream &O, NodeInfo *NI) const { > #ifndef NDEBUG > SDNode *Node = NI->Node; > - O << " " > - << std::hex << Node << std::dec > - << ", Lat=" << NI->Latency > - << ", Slot=" << NI->Slot > - << ", ARITY=(" << Node->getNumOperands() << "," > - << Node->getNumValues() << ")" > - << " " << Node->getOperationName(&DAG); > + *(O.stream()) << " " > + << std::hex << Node << std::dec > + << ", Lat=" << NI->Latency > + << ", Slot=" << NI->Slot > + << ", ARITY=(" << Node->getNumOperands() << "," > + << Node->getNumValues() << ")" > + << " " << Node->getOperationName(&DAG); > if (isFlagDefiner(Node)) O << "<#"; > if (isFlagUser(Node)) O << ">#"; > #endif > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jlaskey at apple.com Mon Dec 11 14:23:07 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 11 Dec 2006 14:23:07 -0600 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c Message-ID: <200612112023.kBBKN72F016128@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests: 2006-12-11-LoadConstants.c added (r1.1) --- Log message: Loading constants properly test. --- Diffs of the changes: (+189 -0) 2006-12-11-LoadConstants.c | 189 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 189 insertions(+) Index: llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c diff -c /dev/null llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c:1.1 *** /dev/null Mon Dec 11 14:22:54 2006 --- llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c Mon Dec 11 14:22:44 2006 *************** *** 0 **** --- 1,189 ---- + #include + + long zz() { return 0x00000000L; } + long zs() { return 0x0000ffffL; } + long zu() { return 0x00007fffL; } + long sz() { return 0xffff0000L; } + long ss() { return 0xffffffffL; } + long su() { return 0xffff7fffL; } + long uz() { return 0x7fff0000L; } + long us() { return 0x7fffffffL; } + long uu() { return 0x7fff7fffL; } + + long long zzzz() { return 0x0000000000000000LL; } + long long zzzs() { return 0x000000000000ffffLL; } + long long zzzu() { return 0x0000000000007fffLL; } + long long zzsz() { return 0x00000000ffff0000LL; } + long long zzss() { return 0x00000000ffffffffLL; } + long long zzsu() { return 0x00000000ffff7fffLL; } + long long zzuz() { return 0x000000007fff0000LL; } + long long zzus() { return 0x000000007fffffffLL; } + long long zzuu() { return 0x000000007fff7fffLL; } + long long zszz() { return 0x0000ffff00000000LL; } + long long zszs() { return 0x0000ffff0000ffffLL; } + long long zszu() { return 0x0000ffff00007fffLL; } + long long zssz() { return 0x0000ffffffff0000LL; } + long long zsss() { return 0x0000ffffffffffffLL; } + long long zssu() { return 0x0000ffffffff7fffLL; } + long long zsuz() { return 0x0000ffff7fff0000LL; } + long long zsus() { return 0x0000ffff7fffffffLL; } + long long zsuu() { return 0x0000ffff7fff7fffLL; } + long long zuzz() { return 0x00007fff00000000LL; } + long long zuzs() { return 0x00007fff0000ffffLL; } + long long zuzu() { return 0x00007fff00007fffLL; } + long long zusz() { return 0x00007fffffff0000LL; } + long long zuss() { return 0x00007fffffffffffLL; } + long long zusu() { return 0x00007fffffff7fffLL; } + long long zuuz() { return 0x00007fff7fff0000LL; } + long long zuus() { return 0x00007fff7fffffffLL; } + long long zuuu() { return 0x00007fff7fff7fffLL; } + long long szzz() { return 0xffff000000000000LL; } + long long szzs() { return 0xffff00000000ffffLL; } + long long szzu() { return 0xffff000000007fffLL; } + long long szsz() { return 0xffff0000ffff0000LL; } + long long szss() { return 0xffff0000ffffffffLL; } + long long szsu() { return 0xffff0000ffff7fffLL; } + long long szuz() { return 0xffff00007fff0000LL; } + long long szus() { return 0xffff00007fffffffLL; } + long long szuu() { return 0xffff00007fff7fffLL; } + long long sszz() { return 0xffffffff00000000LL; } + long long sszs() { return 0xffffffff0000ffffLL; } + long long sszu() { return 0xffffffff00007fffLL; } + long long sssz() { return 0xffffffffffff0000LL; } + long long ssss() { return 0xffffffffffffffffLL; } + long long sssu() { return 0xffffffffffff7fffLL; } + long long ssuz() { return 0xffffffff7fff0000LL; } + long long ssus() { return 0xffffffff7fffffffLL; } + long long ssuu() { return 0xffffffff7fff7fffLL; } + long long suzz() { return 0xffff7fff00000000LL; } + long long suzs() { return 0xffff7fff0000ffffLL; } + long long suzu() { return 0xffff7fff00007fffLL; } + long long susz() { return 0xffff7fffffff0000LL; } + long long suss() { return 0xffff7fffffffffffLL; } + long long susu() { return 0xffff7fffffff7fffLL; } + long long suuz() { return 0xffff7fff7fff0000LL; } + long long suus() { return 0xffff7fff7fffffffLL; } + long long suuu() { return 0xffff7fff7fff7fffLL; } + long long uzzz() { return 0x7fff000000000000LL; } + long long uzzs() { return 0x7fff00000000ffffLL; } + long long uzzu() { return 0x7fff000000007fffLL; } + long long uzsz() { return 0x7fff0000ffff0000LL; } + long long uzss() { return 0x7fff0000ffffffffLL; } + long long uzsu() { return 0x7fff0000ffff7fffLL; } + long long uzuz() { return 0x7fff00007fff0000LL; } + long long uzus() { return 0x7fff00007fffffffLL; } + long long uzuu() { return 0x7fff00007fff7fffLL; } + long long uszz() { return 0x7fffffff00000000LL; } + long long uszs() { return 0x7fffffff0000ffffLL; } + long long uszu() { return 0x7fffffff00007fffLL; } + long long ussz() { return 0x7fffffffffff0000LL; } + long long usss() { return 0x7fffffffffffffffLL; } + long long ussu() { return 0x7fffffffffff7fffLL; } + long long usuz() { return 0x7fffffff7fff0000LL; } + long long usus() { return 0x7fffffff7fffffffLL; } + long long usuu() { return 0x7fffffff7fff7fffLL; } + long long uuzz() { return 0x7fff7fff00000000LL; } + long long uuzs() { return 0x7fff7fff0000ffffLL; } + long long uuzu() { return 0x7fff7fff00007fffLL; } + long long uusz() { return 0x7fff7fffffff0000LL; } + long long uuss() { return 0x7fff7fffffffffffLL; } + long long uusu() { return 0x7fff7fffffff7fffLL; } + long long uuuz() { return 0x7fff7fff7fff0000LL; } + long long uuus() { return 0x7fff7fff7fffffffLL; } + long long uuuu() { return 0x7fff7fff7fff7fffLL; } + + int main(int argc, const char *argv[]) { + printf("%08x\n", zz()); + printf("%08x\n", zs()); + printf("%08x\n", zu()); + printf("%08x\n", sz()); + printf("%08x\n", ss()); + printf("%08x\n", su()); + printf("%08x\n", uz()); + printf("%08x\n", us()); + printf("%08x\n", uu()); + + printf("%016llx\n", zzzz()); + printf("%016llx\n", zzzs()); + printf("%016llx\n", zzzu()); + printf("%016llx\n", zzsz()); + printf("%016llx\n", zzss()); + printf("%016llx\n", zzsu()); + printf("%016llx\n", zzuz()); + printf("%016llx\n", zzus()); + printf("%016llx\n", zzuu()); + printf("%016llx\n", zszz()); + printf("%016llx\n", zszs()); + printf("%016llx\n", zszu()); + printf("%016llx\n", zssz()); + printf("%016llx\n", zsss()); + printf("%016llx\n", zssu()); + printf("%016llx\n", zsuz()); + printf("%016llx\n", zsus()); + printf("%016llx\n", zsuu()); + printf("%016llx\n", zuzz()); + printf("%016llx\n", zuzs()); + printf("%016llx\n", zuzu()); + printf("%016llx\n", zusz()); + printf("%016llx\n", zuss()); + printf("%016llx\n", zusu()); + printf("%016llx\n", zuuz()); + printf("%016llx\n", zuus()); + printf("%016llx\n", zuuu()); + printf("%016llx\n", szzz()); + printf("%016llx\n", szzs()); + printf("%016llx\n", szzu()); + printf("%016llx\n", szsz()); + printf("%016llx\n", szss()); + printf("%016llx\n", szsu()); + printf("%016llx\n", szuz()); + printf("%016llx\n", szus()); + printf("%016llx\n", szuu()); + printf("%016llx\n", sszz()); + printf("%016llx\n", sszs()); + printf("%016llx\n", sszu()); + printf("%016llx\n", sssz()); + printf("%016llx\n", ssss()); + printf("%016llx\n", sssu()); + printf("%016llx\n", ssuz()); + printf("%016llx\n", ssus()); + printf("%016llx\n", ssuu()); + printf("%016llx\n", suzz()); + printf("%016llx\n", suzs()); + printf("%016llx\n", suzu()); + printf("%016llx\n", susz()); + printf("%016llx\n", suss()); + printf("%016llx\n", susu()); + printf("%016llx\n", suuz()); + printf("%016llx\n", suus()); + printf("%016llx\n", suuu()); + printf("%016llx\n", uzzz()); + printf("%016llx\n", uzzs()); + printf("%016llx\n", uzzu()); + printf("%016llx\n", uzsz()); + printf("%016llx\n", uzss()); + printf("%016llx\n", uzsu()); + printf("%016llx\n", uzuz()); + printf("%016llx\n", uzus()); + printf("%016llx\n", uzuu()); + printf("%016llx\n", uszz()); + printf("%016llx\n", uszs()); + printf("%016llx\n", uszu()); + printf("%016llx\n", ussz()); + printf("%016llx\n", usss()); + printf("%016llx\n", ussu()); + printf("%016llx\n", usuz()); + printf("%016llx\n", usus()); + printf("%016llx\n", usuu()); + printf("%016llx\n", uuzz()); + printf("%016llx\n", uuzs()); + printf("%016llx\n", uuzu()); + printf("%016llx\n", uusz()); + printf("%016llx\n", uuss()); + printf("%016llx\n", uusu()); + printf("%016llx\n", uuuz()); + printf("%016llx\n", uuus()); + printf("%016llx\n", uuuu()); + + return 0; + } From reid at x10sys.com Mon Dec 11 14:39:30 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 14:39:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200612112039.kBBKdU4V019193@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.295 -> 1.296 --- Log message: Implement correct bitcast of int<->float and long<->double by using a union to perform the bitcast. --- Diffs of the changes: (+58 -14) Writer.cpp | 72 +++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 58 insertions(+), 14 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.295 llvm/lib/Target/CBackend/Writer.cpp:1.296 --- llvm/lib/Target/CBackend/Writer.cpp:1.295 Sun Dec 10 17:12:42 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Dec 11 14:39:15 2006 @@ -169,7 +169,7 @@ // Must not be used in inline asm if (I.hasOneUse() && isInlineAsm(*I.use_back())) return false; - // Only inline instruction it it's use is in the same BB as the inst. + // Only inline instruction it if it's use is in the same BB as the inst. return I.getParent() == cast(I.use_back())->getParent(); } @@ -1508,6 +1508,16 @@ /// type name is found, emit its declaration... /// void CWriter::printModuleTypes(const SymbolTable &ST) { + Out << "/* Helper union for bitcasts */\n"; + Out << "typedef union {\n"; + Out << " unsigned int UInt;\n"; + Out << " signed int SInt;\n"; + Out << " unsigned long ULong;\n"; + Out << " signed long SLong;\n"; + Out << " float Float;\n"; + Out << " double Double;\n"; + Out << "} llvmBitCastUnion;\n"; + // We are only interested in the type plane of the symbol table. SymbolTable::type_const_iterator I = ST.type_begin(); SymbolTable::type_const_iterator End = ST.type_end(); @@ -1704,6 +1714,15 @@ Out << ";\n"; } PrintedVar = true; + } else if (isa(*I) && + ((I->getType()->isFloatingPoint() && + I->getOperand(0)->getType()->isInteger()) || + (I->getType()->isInteger() && + I->getOperand(0)->getType()->isFloatingPoint()))) { + // We need a temporary for the BitCast to use so it can pluck a + // value out of a union to do the BitCast. + Out << " llvmBitCastUnion " << Mang->getValueName(&*I) + << "__BITCAST_TEMPORARY;\n"; } if (PrintedVar) @@ -1986,23 +2005,48 @@ } } +static const char * getFloatBitCastField(const Type *Ty) { + switch (Ty->getTypeID()) { + default: assert(0 && "Invalid Type"); + case Type::FloatTyID: return "Float"; + case Type::UIntTyID: return "UInt"; + case Type::IntTyID: return "SInt"; + case Type::DoubleTyID:return "Double"; + case Type::ULongTyID: return "ULong"; + case Type::LongTyID: return "SLong"; + } +} + void CWriter::visitCastInst(CastInst &I) { const Type *DstTy = I.getType(); const Type *SrcTy = I.getOperand(0)->getType(); Out << '('; - printCast(I.getOpcode(), SrcTy, DstTy); - if (I.getOpcode() == Instruction::SExt && SrcTy == Type::BoolTy) { - // Make sure we really get a sext from bool by subtracing the bool from 0 - Out << "0-"; - } - writeOperand(I.getOperand(0)); - if (DstTy == Type::BoolTy && - (I.getOpcode() == Instruction::Trunc || - I.getOpcode() == Instruction::FPToUI || - I.getOpcode() == Instruction::FPToSI || - I.getOpcode() == Instruction::PtrToInt)) { - // Make sure we really get a trunc to bool by anding the operand with 1 - Out << "&1u"; + if (isa(I) && + ((I.getType()->isFloatingPoint() && + I.getOperand(0)->getType()->isInteger()) || + (I.getType()->isInteger() && + I.getOperand(0)->getType()->isFloatingPoint()))) { + // These int<->float and long<->double casts need to be handled specially + Out << Mang->getValueName(&I) << "__BITCAST_TEMPORARY." + << getFloatBitCastField(I.getOperand(0)->getType()) << " = "; + writeOperand(I.getOperand(0)); + Out << ", " << Mang->getValueName(&I) << "__BITCAST_TEMPORARY." + << getFloatBitCastField(I.getType()); + } else { + printCast(I.getOpcode(), SrcTy, DstTy); + if (I.getOpcode() == Instruction::SExt && SrcTy == Type::BoolTy) { + // Make sure we really get a sext from bool by subtracing the bool from 0 + Out << "0-"; + } + writeOperand(I.getOperand(0)); + if (DstTy == Type::BoolTy && + (I.getOpcode() == Instruction::Trunc || + I.getOpcode() == Instruction::FPToUI || + I.getOpcode() == Instruction::FPToSI || + I.getOpcode() == Instruction::PtrToInt)) { + // Make sure we really get a trunc to bool by anding the operand with 1 + Out << "&1u"; + } } Out << ')'; } From reid at x10sys.com Mon Dec 11 14:40:43 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 14:40:43 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll Message-ID: <200612112040.kBBKehgS019230@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/CBackend: 2006-12-11-Float-Bitcast.ll added (r1.1) --- Log message: Provide a test for int<->float and long<->double bitcasts. --- Diffs of the changes: (+48 -0) 2006-12-11-Float-Bitcast.ll | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+) Index: llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll diff -c /dev/null llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll:1.1 *** /dev/null Mon Dec 11 14:40:38 2006 --- llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll Mon Dec 11 14:40:28 2006 *************** *** 0 **** --- 1,48 ---- + ; RUN: llvm-upgrade < %s | llvm-as | llc -march=c && + ; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep '__BITCAST' | wc -l | grep 14 + + int %test1(float %F) { + %X = bitcast float %F to int + ret int %X + } + + float %test2(int %I) { + %X = bitcast int %I to float + ret float %X + } + + long %test3(double %D) { + %X = bitcast double %D to long + ret long %X + } + + double %test4(long %L) { + %X = bitcast long %L to double + ret double %X + } + + double %test5(double %D) { + %X = bitcast double %D to double + %Y = add double %X, 2.0 + %Z = bitcast double %Y to long + %res = bitcast long %Z to double + ret double %res + } + + float %test6(float %F) { + %X = bitcast float %F to float + %Y = add float %X, 2.0 + %Z = bitcast float %Y to int + %res = bitcast int %Z to float + ret float %res + } + + int %main(int %argc, sbyte** %argv) { + %a = call int %test1(float 3.1415926) + %b = call float %test2(int %a) + %c = call long %test3(double 3.1415926) + %d = call double %test4(long %c) + %e = call double %test5(double 7.0) + %f = call float %test6(float 7.0) + ret int %a + } From reid at x10sys.com Mon Dec 11 15:25:24 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 15:25:24 -0600 Subject: [llvm-commits] CVS: llvm/test/Feature/fold-fpcast.ll Message-ID: <200612112125.kBBLPOaJ019963@zion.cs.uiuc.edu> Changes in directory llvm/test/Feature: fold-fpcast.ll added (r1.1) --- Log message: Add a test for constant folding of bitcast to/from floating point. --- Diffs of the changes: (+18 -0) fold-fpcast.ll | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+) Index: llvm/test/Feature/fold-fpcast.ll diff -c /dev/null llvm/test/Feature/fold-fpcast.ll:1.1 *** /dev/null Mon Dec 11 15:25:20 2006 --- llvm/test/Feature/fold-fpcast.ll Mon Dec 11 15:25:10 2006 *************** *** 0 **** --- 1,18 ---- + ; RUN: llvm-as < %s | llvm-dis | not grep bitcast + + int %test1() { + ret int bitcast(float 3.7 to int) + } + + float %test2() { + ret float bitcast(int 17 to float) + } + + long %test3() { + ret long bitcast (double 3.1415926 to long) + } + + double %test4() { + ret double bitcast (long 42 to double) + } + From reid at x10sys.com Mon Dec 11 15:27:43 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 15:27:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Message-ID: <200612112127.kBBLRhEb020013@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.112 -> 1.113 --- Log message: Fix constant folding of FP->int due to cut & paste error in last commit. --- Diffs of the changes: (+3 -2) ConstantFolding.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.112 llvm/lib/VMCore/ConstantFolding.cpp:1.113 --- llvm/lib/VMCore/ConstantFolding.cpp:1.112 Mon Dec 11 12:30:27 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Mon Dec 11 15:27:28 2006 @@ -983,9 +983,10 @@ if (const ConstantFP *FP = dyn_cast(V)) { // FP -> Integral. if (DestTy->isIntegral()) { - if (DestTy == Type::FloatTy) + if (DestTy == Type::IntTy || DestTy == Type::UIntTy) return ConstantInt::get(DestTy, FloatToBits(FP->getValue())); - assert(DestTy == Type::DoubleTy && "Unknown FP type!"); + assert((DestTy == Type::LongTy || DestTy == Type::ULongTy) + && "Incorrect integer type for bitcast!"); return ConstantInt::get(DestTy, DoubleToBits(FP->getValue())); } } From clattner at apple.com Mon Dec 11 15:30:09 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 11 Dec 2006 13:30:09 -0800 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp In-Reply-To: <200612112127.kBBLRhEb020013@zion.cs.uiuc.edu> References: <200612112127.kBBLRhEb020013@zion.cs.uiuc.edu> Message-ID: Thanks Reid! -Chris On Dec 11, 2006, at 1:27 PM, Reid Spencer wrote: > > > Changes in directory llvm/lib/VMCore: > > ConstantFolding.cpp updated: 1.112 -> 1.113 > --- > Log message: > > Fix constant folding of FP->int due to cut & paste error in last > commit. > > > --- > Diffs of the changes: (+3 -2) > > ConstantFolding.cpp | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) > > > Index: llvm/lib/VMCore/ConstantFolding.cpp > diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.112 llvm/lib/VMCore/ > ConstantFolding.cpp:1.113 > --- llvm/lib/VMCore/ConstantFolding.cpp:1.112 Mon Dec 11 12:30:27 2006 > +++ llvm/lib/VMCore/ConstantFolding.cpp Mon Dec 11 15:27:28 2006 > @@ -983,9 +983,10 @@ > if (const ConstantFP *FP = dyn_cast(V)) { > // FP -> Integral. > if (DestTy->isIntegral()) { > - if (DestTy == Type::FloatTy) > + if (DestTy == Type::IntTy || DestTy == Type::UIntTy) > return ConstantInt::get(DestTy, FloatToBits(FP->getValue > ())); > - assert(DestTy == Type::DoubleTy && "Unknown FP type!"); > + assert((DestTy == Type::LongTy || DestTy == Type::ULongTy) > + && "Incorrect integer type for bitcast!"); > return ConstantInt::get(DestTy, DoubleToBits(FP->getValue > ())); > } > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Mon Dec 11 15:43:10 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 15:43:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCSubtarget.h Message-ID: <200612112143.kBBLhABk020317@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCSubtarget.h updated: 1.17 -> 1.18 --- Log message: getInstrItineraryData shouldn't copy the itineraries --- Diffs of the changes: (+1 -1) PPCSubtarget.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCSubtarget.h diff -u llvm/lib/Target/PowerPC/PPCSubtarget.h:1.17 llvm/lib/Target/PowerPC/PPCSubtarget.h:1.18 --- llvm/lib/Target/PowerPC/PPCSubtarget.h:1.17 Fri Jul 14 20:24:23 2006 +++ llvm/lib/Target/PowerPC/PPCSubtarget.h Mon Dec 11 15:42:55 2006 @@ -57,7 +57,7 @@ /// getInstrItins - Return the instruction itineraies based on subtarget /// selection. - const InstrItineraryData getInstrItineraryData() const { return InstrItins; } + const InstrItineraryData &getInstrItineraryData() const { return InstrItins; } /// getTargetDataString - Return the pointer size and type alignment /// properties of this subtarget. From reid at x10sys.com Mon Dec 11 17:20:08 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 17:20:08 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll Message-ID: <200612112320.kBBNK873022177@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Bytecode: 2006-12-11-Cast-ConstExpr.ll added (r1.1) --- Log message: Test case for ensuring correct reading back of cast constant expressions. --- Diffs of the changes: (+8 -0) 2006-12-11-Cast-ConstExpr.ll | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll diff -c /dev/null llvm/test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll:1.1 *** /dev/null Mon Dec 11 17:20:03 2006 --- llvm/test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll Mon Dec 11 17:19:53 2006 *************** *** 0 **** --- 1,8 ---- + ; This test ensures that we get a bitcast constant expression in and out, + ; not a sitofp constant expression. + ; RUN: llvm-as < %s | llvm-dis | grep 'bitcast (' + %G = external global int + + float %tryit(int %A) { + ret float bitcast( int ptrtoint (int* %G to int) to float) + } From reid at x10sys.com Mon Dec 11 17:20:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 17:20:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200612112320.kBBNKa6m022194@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.212 -> 1.213 --- Log message: Create the cast constant expression that was read instead of attempting to infer the cast from its operand and type. This fixes: test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll --- Diffs of the changes: (+2 -1) Reader.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.212 llvm/lib/Bytecode/Reader/Reader.cpp:1.213 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.212 Fri Dec 8 12:06:15 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Dec 11 17:20:20 2006 @@ -1325,7 +1325,8 @@ if (!Instruction::isCast(Opcode)) error("Only cast instruction has one argument for ConstantExpr"); - Constant *Result = ConstantExpr::getCast(ArgVec[0], getType(TypeID)); + Constant *Result = ConstantExpr::getCast(Opcode, ArgVec[0], + getType(TypeID)); if (Handler) Handler->handleConstantExpression(Opcode, ArgVec, Result); return Result; } else if (Opcode == Instruction::GetElementPtr) { // GetElementPtr From sabre at nondot.org Mon Dec 11 17:23:00 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 17:23:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp PPCISelLowering.cpp PPCSubtarget.cpp PPCSubtarget.h PPCTargetMachine.cpp Message-ID: <200612112323.kBBNN0LU022307@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCCodeEmitter.cpp updated: 1.72 -> 1.73 PPCISelLowering.cpp updated: 1.243 -> 1.244 PPCSubtarget.cpp updated: 1.26 -> 1.27 PPCSubtarget.h updated: 1.18 -> 1.19 PPCTargetMachine.cpp updated: 1.109 -> 1.110 --- Log message: Another step forward in PPC64 JIT support: we now no-longer need stubs emitted for external globals in PPC64-JIT-PIC mode (which is good because we didn't handle them before!). This also fixes a bug handling the picbase delta, which we would get wrong in some cases. --- Diffs of the changes: (+83 -33) PPCCodeEmitter.cpp | 52 +++++++++++++++++++++++++++------------------------ PPCISelLowering.cpp | 3 -- PPCSubtarget.cpp | 38 +++++++++++++++++++++++++++++++++---- PPCSubtarget.h | 18 +++++++++++++++-- PPCTargetMachine.cpp | 5 +++- 5 files changed, 83 insertions(+), 33 deletions(-) Index: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.72 llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.73 --- llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.72 Thu Dec 7 22:54:03 2006 +++ llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp Mon Dec 11 17:22:44 2006 @@ -136,15 +136,9 @@ if (MI.getOpcode() == PPC::BL || MI.getOpcode() == PPC::BL8) Reloc = PPC::reloc_pcrel_bx; else { - // If in PIC mode, we need to encode the negated address of the - // 'movepctolr' into the unrelocated field. After relocation, we'll have - // &gv-&movepctolr in the imm field. Once &movepctolr is added to the imm - // field, we get &gv. if (TM.getRelocationModel() == Reloc::PIC_) { assert(MovePCtoLROffset && "MovePCtoLR not seen yet?"); - rv = -(intptr_t)MovePCtoLROffset - 4; } - switch (MI.getOpcode()) { default: MI.dump(); assert(0 && "Unknown instruction for relocation!"); case PPC::LIS: @@ -152,7 +146,6 @@ case PPC::ADDIS: case PPC::ADDIS8: Reloc = PPC::reloc_absolute_high; // Pointer to symbol - rv >>= 16; break; case PPC::LI: case PPC::LI8: @@ -173,7 +166,6 @@ case PPC::STFS: case PPC::STFD: Reloc = PPC::reloc_absolute_low; - rv &= 0xFFFF; break; case PPC::LWA: @@ -181,25 +173,37 @@ case PPC::STD: case PPC::STD_32: Reloc = PPC::reloc_absolute_low_ix; - rv &= 0xFFFF; - rv >>= 2; break; } } - if (MO.isGlobalAddress()) - MCE.addRelocation(MachineRelocation::getGV(MCE.getCurrentPCOffset(), - Reloc, MO.getGlobal(), 0)); - else if (MO.isExternalSymbol()) - MCE.addRelocation(MachineRelocation::getExtSym(MCE.getCurrentPCOffset(), - Reloc, MO.getSymbolName(), 0)); - else if (MO.isConstantPoolIndex()) - MCE.addRelocation(MachineRelocation::getConstPool( - MCE.getCurrentPCOffset(), - Reloc, MO.getConstantPoolIndex(), 0)); - else // isJumpTableIndex - MCE.addRelocation(MachineRelocation::getJumpTable( - MCE.getCurrentPCOffset(), - Reloc, MO.getJumpTableIndex(), 0)); + + MachineRelocation R; + if (MO.isGlobalAddress()) { + R = MachineRelocation::getGV(MCE.getCurrentPCOffset(), Reloc, + MO.getGlobal(), 0); + } else if (MO.isExternalSymbol()) { + R = MachineRelocation::getExtSym(MCE.getCurrentPCOffset(), + Reloc, MO.getSymbolName(), 0); + } else if (MO.isConstantPoolIndex()) { + R = MachineRelocation::getConstPool(MCE.getCurrentPCOffset(), + Reloc, MO.getConstantPoolIndex(), 0); + } else { + assert(MO.isJumpTableIndex()); + R = MachineRelocation::getJumpTable(MCE.getCurrentPCOffset(), + Reloc, MO.getJumpTableIndex(), 0); + } + + // If in PIC mode, we need to encode the negated address of the + // 'movepctolr' into the unrelocated field. After relocation, we'll have + // &gv-&movepctolr-4 in the imm field. Once &movepctolr is added to the imm + // field, we get &gv. This doesn't happen for branch relocations, which are + // always implicitly pc relative. + if (TM.getRelocationModel() == Reloc::PIC_ && Reloc != PPC::reloc_pcrel_bx){ + assert(MovePCtoLROffset && "MovePCtoLR not seen yet?"); + R.setConstantVal(-(intptr_t)MovePCtoLROffset - 4); + } + MCE.addRelocation(R); + } else if (MO.isMachineBasicBlock()) { unsigned Reloc = 0; unsigned Opcode = MI.getOpcode(); Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.243 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.244 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.243 Mon Dec 11 12:45:56 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Mon Dec 11 17:22:45 2006 @@ -1015,8 +1015,7 @@ Lo = DAG.getNode(ISD::ADD, PtrVT, Hi, Lo); - if (!GV->hasWeakLinkage() && !GV->hasLinkOnceLinkage() && - (!GV->isExternal() || GV->hasNotBeenReadFromBytecode())) + if (!TM.getSubtarget().hasLazyResolverStub(GV)) return Lo; // If the global is weak or external, we have to go through the lazy Index: llvm/lib/Target/PowerPC/PPCSubtarget.cpp diff -u llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.26 llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.27 --- llvm/lib/Target/PowerPC/PPCSubtarget.cpp:1.26 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/PowerPC/PPCSubtarget.cpp Mon Dec 11 17:22:45 2006 @@ -14,6 +14,7 @@ #include "PPCSubtarget.h" #include "PPC.h" #include "llvm/Module.h" +#include "llvm/Target/TargetMachine.h" #include "PPCGenSubtarget.inc" using namespace llvm; @@ -55,9 +56,10 @@ #endif -PPCSubtarget::PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit) - : StackAlignment(16) - , InstrItins() +PPCSubtarget::PPCSubtarget(const TargetMachine &tm, const Module &M, + const std::string &FS, bool is64Bit) + : TM(tm) + , StackAlignment(16) , IsGigaProcessor(false) , Has64BitSupport(false) , Use64BitRegs(false) @@ -65,7 +67,8 @@ , HasAltivec(false) , HasFSQRT(false) , HasSTFIWX(false) - , IsDarwin(false) { + , IsDarwin(false) + , HasLazyResolverStubs(false) { // Determine default and user specified characteristics std::string CPU = "generic"; @@ -105,4 +108,31 @@ IsDarwin = true; #endif } + + // Set up darwin-specific properties. + if (IsDarwin) { + HasLazyResolverStubs = true; + } +} + +/// SetJITMode - This is called to inform the subtarget info that we are +/// producing code for the JIT. +void PPCSubtarget::SetJITMode() { + // JIT mode doesn't want lazy resolver stubs, it knows exactly where + // everything is. This matters for PPC64, which codegens in PIC mode without + // stubs. + HasLazyResolverStubs = false; +} + + +/// hasLazyResolverStub - Return true if accesses to the specified global have +/// to go through a dyld lazy resolution stub. This means that an extra load +/// is required to get the address of the global. +bool PPCSubtarget::hasLazyResolverStub(const GlobalValue *GV) const { + // We never hae stubs if HasLazyResolverStubs=false or if in static mode. + if (!HasLazyResolverStubs || TM.getRelocationModel() == Reloc::Static) + return false; + + return GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || + (GV->isExternal() && !GV->hasNotBeenReadFromBytecode()); } Index: llvm/lib/Target/PowerPC/PPCSubtarget.h diff -u llvm/lib/Target/PowerPC/PPCSubtarget.h:1.18 llvm/lib/Target/PowerPC/PPCSubtarget.h:1.19 --- llvm/lib/Target/PowerPC/PPCSubtarget.h:1.18 Mon Dec 11 15:42:55 2006 +++ llvm/lib/Target/PowerPC/PPCSubtarget.h Mon Dec 11 17:22:45 2006 @@ -21,9 +21,13 @@ namespace llvm { class Module; - +class GlobalValue; +class TargetMachine; + class PPCSubtarget : public TargetSubtarget { protected: + const TargetMachine &TM; + /// stackAlignment - The minimum alignment known to hold of the stack frame on /// entry to the function and which must be maintained by every function. unsigned StackAlignment; @@ -40,15 +44,21 @@ bool HasFSQRT; bool HasSTFIWX; bool IsDarwin; + bool HasLazyResolverStubs; public: /// This constructor initializes the data members to match that /// of the specified module. /// - PPCSubtarget(const Module &M, const std::string &FS, bool is64Bit); + PPCSubtarget(const TargetMachine &TM, const Module &M, + const std::string &FS, bool is64Bit); /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU); + + /// SetJITMode - This is called to inform the subtarget info that we are + /// producing code for the JIT. + void SetJITMode(); /// getStackAlignment - Returns the minimum alignment known to hold of the /// stack frame on entry to the function and which must be maintained by every @@ -78,6 +88,10 @@ /// has64BitSupport() returns true. bool use64BitRegs() const { return Use64BitRegs; } + /// hasLazyResolverStub - Return true if accesses to the specified global have + /// to go through a dyld lazy resolution stub. This means that an extra load + /// is required to get the address of the global. + bool hasLazyResolverStub(const GlobalValue *GV) const; // Specific obvious features. bool hasFSQRT() const { return HasFSQRT; } Index: llvm/lib/Target/PowerPC/PPCTargetMachine.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.109 llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.110 --- llvm/lib/Target/PowerPC/PPCTargetMachine.cpp:1.109 Thu Dec 7 22:54:03 2006 +++ llvm/lib/Target/PowerPC/PPCTargetMachine.cpp Mon Dec 11 17:22:45 2006 @@ -81,7 +81,7 @@ PPCTargetMachine::PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit) - : Subtarget(M, FS, is64Bit), + : Subtarget(*this, M, FS, is64Bit), DataLayout(Subtarget.getTargetDataString()), InstrInfo(*this), FrameInfo(*this, is64Bit), JITInfo(*this, is64Bit), TLInfo(*this), InstrItins(Subtarget.getInstrItineraryData()) { @@ -146,6 +146,9 @@ setRelocationModel(Reloc::Static); } + // Inform the subtarget that we are in JIT mode. FIXME: does this break macho + // writing? + Subtarget.SetJITMode(); // Machine code emitter pass for PowerPC. PM.add(createPPCCodeEmitterPass(*this, MCE)); From clattner at apple.com Mon Dec 11 17:23:48 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 11 Dec 2006 15:23:48 -0800 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp In-Reply-To: <200612112320.kBBNKa6m022194@zion.cs.uiuc.edu> References: <200612112320.kBBNKa6m022194@zion.cs.uiuc.edu> Message-ID: > Create the cast constant expression that was read instead of > attempting > to infer the cast from its operand and type. This fixes: > test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll Is there any hope that that getCast method will go away soon? -Chris > > --- > Diffs of the changes: (+2 -1) > > Reader.cpp | 3 ++- > 1 files changed, 2 insertions(+), 1 deletion(-) > > > Index: llvm/lib/Bytecode/Reader/Reader.cpp > diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.212 llvm/lib/Bytecode/ > Reader/Reader.cpp:1.213 > --- llvm/lib/Bytecode/Reader/Reader.cpp:1.212 Fri Dec 8 12:06:15 2006 > +++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Dec 11 17:20:20 2006 > @@ -1325,7 +1325,8 @@ > if (!Instruction::isCast(Opcode)) > error("Only cast instruction has one argument for > ConstantExpr"); > > - Constant *Result = ConstantExpr::getCast(ArgVec[0], getType > (TypeID)); > + Constant *Result = ConstantExpr::getCast(Opcode, ArgVec[0], > + getType(TypeID)); > if (Handler) Handler->handleConstantExpression(Opcode, > ArgVec, Result); > return Result; > } else if (Opcode == Instruction::GetElementPtr) { // > GetElementPtr > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Mon Dec 11 17:32:40 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 11 Dec 2006 15:32:40 -0800 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp In-Reply-To: <200612112039.kBBKdU4V019193@zion.cs.uiuc.edu> References: <200612112039.kBBKdU4V019193@zion.cs.uiuc.edu> Message-ID: > Implement correct bitcast of int<->float and long<->double by using a > union to perform the bitcast. > @@ -1508,6 +1508,16 @@ > /// type name is found, emit its declaration... > /// > void CWriter::printModuleTypes(const SymbolTable &ST) { > + Out << "/* Helper union for bitcasts */\n"; > + Out << "typedef union {\n"; > + Out << " unsigned int UInt;\n"; > + Out << " signed int SInt;\n"; > + Out << " unsigned long ULong;\n"; > + Out << " signed long SLong;\n"; > + Out << " float Float;\n"; > + Out << " double Double;\n"; > + Out << "} llvmBitCastUnion;\n" This is wrong for 32-bit targets. ULong should be 'unsigned long long'. SLong should be 'signed long long'. Thanks Reid, -Chris From rafael.espindola at gmail.com Mon Dec 11 17:56:25 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 11 Dec 2006 17:56:25 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/README.txt Message-ID: <200612112356.kBBNuPZs022911@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: README.txt updated: 1.8 -> 1.9 --- Log message: add note --- Diffs of the changes: (+13 -0) README.txt | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/lib/Target/ARM/README.txt diff -u llvm/lib/Target/ARM/README.txt:1.8 llvm/lib/Target/ARM/README.txt:1.9 --- llvm/lib/Target/ARM/README.txt:1.8 Tue Oct 17 08:36:07 2006 +++ llvm/lib/Target/ARM/README.txt Mon Dec 11 17:56:10 2006 @@ -27,6 +27,19 @@ mov r1, r1, lsl r2 add r0, r1, r0 +--------------------------------------------------------- +%tmp1 = shl int %b, ubyte 4 +%tmp2 = add int %a, %tmp1 + +compiles to + +mov r2, #4 +add r0, r0, r1, lsl r2 + +should be + +add r0, r0, r1, lsl #4 + ---------------------------------------------------------- add an offset to FLDS/FLDD/FSTD/FSTS addressing mode From rspencer at reidspencer.com Mon Dec 11 17:56:23 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Mon, 11 Dec 2006 15:56:23 -0800 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp In-Reply-To: References: <200612112320.kBBNKa6m022194@zion.cs.uiuc.edu> Message-ID: <1165881383.15266.165.camel@bashful.x10sys.com> On Mon, 2006-12-11 at 15:23 -0800, Chris Lattner wrote: > > Create the cast constant expression that was read instead of > > attempting > > to infer the cast from its operand and type. This fixes: > > test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll > > Is there any hope that that getCast method will go away soon? My focus this week is cleanup. I'm starting with the 63 getCast calls. This was the first. I'm about to commit CodeGen/AsmPrinter.cpp. Next up is createInferredCast. Then I'll be looking for useless bitcasts, and etc. Reid > > -Chris > > > > > --- > > Diffs of the changes: (+2 -1) > > > > Reader.cpp | 3 ++- > > 1 files changed, 2 insertions(+), 1 deletion(-) > > > > > > Index: llvm/lib/Bytecode/Reader/Reader.cpp > > diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.212 llvm/lib/Bytecode/ > > Reader/Reader.cpp:1.213 > > --- llvm/lib/Bytecode/Reader/Reader.cpp:1.212 Fri Dec 8 12:06:15 2006 > > +++ llvm/lib/Bytecode/Reader/Reader.cpp Mon Dec 11 17:20:20 2006 > > @@ -1325,7 +1325,8 @@ > > if (!Instruction::isCast(Opcode)) > > error("Only cast instruction has one argument for > > ConstantExpr"); > > > > - Constant *Result = ConstantExpr::getCast(ArgVec[0], getType > > (TypeID)); > > + Constant *Result = ConstantExpr::getCast(Opcode, ArgVec[0], > > + getType(TypeID)); > > if (Handler) Handler->handleConstantExpression(Opcode, > > ArgVec, Result); > > return Result; > > } else if (Opcode == Instruction::GetElementPtr) { // > > GetElementPtr > > > > > > > > _______________________________________________ > > llvm-commits mailing list > > llvm-commits at cs.uiuc.edu > > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From reid at x10sys.com Mon Dec 11 18:11:23 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 18:11:23 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200612120011.kBC0BNwd023341@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.296 -> 1.297 --- Log message: Fix the BitCastUnion type for 32-bit targets. --- Diffs of the changes: (+6 -6) Writer.cpp | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.296 llvm/lib/Target/CBackend/Writer.cpp:1.297 --- llvm/lib/Target/CBackend/Writer.cpp:1.296 Mon Dec 11 14:39:15 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Dec 11 18:11:08 2006 @@ -1510,12 +1510,12 @@ void CWriter::printModuleTypes(const SymbolTable &ST) { Out << "/* Helper union for bitcasts */\n"; Out << "typedef union {\n"; - Out << " unsigned int UInt;\n"; - Out << " signed int SInt;\n"; - Out << " unsigned long ULong;\n"; - Out << " signed long SLong;\n"; - Out << " float Float;\n"; - Out << " double Double;\n"; + Out << " unsigned int UInt;\n"; + Out << " signed int SInt;\n"; + Out << " unsigned long long ULong;\n"; + Out << " signed long long SLong;\n"; + Out << " float Float;\n"; + Out << " double Double;\n"; Out << "} llvmBitCastUnion;\n"; // We are only interested in the type plane of the symbol table. From clattner at apple.com Mon Dec 11 18:25:57 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 11 Dec 2006 16:25:57 -0800 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp In-Reply-To: <1165881383.15266.165.camel@bashful.x10sys.com> References: <200612112320.kBBNKa6m022194@zion.cs.uiuc.edu> <1165881383.15266.165.camel@bashful.x10sys.com> Message-ID: <5F2E2C90-EB62-4D83-8478-3F41CE38D182@apple.com> On Dec 11, 2006, at 3:56 PM, Reid Spencer wrote: > On Mon, 2006-12-11 at 15:23 -0800, Chris Lattner wrote: >>> Create the cast constant expression that was read instead of >>> attempting >>> to infer the cast from its operand and type. This fixes: >>> test/Regression/Bytecode/2006-12-11-Cast-ConstExpr.ll >> >> Is there any hope that that getCast method will go away soon? > > My focus this week is cleanup. I'm starting with the 63 getCast calls. > This was the first. I'm about to commit CodeGen/AsmPrinter.cpp. > Next up > is createInferredCast. Then I'll be looking for useless bitcasts, and > etc. Sounds great, thanks Reid! -Chris From rafael.espindola at gmail.com Mon Dec 11 18:37:54 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 11 Dec 2006 18:37:54 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/mvn.ll Message-ID: <200612120037.kBC0bsRE024285@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: mvn.ll added (r1.1) --- Log message: add mvn --- Diffs of the changes: (+55 -0) mvn.ll | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+) Index: llvm/test/Regression/CodeGen/ARM/mvn.ll diff -c /dev/null llvm/test/Regression/CodeGen/ARM/mvn.ll:1.1 *** /dev/null Mon Dec 11 18:37:48 2006 --- llvm/test/Regression/CodeGen/ARM/mvn.ll Mon Dec 11 18:37:38 2006 *************** *** 0 **** --- 1,55 ---- + ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm && + ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 4 + + ;int %f1() { + ;entry: + ; ret int -1 + ;} + + int %f2(int %a) { + entry: + %tmpnot = xor int %a, -1 ; [#uses=1] + ret int %tmpnot + } + + ;int %f3(int %a) { + ;entry: + ; %tmp1 = shl int %a, ubyte 2 ; [#uses=1] + ; %tmp1not = xor int %tmp1, -1 ; [#uses=1] + ; ret int %tmp1not + ;} + + int %f4(int %a, ubyte %b) { + entry: + %tmp3 = shl int %a, ubyte %b ; [#uses=1] + %tmp3not = xor int %tmp3, -1 ; [#uses=1] + ret int %tmp3not + } + + ;uint %f5(uint %a) { + ;entry: + ; %tmp1 = lshr uint %a, ubyte 2 ; [#uses=1] + ; %tmp1not = xor uint %tmp1, 4294967295 ; [#uses=1] + ; ret uint %tmp1not + ;} + + uint %f6(uint %a, ubyte %b) { + entry: + %tmp2 = lshr uint %a, ubyte %b ; [#uses=1] + %tmp2not = xor uint %tmp2, 4294967295 ; [#uses=1] + ret uint %tmp2not + } + + ;int %f7(int %a) { + ;entry: + ; %tmp1 = ashr int %a, ubyte 2 ; [#uses=1] + ; %tmp1not = xor int %tmp1, -1 ; [#uses=1] + ; ret int %tmp1not + ;} + + int %f8(int %a, ubyte %b) { + entry: + %tmp3 = ashr int %a, ubyte %b ; [#uses=1] + %tmp3not = xor int %tmp3, -1 ; [#uses=1] + ret int %tmp3not + } From rafael.espindola at gmail.com Mon Dec 11 18:37:55 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 11 Dec 2006 18:37:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMInstrInfo.td Message-ID: <200612120037.kBC0bt7d024291@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMInstrInfo.td updated: 1.76 -> 1.77 --- Log message: add mvn --- Diffs of the changes: (+3 -0) ARMInstrInfo.td | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.76 llvm/lib/Target/ARM/ARMInstrInfo.td:1.77 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.76 Fri Dec 8 12:41:21 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Mon Dec 11 18:37:38 2006 @@ -190,6 +190,9 @@ def MOV : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src), "mov $dst, $src", [(set IntRegs:$dst, addr_mode1:$src)]>; +def MVN : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src), + "mvn $dst, $src", [(set IntRegs:$dst, (not addr_mode1:$src))]>; + def ADD : Addr1BinOp<"add", add>; def ADCS : Addr1BinOp<"adcs", adde>; def ADDS : Addr1BinOp<"adds", addc>; From reid at x10sys.com Mon Dec 11 18:43:53 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 18:43:53 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-config/Makefile Message-ID: <200612120043.kBC0hr80024481@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-config: Makefile updated: 1.18 -> 1.19 --- Log message: Fix PR1040: http://llvm.org/PR1040 : Don't rebuild llvm-config if none of the library dependencies changed. --- Diffs of the changes: (+8 -3) Makefile | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) Index: llvm/tools/llvm-config/Makefile diff -u llvm/tools/llvm-config/Makefile:1.18 llvm/tools/llvm-config/Makefile:1.19 --- llvm/tools/llvm-config/Makefile:1.18 Tue Dec 5 23:39:18 2006 +++ llvm/tools/llvm-config/Makefile Mon Dec 11 18:43:38 2006 @@ -29,11 +29,16 @@ FinalLibDeps = $(PROJ_OBJ_DIR)/FinalLibDeps.txt LibDeps = $(PROJ_OBJ_DIR)/LibDeps.txt +LibDepsTemp = $(PROJ_OBJ_DIR)/LibDeps.txt.tmp GenLibDeps = $(PROJ_SRC_ROOT)/utils/GenLibDeps.pl -$(LibDeps): $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a $(LibDir)/*.o) - $(Echo) "Regenerating LibDeps.txt" - $(Verb) $(GenLibDeps) -flat $(LibDir) $(NM_PATH) > $(LibDeps) +$(LibDepsTemp): $(GenLibDeps) $(LibDir) $(wildcard $(LibDir)/*.a $(LibDir)/*.o) + $(Echo) "Regenerating LibDeps.txt.tmp" + $(Verb) $(GenLibDeps) -flat $(LibDir) $(NM_PATH) > $(LibDepsTemp) + +$(LibDeps): $(LibDepsTemp) + $(Verb) $(CMP) -s $@ $< || ( $(CP) $< $@ && \ + $(EchoCmd) Updated LibDeps.txt because dependencies changes ) # Find all the cyclic dependencies between various LLVM libraries, so we # don't have to process them at runtime. From reid at x10sys.com Mon Dec 11 18:50:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 18:50:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Instructions.cpp Message-ID: <200612120050.kBC0o0dM024718@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Instructions.cpp updated: 1.54 -> 1.55 --- Log message: Implement createIntegerCast and createFPCast factory methods for handling integer and floating point cast creation. createIntegerCast generates ZExt/SExt, BitCast or Trunc. createFPCast generates FPExt, Bitcast, or FPTrunc. --- Diffs of the changes: (+52 -0) Instructions.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 52 insertions(+) Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.54 llvm/lib/VMCore/Instructions.cpp:1.55 --- llvm/lib/VMCore/Instructions.cpp:1.54 Wed Dec 6 22:18:31 2006 +++ llvm/lib/VMCore/Instructions.cpp Mon Dec 11 18:49:44 2006 @@ -1580,6 +1580,58 @@ return create(Instruction::BitCast, S, Ty, Name, InsertBefore); } +CastInst *CastInst::createIntegerCast(Value *C, const Type *Ty, + bool isSigned, const std::string &Name, + Instruction *InsertBefore) { + assert(C->getType()->isIntegral() && Ty->isIntegral() && "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = + (SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::Trunc : + (isSigned ? Instruction::SExt : Instruction::ZExt))); + return create(opcode, C, Ty, Name, InsertBefore); +} + +CastInst *CastInst::createIntegerCast(Value *C, const Type *Ty, + bool isSigned, const std::string &Name, + BasicBlock *InsertAtEnd) { + assert(C->getType()->isIntegral() && Ty->isIntegral() && "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = + (SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::Trunc : + (isSigned ? Instruction::SExt : Instruction::ZExt))); + return create(opcode, C, Ty, Name, InsertAtEnd); +} + +CastInst *CastInst::createFPCast(Value *C, const Type *Ty, + const std::string &Name, + Instruction *InsertBefore) { + assert(C->getType()->isFloatingPoint() && Ty->isFloatingPoint() && + "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = + (SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt)); + return create(opcode, C, Ty, Name, InsertBefore); +} + +CastInst *CastInst::createFPCast(Value *C, const Type *Ty, + const std::string &Name, + BasicBlock *InsertAtEnd) { + assert(C->getType()->isFloatingPoint() && Ty->isFloatingPoint() && + "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = + (SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt)); + return create(opcode, C, Ty, Name, InsertAtEnd); +} + // Provide a way to get a "cast" where the cast opcode is inferred from the // types and size of the operand. This, basically, is a parallel of the // logic in the checkCast function below. This axiom should hold: From reid at x10sys.com Mon Dec 11 18:50:00 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 18:50:00 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/InstrTypes.h Message-ID: <200612120050.kBC0o0Ae024723@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: InstrTypes.h updated: 1.53 -> 1.54 --- Log message: Implement createIntegerCast and createFPCast factory methods for handling integer and floating point cast creation. createIntegerCast generates ZExt/SExt, BitCast or Trunc. createFPCast generates FPExt, Bitcast, or FPTrunc. --- Diffs of the changes: (+34 -0) InstrTypes.h | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+) Index: llvm/include/llvm/InstrTypes.h diff -u llvm/include/llvm/InstrTypes.h:1.53 llvm/include/llvm/InstrTypes.h:1.54 --- llvm/include/llvm/InstrTypes.h:1.53 Wed Dec 6 22:18:31 2006 +++ llvm/include/llvm/InstrTypes.h Mon Dec 11 18:49:44 2006 @@ -339,6 +339,40 @@ Instruction *InsertBefore = 0 ///< Place to insert the instruction ); + /// @brief Create a ZExt, BitCast, or Trunc for int -> int casts. + static CastInst *createIntegerCast( + Value *S, ///< The pointer value to be casted (operand 0) + const Type *Ty, ///< The type to which cast should be made + bool isSigned, ///< Whether to regard S as signed or not + const std::string &Name = "", ///< Name for the instruction + Instruction *InsertBefore = 0 ///< Place to insert the instruction + ); + + /// @brief Create a ZExt, BitCast, or Trunc for int -> int casts. + static CastInst *createIntegerCast( + Value *S, ///< The integer value to be casted (operand 0) + const Type *Ty, ///< The integer type to which operand is casted + bool isSigned, ///< Whether to regard S as signed or not + const std::string &Name, ///< The name for the instruction + BasicBlock *InsertAtEnd ///< The block to insert the instruction into + ); + + /// @brief Create an FPExt, BitCast, or FPTrunc for fp -> fp casts + static CastInst *createFPCast( + Value *S, ///< The floating point value to be casted + const Type *Ty, ///< The floating point type to cast to + const std::string &Name = "", ///< Name for the instruction + Instruction *InsertBefore = 0 ///< Place to insert the instruction + ); + + /// @brief Create an FPExt, BitCast, or FPTrunc for fp -> fp casts + static CastInst *createFPCast( + Value *S, ///< The floating point value to be casted + const Type *Ty, ///< The floating point type to cast to + const std::string &Name, ///< The name for the instruction + BasicBlock *InsertAtEnd ///< The block to insert the instruction into + ); + /// @brief Create a SExt or BitCast cast instruction static CastInst *createSExtOrBitCast( Value *S, ///< The value to be casted (operand 0) From reid at x10sys.com Mon Dec 11 18:51:25 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 18:51:25 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200612120051.kBC0pP5u024772@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.184 -> 1.185 --- Log message: Implement getIntegerCast and getFPCast for ConstantExpr. These are similar to the createIntegerCast and createFPCast for CastInst instructions. --- Diffs of the changes: (+23 -0) Constants.cpp | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.184 llvm/lib/VMCore/Constants.cpp:1.185 --- llvm/lib/VMCore/Constants.cpp:1.184 Fri Dec 8 12:06:15 2006 +++ llvm/lib/VMCore/Constants.cpp Mon Dec 11 18:51:07 2006 @@ -1514,6 +1514,29 @@ return getCast(Instruction::BitCast, S, Ty); } +Constant *ConstantExpr::getIntegerCast(Constant *C, const Type *Ty, + bool isSigned) { + assert(C->getType()->isIntegral() && Ty->isIntegral() && "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = + (SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::Trunc : + (isSigned ? Instruction::SExt : Instruction::ZExt))); + return getCast(opcode, C, Ty); +} + +Constant *ConstantExpr::getFPCast(Constant *C, const Type *Ty) { + assert(C->getType()->isFloatingPoint() && Ty->isFloatingPoint() && + "Invalid cast"); + unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = + (SrcBits == DstBits ? Instruction::BitCast : + (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt)); + return getCast(opcode, C, Ty); +} + Constant *ConstantExpr::getTrunc(Constant *C, const Type *Ty) { assert(C->getType()->isInteger() && "Trunc operand must be integer"); assert(Ty->isIntegral() && "Trunc produces only integral"); From reid at x10sys.com Mon Dec 11 18:51:25 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 18:51:25 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200612120051.kBC0pPwW024769@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.105 -> 1.106 --- Log message: Implement getIntegerCast and getFPCast for ConstantExpr. These are similar to the createIntegerCast and createFPCast for CastInst instructions. --- Diffs of the changes: (+13 -0) Constants.h | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.105 llvm/include/llvm/Constants.h:1.106 --- llvm/include/llvm/Constants.h:1.105 Fri Dec 8 12:06:14 2006 +++ llvm/include/llvm/Constants.h Mon Dec 11 18:51:07 2006 @@ -559,6 +559,19 @@ const Type *Ty ///< The type to which cast should be made ); + /// @brief Create a ZExt, Bitcast or Trunc for integer -> integer casts + static Constant *getIntegerCast( + Constant *C, ///< The integer constant to be casted + const Type *Ty, ///< The integer type to cast to + bool isSigned ///< Whether C should be treated as signed or not + ); + + /// @brief Create a FPExt, Bitcast or FPTrunc for fp -> fp casts + static Constant *getFPCast( + Constant *C, ///< The integer constant to be casted + const Type *Ty ///< The integer type to cast to + ); + static Constant *getCast(Constant *C, const Type *Ty); /// @brief Return true if this is a convert constant expression From reid at x10sys.com Mon Dec 11 18:53:46 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 18:53:46 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll Message-ID: <200612120053.kBC0rkq8024824@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/CBackend: 2006-12-11-Float-Bitcast.ll updated: 1.1 -> 1.2 --- Log message: Don't bother upgrading this. --- Diffs of the changes: (+2 -2) 2006-12-11-Float-Bitcast.ll | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll diff -u llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll:1.1 llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll:1.2 --- llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll:1.1 Mon Dec 11 14:40:28 2006 +++ llvm/test/Regression/CodeGen/CBackend/2006-12-11-Float-Bitcast.ll Mon Dec 11 18:53:31 2006 @@ -1,5 +1,5 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | grep '__BITCAST' | wc -l | grep 14 +; RUN: llvm-as < %s | llc -march=c && +; RUN: llvm-as < %s | llc -march=c | grep '__BITCAST' | wc -l | grep 14 int %test1(float %F) { %X = bitcast float %F to int From rafael.espindola at gmail.com Mon Dec 11 19:03:29 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 11 Dec 2006 19:03:29 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/long.ll mvn.ll Message-ID: <200612120103.kBC13Tft025018@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: long.ll updated: 1.8 -> 1.9 mvn.ll updated: 1.1 -> 1.2 --- Log message: use MVN to handle small negative constants --- Diffs of the changes: (+7 -7) long.ll | 4 ++-- mvn.ll | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/test/Regression/CodeGen/ARM/long.ll diff -u llvm/test/Regression/CodeGen/ARM/long.ll:1.8 llvm/test/Regression/CodeGen/ARM/long.ll:1.9 --- llvm/test/Regression/CodeGen/ARM/long.ll:1.8 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/ARM/long.ll Mon Dec 11 19:03:11 2006 @@ -1,9 +1,9 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r1, #0" | wc -l | grep 4 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #1" | wc -l | grep 1 && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ".word.*2147483647" | wc -l | grep 2 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mvn r0, #-2147483648" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #-2147483648" | wc -l | grep 1 && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ".word.*4294967295" | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mvn r1, #-2147483648" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "adds" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "adcs" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "subs" | wc -l | grep 1 && Index: llvm/test/Regression/CodeGen/ARM/mvn.ll diff -u llvm/test/Regression/CodeGen/ARM/mvn.ll:1.1 llvm/test/Regression/CodeGen/ARM/mvn.ll:1.2 --- llvm/test/Regression/CodeGen/ARM/mvn.ll:1.1 Mon Dec 11 18:37:38 2006 +++ llvm/test/Regression/CodeGen/ARM/mvn.ll Mon Dec 11 19:03:11 2006 @@ -1,10 +1,10 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 4 +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 5 -;int %f1() { -;entry: -; ret int -1 -;} +int %f1() { +entry: + ret int -1 +} int %f2(int %a) { entry: From rafael.espindola at gmail.com Mon Dec 11 19:03:29 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Mon, 11 Dec 2006 19:03:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp ARMInstrInfo.td Message-ID: <200612120103.kBC13TJI025011@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.88 -> 1.89 ARMInstrInfo.td updated: 1.77 -> 1.78 --- Log message: use MVN to handle small negative constants --- Diffs of the changes: (+32 -0) ARMISelDAGToDAG.cpp | 21 +++++++++++++++++++++ ARMInstrInfo.td | 11 +++++++++++ 2 files changed, 32 insertions(+) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.88 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.89 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.88 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Dec 11 19:03:11 2006 @@ -781,6 +781,8 @@ virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); bool SelectAddrMode1(SDOperand Op, SDOperand N, SDOperand &Arg, SDOperand &Shift, SDOperand &ShiftType); + bool SelectAddrMode1a(SDOperand Op, SDOperand N, SDOperand &Arg, + SDOperand &Shift, SDOperand &ShiftType); bool SelectAddrMode2(SDOperand Op, SDOperand N, SDOperand &Arg, SDOperand &Offset); bool SelectAddrMode5(SDOperand Op, SDOperand N, SDOperand &Arg, @@ -883,6 +885,25 @@ return true; } +bool ARMDAGToDAGISel::SelectAddrMode1a(SDOperand Op, + SDOperand N, + SDOperand &Arg, + SDOperand &Shift, + SDOperand &ShiftType) { + if (N.getOpcode() != ISD::Constant) + return false; + + uint32_t val = ~cast(N)->getValue(); + if(!isRotInt8Immediate(val)) + return false; + + Arg = CurDAG->getTargetConstant(val, MVT::i32); + Shift = CurDAG->getTargetConstant(0, MVT::i32); + ShiftType = CurDAG->getTargetConstant(ARMShift::LSL, MVT::i32); + + return true; +} + bool ARMDAGToDAGISel::SelectAddrMode2(SDOperand Op, SDOperand N, SDOperand &Arg, SDOperand &Offset) { //TODO: complete and cleanup! Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.77 llvm/lib/Target/ARM/ARMInstrInfo.td:1.78 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.77 Mon Dec 11 18:37:38 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Mon Dec 11 19:03:11 2006 @@ -18,6 +18,11 @@ let MIOperandInfo = (ops ptr_rc, ptr_rc, i32imm); } +def op_addr_mode1a : Operand { + let PrintMethod = "printAddrMode1"; + let MIOperandInfo = (ops ptr_rc, ptr_rc, i32imm); +} + def op_addr_mode2 : Operand { let PrintMethod = "printAddrMode2"; let MIOperandInfo = (ops ptr_rc, i32imm); @@ -33,6 +38,9 @@ def addr_mode1 : ComplexPattern; +//Addressing Mode 1a: MVN hack +def addr_mode1a : ComplexPattern; + //Addressing Mode 2: Load and Store Word or Unsigned Byte def addr_mode2 : ComplexPattern; @@ -193,6 +201,9 @@ def MVN : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src), "mvn $dst, $src", [(set IntRegs:$dst, (not addr_mode1:$src))]>; +def MVN2 : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src), + "mvn $dst, $src", [(set IntRegs:$dst, addr_mode1a:$src)]>; + def ADD : Addr1BinOp<"add", add>; def ADCS : Addr1BinOp<"adcs", adde>; def ADDS : Addr1BinOp<"adds", addc>; From reid at x10sys.com Mon Dec 11 19:17:58 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 19:17:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200612120117.kBC1HwTj025264@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.82 -> 1.83 --- Log message: Change inferred cast creation calls to more specific cast creations. --- Diffs of the changes: (+1 -1) JIT.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.82 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.83 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.82 Thu Dec 7 14:04:42 2006 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Mon Dec 11 19:17:41 2006 @@ -212,7 +212,7 @@ } else { C = ConstantInt::get(Type::LongTy, (intptr_t)ArgPtr); } - C = ConstantExpr::getCast(C, ArgTy); // Cast the integer to pointer + C = ConstantExpr::getIntToPtr(C, ArgTy); // Cast the integer to pointer break; } Args.push_back(C); From reid at x10sys.com Mon Dec 11 19:17:59 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 19:17:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp IntrinsicLowering.cpp MachineDebugInfo.cpp Message-ID: <200612120117.kBC1Hxit025273@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.120 -> 1.121 IntrinsicLowering.cpp updated: 1.49 -> 1.50 MachineDebugInfo.cpp updated: 1.63 -> 1.64 --- Log message: Change inferred cast creation calls to more specific cast creations. --- Diffs of the changes: (+11 -7) AsmPrinter.cpp | 6 +++++- IntrinsicLowering.cpp | 2 +- MachineDebugInfo.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.120 llvm/lib/CodeGen/AsmPrinter.cpp:1.121 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.120 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Dec 11 19:17:40 2006 @@ -446,7 +446,11 @@ // integer type. This promotes constant folding and simplifies this code. if (isa(Ty)) { const Type *IntPtrTy = TD->getIntPtrType(); - Op = ConstantExpr::getCast(Op, IntPtrTy); + Instruction::CastOps opcode = Instruction::CastOps(CE->getOpcode()); + if (opcode == Instruction::IntToPtr) + Op = ConstantExpr::getIntegerCast(Op, IntPtrTy, false /*ZExt*/); + else + Op = ConstantExpr::getCast(Instruction::PtrToInt, Op, IntPtrTy); return EmitConstantValueOnly(Op); } Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.49 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.50 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.49 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Mon Dec 11 19:17:40 2006 @@ -239,7 +239,7 @@ for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) { Value *MaskCst = - ConstantExpr::getCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]), + ConstantExpr::getTruncOrBitCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]), V->getType()); Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP); Value *VShift = new ShiftInst(Instruction::LShr, V, Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.63 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.64 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.63 Thu Dec 7 14:04:42 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Mon Dec 11 19:17:40 2006 @@ -292,7 +292,7 @@ if (GV) { // Set to pointer to global. - Elements.push_back(ConstantExpr::getCast(GV, EmptyTy)); + Elements.push_back(ConstantExpr::getBitCast(GV, EmptyTy)); } else { // Use NULL. Elements.push_back(ConstantPointerNull::get(EmptyTy)); @@ -301,7 +301,7 @@ virtual void Apply(GlobalVariable *&Field) { const PointerType *EmptyTy = SR.getEmptyStructPtrType(); if (Field) { - Elements.push_back(ConstantExpr::getCast(Field, EmptyTy)); + Elements.push_back(ConstantExpr::getBitCast(Field, EmptyTy)); } else { Elements.push_back(ConstantPointerNull::get(EmptyTy)); } @@ -315,7 +315,7 @@ for (unsigned i = 0, N = Field.size(); i < N; ++i) { if (DebugInfoDesc *Element = Field[i]) { GlobalVariable *GVE = SR.Serialize(Element); - Constant *CE = ConstantExpr::getCast(GVE, EmptyTy); + Constant *CE = ConstantExpr::getBitCast(GVE, EmptyTy); ArrayElements.push_back(cast(CE)); } else { ArrayElements.push_back(ConstantPointerNull::get(EmptyTy)); @@ -328,7 +328,7 @@ CA, "llvm.dbg.array", SR.getModule()); CAGV->setSection("llvm.metadata"); - Constant *CAE = ConstantExpr::getCast(CAGV, EmptyTy); + Constant *CAE = ConstantExpr::getBitCast(CAGV, EmptyTy); Elements.push_back(CAE); } }; @@ -1323,7 +1323,7 @@ ConstStr, "str", M); StrGV->setSection("llvm.metadata"); // Convert to generic string pointer. - Slot = ConstantExpr::getCast(StrGV, getStrPtrType()); + Slot = ConstantExpr::getBitCast(StrGV, getStrPtrType()); } return Slot; From reid at x10sys.com Mon Dec 11 19:17:59 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 19:17:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612120117.kBC1Hxoi025276@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.428 -> 1.429 --- Log message: Change inferred cast creation calls to more specific cast creations. --- Diffs of the changes: (+1 -1) LegalizeDAG.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.428 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.429 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.428 Mon Dec 11 13:27:14 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 19:17:40 2006 @@ -790,7 +790,7 @@ // Only do this if the target has a native EXTLOAD instruction from // f32. TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) { - LLVMC = cast(ConstantExpr::getCast(LLVMC, Type::FloatTy)); + LLVMC = cast(ConstantExpr::getFPCast(LLVMC, Type::FloatTy)); VT = MVT::f32; Extend = true; } From reid at x10sys.com Mon Dec 11 19:31:52 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 19:31:52 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp Message-ID: <200612120131.kBC1VqPB025550@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.23 -> 1.24 --- Log message: Generate the correct cast opcode for constant expressions. --- Diffs of the changes: (+17 -2) CppWriter.cpp | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.23 llvm/tools/llvm2cpp/CppWriter.cpp:1.24 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.23 Tue Dec 5 19:18:01 2006 +++ llvm/tools/llvm2cpp/CppWriter.cpp Mon Dec 11 19:31:37 2006 @@ -761,8 +761,23 @@ } else if (CE->isCast()) { printConstant(CE->getOperand(0)); Out << "Constant* " << constName << " = ConstantExpr::getCast("; - Out << getCppName(CE->getOperand(0)) << ", " << getCppName(CE->getType()) - << ");"; + switch (CE->getOpcode()) { + default: assert(0 && "Invalid cast opcode"); + case Instruction::Trunc: Out << "Instruction::Trunc"; break; + case Instruction::ZExt: Out << "Instruction::ZExt"; break; + case Instruction::SExt: Out << "Instruction::SExt"; break; + case Instruction::FPTrunc: Out << "Instruction::FPTrunc"; break; + case Instruction::FPExt: Out << "Instruction::FPExt"; break; + case Instruction::FPToUI: Out << "Instruction::FPToUI"; break; + case Instruction::FPToSI: Out << "Instruction::FPToSI"; break; + case Instruction::UIToFP: Out << "Instruction::UIToFP"; break; + case Instruction::SIToFP: Out << "Instruction::SIToFP"; break; + case Instruction::PtrToInt: Out << "Instruction::PtrToInt"; break; + case Instruction::IntToPtr: Out << "Instruction::IntToPtr"; break; + case Instruction::BitCast: Out << "Instruction::BitCast"; break; + } + Out << ", " << getCppName(CE->getOperand(0)) << ", " + << getCppName(CE->getType()) << ");"; } else { unsigned N = CE->getNumOperands(); for (unsigned i = 0; i < N; ++i ) { From reid at x10sys.com Mon Dec 11 19:32:17 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 19:32:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200612120132.kBC1WHXc025569@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.121 -> 1.122 --- Log message: Tidy up a bit. --- Diffs of the changes: (+1 -1) AsmPrinter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.121 llvm/lib/CodeGen/AsmPrinter.cpp:1.122 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.121 Mon Dec 11 19:17:40 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Dec 11 19:32:02 2006 @@ -450,7 +450,7 @@ if (opcode == Instruction::IntToPtr) Op = ConstantExpr::getIntegerCast(Op, IntPtrTy, false /*ZExt*/); else - Op = ConstantExpr::getCast(Instruction::PtrToInt, Op, IntPtrTy); + Op = ConstantExpr::getPtrToInt(Op, IntPtrTy); return EmitConstantValueOnly(Op); } From sabre at nondot.org Mon Dec 11 20:26:24 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 20:26:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200612120226.kBC2QOUr026527@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.68 -> 1.69 --- Log message: teach scev to analyze X*4|1 like X*4+c. This allows us to produce: LBB1_1: #bb movdqa (%esi), %xmm2 movaps %xmm2, %xmm3 punpcklbw %xmm0, %xmm3 movaps %xmm3, %xmm4 punpcklwd %xmm0, %xmm4 cvtdq2ps %xmm4, %xmm4 mulps %xmm1, %xmm4 movaps %xmm4, (%edi) leal 1(,%eax,4), %ebx shll $4, %ebx punpckhwd %xmm0, %xmm3 cvtdq2ps %xmm3, %xmm3 mulps %xmm1, %xmm3 movaps %xmm3, (%edx,%ebx) leal 2(,%eax,4), %ebx shll $4, %ebx punpckhbw %xmm0, %xmm2 movaps %xmm2, %xmm3 punpcklwd %xmm0, %xmm3 cvtdq2ps %xmm3, %xmm3 mulps %xmm1, %xmm3 movaps %xmm3, (%edx,%ebx) leal 3(,%eax,4), %ebx shll $4, %ebx punpckhwd %xmm0, %xmm2 cvtdq2ps %xmm2, %xmm2 mulps %xmm1, %xmm2 movaps %xmm2, (%edx,%ebx) addl $64, %edi incl %eax addl $16, %esi cmpl %ecx, %eax jne LBB1_1 #bb instead of: LBB1_1: #bb movdqa (%esi), %xmm2 movaps %xmm2, %xmm3 punpcklbw %xmm0, %xmm3 movaps %xmm3, %xmm4 punpcklwd %xmm0, %xmm4 cvtdq2ps %xmm4, %xmm4 mulps %xmm1, %xmm4 movaps %xmm4, (%edi) leal 1(,%eax,4), %ebx shll $4, %ebx punpckhwd %xmm0, %xmm3 cvtdq2ps %xmm3, %xmm3 mulps %xmm1, %xmm3 movaps %xmm3, (%edx,%ebx) leal 2(,%eax,4), %ebx shll $4, %ebx punpckhbw %xmm0, %xmm2 movaps %xmm2, %xmm3 punpcklwd %xmm0, %xmm3 cvtdq2ps %xmm3, %xmm3 mulps %xmm1, %xmm3 movaps %xmm3, (%edx,%ebx) leal 3(,%eax,4), %ebx shll $4, %ebx punpckhwd %xmm0, %xmm2 cvtdq2ps %xmm2, %xmm2 mulps %xmm1, %xmm2 movaps %xmm2, (%edx,%ebx) addl $64, %edi incl %eax addl $16, %esi cmpl %ecx, %eax jne LBB1_1 #bb for a testcase. --- Diffs of the changes: (+59 -1) ScalarEvolution.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 59 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.68 llvm/lib/Analysis/ScalarEvolution.cpp:1.69 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.68 Sun Dec 10 18:12:31 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Mon Dec 11 20:26:09 2006 @@ -1339,6 +1339,49 @@ return SCEVUnknown::get(PN); } +/// GetConstantFactor - Determine the largest constant factor that S has. For +/// example, turn {4,+,8} -> 4. (S umod result) should always equal zero. +static uint64_t GetConstantFactor(SCEVHandle S) { + if (SCEVConstant *C = dyn_cast(S)) { + if (uint64_t V = C->getValue()->getZExtValue()) + return V; + else // Zero is a multiple of everything. + return 1ULL << (S->getType()->getPrimitiveSizeInBits()-1); + } + + if (SCEVTruncateExpr *T = dyn_cast(S)) + return GetConstantFactor(T->getOperand()) & + T->getType()->getIntegralTypeMask(); + if (SCEVZeroExtendExpr *E = dyn_cast(S)) + return GetConstantFactor(E->getOperand()); + + if (SCEVAddExpr *A = dyn_cast(S)) { + // The result is the min of all operands. + uint64_t Res = GetConstantFactor(A->getOperand(0)); + for (unsigned i = 1, e = A->getNumOperands(); i != e && Res > 1; ++i) + Res = std::min(Res, GetConstantFactor(A->getOperand(i))); + return Res; + } + + if (SCEVMulExpr *M = dyn_cast(S)) { + // The result is the product of all the operands. + uint64_t Res = GetConstantFactor(M->getOperand(0)); + for (unsigned i = 1, e = M->getNumOperands(); i != e; ++i) + Res *= GetConstantFactor(M->getOperand(i)); + return Res; + } + + if (SCEVAddRecExpr *A = dyn_cast(S)) { + // FIXME: Generalize. + if (A->getNumOperands() == 2) + return std::min(GetConstantFactor(A->getOperand(0)), + GetConstantFactor(A->getOperand(1))); + // ? + } + + // SCEVSDivExpr, SCEVUnknown. + return 1; +} /// createSCEV - We know that there is no SCEV for the specified value. /// Analyze the expression. @@ -1360,7 +1403,22 @@ case Instruction::Sub: return SCEV::getMinusSCEV(getSCEV(I->getOperand(0)), getSCEV(I->getOperand(1))); - + case Instruction::Or: + // If the RHS of the Or is a constant, we may have something like: + // X*4+1 which got turned into X*4|1. Handle this as an add so loop + // optimizations will transparently handle this case. + if (ConstantInt *CI = dyn_cast(I->getOperand(1))) { + SCEVHandle LHS = getSCEV(I->getOperand(0)); + uint64_t CommonFact = GetConstantFactor(LHS); + assert(CommonFact && "Common factor should at least be 1!"); + if (CommonFact > CI->getZExtValue()) { + // If the LHS is a multiple that is larger than the RHS, use +. + return SCEVAddExpr::get(LHS, + getSCEV(I->getOperand(1))); + } + } + break; + case Instruction::Shl: // Turn shift left of a constant amount into a multiply. if (ConstantInt *SA = dyn_cast(I->getOperand(1))) { From sabre at nondot.org Mon Dec 11 22:00:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 22:00:01 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/store-fp-constant.ll Message-ID: <200612120400.kBC401Q2028052@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: store-fp-constant.ll updated: 1.2 -> 1.3 --- Log message: This should check for darwin literal sections as well. --- Diffs of the changes: (+2 -1) store-fp-constant.ll | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/X86/store-fp-constant.ll diff -u llvm/test/Regression/CodeGen/X86/store-fp-constant.ll:1.2 llvm/test/Regression/CodeGen/X86/store-fp-constant.ll:1.3 --- llvm/test/Regression/CodeGen/X86/store-fp-constant.ll:1.2 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/X86/store-fp-constant.ll Mon Dec 11 21:59:46 2006 @@ -1,4 +1,5 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep rodata +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep rodata && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep literal ; ; Check that no FP constants in this testcase ends up in the ; constant pool. From sabre at nondot.org Mon Dec 11 22:16:29 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 22:16:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200612120416.kBC4GTd0028428@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.260 -> 1.261 --- Log message: make this code more aggressive about turning store fpimm into store int imm. This is not sufficient to fix X86/store-fp-constant.ll --- Diffs of the changes: (+32 -9) DAGCombiner.cpp | 41 ++++++++++++++++++++++++++++++++--------- 1 files changed, 32 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.260 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.261 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.260 Mon Dec 11 11:25:19 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Dec 11 22:16:14 2006 @@ -3038,15 +3038,38 @@ if (ConstantFPSDNode *CFP = dyn_cast(Value)) { if (Value.getOpcode() != ISD::TargetConstantFP) { SDOperand Tmp; - if (CFP->getValueType(0) == MVT::f32) { - Tmp = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32); - return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), - ST->getSrcValueOffset()); - } else if (TLI.isTypeLegal(MVT::i64)) { - assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); - Tmp = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64); - return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), - ST->getSrcValueOffset()); + switch (CFP->getValueType(0)) { + default: assert(0 && "Unknown FP type"); + case MVT::f32: + if (!AfterLegalize || TLI.isTypeLegal(MVT::i32)) { + Tmp = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32); + return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), + ST->getSrcValueOffset()); + } + break; + case MVT::f64: + if (!AfterLegalize || TLI.isTypeLegal(MVT::i64)) { + Tmp = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64); + return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), + ST->getSrcValueOffset()); + } else if (TLI.isTypeLegal(MVT::i32)) { + // Many FP stores are not make apparent until after legalize, e.g. for + // argument passing. Since this is so common, custom legalize the + // 64-bit integer store into two 32-bit stores. + uint64_t Val = DoubleToBits(CFP->getValue()); + SDOperand Lo = DAG.getConstant(Val & 0xFFFFFFFF, MVT::i32); + SDOperand Hi = DAG.getConstant(Val >> 32, MVT::i32); + if (!TLI.isLittleEndian()) std::swap(Lo, Hi); + + SDOperand St0 = DAG.getStore(Chain, Lo, Ptr, ST->getSrcValue(), + ST->getSrcValueOffset()); + Ptr = DAG.getNode(ISD::ADD, Ptr.getValueType(), Ptr, + DAG.getConstant(4, Ptr.getValueType())); + SDOperand St1 = DAG.getStore(Chain, Hi, Ptr, ST->getSrcValue(), + ST->getSrcValueOffset()+4); + return DAG.getNode(ISD::TokenFactor, MVT::Other, St0, St1); + } + break; } } } From sabre at nondot.org Mon Dec 11 22:19:12 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 22:19:12 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612120419.kBC4JC8f028509@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.429 -> 1.430 --- Log message: Revert Nate's patch to fix X86/store-fp-constant.ll. With the dag combiner and legalizer separated like they currently are, I don't see a way to handle this xform. --- Diffs of the changes: (+18 -0) LegalizeDAG.cpp | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.429 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.430 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.429 Mon Dec 11 19:17:40 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 22:18:56 2006 @@ -1648,6 +1648,24 @@ Tmp2 = LegalizeOp(ST->getBasePtr()); // Legalize the pointer. if (!ST->isTruncatingStore()) { + // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr' + // FIXME: We shouldn't do this for TargetConstantFP's. + // FIXME: move this to the DAG Combiner! Note that we can't regress due + // to phase ordering between legalized code and the dag combiner. This + // probably means that we need to integrate dag combiner and legalizer + // together. + if (ConstantFPSDNode *CFP = dyn_cast(ST->getValue())) { + if (CFP->getValueType(0) == MVT::f32) { + Tmp3 = DAG.getConstant(FloatToBits(CFP->getValue()), MVT::i32); + } else { + assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); + Tmp3 = DAG.getConstant(DoubleToBits(CFP->getValue()), MVT::i64); + } + Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), + ST->getSrcValueOffset()); + break; + } + switch (getTypeAction(ST->getStoredVT())) { case Legal: { Tmp3 = LegalizeOp(ST->getValue()); From sabre at nondot.org Mon Dec 11 22:24:32 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 22:24:32 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll Message-ID: <200612120424.kBC4OWMx028749@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ScalarRepl: 2006-12-11-SROA-Crash.ll added (r1.1) --- Log message: new testcase for pr1045: http://llvm.org/PR1045 --- Diffs of the changes: (+24 -0) 2006-12-11-SROA-Crash.ll | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+) Index: llvm/test/Regression/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll diff -c /dev/null llvm/test/Regression/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll:1.1 *** /dev/null Mon Dec 11 22:24:27 2006 --- llvm/test/Regression/Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll Mon Dec 11 22:24:17 2006 *************** *** 0 **** --- 1,24 ---- + ; RUN: llvm-as < %s | opt -scalarrepl -disable-output + ; PR1045 + + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>" = type { "struct.__gnu_cxx::bitmap_allocator::_Alloc_block"* } + "struct.__gnu_cxx::bitmap_allocator" = type { ubyte } + "struct.__gnu_cxx::bitmap_allocator::_Alloc_block" = type { [8 x sbyte] } + + implementation ; Functions: + + void %_ZN9__gnu_cxx16bitmap_allocatorIwE27_M_deallocate_single_objectEPw() { + entry: + %this_addr.i = alloca "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"* ; <"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"**> [#uses=3] + %tmp = alloca "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>", align 4 ; <"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"*> [#uses=1] + store "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"* %tmp, "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"** %this_addr.i + %tmp.i = load "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"** %this_addr.i ; <"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"*> [#uses=1] + %tmp.i = bitcast "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"* %tmp.i to "struct.__gnu_cxx::bitmap_allocator"* ; <"struct.__gnu_cxx::bitmap_allocator"*> [#uses=0] + %tmp1.i = load "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"** %this_addr.i ; <"struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"*> [#uses=1] + %tmp.i = getelementptr "struct.__gnu_cxx::balloc::_Inclusive_between<__gnu_cxx::bitmap_allocator::_Alloc_block*>"* %tmp1.i, int 0, uint 0 ; <"struct.__gnu_cxx::bitmap_allocator::_Alloc_block"**> [#uses=0] + unreachable + } From sabre at nondot.org Mon Dec 11 22:24:56 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 22:24:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200612120424.kBC4OuXc028765@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ScalarReplAggregates.cpp updated: 1.55 -> 1.56 --- Log message: Patch for PR1045: http://llvm.org/PR1045 and Transforms/ScalarRepl/2006-12-11-SROA-Crash.ll --- Diffs of the changes: (+2 -0) ScalarReplAggregates.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.55 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.56 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.55 Sun Dec 10 19:17:00 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Mon Dec 11 22:24:41 2006 @@ -433,6 +433,8 @@ const PackedType *PTy; if (Accum == Type::VoidTy || In == Accum) { Accum = In; + } else if (In == Type::VoidTy) { + // Noop. } else if (In->isIntegral() && Accum->isIntegral()) { // integer union. // Otherwise pick whichever type is larger. if (In->getTypeID() > Accum->getTypeID()) From reid at x10sys.com Mon Dec 11 23:05:24 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 23:05:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp Message-ID: <200612120505.kBC55OPX029594@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: FunctionResolution.cpp updated: 1.63 -> 1.64 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+2 -2) FunctionResolution.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.63 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.64 --- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.63 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Mon Dec 11 23:04:59 2006 @@ -103,7 +103,7 @@ if (!Old->use_empty()) { Value *Replacement = Concrete; if (Concrete->getType() != Old->getType()) - Replacement = ConstantExpr::getCast(Concrete, Old->getType()); + Replacement = ConstantExpr::getBitCast(Concrete, Old->getType()); NumResolved += Old->getNumUses(); Old->replaceAllUsesWith(Replacement); } @@ -122,7 +122,7 @@ for (unsigned i = 0; i != Globals.size(); ++i) if (Globals[i] != Concrete) { - Constant *Cast = ConstantExpr::getCast(Concrete, Globals[i]->getType()); + Constant *Cast = ConstantExpr::getBitCast(Concrete,Globals[i]->getType()); Globals[i]->replaceAllUsesWith(Cast); // Since there are no uses of Old anymore, remove it from the module. From reid at x10sys.com Mon Dec 11 23:05:26 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 23:05:26 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200612120505.kBC55QNm029611@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.69 -> 1.70 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+9 -3) ScalarEvolution.cpp | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.69 llvm/lib/Analysis/ScalarEvolution.cpp:1.70 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.69 Mon Dec 11 20:26:09 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Mon Dec 11 23:04:59 2006 @@ -1566,7 +1566,9 @@ // comparison. ConstantInt *CompVal = RHSC->getValue(); const Type *RealTy = ExitCond->getOperand(0)->getType(); - CompVal = dyn_cast(ConstantExpr::getCast(CompVal, RealTy)); + CompVal = dyn_cast( + ConstantExpr::getIntegerCast(CompVal, RealTy, + CompVal->getType()->isSigned())); if (CompVal) { // Form the constant range. ConstantRange CompRange(Cond, CompVal); @@ -1575,8 +1577,12 @@ // range. if (CompRange.getLower()->getType()->isSigned()) { const Type *NewTy = RHSC->getValue()->getType(); - Constant *NewL = ConstantExpr::getCast(CompRange.getLower(), NewTy); - Constant *NewU = ConstantExpr::getCast(CompRange.getUpper(), NewTy); + Constant *NewL = + ConstantExpr::getIntegerCast(CompRange.getLower(), NewTy, + CompRange.getLower()->getType()->isSigned()); + Constant *NewU = + ConstantExpr::getIntegerCast(CompRange.getUpper(), NewTy, + CompRange.getUpper()->getType()->isSigned()); CompRange = ConstantRange(NewL, NewU); } From reid at x10sys.com Mon Dec 11 23:05:24 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 23:05:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerAllocations.cpp LowerInvoke.cpp Message-ID: <200612120505.kBC55OWn029587@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: LowerAllocations.cpp updated: 1.64 -> 1.65 LowerInvoke.cpp updated: 1.45 -> 1.46 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+9 -4) LowerAllocations.cpp | 5 +++-- LowerInvoke.cpp | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.64 llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.65 --- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.64 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Utils/LowerAllocations.cpp Mon Dec 11 23:05:00 2006 @@ -122,14 +122,15 @@ MallocArg = ConstantInt::get(Type::ULongTy, TD.getTypeSize(AllocTy)); else MallocArg = ConstantExpr::getSizeOf(AllocTy); - MallocArg = ConstantExpr::getCast(cast(MallocArg), IntPtrTy); + MallocArg = ConstantExpr::getIntegerCast(cast(MallocArg), + IntPtrTy, true /*SExt*/); if (MI->isArrayAllocation()) { if (isa(MallocArg) && cast(MallocArg)->getZExtValue() == 1) { MallocArg = MI->getOperand(0); // Operand * 1 = Operand } else if (Constant *CO = dyn_cast(MI->getOperand(0))) { - CO = ConstantExpr::getCast(CO, IntPtrTy); + CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, true /*SExt*/); MallocArg = ConstantExpr::getMul(CO, cast(MallocArg)); } else { Value *Scale = MI->getOperand(0); Index: llvm/lib/Transforms/Utils/LowerInvoke.cpp diff -u llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.45 llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.46 --- llvm/lib/Transforms/Utils/LowerInvoke.cpp:1.45 Wed Dec 6 11:46:33 2006 +++ llvm/lib/Transforms/Utils/LowerInvoke.cpp Mon Dec 11 23:05:00 2006 @@ -215,8 +215,12 @@ unsigned NumArgs = FT->getNumParams(); for (unsigned i = 0; i != 3; ++i) if (i < NumArgs && FT->getParamType(i) != Args[i]->getType()) - Args[i] = ConstantExpr::getCast(cast(Args[i]), - FT->getParamType(i)); + if (Args[i]->getType()->isInteger()) + Args[i] = ConstantExpr::getIntegerCast(cast(Args[i]), + FT->getParamType(i), true); + else + Args[i] = ConstantExpr::getBitCast(cast(Args[i]), + FT->getParamType(i)); (new CallInst(WriteFn, Args, "", IB))->setTailCall(); } From reid at x10sys.com Mon Dec 11 23:05:24 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 23:05:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200612120505.kBC55Oim029597@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.297 -> 1.298 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+2 -2) Writer.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.297 llvm/lib/Target/CBackend/Writer.cpp:1.298 --- llvm/lib/Target/CBackend/Writer.cpp:1.297 Mon Dec 11 18:11:08 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Dec 11 23:04:59 2006 @@ -296,7 +296,7 @@ if (!X.second) { // Found a conflict, replace this global with the previous one. GlobalValue *OldGV = X.first->second; - GV->replaceAllUsesWith(ConstantExpr::getCast(OldGV, GV->getType())); + GV->replaceAllUsesWith(ConstantExpr::getBitCast(OldGV, GV->getType())); GV->eraseFromParent(); Changed = true; } @@ -312,7 +312,7 @@ if (!X.second) { // Found a conflict, replace this global with the previous one. GlobalValue *OldGV = X.first->second; - GV->replaceAllUsesWith(ConstantExpr::getCast(OldGV, GV->getType())); + GV->replaceAllUsesWith(ConstantExpr::getBitCast(OldGV, GV->getType())); GV->eraseFromParent(); Changed = true; } From reid at x10sys.com Mon Dec 11 23:05:25 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 23:05:25 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp SCCP.cpp Message-ID: <200612120505.kBC55PPE029606@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.98 -> 1.99 SCCP.cpp updated: 1.140 -> 1.141 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+9 -3) LoopStrengthReduce.cpp | 9 +++++++-- SCCP.cpp | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.98 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.99 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.98 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Mon Dec 11 23:04:59 2006 @@ -200,12 +200,17 @@ return new LoopStrengthReduce(TLI); } -/// getCastedVersionOf - Return the specified value casted to uintptr_t. +/// getCastedVersionOf - Return the specified value casted to uintptr_t. This +/// assumes that the Value* V is of integer or pointer type only. /// Value *LoopStrengthReduce::getCastedVersionOf(Value *V) { if (V->getType() == UIntPtrTy) return V; if (Constant *CB = dyn_cast(V)) - return ConstantExpr::getCast(CB, UIntPtrTy); + if (CB->getType()->isInteger()) + return ConstantExpr::getIntegerCast(CB, UIntPtrTy, + CB->getType()->isSigned()); + else + return ConstantExpr::getPtrToInt(CB, UIntPtrTy); Value *&New = CastedPointers[V]; if (New) return New; Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.140 llvm/lib/Transforms/Scalar/SCCP.cpp:1.141 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.140 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Mon Dec 11 23:04:59 2006 @@ -589,7 +589,8 @@ if (VState.isOverdefined()) // Inherit overdefinedness of operand markOverdefined(&I); else if (VState.isConstant()) // Propagate constant value - markConstant(&I, ConstantExpr::getCast(VState.getConstant(), I.getType())); + markConstant(&I, ConstantExpr::getCast(I.getOpcode(), + VState.getConstant(), I.getType())); } void SCCPSolver::visitSelectInst(SelectInst &I) { From reid at x10sys.com Mon Dec 11 23:05:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 23:05:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp Message-ID: <200612120505.kBC55SR0029619@zion.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkModules.cpp updated: 1.122 -> 1.123 --- Log message: Change inferred getCast into specific getCast. Passes all tests. --- Diffs of the changes: (+6 -6) LinkModules.cpp | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.122 llvm/lib/Linker/LinkModules.cpp:1.123 --- llvm/lib/Linker/LinkModules.cpp:1.122 Thu Dec 7 17:41:45 2006 +++ llvm/lib/Linker/LinkModules.cpp Mon Dec 11 23:04:59 2006 @@ -508,7 +508,8 @@ DGV->isConstant(), DGV->getLinkage()); NewDGV->setAlignment(DGV->getAlignment()); Dest->getGlobalList().insert(DGV, NewDGV); - DGV->replaceAllUsesWith(ConstantExpr::getCast(NewDGV, DGV->getType())); + DGV->replaceAllUsesWith( + ConstantExpr::getBitCast(NewDGV, DGV->getType())); DGV->eraseFromParent(); NewDGV->setName(SGV->getName()); DGV = NewDGV; @@ -529,9 +530,8 @@ SGV->setInitializer(0); } - ValueMap.insert(std::make_pair(SGV, - ConstantExpr::getCast(DGV, - SGV->getType()))); + ValueMap.insert( + std::make_pair(SGV, ConstantExpr::getBitCast(DGV, SGV->getType()))); } } return false; @@ -807,8 +807,8 @@ // FIXME: This should rewrite simple/straight-forward uses such as // getelementptr instructions to not use the Cast! - G1->replaceAllUsesWith(ConstantExpr::getCast(NG, G1->getType())); - G2->replaceAllUsesWith(ConstantExpr::getCast(NG, G2->getType())); + G1->replaceAllUsesWith(ConstantExpr::getBitCast(NG, G1->getType())); + G2->replaceAllUsesWith(ConstantExpr::getBitCast(NG, G2->getType())); // Remove the two globals from the module now... M->getGlobalList().erase(G1); From sabre at nondot.org Mon Dec 11 23:14:28 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 23:14:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200612120514.kBC5ESxE029782@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.122 -> 1.123 --- Log message: the operand of a bitcast is always the right size, just emit it in place. --- Diffs of the changes: (+4 -2) AsmPrinter.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.122 llvm/lib/CodeGen/AsmPrinter.cpp:1.123 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.122 Mon Dec 11 19:32:02 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Dec 11 23:14:13 2006 @@ -434,9 +434,11 @@ case Instruction::FPToSI: assert(0 && "FIXME: Don't yet support this kind of constant cast expr"); break; + case Instruction::BitCast: + return EmitConstantValueOnly(CE->getOperand(0)); + case Instruction::IntToPtr: - case Instruction::PtrToInt: - case Instruction::BitCast: { + case Instruction::PtrToInt:{ // Support only foldable casts to/from pointers that can be eliminated by // changing the pointer to the appropriately sized integer type. Constant *Op = CE->getOperand(0); From sabre at nondot.org Mon Dec 11 23:18:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 23:18:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200612120518.kBC5IYvv029886@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.123 -> 1.124 --- Log message: split up inttoptr from ptrtoint handling, the cases aren't similar at all. --- Diffs of the changes: (+15 -22) AsmPrinter.cpp | 37 +++++++++++++++---------------------- 1 files changed, 15 insertions(+), 22 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.123 llvm/lib/CodeGen/AsmPrinter.cpp:1.124 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.123 Mon Dec 11 23:14:13 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Dec 11 23:18:19 2006 @@ -437,33 +437,26 @@ case Instruction::BitCast: return EmitConstantValueOnly(CE->getOperand(0)); - case Instruction::IntToPtr: - case Instruction::PtrToInt:{ + case Instruction::IntToPtr: { + // Handle casts to pointers by changing them into casts to the appropriate + // integer type. This promotes constant folding and simplifies this code. + Constant *Op = CE->getOperand(0); + Op = ConstantExpr::getIntegerCast(Op, TD->getIntPtrType(), false/*ZExt*/); + return EmitConstantValueOnly(Op); + } + + + case Instruction::PtrToInt: { // Support only foldable casts to/from pointers that can be eliminated by // changing the pointer to the appropriately sized integer type. Constant *Op = CE->getOperand(0); - const Type *OpTy = Op->getType(), *Ty = CE->getType(); + const Type *Ty = CE->getType(); - // Handle casts to pointers by changing them into casts to the appropriate - // integer type. This promotes constant folding and simplifies this code. - if (isa(Ty)) { - const Type *IntPtrTy = TD->getIntPtrType(); - Instruction::CastOps opcode = Instruction::CastOps(CE->getOpcode()); - if (opcode == Instruction::IntToPtr) - Op = ConstantExpr::getIntegerCast(Op, IntPtrTy, false /*ZExt*/); - else - Op = ConstantExpr::getPtrToInt(Op, IntPtrTy); + // We can emit the pointer value into this slot if the slot is an + // integer slot greater or equal to the size of the pointer. + if (Ty->isIntegral() && + Ty->getPrimitiveSize() >= TD->getTypeSize(Op->getType())) return EmitConstantValueOnly(Op); - } - - // We know the dest type is not a pointer. Is the src value a pointer or - // integral? - if (isa(OpTy) || OpTy->isIntegral()) { - // We can emit the pointer value into this slot if the slot is an - // integer slot greater or equal to the size of the pointer. - if (Ty->isIntegral() && TD->getTypeSize(Ty) >= TD->getTypeSize(OpTy)) - return EmitConstantValueOnly(Op); - } assert(0 && "FIXME: Don't yet support this kind of constant cast expr"); EmitConstantValueOnly(Op); From sabre at nondot.org Mon Dec 11 23:20:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 23:20:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp Message-ID: <200612120520.kBC5K1YX029942@zion.cs.uiuc.edu> 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); From sabre at nondot.org Mon Dec 11 23:22:06 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 23:22:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612120522.kBC5M6NR030002@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.430 -> 1.431 --- Log message: this can only be fptrunc. --- Diffs of the changes: (+1 -1) LegalizeDAG.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.430 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.431 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.430 Mon Dec 11 22:18:56 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 23:21:51 2006 @@ -790,7 +790,7 @@ // Only do this if the target has a native EXTLOAD instruction from // f32. TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) { - LLVMC = cast(ConstantExpr::getFPCast(LLVMC, Type::FloatTy)); + LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC, Type::FloatTy)); VT = MVT::f32; Extend = true; } From sabre at nondot.org Mon Dec 11 23:22:36 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 11 Dec 2006 23:22:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612120522.kBC5MaU5030037@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.431 -> 1.432 --- Log message: fit in 80 cols --- Diffs of the changes: (+1 -1) LegalizeDAG.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.431 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.432 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.431 Mon Dec 11 23:21:51 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 11 23:22:21 2006 @@ -790,7 +790,7 @@ // Only do this if the target has a native EXTLOAD instruction from // f32. TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) { - LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC, Type::FloatTy)); + LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC,Type::FloatTy)); VT = MVT::f32; Extend = true; } From clattner at apple.com Mon Dec 11 23:27:59 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 11 Dec 2006 21:27:59 -0800 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp In-Reply-To: <200612120505.kBC55QNm029611@zion.cs.uiuc.edu> References: <200612120505.kBC55QNm029611@zion.cs.uiuc.edu> Message-ID: <6130B17A-6E10-4A59-A7ED-1736F78E3487@apple.com> > Index: llvm/lib/Analysis/ScalarEvolution.cpp > diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.69 llvm/lib/ > Analysis/ScalarEvolution.cpp:1.70 > --- llvm/lib/Analysis/ScalarEvolution.cpp:1.69 Mon Dec 11 20:26:09 > 2006 > +++ llvm/lib/Analysis/ScalarEvolution.cpp Mon Dec 11 23:04:59 2006 > @@ -1566,7 +1566,9 @@ > // comparison. > ConstantInt *CompVal = RHSC->getValue(); > const Type *RealTy = ExitCond->getOperand(0)->getType(); > - CompVal = dyn_cast(ConstantExpr::getCast > (CompVal, RealTy)); > + CompVal = dyn_cast( > + ConstantExpr::getIntegerCast(CompVal, RealTy, > + CompVal->getType()->isSigned > ())); > if (CompVal) { > // Form the constant range. > ConstantRange CompRange(Cond, CompVal); > @@ -1575,8 +1577,12 @@ > // range. > if (CompRange.getLower()->getType()->isSigned()) { > const Type *NewTy = RHSC->getValue()->getType(); > - Constant *NewL = ConstantExpr::getCast > (CompRange.getLower(), NewTy); > - Constant *NewU = ConstantExpr::getCast > (CompRange.getUpper(), NewTy); > + Constant *NewL = > + ConstantExpr::getIntegerCast(CompRange.getLower(), > NewTy, > + CompRange.getLower()->getType()->isSigned()); > + Constant *NewU = > + ConstantExpr::getIntegerCast(CompRange.getUpper(), > NewTy, > + CompRange.getUpper()->getType()->isSigned()); > CompRange = ConstantRange(NewL, NewU); > } I believe all of these are bitcasts. The later two certainly are. -Chris From clattner at apple.com Mon Dec 11 23:33:04 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 11 Dec 2006 21:33:04 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerAllocations.cpp LowerInvoke.cpp In-Reply-To: <200612120505.kBC55OWn029587@zion.cs.uiuc.edu> References: <200612120505.kBC55OWn029587@zion.cs.uiuc.edu> Message-ID: > Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp > diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.64 llvm/ > lib/Transforms/Utils/LowerAllocations.cpp:1.65 > --- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.64 Wed Dec 6 > 11:46:33 2006 > +++ llvm/lib/Transforms/Utils/LowerAllocations.cpp Mon Dec 11 > 23:05:00 2006 > @@ -122,14 +122,15 @@ > MallocArg = ConstantInt::get(Type::ULongTy, TD.getTypeSize > (AllocTy)); > else > MallocArg = ConstantExpr::getSizeOf(AllocTy); > - MallocArg = ConstantExpr::getCast(cast(MallocArg), > IntPtrTy); > + MallocArg = ConstantExpr::getIntegerCast(cast > (MallocArg), > + IntPtrTy, true / > *SExt*/); This is always trunc or bitcast. > if (MI->isArrayAllocation()) { > if (isa(MallocArg) && > cast(MallocArg)->getZExtValue() == 1) { > MallocArg = MI->getOperand(0); // Operand * 1 = > Operand > } else if (Constant *CO = dyn_cast(MI->getOperand > (0))) { > - CO = ConstantExpr::getCast(CO, IntPtrTy); > + CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, true / > *SExt*/); This should zext, not sext. > MallocArg = ConstantExpr::getMul(CO, cast > (MallocArg)); > } else { > Value *Scale = MI->getOperand(0); > -Chris From clattner at apple.com Mon Dec 11 23:35:49 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 11 Dec 2006 21:35:49 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp SCCP.cpp In-Reply-To: <200612120505.kBC55PPE029606@zion.cs.uiuc.edu> References: <200612120505.kBC55PPE029606@zion.cs.uiuc.edu> Message-ID: <3947EF09-0C82-4404-AEC2-C2A924547BB5@apple.com> > -/// getCastedVersionOf - Return the specified value casted to > uintptr_t. > +/// getCastedVersionOf - Return the specified value casted to > uintptr_t. This > +/// assumes that the Value* V is of integer or pointer type only. > /// > Value *LoopStrengthReduce::getCastedVersionOf(Value *V) { > if (V->getType() == UIntPtrTy) return V; > if (Constant *CB = dyn_cast(V)) > - return ConstantExpr::getCast(CB, UIntPtrTy); > + if (CB->getType()->isInteger()) > + return ConstantExpr::getIntegerCast(CB, UIntPtrTy, > + CB->getType()->isSigned()); You're going to have to decide on the signedness at some point. Considering that this is used for gep indices, I'd guess they must be signed. > + else > + return ConstantExpr::getPtrToInt(CB, UIntPtrTy); > > Value *&New = CastedPointers[V]; > if (New) return New; > > > Index: llvm/lib/Transforms/Scalar/SCCP.cpp > diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.140 llvm/lib/ > Transforms/Scalar/SCCP.cpp:1.141 > --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.140 Wed Dec 6 19:30:31 2006 > +++ llvm/lib/Transforms/Scalar/SCCP.cpp Mon Dec 11 23:04:59 2006 > @@ -589,7 +589,8 @@ > if (VState.isOverdefined()) // Inherit overdefinedness > of operand > markOverdefined(&I); > else if (VState.isConstant()) // Propagate constant value > - markConstant(&I, ConstantExpr::getCast(VState.getConstant(), > I.getType())); > + markConstant(&I, ConstantExpr::getCast(I.getOpcode(), > + VState.getConstant(), > I.getType())); > } Nice bug. -Chris From reid at x10sys.com Mon Dec 11 23:39:05 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 11 Dec 2006 23:39:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200612120539.kBC5d5Il030280@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.185 -> 1.186 --- Log message: Don't create usless casts for same-bith-width floating point casts. --- Diffs of the changes: (+3 -2) Constants.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.185 llvm/lib/VMCore/Constants.cpp:1.186 --- llvm/lib/VMCore/Constants.cpp:1.185 Mon Dec 11 18:51:07 2006 +++ llvm/lib/VMCore/Constants.cpp Mon Dec 11 23:38:50 2006 @@ -1531,9 +1531,10 @@ "Invalid cast"); unsigned SrcBits = C->getType()->getPrimitiveSizeInBits(); unsigned DstBits = Ty->getPrimitiveSizeInBits(); + if (SrcBits == DstBits) + return C; // Avoid a useless cast Instruction::CastOps opcode = - (SrcBits == DstBits ? Instruction::BitCast : - (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt)); + (SrcBits > DstBits ? Instruction::FPTrunc : Instruction::FPExt); return getCast(opcode, C, Ty); } From clattner at apple.com Tue Dec 12 00:51:38 2006 From: clattner at apple.com (Chris Lattner) Date: Mon, 11 Dec 2006 22:51:38 -0800 Subject: [llvm-commits] SETCC Patches: #3 In-Reply-To: <1165794220.15266.89.camel@bashful.x10sys.com> References: <1165794220.15266.89.camel@bashful.x10sys.com> Message-ID: <27C0F155-7340-4DE8-9EBA-DD2D4224D4E7@apple.com> On Dec 10, 2006, at 3:43 PM, Reid Spencer wrote: > All, > > Here's the SETCC patch to convert SetCondInst (SetCC) instructions > into > ICmpInst. Here's somethings you should know about this patch: This is all the rest, except for instcombine. Index: tools/llvm-upgrade/UpgradeParser.y =================================================================== RCS file: /var/cvs/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y,v retrieving revision 1.24 diff -t -d -u -p -5 -r1.24 UpgradeParser.y --- tools/llvm-upgrade/UpgradeParser.y 9 Dec 2006 19:40:41 -0000 1.24 +++ tools/llvm-upgrade/UpgradeParser.y 10 Dec 2006 23:27:00 -0000 @@ -21,11 +21,11 @@ #include #define YYERROR_VERBOSE 1 #define YYINCLUDED_STDLIB_H #define YYDEBUG 1 -#define UPGRADE_SETCOND_OPS 0 +#define UPGRADE_SETCOND_OPS 1 #define GENERATE_FCMP_INSTS 0 int yylex(); // declaration" of xxx warnings. int yyparse(); extern int yydebug; This #ifdef should go away now, since it's always on. Index: lib/ExecutionEngine/Interpreter/Execution.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/ExecutionEngine/Interpreter/ Execution.cpp,v retrieving revision 1.152 diff -t -d -u -p -5 -r1.152 Execution.cpp --- lib/ExecutionEngine/Interpreter/Execution.cpp 7 Dec 2006 01:30:31 -0000 1.152 +++ lib/ExecutionEngine/Interpreter/Execution.cpp 10 Dec 2006 23:26:54 -0000 ... +static GenericValue executeICMP_ULT(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_CMP(<, UByte); + IMPLEMENT_CMP(<, UShort); + IMPLEMENT_CMP(<, UInt); + IMPLEMENT_CMP(<, ULong); + IMPLEMENT_POINTERCMP(<); + default: + cerr << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n"; + abort(); + } + return Dest; +} The interpreter is broken: all unsigned comparisons with signed operands will hit the unhandled type case. Index: lib/Target/CBackend/Writer.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Target/CBackend/Writer.cpp,v retrieving revision 1.294 diff -t -d -u -p -5 -r1.294 Writer.cpp --- lib/Target/CBackend/Writer.cpp 7 Dec 2006 23:41:45 -0000 1.294 +++ lib/Target/CBackend/Writer.cpp 10 Dec 2006 23:26:54 -0000 @@ -712,10 +717,44 @@ void CWriter::printConstant(Constant *CP case Instruction::SetGT: Out << " > "; break; case Instruction::SetGE: Out << " >= "; break; case Instruction::Shl: Out << " << "; break; case Instruction::LShr: case Instruction::AShr: Out << " >> "; break; + case Instruction::ICmp: + switch (CE->getPredicate()) { + case ICmpInst::ICMP_EQ: Out << " == "; break; + case ICmpInst::ICMP_NE: Out << " != "; break; + case ICmpInst::ICMP_SLT: + case ICmpInst::ICMP_ULT: Out << " < "; break; + case ICmpInst::ICMP_SLE: + case ICmpInst::ICMP_ULE: Out << " <= "; break; ... This apparently doesn't cast the operands of icmp constant exprs to the right sign. @@ -1122,10 +1161,65 @@ void CWriter::writeOperandWithCast(Value + +// generateCompilerSpecificCode - This is where we add conditional compilation +// directives to cater to specific compilers as need be. +// + // generateCompilerSpecificCode - This is where we add conditional compilation // directives to cater to specific compilers as need be. // ... There ya go again, trying to inflate your LOC count. @@ -1982,10 +2076,49 @@ void CWriter::visitBinaryOperator(Instru if (needsCast) { Out << "))"; } } +void CWriter::visitICmpInst(Instruction &I) { + // icmp instruction. + assert(isa(I)); + Drop the isa and later casts, change the argument to visitICmpInst to ICmpInst. Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/CodeGen/SelectionDAG/ SelectionDAGISel.cpp,v retrieving revision 1.326 diff -t -d -u -p -5 -r1.326 SelectionDAGISel.cpp --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 9 Dec 2006 02:42:38 -0000 1.326 +++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 10 Dec 2006 23:26:53 -0000 + BOp = cast(Cond); + ISD::CondCode Condition; + if (SetCondInst *SCI = dyn_cast(Cond)) { + ISD::CondCode SignCond, UnsCond, FPCond; + switch (BOp->getOpcode()) { + default: assert(0 && "Unknown setcc opcode!"); + case Instruction::SetEQ: + SignCond = ISD::SETEQ; + UnsCond = ISD::SETEQ; + FPCond = ISD::SETOEQ; + break; + case Instruction::SetNE: + SignCond = ISD::SETNE; + UnsCond = ISD::SETNE; + FPCond = ISD::SETUNE; + break; + case Instruction::SetLE: + SignCond = ISD::SETLE; + UnsCond = ISD::SETULE; + FPCond = ISD::SETOLE; + break; + case Instruction::SetGE: + SignCond = ISD::SETGE; + UnsCond = ISD::SETUGE; + FPCond = ISD::SETOGE; + break; + case Instruction::SetLT: + SignCond = ISD::SETLT; + UnsCond = ISD::SETULT; + FPCond = ISD::SETOLT; + break; + case Instruction::SetGT: + SignCond = ISD::SETGT; + UnsCond = ISD::SETUGT; + FPCond = ISD::SETOGT; + break; + } + const Type *OpType = SCI->getOperand(0)->getType(); + if (const PackedType *PTy = dyn_cast(OpType)) + OpType = PTy->getElementType(); + + if (!FiniteOnlyFPMath() && OpType->isFloatingPoint()) + Condition = FPCond; + else if (OpType->isUnsigned()) + Condition = UnsCond; + else + Condition = SignCond; You can drop UnsCond here, as SetCondInst doesn't apply to integers anymore. + } else if (FCmpInst *FC = dyn_cast(Cond)) { + switch (FC->getPredicate()) { + default: assert(0 && "Unknown fcmp predicate opcode!"); + case FCmpInst::FCMP_FALSE: Condition = ISD::SETFALSE; break; + case FCmpInst::FCMP_OEQ: Condition = ISD::SETOEQ; break; + case FCmpInst::FCMP_OGT: Condition = ISD::SETOGT; break; + case FCmpInst::FCMP_OGE: Condition = ISD::SETOGE; break; + case FCmpInst::FCMP_OLT: Condition = ISD::SETOLT; break; + case FCmpInst::FCMP_OLE: Condition = ISD::SETOLE; break; + case FCmpInst::FCMP_ONE: Condition = ISD::SETONE; break; + case FCmpInst::FCMP_ORD: Condition = ISD::SETO; break; + case FCmpInst::FCMP_UNO: Condition = ISD::SETUO; break; + case FCmpInst::FCMP_UEQ: Condition = ISD::SETUEQ; break; + case FCmpInst::FCMP_UGT: Condition = ISD::SETUGT; break; + case FCmpInst::FCMP_UGE: Condition = ISD::SETUGE; break; + case FCmpInst::FCMP_ULT: Condition = ISD::SETULT; break; + case FCmpInst::FCMP_ULE: Condition = ISD::SETULE; break; + case FCmpInst::FCMP_UNE: Condition = ISD::SETUNE; break; + case FCmpInst::FCMP_TRUE: Condition = ISD::SETTRUE; break; + } This (when it becomes active) isn't sufficient. When FiniteOnlyFPMath is enabled, all the 'o's and 'u's should get dropped. void SelectionDAGLowering::visitFCmp(User &I) { + FCmpInst::Predicate predicate = FCmpInst::BAD_FCMP_PREDICATE; + if (FCmpInst *FC = dyn_cast(&I)) likewise. diff -t -d -u -p -5 -r1.107 SimplifyCFG.cpp --- lib/Transforms/Utils/SimplifyCFG.cpp 27 Nov 2006 01:05:10 -0000 1.107 +++ lib/Transforms/Utils/SimplifyCFG.cpp 10 Dec 2006 23:26:51 -0000 @@ -388,23 +390,43 @@ static bool DominatesMergePoint(Value *V } return true; } -// GatherConstantSetEQs - Given a potentially 'or'd together collection of seteq -// instructions that compare a value against a constant, return the value being -// compared, and stick the constant into the Values vector. +// GatherConstantSetEQs - Given a potentially 'or'd together collection of +// icmp_eq instructions that compare a value against a constant, return the +// value being compared, and stick the constant into the Values vector. static Value *GatherConstantSetEQs(Value *V, std::vector &Values){ if (Instruction *Inst = dyn_cast(V)) if (Inst->getOpcode() == Instruction::SetEQ) { if (ConstantInt *C = dyn_cast(Inst->getOperand (1))) { Values.push_back(C); return Inst->getOperand(0); } else if (ConstantInt *C = dyn_cast(Inst- >getOperand(0))) { Values.push_back(C); return Inst->getOperand(1); } This code is dead because integer seteq can't exist anymore (it's icmp). + } else if (Inst->getOpcode() == Instruction::ICmp && + cast(Inst)->getPredicate() == ICmpInst::ICMP_EQ) { + if (ConstantInt *C = dyn_cast(Inst->getOperand (1))) { + Values.push_back(C); + return Inst->getOperand(0); + } else if (ConstantInt *C = dyn_cast(Inst- >getOperand(0))) { + Values.push_back(C); + return Inst->getOperand(1); + } + } else if (FCmpInst *FCI = dyn_cast(Inst)) { + FCmpInst::Predicate pred = FCI->getPredicate(); + if (pred == FCmpInst::FCMP_ONE || pred == FCmpInst::FCMP_UNE) { + if (ConstantInt *C = dyn_cast(Inst->getOperand (1))) { + Values.push_back(C); + return Inst->getOperand(0); + } else if (ConstantInt *C = dyn_cast(Inst- >getOperand(0))){ + Values.push_back(C); + return Inst->getOperand(1); + } + } FCmpInst's can't have constantint operands, this code is dead. @@ -423,10 +445,30 @@ static Value *GatherConstantSetNEs(Value return Inst->getOperand(0); } else if (ConstantInt *C = dyn_cast(Inst- >getOperand(0))) { Values.push_back(C); return Inst->getOperand(1); } + } else if (Inst->getOpcode() == Instruction::ICmp && + cast(Inst)->getPredicate() == ICmpInst::ICMP_NE) { + if (ConstantInt *C = dyn_cast(Inst->getOperand (1))) { + Values.push_back(C); + return Inst->getOperand(0); + } else if (ConstantInt *C = dyn_cast(Inst- >getOperand(0))) { + Values.push_back(C); + return Inst->getOperand(1); + } + } else if (FCmpInst *FCI = dyn_cast(Inst)) { + FCmpInst::Predicate pred = FCI->getPredicate(); + if (pred == FCmpInst::FCMP_ONE || pred == FCmpInst::FCMP_UNE) { + if (ConstantInt *C = dyn_cast(Inst->getOperand (1))) { + Values.push_back(C); + return Inst->getOperand(0); + } else if (ConstantInt *C = dyn_cast(Inst- >getOperand(0))){ + Values.push_back(C); + return Inst->getOperand(1); + } + } Likewise. Since you're handling integers, you can nuke the old SetCondInst code here. @@ -845,12 +887,11 @@ static bool HoistThenElseCodeToIf(Branch // identical order. BasicBlock *BB1 = BI->getSuccessor(0); // The true destination. BasicBlock *BB2 = BI->getSuccessor(1); // The false destination Instruction *I1 = BB1->begin(), *I2 = BB2->begin(); - if (I1->getOpcode() != I2->getOpcode() || !I1->isIdenticalTo(I2) || - isa(I1) || isa(I1)) + if (!I1->isIdenticalTo(I2) || isa(I1) || isa (I1)) return false; // If we get here, we can hoist at least one instruction. BasicBlock *BIParent = BI->getParent(); Why did you drop the opcode check? It is a fast reject path. @@ -868,11 +909,11 @@ static bool HoistThenElseCodeToIf(Branch I2->replaceAllUsesWith(I1); BB2->getInstList().erase(I2); I1 = BB1->begin(); I2 = BB2->begin(); - } while (I1->getOpcode() == I2->getOpcode() && I1->isIdenticalTo (I2)); + } while (I1->isIdenticalTo(I2)); likewise. Index: lib/Transforms/Utils/CloneFunction.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Utils/CloneFunction.cpp,v retrieving revision 1.33 diff -t -d -u -p -5 -r1.33 CloneFunction.cpp --- lib/Transforms/Utils/CloneFunction.cpp 5 Nov 2006 19:31:28 -0000 1.33 +++ lib/Transforms/Utils/CloneFunction.cpp 10 Dec 2006 23:26:50 -0000 @@ -276,16 +276,19 @@ void PruningFunctionCloner::CloneBlock(c /// ConstantFoldMappedInstruction - Constant fold the specified instruction, /// mapping its operands through ValueMap if they are available. Constant *PruningFunctionCloner:: ConstantFoldMappedInstruction(const Instruction *I) { - if (isa(I) || isa(I)) { + if (isa(I) || isa(I) || isa(I)) { if (Constant *Op0 = dyn_cast_or_null(MapValue(I- >getOperand(0), ValueMap))) if (Constant *Op1 = dyn_cast_or_null(MapValue(I- >getOperand(1), ValueMap))) - return ConstantExpr::get(I->getOpcode(), Op0, Op1); + return isa(I) ? + ConstantExpr::getCompare(I->getOpcode(), + cast(I)->getPredicate(), Op0, Op1) : + ConstantExpr::get(I->getOpcode(), Op0, Op1); return 0; } It seems more natural to split CmpInst out from binop/shift handling into a separate if, to eliminate the ternary operator. =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/Reassociate.cpp,v retrieving revision 1.68 diff -t -d -u -p -5 -r1.68 Reassociate.cpp --- lib/Transforms/Scalar/Reassociate.cpp 7 Dec 2006 20:04:42 -0000 1.68 +++ lib/Transforms/Scalar/Reassociate.cpp 10 Dec 2006 23:26:49 -0000 @@ -754,12 +755,12 @@ void Reassociate::ReassociateBB(BasicBlo MadeChange = true; BI = NI; } // Reject cases where it is pointless to do this. - if (!isa(BI) || BI->getType()->isFloatingPoint() || - isa(BI->getType())) + if (!isa(BI) || BI->getType()->isFloatingPoint() || + isa(BI->getType())) continue; // Floating point ops are not associative. This change looks like an incorrect indentation change. Index: lib/Transforms/Scalar/LoopUnswitch.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp,v retrieving revision 1.51 diff -t -d -u -p -5 -r1.51 LoopUnswitch.cpp --- lib/Transforms/Scalar/LoopUnswitch.cpp 6 Dec 2006 17:46:33 -0000 1.51 +++ lib/Transforms/Scalar/LoopUnswitch.cpp 10 Dec 2006 23:26:48 -0000 @@ -486,11 +486,14 @@ static void EmitPreheaderBranchOnConditi Instruction *InsertPt) { // Insert a conditional branch on LIC to the two preheaders. The original // code is the true version and the new code is the false version. Value *BranchVal = LIC; if (!isa(Val)) { - BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", InsertPt); + if (Val->getType()->isFloatingPoint()) + BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", InsertPt); + else + BranchVal = new ICmpInst(ICmpInst::ICMP_EQ, LIC, Val, "tmp", InsertPt); } else if (Val != ConstantBool::getTrue()) { // We want to enter the new loop when the condition is true. std::swap(TrueDest, FalseDest); } It's not obvious from immediate context, but this is always an integer comparison. diff -t -d -u -p -5 -r1.98 LoopStrengthReduce.cpp --- lib/Transforms/Scalar/LoopStrengthReduce.cpp 7 Dec 2006 01:30:31 -0000 1.98 +++ lib/Transforms/Scalar/LoopStrengthReduce.cpp 10 Dec 2006 23:26:48 -0000 @@ -1187,14 +1187,20 @@ void LoopStrengthReduce::OptimizeIndvars PHINode *SomePHI = cast(L->getHeader()->begin()); BasicBlock *Preheader = L->getLoopPreheader(); BasicBlock *LatchBlock = SomePHI->getIncomingBlock(SomePHI->getIncomingBlock(0) == Preheader); BranchInst *TermBr = dyn_cast(LatchBlock- >getTerminator()); + bool isICmp; if (!TermBr || TermBr->isUnconditional() || - !isa(TermBr->getCondition())) + (!(isICmp = isa(TermBr->getCondition()) && + !isa(TermBr->getCondition())))) return; - SetCondInst *Cond = cast(TermBr->getCondition()); + Instruction *Cond; + if (isICmp) + Cond = cast(TermBr->getCondition()); + else + Cond = cast(TermBr->getCondition()); This code only cares about integer comparisons. Please change Cond to be ICmpInst*. @@ -1223,11 +1229,14 @@ void LoopStrengthReduce::OptimizeIndvars if (&*++BasicBlock::iterator(Cond) != (Instruction*)TermBr) { if (Cond->hasOneUse()) { // Condition has a single use, just move it. Cond->moveBefore(TermBr); } else { // Otherwise, clone the terminating condition and insert into the loopend. - Cond = cast(Cond->clone()); + if (isICmp) + Cond = cast(Cond->clone()); + else + Cond = cast(Cond->clone()); Cond->setName(L->getHeader()->getName() + ".termcond"); LatchBlock->getInstList().insert(TermBr, Cond); // Clone the IVUse, as the old use still exists! IVUsesByStride[*CondStride].addUser(CondUse->Offset, Cond, Likewise. @@ -1344,19 +1353,26 @@ void LoopStrengthReduce::runOnLoop(Loop // If all four cases above are true, then we can remove both the add and // the cann indvar. // FIXME: this needs to eliminate an induction variable even if it's being // compared against some value to decide loop termination. if (PN->hasOneUse()) { - BinaryOperator *BO = dyn_cast(*(PN->use_begin ())); - if (BO && BO->hasOneUse()) { - if (PN == *(BO->use_begin())) { + if (BinaryOperator *BO = dyn_cast(*(PN- >use_begin()))) { + if (BO->hasOneUse() && PN == *(BO->use_begin())) { DeadInsts.insert(BO); // Break the cycle, then delete the PHI. PN->replaceAllUsesWith(UndefValue::get(PN->getType())); SE->deleteInstructionFromRecords(PN); PN->eraseFromParent(); } + } else if (CmpInst *CI = dyn_cast(*(PN->use_begin ()))) { + if (CI->hasOneUse() && PN == *(CI->use_begin())) { + DeadInsts.insert(CI); + // Break the cycle, then delete the PHI. + PN->replaceAllUsesWith(UndefValue::get(PN->getType())); + SE->deleteInstructionFromRecords(PN); + PN->eraseFromParent(); + } Instead of cloning the code, how about something like: // FIXME: this needs to eliminate an induction variable even if it's being // compared against some value to decide loop termination. if (PN->hasOneUse()) { Instruction *BO = *PN->use_begin(); if (isa(BO) || isa(BO)) { + if (BO->hasOneUse() && PN == *(BO->use_begin())) { DeadInsts.insert(BO); // Break the cycle, then delete the PHI. PN->replaceAllUsesWith(UndefValue::get(PN->getType())); SE->deleteInstructionFromRecords(PN); PN->eraseFromParent(); } =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp,v retrieving revision 1.74 diff -t -d -u -p -5 -r1.74 SimplifyLibCalls.cpp --- lib/Transforms/IPO/SimplifyLibCalls.cpp 6 Dec 2006 17:46:32 -0000 1.74 +++ lib/Transforms/IPO/SimplifyLibCalls.cpp 10 Dec 2006 23:26:42 -0000 @@ -941,10 +941,16 @@ static bool IsOnlyUsedInEqualsZeroCompar if (User->getOpcode() == Instruction::SetNE || User->getOpcode() == Instruction::SetEQ) { if (isa(User->getOperand(1)) && cast(User->getOperand(1))->isNullValue()) continue; + } else if (ICmpInst *IC = dyn_cast(User)) { + if ((IC->getPredicate() == ICmpInst::ICMP_NE || + IC->getPredicate() == ICmpInst::ICMP_EQ) && + isa(IC->getOperand(1)) && + cast(IC->getOperand(1))->isNullValue()) + continue; } else if (CastInst *CI = dyn_cast(User)) if (CI->getType() == Type::BoolTy) continue; // Unknown instruction. return false; The FP case is dead here. @@ -1769,13 +1775,13 @@ public: // isascii(c) -> (unsigned)c < 128 Value *V = CI->getOperand(1); if (V->getType()->isSigned()) V = CastInst::createInferredCast(V, V->getType()- >getUnsignedVersion(), V->getName(), CI); - Value *Cmp = BinaryOperator::createSetLT(V, ConstantInt::get(V- >getType(), - 128), - V->getName() +".isascii", CI); + Value *Cmp = new ICmpInst(ICmpInst::ICMP_ULT, V, + ConstantInt::get(V->getType(), 128), + V->getName()+".isascii", CI); if (Cmp->getType() != CI->getType()) Cmp = CastInst::createInferredCast( Cmp, CI->getType(), Cmp->getName(), CI); CI->replaceAllUsesWith(Cmp); CI->eraseFromParent(); You can drop the createInferredCast (which should have been a bitcast) now that compares are signless? diff -t -d -u -p -5 -r1.78 GlobalOpt.cpp --- lib/Transforms/IPO/GlobalOpt.cpp 7 Dec 2006 01:30:31 -0000 1.78 +++ lib/Transforms/IPO/GlobalOpt.cpp 10 Dec 2006 23:26:41 -0000 @@ -722,15 +722,53 @@ static GlobalVariable *OptimizeGlobalAdd std::vector Stores; while (!GV->use_empty()) if (LoadInst *LI = dyn_cast(GV->use_back())) { while (!LI->use_empty()) { Use &LoadUse = LI->use_begin().getUse(); - if (!isa(LoadUse.getUser())) - LoadUse = RepValue; - else { + if (CmpInst *CI = dyn_cast(LoadUse.getUser())) { + // Replace the cmp X, 0 with a use of the bool value. + Value *LV = new LoadInst(InitBool, InitBool->getName() +".val", CI); + InitBoolUsed = true; + switch (CI->getPredicate()) { + default: assert(0 && "Unknown ICmp Predicate!"); + case FCmpInst::FCMP_OLT: + case FCmpInst::FCMP_ULT: + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + LV = ConstantBool::getFalse(); // X < null -> always false + break; + case FCmpInst::FCMP_ULE: + case FCmpInst::FCMP_OLE: + case FCmpInst::FCMP_OEQ: + case FCmpInst::FCMP_UEQ: + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: + case ICmpInst::ICMP_EQ: + LV = BinaryOperator::createNot(LV, "notinit", CI); + break; + case ICmpInst::ICMP_NE: + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + case FCmpInst::FCMP_FALSE: + case FCmpInst::FCMP_OGT: + case FCmpInst::FCMP_OGE: + case FCmpInst::FCMP_ONE: + case FCmpInst::FCMP_ORD: + case FCmpInst::FCMP_UNO: + case FCmpInst::FCMP_UGT: + case FCmpInst::FCMP_UGE: + case FCmpInst::FCMP_UNE: + case FCmpInst::FCMP_TRUE: + break; // no change. + } + CI->replaceAllUsesWith(LV); + CI->eraseFromParent(); + } + else if (SetCondInst *SCI = dyn_cast (LoadUse.getUser())) { // Replace the setcc X, 0 with a use of the bool value. This code is walking the use list of a global variable, so all the FP cases (including the SetCondInst case) are dead: only pointer compares are possible. @@ -746,10 +784,12 @@ static GlobalVariable *OptimizeGlobalAdd break; // no change. } SCI->replaceAllUsesWith(LV); SCI->eraseFromParent(); } + else + LoadUse = RepValue; } LI->eraseFromParent(); I strongly prefer that you restore this code to its original order. Putting the short case at the bottom makes it harder to read the code, even if it makes dyn_cast more natural. Index: lib/Transforms/ExprTypeConvert.cpp =================================================================== RCS file: /var/cvs/llvm/llvm/lib/Transforms/ExprTypeConvert.cpp,v retrieving revision 1.115 diff -t -d -u -p -5 -r1.115 ExprTypeConvert.cpp --- lib/Transforms/ExprTypeConvert.cpp 7 Dec 2006 01:30:31 -0000 1.115 +++ lib/Transforms/ExprTypeConvert.cpp 10 Dec 2006 23:26:40 -0000 @@ -456,10 +456,27 @@ static bool OperandConvertibleToType(Use + case Instruction::FCmp: { + FCmpInst::Predicate pred = cast(I)->getPredicate(); + if (pred == FCmpInst::FCMP_OEQ || pred == FCmpInst::FCMP_UEQ || + pred == FCmpInst::FCMP_ONE || pred == FCmpInst::FCMP_UNE) { + Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0); + return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD); + } + return false; + } case Instruction::SetEQ: case Instruction::SetNE: { Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0); return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD); } This code (FCmp and SetEQ/SetNE) is dead, only integer types can get this far. @@ -721,10 +738,37 @@ static void ConvertOperandToType(User *U ... Res->setOperand(!OtherIdx, NewVal) ;+ case Instruction::FCmp: { + FCmpInst::Predicate pred = cast(I)->getPredicate(); + if (pred == FCmpInst::FCMP_OEQ || pred == FCmpInst::FCMP_UEQ || + pred == FCmpInst::FCMP_ONE || pred == FCmpInst::FCMP_UNE) { + Res = new FCmpInst(pred, Dummy, Dummy, Name); + VMC.ExprMap[I] = Res; // Add node to expression eagerly + unsigned OtherIdx = (OldVal == I->getOperand(0)) ? 1 : 0; + Value *OtherOp = I->getOperand(OtherIdx); + Res->setOperand(!OtherIdx, NewVal); + Value *NewOther = ConvertExpressionToType(OtherOp, NewTy, VMC, TD); + Res->setOperand(OtherIdx, NewOther); + } + break; + } case Instruction::Shl: case Instruction::LShr: case Instruction::AShr: assert(I->getOperand(0) == OldVal); Res = new ShiftInst(cast(I)->getOpcode(), NewVal, Likewise. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061211/a9ef6c50/attachment.html From evan.cheng at apple.com Tue Dec 12 01:27:53 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 12 Dec 2006 01:27:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200612120727.kBC7RrGM031983@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.327 -> 1.328 --- Log message: Expand formal arguments and call arguments recursively: e.g. f64 -> i64 -> 2 x i32. --- Diffs of the changes: (+76 -45) SelectionDAGISel.cpp | 121 ++++++++++++++++++++++++++++++++------------------- 1 files changed, 76 insertions(+), 45 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.327 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.328 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.327 Sun Dec 10 17:12:42 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Dec 12 01:27:38 2006 @@ -2860,6 +2860,32 @@ DAG.getSrcValue(I.getOperand(2)))); } +/// ExpandScalarFormalArgs - Recursively expand the formal_argument node, either +/// bit_convert it or join a pair of them with a BUILD_PAIR when appropriate. +static SDOperand ExpandScalarFormalArgs(MVT::ValueType VT, SDNode *Arg, + unsigned &i, SelectionDAG &DAG, + TargetLowering &TLI) { + if (TLI.getTypeAction(VT) != TargetLowering::Expand) + return SDOperand(Arg, i++); + + MVT::ValueType EVT = TLI.getTypeToTransformTo(VT); + unsigned NumVals = MVT::getSizeInBits(VT) / MVT::getSizeInBits(EVT); + if (NumVals == 1) { + return DAG.getNode(ISD::BIT_CONVERT, VT, + ExpandScalarFormalArgs(EVT, Arg, i, DAG, TLI)); + } else if (NumVals == 2) { + SDOperand Lo = ExpandScalarFormalArgs(EVT, Arg, i, DAG, TLI); + SDOperand Hi = ExpandScalarFormalArgs(EVT, Arg, i, DAG, TLI); + if (!TLI.isLittleEndian()) + std::swap(Lo, Hi); + return DAG.getNode(ISD::BUILD_PAIR, VT, Lo, Hi); + } else { + // Value scalarized into many values. Unimp for now. + assert(0 && "Cannot expand i64 -> i16 yet!"); + } + return SDOperand(); +} + /// TargetLowering::LowerArguments - This is the default LowerArguments /// implementation, which just inserts a FORMAL_ARGUMENTS node. FIXME: When all /// targets are migrated to using FORMAL_ARGUMENTS, this hook should be @@ -2890,8 +2916,12 @@ // If this is a large integer, it needs to be broken up into small // integers. Figure out what the destination type is and how many small // integers it turns into. - MVT::ValueType NVT = getTypeToTransformTo(VT); - unsigned NumVals = MVT::getSizeInBits(VT)/MVT::getSizeInBits(NVT); + MVT::ValueType NVT = VT; + unsigned NumVals = 1; + while (getTypeAction(NVT) == Expand) { + NVT = getTypeToTransformTo(NVT); + NumVals *= MVT::getSizeInBits(VT)/MVT::getSizeInBits(NVT); + } for (unsigned i = 0; i != NumVals; ++i) RetVals.push_back(NVT); } else { @@ -2949,26 +2979,10 @@ } case Expand: if (VT != MVT::Vector) { - // If this is a large integer, it needs to be reassembled from small - // integers. Figure out what the source elt type is and how many small - // integers it is. - MVT::ValueType NVT = getTypeToTransformTo(VT); - unsigned NumVals = MVT::getSizeInBits(VT)/MVT::getSizeInBits(NVT); - if (NumVals == 1) { - SDOperand Tmp = SDOperand(Result, i++); - Ops.push_back(DAG.getNode(ISD::BIT_CONVERT, VT, Tmp)); - } else if (NumVals == 2) { - SDOperand Lo = SDOperand(Result, i++); - SDOperand Hi = SDOperand(Result, i++); - - if (!isLittleEndian()) - std::swap(Lo, Hi); - - Ops.push_back(DAG.getNode(ISD::BUILD_PAIR, VT, Lo, Hi)); - } else { - // Value scalarized into many values. Unimp for now. - assert(0 && "Cannot expand i64 -> i16 yet!"); - } + // If this is a large integer or a floating point node that needs to be + // expanded, it needs to be reassembled from small integers. Figure out + // what the source elt type is and how many small integers it is. + Ops.push_back(ExpandScalarFormalArgs(VT, Result, i, DAG, *this)); } else { // Otherwise, this is a vector type. We only support legal vectors // right now. @@ -2998,6 +3012,39 @@ } +/// ExpandScalarCallArgs - Recursively expand call argument node by +/// bit_converting it or extract a pair of elements from the larger node. +static void ExpandScalarCallArgs(MVT::ValueType VT, SDOperand Arg, + bool isSigned, + SmallVector &Ops, + SelectionDAG &DAG, + TargetLowering &TLI) { + if (TLI.getTypeAction(VT) != TargetLowering::Expand) { + Ops.push_back(Arg); + Ops.push_back(DAG.getConstant(isSigned, MVT::i32)); + return; + } + + MVT::ValueType EVT = TLI.getTypeToTransformTo(VT); + unsigned NumVals = MVT::getSizeInBits(VT) / MVT::getSizeInBits(EVT); + if (NumVals == 1) { + Arg = DAG.getNode(ISD::BIT_CONVERT, EVT, Arg); + ExpandScalarCallArgs(EVT, Arg, isSigned, Ops, DAG, TLI); + } else if (NumVals == 2) { + SDOperand Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, EVT, Arg, + DAG.getConstant(0, TLI.getPointerTy())); + SDOperand Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, EVT, Arg, + DAG.getConstant(1, TLI.getPointerTy())); + if (!TLI.isLittleEndian()) + std::swap(Lo, Hi); + ExpandScalarCallArgs(EVT, Lo, isSigned, Ops, DAG, TLI); + ExpandScalarCallArgs(EVT, Hi, isSigned, Ops, DAG, TLI); + } else { + // Value scalarized into many values. Unimp for now. + assert(0 && "Cannot expand i64 -> i16 yet!"); + } +} + /// TargetLowering::LowerCallTo - This is the default LowerCallTo /// implementation, which just inserts an ISD::CALL node, which is later custom /// lowered by the target to something concrete. FIXME: When all targets are @@ -3041,27 +3088,7 @@ // If this is a large integer, it needs to be broken down into small // integers. Figure out what the source elt type is and how many small // integers it is. - MVT::ValueType NVT = getTypeToTransformTo(VT); - unsigned NumVals = MVT::getSizeInBits(VT)/MVT::getSizeInBits(NVT); - if (NumVals == 1) { - Ops.push_back(DAG.getNode(ISD::BIT_CONVERT, VT, Op)); - Ops.push_back(DAG.getConstant(isSigned, MVT::i32)); - } else if (NumVals == 2) { - SDOperand Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Op, - DAG.getConstant(0, getPointerTy())); - SDOperand Hi = DAG.getNode(ISD::EXTRACT_ELEMENT, NVT, Op, - DAG.getConstant(1, getPointerTy())); - if (!isLittleEndian()) - std::swap(Lo, Hi); - - Ops.push_back(Lo); - Ops.push_back(DAG.getConstant(isSigned, MVT::i32)); - Ops.push_back(Hi); - Ops.push_back(DAG.getConstant(isSigned, MVT::i32)); - } else { - // Value scalarized into many values. Unimp for now. - assert(0 && "Cannot expand i64 -> i16 yet!"); - } + ExpandScalarCallArgs(VT, Op, isSigned, Ops, DAG, *this); } else { // Otherwise, this is a vector type. We only support legal vectors // right now. @@ -3104,8 +3131,12 @@ // If this is a large integer, it needs to be reassembled from small // integers. Figure out what the source elt type is and how many small // integers it is. - MVT::ValueType NVT = getTypeToTransformTo(VT); - unsigned NumVals = MVT::getSizeInBits(VT)/MVT::getSizeInBits(NVT); + MVT::ValueType NVT = VT; + unsigned NumVals = 1; + while (getTypeAction(NVT) == Expand) { + NVT = getTypeToTransformTo(NVT); + NumVals *= MVT::getSizeInBits(VT)/MVT::getSizeInBits(NVT); + } for (unsigned i = 0; i != NumVals; ++i) RetTys.push_back(NVT); } else { From reid at x10sys.com Tue Dec 12 03:17:24 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 03:17:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerAllocations.cpp Message-ID: <200612120917.kBC9HOsk010168@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: LowerAllocations.cpp updated: 1.65 -> 1.66 --- Log message: Fix the casting for the computation of the Malloc size. --- Diffs of the changes: (+3 -3) LowerAllocations.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.65 llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.66 --- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.65 Mon Dec 11 23:05:00 2006 +++ llvm/lib/Transforms/Utils/LowerAllocations.cpp Tue Dec 12 03:17:08 2006 @@ -122,15 +122,15 @@ MallocArg = ConstantInt::get(Type::ULongTy, TD.getTypeSize(AllocTy)); else MallocArg = ConstantExpr::getSizeOf(AllocTy); - MallocArg = ConstantExpr::getIntegerCast(cast(MallocArg), - IntPtrTy, true /*SExt*/); + MallocArg = ConstantExpr::getTruncOrBitCast(cast(MallocArg), + IntPtrTy); if (MI->isArrayAllocation()) { if (isa(MallocArg) && cast(MallocArg)->getZExtValue() == 1) { MallocArg = MI->getOperand(0); // Operand * 1 = Operand } else if (Constant *CO = dyn_cast(MI->getOperand(0))) { - CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, true /*SExt*/); + CO = ConstantExpr::getIntegerCast(CO, IntPtrTy, false /*ZExt*/); MallocArg = ConstantExpr::getMul(CO, cast(MallocArg)); } else { Value *Scale = MI->getOperand(0); From reid at x10sys.com Tue Dec 12 03:18:05 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 03:18:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200612120918.kBC9I5K5010211@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.70 -> 1.71 --- Log message: Get even more accurate on the casting. --- Diffs of the changes: (+5 -8) ScalarEvolution.cpp | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.70 llvm/lib/Analysis/ScalarEvolution.cpp:1.71 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.70 Mon Dec 11 23:04:59 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Tue Dec 12 03:17:50 2006 @@ -1567,8 +1567,7 @@ ConstantInt *CompVal = RHSC->getValue(); const Type *RealTy = ExitCond->getOperand(0)->getType(); CompVal = dyn_cast( - ConstantExpr::getIntegerCast(CompVal, RealTy, - CompVal->getType()->isSigned())); + ConstantExpr::getBitCast(CompVal, RealTy)); if (CompVal) { // Form the constant range. ConstantRange CompRange(Cond, CompVal); @@ -1577,12 +1576,10 @@ // range. if (CompRange.getLower()->getType()->isSigned()) { const Type *NewTy = RHSC->getValue()->getType(); - Constant *NewL = - ConstantExpr::getIntegerCast(CompRange.getLower(), NewTy, - CompRange.getLower()->getType()->isSigned()); - Constant *NewU = - ConstantExpr::getIntegerCast(CompRange.getUpper(), NewTy, - CompRange.getUpper()->getType()->isSigned()); + Constant *NewL = ConstantExpr::getBitCast(CompRange.getLower(), + NewTy); + Constant *NewU = ConstantExpr::getBitCast(CompRange.getUpper(), + NewTy); CompRange = ConstantRange(NewL, NewU); } From reid at x10sys.com Tue Dec 12 03:19:06 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 03:19:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612120919.kBC9J6qB010276@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.562 -> 1.563 --- Log message: Fix numerous inferred casts. --- Diffs of the changes: (+121 -77) InstructionCombining.cpp | 198 ++++++++++++++++++++++++++++------------------- 1 files changed, 121 insertions(+), 77 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.562 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.563 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.562 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 12 03:18:51 2006 @@ -205,13 +205,14 @@ /// InsertCastBefore - Insert a cast of V to TY before the instruction POS. /// This also adds the cast to the worklist. Finally, this returns the /// cast. - Value *InsertCastBefore(Value *V, const Type *Ty, Instruction &Pos) { + Value *InsertCastBefore(Instruction::CastOps opc, Value *V, const Type *Ty, + Instruction &Pos) { if (V->getType() == Ty) return V; if (Constant *CV = dyn_cast(V)) - return ConstantExpr::getCast(CV, Ty); + return ConstantExpr::getCast(opc, CV, Ty); - Instruction *C = CastInst::createInferredCast(V, Ty, V->getName(), &Pos); + Instruction *C = CastInst::create(opc, V, Ty, V->getName(), &Pos); WorkList.push_back(C); return C; } @@ -269,7 +270,8 @@ /// InsertBefore instruction. This is specialized a bit to avoid inserting /// casts that are known to not do anything... /// - Value *InsertOperandCastBefore(Value *V, const Type *DestTy, + Value *InsertOperandCastBefore(Instruction::CastOps opcode, + Value *V, const Type *DestTy, Instruction *InsertBefore); // SimplifyCommutative - This performs a few simplifications for commutative @@ -398,13 +400,14 @@ /// InsertBefore instruction. This is specialized a bit to avoid inserting /// casts that are known to not do anything... /// -Value *InstCombiner::InsertOperandCastBefore(Value *V, const Type *DestTy, +Value *InstCombiner::InsertOperandCastBefore(Instruction::CastOps opcode, + Value *V, const Type *DestTy, Instruction *InsertBefore) { if (V->getType() == DestTy) return V; if (Constant *C = dyn_cast(V)) - return ConstantExpr::getCast(C, DestTy); + return ConstantExpr::getCast(opcode, C, DestTy); - return InsertCastBefore(V, DestTy, *InsertBefore); + return InsertCastBefore(opcode, V, DestTy, *InsertBefore); } // SimplifyCommutative - This performs a few simplifications for commutative @@ -1894,7 +1897,7 @@ (CI->getType()->getPrimitiveSize() == TD->getIntPtrType()->getPrimitiveSize()) && isa(CI->getOperand(0)->getType())) { - Value *I2 = InsertCastBefore(CI->getOperand(0), + Value *I2 = InsertCastBefore(Instruction::BitCast, CI->getOperand(0), PointerType::get(Type::SByteTy), I); I2 = InsertNewInstBefore(new GetElementPtrInst(I2, Other, "ctg2"), I); return new PtrToIntInst(I2, CI->getType()); @@ -2190,7 +2193,7 @@ SCOpTy->getPrimitiveSizeInBits()-1); if (SCIOp0->getType()->isUnsigned()) { const Type *NewTy = SCIOp0->getType()->getSignedVersion(); - SCIOp0 = InsertCastBefore(SCIOp0, NewTy, I); + SCIOp0 = InsertCastBefore(Instruction::BitCast, SCIOp0, NewTy, I); } Value *V = @@ -2200,8 +2203,14 @@ // If the multiply type is not the same as the source type, sign extend // or truncate to the multiply type. - if (I.getType() != V->getType()) - V = InsertCastBefore(V, I.getType(), I); + if (I.getType() != V->getType()) { + unsigned SrcBits = V->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = I.getType()->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = + (SrcBits == DstBits ? Instruction::BitCast : + (SrcBits < DstBits ? Instruction::SExt : Instruction::Trunc)); + V = InsertCastBefore(opcode, V, I.getType(), I); + } Value *OtherOp = Op0 == BoolCast ? I.getOperand(1) : Op0; return BinaryOperator::createAnd(V, OtherOp); @@ -2863,12 +2872,14 @@ Constant *ShrMask = ConstantExpr::getLShr(AllOne, OpRHS); Constant *CI = ConstantExpr::getAnd(AndRHS, ShrMask); if (CI == AndRHS) { // Masking out bits shifted in. + // (Val ashr C1) & C2 -> (Val lshr C1) & C2 // Make the argument unsigned. Value *ShVal = Op->getOperand(0); ShVal = InsertNewInstBefore(new ShiftInst(Instruction::LShr, ShVal, OpRHS, Op->getName()), TheAnd); - Value *AndRHS2 = ConstantExpr::getCast(AndRHS, ShVal->getType()); + Value *AndRHS2 = ConstantExpr::getBitCast(AndRHS, ShVal->getType()); + return BinaryOperator::createAnd(ShVal, AndRHS2, TheAnd.getName()); } } @@ -2897,9 +2908,9 @@ InsertNewInstBefore(Add, IB); // Convert to unsigned for the comparison. const Type *UnsType = Add->getType()->getUnsignedVersion(); - Value *OffsetVal = InsertCastBefore(Add, UnsType, IB); + Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add, UnsType, IB); AddCST = ConstantExpr::getAdd(AddCST, Hi); - AddCST = ConstantExpr::getCast(AddCST, UnsType); + AddCST = ConstantExpr::getBitCast(AddCST, UnsType); return new SetCondInst(Instruction::SetLT, OffsetVal, AddCST); } @@ -2918,9 +2929,9 @@ InsertNewInstBefore(Add, IB); // Convert to unsigned for the comparison. const Type *UnsType = Add->getType()->getUnsignedVersion(); - Value *OffsetVal = InsertCastBefore(Add, UnsType, IB); + Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add, UnsType, IB); AddCST = ConstantExpr::getAdd(AddCST, Hi); - AddCST = ConstantExpr::getCast(AddCST, UnsType); + AddCST = ConstantExpr::getBitCast(AddCST, UnsType); return new SetCondInst(Instruction::SetGT, OffsetVal, AddCST); } @@ -3101,7 +3112,7 @@ } else if (CastOp->getOpcode() == Instruction::Or) { // Change: and (cast (or X, C1) to T), C2 // into : trunc(C1)&C2 iff trunc(C1)&C2 == C2 - Constant *C3 = ConstantExpr::getCast(AndCI, I.getType()); + Constant *C3 = ConstantExpr::getBitCast(AndCI, I.getType()); if (ConstantExpr::getAnd(C3, AndRHS) == AndRHS) // trunc(C1)&C2 return ReplaceInstUsesWith(I, AndRHS); } @@ -3226,9 +3237,10 @@ LHSVal->getName()+".off"); InsertNewInstBefore(Add, I); const Type *UnsType = Add->getType()->getUnsignedVersion(); - Value *OffsetVal = InsertCastBefore(Add, UnsType, I); + Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add, + UnsType, I); AddCST = ConstantExpr::getSub(RHSCst, LHSCst); - AddCST = ConstantExpr::getCast(AddCST, UnsType); + AddCST = ConstantExpr::getBitCast(AddCST, UnsType); return new SetCondInst(Instruction::SetGT, OffsetVal, AddCST); } break; // (X != 13 & X != 15) -> no change @@ -3614,9 +3626,10 @@ LHSVal->getName()+".off"); InsertNewInstBefore(Add, I); const Type *UnsType = Add->getType()->getUnsignedVersion(); - Value *OffsetVal = InsertCastBefore(Add, UnsType, I); + Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add, + UnsType, I); AddCST = ConstantExpr::getSub(AddOne(RHSCst), LHSCst); - AddCST = ConstantExpr::getCast(AddCST, UnsType); + AddCST = ConstantExpr::getBitCast(AddCST, UnsType); return new SetCondInst(Instruction::SetLT, OffsetVal, AddCST); } break; // (X == 13 | X == 15) -> no change @@ -3917,11 +3930,11 @@ for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, ++GTI) { Value *Op = GEP->getOperand(i); uint64_t Size = TD.getTypeSize(GTI.getIndexedType()) & PtrSizeMask; - Constant *Scale = ConstantExpr::getCast(ConstantInt::get(UIntPtrTy, Size), + Constant *Scale = ConstantExpr::getBitCast(ConstantInt::get(UIntPtrTy, Size), SIntPtrTy); if (Constant *OpC = dyn_cast(Op)) { if (!OpC->isNullValue()) { - OpC = ConstantExpr::getCast(OpC, SIntPtrTy); + OpC = ConstantExpr::getIntegerCast(OpC, SIntPtrTy, true /*SExt*/); Scale = ConstantExpr::getMul(OpC, Scale); if (Constant *RC = dyn_cast(Result)) Result = ConstantExpr::getAdd(RC, Scale); @@ -4089,9 +4102,9 @@ // signed comparison. const Type *NewTy = LHSV->getType()->getSignedVersion(); if (LHSV->getType() != NewTy) - LHSV = InsertCastBefore(LHSV, NewTy, I); + LHSV = InsertCastBefore(Instruction::BitCast, LHSV, NewTy, I); if (RHSV->getType() != NewTy) - RHSV = InsertCastBefore(RHSV, NewTy, I); + RHSV = InsertCastBefore(Instruction::BitCast, RHSV, NewTy, I); return new SetCondInst(Cond, LHSV, RHSV); } } @@ -4388,7 +4401,8 @@ if (AndTy == Ty) LHSI->setOperand(0, Shift->getOperand(0)); else { - Value *NewCast = InsertCastBefore(Shift->getOperand(0), AndTy, + Value *NewCast = InsertCastBefore(Instruction::BitCast, + Shift->getOperand(0), AndTy, *Shift); LHSI->setOperand(0, NewCast); } @@ -4414,7 +4428,7 @@ // Make sure we insert a logical shift. Constant *NewAndCST = AndCST; if (AndCST->getType()->isSigned()) - NewAndCST = ConstantExpr::getCast(AndCST, + NewAndCST = ConstantExpr::getBitCast(AndCST, AndCST->getType()->getUnsignedVersion()); NS = new ShiftInst(Instruction::LShr, NewAndCST, Shift->getOperand(1), "tmp"); @@ -4423,11 +4437,13 @@ // If C's sign doesn't agree with the and, insert a cast now. if (NS->getType() != LHSI->getType()) - NS = InsertCastBefore(NS, LHSI->getType(), I); + NS = InsertCastBefore(Instruction::BitCast, NS, LHSI->getType(), + I); Value *ShiftOp = Shift->getOperand(0); if (ShiftOp->getType() != LHSI->getType()) - ShiftOp = InsertCastBefore(ShiftOp, LHSI->getType(), I); + ShiftOp = InsertCastBefore(Instruction::BitCast, ShiftOp, + LHSI->getType(), I); // Compute X & (C << Y). Instruction *NewAnd = @@ -4755,7 +4771,7 @@ // If 'X' is not signed, insert a cast now... if (!BOC->getType()->isSigned()) { const Type *DestTy = BOC->getType()->getSignedVersion(); - X = InsertCastBefore(X, DestTy, I); + X = InsertCastBefore(Instruction::BitCast, X, DestTy, I); } return new SetCondInst(isSetNE ? Instruction::SetLT : Instruction::SetGE, X, @@ -4770,8 +4786,8 @@ // If 'X' is signed, insert a cast now. if (NegX->getType()->isSigned()) { const Type *DestTy = NegX->getType()->getUnsignedVersion(); - X = InsertCastBefore(X, DestTy, I); - NegX = ConstantExpr::getCast(NegX, DestTy); + X = InsertCastBefore(Instruction::BitCast, X, DestTy, I); + NegX = ConstantExpr::getBitCast(NegX, DestTy); } return new SetCondInst(isSetNE ? Instruction::SetGE : @@ -4928,10 +4944,11 @@ // If Op1 is a constant, we can fold the cast into the constant. if (Op1->getType() != Op0->getType()) if (Constant *Op1C = dyn_cast(Op1)) { - Op1 = ConstantExpr::getCast(Op1C, Op0->getType()); + Op1 = ConstantExpr::getCast(Instruction::BitCast, Op1C, + Op0->getType()); } else { // Otherwise, cast the RHS right before the setcc - Op1 = InsertCastBefore(Op1, Op0->getType(), I); + Op1 = InsertCastBefore(Instruction::BitCast, Op1, Op0->getType(), I); } return BinaryOperator::create(I.getOpcode(), Op0, Op1); } @@ -5398,7 +5415,7 @@ Value *Op = ShiftOp->getOperand(0); if (Op->getType() != C->getType()) - Op = InsertCastBefore(Op, I.getType(), I); + Op = InsertCastBefore(Instruction::BitCast, Op, I.getType(), I); Instruction *Mask = BinaryOperator::createAnd(Op, C, Op->getName()+".mask"); @@ -5420,7 +5437,8 @@ } } else { // (X >>s C1) << C2 where C1 > C2 === (X >>s (C1-C2)) & mask - Op = InsertCastBefore(Mask, I.getType()->getSignedVersion(), I); + Op = InsertCastBefore(Instruction::BitCast, Mask, + I.getType()->getSignedVersion(), I); Instruction *Shift = new ShiftInst(ShiftOp->getOpcode(), Op, ConstantInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); @@ -5851,7 +5869,8 @@ case Instruction::SExt: // We need to emit a cast to truncate, then a cast to sext. return CastInst::create(Instruction::SExt, - InsertCastBefore(Res, Src->getType(), CI), DestTy); + InsertCastBefore(Instruction::Trunc, Res, Src->getType(), + CI), DestTy); } } } @@ -5874,10 +5893,15 @@ if (DestBitSize == SrcBitSize || !ValueRequiresCast(Op1, DestTy,TD) || !ValueRequiresCast(Op0, DestTy, TD)) { - Value *Op0c = InsertOperandCastBefore(Op0, DestTy, SrcI); - Value *Op1c = InsertOperandCastBefore(Op1, DestTy, SrcI); - return BinaryOperator::create(cast(SrcI) - ->getOpcode(), Op0c, Op1c); + unsigned Op0BitSize = Op0->getType()->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = + (Op0BitSize > DestBitSize ? Instruction::Trunc : + (Op0BitSize == DestBitSize ? Instruction::BitCast : + Op0->getType()->isSigned() ? Instruction::SExt :Instruction::ZExt)); + Value *Op0c = InsertOperandCastBefore(opcode, Op0, DestTy, SrcI); + Value *Op1c = InsertOperandCastBefore(opcode, Op1, DestTy, SrcI); + return BinaryOperator::create( + cast(SrcI)->getOpcode(), Op0c, Op1c); } } @@ -5886,7 +5910,7 @@ SrcI->getOpcode() == Instruction::Xor && Op1 == ConstantBool::getTrue() && (!Op0->hasOneUse() || !isa(Op0))) { - Value *New = InsertOperandCastBefore(Op0, DestTy, &CI); + Value *New = InsertOperandCastBefore(Instruction::ZExt, Op0, DestTy, &CI); return BinaryOperator::createXor(New, ConstantInt::get(CI.getType(), 1)); } break; @@ -5901,8 +5925,10 @@ // only be converting signedness, which is a noop. if (!ValueRequiresCast(Op1, DestTy,TD) || !ValueRequiresCast(Op0, DestTy, TD)) { - Value *Op0c = InsertOperandCastBefore(Op0, DestTy, SrcI); - Value *Op1c = InsertOperandCastBefore(Op1, DestTy, SrcI); + Value *Op0c = InsertOperandCastBefore(Instruction::BitCast, + Op0, DestTy, SrcI); + Value *Op1c = InsertOperandCastBefore(Instruction::BitCast, + Op1, DestTy, SrcI); return BinaryOperator::create( cast(SrcI)->getOpcode(), Op0c, Op1c); } @@ -5917,7 +5943,9 @@ // in the value. if (DestBitSize == SrcBitSize || (DestBitSize < SrcBitSize && isa(Op1))) { - Value *Op0c = InsertOperandCastBefore(Op0, DestTy, SrcI); + Instruction::CastOps opcode = (DestBitSize == SrcBitSize ? + Instruction::BitCast : Instruction::Trunc); + Value *Op0c = InsertOperandCastBefore(opcode, Op0, DestTy, SrcI); return new ShiftInst(Instruction::Shl, Op0c, Op1); } break; @@ -6014,13 +6042,18 @@ // Get a mask for the bits shifting in. uint64_t Mask = (~0ULL >> (64-ShAmt)) << DestBitWidth; - if (SrcI->hasOneUse() && MaskedValueIsZero(SrcI->getOperand(0), Mask)) { + Value* SrcIOp0 = SrcI->getOperand(0); + if (SrcI->hasOneUse() && MaskedValueIsZero(SrcIOp0, Mask)) { if (ShAmt >= DestBitWidth) // All zeros. return ReplaceInstUsesWith(CI, Constant::getNullValue(Ty)); // Okay, we can shrink this. Truncate the input, then return a new // shift. - Value *V = InsertCastBefore(SrcI->getOperand(0), Ty, CI); + Instruction::CastOps opcode = + (SrcIOp0->getType()->getPrimitiveSizeInBits() == + Ty->getPrimitiveSizeInBits() ? Instruction::BitCast : + Instruction::Trunc); + Value *V = InsertCastBefore(opcode, SrcIOp0, Ty, CI); return new ShiftInst(Instruction::LShr, V, SrcI->getOperand(1)); } } else { // This is a variable shr. @@ -6188,8 +6221,10 @@ Tmp->getOperand(0)->getType() == DestTy) || ((Tmp = dyn_cast(SVI->getOperand(1))) && Tmp->getOperand(0)->getType() == DestTy)) { - Value *LHS = InsertOperandCastBefore(SVI->getOperand(0), DestTy, &CI); - Value *RHS = InsertOperandCastBefore(SVI->getOperand(1), DestTy, &CI); + Value *LHS = InsertOperandCastBefore(Instruction::BitCast, + SVI->getOperand(0), DestTy, &CI); + Value *RHS = InsertOperandCastBefore(Instruction::BitCast, + SVI->getOperand(1), DestTy, &CI); // Return a new shuffle vector. Use the same element ID's, as we // know the vector types match #elts. return new ShuffleVectorInst(LHS, RHS, SVI->getOperand(2)); @@ -6737,7 +6772,7 @@ // Turn PPC lvx -> load if the pointer is known aligned. // Turn X86 loadups -> load if the pointer is known aligned. if (GetKnownAlignment(II->getOperand(1), TD) >= 16) { - Value *Ptr = InsertCastBefore(II->getOperand(1), + Value *Ptr = InsertCastBefore(Instruction::BitCast, II->getOperand(1), PointerType::get(II->getType()), CI); return new LoadInst(Ptr); } @@ -6747,7 +6782,8 @@ // Turn stvx -> store if the pointer is known aligned. if (GetKnownAlignment(II->getOperand(2), TD) >= 16) { const Type *OpPtrTy = PointerType::get(II->getOperand(1)->getType()); - Value *Ptr = InsertCastBefore(II->getOperand(2), OpPtrTy, CI); + Value *Ptr = InsertCastBefore(Instruction::BitCast, II->getOperand(2), + OpPtrTy, CI); return new StoreInst(II->getOperand(1), Ptr); } break; @@ -6758,7 +6794,8 @@ // Turn X86 storeu -> store if the pointer is known aligned. if (GetKnownAlignment(II->getOperand(1), TD) >= 16) { const Type *OpPtrTy = PointerType::get(II->getOperand(2)->getType()); - Value *Ptr = InsertCastBefore(II->getOperand(1), OpPtrTy, CI); + Value *Ptr = InsertCastBefore(Instruction::BitCast, II->getOperand(1), + OpPtrTy, CI); return new StoreInst(II->getOperand(2), Ptr); } break; @@ -6792,8 +6829,10 @@ if (AllEltsOk) { // Cast the input vectors to byte vectors. - Value *Op0 = InsertCastBefore(II->getOperand(1), Mask->getType(), CI); - Value *Op1 = InsertCastBefore(II->getOperand(2), Mask->getType(), CI); + Value *Op0 = InsertCastBefore(Instruction::BitCast, + II->getOperand(1), Mask->getType(), CI); + Value *Op1 = InsertCastBefore(Instruction::BitCast, + II->getOperand(2), Mask->getType(), CI); Value *Result = UndefValue::get(Op0->getType()); // Only extract each element once. @@ -7316,15 +7355,18 @@ return 0; } -static Value *InsertSignExtendToPtrTy(Value *V, const Type *DTy, - Instruction *InsertPoint, - InstCombiner *IC) { - unsigned PS = IC->getTargetData().getPointerSize(); - const Type *VTy = V->getType(); - if (!VTy->isSigned() && VTy->getPrimitiveSize() < PS) - // We must insert a cast to ensure we sign-extend. - V = IC->InsertCastBefore(V, VTy->getSignedVersion(), *InsertPoint); - return IC->InsertCastBefore(V, DTy, *InsertPoint); +static Value *InsertCastToIntPtrTy(Value *V, const Type *DTy, + Instruction *InsertPoint, + InstCombiner *IC) { + unsigned PtrSize = IC->getTargetData().getPointerSize(); + unsigned VTySize = V->getType()->getPrimitiveSize(); + // We must cast correctly to the pointer type. Ensure that we + // sign extend the integer value if it is smaller as this is + // used for address computation. + Instruction::CastOps opcode = + (VTySize < PtrSize ? Instruction::SExt : + (VTySize == PtrSize ? Instruction::BitCast : Instruction::Trunc)); + return IC->InsertCastBefore(opcode, V, DTy, *InsertPoint); } @@ -7384,11 +7426,12 @@ Value *Op = GEP.getOperand(i); if (Op->getType()->getPrimitiveSize() > TD->getPointerSize()) if (Constant *C = dyn_cast(Op)) { - GEP.setOperand(i, ConstantExpr::getCast(C, + GEP.setOperand(i, ConstantExpr::getTrunc(C, TD->getIntPtrType()->getSignedVersion())); MadeChange = true; } else { - Op = InsertCastBefore(Op, TD->getIntPtrType(), GEP); + Op = InsertCastBefore(Instruction::Trunc, Op, TD->getIntPtrType(), + GEP); GEP.setOperand(i, Op); MadeChange = true; } @@ -7398,7 +7441,7 @@ if (ConstantInt *CUI = dyn_cast(Op)) if (CUI->getType()->isUnsigned()) { GEP.setOperand(i, - ConstantExpr::getCast(CUI, CUI->getType()->getSignedVersion())); + ConstantExpr::getBitCast(CUI, CUI->getType()->getSignedVersion())); MadeChange = true; } } @@ -7444,22 +7487,22 @@ // target's pointer size. if (SO1->getType() != GO1->getType()) { if (Constant *SO1C = dyn_cast(SO1)) { - SO1 = ConstantExpr::getCast(SO1C, GO1->getType()); + SO1 = ConstantExpr::getIntegerCast(SO1C, GO1->getType(), true); } else if (Constant *GO1C = dyn_cast(GO1)) { - GO1 = ConstantExpr::getCast(GO1C, SO1->getType()); + GO1 = ConstantExpr::getIntegerCast(GO1C, SO1->getType(), true); } else { unsigned PS = TD->getPointerSize(); if (SO1->getType()->getPrimitiveSize() == PS) { // Convert GO1 to SO1's type. - GO1 = InsertSignExtendToPtrTy(GO1, SO1->getType(), &GEP, this); + GO1 = InsertCastToIntPtrTy(GO1, SO1->getType(), &GEP, this); } else if (GO1->getType()->getPrimitiveSize() == PS) { // Convert SO1 to GO1's type. - SO1 = InsertSignExtendToPtrTy(SO1, GO1->getType(), &GEP, this); + SO1 = InsertCastToIntPtrTy(SO1, GO1->getType(), &GEP, this); } else { const Type *PT = TD->getIntPtrType(); - SO1 = InsertSignExtendToPtrTy(SO1, PT, &GEP, this); - GO1 = InsertSignExtendToPtrTy(GO1, PT, &GEP, this); + SO1 = InsertCastToIntPtrTy(SO1, PT, &GEP, this); + GO1 = InsertCastToIntPtrTy(GO1, PT, &GEP, this); } } } @@ -7593,7 +7636,8 @@ Scale = ConstantInt::get(Scale->getType(), Scale->getZExtValue() / ArrayEltSize); if (Scale->getZExtValue() != 1) { - Constant *C = ConstantExpr::getCast(Scale, NewIdx->getType()); + Constant *C = ConstantExpr::getIntegerCast(Scale, NewIdx->getType(), + true /*SExt*/); Instruction *Sc = BinaryOperator::createMul(NewIdx, C, "idxscale"); NewIdx = InsertNewInstBefore(Sc, GEP); } @@ -8279,7 +8323,7 @@ return BinaryOperator::create(BO->getOpcode(), newEI0, newEI1); } } else if (isa(I)) { - Value *Ptr = InsertCastBefore(I->getOperand(0), + Value *Ptr = InsertCastBefore(Instruction::BitCast, I->getOperand(0), PointerType::get(EI.getType()), EI); GetElementPtrInst *GEP = new GetElementPtrInst(Ptr, EI.getOperand(1), I->getName() + ".gep"); @@ -8659,7 +8703,7 @@ } /// OptimizeConstantExpr - Given a constant expression and target data layout -/// information, symbolically evaluation the constant expr to something simpler +/// information, symbolically evaluate the constant expr to something simpler /// if possible. static Constant *OptimizeConstantExpr(ConstantExpr *CE, const TargetData *TD) { if (!TD) return CE; @@ -8677,8 +8721,8 @@ std::vector Ops(CE->op_begin()+1, CE->op_end()); uint64_t Offset = TD->getIndexedOffset(Ptr->getType(), Ops); Constant *C = ConstantInt::get(Type::ULongTy, Offset); - C = ConstantExpr::getCast(C, TD->getIntPtrType()); - return ConstantExpr::getCast(C, CE->getType()); + C = ConstantExpr::getIntegerCast(C, TD->getIntPtrType(), true /*SExt*/); + return ConstantExpr::getIntToPtr(C, CE->getType()); } } From jlaskey at apple.com Tue Dec 12 07:15:44 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 07:15:44 -0600 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c Message-ID: <200612121315.kBCDFiuS014558@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests: 2006-12-11-LoadConstants.c updated: 1.1 -> 1.2 --- Log message: Add more constants. --- Diffs of the changes: (+131 -0) 2006-12-11-LoadConstants.c | 131 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 131 insertions(+) Index: llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c diff -u llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c:1.1 llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c:1.2 --- llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c:1.1 Mon Dec 11 14:22:44 2006 +++ llvm-test/SingleSource/UnitTests/2006-12-11-LoadConstants.c Tue Dec 12 07:15:29 2006 @@ -92,6 +92,72 @@ long long uuus() { return 0x7fff7fff7fffffffLL; } long long uuuu() { return 0x7fff7fff7fff7fffLL; } +long long bit00() { return 0x0000000000000001LL; } +long long bit01() { return 0x0000000000000002LL; } +long long bit02() { return 0x0000000000000004LL; } +long long bit03() { return 0x0000000000000008LL; } +long long bit04() { return 0x0000000000000010LL; } +long long bit05() { return 0x0000000000000020LL; } +long long bit06() { return 0x0000000000000040LL; } +long long bit07() { return 0x0000000000000080LL; } +long long bit08() { return 0x0000000000000100LL; } +long long bit09() { return 0x0000000000000200LL; } +long long bit10() { return 0x0000000000000400LL; } +long long bit11() { return 0x0000000000000800LL; } +long long bit12() { return 0x0000000000001000LL; } +long long bit13() { return 0x0000000000002000LL; } +long long bit14() { return 0x0000000000004000LL; } +long long bit15() { return 0x0000000000008000LL; } +long long bit16() { return 0x0000000000010000LL; } +long long bit17() { return 0x0000000000020000LL; } +long long bit18() { return 0x0000000000040000LL; } +long long bit19() { return 0x0000000000080000LL; } +long long bit20() { return 0x0000000000100000LL; } +long long bit21() { return 0x0000000000200000LL; } +long long bit22() { return 0x0000000000400000LL; } +long long bit23() { return 0x0000000000800000LL; } +long long bit24() { return 0x0000000001000000LL; } +long long bit25() { return 0x0000000002000000LL; } +long long bit26() { return 0x0000000004000000LL; } +long long bit27() { return 0x0000000008000000LL; } +long long bit28() { return 0x0000000010000000LL; } +long long bit29() { return 0x0000000020000000LL; } +long long bit30() { return 0x0000000040000000LL; } +long long bit31() { return 0x0000000080000000LL; } +long long bit32() { return 0x0000000100000000LL; } +long long bit33() { return 0x0000000200000000LL; } +long long bit34() { return 0x0000000400000000LL; } +long long bit35() { return 0x0000000800000000LL; } +long long bit36() { return 0x0000001000000000LL; } +long long bit37() { return 0x0000002000000000LL; } +long long bit38() { return 0x0000004000000000LL; } +long long bit39() { return 0x0000008000000000LL; } +long long bit40() { return 0x0000010000000000LL; } +long long bit41() { return 0x0000020000000000LL; } +long long bit42() { return 0x0000040000000000LL; } +long long bit43() { return 0x0000080000000000LL; } +long long bit44() { return 0x0000100000000000LL; } +long long bit45() { return 0x0000200000000000LL; } +long long bit46() { return 0x0000400000000000LL; } +long long bit47() { return 0x0000800000000000LL; } +long long bit48() { return 0x0001000000000000LL; } +long long bit49() { return 0x0002000000000000LL; } +long long bit50() { return 0x0004000000000000LL; } +long long bit51() { return 0x0008000000000000LL; } +long long bit52() { return 0x0010000000000000LL; } +long long bit53() { return 0x0020000000000000LL; } +long long bit54() { return 0x0040000000000000LL; } +long long bit55() { return 0x0080000000000000LL; } +long long bit56() { return 0x0100000000000000LL; } +long long bit57() { return 0x0200000000000000LL; } +long long bit58() { return 0x0400000000000000LL; } +long long bit59() { return 0x0800000000000000LL; } +long long bit60() { return 0x1000000000000000LL; } +long long bit61() { return 0x2000000000000000LL; } +long long bit62() { return 0x4000000000000000LL; } +long long bit63() { return 0x8000000000000000LL; } + + int main(int argc, const char *argv[]) { printf("%08x\n", zz()); printf("%08x\n", zs()); @@ -185,5 +251,70 @@ printf("%016llx\n", uuus()); printf("%016llx\n", uuuu()); + printf("%016llx\n", bit00()); + printf("%016llx\n", bit01()); + printf("%016llx\n", bit02()); + printf("%016llx\n", bit03()); + printf("%016llx\n", bit04()); + printf("%016llx\n", bit05()); + printf("%016llx\n", bit06()); + printf("%016llx\n", bit07()); + printf("%016llx\n", bit08()); + printf("%016llx\n", bit09()); + printf("%016llx\n", bit10()); + printf("%016llx\n", bit11()); + printf("%016llx\n", bit12()); + printf("%016llx\n", bit13()); + printf("%016llx\n", bit14()); + printf("%016llx\n", bit15()); + printf("%016llx\n", bit16()); + printf("%016llx\n", bit17()); + printf("%016llx\n", bit18()); + printf("%016llx\n", bit19()); + printf("%016llx\n", bit20()); + printf("%016llx\n", bit21()); + printf("%016llx\n", bit22()); + printf("%016llx\n", bit23()); + printf("%016llx\n", bit24()); + printf("%016llx\n", bit25()); + printf("%016llx\n", bit26()); + printf("%016llx\n", bit27()); + printf("%016llx\n", bit28()); + printf("%016llx\n", bit29()); + printf("%016llx\n", bit30()); + printf("%016llx\n", bit31()); + printf("%016llx\n", bit32()); + printf("%016llx\n", bit33()); + printf("%016llx\n", bit34()); + printf("%016llx\n", bit35()); + printf("%016llx\n", bit36()); + printf("%016llx\n", bit37()); + printf("%016llx\n", bit38()); + printf("%016llx\n", bit39()); + printf("%016llx\n", bit40()); + printf("%016llx\n", bit41()); + printf("%016llx\n", bit42()); + printf("%016llx\n", bit43()); + printf("%016llx\n", bit44()); + printf("%016llx\n", bit45()); + printf("%016llx\n", bit46()); + printf("%016llx\n", bit47()); + printf("%016llx\n", bit48()); + printf("%016llx\n", bit49()); + printf("%016llx\n", bit50()); + printf("%016llx\n", bit51()); + printf("%016llx\n", bit52()); + printf("%016llx\n", bit53()); + printf("%016llx\n", bit54()); + printf("%016llx\n", bit55()); + printf("%016llx\n", bit56()); + printf("%016llx\n", bit57()); + printf("%016llx\n", bit58()); + printf("%016llx\n", bit59()); + printf("%016llx\n", bit60()); + printf("%016llx\n", bit61()); + printf("%016llx\n", bit62()); + printf("%016llx\n", bit63()); + return 0; } From jlaskey at apple.com Tue Dec 12 07:23:58 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 07:23:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp PPCInstr64Bit.td Message-ID: <200612121323.kBCDNwRr014699@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.227 -> 1.228 PPCInstr64Bit.td updated: 1.33 -> 1.34 --- Log message: Reduce number of instructions to load 64-bit constants. --- Diffs of the changes: (+75 -42) PPCISelDAGToDAG.cpp | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ PPCInstr64Bit.td | 42 ----------------------------- 2 files changed, 75 insertions(+), 42 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.227 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.228 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.227 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Tue Dec 12 07:23:43 2006 @@ -766,6 +766,81 @@ switch (N->getOpcode()) { default: break; + + case ISD::Constant: { + if (N->getValueType(0) == MVT::i64) { + // Get 64 bit value. + int64_t Imm = cast(N)->getValue(); + // Assume no remaining bits. + unsigned Remainder = 0; + // Assume no shift required. + unsigned Shift = 0; + + // If it can't be represented as a 32 bit value. + if (!isInt32(Imm)) { + Shift = CountTrailingZeros_64(Imm); + int64_t ImmSh = static_cast(Imm) >> Shift; + + // If the shifted value fits 32 bits. + if (isInt32(ImmSh)) { + // Go with the shifted value. + Imm = ImmSh; + } else { + // Still stuck with a 64 bit value. + Remainder = Imm; + Shift = 32; + Imm >>= 32; + } + } + + // Intermediate operand. + SDNode *Result; + + // Handle first 32 bits. + unsigned Lo = Imm & 0xFFFF; + unsigned Hi = (Imm >> 16) & 0xFFFF; + + // Simple value. + if (isInt16(Imm)) { + // Just the Lo bits. + Result = CurDAG->getTargetNode(PPC::LI8, MVT::i64, getI32Imm(Lo)); + } else if (Lo) { + // Handle the Hi bits. + unsigned OpC = Hi ? PPC::LIS8 : PPC::LI8; + Result = CurDAG->getTargetNode(OpC, MVT::i64, getI32Imm(Hi)); + // And Lo bits. + Result = CurDAG->getTargetNode(PPC::ORI8, MVT::i64, + SDOperand(Result, 0), getI32Imm(Lo)); + } else { + // Just the Hi bits. + Result = CurDAG->getTargetNode(PPC::LIS8, MVT::i64, getI32Imm(Hi)); + } + + // If no shift, we're done. + if (!Shift) return Result; + + // Shift for next step if the upper 32-bits were not zero. + if (Imm) { + Result = CurDAG->getTargetNode(PPC::RLDICR, MVT::i64, + SDOperand(Result, 0), + getI32Imm(Shift), getI32Imm(63 - Shift)); + } + + // Add in the last bits as required. + if ((Hi = (Remainder >> 16) & 0xFFFF)) { + Result = CurDAG->getTargetNode(PPC::ORIS8, MVT::i64, + SDOperand(Result, 0), getI32Imm(Hi)); + } + if ((Lo = Remainder & 0xFFFF)) { + Result = CurDAG->getTargetNode(PPC::ORI8, MVT::i64, + SDOperand(Result, 0), getI32Imm(Lo)); + } + + return Result; + } + break; + } + case ISD::SETCC: return SelectSETCC(Op); case PPCISD::GlobalBaseReg: Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.33 llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.34 --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.33 Wed Dec 6 15:46:13 2006 +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td Tue Dec 12 07:23:43 2006 @@ -474,48 +474,6 @@ // Instruction Patterns // -// Immediate support. -// Handled above: -// sext(0x0000_0000_0000_FFFF, i8) -> li imm -// sext(0x0000_0000_FFFF_0000, i16) -> lis imm>>16 - -// sext(0x0000_0000_FFFF_FFFF, i16) -> lis + ori -def sext_0x0000_0000_FFFF_FFFF_i16 : PatLeaf<(imm), [{ - return N->getValue() == (uint64_t)(int32_t)N->getValue(); -}]>; -def : Pat<(i64 sext_0x0000_0000_FFFF_FFFF_i16:$imm), - (ORI8 (LIS8 (HI16 imm:$imm)), (LO16 imm:$imm))>; - -// zext(0x0000_0000_FFFF_7FFF, i16) -> oris (li lo16(imm)), imm>>16 -def zext_0x0000_0000_FFFF_7FFF_i16 : PatLeaf<(imm), [{ - return (N->getValue() & 0xFFFFFFFF00008000ULL) == 0; -}]>; -def : Pat<(i64 zext_0x0000_0000_FFFF_7FFF_i16:$imm), - (ORIS8 (LI8 (LO16 imm:$imm)), (HI16 imm:$imm))>; - -// zext(0x0000_0000_FFFF_FFFF, i16) -> oris (ori (li 0), lo16(imm)), imm>>16 -def zext_0x0000_0000_FFFF_FFFF_i16 : PatLeaf<(imm), [{ - return (N->getValue() & 0xFFFFFFFF00000000ULL) == 0; -}]>; -def : Pat<(i64 zext_0x0000_0000_FFFF_FFFF_i16:$imm), - (ORIS8 (ORI8 (LI8 0), (LO16 imm:$imm)), (HI16 imm:$imm))>; - -// FIXME: Handle smart forms where the top 32-bits are set. Right now, stuff -// like 0xABCD0123BCDE0000 hits the case below, which produces ORI R, R, 0's! - -// Fully general (and most expensive: 6 instructions!) immediate pattern. -def : Pat<(i64 imm:$imm), - (ORI8 - (ORIS8 - (RLDICR - (ORI8 - (LIS8 (HI48_64 imm:$imm)), - (HI32_48 imm:$imm)), - 32, 31), - (HI16 imm:$imm)), - (LO16 imm:$imm))>; - - // Extensions and truncates to/from 32-bit regs. def : Pat<(i64 (zext GPRC:$in)), (RLDICL (OR4To8 GPRC:$in, GPRC:$in), 0, 32)>; From rafael.espindola at gmail.com Tue Dec 12 08:03:45 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 12 Dec 2006 08:03:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Message-ID: <200612121403.kBCE3jgY015314@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.89 -> 1.90 --- Log message: don't use "ordinary" addressing mode 1 when mvn is appropriate --- Diffs of the changes: (+2 -0) ARMISelDAGToDAG.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.89 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.90 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.89 Mon Dec 11 19:03:11 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue Dec 12 08:03:29 2006 @@ -849,6 +849,8 @@ case ISD::Constant: { uint32_t val = cast(N)->getValue(); if(!isRotInt8Immediate(val)) { + if (isRotInt8Immediate(~val)) + return false; //use MVN Constant *C = ConstantInt::get(Type::UIntTy, val); int alignment = 2; SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment); From rafael.espindola at gmail.com Tue Dec 12 08:03:46 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 12 Dec 2006 08:03:46 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/mvn.ll Message-ID: <200612121403.kBCE3k7M015319@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: mvn.ll updated: 1.2 -> 1.3 --- Log message: don't use "ordinary" addressing mode 1 when mvn is appropriate --- Diffs of the changes: (+12 -1) mvn.ll | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/ARM/mvn.ll diff -u llvm/test/Regression/CodeGen/ARM/mvn.ll:1.2 llvm/test/Regression/CodeGen/ARM/mvn.ll:1.3 --- llvm/test/Regression/CodeGen/ARM/mvn.ll:1.2 Mon Dec 11 19:03:11 2006 +++ llvm/test/Regression/CodeGen/ARM/mvn.ll Tue Dec 12 08:03:29 2006 @@ -1,5 +1,5 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 5 +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 6 int %f1() { entry: @@ -53,3 +53,14 @@ %tmp3not = xor int %tmp3, -1 ; [#uses=1] ret int %tmp3not } + +int %f9() { +entry: + %tmp4845 = add int 0, 0 + br label %cond_true4848 + +cond_true4848: ; preds = %bb4835 + %tmp4851 = sub int -3, 0 ; [#uses=1] + %abc = add int %tmp4851, %tmp4845 + ret int %abc +} From jlaskey at apple.com Tue Dec 12 10:06:38 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 12:06:38 -0400 Subject: [llvm-commits] [llvm-ggc4] -m64 needs to be treated as a power4 Message-ID: <388F38B5-49EE-4E81-94CF-8B12FB63F171@apple.com> Index: rs6000/rs6000.h =================================================================== --- rs6000/rs6000.h (revision 121250) +++ rs6000/rs6000.h (working copy) @@ -3613,7 +3613,6 @@ { switch (rs6000_cpu) { \ case PROCESSOR_RIOS1: \ case PROCESSOR_RIOS2: \ - case PROCESSOR_RS64A: \ case PROCESSOR_MPCCORE: \ case PROCESSOR_PPC403: \ case PROCESSOR_PPC405: \ @@ -3628,6 +3627,7 @@ case PROCESSOR_PPC7400: F.setCPU("7400"); break; \ case PROCESSOR_PPC7450: F.setCPU("7450"); break; \ case PROCESSOR_PPC8540: F.setCPU("7450"); break; \ + case PROCESSOR_RS64A: \ case PROCESSOR_POWER4: \ case PROCESSOR_POWER5: F.setCPU("970"); break; /* FIXME: NOT RIGHT */ \ } \ -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061212/17fe8e65/attachment.bin From jlaskey at apple.com Tue Dec 12 10:07:51 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 10:07:51 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/SubtargetFeature.h TargetSubtarget.h Message-ID: <200612121607.kBCG7p51017487@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: SubtargetFeature.h updated: 1.7 -> 1.8 TargetSubtarget.h updated: 1.2 -> 1.3 --- Log message: Honor the command line specification for machine type. --- Diffs of the changes: (+8 -0) SubtargetFeature.h | 3 +++ TargetSubtarget.h | 5 +++++ 2 files changed, 8 insertions(+) Index: llvm/include/llvm/Target/SubtargetFeature.h diff -u llvm/include/llvm/Target/SubtargetFeature.h:1.7 llvm/include/llvm/Target/SubtargetFeature.h:1.8 --- llvm/include/llvm/Target/SubtargetFeature.h:1.7 Fri Mar 24 04:00:56 2006 +++ llvm/include/llvm/Target/SubtargetFeature.h Tue Dec 12 10:07:33 2006 @@ -81,6 +81,9 @@ /// Set the CPU string. Replaces previous setting. Setting to "" clears CPU. void setCPU(const std::string &String); + /// Get the CPU string. + const std::string &getCPU() const { return Features[0]; } + /// Setting CPU string only if no string is set. void setCPUIfNone(const std::string &String); Index: llvm/include/llvm/Target/TargetSubtarget.h diff -u llvm/include/llvm/Target/TargetSubtarget.h:1.2 llvm/include/llvm/Target/TargetSubtarget.h:1.3 --- llvm/include/llvm/Target/TargetSubtarget.h:1.2 Mon Jul 11 21:41:19 2005 +++ llvm/include/llvm/Target/TargetSubtarget.h Tue Dec 12 10:07:33 2006 @@ -14,6 +14,8 @@ #ifndef LLVM_TARGET_TARGETSUBTARGET_H #define LLVM_TARGET_TARGETSUBTARGET_H +#include + namespace llvm { //===----------------------------------------------------------------------===// @@ -25,10 +27,13 @@ class TargetSubtarget { TargetSubtarget(const TargetSubtarget&); // DO NOT IMPLEMENT void operator=(const TargetSubtarget&); // DO NOT IMPLEMENT + std::string CPU; // CPU name. protected: // Can only create subclasses... TargetSubtarget(); public: virtual ~TargetSubtarget(); + void setCPU(const std::string &C) { CPU = C; } + const std::string &getCPU() const { return CPU; } }; } // End llvm namespace From jlaskey at apple.com Tue Dec 12 10:07:50 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 10:07:50 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/SubtargetEmitter.cpp Message-ID: <200612121607.kBCG7o6t017480@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: SubtargetEmitter.cpp updated: 1.21 -> 1.22 --- Log message: Honor the command line specification for machine type. --- Diffs of the changes: (+1 -0) SubtargetEmitter.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/utils/TableGen/SubtargetEmitter.cpp diff -u llvm/utils/TableGen/SubtargetEmitter.cpp:1.21 llvm/utils/TableGen/SubtargetEmitter.cpp:1.22 --- llvm/utils/TableGen/SubtargetEmitter.cpp:1.21 Thu Nov 2 19:28:12 2006 +++ llvm/utils/TableGen/SubtargetEmitter.cpp Tue Dec 12 10:07:33 2006 @@ -460,6 +460,7 @@ " const std::string &CPU) {\n" " SubtargetFeatures Features(FS);\n" " Features.setCPUIfNone(CPU);\n" + " setCPU(Features.getCPU());\n" " uint32_t Bits = Features.getBits(SubTypeKV, SubTypeKVSize,\n" " FeatureKV, FeatureKVSize);\n"; From jlaskey at apple.com Tue Dec 12 10:07:51 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 10:07:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200612121607.kBCG7pCG017492@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.218 -> 1.219 --- Log message: Honor the command line specification for machine type. --- Diffs of the changes: (+12 -1) PPCAsmPrinter.cpp | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.218 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.219 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.218 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Dec 12 10:07:33 2006 @@ -542,8 +542,19 @@ bool DarwinAsmPrinter::doInitialization(Module &M) { - if (Subtarget.isGigaProcessor()) + const std::string &CPU = Subtarget.getCPU(); + + if (CPU != "generic") + O << "\t.machine ppc" << CPU << "\n"; + else if (Subtarget.isGigaProcessor()) O << "\t.machine ppc970\n"; + else if (Subtarget.isPPC64()) + O << "\t.machine ppc64\n"; + else if (Subtarget.hasAltivec()) + O << "\t.machine ppc7400\n"; + else + O << "\t.machine ppc\n"; + AsmPrinter::doInitialization(M); // Darwin wants symbols to be quoted if they have complex names. From rafael.espindola at gmail.com Tue Dec 12 11:10:28 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 12 Dec 2006 11:10:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp ARMInstrInfo.td Message-ID: <200612121710.kBCHASl2018440@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.90 -> 1.91 ARMInstrInfo.td updated: 1.78 -> 1.79 --- Log message: more general matching of the MVN instruction --- Diffs of the changes: (+11 -37) ARMISelDAGToDAG.cpp | 37 +++++++++++-------------------------- ARMInstrInfo.td | 11 ----------- 2 files changed, 11 insertions(+), 37 deletions(-) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.90 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.91 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.90 Tue Dec 12 08:03:29 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Tue Dec 12 11:10:13 2006 @@ -849,13 +849,17 @@ case ISD::Constant: { uint32_t val = cast(N)->getValue(); if(!isRotInt8Immediate(val)) { - if (isRotInt8Immediate(~val)) - return false; //use MVN - Constant *C = ConstantInt::get(Type::UIntTy, val); - int alignment = 2; - SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment); - SDOperand Z = CurDAG->getTargetConstant(0, MVT::i32); - SDNode *n = CurDAG->getTargetNode(ARM::LDR, MVT::i32, Addr, Z); + SDOperand Z = CurDAG->getTargetConstant(0, MVT::i32); + SDNode *n; + if (isRotInt8Immediate(~val)) { + SDOperand C = CurDAG->getTargetConstant(~val, MVT::i32); + n = CurDAG->getTargetNode(ARM::MVN, MVT::i32, C, Z, Z); + } else { + Constant *C = ConstantInt::get(Type::UIntTy, val); + int alignment = 2; + SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment); + n = CurDAG->getTargetNode(ARM::LDR, MVT::i32, Addr, Z); + } Arg = SDOperand(n, 0); } else Arg = CurDAG->getTargetConstant(val, MVT::i32); @@ -887,25 +891,6 @@ return true; } -bool ARMDAGToDAGISel::SelectAddrMode1a(SDOperand Op, - SDOperand N, - SDOperand &Arg, - SDOperand &Shift, - SDOperand &ShiftType) { - if (N.getOpcode() != ISD::Constant) - return false; - - uint32_t val = ~cast(N)->getValue(); - if(!isRotInt8Immediate(val)) - return false; - - Arg = CurDAG->getTargetConstant(val, MVT::i32); - Shift = CurDAG->getTargetConstant(0, MVT::i32); - ShiftType = CurDAG->getTargetConstant(ARMShift::LSL, MVT::i32); - - return true; -} - bool ARMDAGToDAGISel::SelectAddrMode2(SDOperand Op, SDOperand N, SDOperand &Arg, SDOperand &Offset) { //TODO: complete and cleanup! Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.78 llvm/lib/Target/ARM/ARMInstrInfo.td:1.79 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.78 Mon Dec 11 19:03:11 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Tue Dec 12 11:10:13 2006 @@ -18,11 +18,6 @@ let MIOperandInfo = (ops ptr_rc, ptr_rc, i32imm); } -def op_addr_mode1a : Operand { - let PrintMethod = "printAddrMode1"; - let MIOperandInfo = (ops ptr_rc, ptr_rc, i32imm); -} - def op_addr_mode2 : Operand { let PrintMethod = "printAddrMode2"; let MIOperandInfo = (ops ptr_rc, i32imm); @@ -38,9 +33,6 @@ def addr_mode1 : ComplexPattern; -//Addressing Mode 1a: MVN hack -def addr_mode1a : ComplexPattern; - //Addressing Mode 2: Load and Store Word or Unsigned Byte def addr_mode2 : ComplexPattern; @@ -201,9 +193,6 @@ def MVN : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src), "mvn $dst, $src", [(set IntRegs:$dst, (not addr_mode1:$src))]>; -def MVN2 : InstARM<(ops IntRegs:$dst, op_addr_mode1:$src), - "mvn $dst, $src", [(set IntRegs:$dst, addr_mode1a:$src)]>; - def ADD : Addr1BinOp<"add", add>; def ADCS : Addr1BinOp<"adcs", adde>; def ADDS : Addr1BinOp<"adds", addc>; From rafael.espindola at gmail.com Tue Dec 12 11:10:30 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Tue, 12 Dec 2006 11:10:30 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/mvn.ll Message-ID: <200612121710.kBCHAURx018446@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: mvn.ll updated: 1.3 -> 1.4 --- Log message: more general matching of the MVN instruction --- Diffs of the changes: (+7 -1) mvn.ll | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/ARM/mvn.ll diff -u llvm/test/Regression/CodeGen/ARM/mvn.ll:1.3 llvm/test/Regression/CodeGen/ARM/mvn.ll:1.4 --- llvm/test/Regression/CodeGen/ARM/mvn.ll:1.3 Tue Dec 12 08:03:29 2006 +++ llvm/test/Regression/CodeGen/ARM/mvn.ll Tue Dec 12 11:10:13 2006 @@ -1,5 +1,5 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm && -; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 6 +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep mvn | wc -l | grep 7 int %f1() { entry: @@ -64,3 +64,9 @@ %abc = add int %tmp4851, %tmp4845 ret int %abc } + +bool %f10(int %a) { +entry: + %tmp102 = seteq int -2, %a ; [#uses=1] + ret bool %tmp102 +} From sabre at nondot.org Tue Dec 12 12:23:54 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 12 Dec 2006 12:23:54 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Applications/oggenc/oggenc.c Message-ID: <200612121823.kBCINscm019698@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Applications/oggenc: oggenc.c updated: 1.3 -> 1.4 --- Log message: this code is dead when the -s option is passed (which llvm-test does), but it is dangerous, remove it. --- Diffs of the changes: (+1 -1) oggenc.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/MultiSource/Applications/oggenc/oggenc.c diff -u llvm-test/MultiSource/Applications/oggenc/oggenc.c:1.3 llvm-test/MultiSource/Applications/oggenc/oggenc.c:1.4 --- llvm-test/MultiSource/Applications/oggenc/oggenc.c:1.3 Sun Jan 22 12:41:05 2006 +++ llvm-test/MultiSource/Applications/oggenc/oggenc.c Tue Dec 12 12:23:39 2006 @@ -790,7 +790,7 @@ if(opt.serial == 0) { /* We randomly pick a serial number. This is then incremented for each file */ - srand(time(NULL)); + srand(0); opt.serial = rand(); } From sabre at nondot.org Tue Dec 12 12:41:18 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 12 Dec 2006 12:41:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612121841.kBCIfIrU019976@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.563 -> 1.564 --- Log message: Fix regression on 400.perlbench last night. --- Diffs of the changes: (+1 -1) InstructionCombining.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.563 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.564 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.563 Tue Dec 12 03:18:51 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 12 12:41:03 2006 @@ -3112,7 +3112,7 @@ } else if (CastOp->getOpcode() == Instruction::Or) { // Change: and (cast (or X, C1) to T), C2 // into : trunc(C1)&C2 iff trunc(C1)&C2 == C2 - Constant *C3 = ConstantExpr::getBitCast(AndCI, I.getType()); + Constant *C3 = ConstantExpr::getTrunc(AndCI, I.getType()); if (ConstantExpr::getAnd(C3, AndRHS) == AndRHS) // trunc(C1)&C2 return ReplaceInstUsesWith(I, AndRHS); } From rspencer at reidspencer.com Tue Dec 12 13:07:20 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 12 Dec 2006 19:07:20 +0000 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200612121841.kBCIfIrU019976@zion.cs.uiuc.edu> References: <200612121841.kBCIfIrU019976@zion.cs.uiuc.edu> Message-ID: <1165950440.15266.178.camel@bashful.x10sys.com> On Tue, 2006-12-12 at 12:41 -0600, Chris Lattner wrote: > > Changes in directory llvm/lib/Transforms/Scalar: > > InstructionCombining.cpp updated: 1.563 -> 1.564 > --- > Log message: > > Fix regression on 400.perlbench last night. Chris, Thanks. I should have SPEC2006 in a few weeks. Are you sure this shouldn't be getTruncOrBitCast ? Reid. > > > --- > Diffs of the changes: (+1 -1) > > InstructionCombining.cpp | 2 +- > 1 files changed, 1 insertion(+), 1 deletion(-) > > > Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp > diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.563 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.564 > --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.563 Tue Dec 12 03:18:51 2006 > +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 12 12:41:03 2006 > @@ -3112,7 +3112,7 @@ > } else if (CastOp->getOpcode() == Instruction::Or) { > // Change: and (cast (or X, C1) to T), C2 > // into : trunc(C1)&C2 iff trunc(C1)&C2 == C2 > - Constant *C3 = ConstantExpr::getBitCast(AndCI, I.getType()); > + Constant *C3 = ConstantExpr::getTrunc(AndCI, I.getType()); > if (ConstantExpr::getAnd(C3, AndRHS) == AndRHS) // trunc(C1)&C2 > return ReplaceInstUsesWith(I, AndRHS); > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Tue Dec 12 13:11:35 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 12 Dec 2006 13:11:35 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612121911.kBCJBZOa029451@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.564 -> 1.565 --- Log message: this can be trunc or bitcast, per line 3092. --- Diffs of the changes: (+1 -1) InstructionCombining.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.564 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.565 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.564 Tue Dec 12 12:41:03 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 12 13:11:20 2006 @@ -3112,7 +3112,7 @@ } else if (CastOp->getOpcode() == Instruction::Or) { // Change: and (cast (or X, C1) to T), C2 // into : trunc(C1)&C2 iff trunc(C1)&C2 == C2 - Constant *C3 = ConstantExpr::getTrunc(AndCI, I.getType()); + Constant *C3 = ConstantExpr::getTruncOrBitCast(AndCI,I.getType()); if (ConstantExpr::getAnd(C3, AndRHS) == AndRHS) // trunc(C1)&C2 return ReplaceInstUsesWith(I, AndRHS); } From clattner at apple.com Tue Dec 12 13:11:49 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 12 Dec 2006 11:11:49 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <1165950440.15266.178.camel@bashful.x10sys.com> References: <200612121841.kBCIfIrU019976@zion.cs.uiuc.edu> <1165950440.15266.178.camel@bashful.x10sys.com> Message-ID: <2417860E-56EA-400E-90ED-D68F4D762534@apple.com> On Dec 12, 2006, at 11:07 AM, Reid Spencer wrote: > On Tue, 2006-12-12 at 12:41 -0600, Chris Lattner wrote: >> >> Changes in directory llvm/lib/Transforms/Scalar: >> >> InstructionCombining.cpp updated: 1.563 -> 1.564 >> --- >> Log message: >> >> Fix regression on 400.perlbench last night. > > Chris, Thanks. I should have SPEC2006 in a few weeks. Are you sure > this > shouldn't be getTruncOrBitCast ? You're right, fixed. -Chris From jlaskey at apple.com Tue Dec 12 13:27:07 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 13:27:07 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/SubtargetEmitter.cpp Message-ID: <200612121927.kBCJR7OB003444@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: SubtargetEmitter.cpp updated: 1.22 -> 1.23 --- Log message: Rollback changes to take a different tack. --- Diffs of the changes: (+0 -1) SubtargetEmitter.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/utils/TableGen/SubtargetEmitter.cpp diff -u llvm/utils/TableGen/SubtargetEmitter.cpp:1.22 llvm/utils/TableGen/SubtargetEmitter.cpp:1.23 --- llvm/utils/TableGen/SubtargetEmitter.cpp:1.22 Tue Dec 12 10:07:33 2006 +++ llvm/utils/TableGen/SubtargetEmitter.cpp Tue Dec 12 13:26:50 2006 @@ -460,7 +460,6 @@ " const std::string &CPU) {\n" " SubtargetFeatures Features(FS);\n" " Features.setCPUIfNone(CPU);\n" - " setCPU(Features.getCPU());\n" " uint32_t Bits = Features.getBits(SubTypeKV, SubTypeKVSize,\n" " FeatureKV, FeatureKVSize);\n"; From jlaskey at apple.com Tue Dec 12 13:27:09 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 13:27:09 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/SubtargetFeature.h TargetSubtarget.h Message-ID: <200612121927.kBCJR9IL003451@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: SubtargetFeature.h updated: 1.8 -> 1.9 TargetSubtarget.h updated: 1.3 -> 1.4 --- Log message: Rollback changes to take a different tack. --- Diffs of the changes: (+0 -6) SubtargetFeature.h | 3 --- TargetSubtarget.h | 3 --- 2 files changed, 6 deletions(-) Index: llvm/include/llvm/Target/SubtargetFeature.h diff -u llvm/include/llvm/Target/SubtargetFeature.h:1.8 llvm/include/llvm/Target/SubtargetFeature.h:1.9 --- llvm/include/llvm/Target/SubtargetFeature.h:1.8 Tue Dec 12 10:07:33 2006 +++ llvm/include/llvm/Target/SubtargetFeature.h Tue Dec 12 13:26:50 2006 @@ -81,9 +81,6 @@ /// Set the CPU string. Replaces previous setting. Setting to "" clears CPU. void setCPU(const std::string &String); - /// Get the CPU string. - const std::string &getCPU() const { return Features[0]; } - /// Setting CPU string only if no string is set. void setCPUIfNone(const std::string &String); Index: llvm/include/llvm/Target/TargetSubtarget.h diff -u llvm/include/llvm/Target/TargetSubtarget.h:1.3 llvm/include/llvm/Target/TargetSubtarget.h:1.4 --- llvm/include/llvm/Target/TargetSubtarget.h:1.3 Tue Dec 12 10:07:33 2006 +++ llvm/include/llvm/Target/TargetSubtarget.h Tue Dec 12 13:26:50 2006 @@ -27,13 +27,10 @@ class TargetSubtarget { TargetSubtarget(const TargetSubtarget&); // DO NOT IMPLEMENT void operator=(const TargetSubtarget&); // DO NOT IMPLEMENT - std::string CPU; // CPU name. protected: // Can only create subclasses... TargetSubtarget(); public: virtual ~TargetSubtarget(); - void setCPU(const std::string &C) { CPU = C; } - const std::string &getCPU() const { return CPU; } }; } // End llvm namespace From jlaskey at apple.com Tue Dec 12 13:27:09 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 13:27:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200612121927.kBCJR9WQ003456@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.219 -> 1.220 --- Log message: Rollback changes to take a different tack. --- Diffs of the changes: (+5 -0) PPCAsmPrinter.cpp | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.219 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.220 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.219 Tue Dec 12 10:07:33 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Dec 12 13:26:50 2006 @@ -542,6 +542,10 @@ bool DarwinAsmPrinter::doInitialization(Module &M) { +#if 1 + if (Subtarget.isGigaProcessor()) + O << "\t.machine ppc970\n"; +#else const std::string &CPU = Subtarget.getCPU(); if (CPU != "generic") @@ -554,6 +558,7 @@ O << "\t.machine ppc7400\n"; else O << "\t.machine ppc\n"; +#endif AsmPrinter::doInitialization(M); From jlaskey at apple.com Tue Dec 12 13:37:08 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 13:37:08 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetSubtarget.h Message-ID: <200612121937.kBCJb8Df003651@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetSubtarget.h updated: 1.4 -> 1.5 --- Log message: Remove unneeded include. --- Diffs of the changes: (+0 -2) TargetSubtarget.h | 2 -- 1 files changed, 2 deletions(-) Index: llvm/include/llvm/Target/TargetSubtarget.h diff -u llvm/include/llvm/Target/TargetSubtarget.h:1.4 llvm/include/llvm/Target/TargetSubtarget.h:1.5 --- llvm/include/llvm/Target/TargetSubtarget.h:1.4 Tue Dec 12 13:26:50 2006 +++ llvm/include/llvm/Target/TargetSubtarget.h Tue Dec 12 13:36:53 2006 @@ -14,8 +14,6 @@ #ifndef LLVM_TARGET_TARGETSUBTARGET_H #define LLVM_TARGET_TARGETSUBTARGET_H -#include - namespace llvm { //===----------------------------------------------------------------------===// From evan.cheng at apple.com Tue Dec 12 13:53:28 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 12 Dec 2006 13:53:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612121953.kBCJrSBd004030@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.432 -> 1.433 --- Log message: - When expanding a bit_convert whose src operand is also to be expanded and its expansion result type is equal to the result type of the bit_convert, e.g. (i64 bit_convert (f64 op)) if FP is not legal returns the result of the expanded source operand. - Store f32 / f64 may be expanded to a single store i32/i64. --- Diffs of the changes: (+16 -2) LegalizeDAG.cpp | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.432 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.433 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.432 Mon Dec 11 23:22:21 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 12 13:53:13 2006 @@ -1735,7 +1735,7 @@ } } else { ExpandOp(Node->getOperand(1), Lo, Hi); - IncrementSize = MVT::getSizeInBits(Hi.getValueType())/8; + IncrementSize = Hi.Val ? MVT::getSizeInBits(Hi.getValueType())/8 : 0; if (!TLI.isLittleEndian()) std::swap(Lo, Hi); @@ -1743,6 +1743,13 @@ Lo = DAG.getStore(Tmp1, Lo, Tmp2, ST->getSrcValue(), ST->getSrcValueOffset()); + + if (Hi.Val == NULL) { + // Must be int <-> float one-to-one expansion. + Result = Lo; + break; + } + Tmp2 = DAG.getNode(ISD::ADD, Tmp2.getValueType(), Tmp2, getIntPtrConstant(IncrementSize)); assert(isTypeLegal(Tmp2.getValueType()) && @@ -4593,7 +4600,14 @@ // f32 / f64 must be expanded to i32 / i64. if (VT == MVT::f32 || VT == MVT::f64) { Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0)); - Hi = SDOperand(); + break; + } + + // If source operand will be expanded to the same type as VT, i.e. + // i64 <- f64, i32 <- f32, expand the source operand instead. + MVT::ValueType VT0 = Node->getOperand(0).getValueType(); + if (getTypeAction(VT0) == Expand && TLI.getTypeToTransformTo(VT0) == VT) { + ExpandOp(Node->getOperand(0), Lo, Hi); break; } From jlaskey at apple.com Tue Dec 12 14:56:13 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 14:56:13 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/SubtargetEmitter.cpp Message-ID: <200612122056.kBCKuD73005009@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: SubtargetEmitter.cpp updated: 1.23 -> 1.24 --- Log message: Ignore entries with blank names. --- Diffs of the changes: (+4 -2) SubtargetEmitter.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/utils/TableGen/SubtargetEmitter.cpp diff -u llvm/utils/TableGen/SubtargetEmitter.cpp:1.23 llvm/utils/TableGen/SubtargetEmitter.cpp:1.24 --- llvm/utils/TableGen/SubtargetEmitter.cpp:1.23 Tue Dec 12 13:26:50 2006 +++ llvm/utils/TableGen/SubtargetEmitter.cpp Tue Dec 12 14:55:58 2006 @@ -87,7 +87,7 @@ << "static llvm::SubtargetFeatureKV FeatureKV[] = {\n"; // For each feature - for (unsigned i = 0, N = FeatureList.size(); i < N;) { + for (unsigned i = 0, N = FeatureList.size(); i < N; ++i) { // Next feature Record *Feature = FeatureList[i]; @@ -95,6 +95,8 @@ std::string CommandLineName = Feature->getValueAsString("Name"); std::string Desc = Feature->getValueAsString("Desc"); + if (CommandLineName.empty()) continue; + // Emit as { "feature", "decription", feactureEnum } OS << " { " << "\"" << CommandLineName << "\", " @@ -103,7 +105,7 @@ << " }"; // Depending on 'if more in the list' emit comma - if (++i < N) OS << ","; + if ((i + 1) < N) OS << ","; OS << "\n"; } From jlaskey at apple.com Tue Dec 12 14:57:23 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 14:57:23 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC.td PPCAsmPrinter.cpp PPCSubtarget.h Message-ID: <200612122057.kBCKvNTZ005050@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC.td updated: 1.18 -> 1.19 PPCAsmPrinter.cpp updated: 1.220 -> 1.221 PPCSubtarget.h updated: 1.19 -> 1.20 --- Log message: Honor cpu directive, take two. --- Diffs of the changes: (+81 -34) PPC.td | 56 +++++++++++++++++++++++++++++++++++++----------------- PPCAsmPrinter.cpp | 37 +++++++++++++++++++---------------- PPCSubtarget.h | 22 +++++++++++++++++++++ 3 files changed, 81 insertions(+), 34 deletions(-) Index: llvm/lib/Target/PowerPC/PPC.td diff -u llvm/lib/Target/PowerPC/PPC.td:1.18 llvm/lib/Target/PowerPC/PPC.td:1.19 --- llvm/lib/Target/PowerPC/PPC.td:1.18 Fri Jun 16 12:34:12 2006 +++ llvm/lib/Target/PowerPC/PPC.td Tue Dec 12 14:57:07 2006 @@ -19,6 +19,21 @@ // PowerPC Subtarget features. // +//===----------------------------------------------------------------------===// +// CPU Directives // +//===----------------------------------------------------------------------===// + +def Directive601 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_601", "">; +def Directive602 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_602", "">; +def Directive603 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">; +def Directive604 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">; +def Directive620 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_603", "">; +def Directive7400: SubtargetFeature<"", "DarwinDirective", "PPC::DIR_7400", "">; +def Directive750 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_750", "">; +def Directive970 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_970", "">; +def Directive32 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_32", "">; +def Directive64 : SubtargetFeature<"", "DarwinDirective", "PPC::DIR_64", "">; + def Feature64Bit : SubtargetFeature<"64bit","Has64BitSupport", "true", "Enable 64-bit instructions">; def Feature64BitRegs : SubtargetFeature<"64bitregs","Use64BitRegs", "true", @@ -44,26 +59,33 @@ // PowerPC processors supported. // -def : Processor<"generic", G3Itineraries, []>; -def : Processor<"601", G3Itineraries, []>; -def : Processor<"602", G3Itineraries, []>; -def : Processor<"603", G3Itineraries, []>; -def : Processor<"603e", G3Itineraries, []>; -def : Processor<"603ev", G3Itineraries, []>; -def : Processor<"604", G3Itineraries, []>; -def : Processor<"604e", G3Itineraries, []>; -def : Processor<"620", G3Itineraries, []>; -def : Processor<"g3", G3Itineraries, []>; -def : Processor<"7400", G4Itineraries, [FeatureAltivec]>; -def : Processor<"g4", G4Itineraries, [FeatureAltivec]>; -def : Processor<"7450", G4PlusItineraries, [FeatureAltivec]>; -def : Processor<"g4+", G4PlusItineraries, [FeatureAltivec]>; -def : Processor<"750", G3Itineraries, []>; +def : Processor<"generic", G3Itineraries, [Directive32]>; +def : Processor<"601", G3Itineraries, [Directive601]>; +def : Processor<"602", G3Itineraries, [Directive602]>; +def : Processor<"603", G3Itineraries, [Directive603]>; +def : Processor<"603e", G3Itineraries, [Directive603]>; +def : Processor<"603ev", G3Itineraries, [Directive603]>; +def : Processor<"604", G3Itineraries, [Directive604]>; +def : Processor<"604e", G3Itineraries, [Directive604]>; +def : Processor<"620", G3Itineraries, [Directive620]>; +def : Processor<"g3", G3Itineraries, [Directive7400]>; +def : Processor<"7400", G4Itineraries, [Directive7400, FeatureAltivec]>; +def : Processor<"g4", G4Itineraries, [Directive7400, FeatureAltivec]>; +def : Processor<"7450", G4PlusItineraries, [Directive7400, FeatureAltivec]>; +def : Processor<"g4+", G4PlusItineraries, [Directive750, FeatureAltivec]>; +def : Processor<"750", G4Itineraries, [Directive750, FeatureAltivec]>; def : Processor<"970", G5Itineraries, - [FeatureAltivec, FeatureGPUL, FeatureFSqrt, FeatureSTFIWX, + [Directive970, FeatureAltivec, + FeatureGPUL, FeatureFSqrt, FeatureSTFIWX, Feature64Bit /*, Feature64BitRegs */]>; def : Processor<"g5", G5Itineraries, - [FeatureAltivec, FeatureGPUL, FeatureFSqrt, FeatureSTFIWX, + [Directive970, FeatureAltivec, + FeatureGPUL, FeatureFSqrt, FeatureSTFIWX, + Feature64Bit /*, Feature64BitRegs */]>; +def : Processor<"ppc", G3Itineraries, [Directive32]>; +def : Processor<"ppc64", G5Itineraries, + [Directive64, FeatureAltivec, + FeatureGPUL, FeatureFSqrt, FeatureSTFIWX, Feature64Bit /*, Feature64BitRegs */]>; Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.220 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.221 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.220 Tue Dec 12 13:26:50 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Dec 12 14:57:08 2006 @@ -542,23 +542,26 @@ bool DarwinAsmPrinter::doInitialization(Module &M) { -#if 1 - if (Subtarget.isGigaProcessor()) - O << "\t.machine ppc970\n"; -#else - const std::string &CPU = Subtarget.getCPU(); - - if (CPU != "generic") - O << "\t.machine ppc" << CPU << "\n"; - else if (Subtarget.isGigaProcessor()) - O << "\t.machine ppc970\n"; - else if (Subtarget.isPPC64()) - O << "\t.machine ppc64\n"; - else if (Subtarget.hasAltivec()) - O << "\t.machine ppc7400\n"; - else - O << "\t.machine ppc\n"; -#endif + static const char *CPUDirectives[] = { + "ppc", + "ppc601", + "ppc602", + "ppc603", + "ppc7400", + "ppc750", + "ppc970", + "ppc64" + }; + + unsigned Directive = Subtarget.getDarwinDirective(); + if (Subtarget.isGigaProcessor() && Directive < PPC::DIR_970) + Directive = PPC::DIR_970; + if (Subtarget.hasAltivec() && Directive < PPC::DIR_7400) + Directive = PPC::DIR_7400; + if (Subtarget.isPPC64() && Directive < PPC::DIR_970) + Directive = PPC::DIR_64; + assert(Directive <= PPC::DIR_64 && "Directive out of range."); + O << "\t.machine " << CPUDirectives[Directive] << "\n"; AsmPrinter::doInitialization(M); Index: llvm/lib/Target/PowerPC/PPCSubtarget.h diff -u llvm/lib/Target/PowerPC/PPCSubtarget.h:1.19 llvm/lib/Target/PowerPC/PPCSubtarget.h:1.20 --- llvm/lib/Target/PowerPC/PPCSubtarget.h:1.19 Mon Dec 11 17:22:45 2006 +++ llvm/lib/Target/PowerPC/PPCSubtarget.h Tue Dec 12 14:57:08 2006 @@ -20,6 +20,21 @@ #include namespace llvm { + +namespace PPC { + // -m directive values. + enum { + DIR_32, + DIR_601, + DIR_602, + DIR_603, + DIR_7400, + DIR_750, + DIR_970, + DIR_64 + }; +} + class Module; class GlobalValue; class TargetMachine; @@ -34,6 +49,9 @@ /// Selected instruction itineraries (one entry per itinerary class.) InstrItineraryData InstrItins; + + /// Which cpu directive was used. + unsigned DarwinDirective; /// Used by the ISel to turn in optimizations for POWER4-derived architectures bool IsGigaProcessor; @@ -65,6 +83,10 @@ /// function for this subtarget. unsigned getStackAlignment() const { return StackAlignment; } + /// getDarwinDirective - Returns the -m directive specified for the cpu. + /// + unsigned getDarwinDirective() const { return DarwinDirective; } + /// getInstrItins - Return the instruction itineraies based on subtarget /// selection. const InstrItineraryData &getInstrItineraryData() const { return InstrItins; } From jlaskey at apple.com Tue Dec 12 15:00:03 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 12 Dec 2006 17:00:03 -0400 Subject: [llvm-commits] [llvm-commit][llvm-gcc4] Use new cpu directives. Message-ID: <61576F4E-2B55-4E15-AAF3-E3D6EBFEDB32@apple.com> Index: rs6000.h =================================================================== --- rs6000.h (revision 121251) +++ rs6000.h (working copy) @@ -3616,7 +3616,7 @@ case PROCESSOR_MPCCORE: \ case PROCESSOR_PPC403: \ case PROCESSOR_PPC405: \ - case PROCESSOR_PPC440: F.setCPU("generic"); break; \ + case PROCESSOR_PPC440: F.setCPU("ppc"); break; \ case PROCESSOR_PPC601: F.setCPU("601"); break; \ case PROCESSOR_PPC603: F.setCPU("603"); break; \ case PROCESSOR_PPC604: F.setCPU("604"); break; \ @@ -3627,7 +3627,7 @@ case PROCESSOR_PPC7400: F.setCPU("7400"); break; \ case PROCESSOR_PPC7450: F.setCPU("7450"); break; \ case PROCESSOR_PPC8540: F.setCPU("7450"); break; \ - case PROCESSOR_RS64A: \ + case PROCESSOR_RS64A: F.setCPU("ppc64"); break; \ case PROCESSOR_POWER4: \ case PROCESSOR_POWER5: F.setCPU("970"); break; /* FIXME: NOT RIGHT */ \ } \ -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061212/7059d8fd/attachment.bin From evan.cheng at apple.com Tue Dec 12 15:21:47 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 12 Dec 2006 15:21:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200612122121.kBCLLljs005482@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.328 -> 1.329 --- Log message: Expand i32/i64 CopyToReg f32/f64 to BIT_CONVERT + CopyToReg. --- Diffs of the changes: (+3 -0) SelectionDAGISel.cpp | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.328 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.329 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.328 Tue Dec 12 01:27:38 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Dec 12 15:21:32 2006 @@ -3942,6 +3942,9 @@ else Op = DAG.getNode(ISD::ANY_EXTEND, DestVT, Op); return DAG.getCopyToReg(getRoot(), Reg, Op); + } else if (SrcVT == MVT::f32 || SrcVT == MVT::f64) { + return DAG.getCopyToReg(getRoot(), Reg, + DAG.getNode(ISD::BIT_CONVERT, DestVT, Op)); } else { // The src value is expanded into multiple registers. SDOperand Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, DestVT, From evan.cheng at apple.com Tue Dec 12 15:33:00 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 12 Dec 2006 15:33:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612122133.kBCLX0N1005677@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.433 -> 1.434 --- Log message: Expand ConstantFP to load from CP if float types are being expanded. --- Diffs of the changes: (+44 -27) LegalizeDAG.cpp | 71 ++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 44 insertions(+), 27 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.433 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.434 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.433 Tue Dec 12 13:53:13 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 12 15:32:44 2006 @@ -488,6 +488,37 @@ } } +/// ExpandConstantFP - Expands the ConstantFP node by spilling the constant to +/// memory. +static SDOperand ExpandConstantFP(ConstantFPSDNode *CFP, SelectionDAG &DAG, + TargetLowering &TLI) { + bool Extend = false; + + // If a FP immediate is precise when represented as a float and if the + // target can do an extending load from float to double, we put it into + // the constant pool as a float, even if it's is statically typed as a + // double. + MVT::ValueType VT = CFP->getValueType(0); + bool isDouble = VT == MVT::f64; + ConstantFP *LLVMC = ConstantFP::get(isDouble ? Type::DoubleTy : + Type::FloatTy, CFP->getValue()); + if (isDouble && CFP->isExactlyValue((float)CFP->getValue()) && + // Only do this if the target has a native EXTLOAD instruction from f32. + TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) { + LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC,Type::FloatTy)); + VT = MVT::f32; + Extend = true; + } + + SDOperand CPIdx = DAG.getConstantPool(LLVMC, TLI.getPointerTy()); + if (Extend) { + return DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, DAG.getEntryNode(), + CPIdx, NULL, 0, MVT::f32); + } else { + return DAG.getLoad(VT, DAG.getEntryNode(), CPIdx, NULL, 0); + } +} + /// LegalizeOp - We know that the specified value has a legal type. /// Recursively ensure that the operands have legal types, then return the @@ -775,33 +806,7 @@ } // FALLTHROUGH case TargetLowering::Expand: - // Otherwise we need to spill the constant to memory. - bool Extend = false; - - // If a FP immediate is precise when represented as a float and if the - // target can do an extending load from float to double, we put it into - // the constant pool as a float, even if it's is statically typed as a - // double. - MVT::ValueType VT = CFP->getValueType(0); - bool isDouble = VT == MVT::f64; - ConstantFP *LLVMC = ConstantFP::get(isDouble ? Type::DoubleTy : - Type::FloatTy, CFP->getValue()); - if (isDouble && CFP->isExactlyValue((float)CFP->getValue()) && - // Only do this if the target has a native EXTLOAD instruction from - // f32. - TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) { - LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC,Type::FloatTy)); - VT = MVT::f32; - Extend = true; - } - - SDOperand CPIdx = DAG.getConstantPool(LLVMC, TLI.getPointerTy()); - if (Extend) { - Result = DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, DAG.getEntryNode(), - CPIdx, NULL, 0, MVT::f32); - } else { - Result = DAG.getLoad(VT, DAG.getEntryNode(), CPIdx, NULL, 0); - } + Result = ExpandConstantFP(CFP, DAG, TLI); } break; } @@ -4398,6 +4403,12 @@ Hi = DAG.getConstant(Cst >> MVT::getSizeInBits(NVT), NVT); break; } + case ISD::ConstantFP: { + ConstantFPSDNode *CFP = cast(Node); + SDOperand Tmp = ExpandConstantFP(CFP, DAG, TLI); + ExpandOp(Tmp, Lo, Hi); + break; + } case ISD::BUILD_PAIR: // Return the operands. Lo = Node->getOperand(0); @@ -4484,6 +4495,12 @@ if (ExtType == ISD::NON_EXTLOAD) { Lo = DAG.getLoad(NVT, Ch, Ptr, LD->getSrcValue(), LD->getSrcValueOffset()); + if (VT == MVT::f32 || VT == MVT::f64) { + // f32->i32 or f64->i64 one to one expansion. + // Remember that we legalized the chain. + AddLegalizedOperand(SDOperand(Node, 1), LegalizeOp(Lo.getValue(1))); + break; + } // Increment the pointer to the other half. unsigned IncrementSize = MVT::getSizeInBits(Lo.getValueType())/8; From evan.cheng at apple.com Tue Dec 12 15:51:32 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 12 Dec 2006 15:51:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612122151.kBCLpWGs005994@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.434 -> 1.435 --- Log message: Soft fp FNEG, SINT_TO_FP, UINT_TO_FP libcall expansion. --- Diffs of the changes: (+20 -1) LegalizeDAG.cpp | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.434 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.435 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.434 Tue Dec 12 15:32:44 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 12 15:51:17 2006 @@ -4902,7 +4902,10 @@ case ISD::UDIV: Lo = ExpandLibCall("__udivdi3", Node, Hi); break; case ISD::SREM: Lo = ExpandLibCall("__moddi3" , Node, Hi); break; case ISD::UREM: Lo = ExpandLibCall("__umoddi3", Node, Hi); break; - + + case ISD::FNEG: + Lo = ExpandLibCall(((VT == MVT::f32) ? "__negsf2" : "__negdf2"), Node, Hi); + break; case ISD::FADD: Lo = ExpandLibCall(((VT == MVT::f32) ? "__addsf3" : "__adddf3"), Node, Hi); break; @@ -4921,6 +4924,22 @@ case ISD::FP_ROUND: Lo = ExpandLibCall("__truncdfsf2", Node, Hi); break; + case ISD::SINT_TO_FP: + if (Node->getOperand(0).getValueType() == MVT::i64) + Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatdisf" : "__floatdidf"), + Node, Hi); + else + Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatsisf" : "__floatsidf"), + Node, Hi); + break; + case ISD::UINT_TO_FP: + if (Node->getOperand(0).getValueType() == MVT::i64) + Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatundisf" : "__floatundidf"), + Node, Hi); + else + Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatunsisf" : "__floatunsidf"), + Node, Hi); + break; } // Make sure the resultant values have been legalized themselves, unless this From dpatel at apple.com Tue Dec 12 16:02:31 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 16:02:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122202.kBCM2VB8006192@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.75 -> 1.76 --- Log message: Set top level manager. --- Diffs of the changes: (+10 -1) PassManager.cpp | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.75 llvm/lib/VMCore/PassManager.cpp:1.76 --- llvm/lib/VMCore/PassManager.cpp:1.75 Fri Dec 8 19:11:34 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:02:16 2006 @@ -333,7 +333,6 @@ std::vector ForcedLastUses; // Top level manager. - // TODO : Make it a reference. PMTopLevelManager *TPM; private: @@ -814,6 +813,8 @@ FunctionPassManager_New::FunctionPassManager_New(ModuleProvider *P) { FPM = new FunctionPassManagerImpl_New(0); + // FPM is the top level manager. + FPM->setTopLevelManager(FPM); MP = P; } @@ -880,6 +881,8 @@ // Create and add new manager activeBBPassManager = new BasicBlockPassManager_New(getDepth() + 1); + // Inherit top level manager + activeBBPassManager->setTopLevelManager(this->getTopLevelManager()); addPassToManager(activeBBPassManager, false); TPM->addOtherPassManager(activeBBPassManager); @@ -1013,6 +1016,8 @@ activeFunctionPassManager = new FunctionPassManagerImpl_New(getDepth() + 1); addPassToManager(activeFunctionPassManager, false); + // Inherit top level manager + activeFunctionPassManager->setTopLevelManager(this->getTopLevelManager()); TPM->addOtherPassManager(activeFunctionPassManager); // Add pass into new manager. This time it must succeed. @@ -1077,6 +1082,8 @@ if (!activeManager || !activeManager->addPass(P)) { activeManager = new ModulePassManager_New(getDepth() + 1); + // Inherit top level manager + activeManager->setTopLevelManager(this->getTopLevelManager()); // This top level manager is going to manage activeManager. // Set up analysis resolver to connect them. @@ -1108,6 +1115,8 @@ /// Create new pass manager PassManager_New::PassManager_New() { PM = new PassManagerImpl_New(0); + // PM is the top level manager + PM->setTopLevelManager(PM); } /// add - Add a pass to the queue of passes to run. This passes ownership of From evan.cheng at apple.com Tue Dec 12 16:19:43 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 12 Dec 2006 16:19:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612122219.kBCMJh1I006494@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.435 -> 1.436 --- Log message: Expand FP constant to integers if FP types are not legal. --- Diffs of the changes: (+13 -7) LegalizeDAG.cpp | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.435 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.436 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.435 Tue Dec 12 15:51:17 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 12 16:19:28 2006 @@ -488,10 +488,10 @@ } } -/// ExpandConstantFP - Expands the ConstantFP node by spilling the constant to -/// memory. -static SDOperand ExpandConstantFP(ConstantFPSDNode *CFP, SelectionDAG &DAG, - TargetLowering &TLI) { +/// ExpandConstantFP - Expands the ConstantFP node by either converting it to +/// integer constant or spilling the constant to memory. +static SDOperand ExpandConstantFP(ConstantFPSDNode *CFP, bool ToMem, + SelectionDAG &DAG, TargetLowering &TLI) { bool Extend = false; // If a FP immediate is precise when represented as a float and if the @@ -502,6 +502,13 @@ bool isDouble = VT == MVT::f64; ConstantFP *LLVMC = ConstantFP::get(isDouble ? Type::DoubleTy : Type::FloatTy, CFP->getValue()); + if (!ToMem) { + double Val = LLVMC->getValue(); + return isDouble + ? DAG.getConstant(DoubleToBits(Val), MVT::i64) + : DAG.getConstant(FloatToBits(Val), MVT::i32); + } + if (isDouble && CFP->isExactlyValue((float)CFP->getValue()) && // Only do this if the target has a native EXTLOAD instruction from f32. TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) { @@ -806,7 +813,7 @@ } // FALLTHROUGH case TargetLowering::Expand: - Result = ExpandConstantFP(CFP, DAG, TLI); + Result = ExpandConstantFP(CFP, true, DAG, TLI); } break; } @@ -4405,8 +4412,7 @@ } case ISD::ConstantFP: { ConstantFPSDNode *CFP = cast(Node); - SDOperand Tmp = ExpandConstantFP(CFP, DAG, TLI); - ExpandOp(Tmp, Lo, Hi); + Lo = ExpandConstantFP(CFP, false, DAG, TLI); break; } case ISD::BUILD_PAIR: From dpatel at apple.com Tue Dec 12 16:21:52 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 16:21:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122221.kBCMLq4g006550@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.76 -> 1.77 --- Log message: Initialize AnalysisImpls for ImmutablePass. --- Diffs of the changes: (+4 -1) PassManager.cpp | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.76 llvm/lib/VMCore/PassManager.cpp:1.77 --- llvm/lib/VMCore/PassManager.cpp:1.76 Tue Dec 12 16:02:16 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:21:37 2006 @@ -399,7 +399,9 @@ // top level manager. Set up analysis resolver to connect them. AnalysisResolver_New *AR = new AnalysisResolver_New(*this); P->setResolver(AR); + initializeAnalysisImpl(P); addImmutablePass(IP); + recordAvailableAnalysis(IP); } else addPass(P); @@ -504,7 +506,9 @@ // top level manager. Set up analysis resolver to connect them. AnalysisResolver_New *AR = new AnalysisResolver_New(*this); P->setResolver(AR); + initializeAnalysisImpl(P); addImmutablePass(IP); + recordAvailableAnalysis(IP); } else addPass(P); @@ -634,7 +638,6 @@ // Take a note of analysis required and made available by this pass. // Remove the analysis not preserved by this pass - initializeAnalysisImpl(P); removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); } From dpatel at apple.com Tue Dec 12 16:35:40 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 16:35:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122235.kBCMZe9W006771@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.77 -> 1.78 --- Log message: o s/OtherPassManagers/IndirectPassManagers o Make IndirectPassManagers vector of PMDataManager * o Move PMTopLevelManager implementation below all class declarations. --- Diffs of the changes: (+113 -95) PassManager.cpp | 208 ++++++++++++++++++++++++++++++-------------------------- 1 files changed, 113 insertions(+), 95 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.77 llvm/lib/VMCore/PassManager.cpp:1.78 --- llvm/lib/VMCore/PassManager.cpp:1.77 Tue Dec 12 16:21:37 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:35:25 2006 @@ -86,6 +86,8 @@ namespace llvm { +class PMDataManager; + //===----------------------------------------------------------------------===// // PMTopLevelManager // @@ -143,8 +145,8 @@ // Add Manager into the list of managers that are not directly // maintained by this top level pass manager - void addOtherPassManager(Pass *Manager) { - OtherPassManagers.push_back(Manager); + inline void addIndirectPassManager(PMDataManager *Manager) { + IndirectPassManagers.push_back(Manager); } private: @@ -154,7 +156,7 @@ /// Collection of pass managers that are not directly maintained /// by this pass manager - std::vector OtherPassManagers; + std::vector IndirectPassManagers; // Map to keep track of last user of the analysis pass. // LastUser->second is the last user of Lastuser->first. @@ -164,96 +166,6 @@ std::vector ImmutablePasses; }; -/// Set pass P as the last user of the given analysis passes. -void PMTopLevelManager::setLastUser(std::vector &AnalysisPasses, - Pass *P) { - - for (std::vector::iterator I = AnalysisPasses.begin(), - E = AnalysisPasses.end(); I != E; ++I) { - Pass *AP = *I; - LastUser[AP] = P; - // If AP is the last user of other passes then make P last user of - // such passes. - for (std::map::iterator LUI = LastUser.begin(), - LUE = LastUser.end(); LUI != LUE; ++LUI) { - if (LUI->second == AP) - LastUser[LUI->first] = P; - } - } - -} - -/// Collect passes whose last user is P -void PMTopLevelManager::collectLastUses(std::vector &LastUses, - Pass *P) { - for (std::map::iterator LUI = LastUser.begin(), - LUE = LastUser.end(); LUI != LUE; ++LUI) - if (LUI->second == P) - LastUses.push_back(LUI->first); -} - -/// Schedule pass P for execution. Make sure that passes required by -/// P are run before P is run. Update analysis info maintained by -/// the manager. Remove dead passes. This is a recursive function. -void PMTopLevelManager::schedulePass(Pass *P) { - - // TODO : Allocate function manager for this pass, other wise required set - // may be inserted into previous function manager - - AnalysisUsage AnUsage; - P->getAnalysisUsage(AnUsage); - const std::vector &RequiredSet = AnUsage.getRequiredSet(); - for (std::vector::const_iterator I = RequiredSet.begin(), - E = RequiredSet.end(); I != E; ++I) { - - Pass *AnalysisPass = findAnalysisPass(*I); - if (!AnalysisPass) { - // Schedule this analysis run first. - AnalysisPass = (*I)->createPass(); - schedulePass(AnalysisPass); - } - } - - // Now all required passes are available. - addTopLevelPass(P); -} - -/// Find the pass that implements Analysis AID. Search immutable -/// passes and all pass managers. If desired pass is not found -/// then return NULL. -Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) { - - Pass *P = NULL; - for (std::vector::iterator I = ImmutablePasses.begin(), - E = ImmutablePasses.end(); P == NULL && I != E; ++I) { - const PassInfo *PI = (*I)->getPassInfo(); - if (PI == AID) - P = *I; - - // If Pass not found then check the interfaces implemented by Immutable Pass - if (!P) { - const std::vector &ImmPI = - PI->getInterfacesImplemented(); - for (unsigned Index = 0, End = ImmPI.size(); - P == NULL && Index != End; ++Index) - if (ImmPI[Index] == AID) - P = *I; - } - } - - // Check pass managers - for (std::vector::iterator I = PassManagers.begin(), - E = PassManagers.end(); P == NULL && I != E; ++I) - P = (*I)->getResolver()->getAnalysisToUpdate(AID, false); - - // Check other pass managers - for (std::vector::iterator I = OtherPassManagers.begin(), - E = OtherPassManagers.end(); P == NULL && I != E; ++I) - P = (*I)->getResolver()->getAnalysisToUpdate(AID, false); - - return P; -} - //===----------------------------------------------------------------------===// // PMDataManager @@ -526,6 +438,99 @@ } // End of llvm namespace //===----------------------------------------------------------------------===// +// PMTopLevelManager implementation + +/// Set pass P as the last user of the given analysis passes. +void PMTopLevelManager::setLastUser(std::vector &AnalysisPasses, + Pass *P) { + + for (std::vector::iterator I = AnalysisPasses.begin(), + E = AnalysisPasses.end(); I != E; ++I) { + Pass *AP = *I; + LastUser[AP] = P; + // If AP is the last user of other passes then make P last user of + // such passes. + for (std::map::iterator LUI = LastUser.begin(), + LUE = LastUser.end(); LUI != LUE; ++LUI) { + if (LUI->second == AP) + LastUser[LUI->first] = P; + } + } + +} + +/// Collect passes whose last user is P +void PMTopLevelManager::collectLastUses(std::vector &LastUses, + Pass *P) { + for (std::map::iterator LUI = LastUser.begin(), + LUE = LastUser.end(); LUI != LUE; ++LUI) + if (LUI->second == P) + LastUses.push_back(LUI->first); +} + +/// Schedule pass P for execution. Make sure that passes required by +/// P are run before P is run. Update analysis info maintained by +/// the manager. Remove dead passes. This is a recursive function. +void PMTopLevelManager::schedulePass(Pass *P) { + + // TODO : Allocate function manager for this pass, other wise required set + // may be inserted into previous function manager + + AnalysisUsage AnUsage; + P->getAnalysisUsage(AnUsage); + const std::vector &RequiredSet = AnUsage.getRequiredSet(); + for (std::vector::const_iterator I = RequiredSet.begin(), + E = RequiredSet.end(); I != E; ++I) { + + Pass *AnalysisPass = findAnalysisPass(*I); + if (!AnalysisPass) { + // Schedule this analysis run first. + AnalysisPass = (*I)->createPass(); + schedulePass(AnalysisPass); + } + } + + // Now all required passes are available. + addTopLevelPass(P); +} + +/// Find the pass that implements Analysis AID. Search immutable +/// passes and all pass managers. If desired pass is not found +/// then return NULL. +Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) { + + Pass *P = NULL; + for (std::vector::iterator I = ImmutablePasses.begin(), + E = ImmutablePasses.end(); P == NULL && I != E; ++I) { + const PassInfo *PI = (*I)->getPassInfo(); + if (PI == AID) + P = *I; + + // If Pass not found then check the interfaces implemented by Immutable Pass + if (!P) { + const std::vector &ImmPI = + PI->getInterfacesImplemented(); + for (unsigned Index = 0, End = ImmPI.size(); + P == NULL && Index != End; ++Index) + if (ImmPI[Index] == AID) + P = *I; + } + } + + // Check pass managers + for (std::vector::iterator I = PassManagers.begin(), + E = PassManagers.end(); P == NULL && I != E; ++I) + P = (*I)->getResolver()->getAnalysisToUpdate(AID, false); + + // Check other pass managers + for (std::vector::iterator I = IndirectPassManagers.begin(), + E = IndirectPassManagers.end(); P == NULL && I != E; ++I) + P = (*I)->findAnalysisPass(AID, false); + + return P; +} + +//===----------------------------------------------------------------------===// // PMDataManager implementation /// Return true IFF pass P's required analysis set does not required new @@ -886,8 +891,14 @@ new BasicBlockPassManager_New(getDepth() + 1); // Inherit top level manager activeBBPassManager->setTopLevelManager(this->getTopLevelManager()); + + // Add new manager into current manager's list. addPassToManager(activeBBPassManager, false); - TPM->addOtherPassManager(activeBBPassManager); + + // Add new manager into top level manager's indirect passes list + PMDataManager *PMD = dynamic_cast(activeBBPassManager); + assert (PMD && "Manager is not Pass Manager"); + TPM->addIndirectPassManager(PMD); // Add pass into new manager. This time it must succeed. if (!activeBBPassManager->addPass(BP)) @@ -1018,10 +1029,17 @@ // Create and add new manager activeFunctionPassManager = new FunctionPassManagerImpl_New(getDepth() + 1); + + // Add new manager into current manager's list addPassToManager(activeFunctionPassManager, false); + // Inherit top level manager activeFunctionPassManager->setTopLevelManager(this->getTopLevelManager()); - TPM->addOtherPassManager(activeFunctionPassManager); + + // Add new manager into top level manager's indirect passes list + PMDataManager *PMD = dynamic_cast(activeFunctionPassManager); + assert (PMD && "Manager is not Pass Manager"); + TPM->addIndirectPassManager(PMD); // Add pass into new manager. This time it must succeed. if (!activeFunctionPassManager->addPass(FP)) From criswell at cs.uiuc.edu Tue Dec 12 16:43:06 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 12 Dec 2006 16:43:06 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/include/dsa/DSGraph.h DSNode.h DataStructure.h Message-ID: <200612122243.QAA12640@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/include/dsa: DSGraph.h updated: 1.110 -> 1.110.2.1 DSNode.h updated: 1.58 -> 1.58.2.1 DataStructure.h updated: 1.98 -> 1.98.2.1 --- Log message: Adjusted DSA to build within the llvm-poolalloc project. Merged in the pool inference code. --- Diffs of the changes: (+111 -7) DSGraph.h | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- DSNode.h | 9 ++++- DataStructure.h | 9 ++++- 3 files changed, 111 insertions(+), 7 deletions(-) Index: llvm-poolalloc/include/dsa/DSGraph.h diff -u llvm-poolalloc/include/dsa/DSGraph.h:1.110 llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.1 --- llvm-poolalloc/include/dsa/DSGraph.h:1.110 Wed Feb 22 10:23:42 2006 +++ llvm-poolalloc/include/dsa/DSGraph.h Tue Dec 12 16:42:37 2006 @@ -19,9 +19,13 @@ #include "llvm/ADT/hash_map" #include "llvm/ADT/EquivalenceClasses.h" #include - +#include +#include +#define LLVA_KERNEL 1 namespace llvm { + //typedef map PoolDescriptorMapType; + class GlobalValue; //===----------------------------------------------------------------------===// @@ -170,6 +174,62 @@ }; +#ifdef LLVA_KERNEL +class MetaPool; +class MetaPoolHandle { + MetaPool *Rep; + Instruction * Creator; +public: + MetaPoolHandle(MetaPool *mp, Instruction * Maker = 0); + + MetaPool *getMetaPool() { + return Rep; + } + void setMetaPool(MetaPool *v) { + Rep = v; + } + ~MetaPoolHandle() { + //do nothing for now + } + const std::string &getName(); + Value *getMetaPoolValue(); + void merge(MetaPoolHandle *other); +}; + + class MetaPool { + Value *MPD; + hash_set HandleSet; + + public: + MetaPool(Value *mpd) : MPD(mpd) { + } + void addMetaPoolHandles(hash_set & mpHS) { + HandleSet.insert(mpHS.begin(), mpHS.end()); + } + hash_set& getHandleSet() { + return HandleSet; + } + Value * getMetaPoolValue() { + return MPD; + } + void setMetaPoolValue(Value *V) { + MPD = V; + } + void insert(MetaPoolHandle *mph) { + HandleSet.insert(mph); + } + const std::string& getName() { + return MPD->getName(); + } + ~MetaPool() { + HandleSet.clear(); + } + }; + +#endif + + + //===----------------------------------------------------------------------===// /// DSGraph - The graph that represents a function. /// @@ -219,13 +279,18 @@ /// constructed for. const TargetData &TD; +#ifdef LLVA_KERNEL + hash_map PoolDescriptors; +#endif + + + void operator=(const DSGraph &); // DO NOT IMPLEMENT DSGraph(const DSGraph&); // DO NOT IMPLEMENT public: // Create a new, empty, DSGraph. DSGraph(EquivalenceClasses &ECs, const TargetData &td) - : GlobalsGraph(0), PrintAuxCalls(false), ScalarMap(ECs), TD(td) {} - + : GlobalsGraph(0), PrintAuxCalls(false), ScalarMap(ECs), TD(td) { } // Compute the local DSGraph DSGraph(EquivalenceClasses &ECs, const TargetData &TD, Function &F, DSGraph *GlobalsGraph); @@ -238,13 +303,38 @@ // source. You need to set a new GlobalsGraph with the setGlobalsGraph // method. // - DSGraph(const DSGraph &DSG, EquivalenceClasses &ECs, + DSGraph( DSGraph &DSG, EquivalenceClasses &ECs, unsigned CloneFlags = 0); ~DSGraph(); DSGraph *getGlobalsGraph() const { return GlobalsGraph; } void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; } +#ifdef LLVA_KERNEL +#if 1 + hash_map& getPoolDescriptorsMap() { + return PoolDescriptors; + } + MetaPoolHandle *getPoolForNode(const DSNode *N) { + if (PoolDescriptors.count(N) > 0) { + return PoolDescriptors[N]; + } + return 0; + } +#else + hash_map& getPoolDescriptorsMap() { + return PoolDescriptors; + } + MetaPoolHandle *getPoolForNode(const DSNodeHandle *N) { + if (PoolDescriptors.count(N) > 0) { + return PoolDescriptors[N]; + } + return 0; + } +#endif + +#endif + /// getGlobalECs - Return the set of equivalence classes that the global /// variables in the program form. EquivalenceClasses &getGlobalECs() const { @@ -469,7 +559,7 @@ /// /// The CloneFlags member controls various aspects of the cloning process. /// - void cloneInto(const DSGraph &G, unsigned CloneFlags = 0); + void cloneInto(DSGraph &G, unsigned CloneFlags = 0); /// getFunctionArgumentsForCall - Given a function that is currently in this /// graph, return the DSNodeHandles that correspond to the pointer-compatible Index: llvm-poolalloc/include/dsa/DSNode.h diff -u llvm-poolalloc/include/dsa/DSNode.h:1.58 llvm-poolalloc/include/dsa/DSNode.h:1.58.2.1 --- llvm-poolalloc/include/dsa/DSNode.h:1.58 Fri May 19 14:07:54 2006 +++ llvm-poolalloc/include/dsa/DSNode.h Tue Dec 12 16:42:37 2006 @@ -91,8 +91,9 @@ Read = 1 << 6, // This node is read in this context Array = 1 << 7, // This node is treated like an array + External = 1 << 8, // This node comes from an external source //#ifndef NDEBUG - DEAD = 1 << 8, // This node is dead and should not be pointed to + DEAD = 1 << 9, // This node is dead and should not be pointed to //#endif Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode @@ -118,10 +119,14 @@ /// DSNode(const DSNode &, DSGraph *G, bool NullLinks = false); +#if 0 ~DSNode() { dropAllReferences(); assert(hasNoReferrers() && "Referrers to dead node exist!"); } +#else + ~DSNode(); +#endif // Iterator for graph interface... Defined in DSGraphTraits.h typedef DSNodeIterator iterator; @@ -340,12 +345,14 @@ bool isIncomplete() const { return NodeType & Incomplete; } bool isComplete() const { return !isIncomplete(); } bool isDeadNode() const { return NodeType & DEAD; } + bool isExternalNode() const { return NodeType & External; } DSNode *setAllocaNodeMarker() { NodeType |= AllocaNode; return this; } DSNode *setHeapNodeMarker() { NodeType |= HeapNode; return this; } DSNode *setGlobalNodeMarker() { NodeType |= GlobalNode; return this; } DSNode *setUnknownNodeMarker() { NodeType |= UnknownNode; return this; } + DSNode *setExternalMarker() { NodeType |= External; return this; } DSNode *setIncompleteMarker() { NodeType |= Incomplete; return this; } DSNode *setModifiedMarker() { NodeType |= Modified; return this; } DSNode *setReadMarker() { NodeType |= Read; return this; } Index: llvm-poolalloc/include/dsa/DataStructure.h diff -u llvm-poolalloc/include/dsa/DataStructure.h:1.98 llvm-poolalloc/include/dsa/DataStructure.h:1.98.2.1 --- llvm-poolalloc/include/dsa/DataStructure.h:1.98 Mon Oct 23 14:52:54 2006 +++ llvm-poolalloc/include/dsa/DataStructure.h Tue Dec 12 16:42:37 2006 @@ -21,6 +21,8 @@ #include "llvm/ADT/hash_set" #include "llvm/ADT/EquivalenceClasses.h" + + namespace llvm { class Type; @@ -30,10 +32,12 @@ class DSCallSite; class DSNode; class DSNodeHandle; +typedef std::map PoolDescriptorMapType; FunctionPass *createDataStructureStatsPass(); FunctionPass *createDataStructureGraphCheckerPass(); +#define LLVA_KERNEL 1 // FIXME: move this stuff to a private header namespace DataStructureAnalysis { @@ -43,7 +47,6 @@ bool isPointerType(const Type *Ty); } - // LocalDataStructures - The analysis that computes the local data structure // graphs for all of the functions in the program. // @@ -55,6 +58,10 @@ hash_map DSInfo; DSGraph *GlobalsGraph; +#ifdef LLVA_KERNEL + Function *AddPoolDescToMetaPool; +#endif + /// GlobalECs - The equivalence classes for each global value that is merged /// with other global values in the DSGraphs. EquivalenceClasses GlobalECs; From criswell at cs.uiuc.edu Tue Dec 12 16:43:06 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 12 Dec 2006 16:43:06 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/lib/DSA/BottomUpClosure.cpp CallTargets.cpp CompleteBottomUp.cpp DataStructure.cpp DataStructureAA.cpp DataStructureOpt.cpp DataStructureStats.cpp EquivClassGraphs.cpp GraphChecker.cpp Local.cpp Makefile Printer.cpp Steensgaard.cpp TopDownClosure.cpp Message-ID: <200612122243.QAA12664@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/DSA: BottomUpClosure.cpp updated: 1.123 -> 1.123.2.1 CallTargets.cpp updated: 1.4 -> 1.4.2.1 CompleteBottomUp.cpp updated: 1.37 -> 1.37.2.1 DataStructure.cpp updated: 1.248 -> 1.248.2.1 DataStructureAA.cpp updated: 1.40 -> 1.40.2.1 DataStructureOpt.cpp updated: 1.13 -> 1.13.2.1 DataStructureStats.cpp updated: 1.21 -> 1.21.2.1 EquivClassGraphs.cpp updated: 1.49 -> 1.49.2.1 GraphChecker.cpp updated: 1.21 -> 1.21.2.1 Local.cpp updated: 1.158 -> 1.158.2.1 Makefile updated: 1.5 -> 1.5.2.1 Printer.cpp updated: 1.86 -> 1.86.2.1 Steensgaard.cpp updated: 1.65 -> 1.65.2.1 TopDownClosure.cpp updated: 1.92 -> 1.92.2.1 --- Log message: Adjusted DSA to build within the llvm-poolalloc project. Merged in the pool inference code. --- Diffs of the changes: (+701 -61) BottomUpClosure.cpp | 12 - CallTargets.cpp | 6 CompleteBottomUp.cpp | 4 DataStructure.cpp | 247 ++++++++++++++++++++++++++ DataStructureAA.cpp | 4 DataStructureOpt.cpp | 4 DataStructureStats.cpp | 4 EquivClassGraphs.cpp | 4 GraphChecker.cpp | 4 Local.cpp | 453 ++++++++++++++++++++++++++++++++++++++++++++++--- Makefile | 4 Printer.cpp | 6 Steensgaard.cpp | 5 TopDownClosure.cpp | 5 14 files changed, 701 insertions(+), 61 deletions(-) Index: llvm-poolalloc/lib/DSA/BottomUpClosure.cpp diff -u llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.123 llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.123.2.1 --- llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.123 Mon Oct 23 14:55:24 2006 +++ llvm-poolalloc/lib/DSA/BottomUpClosure.cpp Tue Dec 12 16:42:41 2006 @@ -14,8 +14,8 @@ // //===----------------------------------------------------------------------===// #define DEBUG_TYPE "bu_dsa" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "llvm/ADT/Statistic.h" @@ -590,11 +590,11 @@ ++NumBUInlines; } else { if (!Printed) - std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; - std::cerr << " calls " << CalledFuncs.size() + DEBUG(std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"); + DEBUG(std::cerr << " calls " << CalledFuncs.size() << " fns from site: " << CS.getCallSite().getInstruction() - << " " << *CS.getCallSite().getInstruction(); - std::cerr << " Fns ="; + << " " << *CS.getCallSite().getInstruction()); + DEBUG(std::cerr << " Fns ="); unsigned NumPrinted = 0; for (std::vector::iterator I = CalledFuncs.begin(), Index: llvm-poolalloc/lib/DSA/CallTargets.cpp diff -u llvm-poolalloc/lib/DSA/CallTargets.cpp:1.4 llvm-poolalloc/lib/DSA/CallTargets.cpp:1.4.2.1 --- llvm-poolalloc/lib/DSA/CallTargets.cpp:1.4 Sun Aug 27 17:31:12 2006 +++ llvm-poolalloc/lib/DSA/CallTargets.cpp Tue Dec 12 16:42:41 2006 @@ -19,9 +19,9 @@ #include "llvm/Module.h" #include "llvm/Instructions.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Analysis/DataStructure/CallTargets.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" +#include "dsa/CallTargets.h" #include "llvm/ADT/Statistic.h" #include #include "llvm/Constants.h" Index: llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp diff -u llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.37 llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.37.2.1 --- llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.37 Fri Oct 13 12:38:22 2006 +++ llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp Tue Dec 12 16:42:41 2006 @@ -14,9 +14,9 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "cbudatastructure" -#include "llvm/Analysis/DataStructure/DataStructure.h" +#include "dsa/DataStructure.h" #include "llvm/Module.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DSGraph.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/Statistic.h" Index: llvm-poolalloc/lib/DSA/DataStructure.cpp diff -u llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248 llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.1 --- llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248 Thu Nov 2 14:25:49 2006 +++ llvm-poolalloc/lib/DSA/DataStructure.cpp Tue Dec 12 16:42:42 2006 @@ -1,3 +1,4 @@ +#define JTC 0 //===- DataStructure.cpp - Implement the core data structure analysis -----===// // // The LLVM Compiler Infrastructure @@ -11,7 +12,9 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DSGraphTraits.h" +#include "dsa/DSGraphTraits.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Constants.h" #include "llvm/Function.h" #include "llvm/GlobalVariable.h" @@ -26,12 +29,13 @@ #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Timer.h" +#include "llvm/ADT/hash_map" #include #include using namespace llvm; #define COLLAPSE_ARRAYS_AGGRESSIVELY 0 - +#define LLVA_KERNEL 1 namespace { Statistic<> NumFolds ("dsa", "Number of nodes completely folded"); Statistic<> NumCallNodesMerged("dsa", "Number of call nodes merged"); @@ -39,6 +43,9 @@ Statistic<> NumDNE ("dsa", "Number of nodes removed by reachability"); Statistic<> NumTrivialDNE ("dsa", "Number of nodes trivially removed"); Statistic<> NumTrivialGlobalDNE("dsa", "Number of globals trivially removed"); +#ifdef LLVA_KERNEL + Statistic<> LostPools ("dsa", "Number of pools lost to DSNode Merge"); +#endif static cl::opt DSAFieldLimit("dsa-field-limit", cl::Hidden, cl::desc("Number of fields to track before collapsing a node"), @@ -119,6 +126,9 @@ if (T) mergeTypeInfo(T, 0); if (G) G->addNode(this); ++NumNodeAllocated; +#if JTC +std::cerr << "LLVA: Creating (1) DSNode " << this << "\n"; +#endif } // DSNode copy constructor... do not copy over the referrers list! @@ -131,6 +141,27 @@ Links.resize(N.Links.size()); // Create the appropriate number of null links G->addNode(this); ++NumNodeAllocated; +#if JTC +std::cerr << "LLVA: Creating (2) DSNode " << this << "\n"; +#endif +} + +DSNode::~DSNode() { + dropAllReferences(); + assert(hasNoReferrers() && "Referrers to dead node exist!"); + +#ifdef LLVA_KERNEL + // + // Remove all references to this node from the Pool Descriptor Map. + // +#if JTC + std::cerr << "LLVA: Removing " << this << "\n"; +#endif + if (ParentGraph) { + hash_map &pdm=ParentGraph->getPoolDescriptorsMap(); + pdm.erase (this); + } +#endif } /// getTargetData - Get the target data object used to construct this node. @@ -226,10 +257,26 @@ DestNode->Ty = Type::VoidTy; DestNode->Size = 1; DestNode->Globals.swap(Globals); + +#if JTC + std::cerr << "LLVA: foldNode: " << this << " becomes " << DestNode << "\n"; +#endif +#ifdef LLVA_KERNEL + //Again we have created a new DSNode, we need to fill in the + // pool desc map appropriately + assert(ParentGraph && "parent graph is not null \n"); + hash_map &pdm = ParentGraph->getPoolDescriptorsMap(); + if (pdm.count(this) > 0) { + pdm[DestNode] = pdm[this]; + } else { + //do nothing + } +#endif // Start forwarding to the destination node... forwardNode(DestNode, 0); + if (!Links.empty()) { DestNode->Links.reserve(1); @@ -819,7 +866,62 @@ } #endif } - +#ifdef LLVA_KERNEL + DSNode *currNode = CurNodeH.getNode(); + DSNode *NNode = NH.getNode(); + DSGraph *pGraph = currNode->getParentGraph(); + assert((pGraph == NNode->getParentGraph()) && "LLVA_KERNEL : merging nodes in two different graphs?"); + //get the pooldescriptor map + hash_map &pdm = pGraph->getPoolDescriptorsMap(); + if (pdm.count(currNode) == 0) { + if (pdm.count(NNode) == 0) { + //do nothing (common case) + } else { + if (pdm[NNode]) { +#if JTC + std::cerr << "LLVA: 1: currNode (" << currNode << ") becomes " << pdm[NNode]->getName() << "(" << NNode << ")\n"; +#endif + pdm[currNode] = pdm[NNode]; + } + } + } else { + if (pdm.count(NNode) == 0) { +#if 1 + // + // FIXME: + // Verify that this is correct. I believe it is; it seems to make sense + // since either node can be used after the merge. + // +#if JTC +std::cerr << "LLVA: MergeNodes: currnode has something, newnode has nothing\n"; + std::cerr << "LLVA: 2: currNode (" << currNode << ") becomes " << "(" << NNode << ")\n"; +#endif + pdm[NNode] = pdm[currNode]; +#endif + //do nothing + } else { + if (pdm[currNode] != pdm[NNode]) { + //The following is commented because pdm[..] could be null! + //std::cerr << "LLVA: OldPool: " << pdm[currNode]->getName() << "(" + // << pdm[currNode] << ") " + // << " NewPool: " << pdm[NNode]->getName() << "(" + // << pdm[NNode] << ")" << std::endl; + pdm[NNode]->merge(pdm[currNode]); + /* + Value *currN = pdm[currNode]->getMetaPoolValue(); + Value *NN = pdm[NNode]->getMetaPoolValue(); + if (currN != NN) { + std::cerr << "LLVA: Two Pools for one DSNode\n"; + currN->replaceAllUsesWith(NN); + pdm[currNode]->merge(pdm[NNode]); + } else { + //The nodes are same + } + */ + } + } + } +#endif // Merge the type entries of the two nodes together... if (NH.getNode()->Ty != Type::VoidTy) CurNodeH.getNode()->mergeTypeInfo(NH.getNode()->Ty, NOffset); @@ -898,6 +1000,9 @@ /// point to this node). /// void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) { +#if JTC +std::cerr << "LLVA: mergeWith: " << this << " becomes " << NH.getNode() << "\n"; +#endif DSNode *N = NH.getNode(); if (N == this && NH.getOffset() == Offset) return; // Noop @@ -978,6 +1083,21 @@ DSNode *DN = new DSNode(*SN, &Dest, true /* Null out all links */); DN->maskNodeTypes(BitsToKeep); NH = DN; +#if JTC +std::cerr << "LLVA: getClonedNH: " << SN << " becomes " << DN << "\n"; +#endif +#if 1 +#ifdef LLVA_KERNEL + //Again we have created a new DSNode, we need to fill in the + // pool desc map appropriately + hash_map &pdm = Dest.getPoolDescriptorsMap(); + if (pdm.count(SN) > 0) { + pdm[DN] = pdm[SN]; + } else { + //do nothing + } +#endif +#endif // Next, recursively clone all outgoing links as necessary. Note that // adding these links can cause the node to collapse itself at any time, and @@ -1136,7 +1256,58 @@ } } +#if JTC +std::cerr << "LLVA: mergeWith: " << SN << " becomes " << DN << "\n"; +#endif +#ifdef LLVA_KERNEL + //Here some merge is going on just like in DSNode::merge + //I think because of the inplace merging we don't update the pool desc maps + //This is modification from DSNode::MergeNodes + //Here DN and SN may belong to different graphs + DN = NH.getNode(); +#if 0 + DSGraph *destGraph = DN->getParentGraph(); + DSGraph *srcGraph = SN->getParentGraph(); +#else + DSGraph *destGraph = NH.getNode()->getParentGraph(); + DSGraph *srcGraph = SN->getParentGraph(); +#endif + if (destGraph && srcGraph) { + //get the pooldescriptor map + hash_map &destpdm = destGraph->getPoolDescriptorsMap(); + hash_map &srcpdm = srcGraph->getPoolDescriptorsMap(); + if (destpdm.count(DN) == 0) { + if (srcpdm.count(SN) == 0) { + //do nothing (common case) + } else { + if (srcpdm[SN]) { +#if JTC + std::cerr << "LLVA: DN becomes " << srcpdm[SN]->getName() << std::endl; +#endif + destpdm[DN] = srcpdm[SN]; + } + } + } else { + if (srcpdm.count(SN) == 0) { + srcpdm[SN] = destpdm[DN]; + } else { + if (destpdm[DN] != srcpdm[SN]) { + srcpdm[SN]->merge(destpdm[DN]); + /* + Value *dnv = destpdm[DN]->getMetaPoolValue(); + Value *snv = srcpdm[SN]->getMetaPoolValue(); + if (dnv != snv) { + DEBUG(std::cerr << "LLVA: Two Pools for one DSNode\n"); + dnv->replaceAllUsesWith(snv); + destpdm[DN]->setMetaPoolValue(snv); + } + */ + } + } + } + } +#endif // Next, recursively merge all outgoing links as necessary. Note that // adding these links can cause the destination node to collapse itself at // any time, and the current node may be merged with arbitrary other nodes. @@ -1205,6 +1376,53 @@ NH = RC.getClonedNH(Src); } +#ifdef LLVA_KERNEL +// MetaPoolHandle Implementation + //The following should go in a cpp file later + MetaPoolHandle::MetaPoolHandle(MetaPool *mp, Instruction * Maker) { + Rep = mp; + Rep->insert(this); + Creator = Maker; + } + const std::string& MetaPoolHandle::getName() { + assert(Rep != 0 && "Null meta pool ??\n"); + return Rep->getName(); + } + Value *MetaPoolHandle::getMetaPoolValue() { + assert(Rep != 0 && "Null meta pool ??\n"); + return Rep->getMetaPoolValue(); + } + void MetaPoolHandle::merge(MetaPoolHandle *other) { + //after this operation other points to what this points to . + //first replace all uses + Value *dest = getMetaPoolValue(); + Value *curr = other->getMetaPoolValue(); + if (dest != curr) { + std::cerr << "LLVA: Merging metapools: " << this->Creator->getParent()->getParent()->getName() << " : " << other->Creator->getParent()->getParent()->getName() << "\n" + << "LLVA: " << *(this->Creator) << "\n" + << "LLVA: " << *(other->Creator) << "\n"; + curr->replaceAllUsesWith(dest); + } + + //merge the hash sets in to other + hash_set &otherHandleSet = other->getMetaPool()->getHandleSet(); + hash_set::iterator ohsI = otherHandleSet.begin(), ohsE = otherHandleSet.end(); + for (; ohsI != ohsE; ++ohsI) { + MetaPoolHandle *omph = *ohsI; + //now make sure that this omph points to what we point to + omph->setMetaPool(Rep); + Rep->insert(omph); + } + + //now delete others MetaPool + //gd delete other->getMetaPool(); + + //Assign our metapool to other + other->setMetaPool(Rep); +} + +#endif + //===----------------------------------------------------------------------===// // DSGraph Implementation //===----------------------------------------------------------------------===// @@ -1226,7 +1444,7 @@ } -DSGraph::DSGraph(const DSGraph &G, EquivalenceClasses &ECs, +DSGraph::DSGraph(DSGraph &G, EquivalenceClasses &ECs, unsigned CloneFlags) : GlobalsGraph(0), ScalarMap(ECs), TD(G.TD) { PrintAuxCalls = false; @@ -1238,7 +1456,9 @@ AuxFunctionCalls.clear(); ScalarMap.clear(); ReturnNodes.clear(); - +#ifdef LLVA_KERNEL + PoolDescriptors.clear(); +#endif // Drop all intra-node references, so that assertions don't fail... for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) NI->dropAllReferences(); @@ -1296,7 +1516,7 @@ /// /// The CloneFlags member controls various aspects of the cloning process. /// -void DSGraph::cloneInto(const DSGraph &G, unsigned CloneFlags) { +void DSGraph::cloneInto( DSGraph &G, unsigned CloneFlags) { TIME_REGION(X, "cloneInto"); assert(&G != this && "Cannot clone graph into itself!"); @@ -1314,6 +1534,10 @@ DSNode *New = new DSNode(*I, this); New->maskNodeTypes(~BitsToClear); OldNodeMap[I] = New; +#ifdef LLVA_KERNEL + if (G.getPoolForNode(&*I)) + PoolDescriptors[New] = G.getPoolForNode(&*I); +#endif } #ifndef NDEBUG @@ -1391,6 +1615,17 @@ // Merge the scalar map in. ScalarMap.spliceFrom(RHS.ScalarMap); + +#ifdef LLVA_KERNEL + //Take all from the pooldescriptor map +#if 0 + PoolDescriptors.swap(RHS.getPoolDescriptorsMap()); +#else + hash_map& rhsmap = RHS.getPoolDescriptorsMap(); + PoolDescriptors.insert(rhsmap.begin(), rhsmap.end()); +#endif + RHS.getPoolDescriptorsMap().clear(); +#endif } /// spliceFrom - Copy all entries from RHS, then clear RHS. Index: llvm-poolalloc/lib/DSA/DataStructureAA.cpp diff -u llvm-poolalloc/lib/DSA/DataStructureAA.cpp:1.40 llvm-poolalloc/lib/DSA/DataStructureAA.cpp:1.40.2.1 --- llvm-poolalloc/lib/DSA/DataStructureAA.cpp:1.40 Sun Aug 27 19:42:29 2006 +++ llvm-poolalloc/lib/DSA/DataStructureAA.cpp Tue Dec 12 16:42:42 2006 @@ -17,8 +17,8 @@ #include "llvm/Module.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/Passes.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" using namespace llvm; namespace { Index: llvm-poolalloc/lib/DSA/DataStructureOpt.cpp diff -u llvm-poolalloc/lib/DSA/DataStructureOpt.cpp:1.13 llvm-poolalloc/lib/DSA/DataStructureOpt.cpp:1.13.2.1 --- llvm-poolalloc/lib/DSA/DataStructureOpt.cpp:1.13 Sun Aug 27 17:42:51 2006 +++ llvm-poolalloc/lib/DSA/DataStructureOpt.cpp Tue Dec 12 16:42:42 2006 @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Analysis/Passes.h" #include "llvm/Module.h" #include "llvm/Constant.h" Index: llvm-poolalloc/lib/DSA/DataStructureStats.cpp diff -u llvm-poolalloc/lib/DSA/DataStructureStats.cpp:1.21 llvm-poolalloc/lib/DSA/DataStructureStats.cpp:1.21.2.1 --- llvm-poolalloc/lib/DSA/DataStructureStats.cpp:1.21 Sun Aug 27 17:30:17 2006 +++ llvm-poolalloc/lib/DSA/DataStructureStats.cpp Tue Dec 12 16:42:42 2006 @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/Pass.h" Index: llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp diff -u llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp:1.49 llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp:1.49.2.1 --- llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp:1.49 Thu Nov 2 14:25:49 2006 +++ llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp Tue Dec 12 16:42:42 2006 @@ -15,11 +15,11 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "ECGraphs" -#include "llvm/Analysis/DataStructure/DataStructure.h" +#include "dsa/DataStructure.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/Pass.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DSGraph.h" #include "llvm/Support/CallSite.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/SCCIterator.h" Index: llvm-poolalloc/lib/DSA/GraphChecker.cpp diff -u llvm-poolalloc/lib/DSA/GraphChecker.cpp:1.21 llvm-poolalloc/lib/DSA/GraphChecker.cpp:1.21.2.1 --- llvm-poolalloc/lib/DSA/GraphChecker.cpp:1.21 Sun Aug 27 17:30:17 2006 +++ llvm-poolalloc/lib/DSA/GraphChecker.cpp Tue Dec 12 16:42:42 2006 @@ -23,8 +23,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Support/CommandLine.h" #include "llvm/Value.h" #include Index: llvm-poolalloc/lib/DSA/Local.cpp diff -u llvm-poolalloc/lib/DSA/Local.cpp:1.158 llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.1 --- llvm-poolalloc/lib/DSA/Local.cpp:1.158 Fri Nov 3 11:43:19 2006 +++ llvm-poolalloc/lib/DSA/Local.cpp Tue Dec 12 16:42:42 2006 @@ -1,3 +1,4 @@ +#define JTC 0 //===- Local.cpp - Compute a local data structure graph for a function ----===// // // The LLVM Compiler Infrastructure @@ -12,8 +13,10 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#define LLVA_KERNEL 1 +#include "llvm/ADT/Statistic.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" @@ -33,6 +36,12 @@ using namespace llvm; +#ifdef LLVA_KERNEL +static Statistic<> CacheAllocs ("dsa", "Number of kmem_cache_alloc calls"); +static Statistic<> KMallocs ("dsa", "Number of kmalloc calls"); +static Statistic<> GlobalPools ("dsa", "Number of global pools"); +#endif + static RegisterPass X("datastructure", "Local Data Structure Analysis"); @@ -87,27 +96,59 @@ DSNodeHandle *RetNode; // Node that gets returned... DSScalarMap &ScalarMap; std::list *FunctionCalls; - + Value * KMallocPool; public: GraphBuilder(Function &f, DSGraph &g, DSNodeHandle &retNode, std::list &fc) : G(g), RetNode(&retNode), ScalarMap(G.getScalarMap()), FunctionCalls(&fc) { - + // Find the type unsafe pool in the program + KMallocPool = f.getParent()->getNamedGlobal ("KmallocPool"); + +#if 1 + // + // Determine if the function somehow escapes + // + bool escapes = false; + if (!(f.hasInternalLinkage())) { + escapes = true; + } + Value::use_iterator U; + for (U=f.use_begin(); U != f.use_end(); ++U) { + if (isa(U)) { + std::cerr << "LLVA: isa: " << f.getName() << " " << *U << std::endl; + escapes = true; + break; + } + } +#endif // Create scalar nodes for all pointer arguments... for (Function::arg_iterator I = f.arg_begin(), E = f.arg_end(); - I != E; ++I) - if (isPointerType(I->getType())) - getValueDest(*I); + I != E; ++I) { + if (isPointerType(I->getType())) { + DSNode * Node = getValueDest(*I).getNode(); + if (!(f.hasInternalLinkage())) { + Node->setExternalMarker(); + } + } + } visit(f); // Single pass over the function +#if JTC +std::cerr << "LLVA: Function " << f.getName() << "\n"; + for (DSScalarMap::iterator I = ScalarMap.begin(), E=ScalarMap.end(); + I != E; + ++I) + { + std::cerr << "LLVA:\t" << I->first->getName() << ": " << (void *)(I->second.getNode()) << "\n"; + } +#endif } // GraphBuilder ctor for working on the globals graph GraphBuilder(DSGraph &g) : G(g), RetNode(0), ScalarMap(G.getScalarMap()), FunctionCalls(0) { } - void mergeInGlobalInitializer(GlobalVariable *GV); private: @@ -341,6 +382,24 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) { + +#if 1 + int debug = 0; + if (isa(GEP)) { + Instruction * IGEP = (Instruction *)(&GEP); + if (IGEP->getParent()->getParent()->getName() == "alloc_vfsmnt") + { +#if 0 + if (G.getPoolDescriptorsMap().count(N) != 0) + if (G.getPoolDescriptorsMap()[N]) + std::cerr << "LLVA: GEP[" << count << "]: Pool for " << GEP.getName() << " is " << G.getPoolDescriptorsMap()[N]->getMetaPoolValue()->getName() << "\n"; +#else + debug = 1; +#endif + } + } +#endif + DSNodeHandle Value = getValueDest(*GEP.getOperand(0)); if (Value.isNull()) Value = createNode(); @@ -360,6 +419,11 @@ if (AllZeros || (!Value.isNull() && Value.getNode()->isNodeCompletelyFolded())) { setDestTo(GEP, Value); +#if 0 +if (debug) std::cerr << "LLVA: GEP: All Zeros\n"; + if (G.getPoolDescriptorsMap()[Value.getNode()]) + std::cerr << "LLVA: GEP: Pool for " << GEP.getName() << " is " << G.getPoolDescriptorsMap()[Value.getNode()]->getName() << "\n"; +#endif return; } @@ -370,6 +434,8 @@ if (Value.getNode()->mergeTypeInfo(CurTy, Value.getOffset())) { // If the node had to be folded... exit quickly setDestTo(GEP, Value); // GEP result points to folded node + +if (debug) std::cerr << "LLVA: GEP: Funny Return\n"; return; } @@ -468,9 +534,23 @@ N->foldNodeCompletely(); } } - + // Value is now the pointer we want to GEP to be... setDestTo(GEP, Value); +#if 0 + if (debug && (isa(GEP))) { + Instruction * IGEP = (Instruction *)(&GEP); + DSNode * N = Value.getNode(); + if (IGEP->getParent()->getParent()->getName() == "alloc_vfsmnt") + { + if (G.getPoolDescriptorsMap().count(N) != 0) + if (G.getPoolDescriptorsMap()[N]) + std::cerr << "LLVA: GEP[" << 0 << "]: Pool for " << GEP.getName() << " is " << G.getPoolDescriptorsMap()[N]->getName() << "\n"; + } + } +#endif + +if (debug) std::cerr << "LLVA: GEP: Normal Return\n"; } void GraphBuilder::visitLoadInst(LoadInst &LI) { @@ -486,6 +566,10 @@ if (isPointerType(LI.getType())) setDestTo(LI, getLink(Ptr)); +#if 0 + if (G.getPoolDescriptorsMap()[getLink(Ptr).getNode()]) + std::cerr << "LLVA: Load: Pool for " << LI.getName() << " is " << G.getPoolDescriptorsMap()[getLink(Ptr).getNode()]->getName() << "\n"; +#endif } void GraphBuilder::visitStoreInst(StoreInst &SI) { @@ -502,6 +586,16 @@ // Avoid adding edges from null, or processing non-"pointer" stores if (isPointerType(StoredTy)) Dest.addEdgeTo(getValueDest(*SI.getOperand(0))); +#if 1 + { + if (SI.getParent()->getParent()->getName() == "alloc_vfsmnt") { + DSNode * N = getValueDest(*SI.getOperand(1)).getNode(); + if (G.getPoolDescriptorsMap().count(N) != 0) + if (G.getPoolDescriptorsMap()[N]) + std::cerr << "LLVA: Store: Pool for " << SI.getName() << " is " << G.getPoolDescriptorsMap()[N]->getName() << "\n"; + } + } +#endif } void GraphBuilder::visitReturnInst(ReturnInst &RI) { @@ -1000,7 +1094,155 @@ if (DSNode *N = getValueDest(**(CS.arg_begin() + 1)).getNode()) N->setReadMarker(); return true; +#ifdef LLVA_KERNEL_0 + } else if (F->getName() == "kmem_cache_alloc") { + DEBUG(std::cerr << "LLVA: kmem_cache_alloc" << std::endl); + // Update the statistics count + ++CacheAllocs; + + // Create a new DSNode for this memory allocation + DSNode *N = createNode(); + N->setHeapNodeMarker(); + setDestTo(*CS.getInstruction(), N); + + // Get the pool handle + if (CS.arg_begin() == CS.arg_end()) { + abort(); //Hanlde this later + // Treat it as a kmalloc + N->foldNodeCompletely(); + //This becomes a kmalloc pool + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(KMallocPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } else { + Value *actualPD = *(CS.arg_begin()); + if (!isa(actualPD)) { + std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n"; + } else { + ++GlobalPools; + } + Value *TheMetaPool = actualPD; + if (G.getPoolDescriptorsMap().count(N)== 0) { + //Here we insert a global meta pool + //Get the Module first + Module * M = F->getParent(); + //Now create a meta pool for this value, DSN Node + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + TheMetaPool = new GlobalVariable( + /*type=*/ VoidPtrType, + /*isConstant=*/ false, + /*Linkage=*/ GlobalValue::InternalLinkage, + /*initializer=*/ Constant::getNullValue(VoidPtrType), + /*name=*/ "_metaPool_", + /*parent=*/ M ); + //Inserted a global meta pool + } + //Now insert a function call that takes care of adding this pool to the global pool + + //First get the Insert point + Instruction *InsertPoint = CS.getInstruction(); + + //Assumes AddPoolDescToMetaPool is in the module + CastInst *CastMetaPool = + new CastInst(TheMetaPool, + PointerType::get(Type::SByteTy), "metapool.casted", InsertPoint); + CastInst *CastActualPD = + new CastInst(actualPD, + PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint); + + // Create the call to AddPoolDescToMetaPool + std::vector args(1,CastMetaPool); + args.push_back(CastActualPD); + new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint); + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } + } else if (F->getName() == "poolalloc") { + if (CS.getCaller()->getName() == "kmem_cache_alloc") + return; + // Update the statistics + ++KMallocs; + + // Create a DSNode for the memory allocated by this function call + DSNode *N = createNode(); + N->setHeapNodeMarker(); + setDestTo(*CS.getInstruction(), N); + + // Get the pool handle, if possible + if (CS.arg_begin() == CS.arg_end()) { + abort(); //handle later + // Treat it as kmalloc + N->foldNodeCompletely(); + //This becomes a kmalloc pool + //So get the kmalloc pool + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(KMallocPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } else { + Value *actualPD = *(CS.arg_begin()); + if (!isa(actualPD)) { + std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n"; + } else { + ++GlobalPools; + } + Value *TheMetaPool = actualPD; + if (G.getPoolDescriptorsMap().count(N)== 0) { + //Here we insert a global meta pool + //Get the Module first + Module * M = F->getParent(); + //Now create a meta pool for this value, DSN Node + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + TheMetaPool = new GlobalVariable( + /*type=*/ VoidPtrType, + /*isConstant=*/ false, + /*Linkage=*/ GlobalValue::InternalLinkage, + /*initializer=*/ Constant::getNullValue(VoidPtrType), + /*name=*/ "_metaPool_", + /*parent=*/ M ); + //Inserted a global meta pool + } + //Now insert a function call that takes care of adding this pool to the global pool + //First get the Insert point + Instruction *InsertPoint = CS.getInstruction(); + + //Assumes AddPoolDescToMetaPool is in the module + CastInst *CastMetaPool = + new CastInst(TheMetaPool, + PointerType::get(Type::SByteTy), "metapool.casted", InsertPoint); + CastInst *CastActualPD = + new CastInst(actualPD, + PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint); + + // Create the call to AddPoolDescToMetaPool + std::vector args(1,CastMetaPool); + args.push_back(CastActualPD); + new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint); + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } +#endif +#ifdef LLVA_KERNEL + } else if (F->getName() == "llva_memcpy") { + if (CS.getCaller()->getName() == "kmem_cache_alloc") + return false; + // Merge the first & second arguments, and mark the memory read and + // modified. + DSNodeHandle RetNH = getValueDest(**CS.arg_begin()); + RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1))); + if (DSNode *N = RetNH.getNode()) + N->setModifiedMarker()->setReadMarker(); + return true; + } else if (F->getName() == "__generic_copy_from_user") { + if (CS.getCaller()->getName() == "kmem_cache_alloc") + return false; + // Merge the first & second arguments, and mark the memory read and + // modified. + DSNodeHandle RetNH = getValueDest(**CS.arg_begin()); + RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1))); + if (DSNode *N = RetNH.getNode()) + N->setModifiedMarker()->setReadMarker(); + return true; +#endif } + return false; } @@ -1008,29 +1250,192 @@ Value *Callee = CS.getCalledValue(); // Special case handling of certain libc allocation functions here. - if (Function *F = dyn_cast(Callee)) + if (Function *F = dyn_cast(Callee)) { +#ifdef LLVA_KERNEL + if (F->getName() == "kmem_cache_alloc") { + DEBUG(std::cerr << "LLVA: kmem_cache_alloc" << std::endl); + // Update the statistics count + ++CacheAllocs; + + // Create a new DSNode for this memory allocation + DSNode *N = createNode(); + N->setHeapNodeMarker(); + setDestTo(*CS.getInstruction(), N); + + // Get the pool handle + if (CS.arg_begin() == CS.arg_end()) { + abort(); //Handle this later + // Treat it as a kmalloc + N->foldNodeCompletely(); + //This becomes a kmalloc pool + MetaPoolHandle* mpvh = new MetaPoolHandle(new MetaPool(KMallocPool)); + G.getPoolDescriptorsMap()[N] = mpvh; + } else { + Value *actualPD = *(CS.arg_begin()); + if (!isa(actualPD)) { + std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n"; + } else { + ++GlobalPools; + } + Value *TheMetaPool = actualPD; + //Get the Module first + Module * M = F->getParent(); + if (G.getPoolDescriptorsMap().count(N)== 0) { + //Here we insert a global meta pool + //Now create a meta pool for this value, DSN Node + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + TheMetaPool = new GlobalVariable( + /*type=*/ VoidPtrType, + /*isConstant=*/ false, + /*Linkage=*/ GlobalValue::InternalLinkage, + /*initializer=*/ Constant::getNullValue(VoidPtrType), + /*name=*/ "_metaPool_", + /*parent=*/ M ); + //Inserted a global meta pool + } +#if 1 + else { + // Lookup the meta pool + TheMetaPool = G.getPoolForNode(N)->getMetaPoolValue(); + } +#endif + //Now insert a function call that takes care of adding this pool to the global pool + + //First get the Insert point + Instruction *InsertPoint = CS.getInstruction(); + + //Assumes AddPoolDescToMetaPool is in the module + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + const Type * VoidPtrPtrType = PointerType::get(VoidPtrType); + CastInst *CastMetaPool = + new CastInst(TheMetaPool, + VoidPtrPtrType, "metapool.casted", InsertPoint); + CastInst *CastActualPD = + new CastInst(actualPD, + PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint); + + // Create the call to AddPoolDescToMetaPool + std::vector args(1,CastMetaPool); + args.push_back(CastActualPD); + + //Get the AddPoolDescToMetaPool function from the module + //FIXME optimize it by getting it once per module + std::vector Arg(1, VoidPtrPtrType); + Arg.push_back(VoidPtrType); + FunctionType *AddPoolDescToMetaPoolTy = + FunctionType::get(Type::VoidTy,Arg, false); + Function *AddPoolDescToMetaPool = M->getOrInsertFunction("AddPoolDescToMetaPool", AddPoolDescToMetaPoolTy); + + + new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint); +#if 0 + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool)); +#else + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool), CS.getInstruction()); +#endif + G.getPoolDescriptorsMap()[N] = tmpvh; + } + return; + } else if (F->getName() == "poolalloc") { + if (CS.getCaller()->getName() == "kmem_cache_alloc") + return; + // Update the statistics + ++KMallocs; + + // Create a DSNode for the memory allocated by this function call + DSNode *N = createNode(); + N->setHeapNodeMarker(); + setDestTo(*CS.getInstruction(), N); + + // Get the pool handle, if possible + if (CS.arg_begin() == CS.arg_end()) { + abort() ; //Handle this later + // Treat it as kmalloc + N->foldNodeCompletely(); + //This becomes a kmalloc pool + //So get the kmalloc pool + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(KMallocPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } else { + Value *actualPD = *(CS.arg_begin()); + if (!isa(actualPD)) { + std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n"; + } else { + ++GlobalPools; + } + Value *TheMetaPool = actualPD; + Module * M = F->getParent(); + if (G.getPoolDescriptorsMap().count(N)== 0) { + //Here we insert a global meta pool + //Get the Module first + //Now create a meta pool for this value, DSN Node + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + TheMetaPool = new GlobalVariable( + /*type=*/ VoidPtrType, + /*isConstant=*/ false, + /*Linkage=*/ GlobalValue::InternalLinkage, + /*initializer=*/ Constant::getNullValue(VoidPtrType), + /*name=*/ "_metaPool_", + /*parent=*/ M ); + //Inserted a global meta pool + } + //Now insert a function call that takes care of adding this pool to the global pool + //First get the Insert point + Instruction *InsertPoint = CS.getInstruction(); + + //Assumes AddPoolDescToMetaPool is in the module + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + const Type * VoidPtrPtrType = PointerType::get(VoidPtrType); + CastInst *CastMetaPool = + new CastInst(TheMetaPool, + VoidPtrPtrType, "metapool.casted", InsertPoint); + CastInst *CastActualPD = + new CastInst(actualPD, + PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint); + + // Create the call to AddPoolDescToMetaPool + std::vector args(1,CastMetaPool); + args.push_back(CastActualPD); + + //FIXME optimize it by getting it once per module + std::vector Arg(1, VoidPtrPtrType); + Arg.push_back(VoidPtrType); + FunctionType *AddPoolDescToMetaPoolTy = + FunctionType::get(Type::VoidTy,Arg, false); + Function *AddPoolDescToMetaPool = M->getOrInsertFunction("AddPoolDescToMetaPool", AddPoolDescToMetaPoolTy); + + new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint); + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } + return; + } +#endif if (F->isExternal()) if (F->isIntrinsic() && visitIntrinsic(CS, F)) return; else { // Determine if the called function is one of the specified heap // allocation functions - if (AllocList.end() != std::find(AllocList.begin(), AllocList.end(), F->getName())) { - setDestTo(*CS.getInstruction(), - createNode()->setHeapNodeMarker()->setModifiedMarker()); - return; - } + if (AllocList.end() != std::find(AllocList.begin(), AllocList.end(), F->getName())) { + setDestTo(*CS.getInstruction(), + createNode()->setHeapNodeMarker()->setModifiedMarker()); + return; + } // Determine if the called function is one of the specified heap // free functions - if (FreeList.end() != std::find(FreeList.begin(), FreeList.end(), F->getName())) { - // Mark that the node is written to... - if (DSNode *N = getValueDest(*(CS.getArgument(0))).getNode()) - N->setModifiedMarker()->setHeapNodeMarker(); - return; - } - if (visitExternal(CS,F)) - return; + if (FreeList.end() != std::find(FreeList.begin(), FreeList.end(), + F->getName())) { + // Mark that the node is written to... + if (DSNode *N = getValueDest(*(CS.getArgument(0))).getNode()) + N->setModifiedMarker()->setHeapNodeMarker(); + return; + } + + if (visitExternal(CS,F)) + return; + // Unknown function, warn if it returns a pointer type or takes a // pointer argument. bool Warn = isPointerType(CS.getInstruction()->getType()); @@ -1046,6 +1451,7 @@ << F->getName() << "' will cause pessimistic results!\n"); } } + } // Set up the return value... DSNodeHandle RetVal; @@ -1283,7 +1689,6 @@ if (!I->isExternal()) DSInfo.insert(std::make_pair(I, new DSGraph(GlobalECs, TD, *I, GlobalsGraph))); - GlobalsGraph->removeTriviallyDeadNodes(); GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs); Index: llvm-poolalloc/lib/DSA/Makefile diff -u llvm-poolalloc/lib/DSA/Makefile:1.5 llvm-poolalloc/lib/DSA/Makefile:1.5.2.1 --- llvm-poolalloc/lib/DSA/Makefile:1.5 Sun Oct 23 20:08:20 2005 +++ llvm-poolalloc/lib/DSA/Makefile Tue Dec 12 16:42:42 2006 @@ -1,4 +1,4 @@ -##===- lib/Analysis/DataStructure/Makefile -----------------*- Makefile -*-===## +##===- lib/DSA/Makefile ------------------------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -7,7 +7,7 @@ # ##===----------------------------------------------------------------------===## -LEVEL = ../../.. +LEVEL = ../.. LIBRARYNAME = LLVMDataStructure include $(LEVEL)/Makefile.common Index: llvm-poolalloc/lib/DSA/Printer.cpp diff -u llvm-poolalloc/lib/DSA/Printer.cpp:1.86 llvm-poolalloc/lib/DSA/Printer.cpp:1.86.2.1 --- llvm-poolalloc/lib/DSA/Printer.cpp:1.86 Mon Oct 2 07:26:53 2006 +++ llvm-poolalloc/lib/DSA/Printer.cpp Tue Dec 12 16:42:42 2006 @@ -11,9 +11,9 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Analysis/DataStructure/DSGraphTraits.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" +#include "dsa/DSGraphTraits.h" #include "llvm/Module.h" #include "llvm/Constants.h" #include "llvm/Assembly/Writer.h" Index: llvm-poolalloc/lib/DSA/Steensgaard.cpp diff -u llvm-poolalloc/lib/DSA/Steensgaard.cpp:1.65 llvm-poolalloc/lib/DSA/Steensgaard.cpp:1.65.2.1 --- llvm-poolalloc/lib/DSA/Steensgaard.cpp:1.65 Sun Aug 27 20:02:49 2006 +++ llvm-poolalloc/lib/DSA/Steensgaard.cpp Tue Dec 12 16:42:42 2006 @@ -14,8 +14,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/Passes.h" #include "llvm/Module.h" @@ -28,6 +28,7 @@ DSGraph *ResultGraph; EquivalenceClasses GlobalECs; // Always empty + PoolDescriptorMapType PoolDescriptors; public: Steens() : ResultGraph(0) {} ~Steens() { Index: llvm-poolalloc/lib/DSA/TopDownClosure.cpp diff -u llvm-poolalloc/lib/DSA/TopDownClosure.cpp:1.92 llvm-poolalloc/lib/DSA/TopDownClosure.cpp:1.92.2.1 --- llvm-poolalloc/lib/DSA/TopDownClosure.cpp:1.92 Fri Oct 13 12:38:22 2006 +++ llvm-poolalloc/lib/DSA/TopDownClosure.cpp Tue Dec 12 16:42:42 2006 @@ -14,10 +14,10 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" +#include "dsa/DataStructure.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DSGraph.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Timer.h" #include "llvm/ADT/Statistic.h" @@ -377,7 +377,6 @@ } else { // Otherwise, create a new DSGraph to represent this. IndCallGraph = new DSGraph(DSG.getGlobalECs(), DSG.getTargetData()); - // Make a nullary dummy call site, which will eventually get some content // merged into it. The actual callee function doesn't matter here, so we // just pass it something to keep the ctor happy. From dpatel at apple.com Tue Dec 12 16:47:29 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 16:47:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122247.kBCMlSKa007018@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.78 -> 1.79 --- Log message: Fix thinko. While searching for a analysis in a pass manager, do not search it into pass manager's manager. --- Diffs of the changes: (+18 -3) PassManager.cpp | 21 ++++++++++++++++++--- 1 files changed, 18 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.78 llvm/lib/VMCore/PassManager.cpp:1.79 --- llvm/lib/VMCore/PassManager.cpp:1.78 Tue Dec 12 16:35:25 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:47:13 2006 @@ -260,6 +260,9 @@ unsigned Depth; }; +//===----------------------------------------------------------------------===// +// BasicBlockPassManager_New +// /// BasicBlockPassManager_New manages BasicBlockPass. It batches all the /// pass together and sequence them to process one basic block before /// processing next basic block. @@ -288,6 +291,9 @@ }; +//===----------------------------------------------------------------------===// +// FunctionPassManagerImpl_New +// /// FunctionPassManagerImpl_New manages FunctionPasses and BasicBlockPassManagers. /// It batches all function passes and basic block pass managers together and /// sequence them to process one function at a time before processing next @@ -356,6 +362,9 @@ BasicBlockPassManager_New *activeBBPassManager; }; +//===----------------------------------------------------------------------===// +// ModulePassManager_New +// /// ModulePassManager_New manages ModulePasses and function pass managers. /// It batches all Module passes passes and function pass managers together and /// sequence them to process one module. @@ -384,7 +393,10 @@ FunctionPassManagerImpl_New *activeFunctionPassManager; }; -/// PassManager_New manages ModulePassManagers +//===----------------------------------------------------------------------===// +// PassManagerImpl_New +// +/// PassManagerImpl_New manages ModulePassManagers class PassManagerImpl_New : public Pass, public PMDataManager, public PMTopLevelManager { @@ -519,8 +531,11 @@ // Check pass managers for (std::vector::iterator I = PassManagers.begin(), - E = PassManagers.end(); P == NULL && I != E; ++I) - P = (*I)->getResolver()->getAnalysisToUpdate(AID, false); + E = PassManagers.end(); P == NULL && I != E; ++I) { + PMDataManager *PMD = dynamic_cast(*I); + assert(PMD && "This is not a PassManager"); + P = PMD->findAnalysisPass(AID, false); + } // Check other pass managers for (std::vector::iterator I = IndirectPassManagers.begin(), From criswell at cs.uiuc.edu Tue Dec 12 16:49:05 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 12 Dec 2006 16:49:05 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/lib/Makefile Message-ID: <200612122249.QAA14049@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib: Makefile updated: 1.3 -> 1.3.2.1 --- Log message: Build DSA and Pool Allocation in parallel. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-poolalloc/lib/Makefile diff -u llvm-poolalloc/lib/Makefile:1.3 llvm-poolalloc/lib/Makefile:1.3.2.1 --- llvm-poolalloc/lib/Makefile:1.3 Wed May 18 14:56:25 2005 +++ llvm-poolalloc/lib/Makefile Tue Dec 12 16:48:36 2006 @@ -6,6 +6,6 @@ # # List all of the subdirectories that we will compile. # -DIRS=PoolAllocate +PARALLEL_DIRS=DSA PoolAllocate include $(LEVEL)/Makefile.common From dpatel at apple.com Tue Dec 12 16:50:20 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 16:50:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122250.kBCMoK23007168@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.79 -> 1.80 --- Log message: findAnalysisPass(). First search all available passes before searching ImmutablePasses. --- Diffs of the changes: (+13 -13) PassManager.cpp | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.79 llvm/lib/VMCore/PassManager.cpp:1.80 --- llvm/lib/VMCore/PassManager.cpp:1.79 Tue Dec 12 16:47:13 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:50:05 2006 @@ -512,6 +512,19 @@ Pass *PMTopLevelManager::findAnalysisPass(AnalysisID AID) { Pass *P = NULL; + // Check pass managers + for (std::vector::iterator I = PassManagers.begin(), + E = PassManagers.end(); P == NULL && I != E; ++I) { + PMDataManager *PMD = dynamic_cast(*I); + assert(PMD && "This is not a PassManager"); + P = PMD->findAnalysisPass(AID, false); + } + + // Check other pass managers + for (std::vector::iterator I = IndirectPassManagers.begin(), + E = IndirectPassManagers.end(); P == NULL && I != E; ++I) + P = (*I)->findAnalysisPass(AID, false); + for (std::vector::iterator I = ImmutablePasses.begin(), E = ImmutablePasses.end(); P == NULL && I != E; ++I) { const PassInfo *PI = (*I)->getPassInfo(); @@ -529,19 +542,6 @@ } } - // Check pass managers - for (std::vector::iterator I = PassManagers.begin(), - E = PassManagers.end(); P == NULL && I != E; ++I) { - PMDataManager *PMD = dynamic_cast(*I); - assert(PMD && "This is not a PassManager"); - P = PMD->findAnalysisPass(AID, false); - } - - // Check other pass managers - for (std::vector::iterator I = IndirectPassManagers.begin(), - E = IndirectPassManagers.end(); P == NULL && I != E; ++I) - P = (*I)->findAnalysisPass(AID, false); - return P; } From dpatel at apple.com Tue Dec 12 16:53:55 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 16:53:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122253.kBCMrt9F007237@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.80 -> 1.81 --- Log message: Maintain ImmutablePasses list at top level only. Do not make them directly available to individual managers. --- Diffs of the changes: (+0 -6) PassManager.cpp | 6 ------ 1 files changed, 6 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.80 llvm/lib/VMCore/PassManager.cpp:1.81 --- llvm/lib/VMCore/PassManager.cpp:1.80 Tue Dec 12 16:50:05 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:53:40 2006 @@ -200,12 +200,6 @@ void initializeAnalysisInfo() { ForcedLastUses.clear(); AvailableAnalysis.clear(); - - // Include immutable passes into AvailableAnalysis vector. - std::vector &ImmutablePasses = TPM->getImmutablePasses(); - for (std::vector::iterator I = ImmutablePasses.begin(), - E = ImmutablePasses.end(); I != E; ++I) - recordAvailableAnalysis(*I); } /// Populate RequiredPasses with the analysis pass that are required by From dpatel at apple.com Tue Dec 12 16:56:51 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 16:56:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122256.kBCMup1q007314@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.81 -> 1.82 --- Log message: Remove unused constructor. --- Diffs of the changes: (+0 -2) PassManager.cpp | 2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.81 llvm/lib/VMCore/PassManager.cpp:1.82 --- llvm/lib/VMCore/PassManager.cpp:1.81 Tue Dec 12 16:53:40 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:56:36 2006 @@ -296,8 +296,6 @@ public PMDataManager, public PMTopLevelManager { public: - FunctionPassManagerImpl_New(ModuleProvider *P, int D) : - PMDataManager(D) { /* TODO */ } FunctionPassManagerImpl_New(int D) : PMDataManager(D) { activeBBPassManager = NULL; } From dpatel at apple.com Tue Dec 12 16:57:58 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 16:57:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122257.kBCMvwct007349@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.82 -> 1.83 --- Log message: Initialize activeManager. --- Diffs of the changes: (+3 -1) PassManager.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.82 llvm/lib/VMCore/PassManager.cpp:1.83 --- llvm/lib/VMCore/PassManager.cpp:1.82 Tue Dec 12 16:56:36 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 16:57:43 2006 @@ -395,7 +395,9 @@ public: - PassManagerImpl_New(int D) : PMDataManager(D) {} + PassManagerImpl_New(int D) : PMDataManager(D) { + activeManager = NULL; + } /// add - Add a pass to the queue of passes to run. This passes ownership of /// the Pass to the PassManager. When the PassManager is destroyed, the pass From dpatel at apple.com Tue Dec 12 17:08:00 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 17:08:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122308.kBCN80wS007553@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.83 -> 1.84 --- Log message: removeNotPreservedAnalysis(). Do not remove ImmutablePass from the list. --- Diffs of the changes: (+8 -4) PassManager.cpp | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.83 llvm/lib/VMCore/PassManager.cpp:1.84 --- llvm/lib/VMCore/PassManager.cpp:1.83 Tue Dec 12 16:57:43 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:07:44 2006 @@ -580,13 +580,17 @@ const std::vector &PreservedSet = AnUsage.getPreservedSet(); for (std::map::iterator I = AvailableAnalysis.begin(), - E = AvailableAnalysis.end(); I != E; ++I ) { + E = AvailableAnalysis.end(); I != E; ) { if (std::find(PreservedSet.begin(), PreservedSet.end(), I->first) == PreservedSet.end()) { // Remove this analysis - std::map::iterator J = I++; - AvailableAnalysis.erase(J); - } + if (!dynamic_cast(I->second)) { + std::map::iterator J = I++; + AvailableAnalysis.erase(J); + } else + ++I; + } else + ++I; } } From dpatel at apple.com Tue Dec 12 17:09:47 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 17:09:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122309.kBCN9lUc007604@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.84 -> 1.85 --- Log message: collectRequiredAnalysisPasses(). Include RequiredTrainsitiveSet also. --- Diffs of the changes: (+8 -0) PassManager.cpp | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.84 llvm/lib/VMCore/PassManager.cpp:1.85 --- llvm/lib/VMCore/PassManager.cpp:1.84 Tue Dec 12 17:07:44 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:09:32 2006 @@ -678,6 +678,14 @@ assert (AnalysisPass && "Analysis pass is not available"); RP.push_back(AnalysisPass); } + + const std::vector &IDs = AnUsage.getRequiredTransitiveSet(); + for (std::vector::const_iterator I = IDs.begin(), + E = IDs.end(); I != E; ++I) { + Pass *AnalysisPass = findAnalysisPass(*I, true); + assert (AnalysisPass && "Analysis pass is not available"); + RP.push_back(AnalysisPass); + } } // All Required analyses should be available to the pass as it runs! Here From dpatel at apple.com Tue Dec 12 17:13:24 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 17:13:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122313.kBCNDOjT007708@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.85 -> 1.86 --- Log message: Initialize AnalysisImpls for each pass before executing the pass. --- Diffs of the changes: (+3 -3) PassManager.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.85 llvm/lib/VMCore/PassManager.cpp:1.86 --- llvm/lib/VMCore/PassManager.cpp:1.85 Tue Dec 12 17:09:32 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:13:09 2006 @@ -768,7 +768,7 @@ for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; - + initializeAnalysisImpl(P); BasicBlockPass *BP = dynamic_cast(P); Changed |= BP->runOnBasicBlock(*I); removeNotPreservedAnalysis(P); @@ -977,7 +977,7 @@ for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; - + initializeAnalysisImpl(P); FunctionPass *FP = dynamic_cast(P); Changed |= FP->runOnFunction(F); removeNotPreservedAnalysis(P); @@ -1104,7 +1104,7 @@ for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; - + initializeAnalysisImpl(P); ModulePass *MP = dynamic_cast(P); Changed |= MP->runOnModule(M); removeNotPreservedAnalysis(P); From dpatel at apple.com Tue Dec 12 17:15:43 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 17:15:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122315.kBCNFhMl007758@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.86 -> 1.87 --- Log message: Do not runOnFunction on external functions. --- Diffs of the changes: (+7 -0) PassManager.cpp | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.86 llvm/lib/VMCore/PassManager.cpp:1.87 --- llvm/lib/VMCore/PassManager.cpp:1.86 Tue Dec 12 17:13:09 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:15:28 2006 @@ -761,6 +761,9 @@ bool BasicBlockPassManager_New::runOnFunction(Function &F) { + if (F.isExternal()) + return false; + bool Changed = doInitialization(F); initializeAnalysisInfo(); @@ -972,6 +975,10 @@ bool FunctionPassManagerImpl_New::runOnFunction(Function &F) { bool Changed = false; + + if (F.isExternal()) + return false; + initializeAnalysisInfo(); for (std::vector::iterator itr = passVectorBegin(), From criswell at cs.uiuc.edu Tue Dec 12 17:21:16 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Tue, 12 Dec 2006 17:21:16 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/include/dsa/DSGraph.h DataStructure.h Message-ID: <200612122321.RAA22490@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/include/dsa: DSGraph.h updated: 1.110.2.1 -> 1.110.2.2 DataStructure.h updated: 1.98.2.1 -> 1.98.2.2 --- Log message: Do not build with these enabled by default; let configure script enable them. --- Diffs of the changes: (+0 -3) DSGraph.h | 1 - DataStructure.h | 2 -- 2 files changed, 3 deletions(-) Index: llvm-poolalloc/include/dsa/DSGraph.h diff -u llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.1 llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.2 --- llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.1 Tue Dec 12 16:42:37 2006 +++ llvm-poolalloc/include/dsa/DSGraph.h Tue Dec 12 17:20:47 2006 @@ -21,7 +21,6 @@ #include #include #include -#define LLVA_KERNEL 1 namespace llvm { //typedef map PoolDescriptorMapType; Index: llvm-poolalloc/include/dsa/DataStructure.h diff -u llvm-poolalloc/include/dsa/DataStructure.h:1.98.2.1 llvm-poolalloc/include/dsa/DataStructure.h:1.98.2.2 --- llvm-poolalloc/include/dsa/DataStructure.h:1.98.2.1 Tue Dec 12 16:42:37 2006 +++ llvm-poolalloc/include/dsa/DataStructure.h Tue Dec 12 17:20:47 2006 @@ -37,8 +37,6 @@ FunctionPass *createDataStructureStatsPass(); FunctionPass *createDataStructureGraphCheckerPass(); -#define LLVA_KERNEL 1 - // FIXME: move this stuff to a private header namespace DataStructureAnalysis { /// isPointerType - Return true if this first class type is big enough to hold From dpatel at apple.com Tue Dec 12 17:27:52 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 17:27:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122327.kBCNRqMo008357@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.87 -> 1.88 --- Log message: FunctionPassManager() Set AnalysisResolver_New and add FPM to PassManagers list. --- Diffs of the changes: (+6 -0) PassManager.cpp | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.87 llvm/lib/VMCore/PassManager.cpp:1.88 --- llvm/lib/VMCore/PassManager.cpp:1.87 Tue Dec 12 17:15:28 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:27:37 2006 @@ -847,6 +847,12 @@ FPM = new FunctionPassManagerImpl_New(0); // FPM is the top level manager. FPM->setTopLevelManager(FPM); + + PMDataManager *PMD = dynamic_cast(FPM); + AnalysisResolver_New *AR = new AnalysisResolver_New(*PMD); + FPM->setResolver(AR); + + FPM->addPassManager(FPM); MP = P; } From dpatel at apple.com Tue Dec 12 17:34:48 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 17:34:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122334.kBCNYmrX008670@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.88 -> 1.89 --- Log message: Add routines to dump pass manager queue. --- Diffs of the changes: (+62 -0) PassManager.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 62 insertions(+) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.88 llvm/lib/VMCore/PassManager.cpp:1.89 --- llvm/lib/VMCore/PassManager.cpp:1.88 Tue Dec 12 17:27:37 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:34:33 2006 @@ -149,6 +149,9 @@ IndirectPassManagers.push_back(Manager); } + // Print passes managed by this top level manager. + void dumpPasses(); + private: /// Collection of pass managers @@ -231,6 +234,21 @@ unsigned getDepth() { return Depth; } + // Print list of passes that are last used by P. + void dumpLastUses(Pass *P, unsigned Offset) { + + std::vector LUses; + + assert (TPM && "Top Level Manager is missing"); + TPM->collectLastUses(LUses, P); + + for (std::vector::iterator I = LUses.begin(), + E = LUses.end(); I != E; ++I) { + llvm::cerr << "--" << std::string(Offset*2, ' '); + (*I)->dumpPassStructure(0); + } + } + protected: // Collection of pass whose last user asked this manager to claim @@ -283,6 +301,16 @@ bool doFinalization(Module &M); bool doFinalization(Function &F); + // Print passes managed by this manager + void dumpPassStructure(unsigned Offset) { + llvm::cerr << std::string(Offset*2, ' ') << "BasicBLockPass Manager\n"; + for (std::vector::iterator I = passVectorBegin(), + E = passVectorEnd(); I != E; ++I) { + (*I)->dumpPassStructure(Offset + 1); + dumpLastUses(*I, Offset+1); + } + } + }; //===----------------------------------------------------------------------===// @@ -349,6 +377,16 @@ Info.setPreservesAll(); } + // Print passes managed by this manager + void dumpPassStructure(unsigned Offset) { + llvm::cerr << std::string(Offset*2, ' ') << "FunctionPass Manager\n"; + for (std::vector::iterator I = passVectorBegin(), + E = passVectorEnd(); I != E; ++I) { + (*I)->dumpPassStructure(Offset + 1); + dumpLastUses(*I, Offset+1); + } + } + private: // Active Pass Managers BasicBlockPassManager_New *activeBBPassManager; @@ -380,6 +418,16 @@ Info.setPreservesAll(); } + // Print passes managed by this manager + void dumpPassStructure(unsigned Offset) { + llvm::cerr << std::string(Offset*2, ' ') << "ModulePass Manager\n"; + for (std::vector::iterator I = passVectorBegin(), + E = passVectorEnd(); I != E; ++I) { + (*I)->dumpPassStructure(Offset + 1); + dumpLastUses(*I, Offset+1); + } + } + private: // Active Pass Manager FunctionPassManagerImpl_New *activeFunctionPassManager; @@ -539,6 +587,20 @@ return P; } +// Print passes managed by this top level manager. +void PMTopLevelManager::dumpPasses() { + + // Print out the immutable passes + for (unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) { + ImmutablePasses[i]->dumpPassStructure(0); + } + + for (std::vector::iterator I = PassManagers.begin(), + E = PassManagers.end(); I != E; ++I) + (*I)->dumpPassStructure(1); + +} + //===----------------------------------------------------------------------===// // PMDataManager implementation From reid at x10sys.com Tue Dec 12 17:36:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 17:36:36 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200612122336.kBCNaaNp008793@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.106 -> 1.107 --- Log message: Replace inferred getCast(V,Ty) calls with more strict variants. Rename getZeroExtend and getSignExtend to getZExt and getSExt to match the the casting mnemonics in the rest of LLVM. --- Diffs of the changes: (+12 -12) Constants.h | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.106 llvm/include/llvm/Constants.h:1.107 --- llvm/include/llvm/Constants.h:1.106 Mon Dec 11 18:51:07 2006 +++ llvm/include/llvm/Constants.h Tue Dec 12 17:36:14 2006 @@ -514,18 +514,18 @@ /// Cast constant expr /// - static Constant *getTrunc (Constant *C, const Type *Ty); - static Constant *getSignExtend (Constant *C, const Type *Ty); - static Constant *getZeroExtend (Constant *C, const Type *Ty); - static Constant *getFPTrunc (Constant *C, const Type *Ty); - static Constant *getFPExtend (Constant *C, const Type *Ty); - static Constant *getUIToFP (Constant *C, const Type *Ty); - static Constant *getSIToFP (Constant *C, const Type *Ty); - static Constant *getFPToUI (Constant *C, const Type *Ty); - static Constant *getFPToSI (Constant *C, const Type *Ty); - static Constant *getPtrToInt (Constant *C, const Type *Ty); - static Constant *getIntToPtr (Constant *C, const Type *Ty); - static Constant *getBitCast (Constant *C, const Type *Ty); + static Constant *getTrunc (Constant *C, const Type *Ty); + static Constant *getSExt (Constant *C, const Type *Ty); + static Constant *getZExt (Constant *C, const Type *Ty); + static Constant *getFPTrunc (Constant *C, const Type *Ty); + static Constant *getFPExtend(Constant *C, const Type *Ty); + static Constant *getUIToFP (Constant *C, const Type *Ty); + static Constant *getSIToFP (Constant *C, const Type *Ty); + static Constant *getFPToUI (Constant *C, const Type *Ty); + static Constant *getFPToSI (Constant *C, const Type *Ty); + static Constant *getPtrToInt(Constant *C, const Type *Ty); + static Constant *getIntToPtr(Constant *C, const Type *Ty); + static Constant *getBitCast (Constant *C, const Type *Ty); // @brief Convenience function for getting one of the casting operations // using a CastOps opcode. From reid at x10sys.com Tue Dec 12 17:36:32 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 17:36:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp ConstantRange.cpp ScalarEvolution.cpp ScalarEvolutionExpander.cpp Message-ID: <200612122336.kBCNaWBG008777@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: BasicAliasAnalysis.cpp updated: 1.93 -> 1.94 ConstantRange.cpp updated: 1.21 -> 1.22 ScalarEvolution.cpp updated: 1.71 -> 1.72 ScalarEvolutionExpander.cpp updated: 1.8 -> 1.9 --- Log message: Replace inferred getCast(V,Ty) calls with more strict variants. Rename getZeroExtend and getSignExtend to getZExt and getSExt to match the the casting mnemonics in the rest of LLVM. --- Diffs of the changes: (+42 -21) BasicAliasAnalysis.cpp | 8 ++++---- ConstantRange.cpp | 8 ++++---- ScalarEvolution.cpp | 21 ++++++++++++--------- ScalarEvolutionExpander.cpp | 26 ++++++++++++++++++++++---- 4 files changed, 42 insertions(+), 21 deletions(-) Index: llvm/lib/Analysis/BasicAliasAnalysis.cpp diff -u llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.93 llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.94 --- llvm/lib/Analysis/BasicAliasAnalysis.cpp:1.93 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Analysis/BasicAliasAnalysis.cpp Tue Dec 12 17:36:14 2006 @@ -459,11 +459,11 @@ if (Constant *C2 = dyn_cast(V2)) { // Sign extend the constants to long types, if necessary if (C1->getType()->getPrimitiveSizeInBits() < 64) - C1 = ConstantExpr::getSignExtend(C1, Type::LongTy); + C1 = ConstantExpr::getSExt(C1, Type::LongTy); else if (C1->getType() == Type::ULongTy) C1 = ConstantExpr::getBitCast(C1, Type::LongTy); if (C2->getType()->getPrimitiveSizeInBits() < 64) - C2 = ConstantExpr::getSignExtend(C2, Type::LongTy); + C2 = ConstantExpr::getSExt(C2, Type::LongTy); else if (C2->getType() == Type::ULongTy) C2 = ConstantExpr::getBitCast(C2, Type::LongTy); return C1 == C2; @@ -555,11 +555,11 @@ if (G1OC->getType() != G2OC->getType()) { // Sign extend both operands to long. if (G1OC->getType()->getPrimitiveSizeInBits() < 64) - G1OC = ConstantExpr::getSignExtend(G1OC, Type::LongTy); + G1OC = ConstantExpr::getSExt(G1OC, Type::LongTy); else if (G1OC->getType() == Type::ULongTy) G1OC = ConstantExpr::getBitCast(G1OC, Type::LongTy); if (G2OC->getType()->getPrimitiveSizeInBits() < 64) - G2OC = ConstantExpr::getSignExtend(G2OC, Type::LongTy); + G2OC = ConstantExpr::getSExt(G2OC, Type::LongTy); else if (G2OC->getType() == Type::ULongTy) G2OC = ConstantExpr::getBitCast(G2OC, Type::LongTy); GEP1Ops[FirstConstantOper] = G1OC; Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.21 llvm/lib/Analysis/ConstantRange.cpp:1.22 --- llvm/lib/Analysis/ConstantRange.cpp:1.21 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Analysis/ConstantRange.cpp Tue Dec 12 17:36:14 2006 @@ -340,8 +340,8 @@ Constant *Lower = getLower(); Constant *Upper = getUpper(); - return ConstantRange(ConstantExpr::getCast(Instruction::ZExt, Lower, Ty), - ConstantExpr::getCast(Instruction::ZExt, Upper, Ty)); + return ConstantRange(ConstantExpr::getZExt(Lower, Ty), + ConstantExpr::getZExt(Upper, Ty)); } /// truncate - Return a new range in the specified integer type, which must be @@ -356,8 +356,8 @@ return ConstantRange(getType()); return ConstantRange( - ConstantExpr::getCast(Instruction::Trunc, getLower(), Ty), - ConstantExpr::getCast(Instruction::Trunc, getUpper(), Ty)); + ConstantExpr::getTrunc(getLower(), Ty), + ConstantExpr::getTrunc(getUpper(), Ty)); } Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.71 llvm/lib/Analysis/ScalarEvolution.cpp:1.72 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.71 Tue Dec 12 03:17:50 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Tue Dec 12 17:36:14 2006 @@ -584,7 +584,7 @@ SCEVHandle SCEVZeroExtendExpr::get(const SCEVHandle &Op, const Type *Ty) { if (SCEVConstant *SC = dyn_cast(Op)) return SCEVUnknown::get( - ConstantExpr::getZeroExtend(SC->getValue(), Ty)); + ConstantExpr::getZExt(SC->getValue(), Ty)); // FIXME: If the input value is a chrec scev, and we can prove that the value // did not overflow the old, smaller, value, we can zero extend all of the @@ -2000,11 +2000,14 @@ } else { SCEVHandle OpV = getSCEVAtScope(getSCEV(Op), L); if (SCEVConstant *SC = dyn_cast(OpV)) - Operands.push_back(ConstantExpr::getCast(SC->getValue(), - Op->getType())); + Operands.push_back(ConstantExpr::getIntegerCast(SC->getValue(), + Op->getType(), + false)); else if (SCEVUnknown *SU = dyn_cast(OpV)) { if (Constant *C = dyn_cast(SU->getValue())) - Operands.push_back(ConstantExpr::getCast(C, Op->getType())); + Operands.push_back(ConstantExpr::getIntegerCast(C, + Op->getType(), + false)); else return V; } else { @@ -2122,7 +2125,7 @@ // Compute floor(sqrt(B^2-4ac)) ConstantInt *SqrtVal = - cast(ConstantExpr::getCast(SqrtTerm, + cast(ConstantExpr::getBitCast(SqrtTerm, SqrtTerm->getType()->getUnsignedVersion())); uint64_t SqrtValV = SqrtVal->getZExtValue(); uint64_t SqrtValV2 = (uint64_t)sqrt((double)SqrtValV); @@ -2135,16 +2138,16 @@ } SqrtVal = ConstantInt::get(Type::ULongTy, SqrtValV2); - SqrtTerm = ConstantExpr::getCast(SqrtVal, SqrtTerm->getType()); + SqrtTerm = ConstantExpr::getTruncOrBitCast(SqrtVal, SqrtTerm->getType()); Constant *NegB = ConstantExpr::getNeg(B); Constant *TwoA = ConstantExpr::getMul(A, Two); // The divisions must be performed as signed divisions. const Type *SignedTy = NegB->getType()->getSignedVersion(); - NegB = ConstantExpr::getCast(NegB, SignedTy); - TwoA = ConstantExpr::getCast(TwoA, SignedTy); - SqrtTerm = ConstantExpr::getCast(SqrtTerm, SignedTy); + NegB = ConstantExpr::getBitCast(NegB, SignedTy); + TwoA = ConstantExpr::getBitCast(TwoA, SignedTy); + SqrtTerm = ConstantExpr::getBitCast(SqrtTerm, SignedTy); Constant *Solution1 = ConstantExpr::getSDiv(ConstantExpr::getAdd(NegB, SqrtTerm), TwoA); Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp diff -u llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.8 llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.9 --- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.8 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp Tue Dec 12 17:36:14 2006 @@ -20,9 +20,27 @@ /// InsertCastOfTo - Insert a cast of V to the specified type, doing what /// we can to share the casts. Value *SCEVExpander::InsertCastOfTo(Value *V, const Type *Ty) { + // Compute the Cast opcode to use + Instruction::CastOps opcode = Instruction::BitCast; + if (Ty->isIntegral()) { + if (V->getType()->getTypeID() == Type::PointerTyID) + opcode = Instruction::PtrToInt; + else { + unsigned SrcBits = V->getType()->getPrimitiveSizeInBits(); + unsigned DstBits = Ty->getPrimitiveSizeInBits(); + opcode = (SrcBits > DstBits ? Instruction::Trunc : + (SrcBits == DstBits ? Instruction::BitCast : + (V->getType()->isSigned() ? Instruction::SExt : + Instruction::ZExt))); + } + } else if (Ty->isFloatingPoint()) + opcode = Instruction::UIToFP; + else if (Ty->getTypeID() == Type::PointerTyID && V->getType()->isIntegral()) + opcode = Instruction::IntToPtr; + // FIXME: keep track of the cast instruction. if (Constant *C = dyn_cast(V)) - return ConstantExpr::getCast(C, Ty); + return ConstantExpr::getCast(opcode, C, Ty); if (Argument *A = dyn_cast(V)) { // Check to see if there is already a cast! @@ -38,8 +56,8 @@ return CI; } } - return CastInst::createInferredCast( - V, Ty, V->getName(), A->getParent()->getEntryBlock().begin()); + return CastInst::create(opcode, V, Ty, V->getName(), + A->getParent()->getEntryBlock().begin()); } Instruction *I = cast(V); @@ -64,7 +82,7 @@ if (InvokeInst *II = dyn_cast(I)) IP = II->getNormalDest()->begin(); while (isa(IP)) ++IP; - return CastInst::createInferredCast(V, Ty, V->getName(), IP); + return CastInst::create(opcode, V, Ty, V->getName(), IP); } Value *SCEVExpander::visitMulExpr(SCEVMulExpr *S) { From reid at x10sys.com Tue Dec 12 17:36:32 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 17:36:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612122336.kBCNaWOT008766@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.565 -> 1.566 --- Log message: Replace inferred getCast(V,Ty) calls with more strict variants. Rename getZeroExtend and getSignExtend to getZExt and getSExt to match the the casting mnemonics in the rest of LLVM. --- Diffs of the changes: (+31 -31) InstructionCombining.cpp | 62 +++++++++++++++++++++++------------------------ 1 files changed, 31 insertions(+), 31 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.565 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.566 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.565 Tue Dec 12 13:11:20 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Dec 12 17:36:14 2006 @@ -1792,8 +1792,7 @@ case 8: MiddleType = Type::SByteTy; break; } if (MiddleType) { - Instruction *NewTrunc = - CastInst::createInferredCast(XorLHS, MiddleType, "sext"); + Instruction *NewTrunc = new TruncInst(XorLHS, MiddleType, "sext"); InsertNewInstBefore(NewTrunc, I); return new SExtInst(NewTrunc, I.getType()); } @@ -3097,16 +3096,12 @@ // into : and (cast X to T), trunc_or_bitcast(C1)&C2 // This will fold the two constants together, which may allow // other simplifications. - Instruction *NewCast = - CastInst::createInferredCast(CastOp->getOperand(0), I.getType(), - CastOp->getName()+".shrunk"); + Instruction *NewCast = CastInst::createTruncOrBitCast( + CastOp->getOperand(0), I.getType(), + CastOp->getName()+".shrunk"); NewCast = InsertNewInstBefore(NewCast, I); // trunc_or_bitcast(C1)&C2 - Instruction::CastOps opc = ( - AndCI->getType()->getPrimitiveSizeInBits() == - I.getType()->getPrimitiveSizeInBits() ? - Instruction::BitCast : Instruction::Trunc); - Constant *C3 = ConstantExpr::getCast(opc, AndCI, I.getType()); + Constant *C3 = ConstantExpr::getTruncOrBitCast(AndCI,I.getType()); C3 = ConstantExpr::getAnd(C3, AndRHS); return BinaryOperator::createAnd(NewCast, C3); } else if (CastOp->getOpcode() == Instruction::Or) { @@ -3286,7 +3281,8 @@ Op1C->getOperand(0), I.getName()); InsertNewInstBefore(NewOp, I); - return CastInst::createInferredCast(NewOp, I.getType()); + return CastInst::createIntegerCast(NewOp, I.getType(), + SrcTy->isSigned()); } } } @@ -3690,7 +3686,8 @@ Op1C->getOperand(0), I.getName()); InsertNewInstBefore(NewOp, I); - return CastInst::createInferredCast(NewOp, I.getType()); + return CastInst::createIntegerCast(NewOp, I.getType(), + SrcTy->isSigned()); } } @@ -3871,7 +3868,8 @@ Op1C->getOperand(0), I.getName()); InsertNewInstBefore(NewOp, I); - return CastInst::createInferredCast(NewOp, I.getType()); + return CastInst::createIntegerCast(NewOp, I.getType(), + SrcTy->isSigned()); } } @@ -3947,7 +3945,7 @@ } } else { // Convert to correct type. - Op = IC.InsertNewInstBefore(CastInst::createInferredCast(Op, SIntPtrTy, + Op = IC.InsertNewInstBefore(CastInst::createSExtOrBitCast(Op, SIntPtrTy, Op->getName()+".c"), I); if (Size != 1) // We'll let instcombine(mul) convert this to a shl if possible. @@ -4944,8 +4942,7 @@ // If Op1 is a constant, we can fold the cast into the constant. if (Op1->getType() != Op0->getType()) if (Constant *Op1C = dyn_cast(Op1)) { - Op1 = ConstantExpr::getCast(Instruction::BitCast, Op1C, - Op0->getType()); + Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType()); } else { // Otherwise, cast the RHS right before the setcc Op1 = InsertCastBefore(Instruction::BitCast, Op1, Op0->getType(), I); @@ -5392,8 +5389,7 @@ Value *Op = ShiftOp->getOperand(0); if (isShiftOfSignedShift != isSignedShift) - Op = InsertNewInstBefore( - CastInst::createInferredCast(Op, I.getType(), "tmp"), I); + Op = InsertNewInstBefore(new BitCastInst(Op, I.getType(), "tmp"), I); ShiftInst *ShiftResult = new ShiftInst(I.getOpcode(), Op, ConstantInt::get(Type::UByteTy, Amt)); if (I.getType() == ShiftResult->getType()) @@ -5681,7 +5677,7 @@ /// evaluate the expression. Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type *Ty) { if (Constant *C = dyn_cast(V)) - return ConstantExpr::getCast(C, Ty); + return ConstantExpr::getIntegerCast(C, Ty, C->getType()->isSigned()); // Otherwise, it must be an instruction. Instruction *I = cast(V); @@ -5990,7 +5986,7 @@ // (X&4) == 2 --> false // (X&4) != 2 --> true Constant *Res = ConstantBool::get(isSetNE); - Res = ConstantExpr::getZeroExtend(Res, CI.getType()); + Res = ConstantExpr::getZExt(Res, CI.getType()); return ReplaceInstUsesWith(CI, Res); } @@ -6014,7 +6010,7 @@ if (CI.getType() == In->getType()) return ReplaceInstUsesWith(CI, In); else - return CastInst::createInferredCast(In, CI.getType()); + return CastInst::createIntegerCast(In, CI.getType(), false/*ZExt*/); } } } @@ -6090,9 +6086,6 @@ // If this is a cast of a cast if (CastInst *CSrc = dyn_cast(Src)) { // A->B->C cast - // If the operand of the ZEXT is a TRUNC then we are dealing with integral - // types and we can convert this to a logical AND if the sizes are just - // right. This will be much cheaper than the pair of casts. // If this is a TRUNC followed by a ZEXT then we are dealing with integral // types and if the sizes are just right we can convert this into a logical // 'and' which will be much cheaper than the pair of casts. @@ -6113,7 +6106,7 @@ if (And->getType() != CI.getType()) { And->setName(CSrc->getName()+".mask"); InsertNewInstBefore(And, CI); - And = CastInst::createInferredCast(And, CI.getType()); + And = CastInst::createIntegerCast(And, CI.getType(), false/*ZExt*/); } return And; } @@ -7770,7 +7763,7 @@ CI->getName(), LI.isVolatile()),LI); // Now cast the result of the load. - return CastInst::createInferredCast(NewLoad, LI.getType()); + return new BitCastInst(NewLoad, LI.getType()); } } } @@ -7950,13 +7943,20 @@ // the same size. Instead of casting the pointer before the store, cast // the value to be stored. Value *NewCast; - if (Constant *C = dyn_cast(SI.getOperand(0))) - NewCast = ConstantExpr::getCast(C, SrcPTy); + Instruction::CastOps opcode = Instruction::BitCast; + Value *SIOp0 = SI.getOperand(0); + if (SrcPTy->getTypeID() == Type::PointerTyID) { + if (SIOp0->getType()->isIntegral()) + opcode = Instruction::IntToPtr; + } else if (SrcPTy->isIntegral()) { + if (SIOp0->getType()->getTypeID() == Type::PointerTyID) + opcode = Instruction::PtrToInt; + } + if (Constant *C = dyn_cast(SIOp0)) + NewCast = ConstantExpr::getCast(opcode, C, SrcPTy); else NewCast = IC.InsertNewInstBefore( - CastInst::createInferredCast(SI.getOperand(0), SrcPTy, - SI.getOperand(0)->getName()+".c"), SI); - + CastInst::create(opcode, SIOp0, SrcPTy, SIOp0->getName()+".c"), SI); return new StoreInst(NewCast, CastOp); } } From reid at x10sys.com Tue Dec 12 17:36:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 17:36:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp Message-ID: <200612122336.kBCNaanu008787@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.113 -> 1.114 Constants.cpp updated: 1.186 -> 1.187 --- Log message: Replace inferred getCast(V,Ty) calls with more strict variants. Rename getZeroExtend and getSignExtend to getZExt and getSExt to match the the casting mnemonics in the rest of LLVM. --- Diffs of the changes: (+10 -11) ConstantFolding.cpp | 9 ++++----- Constants.cpp | 12 ++++++------ 2 files changed, 10 insertions(+), 11 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.113 llvm/lib/VMCore/ConstantFolding.cpp:1.114 --- llvm/lib/VMCore/ConstantFolding.cpp:1.113 Mon Dec 11 15:27:28 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Tue Dec 12 17:36:14 2006 @@ -743,8 +743,7 @@ (SrcEltTy->isFloatingPoint() && DstEltTy->isFloatingPoint())) { for (unsigned i = 0; i != SrcNumElts; ++i) Result.push_back( - ConstantExpr::getCast(Instruction::BitCast, CP->getOperand(i), - DstEltTy)); + ConstantExpr::getBitCast(CP->getOperand(i), DstEltTy)); return ConstantPacked::get(Result); } @@ -1148,11 +1147,11 @@ // Ok, we have two differing integer indices. Sign extend them to be the same // type. Long is always big enough, so we use it. if (C1->getType() != Type::LongTy && C1->getType() != Type::ULongTy) - C1 = ConstantExpr::getSignExtend(C1, Type::LongTy); + C1 = ConstantExpr::getSExt(C1, Type::LongTy); else C1 = ConstantExpr::getBitCast(C1, Type::LongTy); if (C2->getType() != Type::LongTy && C1->getType() != Type::ULongTy) - C2 = ConstantExpr::getSignExtend(C2, Type::LongTy); + C2 = ConstantExpr::getSExt(C2, Type::LongTy); else C2 = ConstantExpr::getBitCast(C2, Type::LongTy); @@ -1672,7 +1671,7 @@ R = ConstantExpr::getSExtOrBitCast(R, Idx0->getType()); R = ConstantExpr::getMul(R, Idx0); // signed multiply // R is a signed integer, C is the GEP pointer so -> IntToPtr - return ConstantExpr::getCast(Instruction::IntToPtr, R, C->getType()); + return ConstantExpr::getIntToPtr(R, C->getType()); } } } Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.186 llvm/lib/VMCore/Constants.cpp:1.187 --- llvm/lib/VMCore/Constants.cpp:1.186 Mon Dec 11 23:38:50 2006 +++ llvm/lib/VMCore/Constants.cpp Tue Dec 12 17:36:14 2006 @@ -1391,8 +1391,8 @@ case Instruction::PtrToInt: case Instruction::IntToPtr: case Instruction::BitCast: - New = ConstantExpr::getCast( - OldC->getOpcode(), OldC->getOperand(0), NewTy); + New = ConstantExpr::getCast(OldC->getOpcode(), OldC->getOperand(0), + NewTy); break; case Instruction::Select: New = ConstantExpr::getSelectTy(NewTy, OldC->getOperand(0), @@ -1464,8 +1464,8 @@ assert(0 && "Invalid cast opcode"); break; case Instruction::Trunc: return getTrunc(C, Ty); - case Instruction::ZExt: return getZeroExtend(C, Ty); - case Instruction::SExt: return getSignExtend(C, Ty); + case Instruction::ZExt: return getZExt(C, Ty); + case Instruction::SExt: return getSExt(C, Ty); case Instruction::FPTrunc: return getFPTrunc(C, Ty); case Instruction::FPExt: return getFPExtend(C, Ty); case Instruction::UIToFP: return getUIToFP(C, Ty); @@ -1547,7 +1547,7 @@ return getFoldedCast(Instruction::Trunc, C, Ty); } -Constant *ConstantExpr::getSignExtend(Constant *C, const Type *Ty) { +Constant *ConstantExpr::getSExt(Constant *C, const Type *Ty) { assert(C->getType()->isIntegral() && "SEXt operand must be integral"); assert(Ty->isInteger() && "SExt produces only integer"); assert(C->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()&& @@ -1556,7 +1556,7 @@ return getFoldedCast(Instruction::SExt, C, Ty); } -Constant *ConstantExpr::getZeroExtend(Constant *C, const Type *Ty) { +Constant *ConstantExpr::getZExt(Constant *C, const Type *Ty) { assert(C->getType()->isIntegral() && "ZEXt operand must be integral"); assert(Ty->isInteger() && "ZExt produces only integer"); assert(C->getType()->getPrimitiveSizeInBits() < Ty->getPrimitiveSizeInBits()&& From reid at x10sys.com Tue Dec 12 17:36:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 17:36:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200612122336.kBCNaaBp008798@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.78 -> 1.79 --- Log message: Replace inferred getCast(V,Ty) calls with more strict variants. Rename getZeroExtend and getSignExtend to getZExt and getSExt to match the the casting mnemonics in the rest of LLVM. --- Diffs of the changes: (+4 -5) GlobalOpt.cpp | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.78 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.79 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.78 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Tue Dec 12 17:36:14 2006 @@ -708,8 +708,8 @@ Constant *RepValue = NewGV; if (NewGV->getType() != GV->getType()->getElementType()) - RepValue = ConstantExpr::getCast(Instruction::BitCast, - RepValue, GV->getType()->getElementType()); + RepValue = ConstantExpr::getBitCast(RepValue, + GV->getType()->getElementType()); // If there is a comparison against null, we will insert a global bool to // keep track of whether the global was initialized yet or not. @@ -1058,8 +1058,7 @@ GV->getInitializer()->isNullValue()) { if (Constant *SOVC = dyn_cast(StoredOnceVal)) { if (GV->getInitializer()->getType() != SOVC->getType()) - SOVC = ConstantExpr::getCast(Instruction::BitCast, - SOVC, GV->getInitializer()->getType()); + SOVC = ConstantExpr::getBitCast(SOVC, GV->getInitializer()->getType()); // Optimize away any trapping uses of the loaded value. if (OptimizeAwayTrappingUsesOfLoads(GV, SOVC)) @@ -1510,7 +1509,7 @@ if (!GCL->use_empty()) { Constant *V = NGV; if (V->getType() != GCL->getType()) - V = ConstantExpr::getCast(Instruction::BitCast, V, GCL->getType()); + V = ConstantExpr::getBitCast(V, GCL->getType()); GCL->replaceAllUsesWith(V); } GCL->eraseFromParent(); From reid at x10sys.com Tue Dec 12 17:43:06 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 17:43:06 -0600 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/Vector/sumarray-dbl.c Message-ID: <200612122343.kBCNh6Ls009070@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/Vector: sumarray-dbl.c updated: 1.1 -> 1.2 --- Log message: Make this program return a consistent result value. --- Diffs of the changes: (+2 -1) sumarray-dbl.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm-test/SingleSource/UnitTests/Vector/sumarray-dbl.c diff -u llvm-test/SingleSource/UnitTests/Vector/sumarray-dbl.c:1.1 llvm-test/SingleSource/UnitTests/Vector/sumarray-dbl.c:1.2 --- llvm-test/SingleSource/UnitTests/Vector/sumarray-dbl.c:1.1 Thu Mar 30 20:11:46 2006 +++ llvm-test/SingleSource/UnitTests/Vector/sumarray-dbl.c Tue Dec 12 17:42:51 2006 @@ -7,7 +7,7 @@ union Array TheArray; -void main() { +int main() { int i; v8sd sum = { 0, 0, 0, 0, 0, 0, 0, 0}; D8V sumV; @@ -19,4 +19,5 @@ sumV.V = sum; printD8V(&sumV); + return 0; } From dpatel at apple.com Tue Dec 12 17:51:46 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 17:51:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612122351.kBCNpkHT009426@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.89 -> 1.90 --- Log message: Remove unused constructor. --- Diffs of the changes: (+0 -4) PassManager.cpp | 4 ---- 1 files changed, 4 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.89 llvm/lib/VMCore/PassManager.cpp:1.90 --- llvm/lib/VMCore/PassManager.cpp:1.89 Tue Dec 12 17:34:33 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 17:51:31 2006 @@ -901,10 +901,6 @@ // FunctionPassManager_New implementation /// Create new Function pass manager -FunctionPassManager_New::FunctionPassManager_New() { - FPM = new FunctionPassManagerImpl_New(0); -} - FunctionPassManager_New::FunctionPassManager_New(ModuleProvider *P) { FPM = new FunctionPassManagerImpl_New(0); // FPM is the top level manager. From dpatel at apple.com Tue Dec 12 18:09:43 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 18:09:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612130009.kBD09hDW009970@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.90 -> 1.91 --- Log message: Implement PassManager_New destructors. --- Diffs of the changes: (+27 -2) PassManager.cpp | 29 +++++++++++++++++++++++++++-- 1 files changed, 27 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.90 llvm/lib/VMCore/PassManager.cpp:1.91 --- llvm/lib/VMCore/PassManager.cpp:1.90 Tue Dec 12 17:51:31 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 18:09:23 2006 @@ -126,6 +126,15 @@ Pass *findAnalysisPass(AnalysisID AID); virtual ~PMTopLevelManager() { + + for (std::vector::iterator I = PassManagers.begin(), + E = PassManagers.end(); I != E; ++I) + delete *I; + + for (std::vector::iterator + I = ImmutablePasses.begin(), E = ImmutablePasses.end(); I != E; ++I) + delete *I; + PassManagers.clear(); } @@ -182,6 +191,15 @@ initializeAnalysisInfo(); } + virtual ~PMDataManager() { + + for (std::vector::iterator I = PassVector.begin(), + E = PassVector.end(); I != E; ++I) + delete *I; + + PassVector.clear(); + } + /// Return true IFF pass P's required analysis set does not required new /// manager. bool manageablePass(Pass *P); @@ -914,6 +932,10 @@ MP = P; } +FunctionPassManager_New::~FunctionPassManager_New() { + delete FPM; +} + /// add - Add a pass to the queue of passes to run. This passes /// ownership of the Pass to the PassManager. When the /// PassManager_X is destroyed, the pass will be destroyed as well, so @@ -1187,8 +1209,7 @@ //===----------------------------------------------------------------------===// // PassManagerImpl implementation - -// PassManager_New implementation +// /// Add P into active pass manager or use new module pass manager to /// manage it. bool PassManagerImpl_New::addPass(Pass *P) { @@ -1232,6 +1253,10 @@ PM->setTopLevelManager(PM); } +PassManager_New::~PassManager_New() { + delete PM; +} + /// add - Add a pass to the queue of passes to run. This passes ownership of /// the Pass to the PassManager. When the PassManager is destroyed, the pass /// will be destroyed as well, so there is no need to delete the pass. This From dpatel at apple.com Tue Dec 12 18:09:43 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 18:09:43 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200612130009.kBD09h7d009973@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.33 -> 1.34 --- Log message: Implement PassManager_New destructors. --- Diffs of the changes: (+2 -1) PassManager.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.33 llvm/include/llvm/PassManager.h:1.34 --- llvm/include/llvm/PassManager.h:1.33 Fri Dec 8 12:57:16 2006 +++ llvm/include/llvm/PassManager.h Tue Dec 12 18:09:23 2006 @@ -97,6 +97,7 @@ public: PassManager_New(); + ~PassManager_New(); /// add - Add a pass to the queue of passes to run. This passes ownership of /// the Pass to the PassManager. When the PassManager is destroyed, the pass @@ -121,7 +122,7 @@ public: FunctionPassManager_New(ModuleProvider *P); FunctionPassManager_New(); - ~FunctionPassManager_New() { /* TODO */ }; + ~FunctionPassManager_New(); /// add - Add a pass to the queue of passes to run. This passes /// ownership of the Pass to the PassManager. When the From dpatel at apple.com Tue Dec 12 18:23:59 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 18:23:59 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h PassAnalysisSupport.h Message-ID: <200612130023.kBD0NxBB010221@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.57 -> 1.58 PassAnalysisSupport.h updated: 1.23 -> 1.24 --- Log message: Move getAnalysis() and getAnalysisID() definitions from Pass.h to PassAnalysisSupport.h --- Diffs of the changes: (+43 -33) Pass.h | 36 +++--------------------------------- PassAnalysisSupport.h | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 33 deletions(-) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.57 llvm/include/llvm/Pass.h:1.58 --- llvm/include/llvm/Pass.h:1.57 Fri Dec 8 17:52:04 2006 +++ llvm/include/llvm/Pass.h Tue Dec 12 18:23:44 2006 @@ -173,41 +173,11 @@ /// getAnalysisUsage function. /// template - AnalysisType &getAnalysis() const { - assert(Resolver && "Pass has not been inserted into a PassManager object!"); - const PassInfo *PI = getClassPassInfo(); - return getAnalysisID(PI); - } + AnalysisType &getAnalysis() const; // Defined in PassAnalysisSupport.h template - AnalysisType &getAnalysisID(const PassInfo *PI) const { - assert(Resolver && "Pass has not been inserted into a PassManager object!"); - assert(PI && "getAnalysis for unregistered pass!"); - - // PI *must* appear in AnalysisImpls. Because the number of passes used - // should be a small number, we just do a linear search over a (dense) - // vector. - Pass *ResultPass = 0; - for (unsigned i = 0; ; ++i) { - assert(i != AnalysisImpls.size() && - "getAnalysis*() called on an analysis that was not " - "'required' by pass!"); - if (AnalysisImpls[i].first == PI) { - ResultPass = AnalysisImpls[i].second; - break; - } - } - - // Because the AnalysisType may not be a subclass of pass (for - // AnalysisGroups), we must use dynamic_cast here to potentially adjust the - // return pointer (because the class may multiply inherit, once from pass, - // once from AnalysisType). - // - AnalysisType *Result = dynamic_cast(ResultPass); - assert(Result && "Pass does not implement interface required!"); - return *Result; - } - + AnalysisType &getAnalysisID(const PassInfo *PI) const; + private: template friend class PassManagerT; friend class ModulePassManager; Index: llvm/include/llvm/PassAnalysisSupport.h diff -u llvm/include/llvm/PassAnalysisSupport.h:1.23 llvm/include/llvm/PassAnalysisSupport.h:1.24 --- llvm/include/llvm/PassAnalysisSupport.h:1.23 Fri Dec 8 17:28:54 2006 +++ llvm/include/llvm/PassAnalysisSupport.h Tue Dec 12 18:23:44 2006 @@ -195,6 +195,46 @@ return dynamic_cast(Resolver->getAnalysisToUpdate(PI)); } +/// getAnalysis() - This function is used by subclasses to get +/// to the analysis information that they claim to use by overriding the +/// getAnalysisUsage function. +/// +template +AnalysisType &Pass::getAnalysis() const { + assert(Resolver && "Pass has not been inserted into a PassManager object!"); + const PassInfo *PI = getClassPassInfo(); + return getAnalysisID(PI); +} + +template +AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const { + assert(Resolver && "Pass has not been inserted into a PassManager object!"); + assert(PI && "getAnalysis for unregistered pass!"); + + // PI *must* appear in AnalysisImpls. Because the number of passes used + // should be a small number, we just do a linear search over a (dense) + // vector. + Pass *ResultPass = 0; + for (unsigned i = 0; ; ++i) { + assert(i != AnalysisImpls.size() && + "getAnalysis*() called on an analysis that was not " + "'required' by pass!"); + if (AnalysisImpls[i].first == PI) { + ResultPass = AnalysisImpls[i].second; + break; + } + } + + // Because the AnalysisType may not be a subclass of pass (for + // AnalysisGroups), we must use dynamic_cast here to potentially adjust the + // return pointer (because the class may multiply inherit, once from pass, + // once from AnalysisType). + // + AnalysisType *Result = dynamic_cast(ResultPass); + assert(Result && "Pass does not implement interface required!"); + return *Result; +} + } // End llvm namespace #endif From dpatel at apple.com Tue Dec 12 18:34:47 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 18:34:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612130034.kBD0Ylc8010447@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.91 -> 1.92 --- Log message: FunctionPassManager does not support runOnModule(). --- Diffs of the changes: (+0 -7) PassManager.cpp | 7 ------- 1 files changed, 7 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.91 llvm/lib/VMCore/PassManager.cpp:1.92 --- llvm/lib/VMCore/PassManager.cpp:1.91 Tue Dec 12 18:09:23 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 18:34:32 2006 @@ -945,13 +945,6 @@ FPM->add(P); } -/// Execute all of the passes scheduled for execution. Keep -/// track of whether any of the passes modifies the function, and if -/// so, return true. -bool FunctionPassManager_New::runOnModule(Module &M) { - return FPM->runOnModule(M); -} - /// run - Execute all of the passes scheduled for execution. Keep /// track of whether any of the passes modifies the function, and if /// so, return true. From dpatel at apple.com Tue Dec 12 18:34:48 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 18:34:48 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200612130034.kBD0Ym75010452@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.34 -> 1.35 --- Log message: FunctionPassManager does not support runOnModule(). --- Diffs of the changes: (+0 -5) PassManager.h | 5 ----- 1 files changed, 5 deletions(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.34 llvm/include/llvm/PassManager.h:1.35 --- llvm/include/llvm/PassManager.h:1.34 Tue Dec 12 18:09:23 2006 +++ llvm/include/llvm/PassManager.h Tue Dec 12 18:34:32 2006 @@ -131,11 +131,6 @@ /// This implies that all passes MUST be allocated with 'new'. void add(Pass *P); - /// Execute all of the passes scheduled for execution. Keep - /// track of whether any of the passes modifies the function, and if - /// so, return true. - bool runOnModule(Module &M); - /// run - Execute all of the passes scheduled for execution. Keep /// track of whether any of the passes modifies the function, and if /// so, return true. From reid at x10sys.com Tue Dec 12 18:48:13 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 18:48:13 -0600 Subject: [llvm-commits] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Message-ID: <200612130048.kBD0mDc5010664@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/lib/compiler: StackerCompiler.cpp updated: 1.25 -> 1.26 --- Log message: Change createInferredCast calls to more accurate cast creation calls. --- Diffs of the changes: (+18 -14) StackerCompiler.cpp | 32 ++++++++++++++++++-------------- 1 files changed, 18 insertions(+), 14 deletions(-) Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.25 llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.26 --- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.25 Wed Dec 6 13:00:27 2006 +++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Tue Dec 12 18:47:58 2006 @@ -367,7 +367,7 @@ // Increment the loaded index value if ( ival == 0 ) ival = One; - CastInst* caster = CastInst::createInferredCast( ival, Type::LongTy ); + CastInst* caster = CastInst::createSExtOrBitCast( ival, Type::LongTy ); bb->getInstList().push_back( caster ); BinaryOperator* addop = BinaryOperator::create( Instruction::Add, loadop, caster); @@ -388,7 +388,7 @@ // Decrement the loaded index value if ( ival == 0 ) ival = One; - CastInst* caster = CastInst::createInferredCast( ival, Type::LongTy ); + CastInst* caster = CastInst::createSExtOrBitCast( ival, Type::LongTy ); bb->getInstList().push_back( caster ); BinaryOperator* subop = BinaryOperator::create( Instruction::Sub, loadop, caster); @@ -422,7 +422,7 @@ } else { - CastInst* caster = CastInst::createInferredCast( index, Type::LongTy ); + CastInst* caster = CastInst::createSExtOrBitCast( index, Type::LongTy ); bb->getInstList().push_back( caster ); BinaryOperator* subop = BinaryOperator::create( Instruction::Sub, loadop, caster ); @@ -448,7 +448,11 @@ get_stack_pointer( bb ) ); // Cast the value to a long .. hopefully it works - CastInst* cast_inst = CastInst::createInferredCast( val, Type::LongTy ); + Instruction::CastOps opcode = + (isa(val->getType()) ? Instruction::PtrToInt : + (val->getType()->getPrimitiveSizeInBits() < 64 ? Instruction::SExt : + Instruction::BitCast)); + CastInst* cast_inst = CastInst::create(opcode, val, Type::LongTy ); bb->getInstList().push_back( cast_inst ); // Store the value @@ -523,7 +527,7 @@ // Cast the integer to a sbyte* CastInst* caster = - CastInst::createInferredCast( loader, PointerType::get(Type::SByteTy) ); + new IntToPtrInst(loader, PointerType::get(Type::SByteTy)); bb->getInstList().push_back( caster ); // Decrement stack index @@ -576,7 +580,7 @@ // Cast the integer to a sbyte* CastInst* caster = - CastInst::createInferredCast( loader, PointerType::get(Type::SByteTy) ); + new IntToPtrInst(loader, PointerType::get(Type::SByteTy) ); bb->getInstList().push_back( caster ); // Return the value @@ -1245,7 +1249,7 @@ if (echo) bb->setName("SHL"); LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); - CastInst* castop = CastInst::createInferredCast( op1, Type::UByteTy ); + CastInst* castop = new TruncInst( op1, Type::UByteTy ); bb->getInstList().push_back( castop ); ShiftInst* shlop = new ShiftInst( Instruction::Shl, op2, castop ); bb->getInstList().push_back( shlop ); @@ -1257,7 +1261,7 @@ if (echo) bb->setName("SHR"); LoadInst* op1 = cast(pop_integer(bb)); LoadInst* op2 = cast(pop_integer(bb)); - CastInst* castop = CastInst::createInferredCast( op1, Type::UByteTy ); + CastInst* castop = new TruncInst( op1, Type::UByteTy ); bb->getInstList().push_back( castop ); ShiftInst* shrop = new ShiftInst( Instruction::AShr, op2, castop ); bb->getInstList().push_back( shrop ); @@ -1479,7 +1483,7 @@ LoadInst* op1 = cast( pop_integer(bb) ); // Make sure its a UIntTy - CastInst* caster = CastInst::createInferredCast( op1, Type::UIntTy ); + CastInst* caster = CastInst::createTruncOrBitCast( op1, Type::UIntTy ); bb->getInstList().push_back( caster ); // Allocate the bytes @@ -1507,7 +1511,7 @@ if (echo) bb->setName("GET"); // Get the character index LoadInst* op1 = cast( stack_top(bb) ); - CastInst* chr_idx = CastInst::createInferredCast( op1, Type::LongTy ); + CastInst* chr_idx = CastInst::createSExtOrBitCast( op1, Type::LongTy ); bb->getInstList().push_back( chr_idx ); // Get the String pointer @@ -1522,7 +1526,7 @@ // Get the value and push it LoadInst* loader = new LoadInst( gep ); bb->getInstList().push_back( loader ); - CastInst* caster = CastInst::createInferredCast( loader, Type::IntTy ); + CastInst* caster = CastInst::createTruncOrBitCast(loader, Type::IntTy); bb->getInstList().push_back( caster ); // Push the result back on stack @@ -1539,7 +1543,7 @@ // Get the character index LoadInst* w2 = cast( pop_integer(bb) ); - CastInst* chr_idx = CastInst::createInferredCast( w2, Type::LongTy ); + CastInst* chr_idx = CastInst::createSExtOrBitCast( w2, Type::LongTy ); bb->getInstList().push_back( chr_idx ); // Get the String pointer @@ -1552,7 +1556,7 @@ bb->getInstList().push_back( gep ); // Cast the value and put it - CastInst* caster = CastInst::createInferredCast( w1, Type::SByteTy ); + CastInst* caster = new TruncInst( w1, Type::SByteTy ); bb->getInstList().push_back( caster ); StoreInst* storer = new StoreInst( caster, gep ); bb->getInstList().push_back( storer ); @@ -1580,7 +1584,7 @@ LoadInst* op1 = cast(pop_integer(bb)); // Cast down to an integer - CastInst* caster = CastInst::createInferredCast( op1, Type::IntTy ); + CastInst* caster = new TruncInst( op1, Type::IntTy ); bb->getInstList().push_back( caster ); // Call exit(3) From reid at x10sys.com Tue Dec 12 18:50:42 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 18:50:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/IndMemRemoval.cpp RaiseAllocations.cpp SimplifyLibCalls.cpp Message-ID: <200612130050.kBD0og06010755@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: IndMemRemoval.cpp updated: 1.7 -> 1.8 RaiseAllocations.cpp updated: 1.32 -> 1.33 SimplifyLibCalls.cpp updated: 1.74 -> 1.75 --- Log message: Replace CastInst::createInferredCast calls with more accurate cast creation calls. --- Diffs of the changes: (+35 -32) IndMemRemoval.cpp | 4 +-- RaiseAllocations.cpp | 8 +++---- SimplifyLibCalls.cpp | 55 ++++++++++++++++++++++++++------------------------- 3 files changed, 35 insertions(+), 32 deletions(-) Index: llvm/lib/Transforms/IPO/IndMemRemoval.cpp diff -u llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.7 llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.8 --- llvm/lib/Transforms/IPO/IndMemRemoval.cpp:1.7 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/IndMemRemoval.cpp Tue Dec 12 18:50:17 2006 @@ -74,8 +74,8 @@ GlobalValue::LinkOnceLinkage, "malloc_llvm_bounce", &M); BasicBlock* bb = new BasicBlock("entry",FN); - Instruction* c = - CastInst::createInferredCast(FN->arg_begin(), Type::UIntTy, "c", bb); + Instruction* c = CastInst::createIntegerCast( + FN->arg_begin(), Type::UIntTy, false, "c", bb); Instruction* a = new MallocInst(Type::SByteTy, c, "m", bb); new ReturnInst(a, bb); ++NumBounce; Index: llvm/lib/Transforms/IPO/RaiseAllocations.cpp diff -u llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.32 llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.33 --- llvm/lib/Transforms/IPO/RaiseAllocations.cpp:1.32 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/RaiseAllocations.cpp Tue Dec 12 18:50:17 2006 @@ -141,8 +141,8 @@ // source size. if (Source->getType() != Type::UIntTy) Source = - CastInst::createInferredCast(Source, Type::UIntTy, - "MallocAmtCast", I); + CastInst::createIntegerCast(Source, Type::UIntTy, false/*ZExt*/, + "MallocAmtCast", I); std::string Name(I->getName()); I->setName(""); MallocInst *MI = new MallocInst(Type::SByteTy, Source, Name, I); @@ -193,8 +193,8 @@ // Value *Source = *CS.arg_begin(); if (!isa(Source->getType())) - Source = CastInst::createInferredCast( - Source, PointerType::get(Type::SByteTy), "FreePtrCast", I); + Source = new IntToPtrInst(Source, PointerType::get(Type::SByteTy), + "FreePtrCast", I); new FreeInst(Source, I); // If the old instruction was an invoke, add an unconditional branch Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.74 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.75 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.74 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Tue Dec 12 18:50:17 2006 @@ -1009,7 +1009,8 @@ Value *S2V = new LoadInst(Op2Cast, RHS->getName()+".val", CI); Value *RV = BinaryOperator::createSub(S1V, S2V, CI->getName()+".diff",CI); if (RV->getType() != CI->getType()) - RV = CastInst::createInferredCast(RV, CI->getType(), RV->getName(), CI); + RV = CastInst::createIntegerCast(RV, CI->getType(), false, + RV->getName(), CI); CI->replaceAllUsesWith(RV); CI->eraseFromParent(); return true; @@ -1037,8 +1038,8 @@ CI->getName()+".d1", CI); Value *Or = BinaryOperator::createOr(D1, D2, CI->getName()+".res", CI); if (Or->getType() != CI->getType()) - Or = CastInst::createInferredCast(Or, CI->getType(), Or->getName(), - CI); + Or = CastInst::createIntegerCast(Or, CI->getType(), false /*ZExt*/, + Or->getName(), CI); CI->replaceAllUsesWith(Or); CI->eraseFromParent(); return true; @@ -1222,8 +1223,8 @@ } // Cast dest to the right sized primitive and then load/store - CastInst* DestCast = CastInst::createInferredCast( - dest, PointerType::get(castType), dest->getName()+".cast", ci); + CastInst* DestCast = new BitCastInst(dest, PointerType::get(castType), + dest->getName()+".cast", ci); new StoreInst(ConstantInt::get(castType,fill_value),DestCast, ci); ci->eraseFromParent(); return true; @@ -1365,7 +1366,7 @@ Function* putchar_func = SLC.get_putchar(); if (!putchar_func) return false; - CastInst* cast = CastInst::createInferredCast( + CastInst* cast = CastInst::createSExtOrBitCast( ci->getOperand(2), Type::IntTy, CI->getName()+".int", ci); new CallInst(putchar_func, cast, "", ci); ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy, 1)); @@ -1499,7 +1500,7 @@ Function* fputc_func = SLC.get_fputc(FILEptr_type); if (!fputc_func) return false; - CastInst* cast = CastInst::createInferredCast( + CastInst* cast = CastInst::createSExtOrBitCast( ci->getOperand(3), Type::IntTy, CI->getName()+".int", ci); new CallInst(fputc_func,cast,ci->getOperand(1),"",ci); ci->replaceAllUsesWith(ConstantInt::get(Type::IntTy,1)); @@ -1606,8 +1607,8 @@ ConstantInt::get(Len->getType(), 1), Len->getName()+"1", ci); if (Len1->getType() != SLC.getIntPtrType()) - Len1 = CastInst::createInferredCast( - Len1, SLC.getIntPtrType(), Len1->getName(), ci); + Len1 = CastInst::createIntegerCast(Len1, SLC.getIntPtrType(), false, + Len1->getName(), ci); std::vector args; args.push_back(CastToCStr(ci->getOperand(1), *ci)); args.push_back(CastToCStr(ci->getOperand(3), *ci)); @@ -1618,8 +1619,8 @@ // The strlen result is the unincremented number of bytes in the string. if (!ci->use_empty()) { if (Len->getType() != ci->getType()) - Len = CastInst::createInferredCast( - Len, ci->getType(), Len->getName(), ci); + Len = CastInst::createIntegerCast(Len, ci->getType(), false, + Len->getName(), ci); ci->replaceAllUsesWith(Len); } ci->eraseFromParent(); @@ -1627,7 +1628,7 @@ } case 'c': { // sprintf(dest,"%c",chr) -> store chr, dest - CastInst* cast = CastInst::createInferredCast( + CastInst* cast = CastInst::createTruncOrBitCast( ci->getOperand(3), Type::SByteTy, "char", ci); new StoreInst(cast, ci->getOperand(1), ci); GetElementPtrInst* gep = new GetElementPtrInst(ci->getOperand(1), @@ -1684,8 +1685,8 @@ return false; LoadInst* loadi = new LoadInst(ci->getOperand(1), ci->getOperand(1)->getName()+".byte",ci); - CastInst* casti = CastInst::createInferredCast( - loadi, Type::IntTy, loadi->getName()+".int", ci); + CastInst* casti = new SExtInst(loadi, Type::IntTy, + loadi->getName()+".int", ci); new CallInst(fputc_func,casti,ci->getOperand(2),"",ci); break; } @@ -1738,16 +1739,16 @@ } // isdigit(c) -> (unsigned)c - '0' <= 9 - CastInst* cast = CastInst::createInferredCast(ci->getOperand(1), - Type::UIntTy, ci->getOperand(1)->getName()+".uint", ci); + CastInst* cast = CastInst::createIntegerCast(ci->getOperand(1), + Type::UIntTy, false/*ZExt*/, ci->getOperand(1)->getName()+".uint", ci); BinaryOperator* sub_inst = BinaryOperator::createSub(cast, ConstantInt::get(Type::UIntTy,0x30), ci->getOperand(1)->getName()+".sub",ci); SetCondInst* setcond_inst = new SetCondInst(Instruction::SetLE,sub_inst, ConstantInt::get(Type::UIntTy,9), ci->getOperand(1)->getName()+".cmp",ci); - CastInst* c2 = CastInst::createInferredCast( - setcond_inst, Type::IntTy, ci->getOperand(1)->getName()+".isdigit", ci); + CastInst* c2 = new SExtInst(setcond_inst, Type::IntTy, + ci->getOperand(1)->getName()+".isdigit", ci); ci->replaceAllUsesWith(c2); ci->eraseFromParent(); return true; @@ -1769,14 +1770,13 @@ // isascii(c) -> (unsigned)c < 128 Value *V = CI->getOperand(1); if (V->getType()->isSigned()) - V = CastInst::createInferredCast(V, V->getType()->getUnsignedVersion(), - V->getName(), CI); + V = new BitCastInst(V, V->getType()->getUnsignedVersion(), V->getName(), + CI); Value *Cmp = BinaryOperator::createSetLT(V, ConstantInt::get(V->getType(), 128), V->getName()+".isascii", CI); if (Cmp->getType() != CI->getType()) - Cmp = CastInst::createInferredCast( - Cmp, CI->getType(), Cmp->getName(), CI); + Cmp = new BitCastInst(Cmp, CI->getType(), Cmp->getName(), CI); CI->replaceAllUsesWith(Cmp); CI->eraseFromParent(); return true; @@ -1870,10 +1870,11 @@ Function *F = SLC.getModule()->getOrInsertFunction(CTTZName, ArgType, ArgType, NULL); - Value *V = CastInst::createInferredCast( - TheCall->getOperand(1), ArgType, "tmp", TheCall); + Value *V = CastInst::createIntegerCast(TheCall->getOperand(1), ArgType, + false/*ZExt*/, "tmp", TheCall); Value *V2 = new CallInst(F, V, "tmp", TheCall); - V2 = CastInst::createInferredCast(V2, Type::IntTy, "tmp", TheCall); + V2 = CastInst::createIntegerCast(V2, Type::IntTy, true/*SExt*/, + "tmp", TheCall); V2 = BinaryOperator::createAdd(V2, ConstantInt::get(Type::IntTy, 1), "tmp", TheCall); Value *Cond = @@ -2116,9 +2117,11 @@ /// inserting the cast before IP, and return the cast. /// @brief Cast a value to a "C" string. Value *CastToCStr(Value *V, Instruction &IP) { + assert(V->getType()->getTypeID() == Type::PointerTyID && + "Can't cast non-pointer type to C string type"); const Type *SBPTy = PointerType::get(Type::SByteTy); if (V->getType() != SBPTy) - return CastInst::createInferredCast(V, SBPTy, V->getName(), &IP); + return new BitCastInst(V, SBPTy, V->getName(), &IP); return V; } From reid at x10sys.com Tue Dec 12 18:50:43 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 18:50:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/LevelRaise.cpp Message-ID: <200612130050.kBD0ohFj010768@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: LevelRaise.cpp updated: 1.114 -> 1.115 --- Log message: Replace CastInst::createInferredCast calls with more accurate cast creation calls. --- Diffs of the changes: (+2 -2) LevelRaise.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/LevelRaise.cpp diff -u llvm/lib/Transforms/LevelRaise.cpp:1.114 llvm/lib/Transforms/LevelRaise.cpp:1.115 --- llvm/lib/Transforms/LevelRaise.cpp:1.114 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/LevelRaise.cpp Tue Dec 12 18:50:17 2006 @@ -258,8 +258,8 @@ // The existing and new operand 0 types are different so we must // replace CI with a new CastInst so that we are assured to // get the correct cast opcode. - CastInst *NewCI = CastInst::createInferredCast( - GEP, CI->getType(), CI->getName(), CI); + CastInst *NewCI = new BitCastInst(GEP, CI->getType(), + CI->getName(), CI); CI->replaceAllUsesWith(NewCI); CI->eraseFromParent(); CI = NewCI; From reid at x10sys.com Tue Dec 12 18:50:41 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 18:50:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LowerGC.cpp Message-ID: <200612130050.kBD0ofPi010746@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LowerGC.cpp updated: 1.15 -> 1.16 --- Log message: Replace CastInst::createInferredCast calls with more accurate cast creation calls. --- Diffs of the changes: (+1 -2) LowerGC.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/LowerGC.cpp diff -u llvm/lib/Transforms/Scalar/LowerGC.cpp:1.15 llvm/lib/Transforms/Scalar/LowerGC.cpp:1.16 --- llvm/lib/Transforms/Scalar/LowerGC.cpp:1.15 Sun Nov 26 19:05:10 2006 +++ llvm/lib/Transforms/Scalar/LowerGC.cpp Tue Dec 12 18:50:17 2006 @@ -146,8 +146,7 @@ if (Constant *C = dyn_cast(I->getOperand(OpNum))) I->setOperand(OpNum, ConstantExpr::getBitCast(C, Ty)); else { - CastInst *CI = - CastInst::createInferredCast(I->getOperand(OpNum), Ty, "", I); + CastInst *CI = new BitCastInst(I->getOperand(OpNum), Ty, "", I); I->setOperand(OpNum, CI); } } From reid at x10sys.com Tue Dec 12 18:50:43 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 18:50:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp TraceValues.cpp Message-ID: <200612130050.kBD0ohnG010778@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Instrumentation: ProfilingUtils.cpp updated: 1.9 -> 1.10 TraceValues.cpp updated: 1.77 -> 1.78 --- Log message: Replace CastInst::createInferredCast calls with more accurate cast creation calls. --- Diffs of the changes: (+3 -2) ProfilingUtils.cpp | 1 + TraceValues.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp diff -u llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.9 llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.10 --- llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp:1.9 Sun Nov 26 19:05:10 2006 +++ llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp Tue Dec 12 18:50:17 2006 @@ -67,6 +67,7 @@ } else { InitCall->setOperand(2, AI); } + /* FALL THROUGH */ case 1: AI = MainFn->arg_begin(); Index: llvm/lib/Transforms/Instrumentation/TraceValues.cpp diff -u llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.77 llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.78 --- llvm/lib/Transforms/Instrumentation/TraceValues.cpp:1.77 Sun Nov 26 19:05:10 2006 +++ llvm/lib/Transforms/Instrumentation/TraceValues.cpp Tue Dec 12 18:50:17 2006 @@ -281,7 +281,7 @@ const Type *SBP = PointerType::get(Type::SByteTy); if (V->getType() != SBP) // Cast pointer to be sbyte* - V = CastInst::createInferredCast(V, SBP, "RPSN_cast", InsertBefore); + V = new BitCastInst(V, SBP, "RPSN_cast", InsertBefore); std::vector releaseArgs(1, V); new CallInst(ReleasePtrFunc, releaseArgs, "", InsertBefore); @@ -293,7 +293,7 @@ Function* RecordPtrFunc) { const Type *SBP = PointerType::get(Type::SByteTy); if (V->getType() != SBP) // Cast pointer to be sbyte* - V = CastInst::createInferredCast(V, SBP, "RP_cast", InsertBefore); + V = new BitCastInst(V, SBP, "RP_cast", InsertBefore); std::vector releaseArgs(1, V); new CallInst(RecordPtrFunc, releaseArgs, "", InsertBefore); From reid at x10sys.com Tue Dec 12 18:50:43 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 18:50:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerAllocations.cpp Message-ID: <200612130050.kBD0ohbI010760@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: LowerAllocations.cpp updated: 1.66 -> 1.67 --- Log message: Replace CastInst::createInferredCast calls with more accurate cast creation calls. --- Diffs of the changes: (+8 -9) LowerAllocations.cpp | 17 ++++++++--------- 1 files changed, 8 insertions(+), 9 deletions(-) Index: llvm/lib/Transforms/Utils/LowerAllocations.cpp diff -u llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.66 llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.67 --- llvm/lib/Transforms/Utils/LowerAllocations.cpp:1.66 Tue Dec 12 03:17:08 2006 +++ llvm/lib/Transforms/Utils/LowerAllocations.cpp Tue Dec 12 18:50:17 2006 @@ -135,7 +135,8 @@ } else { Value *Scale = MI->getOperand(0); if (Scale->getType() != IntPtrTy) - Scale = CastInst::createInferredCast(Scale, IntPtrTy, "", I); + Scale = CastInst::createIntegerCast(Scale, IntPtrTy, false /*ZExt*/, + "", I); // Multiply it by the array size if necessary... MallocArg = BinaryOperator::create(Instruction::Mul, Scale, @@ -149,13 +150,12 @@ if (MallocFTy->getNumParams() > 0 || MallocFTy->isVarArg()) { if (MallocFTy->isVarArg()) { if (MallocArg->getType() != IntPtrTy) - MallocArg = CastInst::createInferredCast(MallocArg, IntPtrTy, "", - I); + MallocArg = CastInst::createIntegerCast(MallocArg, IntPtrTy, + false /*ZExt*/, "", I); } else if (MallocFTy->getNumParams() > 0 && MallocFTy->getParamType(0) != Type::UIntTy) - MallocArg = - CastInst::createInferredCast(MallocArg, MallocFTy->getParamType(0), - "",I); + MallocArg = CastInst::createIntegerCast( + MallocArg, MallocFTy->getParamType(0), false/*ZExt*/, "",I); MallocArgs.push_back(MallocArg); } @@ -170,7 +170,7 @@ // Create a cast instruction to convert to the right type... Value *MCast; if (MCall->getType() != Type::VoidTy) - MCast = CastInst::createInferredCast(MCall, MI->getType(), "", I); + MCast = new BitCastInst(MCall, MI->getType(), "", I); else MCast = Constant::getNullValue(MI->getType()); @@ -187,8 +187,7 @@ Value *MCast = FI->getOperand(0); if (FreeFTy->getNumParams() > 0 && FreeFTy->getParamType(0) != MCast->getType()) - MCast = CastInst::createInferredCast(MCast, FreeFTy->getParamType(0), - "", I); + MCast = new BitCastInst(MCast, FreeFTy->getParamType(0), "", I); FreeArgs.push_back(MCast); } From reid at x10sys.com Tue Dec 12 18:50:43 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 12 Dec 2006 18:50:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200612130050.kBD0ohOx010765@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.329 -> 1.330 --- Log message: Replace CastInst::createInferredCast calls with more accurate cast creation calls. --- Diffs of the changes: (+5 -5) SelectionDAGISel.cpp | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.329 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.330 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.329 Tue Dec 12 15:21:32 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Dec 12 18:50:17 2006 @@ -3519,8 +3519,8 @@ while (isa(InsertPt)) ++InsertPt; InsertedCast = - CastInst::createInferredCast(CI->getOperand(0), CI->getType(), "", - InsertPt); + CastInst::create(CI->getOpcode(), CI->getOperand(0), CI->getType(), "", + InsertPt); MadeChange = true; } @@ -3559,8 +3559,8 @@ // operand). if (CastInst *CI = dyn_cast(Ptr)) if (CI->getParent() != BB && isa(CI->getOperand(0)->getType())) - Ptr = CastInst::createInferredCast(CI->getOperand(0), CI->getType(), "", - InsertPt); + Ptr = CastInst::create(CI->getOpcode(), CI->getOperand(0), CI->getType(), + "", InsertPt); // Add the offset, cast it to the right type. Ptr = BinaryOperator::createAdd(Ptr, PtrOffset, "", InsertPt); @@ -3702,7 +3702,7 @@ // Ptr = Ptr + Idx * ElementSize; // Cast Idx to UIntPtrTy if needed. - Idx = CastInst::createInferredCast(Idx, UIntPtrTy, "", GEPI); + Idx = CastInst::createIntegerCast(Idx, UIntPtrTy, true/*SExt*/, "", GEPI); uint64_t ElementSize = TD->getTypeSize(Ty); // Mask off bits that should not be set. From sabre at nondot.org Tue Dec 12 19:15:33 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 12 Dec 2006 19:15:33 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.config.in Message-ID: <200612130115.kBD1FXa7011161@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.config.in updated: 1.70 -> 1.71 --- Log message: Fix a regression that completely broke make install. Instead of installing into /usr/local/bin it would install into /usr/localbin --- Diffs of the changes: (+8 -8) Makefile.config.in | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/Makefile.config.in diff -u llvm/Makefile.config.in:1.70 llvm/Makefile.config.in:1.71 --- llvm/Makefile.config.in:1.70 Sat Dec 9 22:09:19 2006 +++ llvm/Makefile.config.in Tue Dec 12 19:15:18 2006 @@ -49,14 +49,14 @@ PROJ_SRC_DIR := $(shell cd $(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)); $(PWD)) DESTDIR := @prefix@ PROJ_prefix := $(DESTDIR) -PROJ_bindir := $(DESTDIR)bin -PROJ_libdir := $(DESTDIR)lib -PROJ_datadir := $(DESTDIR)share -PROJ_docsdir := $(DESTDIR)docs/llvm -PROJ_etcdir := $(DESTDIR)etc/llvm -PROJ_includedir := $(DESTDIR)include -PROJ_infodir := $(DESTDIR)info -PROJ_mandir := $(DESTDIR)man +PROJ_bindir := $(DESTDIR)/bin +PROJ_libdir := $(DESTDIR)/lib +PROJ_datadir := $(DESTDIR)/share +PROJ_docsdir := $(DESTDIR)/docs/llvm +PROJ_etcdir := $(DESTDIR)/etc/llvm +PROJ_includedir := $(DESTDIR)/include +PROJ_infodir := $(DESTDIR)/info +PROJ_mandir := $(DESTDIR)/man PROJ_VERSION := $(LLVMVersion) else ifndef PROJ_SRC_ROOT From evan.cheng at apple.com Tue Dec 12 19:58:10 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 12 Dec 2006 19:58:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612130158.kBD1wAXw011821@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.436 -> 1.437 --- Log message: Expand f32 / f64 to i32 / i64 conversion to soft-fp library calls. --- Diffs of the changes: (+23 -2) LegalizeDAG.cpp | 25 +++++++++++++++++++++++-- 1 files changed, 23 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.436 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.437 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.436 Tue Dec 12 16:19:28 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 12 19:57:55 2006 @@ -2860,8 +2860,29 @@ break; } break; - case Expand: - assert(0 && "Shouldn't need to expand other operators here!"); + case Expand: { + // Convert f32 / f64 to i32 / i64. + MVT::ValueType VT = Op.getValueType(); + const char *FnName = 0; + switch (Node->getOpcode()) { + case ISD::FP_TO_SINT: + if (Node->getOperand(0).getValueType() == MVT::f32) + FnName = (VT == MVT::i32) ? "__fixsfsi" : "__fixsfdi"; + else + FnName = (VT == MVT::i32) ? "__fixdfsi" : "__fixdfdi"; + break; + case ISD::FP_TO_UINT: + if (Node->getOperand(0).getValueType() == MVT::f32) + FnName = (VT == MVT::i32) ? "__fixunssfsi" : "__fixunssfdi"; + else + FnName = (VT == MVT::i32) ? "__fixunsdfsi" : "__fixunsdfdi"; + break; + default: assert(0 && "Unreachable!"); + } + SDOperand Dummy; + Result = ExpandLibCall(FnName, Node, Dummy); + break; + } case Promote: Tmp1 = PromoteOp(Node->getOperand(0)); Result = DAG.UpdateNodeOperands(Result, LegalizeOp(Tmp1)); From sabre at nondot.org Tue Dec 12 20:27:00 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 12 Dec 2006 20:27:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200612130227.kBD2R0NQ012387@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ScalarReplAggregates.cpp updated: 1.56 -> 1.57 --- Log message: revert my recent int<->fp and vector union promotion changes, they expose obscure bugs affecting the X86 code generator. I will reenable this when fixed. --- Diffs of the changes: (+53 -132) ScalarReplAggregates.cpp | 185 +++++++++++++---------------------------------- 1 files changed, 53 insertions(+), 132 deletions(-) Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.56 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.57 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.56 Mon Dec 11 22:24:41 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Dec 12 20:26:45 2006 @@ -419,64 +419,39 @@ /// types are incompatible, return true, otherwise update Accum and return /// false. /// -/// There are three cases we handle here: -/// 1) An effectively-integer union, where the pieces are stored into as +/// There are two cases we handle here: +/// 1) An effectively integer union, where the pieces are stored into as /// smaller integers (common with byte swap and other idioms). -/// 2) A union of vector types of the same size and potentially its elements. -/// Here we turn element accesses into insert/extract element operations. -/// 3) A union of scalar types, such as int/float or int/pointer. Here we -/// merge together into integers, allowing the xform to work with #1 as -/// well. +/// 2) A union of a vector and its elements. Here we turn element accesses +/// into insert/extract element operations. static bool MergeInType(const Type *In, const Type *&Accum, const TargetData &TD) { // If this is our first type, just use it. const PackedType *PTy; if (Accum == Type::VoidTy || In == Accum) { Accum = In; - } else if (In == Type::VoidTy) { - // Noop. } else if (In->isIntegral() && Accum->isIntegral()) { // integer union. // Otherwise pick whichever type is larger. if (In->getTypeID() > Accum->getTypeID()) Accum = In; } else if (isa(In) && isa(Accum)) { // Pointer unions just stay as one of the pointers. - } else if (isa(In) || isa(Accum)) { - if ((PTy = dyn_cast(Accum)) && - PTy->getElementType() == In) { - // Accum is a vector, and we are accessing an element: ok. - } else if ((PTy = dyn_cast(In)) && - PTy->getElementType() == Accum) { - // In is a vector, and accum is an element: ok, remember In. - Accum = In; - } else if ((PTy = dyn_cast(In)) && isa(Accum) && - PTy->getBitWidth() == cast(Accum)->getBitWidth()) { - // Two vectors of the same size: keep Accum. - } else { - // Cannot insert an short into a <4 x int> or handle - // <2 x int> -> <4 x int> - return true; - } - } else { - // Pointer/FP/Integer unions merge together as integers. - switch (Accum->getTypeID()) { - case Type::PointerTyID: Accum = TD.getIntPtrType(); break; - case Type::FloatTyID: Accum = Type::UIntTy; break; - case Type::DoubleTyID: Accum = Type::ULongTy; break; - default: - assert(Accum->isIntegral() && "Unknown FP type!"); - break; - } - - switch (In->getTypeID()) { - case Type::PointerTyID: In = TD.getIntPtrType(); break; - case Type::FloatTyID: In = Type::UIntTy; break; - case Type::DoubleTyID: In = Type::ULongTy; break; - default: - assert(In->isIntegral() && "Unknown FP type!"); - break; - } + } else if ((PTy = dyn_cast(Accum)) && + PTy->getElementType() == In) { + // Accum is a vector, and we are accessing an element: ok. + } else if ((PTy = dyn_cast(In)) && + PTy->getElementType() == Accum) { + // In is a vector, and accum is an element: ok, remember In. + Accum = In; + } else if (isa(In) && Accum->isIntegral()) { + // Pointer/Integer unions merge together as integers. + return MergeInType(TD.getIntPtrType(), Accum, TD); + } else if (isa(Accum) && In->isIntegral()) { + // Pointer/Integer unions merge together as integers. + Accum = TD.getIntPtrType(); return MergeInType(In, Accum, TD); + } else { + return true; } return false; } @@ -518,7 +493,8 @@ if (MergeInType(SI->getOperand(0)->getType(), UsedType, TD)) return 0; - } else if (BitCastInst *CI = dyn_cast(User)) { + } else if (CastInst *CI = dyn_cast(User)) { + if (!isa(CI->getType())) return 0; IsNotTrivial = true; const Type *SubTy = CanConvertToScalar(CI, IsNotTrivial); if (!SubTy || MergeInType(SubTy, UsedType, TD)) return 0; @@ -632,54 +608,24 @@ Value *NV = new LoadInst(NewAI, LI->getName(), LI); if (NV->getType() != LI->getType()) { if (const PackedType *PTy = dyn_cast(NV->getType())) { - // If the result alloca is a packed type, this is either an element - // access or a bitcast to another packed type. - if (isa(LI->getType())) { - NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI); - } else { - // Must be an element access. - unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); - NV = new ExtractElementInst(NV, ConstantInt::get(Type::UIntTy, Elt), - "tmp", LI); - } - } else if (isa(NV->getType())) { - assert(isa(LI->getType())); - // Must be ptr->ptr cast. Anything else would result in NV being - // an integer. - NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI); + // Must be an element access. + unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); + NV = new ExtractElementInst(NV, ConstantInt::get(Type::UIntTy, Elt), + "tmp", LI); } else { - assert(NV->getType()->isInteger() && "Unknown promotion!"); - if (Offset && Offset < TD.getTypeSize(NV->getType())*8) { - NV = new ShiftInst(Instruction::LShr, NV, - ConstantInt::get(Type::UByteTy, Offset), - LI->getName(), LI); - } - - // If the result is an integer, this is a trunc or bitcast. - if (LI->getType()->isIntegral()) { - NV = CastInst::createTruncOrBitCast(NV, LI->getType(), - LI->getName(), LI); - } else if (LI->getType()->isFloatingPoint()) { - // If needed, truncate the integer to the appropriate size. - if (NV->getType()->getPrimitiveSize() > - LI->getType()->getPrimitiveSize()) { - switch (LI->getType()->getTypeID()) { - default: assert(0 && "Unknown FP type!"); - case Type::FloatTyID: - NV = new TruncInst(NV, Type::UIntTy, LI->getName(), LI); - break; - case Type::DoubleTyID: - NV = new TruncInst(NV, Type::ULongTy, LI->getName(), LI); - break; - } + if (Offset) { + assert(NV->getType()->isInteger() && "Unknown promotion!"); + if (Offset < TD.getTypeSize(NV->getType())*8) { + NV = new ShiftInst(Instruction::LShr, NV, + ConstantInt::get(Type::UByteTy, Offset), + LI->getName(), LI); } - - // Then do a bitcast. - NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI); } else { - // Otherwise must be a pointer. - NV = new IntToPtrInst(NV, LI->getType(), LI->getName(), LI); + assert((NV->getType()->isInteger() || + isa(NV->getType())) && "Unknown promotion!"); } + NV = CastInst::createInferredCast(NV, LI->getType(), LI->getName(), + LI); } } LI->replaceAllUsesWith(NV); @@ -695,55 +641,30 @@ Value *Old = new LoadInst(NewAI, NewAI->getName()+".in", SI); if (const PackedType *PTy = dyn_cast(AllocaType)) { - // If the result alloca is a packed type, this is either an element - // access or a bitcast to another packed type. - if (isa(SV->getType())) { - SV = new BitCastInst(SV, AllocaType, SV->getName(), SI); - } else { - // Must be an element insertion. - unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); - SV = new InsertElementInst(Old, SV, - ConstantInt::get(Type::UIntTy, Elt), - "tmp", SI); - } + // Must be an element insertion. + unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); + SV = new InsertElementInst(Old, SV, + ConstantInt::get(Type::UIntTy, Elt), + "tmp", SI); } else { - // If SV is a float, convert it to the appropriate integer type. - // If it is a pointer, do the same, and also handle ptr->ptr casts - // here. - switch (SV->getType()->getTypeID()) { - default: - assert(!SV->getType()->isFloatingPoint() && "Unknown FP type!"); - break; - case Type::FloatTyID: - SV = new BitCastInst(SV, Type::UIntTy, SV->getName(), SI); - break; - case Type::DoubleTyID: - SV = new BitCastInst(SV, Type::ULongTy, SV->getName(), SI); - break; - case Type::PointerTyID: - if (isa(AllocaType)) - SV = new BitCastInst(SV, AllocaType, SV->getName(), SI); - else - SV = new PtrToIntInst(SV, TD.getIntPtrType(), SV->getName(), SI); - break; - } - - unsigned SrcSize = TD.getTypeSize(SV->getType())*8; - - // Always zero extend the value if needed. - if (SV->getType() != AllocaType) - SV = CastInst::createZExtOrBitCast(SV, AllocaType, - SV->getName(), SI); - if (Offset && Offset < AllocaType->getPrimitiveSizeInBits()) + // Always zero extend the value. + if (SV->getType()->isSigned()) + SV = CastInst::createInferredCast(SV, + SV->getType()->getUnsignedVersion(), SV->getName(), SI); + SV = CastInst::createInferredCast(SV, Old->getType(), SV->getName(), + SI); + if (Offset && Offset < TD.getTypeSize(SV->getType())*8) SV = new ShiftInst(Instruction::Shl, SV, ConstantInt::get(Type::UByteTy, Offset), SV->getName()+".adj", SI); // Mask out the bits we are about to insert from the old value. unsigned TotalBits = TD.getTypeSize(SV->getType())*8; - if (TotalBits != SrcSize) { - assert(TotalBits > SrcSize); - uint64_t Mask = ~(((1ULL << SrcSize)-1) << Offset); - Mask = Mask & SV->getType()->getIntegralTypeMask(); + unsigned InsertBits = TD.getTypeSize(SI->getOperand(0)->getType())*8; + if (TotalBits != InsertBits) { + assert(TotalBits > InsertBits); + uint64_t Mask = ~(((1ULL << InsertBits)-1) << Offset); + if (TotalBits != 64) + Mask = Mask & ((1ULL << TotalBits)-1); Old = BinaryOperator::createAnd(Old, ConstantInt::get(Old->getType(), Mask), Old->getName()+".mask", SI); From rspencer at reidspencer.com Tue Dec 12 20:32:03 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 13 Dec 2006 02:32:03 +0000 Subject: [llvm-commits] SETCC Patches (For Review Only) #1: llvm-gcc In-Reply-To: <0D5449D0-4404-4A49-AD36-D8DC4BD9D295@apple.com> References: <1165794220.15266.89.camel@bashful.x10sys.com> <0D5449D0-4404-4A49-AD36-D8DC4BD9D295@apple.com> Message-ID: <1165977123.15266.195.camel@bashful.x10sys.com> On Sun, 2006-12-10 at 18:03 -0800, Chris Lattner wrote: > On Dec 10, 2006, at 3:43 PM, Reid Spencer wrote: > > Here's the SETCC patch to convert SetCondInst (SetCC) instructions > > into > > ICmpInst. Here's somethings you should know about this patch: > > > > > > 3. The SetCondInst instruction is still used for floating point > > comparisons. > > > Ok, this will be changed in the next patch? Yes. This was done to minimize patch size, although I'm not sure it helped that much. > > > > 6. The llvm-gcc patch emits ICmp for integer/pointer and SetCC for > > floating > > point. No FCmpInst instructions are emitted. We'll do that in the > > next patch. > > > Ok, sounds great. > > > For the llvm-gcc patch: > > > Value *EmitCompare(tree_node *exp, unsigned Opc, bool isUnordered); > + Value *EmitCompare(tree_node *exp, unsigned Opc); > > > I don't like the subtle overloads here. One way to fix this: > > > + case LT_EXPR: { > + tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0)); > + if (!FLOAT_TYPE_P(Op0Ty)) > + Result = > + EmitCompare(exp, TYPE_UNSIGNED(Op0Ty) ? > + ICmpInst::ICMP_ULT : ICmpInst::ICMP_SLT); > + else > + Result = EmitCompare(exp, Instruction::SetLT, 0); > + break; > + } > + case LE_EXPR: { > + tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0)); > + if (!FLOAT_TYPE_P(Op0Ty)) > + Result = > + EmitCompare(exp, TYPE_UNSIGNED(Op0Ty) ? > + ICmpInst::ICMP_ULE : ICmpInst::ICMP_SLE); > + else > + Result = EmitCompare(exp, Instruction::SetLE, 0); > + break; > + } > > > This logic shouldn't be duplicated everywhere. I much prefer that you > do something like: > > > case LT_EXPR: > Result = EmitCompare(exp, ICmpInst::ICMP_ULT, > ICmpInst::ICMP_SLT, Instruction::SetLT, 0); > break; That's really gross. One or two arguments will always be ignored depending on whether it is a floating point or an integer compare. If your objection is the overloading, how about EmitFPCompare and EmitIntCompare? If you want to shorten the logic in the switch cases we could write an inline name EmitCompare to do what you suggested. > > ... and move the code for determining which opcode to use into > EmitCompare. The same can be > done for EmitMinMaxExpr. > > > > > @@ -2261,8 +2319,8 @@ > Value *Op = Emit(TREE_OPERAND(exp, 0), 0); > if (!Op->getType()->isFloatingPoint()) { > Instruction *OpN = BinaryOperator::createNeg(Op, > Op->getName()+"neg",CurBB); > - Value *Cmp = new SetCondInst(Instruction::SetGE, Op, > OpN->getOperand(0), > - "abscond", CurBB); > + Value *Cmp = new ICmpInst(ICmpInst::ICMP_SGE, Op, > OpN->getOperand(0), > + "abscond", CurBB); > return new SelectInst(Cmp, Op, OpN, "abs", CurBB); > } else { > // Turn FP abs into fabs/fabsf. > > > This isn't right. You need to emit a signed or unsigned comparison > depending on TYPE_UNSIGNED. It would make sense to just use a call to > EmitCompare here and have it pick the right one. I know that unsigned > abs doesn't make much sense, but this is how expr.c handles it for > GCC: > > > /* Unsigned abs is simply the operand. Testing here means we > don't > risk generating incorrect code below. */ > if (TYPE_UNSIGNED (type)) > return op0; > Okay. > > @@ -2464,8 +2542,13 @@ > LHS = NOOPCastToType(LHS, Ty); > RHS = NOOPCastToType(RHS, Ty); > > > > > - Value *Pred = new SetCondInst((Instruction::BinaryOps)CmpOpc, LHS, > RHS, > - "tmp", CurBB); > + Value *Pred; > + if (LHS->getType()->isFloatingPoint()) > + Pred = new SetCondInst((Instruction::BinaryOps)CmpOpc, LHS, RHS, > + "tmp", CurBB); > + else > + Pred = new ICmpInst((ICmpInst::Predicate)CmpOpc, LHS, RHS, > + "tmp", CurBB); > return new SelectInst(Pred, LHS, RHS, > TREE_CODE(exp) == MAX_EXPR ? "max" : "min", > CurBB); > } > > > Likewise this code is wrong (for max). It should also just call > EmitCompare. Okay. > > > -Chris From dpatel at apple.com Tue Dec 12 20:36:19 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 20:36:19 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h PassAnalysisSupport.h PassManager.h Message-ID: <200612130236.kBD2aJIK012538@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.58 -> 1.59 PassAnalysisSupport.h updated: 1.24 -> 1.25 PassManager.h updated: 1.35 -> 1.36 --- Log message: Add #ifdef switch toggle between old and new pass manager. However, continue to use old pass manager at the moment. To use new manager remove #define USE_OLD_PASSMANAGER 1 from Pass.h --- Diffs of the changes: (+53 -13) Pass.h | 10 ++++++++++ PassAnalysisSupport.h | 28 ++++++++++++++++++++++++++-- PassManager.h | 28 +++++++++++++++++----------- 3 files changed, 53 insertions(+), 13 deletions(-) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.58 llvm/include/llvm/Pass.h:1.59 --- llvm/include/llvm/Pass.h:1.58 Tue Dec 12 18:23:44 2006 +++ llvm/include/llvm/Pass.h Tue Dec 12 20:36:01 2006 @@ -36,6 +36,8 @@ #include #include +#define USE_OLD_PASSMANAGER 1 + namespace llvm { class Value; @@ -203,7 +205,9 @@ virtual bool runPass(Module &M) { return runOnModule(M); } virtual bool runPass(BasicBlock&) { return false; } +#ifdef USE_OLD_PASSMANAGER virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU); +#endif }; @@ -226,10 +230,12 @@ /// virtual bool runOnModule(Module &M) { return false; } +#ifdef USE_OLD_PASSMANAGER private: template friend class PassManagerT; friend class ModulePassManager; virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU); +#endif }; //===----------------------------------------------------------------------===// @@ -269,6 +275,7 @@ /// bool run(Function &F); +#ifdef USE_OLD_PASSMANAGER protected: template friend class PassManagerT; friend class ModulePassManager; @@ -276,6 +283,7 @@ friend class BasicBlockPassManager; virtual void addToPassManager(ModulePassManager *PM, AnalysisUsage &AU); virtual void addToPassManager(FunctionPassManagerT *PM, AnalysisUsage &AU); +#endif }; @@ -329,6 +337,7 @@ virtual bool runPass(Module &M) { return false; } virtual bool runPass(BasicBlock &BB); +#ifdef USE_OLD_PASSMANAGER private: template friend class PassManagerT; friend class FunctionPassManagerT; @@ -338,6 +347,7 @@ } virtual void addToPassManager(FunctionPassManagerT *PM, AnalysisUsage &AU); virtual void addToPassManager(BasicBlockPassManager *PM,AnalysisUsage &AU); +#endif }; /// If the user specifies the -time-passes argument on an LLVM tool command line Index: llvm/include/llvm/PassAnalysisSupport.h diff -u llvm/include/llvm/PassAnalysisSupport.h:1.24 llvm/include/llvm/PassAnalysisSupport.h:1.25 --- llvm/include/llvm/PassAnalysisSupport.h:1.24 Tue Dec 12 18:23:44 2006 +++ llvm/include/llvm/PassAnalysisSupport.h Tue Dec 12 20:36:01 2006 @@ -189,10 +189,19 @@ /// template AnalysisType *Pass::getAnalysisToUpdate() const { +#ifdef USE_OLD_PASSMANAGER assert(Resolver && "Pass not resident in a PassManager object!"); +#else + assert(Resolver_New && "Pass not resident in a PassManager object!"); +#endif const PassInfo *PI = getClassPassInfo(); if (PI == 0) return 0; +#ifdef USE_OLD_PASSMANAGER return dynamic_cast(Resolver->getAnalysisToUpdate(PI)); +#else + return dynamic_cast + (Resolver_New->getAnalysisToUpdate(PI, true)); +#endif } /// getAnalysis() - This function is used by subclasses to get @@ -201,15 +210,20 @@ /// template AnalysisType &Pass::getAnalysis() const { +#ifdef USE_OLD_PASSMANAGER assert(Resolver && "Pass has not been inserted into a PassManager object!"); +#else + assert(Resolver_New && "Pass has not been inserted into a PassManager object!"); +#endif const PassInfo *PI = getClassPassInfo(); return getAnalysisID(PI); } template AnalysisType &Pass::getAnalysisID(const PassInfo *PI) const { - assert(Resolver && "Pass has not been inserted into a PassManager object!"); assert(PI && "getAnalysis for unregistered pass!"); +#ifdef USE_OLD_PASSMANAGER + assert(Resolver && "Pass has not been inserted into a PassManager object!"); // PI *must* appear in AnalysisImpls. Because the number of passes used // should be a small number, we just do a linear search over a (dense) @@ -224,7 +238,17 @@ break; } } - +#else + assert(Resolver_New && "Pass has not been inserted into a PassManager object!"); + // PI *must* appear in AnalysisImpls. Because the number of passes used + // should be a small number, we just do a linear search over a (dense) + // vector. + Pass *ResultPass = Resolver_New->findImplPass(PI); + assert (ResultPass && + "getAnalysis*() called on an analysis that was not " + "'required' by pass!"); + +#endif // Because the AnalysisType may not be a subclass of pass (for // AnalysisGroups), we must use dynamic_cast here to potentially adjust the // return pointer (because the class may multiply inherit, once from pass, Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.35 llvm/include/llvm/PassManager.h:1.36 --- llvm/include/llvm/PassManager.h:1.35 Tue Dec 12 18:34:32 2006 +++ llvm/include/llvm/PassManager.h Tue Dec 12 20:36:01 2006 @@ -25,6 +25,9 @@ class ModulePass; class Module; class ModuleProvider; + +#ifdef USE_OLD_PASSMANAGER + class ModulePassManager; class FunctionPassManagerT; class BasicBlockPassManager; @@ -87,17 +90,19 @@ bool doFinalization(); }; -class ModulePassManager_New; +#else + +class ModulePassManager; class PassManagerImpl_New; class FunctionPassManagerImpl_New; -/// PassManager_New manages ModulePassManagers -class PassManager_New { +/// PassManager manages ModulePassManagers +class PassManager { public: - PassManager_New(); - ~PassManager_New(); + PassManager(); + ~PassManager(); /// add - Add a pass to the queue of passes to run. This passes ownership of /// the Pass to the PassManager. When the PassManager is destroyed, the pass @@ -111,18 +116,18 @@ private: - /// PassManagerImpl_New is the actual class. PassManager_New is just the + /// PassManagerImpl_New is the actual class. PassManager is just the /// wraper to publish simple pass manager interface PassManagerImpl_New *PM; }; -/// FunctionPassManager_New manages FunctionPasses and BasicBlockPassManagers. -class FunctionPassManager_New { +/// FunctionPassManager manages FunctionPasses and BasicBlockPassManagers. +class FunctionPassManager { public: - FunctionPassManager_New(ModuleProvider *P); - FunctionPassManager_New(); - ~FunctionPassManager_New(); + FunctionPassManager(ModuleProvider *P); + FunctionPassManager(); + ~FunctionPassManager(); /// add - Add a pass to the queue of passes to run. This passes /// ownership of the Pass to the PassManager. When the @@ -150,6 +155,7 @@ ModuleProvider *MP; }; +#endif } // End llvm namespace From dpatel at apple.com Tue Dec 12 20:36:19 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 12 Dec 2006 20:36:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManager.cpp Message-ID: <200612130236.kBD2aJ5T012545@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Pass.cpp updated: 1.77 -> 1.78 PassManager.cpp updated: 1.92 -> 1.93 --- Log message: Add #ifdef switch toggle between old and new pass manager. However, continue to use old pass manager at the moment. To use new manager remove #define USE_OLD_PASSMANAGER 1 from Pass.h --- Diffs of the changes: (+65 -37) Pass.cpp | 18 ++++++++++-- PassManager.cpp | 84 ++++++++++++++++++++++++++++++++------------------------ 2 files changed, 65 insertions(+), 37 deletions(-) Index: llvm/lib/VMCore/Pass.cpp diff -u llvm/lib/VMCore/Pass.cpp:1.77 llvm/lib/VMCore/Pass.cpp:1.78 --- llvm/lib/VMCore/Pass.cpp:1.77 Sun Dec 10 01:40:46 2006 +++ llvm/lib/VMCore/Pass.cpp Tue Dec 12 20:36:01 2006 @@ -14,7 +14,9 @@ //===----------------------------------------------------------------------===// #include "llvm/PassManager.h" +#ifdef USE_OLD_PASSMANAGER #include "PassManagerT.h" // PassManagerT implementation +#endif #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/ADT/STLExtras.h" @@ -34,6 +36,7 @@ P->Resolver = AR; } +#ifdef USE_OLD_PASSMANAGER //===----------------------------------------------------------------------===// // PassManager implementation - The PassManager class is a simple Pimpl class // that wraps the PassManagerT template. @@ -158,17 +161,24 @@ cerr << "\n"; } } +#endif //===----------------------------------------------------------------------===// // Pass Implementation // +#ifdef USE_OLD_PASSMANAGER void ModulePass::addToPassManager(ModulePassManager *PM, AnalysisUsage &AU) { PM->addPass(this, AU); } +#endif bool Pass::mustPreserveAnalysisID(const PassInfo *AnalysisID) const { +#ifdef USE_OLD_PASSMANAGER return Resolver->getAnalysisToUpdate(AnalysisID) != 0; +#else + return Resolver_New->getAnalysisToUpdate(AnalysisID, true) != 0; +#endif } // dumpPassStructure - Implement the -debug-passes=Structure option @@ -200,11 +210,12 @@ //===----------------------------------------------------------------------===// // ImmutablePass Implementation // +#ifdef USE_OLD_PASSMANAGER void ImmutablePass::addToPassManager(ModulePassManager *PM, AnalysisUsage &AU) { PM->addPass(this, AU); } - +#endif //===----------------------------------------------------------------------===// // FunctionPass Implementation @@ -233,6 +244,7 @@ return Changed | doFinalization(*F.getParent()); } +#ifdef USE_OLD_PASSMANAGER void FunctionPass::addToPassManager(ModulePassManager *PM, AnalysisUsage &AU) { PM->addPass(this, AU); @@ -242,6 +254,7 @@ AnalysisUsage &AU) { PM->addPass(this, AU); } +#endif //===----------------------------------------------------------------------===// // BasicBlockPass Implementation @@ -271,6 +284,7 @@ return Changed; } +#ifdef USE_OLD_PASSMANAGER void BasicBlockPass::addToPassManager(FunctionPassManagerT *PM, AnalysisUsage &AU) { PM->addPass(this, AU); @@ -280,7 +294,7 @@ AnalysisUsage &AU) { PM->addPass(this, AU); } - +#endif //===----------------------------------------------------------------------===// // Pass Registration mechanism Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.92 llvm/lib/VMCore/PassManager.cpp:1.93 --- llvm/lib/VMCore/PassManager.cpp:1.92 Tue Dec 12 18:34:32 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Dec 12 20:36:01 2006 @@ -84,6 +84,7 @@ // ModulePassManagers. //===----------------------------------------------------------------------===// +#ifndef USE_OLD_PASSMANAGER namespace llvm { class PMDataManager; @@ -125,6 +126,10 @@ /// then return NULL. Pass *findAnalysisPass(AnalysisID AID); + inline void clearManagers() { + PassManagers.clear(); + } + virtual ~PMTopLevelManager() { for (std::vector::iterator I = PassManagers.begin(), @@ -291,16 +296,16 @@ }; //===----------------------------------------------------------------------===// -// BasicBlockPassManager_New +// BasicBlockPassManager // -/// BasicBlockPassManager_New manages BasicBlockPass. It batches all the +/// BasicBlockPassManager manages BasicBlockPass. It batches all the /// pass together and sequence them to process one basic block before /// processing next basic block. -class BasicBlockPassManager_New : public PMDataManager, +class BasicBlockPassManager : public PMDataManager, public FunctionPass { public: - BasicBlockPassManager_New(int D) : PMDataManager(D) { } + BasicBlockPassManager(int D) : PMDataManager(D) { } /// Add a pass into a passmanager queue. bool addPass(Pass *p); @@ -407,20 +412,20 @@ private: // Active Pass Managers - BasicBlockPassManager_New *activeBBPassManager; + BasicBlockPassManager *activeBBPassManager; }; //===----------------------------------------------------------------------===// -// ModulePassManager_New +// ModulePassManager // -/// ModulePassManager_New manages ModulePasses and function pass managers. +/// ModulePassManager manages ModulePasses and function pass managers. /// It batches all Module passes passes and function pass managers together and /// sequence them to process one module. -class ModulePassManager_New : public Pass, +class ModulePassManager : public Pass, public PMDataManager { public: - ModulePassManager_New(int D) : PMDataManager(D) { + ModulePassManager(int D) : PMDataManager(D) { activeFunctionPassManager = NULL; } @@ -504,7 +509,7 @@ bool addPass(Pass *p); // Active Pass Manager - ModulePassManager_New *activeManager; + ModulePassManager *activeManager; }; } // End of llvm namespace @@ -814,12 +819,12 @@ } //===----------------------------------------------------------------------===// -// BasicBlockPassManager_New implementation +// BasicBlockPassManager implementation /// Add pass P into PassVector and return true. If this pass is not /// manageable by this manager then return false. bool -BasicBlockPassManager_New::addPass(Pass *P) { +BasicBlockPassManager::addPass(Pass *P) { BasicBlockPass *BP = dynamic_cast(P); if (!BP) @@ -839,7 +844,7 @@ /// runOnBasicBlock method. Keep track of whether any of the passes modifies /// the function, and if so, return true. bool -BasicBlockPassManager_New::runOnFunction(Function &F) { +BasicBlockPassManager::runOnFunction(Function &F) { if (F.isExternal()) return false; @@ -862,7 +867,7 @@ } // Implement doInitialization and doFinalization -inline bool BasicBlockPassManager_New::doInitialization(Module &M) { +inline bool BasicBlockPassManager::doInitialization(Module &M) { bool Changed = false; for (std::vector::iterator itr = passVectorBegin(), @@ -875,7 +880,7 @@ return Changed; } -inline bool BasicBlockPassManager_New::doFinalization(Module &M) { +inline bool BasicBlockPassManager::doFinalization(Module &M) { bool Changed = false; for (std::vector::iterator itr = passVectorBegin(), @@ -888,7 +893,7 @@ return Changed; } -inline bool BasicBlockPassManager_New::doInitialization(Function &F) { +inline bool BasicBlockPassManager::doInitialization(Function &F) { bool Changed = false; for (std::vector::iterator itr = passVectorBegin(), @@ -901,7 +906,7 @@ return Changed; } -inline bool BasicBlockPassManager_New::doFinalization(Function &F) { +inline bool BasicBlockPassManager::doFinalization(Function &F) { bool Changed = false; for (std::vector::iterator itr = passVectorBegin(), @@ -916,10 +921,10 @@ //===----------------------------------------------------------------------===// -// FunctionPassManager_New implementation +// FunctionPassManager implementation /// Create new Function pass manager -FunctionPassManager_New::FunctionPassManager_New(ModuleProvider *P) { +FunctionPassManager::FunctionPassManager(ModuleProvider *P) { FPM = new FunctionPassManagerImpl_New(0); // FPM is the top level manager. FPM->setTopLevelManager(FPM); @@ -932,7 +937,14 @@ MP = P; } -FunctionPassManager_New::~FunctionPassManager_New() { +FunctionPassManager::~FunctionPassManager() { + // Note : FPM maintains one entry in PassManagers vector. + // This one entry is FPM itself. This is not ideal. One + // alternative is have one additional layer between + // FunctionPassManager and FunctionPassManagerImpl. + // Meanwhile, to avoid going into infinte loop, first + // remove FPM from its PassMangers vector. + FPM->clearManagers(); delete FPM; } @@ -941,7 +953,7 @@ /// PassManager_X is destroyed, the pass will be destroyed as well, so /// there is no need to delete the pass. (TODO delete passes.) /// This implies that all passes MUST be allocated with 'new'. -void FunctionPassManager_New::add(Pass *P) { +void FunctionPassManager::add(Pass *P) { FPM->add(P); } @@ -949,7 +961,7 @@ /// track of whether any of the passes modifies the function, and if /// so, return true. /// -bool FunctionPassManager_New::run(Function &F) { +bool FunctionPassManager::run(Function &F) { std::string errstr; if (MP->materializeFunction(&F, &errstr)) { cerr << "Error reading bytecode file: " << errstr << "\n"; @@ -961,13 +973,13 @@ /// doInitialization - Run all of the initializers for the function passes. /// -bool FunctionPassManager_New::doInitialization() { +bool FunctionPassManager::doInitialization() { return FPM->doInitialization(*MP->getModule()); } /// doFinalization - Run all of the initializers for the function passes. /// -bool FunctionPassManager_New::doFinalization() { +bool FunctionPassManager::doFinalization() { return FPM->doFinalization(*MP->getModule()); } @@ -980,7 +992,7 @@ bool FunctionPassManagerImpl_New::addPass(Pass *P) { - // If P is a BasicBlockPass then use BasicBlockPassManager_New. + // If P is a BasicBlockPass then use BasicBlockPassManager. if (BasicBlockPass *BP = dynamic_cast(P)) { if (!activeBBPassManager || !activeBBPassManager->addPass(BP)) { @@ -991,7 +1003,7 @@ // Create and add new manager activeBBPassManager = - new BasicBlockPassManager_New(getDepth() + 1); + new BasicBlockPassManager(getDepth() + 1); // Inherit top level manager activeBBPassManager->setTopLevelManager(this->getTopLevelManager()); @@ -1109,7 +1121,8 @@ bool Changed = false; for (std::vector::iterator I = passManagersBegin(), E = passManagersEnd(); I != E; ++I) { - FunctionPass *FP = dynamic_cast(*I); + FunctionPassManagerImpl_New *FP = + dynamic_cast(*I); Changed |= FP->runOnFunction(F); } return Changed; @@ -1122,7 +1135,7 @@ /// then use FunctionPassManagerImpl_New to manage it. Return false if P /// is not manageable by this manager. bool -ModulePassManager_New::addPass(Pass *P) { +ModulePassManager::addPass(Pass *P) { // If P is FunctionPass then use function pass maanager. if (FunctionPass *FP = dynamic_cast(P)) { @@ -1183,7 +1196,7 @@ /// runOnModule method. Keep track of whether any of the passes modifies /// the module, and if so, return true. bool -ModulePassManager_New::runOnModule(Module &M) { +ModulePassManager::runOnModule(Module &M) { bool Changed = false; initializeAnalysisInfo(); @@ -1208,7 +1221,7 @@ bool PassManagerImpl_New::addPass(Pass *P) { if (!activeManager || !activeManager->addPass(P)) { - activeManager = new ModulePassManager_New(getDepth() + 1); + activeManager = new ModulePassManager(getDepth() + 1); // Inherit top level manager activeManager->setTopLevelManager(this->getTopLevelManager()); @@ -1230,7 +1243,7 @@ bool Changed = false; for (std::vector::iterator I = passManagersBegin(), E = passManagersEnd(); I != E; ++I) { - ModulePassManager_New *MP = dynamic_cast(*I); + ModulePassManager *MP = dynamic_cast(*I); Changed |= MP->runOnModule(M); } return Changed; @@ -1240,13 +1253,13 @@ // PassManager implementation /// Create new pass manager -PassManager_New::PassManager_New() { +PassManager::PassManager() { PM = new PassManagerImpl_New(0); // PM is the top level manager PM->setTopLevelManager(PM); } -PassManager_New::~PassManager_New() { +PassManager::~PassManager() { delete PM; } @@ -1255,14 +1268,15 @@ /// will be destroyed as well, so there is no need to delete the pass. This /// implies that all passes MUST be allocated with 'new'. void -PassManager_New::add(Pass *P) { +PassManager::add(Pass *P) { PM->add(P); } /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. bool -PassManager_New::run(Module &M) { +PassManager::run(Module &M) { return PM->run(M); } +#endif From evan.cheng at apple.com Tue Dec 12 20:38:28 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 12 Dec 2006 20:38:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612130238.kBD2cS4J012589@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.437 -> 1.438 --- Log message: Expand fsqrt, fsin, and fcos to libcalls. --- Diffs of the changes: (+25 -10) LegalizeDAG.cpp | 35 +++++++++++++++++++++++++---------- 1 files changed, 25 insertions(+), 10 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.437 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.438 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.437 Tue Dec 12 19:57:55 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 12 20:38:13 2006 @@ -4951,23 +4951,38 @@ case ISD::FP_ROUND: Lo = ExpandLibCall("__truncdfsf2", Node, Hi); break; - case ISD::SINT_TO_FP: + case ISD::SINT_TO_FP: { + const char *FnName = 0; if (Node->getOperand(0).getValueType() == MVT::i64) - Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatdisf" : "__floatdidf"), - Node, Hi); + FnName = (VT == MVT::f32) ? "__floatdisf" : "__floatdidf"; else - Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatsisf" : "__floatsidf"), - Node, Hi); + FnName = (VT == MVT::f32) ? "__floatsisf" : "__floatsidf"; + Lo = ExpandLibCall(FnName, Node, Hi); break; - case ISD::UINT_TO_FP: + } + case ISD::UINT_TO_FP: { + const char *FnName = 0; if (Node->getOperand(0).getValueType() == MVT::i64) - Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatundisf" : "__floatundidf"), - Node, Hi); + FnName = (VT == MVT::f32) ? "__floatundisf" : "__floatundidf"; else - Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatunsisf" : "__floatunsidf"), - Node, Hi); + FnName = (VT == MVT::f32) ? "__floatunsisf" : "__floatunsidf"; + Lo = ExpandLibCall(FnName, Node, Hi); break; } + case ISD::FSQRT: + case ISD::FSIN: + case ISD::FCOS: { + const char *FnName = 0; + switch(Node->getOpcode()) { + case ISD::FSQRT: FnName = (VT == MVT::f32) ? "sqrtf" : "sqrt"; break; + case ISD::FSIN: FnName = (VT == MVT::f32) ? "sinf" : "sin"; break; + case ISD::FCOS: FnName = (VT == MVT::f32) ? "cosf" : "cos"; break; + default: assert(0 && "Unreachable!"); + } + Lo = ExpandLibCall(FnName, Node, Hi); + break; + } + } // Make sure the resultant values have been legalized themselves, unless this // is a type that requires multi-step expansion. From evan.cheng at apple.com Tue Dec 12 21:20:13 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 12 Dec 2006 21:20:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612130320.kBD3KDsk013412@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.438 -> 1.439 --- Log message: Expand (f64 extload f32) to (f64 fp_ext (load f32)) if f64 type action is expand. --- Diffs of the changes: (+10 -0) LegalizeDAG.cpp | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.438 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.439 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.438 Tue Dec 12 20:38:13 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 12 21:19:57 2006 @@ -4547,6 +4547,16 @@ std::swap(Lo, Hi); } else { MVT::ValueType EVT = LD->getLoadedVT(); + + if (VT == MVT::f64 && EVT == MVT::f32) { + // f64 = EXTLOAD f32 should expand to LOAD, FP_EXTEND + SDOperand Load = DAG.getLoad(EVT, Ch, Ptr, LD->getSrcValue(), + LD->getSrcValueOffset()); + // Remember that we legalized the chain. + AddLegalizedOperand(SDOperand(Node, 1), LegalizeOp(Load.getValue(1))); + ExpandOp(DAG.getNode(ISD::FP_EXTEND, VT, Load), Lo, Hi); + break; + } if (EVT == NVT) Lo = DAG.getLoad(NVT, Ch, Ptr, LD->getSrcValue(), From clattner at apple.com Tue Dec 12 22:08:46 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 12 Dec 2006 20:08:46 -0800 Subject: [llvm-commits] SETCC Patches (For Review Only) #1: llvm-gcc In-Reply-To: <1165977123.15266.195.camel@bashful.x10sys.com> References: <1165794220.15266.89.camel@bashful.x10sys.com> <0D5449D0-4404-4A49-AD36-D8DC4BD9D295@apple.com> <1165977123.15266.195.camel@bashful.x10sys.com> Message-ID: >> >> + case LT_EXPR: { >> + tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0)); >> + if (!FLOAT_TYPE_P(Op0Ty)) >> + Result = >> + EmitCompare(exp, TYPE_UNSIGNED(Op0Ty) ? >> + ICmpInst::ICMP_ULT : ICmpInst::ICMP_SLT); >> + else >> + Result = EmitCompare(exp, Instruction::SetLT, 0); >> + break; >> + } >> + case LE_EXPR: { >> + tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0)); >> + if (!FLOAT_TYPE_P(Op0Ty)) >> + Result = >> + EmitCompare(exp, TYPE_UNSIGNED(Op0Ty) ? >> + ICmpInst::ICMP_ULE : ICmpInst::ICMP_SLE); >> + else >> + Result = EmitCompare(exp, Instruction::SetLE, 0); >> + break; >> + } >> >> >> This logic shouldn't be duplicated everywhere. I much prefer that >> you >> do something like: >> >> >> case LT_EXPR: >> Result = EmitCompare(exp, ICmpInst::ICMP_ULT, >> ICmpInst::ICMP_SLT, Instruction::SetLT, 0); >> break; > > That's really gross. One or two arguments will always be ignored > depending on whether it is a floating point or an integer compare. If > your objection is the overloading, how about EmitFPCompare and > EmitIntCompare? If you want to shorten the logic in the switch > cases we > could write an inline name EmitCompare to do what you suggested. I don't understand, why is that gross? Basically EmitCompare will have this at the top: Value *EmitCompare(tree exp, unsigned UIOpc, SIOpc, FPOpc, ...) { tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0)); unsigned Predicate = FPOpc; if (!FLOAT_TYPE_P(Op0Ty)) Predicate = TYPE_UNSIGNED(Op0Ty) ? UIOpc : SIOpc; This doesn't seem gross. -Chris From sabre at nondot.org Tue Dec 12 22:30:33 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 12 Dec 2006 22:30:33 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Verifier/2006-12-12-IntrinsicDefine.ll Message-ID: <200612130430.kBD4UXpe014598@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Verifier: 2006-12-12-IntrinsicDefine.ll added (r1.1) --- Log message: New testcase for PR1047: http://llvm.org/PR1047 --- Diffs of the changes: (+7 -0) 2006-12-12-IntrinsicDefine.ll | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/test/Regression/Verifier/2006-12-12-IntrinsicDefine.ll diff -c /dev/null llvm/test/Regression/Verifier/2006-12-12-IntrinsicDefine.ll:1.1 *** /dev/null Tue Dec 12 22:30:28 2006 --- llvm/test/Regression/Verifier/2006-12-12-IntrinsicDefine.ll Tue Dec 12 22:30:18 2006 *************** *** 0 **** --- 1,7 ---- + ; RUN: not llvm-as < %s + ; PR1047 + + void %llvm.memcpy.i32(sbyte*, sbyte*, uint, uint) { + entry: + ret void + } From sabre at nondot.org Tue Dec 12 22:30:52 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 12 Dec 2006 22:30:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200612130430.kBD4UqxG014616@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.171 -> 1.172 --- Log message: Reject attempts to define intrinsics. This fixes PR1047: http://llvm.org/PR1047 and Regression/Verifier/2006-12-12-IntrinsicDefine.ll --- Diffs of the changes: (+7 -0) Verifier.cpp | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.171 llvm/lib/VMCore/Verifier.cpp:1.172 --- llvm/lib/VMCore/Verifier.cpp:1.171 Thu Dec 7 17:41:45 2006 +++ llvm/lib/VMCore/Verifier.cpp Tue Dec 12 22:30:37 2006 @@ -112,6 +112,7 @@ bool runOnFunction(Function &F) { // Get dominator information if we are being run by PassManager if (RealPass) EF = &getAnalysis(); + visit(F); InstsInThisBlock.clear(); @@ -333,6 +334,12 @@ F.getReturnType() == Type::VoidTy, "Functions cannot return aggregate values!", &F); + // Verify that this function (which has a body) is not named "llvm.*". It + // is not legal to define intrinsics. + if (F.getName().size() >= 5) + Assert1(F.getName().substr(0, 5) != "llvm.", + "llvm intrinsics cannot be defined!", &F); + // Check that this function meets the restrictions on this calling convention. switch (F.getCallingConv()) { default: From sabre at nondot.org Tue Dec 12 22:46:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 12 Dec 2006 22:46:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200612130446.kBD4k1kc014878@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.172 -> 1.173 --- Log message: only check non-external functions --- Diffs of the changes: (+6 -6) Verifier.cpp | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.172 llvm/lib/VMCore/Verifier.cpp:1.173 --- llvm/lib/VMCore/Verifier.cpp:1.172 Tue Dec 12 22:30:37 2006 +++ llvm/lib/VMCore/Verifier.cpp Tue Dec 12 22:45:46 2006 @@ -334,12 +334,6 @@ F.getReturnType() == Type::VoidTy, "Functions cannot return aggregate values!", &F); - // Verify that this function (which has a body) is not named "llvm.*". It - // is not legal to define intrinsics. - if (F.getName().size() >= 5) - Assert1(F.getName().substr(0, 5) != "llvm.", - "llvm intrinsics cannot be defined!", &F); - // Check that this function meets the restrictions on this calling convention. switch (F.getCallingConv()) { default: @@ -371,6 +365,12 @@ } if (!F.isExternal()) { + // Verify that this function (which has a body) is not named "llvm.*". It + // is not legal to define intrinsics. + if (F.getName().size() >= 5) + Assert1(F.getName().substr(0, 5) != "llvm.", + "llvm intrinsics cannot be defined!", &F); + verifySymbolTable(F.getSymbolTable()); // Check the entry node From clattner at apple.com Tue Dec 12 22:51:43 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 12 Dec 2006 20:51:43 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/IndMemRemoval.cpp RaiseAllocations.cpp SimplifyLibCalls.cpp In-Reply-To: <200612130050.kBD0og06010755@zion.cs.uiuc.edu> References: <200612130050.kBD0og06010755@zion.cs.uiuc.edu> Message-ID: <81AAE04F-C1FF-432D-8836-6E91321E087C@apple.com> > @@ -1738,16 +1739,16 @@ > } > > // isdigit(c) -> (unsigned)c - '0' <= 9 > - CastInst* cast = CastInst::createInferredCast(ci->getOperand(1), > - Type::UIntTy, ci->getOperand(1)->getName()+".uint", ci); > + CastInst* cast = CastInst::createIntegerCast(ci->getOperand(1), > + Type::UIntTy, false/*ZExt*/, ci->getOperand(1)->getName() > +".uint", ci); > BinaryOperator* sub_inst = BinaryOperator::createSub(cast, > ConstantInt::get(Type::UIntTy,0x30), > ci->getOperand(1)->getName()+".sub",ci); > SetCondInst* setcond_inst = new SetCondInst > (Instruction::SetLE,sub_inst, > ConstantInt::get(Type::UIntTy,9), > ci->getOperand(1)->getName()+".cmp",ci); > - CastInst* c2 = CastInst::createInferredCast( > - setcond_inst, Type::IntTy, ci->getOperand(1)->getName() > +".isdigit", ci); > + CastInst* c2 = new SExtInst(setcond_inst, Type::IntTy, > + ci->getOperand(1)->getName()+".isdigit", ci); This should be a zext instruction not sext. isdigit returns 0/1 not 0/-1. > @@ -1870,10 +1870,11 @@ > > Function *F = SLC.getModule()->getOrInsertFunction(CTTZName, > ArgType, > ArgType, > NULL); > - Value *V = CastInst::createInferredCast( > - TheCall->getOperand(1), ArgType, "tmp", TheCall); > + Value *V = CastInst::createIntegerCast(TheCall->getOperand(1), > ArgType, > + false/*ZExt*/, "tmp", > TheCall); > Value *V2 = new CallInst(F, V, "tmp", TheCall); > - V2 = CastInst::createInferredCast(V2, Type::IntTy, "tmp", > TheCall); > + V2 = CastInst::createIntegerCast(V2, Type::IntTy, true/*SExt*/, > + "tmp", TheCall); This should be zext, not sext. Why did you choose sext for these? > V2 = BinaryOperator::createAdd(V2, ConstantInt::get > (Type::IntTy, 1), > "tmp", TheCall); > Value *Cond = > @@ -2116,9 +2117,11 @@ > /// inserting the cast before IP, and return the cast. > /// @brief Cast a value to a "C" string. > Value *CastToCStr(Value *V, Instruction &IP) { > + assert(V->getType()->getTypeID() == Type::PointerTyID && > + "Can't cast non-pointer type to C string type"); isa(V->getType()) please. Thanks Reid, -Chris From clattner at apple.com Tue Dec 12 23:55:32 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 12 Dec 2006 21:55:32 -0800 Subject: [llvm-commits] CVS: llvm/lib/Analysis/BasicAliasAnalysis.cpp ConstantRange.cpp ScalarEvolution.cpp ScalarEvolutionExpander.cpp In-Reply-To: <200612122336.kBCNaWBG008777@zion.cs.uiuc.edu> References: <200612122336.kBCNaWBG008777@zion.cs.uiuc.edu> Message-ID: <28FB8554-FE82-4D17-86D0-F3958CD3CAE8@apple.com> > --- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.8 Wed Dec 6 > 19:30:31 2006 > +++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp Tue Dec 12 > 17:36:14 2006 > @@ -20,9 +20,27 @@ > /// InsertCastOfTo - Insert a cast of V to the specified type, > doing what > /// we can to share the casts. > Value *SCEVExpander::InsertCastOfTo(Value *V, const Type *Ty) { > + // Compute the Cast opcode to use > + Instruction::CastOps opcode = Instruction::BitCast; > + if (Ty->isIntegral()) { > + if (V->getType()->getTypeID() == Type::PointerTyID) > + opcode = Instruction::PtrToInt; > + else { > + unsigned SrcBits = V->getType()->getPrimitiveSizeInBits(); > + unsigned DstBits = Ty->getPrimitiveSizeInBits(); > + opcode = (SrcBits > DstBits ? Instruction::Trunc : > + (SrcBits == DstBits ? Instruction::BitCast : > + (V->getType()->isSigned() ? Instruction::SExt : > + Instruction::ZExt))); > + } This code is not good, you shouldn't look at the type of the value. InsertCastOfTo is called in two places: LoopStrengthReduce.cpp:1124 (in which case it is a truncate, maybe a bitcast) and at :213. The call in 213 is in getCastedVersionOf, which is called at :256 (in which case it should be ptrtoint) and :271 (in which case it should be sext or bitcast). Please pass down the correct opcode from these callers. -Chris From evan.cheng at apple.com Wed Dec 13 00:09:18 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 13 Dec 2006 00:09:18 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200612130609.kBD69ITL016175@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.91 -> 1.92 --- Log message: Update comments. --- Diffs of the changes: (+3 -3) TargetLowering.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.91 llvm/include/llvm/Target/TargetLowering.h:1.92 --- llvm/include/llvm/Target/TargetLowering.h:1.91 Sun Dec 10 17:12:42 2006 +++ llvm/include/llvm/Target/TargetLowering.h Wed Dec 13 00:09:03 2006 @@ -338,9 +338,9 @@ } /// getNumElements - Return the number of registers that this ValueType will - /// eventually require. This is always one for all non-integer types, is - /// one for any types promoted to live in larger registers, but may be more - /// than one for types (like i64) that are split into pieces. + /// eventually require. This is one for any types promoted to live in larger + /// registers, but may be more than one for types (like i64) that are split + /// into pieces. unsigned getNumElements(MVT::ValueType VT) const { return NumElementsForVT[VT]; } From evan.cheng at apple.com Wed Dec 13 00:12:50 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 13 Dec 2006 00:12:50 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200612130612.kBD6Co6K016247@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.92 -> 1.93 --- Log message: Update comments. --- Diffs of the changes: (+4 -3) TargetLowering.h | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.92 llvm/include/llvm/Target/TargetLowering.h:1.93 --- llvm/include/llvm/Target/TargetLowering.h:1.92 Wed Dec 13 00:09:03 2006 +++ llvm/include/llvm/Target/TargetLowering.h Wed Dec 13 00:12:35 2006 @@ -168,9 +168,10 @@ /// getTypeToTransformTo - For types supported by the target, this is an /// identity function. For types that must be promoted to larger types, this - /// returns the larger type to promote to. For types that are larger than the - /// largest integer register, this contains one step in the expansion to get - /// to the smaller register. + /// returns the larger type to promote to. For integer types that are larger + /// than the largest integer register, this contains one step in the expansion + /// to get to the smaller register. For illegal floating point types, this + /// returns the integer type to transform to. MVT::ValueType getTypeToTransformTo(MVT::ValueType VT) const { return TransformToType[VT]; } From clattner at apple.com Wed Dec 13 00:42:26 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 12 Dec 2006 22:42:26 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200612120919.kBC9J6qB010276@zion.cs.uiuc.edu> References: <200612120919.kBC9J6qB010276@zion.cs.uiuc.edu> Message-ID: <4CE84EF9-5604-4A99-A336-9BF991A89F39@apple.com> This code (around line 2173): CastInst *BoolCast = 0; if (CastInst *CI = dyn_cast(I.getOperand(0))) if (CI->getOperand(0)->getType() == Type::BoolTy) BoolCast = CI; if (!BoolCast) if (CastInst *CI = dyn_cast(I.getOperand(1))) if (CI->getOperand(0)->getType() == Type::BoolTy) BoolCast = CI; Should *only* allow zext from bool (not any cast). This is a serious bug from the original cast patch. > @@ -2190,7 +2193,7 @@ > SCOpTy- > >getPrimitiveSizeInBits()-1); > if (SCIOp0->getType()->isUnsigned()) { > const Type *NewTy = SCIOp0->getType()->getSignedVersion(); > - SCIOp0 = InsertCastBefore(SCIOp0, NewTy, I); > + SCIOp0 = InsertCastBefore(Instruction::BitCast, SCIOp0, > NewTy, I); > } This cast be removed now that ashr is signless. > @@ -2863,12 +2872,14 @@ > Constant *ShrMask = ConstantExpr::getLShr(AllOne, OpRHS); > Constant *CI = ConstantExpr::getAnd(AndRHS, ShrMask); > if (CI == AndRHS) { // Masking out bits shifted in. > + // (Val ashr C1) & C2 -> (Val lshr C1) & C2 > // Make the argument unsigned. > Value *ShVal = Op->getOperand(0); > ShVal = InsertNewInstBefore(new ShiftInst > (Instruction::LShr, ShVal, > OpRHS, Op- > >getName()), > TheAnd); > - Value *AndRHS2 = ConstantExpr::getCast(AndRHS, ShVal- > >getType()); > + Value *AndRHS2 = ConstantExpr::getBitCast(AndRHS, ShVal- > >getType()); > + This cast looks completely dead, if so, it should just be removed. > @@ -2897,9 +2908,9 @@ > InsertNewInstBefore(Add, IB); > // Convert to unsigned for the comparison. > const Type *UnsType = Add->getType()->getUnsignedVersion(); > - Value *OffsetVal = InsertCastBefore(Add, UnsType, IB); > + Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add, > UnsType, IB); > AddCST = ConstantExpr::getAdd(AddCST, Hi); > - AddCST = ConstantExpr::getCast(AddCST, UnsType); > + AddCST = ConstantExpr::getBitCast(AddCST, UnsType); > return new SetCondInst(Instruction::SetLT, OffsetVal, AddCST); If only we had signless comparisons! :-) > @@ -3917,11 +3930,11 @@ > for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, + > +GTI) { > Value *Op = GEP->getOperand(i); > uint64_t Size = TD.getTypeSize(GTI.getIndexedType()) & > PtrSizeMask; > - Constant *Scale = ConstantExpr::getCast(ConstantInt::get > (UIntPtrTy, Size), > + Constant *Scale = ConstantExpr::getBitCast(ConstantInt::get > (UIntPtrTy, Size), > SIntPtrTy); This doesn't fit in 80 columns. Further, you can just use: > Constant *Scale = ConstantInt::get(SIntPtrTy, Size); Now that Constant[SU]Int got merged into ConstantInt. This code: // Check to see if there is a noop-cast between the shift and the and. if (!Shift) { if (CastInst *CI = dyn_cast(LHSI->getOperand(0))) if (CI->getOperand(0)->getType()->isIntegral() && CI->getOperand(0)->getType()- >getPrimitiveSizeInBits() == CI->getType()->getPrimitiveSizeInBits()) Shift = dyn_cast(CI->getOperand(0)); } Should check for bitcast with integral src/dest instead of checking sizes etc. This code: // Make sure we insert a logical shift. Constant *NewAndCST = AndCST; if (AndCST->getType()->isSigned()) NewAndCST = ConstantExpr::getBitCast(AndCST, AndCST->getType()- >getUnsignedVersion()); NS = new ShiftInst(Instruction::LShr, NewAndCST, Shift->getOperand(1), "tmp"); You can drop the cast now that the shift is signless. The two casts here can be eliminated now that shifts are signless: // (X >>s C1) << C2 where C1 > C2 === (X >>s (C1-C2)) & mask Op = InsertCastBefore(Instruction::BitCast, Mask, I.getType()->getSignedVersion(), I); Instruction *Shift = new ShiftInst(ShiftOp->getOpcode(), Op, ConstantInt::get(Type::UByteTy, ShiftAmt1- ShiftAmt2)); InsertNewInstBefore(Shift, I); C = ConstantIntegral::getAllOnesValue(Shift->getType()); C = ConstantExpr::getShl(C, Op1); Mask = BinaryOperator::createAnd(Shift, C, Op->getName() +".mask"); InsertNewInstBefore(Mask, I); return CastInst::create(Instruction::BitCast, Mask, I.getType ()); > @@ -5874,10 +5893,15 @@ > if (DestBitSize == SrcBitSize || > !ValueRequiresCast(Op1, DestTy,TD) || > !ValueRequiresCast(Op0, DestTy, TD)) { > - Value *Op0c = InsertOperandCastBefore(Op0, DestTy, SrcI); > - Value *Op1c = InsertOperandCastBefore(Op1, DestTy, SrcI); > - return BinaryOperator::create(cast(SrcI) > - ->getOpcode(), Op0c, Op1c); > + unsigned Op0BitSize = Op0->getType()- > >getPrimitiveSizeInBits(); > + Instruction::CastOps opcode = > + (Op0BitSize > DestBitSize ? Instruction::Trunc : > + (Op0BitSize == DestBitSize ? Instruction::BitCast : > + Op0->getType()->isSigned() ? > Instruction::SExt :Instruction::ZExt)); This is a serious bug. You can't look at the type of the operand to determine the type of the cast! Replace this with: Instruction::CastOps opcode = CI.getOpcode(); > @@ -6014,13 +6042,18 @@ > > // Get a mask for the bits shifting in. > uint64_t Mask = (~0ULL >> (64-ShAmt)) << DestBitWidth; > - if (SrcI->hasOneUse() && MaskedValueIsZero(SrcI->getOperand > (0), Mask)) { > + Value* SrcIOp0 = SrcI->getOperand(0); > + if (SrcI->hasOneUse() && MaskedValueIsZero(SrcIOp0, Mask)) { > if (ShAmt >= DestBitWidth) // All zeros. > return ReplaceInstUsesWith(CI, Constant::getNullValue > (Ty)); > > // Okay, we can shrink this. Truncate the input, then > return a new > // shift. > - Value *V = InsertCastBefore(SrcI->getOperand(0), Ty, CI); > + Instruction::CastOps opcode = > + (SrcIOp0->getType()->getPrimitiveSizeInBits() == > + Ty->getPrimitiveSizeInBits() ? Instruction::BitCast : > + Instruction::Trunc); This is always trunc. > @@ -7316,15 +7355,18 @@ > return 0; > } > > -static Value *InsertSignExtendToPtrTy(Value *V, const Type *DTy, > - Instruction *InsertPoint, > - InstCombiner *IC) { > - unsigned PS = IC->getTargetData().getPointerSize(); > - const Type *VTy = V->getType(); > - if (!VTy->isSigned() && VTy->getPrimitiveSize() < PS) > - // We must insert a cast to ensure we sign-extend. > - V = IC->InsertCastBefore(V, VTy->getSignedVersion(), > *InsertPoint); > - return IC->InsertCastBefore(V, DTy, *InsertPoint); > +static Value *InsertCastToIntPtrTy(Value *V, const Type *DTy, > + Instruction *InsertPoint, > + InstCombiner *IC) { Why did you rename this? The previous name was better (indicated sign extension). > + unsigned PtrSize = IC->getTargetData().getPointerSize(); This isn't right. Two callers pass in intptr_t, but two pass in something else. You should use DTy->getPrimitiveSize() instead of TD.getPointerSize() > + unsigned VTySize = V->getType()->getPrimitiveSize(); > + // We must cast correctly to the pointer type. Ensure that we > + // sign extend the integer value if it is smaller as this is > + // used for address computation. > + Instruction::CastOps opcode = > + (VTySize < PtrSize ? Instruction::SExt : > + (VTySize == PtrSize ? Instruction::BitCast : > Instruction::Trunc)); > + return IC->InsertCastBefore(opcode, V, DTy, *InsertPoint); > } > @@ -8677,8 +8721,8 @@ > std::vector Ops(CE->op_begin()+1, CE->op_end()); > uint64_t Offset = TD->getIndexedOffset(Ptr->getType(), Ops); > Constant *C = ConstantInt::get(Type::ULongTy, Offset); > + C = ConstantExpr::getIntegerCast(C, TD->getIntPtrType(), > true /*SExt*/); Just use: > Constant *C = ConstantInt::get(TD->getIntPtrType(), Offset); -Chris From clattner at apple.com Wed Dec 13 01:14:55 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 12 Dec 2006 23:14:55 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200612122336.kBCNaWOT008766@zion.cs.uiuc.edu> References: <200612122336.kBCNaWOT008766@zion.cs.uiuc.edu> Message-ID: <3430C265-387A-41D7-8C50-E3225E86E37A@apple.com> On Dec 12, 2006, at 3:36 PM, Reid Spencer wrote: > @@ -3286,7 +3281,8 @@ > Op1C- > >getOperand(0), > I.getName()); > InsertNewInstBefore(NewOp, I); > - return CastInst::createInferredCast(NewOp, I.getType()); > + return CastInst::createIntegerCast(NewOp, I.getType(), > + SrcTy->isSigned()); > } > } > } > @@ -3690,7 +3686,8 @@ > Op1C- > >getOperand(0), > I.getName()); > InsertNewInstBefore(NewOp, I); > - return CastInst::createInferredCast(NewOp, I.getType()); > + return CastInst::createIntegerCast(NewOp, I.getType(), > + SrcTy->isSigned()); > } > } > > @@ -3871,7 +3868,8 @@ > Op1C- > >getOperand(0), > I.getName()); > InsertNewInstBefore(NewOp, I); > - return CastInst::createInferredCast(NewOp, I.getType()); > + return CastInst::createIntegerCast(NewOp, I.getType(), > + SrcTy->isSigned()); > } > } These three all point out serious bugs. The code looks like this for each: // fold (and (cast A), (cast B)) -> (cast (and A, B)) if (CastInst *Op1C = dyn_cast(Op1)) { if (CastInst *Op0C = dyn_cast(Op0)) { const Type *SrcTy = Op0C->getOperand(0)->getType(); if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy- >isIntegral() && // Only do this if the casts both really cause code to be generated. ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) && ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) { Instruction *NewOp = BinaryOperator::createAnd(Op0C- >getOperand(0), Op1C- >getOperand(0), I.getName()); InsertNewInstBefore(NewOp, I); return CastInst::createIntegerCast(NewOp, I.getType(), SrcTy->isSigned()); } } } This xform used to be safe before the cast patch, but now can turn stuff like: (and (sext A), (zext B)) into: (sext (and A, B)) which is very wrong (again, never use SrcTy->isSigned!). All three of these cases should verify that Op1C->getOpcode() == Op2C- >getOpcode(), and it should use the opcode in the inserted cast. That is, either of these are allowed: (and (sext A), (sext B)) -> (sext (and A, B)) (and (zext A), (zext B)) -> (zext (and A, B)) but no mixing. > @@ -5392,8 +5389,7 @@ > > Value *Op = ShiftOp->getOperand(0); > if (isShiftOfSignedShift != isSignedShift) > - Op = InsertNewInstBefore( > - CastInst::createInferredCast(Op, I.getType(), > "tmp"), I); > + Op = InsertNewInstBefore(new BitCastInst(Op, I.getType(), > "tmp"), I); This cast can be removed, now that shifts are signless. > @@ -5681,7 +5677,7 @@ > /// evaluate the expression. > Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type > *Ty) { > if (Constant *C = dyn_cast(V)) > - return ConstantExpr::getCast(C, Ty); > + return ConstantExpr::getIntegerCast(C, Ty, C->getType()- > >isSigned()); This looks extremely unsafe. Why is it ok? > @@ -7950,13 +7943,20 @@ > // the same size. Instead of casting the pointer before > the store, cast > // the value to be stored. > Value *NewCast; > - if (Constant *C = dyn_cast(SI.getOperand(0))) > - NewCast = ConstantExpr::getCast(C, SrcPTy); > + Instruction::CastOps opcode = Instruction::BitCast; > + Value *SIOp0 = SI.getOperand(0); > + if (SrcPTy->getTypeID() == Type::PointerTyID) { isa(SrcPTy) > + if (SIOp0->getType()->isIntegral()) > + opcode = Instruction::IntToPtr; > + } else if (SrcPTy->isIntegral()) { > + if (SIOp0->getType()->getTypeID() == Type::PointerTyID) isa -Chris From reid at x10sys.com Wed Dec 13 02:03:40 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Dec 2006 02:03:40 -0600 Subject: [llvm-commits] CVS: llvm/projects/Stacker/test/Makefile Message-ID: <200612130803.kBD83ehw018046@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/test: Makefile updated: 1.10 -> 1.11 --- Log message: Update for llvm-gcc4 build. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/projects/Stacker/test/Makefile diff -u llvm/projects/Stacker/test/Makefile:1.10 llvm/projects/Stacker/test/Makefile:1.11 --- llvm/projects/Stacker/test/Makefile:1.10 Mon Feb 14 10:04:28 2005 +++ llvm/projects/Stacker/test/Makefile Wed Dec 13 02:03:25 2006 @@ -42,7 +42,7 @@ % : %.st Makefile testing.bc $(Echo) "Building $*" - $(Verb)$(LLVMC) -O4 -o $@ $< testing.bc $(LibDir)/stkr_runtime.bc -lcrtend + $(Verb)$(LLVMC) -O4 -o $@ $< testing.bc -L$(LibDir) testing.bc : testing.st Makefile $(Echo) "Compiling $*" From reid at x10sys.com Wed Dec 13 02:04:47 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Dec 2006 02:04:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Message-ID: <200612130804.kBD84lOV018075@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: SimplifyLibCalls.cpp updated: 1.75 -> 1.76 --- Log message: Fix some casts. isdigit(c) returns 0 or 1, not 0 or -1 --- Diffs of the changes: (+3 -3) SimplifyLibCalls.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.75 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.76 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.75 Tue Dec 12 18:50:17 2006 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Wed Dec 13 02:04:32 2006 @@ -1747,7 +1747,7 @@ SetCondInst* setcond_inst = new SetCondInst(Instruction::SetLE,sub_inst, ConstantInt::get(Type::UIntTy,9), ci->getOperand(1)->getName()+".cmp",ci); - CastInst* c2 = new SExtInst(setcond_inst, Type::IntTy, + CastInst* c2 = new ZExtInst(setcond_inst, Type::IntTy, ci->getOperand(1)->getName()+".isdigit", ci); ci->replaceAllUsesWith(c2); ci->eraseFromParent(); @@ -1873,7 +1873,7 @@ Value *V = CastInst::createIntegerCast(TheCall->getOperand(1), ArgType, false/*ZExt*/, "tmp", TheCall); Value *V2 = new CallInst(F, V, "tmp", TheCall); - V2 = CastInst::createIntegerCast(V2, Type::IntTy, true/*SExt*/, + V2 = CastInst::createIntegerCast(V2, Type::IntTy, false/*ZExt*/, "tmp", TheCall); V2 = BinaryOperator::createAdd(V2, ConstantInt::get(Type::IntTy, 1), "tmp", TheCall); @@ -2117,7 +2117,7 @@ /// inserting the cast before IP, and return the cast. /// @brief Cast a value to a "C" string. Value *CastToCStr(Value *V, Instruction &IP) { - assert(V->getType()->getTypeID() == Type::PointerTyID && + assert(isa(V->getType()) && "Can't cast non-pointer type to C string type"); const Type *SBPTy = PointerType::get(Type::SByteTy); if (V->getType() != SBPTy) From reid at x10sys.com Wed Dec 13 02:07:02 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Dec 2006 02:07:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolutionExpander.cpp Message-ID: <200612130807.kBD872n6018478@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolutionExpander.cpp updated: 1.9 -> 1.10 --- Log message: Change the interface to SCEVExpander::InsertCastOfTo to take a cast opcode so the decision of which opcode to use is pushed upward to the caller. Adjust the callers to pass the expected opcode. --- Diffs of the changes: (+2 -19) ScalarEvolutionExpander.cpp | 21 ++------------------- 1 files changed, 2 insertions(+), 19 deletions(-) Index: llvm/lib/Analysis/ScalarEvolutionExpander.cpp diff -u llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.9 llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.10 --- llvm/lib/Analysis/ScalarEvolutionExpander.cpp:1.9 Tue Dec 12 17:36:14 2006 +++ llvm/lib/Analysis/ScalarEvolutionExpander.cpp Wed Dec 13 02:06:42 2006 @@ -19,25 +19,8 @@ /// InsertCastOfTo - Insert a cast of V to the specified type, doing what /// we can to share the casts. -Value *SCEVExpander::InsertCastOfTo(Value *V, const Type *Ty) { - // Compute the Cast opcode to use - Instruction::CastOps opcode = Instruction::BitCast; - if (Ty->isIntegral()) { - if (V->getType()->getTypeID() == Type::PointerTyID) - opcode = Instruction::PtrToInt; - else { - unsigned SrcBits = V->getType()->getPrimitiveSizeInBits(); - unsigned DstBits = Ty->getPrimitiveSizeInBits(); - opcode = (SrcBits > DstBits ? Instruction::Trunc : - (SrcBits == DstBits ? Instruction::BitCast : - (V->getType()->isSigned() ? Instruction::SExt : - Instruction::ZExt))); - } - } else if (Ty->isFloatingPoint()) - opcode = Instruction::UIToFP; - else if (Ty->getTypeID() == Type::PointerTyID && V->getType()->isIntegral()) - opcode = Instruction::IntToPtr; - +Value *SCEVExpander::InsertCastOfTo(Instruction::CastOps opcode, Value *V, + const Type *Ty) { // FIXME: keep track of the cast instruction. if (Constant *C = dyn_cast(V)) return ConstantExpr::getCast(opcode, C, Ty); From reid at x10sys.com Wed Dec 13 02:10:04 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Dec 2006 02:10:04 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvmc/Makefile Message-ID: <200612130810.kBD8A47X020081@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: Makefile updated: 1.22 -> 1.23 --- Log message: Ressurrect the Stacker "st" configuration. Someday this will all go away, but until then Stacker needs its configuration. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/llvmc/Makefile diff -u llvm/tools/llvmc/Makefile:1.22 llvm/tools/llvmc/Makefile:1.23 --- llvm/tools/llvmc/Makefile:1.22 Mon Sep 4 00:59:09 2006 +++ llvm/tools/llvmc/Makefile Wed Dec 13 02:09:48 2006 @@ -9,7 +9,7 @@ LEVEL = ../.. TOOLNAME = llvmc LINK_COMPONENTS = support system -CONFIG_FILES = c cpp ll +CONFIG_FILES = c cpp ll st EXTRA_DIST = c cpp ll ConfigLexer.cpp.cvs ConfigLexer.l.cvs REQUIRES_EH := 1 From reid at x10sys.com Wed Dec 13 02:10:32 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Dec 2006 02:10:32 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvmc/st Message-ID: <200612130810.kBD8AWwZ020341@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: st updated: 1.9 -> 1.10 --- Log message: Ressurrect this needed file. --- Diffs of the changes: (+63 -0) st | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+) Index: llvm/tools/llvmc/st diff -u /dev/null llvm/tools/llvmc/st:1.10 --- /dev/null Wed Dec 13 02:10:26 2006 +++ llvm/tools/llvmc/st Wed Dec 13 02:10:16 2006 @@ -0,0 +1,63 @@ +# Stacker Configuration File For llvmc + +########################################################## +# Language definitions +########################################################## + lang.name=Stacker + lang.opt1=-O1 + lang.opt2=-O2 + lang.opt3=-O3 + lang.opt4=-O4 + lang.opt5=-O5 + +########################################################## +# Pre-processor definitions +########################################################## + + # Stacker doesn't have a preprocessor but the following + # allows the -E option to be supported + preprocessor.command=cp %in% %out% + preprocessor.required=false + +########################################################## +# Translator definitions +########################################################## + + # To compile stacker source, we just run the stacker + # compiler with a default stack size of 2048 entries. + translator.command=stkrc -s 2048 %in% -f -o %out% %opt% \ + %time% %stats% %args% + + # stkrc doesn't preprocess but we set this to true so + # that we don't run the cp command by default. + translator.preprocesses=true + + # The translator is required to run. + translator.required=false + + # stkrc doesn't handle the -On options + translator.output=bytecode + +########################################################## +# Optimizer definitions +########################################################## + + # For optimization, we use the LLVM "opt" program + optimizer.command=stkrc -s 2048 %in% -f -o %out% %opt% \ + %time% %stats% %args% + + optimizer.required = yes + + # opt doesn't translate + optimizer.translates = yes + + # opt doesn't preprocess + optimizer.preprocesses=yes + + # opt produces bytecode + optimizer.output = bc + +########################################################## +# Assembler definitions +########################################################## + assembler.command=llc %in% -o %out% %target% %time% %stats% From reid at x10sys.com Wed Dec 13 02:27:30 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Dec 2006 02:27:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612130827.kBD8RUhj027241@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.566 -> 1.567 --- Log message: Fix and/or/xor (cast A), (cast B) --> cast (and/or/xor A, B) The cast patch introduced the possibility that the wrong cast opcode could be used and that this transform could trigger on different kinds of cast operations. This patch rectifies that. --- Diffs of the changes: (+40 -41) InstructionCombining.cpp | 81 +++++++++++++++++++++++------------------------ 1 files changed, 40 insertions(+), 41 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.566 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.566 Tue Dec 12 17:36:14 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Dec 13 02:27:15 2006 @@ -3270,22 +3270,21 @@ } // fold (and (cast A), (cast B)) -> (cast (and A, B)) - if (CastInst *Op1C = dyn_cast(Op1)) { - if (CastInst *Op0C = dyn_cast(Op0)) { - const Type *SrcTy = Op0C->getOperand(0)->getType(); - if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && - // Only do this if the casts both really cause code to be generated. - ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) && - ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) { - Instruction *NewOp = BinaryOperator::createAnd(Op0C->getOperand(0), - Op1C->getOperand(0), - I.getName()); - InsertNewInstBefore(NewOp, I); - return CastInst::createIntegerCast(NewOp, I.getType(), - SrcTy->isSigned()); + if (CastInst *Op0C = dyn_cast(Op0)) + if (CastInst *Op1C = dyn_cast(Op1)) + if (Op0C->getOpcode() == Op1C->getOpcode()) { // same cast kind ? + const Type *SrcTy = Op0C->getOperand(0)->getType(); + if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && + // Only do this if the casts both really cause code to be generated. + ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) && + ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) { + Instruction *NewOp = BinaryOperator::createAnd(Op0C->getOperand(0), + Op1C->getOperand(0), + I.getName()); + InsertNewInstBefore(NewOp, I); + return CastInst::create(Op0C->getOpcode(), NewOp, I.getType()); + } } - } - } // (X >> Z) & (Y >> Z) -> (X&Y) >> Z for all shifts. if (ShiftInst *SI1 = dyn_cast(Op1)) { @@ -3675,21 +3674,21 @@ } // fold (or (cast A), (cast B)) -> (cast (or A, B)) - if (CastInst *Op0C = dyn_cast(Op0)) { - const Type *SrcTy = Op0C->getOperand(0)->getType(); + if (CastInst *Op0C = dyn_cast(Op0)) if (CastInst *Op1C = dyn_cast(Op1)) - if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && - // Only do this if the casts both really cause code to be generated. - ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) && - ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) { - Instruction *NewOp = BinaryOperator::createOr(Op0C->getOperand(0), - Op1C->getOperand(0), - I.getName()); - InsertNewInstBefore(NewOp, I); - return CastInst::createIntegerCast(NewOp, I.getType(), - SrcTy->isSigned()); + if (Op0C->getOpcode() == Op1C->getOpcode()) {// same cast kind ? + const Type *SrcTy = Op0C->getOperand(0)->getType(); + if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && + // Only do this if the casts both really cause code to be generated. + ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) && + ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) { + Instruction *NewOp = BinaryOperator::createOr(Op0C->getOperand(0), + Op1C->getOperand(0), + I.getName()); + InsertNewInstBefore(NewOp, I); + return CastInst::create(Op0C->getOpcode(), NewOp, I.getType()); + } } - } return Changed ? &I : 0; @@ -3857,21 +3856,21 @@ return R; // fold (xor (cast A), (cast B)) -> (cast (xor A, B)) - if (CastInst *Op0C = dyn_cast(Op0)) { - const Type *SrcTy = Op0C->getOperand(0)->getType(); + if (CastInst *Op0C = dyn_cast(Op0)) if (CastInst *Op1C = dyn_cast(Op1)) - if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && - // Only do this if the casts both really cause code to be generated. - ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) && - ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) { - Instruction *NewOp = BinaryOperator::createXor(Op0C->getOperand(0), - Op1C->getOperand(0), - I.getName()); - InsertNewInstBefore(NewOp, I); - return CastInst::createIntegerCast(NewOp, I.getType(), - SrcTy->isSigned()); + if (Op0C->getOpcode() == Op1C->getOpcode()) { // same cast kind? + const Type *SrcTy = Op0C->getOperand(0)->getType(); + if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() && + // Only do this if the casts both really cause code to be generated. + ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) && + ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) { + Instruction *NewOp = BinaryOperator::createXor(Op0C->getOperand(0), + Op1C->getOperand(0), + I.getName()); + InsertNewInstBefore(NewOp, I); + return CastInst::create(Op0C->getOpcode(), NewOp, I.getType()); + } } - } // (X >> Z) ^ (Y >> Z) -> (X^Y) >> Z for all shifts. if (ShiftInst *SI1 = dyn_cast(Op1)) { From reid at x10sys.com Wed Dec 13 02:33:48 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Dec 2006 02:33:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612130833.kBD8Xmuv027379@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.567 -> 1.568 --- Log message: For mul transforms, when checking for a cast from bool as either operand, make sure to also check that it is a zext from bool, not any other cast operation type. --- Diffs of the changes: (+4 -2) InstructionCombining.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.568 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567 Wed Dec 13 02:27:15 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Dec 13 02:33:33 2006 @@ -2172,11 +2172,13 @@ // formed. CastInst *BoolCast = 0; if (CastInst *CI = dyn_cast(I.getOperand(0))) - if (CI->getOperand(0)->getType() == Type::BoolTy) + if (CI->getOperand(0)->getType() == Type::BoolTy && + CI->getOpcode() == Instruction::ZExt) BoolCast = CI; if (!BoolCast) if (CastInst *CI = dyn_cast(I.getOperand(1))) - if (CI->getOperand(0)->getType() == Type::BoolTy) + if (CI->getOperand(0)->getType() == Type::BoolTy && + CI->getOpcode() == Instruction::ZExt) BoolCast = CI; if (BoolCast) { if (SetCondInst *SCI = dyn_cast(BoolCast->getOperand(0))) { From reid at x10sys.com Wed Dec 13 02:07:02 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Dec 2006 02:07:02 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h Message-ID: <200612130807.kBD872mO018485@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: ScalarEvolutionExpander.h updated: 1.9 -> 1.10 --- Log message: Change the interface to SCEVExpander::InsertCastOfTo to take a cast opcode so the decision of which opcode to use is pushed upward to the caller. Adjust the callers to pass the expected opcode. --- Diffs of the changes: (+17 -4) ScalarEvolutionExpander.h | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) Index: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.9 llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.10 --- llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.9 Mon Dec 4 14:18:26 2006 +++ llvm/include/llvm/Analysis/ScalarEvolutionExpander.h Wed Dec 13 02:06:42 2006 @@ -88,7 +88,8 @@ /// InsertCastOfTo - Insert a cast of V to the specified type, doing what /// we can to share the casts. - static Value *InsertCastOfTo(Value *V, const Type *Ty); + static Value *InsertCastOfTo(Instruction::CastOps opcode, Value *V, + const Type *Ty); protected: Value *expand(SCEV *S) { @@ -104,8 +105,20 @@ Value *expandInTy(SCEV *S, const Type *Ty) { Value *V = expand(S); - if (Ty && V->getType() != Ty) - return InsertCastOfTo(V, Ty); + if (Ty && V->getType() != Ty) { + if (isa(Ty) && V->getType()->isInteger()) + return InsertCastOfTo(Instruction::IntToPtr, V, Ty); + else if (Ty->isInteger() && isa(V->getType())) + return InsertCastOfTo(Instruction::PtrToInt, V, Ty); + else if (Ty->getPrimitiveSizeInBits() == + V->getType()->getPrimitiveSizeInBits()) + return InsertCastOfTo(Instruction::BitCast, V, Ty); + else if (Ty->getPrimitiveSizeInBits() > + V->getType()->getPrimitiveSizeInBits()) + return InsertCastOfTo(Instruction::ZExt, V, Ty); + else + return InsertCastOfTo(Instruction::Trunc, V, Ty); + } return V; } @@ -119,7 +132,7 @@ } Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S) { - Value *V = expandInTy(S->getOperand(),S->getType()->getUnsignedVersion()); + Value *V = expandInTy(S->getOperand(), S->getType()); return CastInst::createZExtOrBitCast(V, S->getType(), "tmp.", InsertPt); } From reid at x10sys.com Wed Dec 13 02:07:03 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Dec 2006 02:07:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Message-ID: <200612130807.kBD8730f018501@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopStrengthReduce.cpp updated: 1.99 -> 1.100 --- Log message: Change the interface to SCEVExpander::InsertCastOfTo to take a cast opcode so the decision of which opcode to use is pushed upward to the caller. Adjust the callers to pass the expected opcode. --- Diffs of the changes: (+21 -12) LoopStrengthReduce.cpp | 33 +++++++++++++++++++++------------ 1 files changed, 21 insertions(+), 12 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp diff -u llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.99 llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.100 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp:1.99 Mon Dec 11 23:04:59 2006 +++ llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp Wed Dec 13 02:06:42 2006 @@ -177,7 +177,7 @@ /// getCastedVersionOf - Return the specified value casted to uintptr_t. /// - Value *getCastedVersionOf(Value *V); + Value *getCastedVersionOf(Instruction::CastOps opcode, Value *V); private: void runOnLoop(Loop *L); bool AddUsersIfInteresting(Instruction *I, Loop *L, @@ -203,19 +203,16 @@ /// getCastedVersionOf - Return the specified value casted to uintptr_t. This /// assumes that the Value* V is of integer or pointer type only. /// -Value *LoopStrengthReduce::getCastedVersionOf(Value *V) { +Value *LoopStrengthReduce::getCastedVersionOf(Instruction::CastOps opcode, + Value *V) { if (V->getType() == UIntPtrTy) return V; if (Constant *CB = dyn_cast(V)) - if (CB->getType()->isInteger()) - return ConstantExpr::getIntegerCast(CB, UIntPtrTy, - CB->getType()->isSigned()); - else - return ConstantExpr::getPtrToInt(CB, UIntPtrTy); + return ConstantExpr::getCast(opcode, CB, UIntPtrTy); Value *&New = CastedPointers[V]; if (New) return New; - New = SCEVExpander::InsertCastOfTo(V, UIntPtrTy); + New = SCEVExpander::InsertCastOfTo(opcode, V, UIntPtrTy); DeadInsts.insert(cast(New)); return New; } @@ -258,7 +255,8 @@ // Build up the base expression. Insert an LLVM cast of the pointer to // uintptr_t first. - SCEVHandle GEPVal = SCEVUnknown::get(getCastedVersionOf(GEP->getOperand(0))); + SCEVHandle GEPVal = SCEVUnknown::get( + getCastedVersionOf(Instruction::PtrToInt, GEP->getOperand(0))); gep_type_iterator GTI = gep_type_begin(GEP); @@ -273,7 +271,13 @@ GEPVal = SCEVAddExpr::get(GEPVal, SCEVUnknown::getIntegerSCEV(Offset, UIntPtrTy)); } else { - Value *OpVal = getCastedVersionOf(GEP->getOperand(i)); + unsigned GEPOpiBits = + GEP->getOperand(i)->getType()->getPrimitiveSizeInBits(); + unsigned IntPtrBits = UIntPtrTy->getPrimitiveSizeInBits(); + Instruction::CastOps opcode = (GEPOpiBits < IntPtrBits ? + Instruction::SExt : (GEPOpiBits > IntPtrBits ? Instruction::Trunc : + Instruction::BitCast)); + Value *OpVal = getCastedVersionOf(opcode, GEP->getOperand(i)); SCEVHandle Idx = SE->getSCEV(OpVal); uint64_t TypeSize = TD->getTypeSize(GTI.getIndexedType()); @@ -1125,8 +1129,13 @@ if (L->contains(User.Inst->getParent())) User.Inst->moveBefore(LatchBlock->getTerminator()); } - if (RewriteOp->getType() != ReplacedTy) - RewriteOp = SCEVExpander::InsertCastOfTo(RewriteOp, ReplacedTy); + if (RewriteOp->getType() != ReplacedTy) { + Instruction::CastOps opcode = Instruction::Trunc; + if (ReplacedTy->getPrimitiveSizeInBits() == + RewriteOp->getType()->getPrimitiveSizeInBits()) + opcode = Instruction::BitCast; + RewriteOp = SCEVExpander::InsertCastOfTo(opcode, RewriteOp, ReplacedTy); + } SCEVHandle RewriteExpr = SCEVUnknown::get(RewriteOp); From criswell at cs.uiuc.edu Wed Dec 13 10:25:17 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 10:25:17 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/include/dsa/DSGraph.h DSGraphTraits.h DSNode.h Message-ID: <200612131625.KAA24429@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/include/dsa: DSGraph.h updated: 1.110.2.2 -> 1.110.2.3 DSGraphTraits.h updated: 1.25 -> 1.25.2.1 DSNode.h updated: 1.58.2.1 -> 1.58.2.2 --- Log message: Only use DSA header files from this project. --- Diffs of the changes: (+3 -3) DSGraph.h | 2 +- DSGraphTraits.h | 2 +- DSNode.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-poolalloc/include/dsa/DSGraph.h diff -u llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.2 llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.3 --- llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.2 Tue Dec 12 17:20:47 2006 +++ llvm-poolalloc/include/dsa/DSGraph.h Wed Dec 13 10:24:48 2006 @@ -15,7 +15,7 @@ #ifndef LLVM_ANALYSIS_DSGRAPH_H #define LLVM_ANALYSIS_DSGRAPH_H -#include "llvm/Analysis/DataStructure/DSNode.h" +#include "dsa/DSNode.h" #include "llvm/ADT/hash_map" #include "llvm/ADT/EquivalenceClasses.h" #include Index: llvm-poolalloc/include/dsa/DSGraphTraits.h diff -u llvm-poolalloc/include/dsa/DSGraphTraits.h:1.25 llvm-poolalloc/include/dsa/DSGraphTraits.h:1.25.2.1 --- llvm-poolalloc/include/dsa/DSGraphTraits.h:1.25 Thu Nov 2 19:43:47 2006 +++ llvm-poolalloc/include/dsa/DSGraphTraits.h Wed Dec 13 10:24:48 2006 @@ -16,7 +16,7 @@ #ifndef LLVM_ANALYSIS_DSGRAPHTRAITS_H #define LLVM_ANALYSIS_DSGRAPHTRAITS_H -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DSGraph.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator" #include "llvm/ADT/STLExtras.h" Index: llvm-poolalloc/include/dsa/DSNode.h diff -u llvm-poolalloc/include/dsa/DSNode.h:1.58.2.1 llvm-poolalloc/include/dsa/DSNode.h:1.58.2.2 --- llvm-poolalloc/include/dsa/DSNode.h:1.58.2.1 Tue Dec 12 16:42:37 2006 +++ llvm-poolalloc/include/dsa/DSNode.h Wed Dec 13 10:24:48 2006 @@ -14,7 +14,7 @@ #ifndef LLVM_ANALYSIS_DSNODE_H #define LLVM_ANALYSIS_DSNODE_H -#include "llvm/Analysis/DataStructure/DSSupport.h" +#include "dsa/DSSupport.h" #include "llvm/ADT/hash_map" namespace llvm { From criswell at cs.uiuc.edu Wed Dec 13 10:26:03 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 10:26:03 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/lib/DSA/DataStructure.cpp Message-ID: <200612131626.KAA24441@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/DSA: DataStructure.cpp updated: 1.248.2.1 -> 1.248.2.2 --- Log message: Do not compile in pool inference code by default. --- Diffs of the changes: (+0 -1) DataStructure.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm-poolalloc/lib/DSA/DataStructure.cpp diff -u llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.1 llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.2 --- llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.1 Tue Dec 12 16:42:42 2006 +++ llvm-poolalloc/lib/DSA/DataStructure.cpp Wed Dec 13 10:25:34 2006 @@ -35,7 +35,6 @@ using namespace llvm; #define COLLAPSE_ARRAYS_AGGRESSIVELY 0 -#define LLVA_KERNEL 1 namespace { Statistic<> NumFolds ("dsa", "Number of nodes completely folded"); Statistic<> NumCallNodesMerged("dsa", "Number of call nodes merged"); From criswell at cs.uiuc.edu Wed Dec 13 10:53:46 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 10:53:46 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/LinkAllPasses.h Message-ID: <200612131653.KAA07269@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm: LinkAllPasses.h updated: 1.4 -> 1.5 --- Log message: Remove DSA. --- Diffs of the changes: (+0 -11) LinkAllPasses.h | 11 ----------- 1 files changed, 11 deletions(-) Index: llvm/include/llvm/LinkAllPasses.h diff -u llvm/include/llvm/LinkAllPasses.h:1.4 llvm/include/llvm/LinkAllPasses.h:1.5 --- llvm/include/llvm/LinkAllPasses.h:1.4 Mon Nov 13 23:21:04 2006 +++ llvm/include/llvm/LinkAllPasses.h Wed Dec 13 10:53:17 2006 @@ -57,8 +57,6 @@ (void) llvm::createConstantMergePass(); (void) llvm::createConstantPropagationPass(); (void) llvm::createCorrelatedExpressionEliminationPass(); - (void) llvm::createDSAAPass(); - (void) llvm::createDSOptPass(); (void) llvm::createDeadArgEliminationPass(); (void) llvm::createDeadCodeEliminationPass(); (void) llvm::createDeadInstEliminationPass(); @@ -106,7 +104,6 @@ (void) llvm::createScalarReplAggregatesPass(); (void) llvm::createSimplifyLibCallsPass(); (void) llvm::createSingleLoopExtractorPass(); - (void) llvm::createSteensgaardPass(); (void) llvm::createStripSymbolsPass(); (void) llvm::createTailCallEliminationPass(); (void) llvm::createTailDuplicationPass(); @@ -118,22 +115,14 @@ (void) llvm::createNullProfilerRSPass(); (void) llvm::createRSProfilingPass(); (void) llvm::createIndMemRemPass(); - (void) llvm::createDataStructureStatsPass(); - (void) llvm::createDataStructureGraphCheckerPass(); (void) llvm::createInstCountPass(); (void) llvm::createPredicateSimplifierPass(); - (void)new llvm::LocalDataStructures(); - (void)new llvm::BUDataStructures(); - (void)new llvm::TDDataStructures(); - (void)new llvm::CompleteBUDataStructures(); - (void)new llvm::EquivClassGraphs(); (void)new llvm::IntervalPartition(); (void)new llvm::ImmediateDominators(); (void)new llvm::PostDominatorSet(); (void)new llvm::FindUsedTypes(); (void)new llvm::ScalarEvolution(); - (void)new llvm::CallTargetFinder(); ((llvm::Function*)0)->viewCFGOnly(); llvm::AliasSetTracker X(*(llvm::AliasAnalysis*)0); X.add((llvm::Value*)0, 0); // for -print-alias-sets From criswell at cs.uiuc.edu Wed Dec 13 10:54:26 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 10:54:26 -0600 Subject: [llvm-commits] CVS: llvm/tools/opt/Makefile Message-ID: <200612131654.KAA07294@choi.cs.uiuc.edu> Changes in directory llvm/tools/opt: Makefile updated: 1.59 -> 1.60 --- Log message: Remove DSA. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/opt/Makefile diff -u llvm/tools/opt/Makefile:1.59 llvm/tools/opt/Makefile:1.60 --- llvm/tools/opt/Makefile:1.59 Mon Sep 4 00:59:09 2006 +++ llvm/tools/opt/Makefile Wed Dec 13 10:54:05 2006 @@ -11,6 +11,6 @@ REQUIRES_EH := 1 LINK_COMPONENTS := bcreader bcwriter instrumentation scalaropts ipo \ - datastructure transforms + transforms include $(LEVEL)/Makefile.common From criswell at cs.uiuc.edu Wed Dec 13 10:54:27 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 10:54:27 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/Makefile Message-ID: <200612131654.KAA07300@choi.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: Makefile updated: 1.19 -> 1.20 --- Log message: Remove DSA. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/tools/bugpoint/Makefile diff -u llvm/tools/bugpoint/Makefile:1.19 llvm/tools/bugpoint/Makefile:1.20 --- llvm/tools/bugpoint/Makefile:1.19 Mon Sep 4 00:59:09 2006 +++ llvm/tools/bugpoint/Makefile Wed Dec 13 10:54:08 2006 @@ -11,7 +11,7 @@ TOOLNAME = bugpoint LINK_COMPONENTS := bcreader bcwriter asmparser instrumentation scalaropts ipo \ - datastructure transforms linker + transforms linker REQUIRES_EH := 1 include $(LEVEL)/Makefile.common From criswell at cs.uiuc.edu Wed Dec 13 10:54:45 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 10:54:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/Makefile Message-ID: <200612131654.KAA07309@choi.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: Makefile updated: 1.11 -> 1.12 --- Log message: Remove DSA. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/Makefile diff -u llvm/lib/Analysis/Makefile:1.11 llvm/lib/Analysis/Makefile:1.12 --- llvm/lib/Analysis/Makefile:1.11 Sun Oct 23 21:24:54 2005 +++ llvm/lib/Analysis/Makefile Wed Dec 13 10:54:24 2006 @@ -9,7 +9,7 @@ LEVEL = ../.. LIBRARYNAME = LLVMAnalysis -PARALLEL_DIRS = IPA DataStructure +PARALLEL_DIRS = IPA BUILD_ARCHIVE = 1 include $(LEVEL)/Makefile.common From criswell at cs.uiuc.edu Wed Dec 13 11:01:55 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 11:01:55 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/DSGraph/dg.exp Message-ID: <200612131701.LAA07381@choi.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/DSGraph: dg.exp (r1.3) removed --- Log message: Remove DSA tests. --- Diffs of the changes: (+0 -0) 0 files changed From criswell at cs.uiuc.edu Wed Dec 13 11:02:14 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 11:02:14 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/DSGraph/.cvsignore Message-ID: <200612131702.LAA07398@choi.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/DSGraph: .cvsignore (r1.2) removed --- Log message: Remove DSA tests. --- Diffs of the changes: (+0 -0) 0 files changed From criswell at cs.uiuc.edu Wed Dec 13 11:02:23 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 11:02:23 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/DSGraph/2003-06-29-IncompleteTDPass.ll 2003-06-29-NodeCollapsing.ll 2003-06-29-NodeCollapsing2.ll 2003-06-30-TopDownResolve.ll 2003-07-01-FieldCollapse.ll 2003-07-16-ConstantExprCollapse.ll 2003-11-02-NodeCollapsing.ll 2004-02-13-memcpy.ll 2004-03-10-ElimLoad.ll 2004-03-10-NoElimLoad.ll 2005-03-22-IncompleteGlobal.ll 2005-03-24-Global-Arg-Alias.ll 2006-03-27-LinkedCollapsed.ll 2006-04-13-ZeroArrayStruct.ll 2006-04-25-ZeroArrayStructUse.ll FunctionPointerTable-const.ll GlobalsGraphFuncPtr.ll HardBUCase.ll PhysicalSubtyping.ll SCCSimpleExample.ll buglobals.ll constant_globals.ll constantize.ll field-sensitive.ll gcsetest.ll incompletenode.ll mustalias.ll strcpy.ll Message-ID: <200612131702.LAA07425@choi.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/DSGraph: 2003-06-29-IncompleteTDPass.ll (r1.5) removed 2003-06-29-NodeCollapsing.ll (r1.4) removed 2003-06-29-NodeCollapsing2.ll (r1.5) removed 2003-06-30-TopDownResolve.ll (r1.6) removed 2003-07-01-FieldCollapse.ll (r1.5) removed 2003-07-16-ConstantExprCollapse.ll (r1.5) removed 2003-11-02-NodeCollapsing.ll (r1.5) removed 2004-02-13-memcpy.ll (r1.7) removed 2004-03-10-ElimLoad.ll (r1.3) removed 2004-03-10-NoElimLoad.ll (r1.3) removed 2005-03-22-IncompleteGlobal.ll (r1.6) removed 2005-03-24-Global-Arg-Alias.ll (r1.3) removed 2006-03-27-LinkedCollapsed.ll (r1.3) removed 2006-04-13-ZeroArrayStruct.ll (r1.3) removed 2006-04-25-ZeroArrayStructUse.ll (r1.4) removed FunctionPointerTable-const.ll (r1.6) removed GlobalsGraphFuncPtr.ll (r1.6) removed HardBUCase.ll (r1.5) removed PhysicalSubtyping.ll (r1.5) removed SCCSimpleExample.ll (r1.4) removed buglobals.ll (r1.3) removed constant_globals.ll (r1.6) removed constantize.ll (r1.3) removed field-sensitive.ll (r1.2) removed gcsetest.ll (r1.8) removed incompletenode.ll (r1.5) removed mustalias.ll (r1.5) removed strcpy.ll (r1.5) removed --- Log message: Remove DSA tests. --- Diffs of the changes: (+0 -0) 0 files changed From rspencer at reidspencer.com Wed Dec 13 11:15:45 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 13 Dec 2006 09:15:45 -0800 Subject: [llvm-commits] CVS: llvm/lib/Analysis/Makefile In-Reply-To: <200612131654.KAA07309@choi.cs.uiuc.edu> References: <200612131654.KAA07309@choi.cs.uiuc.edu> Message-ID: <1166030145.2860.11.camel@bashful.x10sys.com> On Wed, 2006-12-13 at 10:54 -0600, John Criswell wrote: > > Changes in directory llvm/lib/Analysis: > > Makefile updated: 1.11 -> 1.12 > --- > Log message: > > Remove DSA. > > > --- > Diffs of the changes: (+1 -1) > > Makefile | 2 +- > 1 files changed, 1 insertion(+), 1 deletion(-) > > > Index: llvm/lib/Analysis/Makefile > diff -u llvm/lib/Analysis/Makefile:1.11 llvm/lib/Analysis/Makefile:1.12 > --- llvm/lib/Analysis/Makefile:1.11 Sun Oct 23 21:24:54 2005 > +++ llvm/lib/Analysis/Makefile Wed Dec 13 10:54:24 2006 > @@ -9,7 +9,7 @@ > > LEVEL = ../.. > LIBRARYNAME = LLVMAnalysis > -PARALLEL_DIRS = IPA DataStructure > +PARALLEL_DIRS = IPA Not much point in making a single DIR be parallel. > BUILD_ARCHIVE = 1 > > include $(LEVEL)/Makefile.common > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From reid at x10sys.com Wed Dec 13 11:19:24 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Dec 2006 11:19:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612131719.kBDHJO2J006215@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.568 -> 1.569 --- Log message: Implement review feedback. Most of this has to do with removing unnecessary cast instructions. A few are bug fixes. --- Diffs of the changes: (+16 -43) InstructionCombining.cpp | 59 ++++++++++++----------------------------------- 1 files changed, 16 insertions(+), 43 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.568 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.569 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.568 Wed Dec 13 02:33:33 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Dec 13 11:19:09 2006 @@ -2192,11 +2192,6 @@ // Shift the X value right to turn it into "all signbits". Constant *Amt = ConstantInt::get(Type::UByteTy, SCOpTy->getPrimitiveSizeInBits()-1); - if (SCIOp0->getType()->isUnsigned()) { - const Type *NewTy = SCIOp0->getType()->getSignedVersion(); - SCIOp0 = InsertCastBefore(Instruction::BitCast, SCIOp0, NewTy, I); - } - Value *V = InsertNewInstBefore(new ShiftInst(Instruction::AShr, SCIOp0, Amt, BoolCast->getOperand(0)->getName()+ @@ -2871,17 +2866,14 @@ if (Op->hasOneUse()) { Constant *AllOne = ConstantIntegral::getAllOnesValue(AndRHS->getType()); Constant *ShrMask = ConstantExpr::getLShr(AllOne, OpRHS); - Constant *CI = ConstantExpr::getAnd(AndRHS, ShrMask); - if (CI == AndRHS) { // Masking out bits shifted in. + Constant *C = ConstantExpr::getAnd(AndRHS, ShrMask); + if (C == AndRHS) { // Masking out bits shifted in. // (Val ashr C1) & C2 -> (Val lshr C1) & C2 // Make the argument unsigned. Value *ShVal = Op->getOperand(0); - ShVal = InsertNewInstBefore(new ShiftInst(Instruction::LShr, ShVal, - OpRHS, Op->getName()), - TheAnd); - Value *AndRHS2 = ConstantExpr::getBitCast(AndRHS, ShVal->getType()); - - return BinaryOperator::createAnd(ShVal, AndRHS2, TheAnd.getName()); + ShVal = InsertNewInstBefore(new ShiftInst(Instruction::LShr, ShVal, + OpRHS, Op->getName()), TheAnd); + return BinaryOperator::createAnd(ShVal, AndRHS, TheAnd.getName()); } } break; @@ -3929,8 +3921,7 @@ for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, ++GTI) { Value *Op = GEP->getOperand(i); uint64_t Size = TD.getTypeSize(GTI.getIndexedType()) & PtrSizeMask; - Constant *Scale = ConstantExpr::getBitCast(ConstantInt::get(UIntPtrTy, Size), - SIntPtrTy); + Constant *Scale = ConstantInt::get(SIntPtrTy, Size); if (Constant *OpC = dyn_cast(Op)) { if (!OpC->isNullValue()) { OpC = ConstantExpr::getIntegerCast(OpC, SIntPtrTy, true /*SExt*/); @@ -4342,9 +4333,8 @@ // Check to see if there is a noop-cast between the shift and the and. if (!Shift) { if (CastInst *CI = dyn_cast(LHSI->getOperand(0))) - if (CI->getOperand(0)->getType()->isIntegral() && - CI->getOperand(0)->getType()->getPrimitiveSizeInBits() == - CI->getType()->getPrimitiveSizeInBits()) + if (CI->getOpcode() == Instruction::BitCast && + CI->getType()->isIntegral()) Shift = dyn_cast(CI->getOperand(0)); } @@ -4424,12 +4414,8 @@ NS = new ShiftInst(Instruction::Shl, AndCST, Shift->getOperand(1), "tmp"); } else { - // Make sure we insert a logical shift. - Constant *NewAndCST = AndCST; - if (AndCST->getType()->isSigned()) - NewAndCST = ConstantExpr::getBitCast(AndCST, - AndCST->getType()->getUnsignedVersion()); - NS = new ShiftInst(Instruction::LShr, NewAndCST, + // Insert a logical shift. + NS = new ShiftInst(Instruction::LShr, AndCST, Shift->getOperand(1), "tmp"); } InsertNewInstBefore(cast(NS), I); @@ -5434,18 +5420,14 @@ } } else { // (X >>s C1) << C2 where C1 > C2 === (X >>s (C1-C2)) & mask - Op = InsertCastBefore(Instruction::BitCast, Mask, - I.getType()->getSignedVersion(), I); Instruction *Shift = - new ShiftInst(ShiftOp->getOpcode(), Op, + new ShiftInst(ShiftOp->getOpcode(), Mask, ConstantInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); InsertNewInstBefore(Shift, I); C = ConstantIntegral::getAllOnesValue(Shift->getType()); C = ConstantExpr::getShl(C, Op1); - Mask = BinaryOperator::createAnd(Shift, C, Op->getName()+".mask"); - InsertNewInstBefore(Mask, I); - return CastInst::create(Instruction::BitCast, Mask, I.getType()); + return BinaryOperator::createAnd(Shift, C, Op->getName()+".mask"); } } else { // We can handle signed (X << C1) >>s C2 if it's a sign extend. In @@ -5890,11 +5872,7 @@ if (DestBitSize == SrcBitSize || !ValueRequiresCast(Op1, DestTy,TD) || !ValueRequiresCast(Op0, DestTy, TD)) { - unsigned Op0BitSize = Op0->getType()->getPrimitiveSizeInBits(); - Instruction::CastOps opcode = - (Op0BitSize > DestBitSize ? Instruction::Trunc : - (Op0BitSize == DestBitSize ? Instruction::BitCast : - Op0->getType()->isSigned() ? Instruction::SExt :Instruction::ZExt)); + Instruction::CastOps opcode = CI.getOpcode(); Value *Op0c = InsertOperandCastBefore(opcode, Op0, DestTy, SrcI); Value *Op1c = InsertOperandCastBefore(opcode, Op1, DestTy, SrcI); return BinaryOperator::create( @@ -6046,11 +6024,7 @@ // Okay, we can shrink this. Truncate the input, then return a new // shift. - Instruction::CastOps opcode = - (SrcIOp0->getType()->getPrimitiveSizeInBits() == - Ty->getPrimitiveSizeInBits() ? Instruction::BitCast : - Instruction::Trunc); - Value *V = InsertCastBefore(opcode, SrcIOp0, Ty, CI); + Value *V = InsertCastBefore(Instruction::Trunc, SrcIOp0, Ty, CI); return new ShiftInst(Instruction::LShr, V, SrcI->getOperand(1)); } } else { // This is a variable shr. @@ -7352,7 +7326,7 @@ static Value *InsertCastToIntPtrTy(Value *V, const Type *DTy, Instruction *InsertPoint, InstCombiner *IC) { - unsigned PtrSize = IC->getTargetData().getPointerSize(); + unsigned PtrSize = DTy->getPrimitiveSize(); unsigned VTySize = V->getType()->getPrimitiveSize(); // We must cast correctly to the pointer type. Ensure that we // sign extend the integer value if it is smaller as this is @@ -8721,8 +8695,7 @@ if (isFoldableGEP) { std::vector Ops(CE->op_begin()+1, CE->op_end()); uint64_t Offset = TD->getIndexedOffset(Ptr->getType(), Ops); - Constant *C = ConstantInt::get(Type::ULongTy, Offset); - C = ConstantExpr::getIntegerCast(C, TD->getIntPtrType(), true /*SExt*/); + Constant *C = ConstantInt::get(TD->getIntPtrType(), Offset); return ConstantExpr::getIntToPtr(C, CE->getType()); } } From rspencer at reidspencer.com Wed Dec 13 11:20:13 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 13 Dec 2006 09:20:13 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <4CE84EF9-5604-4A99-A336-9BF991A89F39@apple.com> References: <200612120919.kBC9J6qB010276@zion.cs.uiuc.edu> <4CE84EF9-5604-4A99-A336-9BF991A89F39@apple.com> Message-ID: <1166030413.2860.14.camel@bashful.x10sys.com> Hi Chris, Feedback below ... On Tue, 2006-12-12 at 22:42 -0800, Chris Lattner wrote: > This code (around line 2173): > > CastInst *BoolCast = 0; > if (CastInst *CI = dyn_cast(I.getOperand(0))) > if (CI->getOperand(0)->getType() == Type::BoolTy) > BoolCast = CI; > if (!BoolCast) > if (CastInst *CI = dyn_cast(I.getOperand(1))) > if (CI->getOperand(0)->getType() == Type::BoolTy) > BoolCast = CI; > > Should *only* allow zext from bool (not any cast). This is a serious > bug from the original cast patch. Committed last night. > > > > @@ -2190,7 +2193,7 @@ > > SCOpTy- > > >getPrimitiveSizeInBits()-1); > > if (SCIOp0->getType()->isUnsigned()) { > > const Type *NewTy = SCIOp0->getType()->getSignedVersion(); > > - SCIOp0 = InsertCastBefore(SCIOp0, NewTy, I); > > + SCIOp0 = InsertCastBefore(Instruction::BitCast, SCIOp0, > > NewTy, I); > > } > > This cast be removed now that ashr is signless. Right. Fixed. When SETCC finally gets in, I'll be looking for all kinds of useless casts, and not only in InstCombine. > > > > @@ -2863,12 +2872,14 @@ > > Constant *ShrMask = ConstantExpr::getLShr(AllOne, OpRHS); > > Constant *CI = ConstantExpr::getAnd(AndRHS, ShrMask); > > if (CI == AndRHS) { // Masking out bits shifted in. > > + // (Val ashr C1) & C2 -> (Val lshr C1) & C2 > > // Make the argument unsigned. > > Value *ShVal = Op->getOperand(0); > > ShVal = InsertNewInstBefore(new ShiftInst > > (Instruction::LShr, ShVal, > > OpRHS, Op- > > >getName()), > > TheAnd); > > - Value *AndRHS2 = ConstantExpr::getCast(AndRHS, ShVal- > > >getType()); > > + Value *AndRHS2 = ConstantExpr::getBitCast(AndRHS, ShVal- > > >getType()); > > + > > This cast looks completely dead, if so, it should just be removed. Removed. > > > @@ -2897,9 +2908,9 @@ > > InsertNewInstBefore(Add, IB); > > // Convert to unsigned for the comparison. > > const Type *UnsType = Add->getType()->getUnsignedVersion(); > > - Value *OffsetVal = InsertCastBefore(Add, UnsType, IB); > > + Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add, > > UnsType, IB); > > AddCST = ConstantExpr::getAdd(AddCST, Hi); > > - AddCST = ConstantExpr::getCast(AddCST, UnsType); > > + AddCST = ConstantExpr::getBitCast(AddCST, UnsType); > > return new SetCondInst(Instruction::SetLT, OffsetVal, AddCST); > > If only we had signless comparisons! :-) Indeed. I'd like to get back to finishing it off :) > > > @@ -3917,11 +3930,11 @@ > > for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, + > > +GTI) { > > Value *Op = GEP->getOperand(i); > > uint64_t Size = TD.getTypeSize(GTI.getIndexedType()) & > > PtrSizeMask; > > - Constant *Scale = ConstantExpr::getCast(ConstantInt::get > > (UIntPtrTy, Size), > > + Constant *Scale = ConstantExpr::getBitCast(ConstantInt::get > > (UIntPtrTy, Size), > > SIntPtrTy); > > This doesn't fit in 80 columns. Fixed. > Further, you can just use: > > > Constant *Scale = ConstantInt::get(SIntPtrTy, Size); > > Now that Constant[SU]Int got merged into ConstantInt. Yup. Done. > > > This code: > // Check to see if there is a noop-cast between the shift > and the and. > if (!Shift) { > if (CastInst *CI = dyn_cast(LHSI->getOperand(0))) > if (CI->getOperand(0)->getType()->isIntegral() && > CI->getOperand(0)->getType()- > >getPrimitiveSizeInBits() == > CI->getType()->getPrimitiveSizeInBits()) > Shift = dyn_cast(CI->getOperand(0)); > } > > Should check for bitcast with integral src/dest instead of checking > sizes etc. Done. > > > This code: > > // Make sure we insert a logical shift. > Constant *NewAndCST = AndCST; > if (AndCST->getType()->isSigned()) > NewAndCST = ConstantExpr::getBitCast(AndCST, > AndCST->getType()- > >getUnsignedVersion()); > NS = new ShiftInst(Instruction::LShr, NewAndCST, > Shift->getOperand(1), "tmp"); > > You can drop the cast now that the shift is signless. Yup. Done. > > > The two casts here can be eliminated now that shifts are signless: > > // (X >>s C1) << C2 where C1 > C2 === (X >>s (C1-C2)) & mask > Op = InsertCastBefore(Instruction::BitCast, Mask, > I.getType()->getSignedVersion(), I); > Instruction *Shift = > new ShiftInst(ShiftOp->getOpcode(), Op, > ConstantInt::get(Type::UByteTy, ShiftAmt1- > ShiftAmt2)); > InsertNewInstBefore(Shift, I); > > C = ConstantIntegral::getAllOnesValue(Shift->getType()); > C = ConstantExpr::getShl(C, Op1); > Mask = BinaryOperator::createAnd(Shift, C, Op->getName() > +".mask"); > InsertNewInstBefore(Mask, I); > return CastInst::create(Instruction::BitCast, Mask, I.getType > ()); Done. > > > > @@ -5874,10 +5893,15 @@ > > if (DestBitSize == SrcBitSize || > > !ValueRequiresCast(Op1, DestTy,TD) || > > !ValueRequiresCast(Op0, DestTy, TD)) { > > - Value *Op0c = InsertOperandCastBefore(Op0, DestTy, SrcI); > > - Value *Op1c = InsertOperandCastBefore(Op1, DestTy, SrcI); > > - return BinaryOperator::create(cast(SrcI) > > - ->getOpcode(), Op0c, Op1c); > > + unsigned Op0BitSize = Op0->getType()- > > >getPrimitiveSizeInBits(); > > + Instruction::CastOps opcode = > > + (Op0BitSize > DestBitSize ? Instruction::Trunc : > > + (Op0BitSize == DestBitSize ? Instruction::BitCast : > > + Op0->getType()->isSigned() ? > > Instruction::SExt :Instruction::ZExt)); > > This is a serious bug. You can't look at the type of the operand to > determine the type of the cast! Replace this with: > > Instruction::CastOps opcode = CI.getOpcode(); Done. > > > @@ -6014,13 +6042,18 @@ > > > > // Get a mask for the bits shifting in. > > uint64_t Mask = (~0ULL >> (64-ShAmt)) << DestBitWidth; > > - if (SrcI->hasOneUse() && MaskedValueIsZero(SrcI->getOperand > > (0), Mask)) { > > + Value* SrcIOp0 = SrcI->getOperand(0); > > + if (SrcI->hasOneUse() && MaskedValueIsZero(SrcIOp0, Mask)) { > > if (ShAmt >= DestBitWidth) // All zeros. > > return ReplaceInstUsesWith(CI, Constant::getNullValue > > (Ty)); > > > > // Okay, we can shrink this. Truncate the input, then > > return a new > > // shift. > > - Value *V = InsertCastBefore(SrcI->getOperand(0), Ty, CI); > > + Instruction::CastOps opcode = > > + (SrcIOp0->getType()->getPrimitiveSizeInBits() == > > + Ty->getPrimitiveSizeInBits() ? Instruction::BitCast : > > + Instruction::Trunc); > > This is always trunc. > > > > @@ -7316,15 +7355,18 @@ > > return 0; > > } > > > > -static Value *InsertSignExtendToPtrTy(Value *V, const Type *DTy, > > - Instruction *InsertPoint, > > - InstCombiner *IC) { > > - unsigned PS = IC->getTargetData().getPointerSize(); > > - const Type *VTy = V->getType(); > > - if (!VTy->isSigned() && VTy->getPrimitiveSize() < PS) > > - // We must insert a cast to ensure we sign-extend. > > - V = IC->InsertCastBefore(V, VTy->getSignedVersion(), > > *InsertPoint); > > - return IC->InsertCastBefore(V, DTy, *InsertPoint); > > +static Value *InsertCastToIntPtrTy(Value *V, const Type *DTy, > > + Instruction *InsertPoint, > > + InstCombiner *IC) { > > Why did you rename this? Because the name doesn't match its action. SExt is only one possibility. The type of Value* can be larger, smaller, or equal in size to DTy so it can be SExt, Trunc, or BitCast. I figured InsertSignExtendOrTruncateOrBitCastToPtrTy was a bit long. > The previous name was better (indicated > sign extension). The previous name is misleading. It doesn't always do a SExt. Consider long GEP index on a 32-bit platform. The cast needed is a Trunc. > > > + unsigned PtrSize = IC->getTargetData().getPointerSize(); > > This isn't right. Two callers pass in intptr_t, but two pass in > something else. You should use DTy->getPrimitiveSize() instead of > TD.getPointerSize() Okay, missed that. Thanks. > > > + unsigned VTySize = V->getType()->getPrimitiveSize(); > > + // We must cast correctly to the pointer type. Ensure that we > > + // sign extend the integer value if it is smaller as this is > > + // used for address computation. > > + Instruction::CastOps opcode = > > + (VTySize < PtrSize ? Instruction::SExt : > > + (VTySize == PtrSize ? Instruction::BitCast : > > Instruction::Trunc)); > > + return IC->InsertCastBefore(opcode, V, DTy, *InsertPoint); > > } > > > > @@ -8677,8 +8721,8 @@ > > std::vector Ops(CE->op_begin()+1, CE->op_end()); > > uint64_t Offset = TD->getIndexedOffset(Ptr->getType(), Ops); > > Constant *C = ConstantInt::get(Type::ULongTy, Offset); > > + C = ConstantExpr::getIntegerCast(C, TD->getIntPtrType(), > > true /*SExt*/); > > Just use: > > > Constant *C = ConstantInt::get(TD->getIntPtrType(), Offset); Done. > > -Chris > From rspencer at reidspencer.com Wed Dec 13 11:28:30 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 13 Dec 2006 09:28:30 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <3430C265-387A-41D7-8C50-E3225E86E37A@apple.com> References: <200612122336.kBCNaWOT008766@zion.cs.uiuc.edu> <3430C265-387A-41D7-8C50-E3225E86E37A@apple.com> Message-ID: <1166030910.2860.22.camel@bashful.x10sys.com> Hi Chris, Feedback below ... On Tue, 2006-12-12 at 23:14 -0800, Chris Lattner wrote: > On Dec 12, 2006, at 3:36 PM, Reid Spencer wrote: > > @@ -3286,7 +3281,8 @@ > > Op1C- > > >getOperand(0), > > I.getName()); > > InsertNewInstBefore(NewOp, I); > > - return CastInst::createInferredCast(NewOp, I.getType()); > > + return CastInst::createIntegerCast(NewOp, I.getType(), > > + SrcTy->isSigned()); > > } > > } > > } > > @@ -3690,7 +3686,8 @@ > > Op1C- > > >getOperand(0), > > I.getName()); > > InsertNewInstBefore(NewOp, I); > > - return CastInst::createInferredCast(NewOp, I.getType()); > > + return CastInst::createIntegerCast(NewOp, I.getType(), > > + SrcTy->isSigned()); > > } > > } > > > > @@ -3871,7 +3868,8 @@ > > Op1C- > > >getOperand(0), > > I.getName()); > > InsertNewInstBefore(NewOp, I); > > - return CastInst::createInferredCast(NewOp, I.getType()); > > + return CastInst::createIntegerCast(NewOp, I.getType(), > > + SrcTy->isSigned()); > > } > > } > > These three all point out serious bugs. The code looks like this for > each: > > // fold (and (cast A), (cast B)) -> (cast (and A, B)) > if (CastInst *Op1C = dyn_cast(Op1)) { > if (CastInst *Op0C = dyn_cast(Op0)) { > const Type *SrcTy = Op0C->getOperand(0)->getType(); > if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy- > >isIntegral() && > // Only do this if the casts both really cause code to be > generated. > ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) && > ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) { > Instruction *NewOp = BinaryOperator::createAnd(Op0C- > >getOperand(0), > Op1C- > >getOperand(0), > I.getName()); > InsertNewInstBefore(NewOp, I); > return CastInst::createIntegerCast(NewOp, I.getType(), > SrcTy->isSigned()); > } > } > } > > This xform used to be safe before the cast patch, but now can turn > stuff like: > > (and (sext A), (zext B)) > > into: > > (sext (and A, B)) > > which is very wrong (again, never use SrcTy->isSigned!). > > All three of these cases should verify that Op1C->getOpcode() == Op2C- > >getOpcode(), and it should use the opcode in the inserted cast. > That is, either of these are allowed: > > (and (sext A), (sext B)) -> (sext (and A, B)) > (and (zext A), (zext B)) -> (zext (and A, B)) > > but no mixing. Yup, you're right. This is bad. I committed this fix separately last night. > > > @@ -5392,8 +5389,7 @@ > > > > Value *Op = ShiftOp->getOperand(0); > > if (isShiftOfSignedShift != isSignedShift) > > - Op = InsertNewInstBefore( > > - CastInst::createInferredCast(Op, I.getType(), > > "tmp"), I); > > + Op = InsertNewInstBefore(new BitCastInst(Op, I.getType(), > > "tmp"), I); > > This cast can be removed, now that shifts are signless. Yup. Done. > > > @@ -5681,7 +5677,7 @@ > > /// evaluate the expression. > > Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type > > *Ty) { > > if (Constant *C = dyn_cast(V)) > > - return ConstantExpr::getCast(C, Ty); > > + return ConstantExpr::getIntegerCast(C, Ty, C->getType()- > > >isSigned()); > > This looks extremely unsafe. Why is it ok? The only place EvaluateInDifferentType is called is from commonIntCastTransforms. Those casts are guaranteed to only involve integer operands. Therefore, the only kind of cast that could be involved is an integer cast. What looks "extremely" unsafe about it? > > > @@ -7950,13 +7943,20 @@ > > // the same size. Instead of casting the pointer before > > the store, cast > > // the value to be stored. > > Value *NewCast; > > - if (Constant *C = dyn_cast(SI.getOperand(0))) > > - NewCast = ConstantExpr::getCast(C, SrcPTy); > > + Instruction::CastOps opcode = Instruction::BitCast; > > + Value *SIOp0 = SI.getOperand(0); > > + if (SrcPTy->getTypeID() == Type::PointerTyID) { > > isa(SrcPTy) > > > + if (SIOp0->getType()->isIntegral()) > > + opcode = Instruction::IntToPtr; > > + } else if (SrcPTy->isIntegral()) { > > + if (SIOp0->getType()->getTypeID() == Type::PointerTyID) > > isa Both done. > > -Chris > From sabre at nondot.org Wed Dec 13 11:42:55 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 13 Dec 2006 11:42:55 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll union-packed.ll Message-ID: <200612131742.kBDHgt7R006712@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ScalarRepl: union-fp-int.ll updated: 1.1 -> 1.2 union-packed.ll updated: 1.1 -> 1.2 --- Log message: xfail these until I recommit the scalarrepl patch --- Diffs of the changes: (+4 -0) union-fp-int.ll | 2 ++ union-packed.ll | 2 ++ 2 files changed, 4 insertions(+) Index: llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll diff -u llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll:1.1 llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll:1.2 --- llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll:1.1 Sun Dec 10 17:52:28 2006 +++ llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll Wed Dec 13 11:42:40 2006 @@ -1,6 +1,8 @@ ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | not grep alloca && ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | grep 'bitcast.*float.*int' +; XFAIL: * + int %test(float %X) { %X_addr = alloca float store float %X, float* %X_addr Index: llvm/test/Regression/Transforms/ScalarRepl/union-packed.ll diff -u llvm/test/Regression/Transforms/ScalarRepl/union-packed.ll:1.1 llvm/test/Regression/Transforms/ScalarRepl/union-packed.ll:1.2 --- llvm/test/Regression/Transforms/ScalarRepl/union-packed.ll:1.1 Sun Dec 10 18:34:27 2006 +++ llvm/test/Regression/Transforms/ScalarRepl/union-packed.ll Wed Dec 13 11:42:40 2006 @@ -1,6 +1,8 @@ ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | not grep alloca && ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | grep 'bitcast' +; XFAIL: * + target endian = little <4 x int> %test(<4 x float> %X) { From clattner at apple.com Wed Dec 13 11:48:07 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 13 Dec 2006 09:48:07 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <1166030910.2860.22.camel@bashful.x10sys.com> References: <200612122336.kBCNaWOT008766@zion.cs.uiuc.edu> <3430C265-387A-41D7-8C50-E3225E86E37A@apple.com> <1166030910.2860.22.camel@bashful.x10sys.com> Message-ID: <6B06F2A7-35BD-4FB0-BAE4-ADEFD7239D6A@apple.com> >>> @@ -5681,7 +5677,7 @@ >>> /// evaluate the expression. >>> Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type >>> *Ty) { >>> if (Constant *C = dyn_cast(V)) >>> - return ConstantExpr::getCast(C, Ty); >>> + return ConstantExpr::getIntegerCast(C, Ty, C->getType()- >>>> isSigned()); >> >> This looks extremely unsafe. Why is it ok? > > The only place EvaluateInDifferentType is called is from > commonIntCastTransforms. Those casts are guaranteed to only involve > integer operands. Therefore, the only kind of cast that could be > involved is an integer cast. > > What looks "extremely" unsafe about it? I'm specifically concerned that there is nothing controlling whether a zext or sext gets generated other than C->getType()->isSigned(), which I'm not convinced is the right thing. Getting the wrong one is bad :) -Chris From jlaskey at apple.com Wed Dec 13 11:49:39 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 13 Dec 2006 11:49:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/IntrinsicInst.cpp Message-ID: <200612131749.kBDHndjg006830@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: IntrinsicInst.cpp updated: 1.11 -> 1.12 --- Log message: Update version in safe guards. --- Diffs of the changes: (+2 -2) IntrinsicInst.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/IntrinsicInst.cpp diff -u llvm/lib/VMCore/IntrinsicInst.cpp:1.11 llvm/lib/VMCore/IntrinsicInst.cpp:1.12 --- llvm/lib/VMCore/IntrinsicInst.cpp:1.11 Sun Nov 26 19:05:10 2006 +++ llvm/lib/VMCore/IntrinsicInst.cpp Wed Dec 13 11:49:24 2006 @@ -59,7 +59,7 @@ std::string DbgStopPointInst::getFileName() const { // Once the operand indices are verified, update this assert - assert(LLVMDebugVersion == (5 << 16) && "Verify operand indices"); + assert(LLVMDebugVersion == (6 << 16) && "Verify operand indices"); GlobalVariable *GV = cast(getContext()); if (!GV->hasInitializer()) return ""; ConstantStruct *CS = cast(GV->getInitializer()); @@ -68,7 +68,7 @@ std::string DbgStopPointInst::getDirectory() const { // Once the operand indices are verified, update this assert - assert(LLVMDebugVersion == (5 << 16) && "Verify operand indices"); + assert(LLVMDebugVersion == (6 << 16) && "Verify operand indices"); GlobalVariable *GV = cast(getContext()); if (!GV->hasInitializer()) return ""; ConstantStruct *CS = cast(GV->getInitializer()); From clattner at apple.com Wed Dec 13 11:51:12 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 13 Dec 2006 09:51:12 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200612131719.kBDHJO2J006215@zion.cs.uiuc.edu> References: <200612131719.kBDHJO2J006215@zion.cs.uiuc.edu> Message-ID: <157CBD40-873B-4469-9182-3BD882D710A5@apple.com> > Implement review feedback. Most of this has to do with removing > unnecessary > cast instructions. A few are bug fixes. Thanks Reid, > @@ -4342,9 +4333,8 @@ > // Check to see if there is a noop-cast between the > shift and the and. > if (!Shift) { > if (CastInst *CI = dyn_cast(LHSI->getOperand > (0))) > - if (CI->getOperand(0)->getType()->isIntegral() && > - CI->getOperand(0)->getType()- > >getPrimitiveSizeInBits() == > - CI->getType()->getPrimitiveSizeInBits()) > + if (CI->getOpcode() == Instruction::BitCast && > + CI->getType()->isIntegral()) > Shift = dyn_cast(CI->getOperand(0)); > } I'm pretty certain you can also drop the 'CI->getType()->isIntegral ()' check here. Shifts can only return/take integral arguments. -Chris From clattner at apple.com Wed Dec 13 11:53:53 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 13 Dec 2006 09:53:53 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200612130833.kBD8Xmuv027379@zion.cs.uiuc.edu> References: <200612130833.kBD8Xmuv027379@zion.cs.uiuc.edu> Message-ID: > Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp > diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567 > llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.568 > --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567 Wed > Dec 13 02:27:15 2006 > +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Dec 13 > 02:33:33 2006 > @@ -2172,11 +2172,13 @@ > // formed. > CastInst *BoolCast = 0; > if (CastInst *CI = dyn_cast(I.getOperand(0))) > - if (CI->getOperand(0)->getType() == Type::BoolTy) > + if (CI->getOperand(0)->getType() == Type::BoolTy && > + CI->getOpcode() == Instruction::ZExt) > BoolCast = CI; > if (!BoolCast) > if (CastInst *CI = dyn_cast(I.getOperand(1))) > - if (CI->getOperand(0)->getType() == Type::BoolTy) > + if (CI->getOperand(0)->getType() == Type::BoolTy && > + CI->getOpcode() == Instruction::ZExt) > BoolCast = CI; > if (BoolCast) { > if (SetCondInst *SCI = dyn_cast(BoolCast- > >getOperand(0))) { Why not dyn_cast instead of checking the opcode? Thanks Reid, -Chris From clattner at apple.com Wed Dec 13 11:55:22 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 13 Dec 2006 09:55:22 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <1166030413.2860.14.camel@bashful.x10sys.com> References: <200612120919.kBC9J6qB010276@zion.cs.uiuc.edu> <4CE84EF9-5604-4A99-A336-9BF991A89F39@apple.com> <1166030413.2860.14.camel@bashful.x10sys.com> Message-ID: <3E24836E-DA8C-4FDD-ADC0-C65AC2F9241C@apple.com> On Dec 13, 2006, at 9:20 AM, Reid Spencer wrote: >>> +static Value *InsertCastToIntPtrTy(Value *V, const Type *DTy, >>> + Instruction *InsertPoint, >>> + InstCombiner *IC) { >> >> Why did you rename this? > > Because the name doesn't match its action. SExt is only one > possibility. > The type of Value* can be larger, smaller, or equal in size to DTy > so it > can be SExt, Trunc, or BitCast. I figured > InsertSignExtendOrTruncateOrBitCastToPtrTy was a bit long. > >> The previous name was better (indicated >> sign extension). > > The previous name is misleading. It doesn't always do a SExt. > Consider > long GEP index on a 32-bit platform. The cast needed is a Trunc. > Ok. -Chris From rspencer at reidspencer.com Wed Dec 13 11:55:36 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 13 Dec 2006 09:55:36 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <6B06F2A7-35BD-4FB0-BAE4-ADEFD7239D6A@apple.com> References: <200612122336.kBCNaWOT008766@zion.cs.uiuc.edu> <3430C265-387A-41D7-8C50-E3225E86E37A@apple.com> <1166030910.2860.22.camel@bashful.x10sys.com> <6B06F2A7-35BD-4FB0-BAE4-ADEFD7239D6A@apple.com> Message-ID: <1166032536.2860.24.camel@bashful.x10sys.com> On Wed, 2006-12-13 at 09:48 -0800, Chris Lattner wrote: > >>> @@ -5681,7 +5677,7 @@ > >>> /// evaluate the expression. > >>> Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type > >>> *Ty) { > >>> if (Constant *C = dyn_cast(V)) > >>> - return ConstantExpr::getCast(C, Ty); > >>> + return ConstantExpr::getIntegerCast(C, Ty, C->getType()- > >>>> isSigned()); > >> > >> This looks extremely unsafe. Why is it ok? > > > > The only place EvaluateInDifferentType is called is from > > commonIntCastTransforms. Those casts are guaranteed to only involve > > integer operands. Therefore, the only kind of cast that could be > > involved is an integer cast. > > > > What looks "extremely" unsafe about it? > > I'm specifically concerned that there is nothing controlling whether > a zext or sext gets generated other than C->getType()->isSigned(), > which I'm not convinced is the right thing. Getting the wrong one is > bad :) Ah, okay, that makes sense. I'll look at getting rid of the isSigned() call. > > -Chris From rspencer at reidspencer.com Wed Dec 13 12:05:44 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 13 Dec 2006 10:05:44 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: References: <200612130833.kBD8Xmuv027379@zion.cs.uiuc.edu> Message-ID: <1166033144.2860.26.camel@bashful.x10sys.com> On Wed, 2006-12-13 at 09:53 -0800, Chris Lattner wrote: > > Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp > > diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567 > > llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.568 > > --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.567 Wed > > Dec 13 02:27:15 2006 > > +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Dec 13 > > 02:33:33 2006 > > @@ -2172,11 +2172,13 @@ > > // formed. > > CastInst *BoolCast = 0; > > if (CastInst *CI = dyn_cast(I.getOperand(0))) > > - if (CI->getOperand(0)->getType() == Type::BoolTy) > > + if (CI->getOperand(0)->getType() == Type::BoolTy && > > + CI->getOpcode() == Instruction::ZExt) > > BoolCast = CI; > > if (!BoolCast) > > if (CastInst *CI = dyn_cast(I.getOperand(1))) > > - if (CI->getOperand(0)->getType() == Type::BoolTy) > > + if (CI->getOperand(0)->getType() == Type::BoolTy && > > + CI->getOpcode() == Instruction::ZExt) > > BoolCast = CI; > > if (BoolCast) { > > if (SetCondInst *SCI = dyn_cast(BoolCast- > > >getOperand(0))) { > > Why not dyn_cast instead of checking the opcode? Because at midnight I'm not thinking clearly? I've included this in my next round of tests. > > Thanks Reid, > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From rspencer at reidspencer.com Wed Dec 13 12:06:29 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 13 Dec 2006 10:06:29 -0800 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <157CBD40-873B-4469-9182-3BD882D710A5@apple.com> References: <200612131719.kBDHJO2J006215@zion.cs.uiuc.edu> <157CBD40-873B-4469-9182-3BD882D710A5@apple.com> Message-ID: <1166033189.2860.28.camel@bashful.x10sys.com> On Wed, 2006-12-13 at 09:51 -0800, Chris Lattner wrote: > > Implement review feedback. Most of this has to do with removing > > unnecessary > > cast instructions. A few are bug fixes. > > Thanks Reid, > > > @@ -4342,9 +4333,8 @@ > > // Check to see if there is a noop-cast between the > > shift and the and. > > if (!Shift) { > > if (CastInst *CI = dyn_cast(LHSI->getOperand > > (0))) > > - if (CI->getOperand(0)->getType()->isIntegral() && > > - CI->getOperand(0)->getType()- > > >getPrimitiveSizeInBits() == > > - CI->getType()->getPrimitiveSizeInBits()) > > + if (CI->getOpcode() == Instruction::BitCast && > > + CI->getType()->isIntegral()) > > Shift = dyn_cast(CI->getOperand(0)); > > } > > I'm pretty certain you can also drop the 'CI->getType()->isIntegral > ()' check here. Shifts can only return/take integral arguments. Yup, dropped it. > > -Chris From reid at x10sys.com Wed Dec 13 12:21:37 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 13 Dec 2006 12:21:37 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200612131821.kBDILbtc007351@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.569 -> 1.570 --- Log message: Fix a bug in EvaluateInDifferentType. The type of operand should not be used to determine whether a ZExt or SExt cast is performed. Instead, pass an "isSigned" bool to the function and determine its value from the opcode of the cast involved. Also, clean up some cruft from previous patches. --- Diffs of the changes: (+17 -20) InstructionCombining.cpp | 37 +++++++++++++++++-------------------- 1 files changed, 17 insertions(+), 20 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.569 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.570 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.569 Wed Dec 13 11:19:09 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Dec 13 12:21:21 2006 @@ -307,7 +307,7 @@ Instruction *PromoteCastOfAllocation(CastInst &CI, AllocationInst &AI); Instruction *MatchBSwap(BinaryOperator &I); - Value *EvaluateInDifferentType(Value *V, const Type *Ty); + Value *EvaluateInDifferentType(Value *V, const Type *Ty, bool isSigned); }; RegisterPass X("instcombine", "Combine redundant instructions"); @@ -2171,14 +2171,12 @@ // See if we can simplify things based on how the boolean was originally // formed. CastInst *BoolCast = 0; - if (CastInst *CI = dyn_cast(I.getOperand(0))) - if (CI->getOperand(0)->getType() == Type::BoolTy && - CI->getOpcode() == Instruction::ZExt) + if (ZExtInst *CI = dyn_cast(I.getOperand(0))) + if (CI->getOperand(0)->getType() == Type::BoolTy) BoolCast = CI; if (!BoolCast) - if (CastInst *CI = dyn_cast(I.getOperand(1))) - if (CI->getOperand(0)->getType() == Type::BoolTy && - CI->getOpcode() == Instruction::ZExt) + if (ZExtInst *CI = dyn_cast(I.getOperand(1))) + if (CI->getOperand(0)->getType() == Type::BoolTy) BoolCast = CI; if (BoolCast) { if (SetCondInst *SCI = dyn_cast(BoolCast->getOperand(0))) { @@ -4333,8 +4331,7 @@ // Check to see if there is a noop-cast between the shift and the and. if (!Shift) { if (CastInst *CI = dyn_cast(LHSI->getOperand(0))) - if (CI->getOpcode() == Instruction::BitCast && - CI->getType()->isIntegral()) + if (CI->getOpcode() == Instruction::BitCast) Shift = dyn_cast(CI->getOperand(0)); } @@ -5375,10 +5372,8 @@ Amt = Op0->getType()->getPrimitiveSizeInBits(); Value *Op = ShiftOp->getOperand(0); - if (isShiftOfSignedShift != isSignedShift) - Op = InsertNewInstBefore(new BitCastInst(Op, I.getType(), "tmp"), I); ShiftInst *ShiftResult = new ShiftInst(I.getOpcode(), Op, - ConstantInt::get(Type::UByteTy, Amt)); + ConstantInt::get(Type::UByteTy, Amt)); if (I.getType() == ShiftResult->getType()) return ShiftResult; InsertNewInstBefore(ShiftResult, I); @@ -5658,9 +5653,10 @@ /// EvaluateInDifferentType - Given an expression that /// CanEvaluateInDifferentType returns true for, actually insert the code to /// evaluate the expression. -Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type *Ty) { +Value *InstCombiner::EvaluateInDifferentType(Value *V, const Type *Ty, + bool isSigned ) { if (Constant *C = dyn_cast(V)) - return ConstantExpr::getIntegerCast(C, Ty, C->getType()->isSigned()); + return ConstantExpr::getIntegerCast(C, Ty, isSigned /*Sext or ZExt*/); // Otherwise, it must be an instruction. Instruction *I = cast(V); @@ -5669,8 +5665,8 @@ case Instruction::And: case Instruction::Or: case Instruction::Xor: { - Value *LHS = EvaluateInDifferentType(I->getOperand(0), Ty); - Value *RHS = EvaluateInDifferentType(I->getOperand(1), Ty); + Value *LHS = EvaluateInDifferentType(I->getOperand(0), Ty, isSigned); + Value *RHS = EvaluateInDifferentType(I->getOperand(1), Ty, isSigned); Res = BinaryOperator::create((Instruction::BinaryOps)I->getOpcode(), LHS, RHS, I->getName()); break; @@ -5678,7 +5674,7 @@ case Instruction::AShr: case Instruction::LShr: case Instruction::Shl: { - Value *LHS = EvaluateInDifferentType(I->getOperand(0), Ty); + Value *LHS = EvaluateInDifferentType(I->getOperand(0), Ty, isSigned); Res = new ShiftInst((Instruction::OtherOps)I->getOpcode(), LHS, I->getOperand(1), I->getName()); break; @@ -5824,7 +5820,8 @@ } if (DoXForm) { - Value *Res = EvaluateInDifferentType(SrcI, DestTy); + Value *Res = EvaluateInDifferentType(SrcI, DestTy, + CI.getOpcode() == Instruction::SExt); assert(Res->getType() == DestTy); switch (CI.getOpcode()) { default: assert(0 && "Unknown cast type!"); @@ -7920,11 +7917,11 @@ Value *NewCast; Instruction::CastOps opcode = Instruction::BitCast; Value *SIOp0 = SI.getOperand(0); - if (SrcPTy->getTypeID() == Type::PointerTyID) { + if (isa(SrcPTy)) { if (SIOp0->getType()->isIntegral()) opcode = Instruction::IntToPtr; } else if (SrcPTy->isIntegral()) { - if (SIOp0->getType()->getTypeID() == Type::PointerTyID) + if (isa(SIOp0->getType())) opcode = Instruction::PtrToInt; } if (Constant *C = dyn_cast(SIOp0)) From criswell at cs.uiuc.edu Wed Dec 13 12:08:22 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 12:08:22 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/DSAnalysis/arraymerge.ll arraytest.ll badcases.ll basictest.ll dg.exp fieldmerge.ll goodcases.ll indcalltest.ll misctests.ll physicalsubtype.ll recursion.ll simplest-test.ll simpletest.ll structpadding.ll Message-ID: <200612131808.MAA17282@choi.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/DSAnalysis: arraymerge.ll (r1.5) removed arraytest.ll (r1.6) removed badcases.ll (r1.6) removed basictest.ll (r1.6) removed dg.exp (r1.3) removed fieldmerge.ll (r1.6) removed goodcases.ll (r1.5) removed indcalltest.ll (r1.5) removed misctests.ll (r1.6) removed physicalsubtype.ll (r1.6) removed recursion.ll (r1.5) removed simplest-test.ll (r1.5) removed simpletest.ll (r1.5) removed structpadding.ll (r1.6) removed --- Log message: Remove DSA tests. --- Diffs of the changes: (+0 -0) 0 files changed From rspencer at reidspencer.com Wed Dec 13 13:21:07 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 13 Dec 2006 11:21:07 -0800 Subject: [llvm-commits] SETCC Patches (For Review Only) #1: llvm-gcc In-Reply-To: <0D5449D0-4404-4A49-AD36-D8DC4BD9D295@apple.com> References: <1165794220.15266.89.camel@bashful.x10sys.com> <0D5449D0-4404-4A49-AD36-D8DC4BD9D295@apple.com> Message-ID: <1166037667.2860.34.camel@bashful.x10sys.com> Chris, I rewrote the llvm-gcc portion of the SETCC patch with your suggestions. It is much cleaner now. The patch is attached. Hopefully this is more to your liking. Reid. Sheng: This is just FYI. On Sun, 2006-12-10 at 18:03 -0800, Chris Lattner wrote: > On Dec 10, 2006, at 3:43 PM, Reid Spencer wrote: > > Here's the SETCC patch to convert SetCondInst (SetCC) instructions > > into > > ICmpInst. Here's somethings you should know about this patch: > > > > > > 3. The SetCondInst instruction is still used for floating point > > comparisons. > > > Ok, this will be changed in the next patch? > > > > 6. The llvm-gcc patch emits ICmp for integer/pointer and SetCC for > > floating > > point. No FCmpInst instructions are emitted. We'll do that in the > > next patch. > > > Ok, sounds great. > > > For the llvm-gcc patch: > > > Value *EmitCompare(tree_node *exp, unsigned Opc, bool isUnordered); > + Value *EmitCompare(tree_node *exp, unsigned Opc); > > > I don't like the subtle overloads here. One way to fix this: > > > + case LT_EXPR: { > + tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0)); > + if (!FLOAT_TYPE_P(Op0Ty)) > + Result = > + EmitCompare(exp, TYPE_UNSIGNED(Op0Ty) ? > + ICmpInst::ICMP_ULT : ICmpInst::ICMP_SLT); > + else > + Result = EmitCompare(exp, Instruction::SetLT, 0); > + break; > + } > + case LE_EXPR: { > + tree Op0Ty = TREE_TYPE(TREE_OPERAND(exp,0)); > + if (!FLOAT_TYPE_P(Op0Ty)) > + Result = > + EmitCompare(exp, TYPE_UNSIGNED(Op0Ty) ? > + ICmpInst::ICMP_ULE : ICmpInst::ICMP_SLE); > + else > + Result = EmitCompare(exp, Instruction::SetLE, 0); > + break; > + } > > > This logic shouldn't be duplicated everywhere. I much prefer that you > do something like: > > > case LT_EXPR: > Result = EmitCompare(exp, ICmpInst::ICMP_ULT, > ICmpInst::ICMP_SLT, Instruction::SetLT, 0); > break; > > > ... and move the code for determining which opcode to use into > EmitCompare. The same can be > done for EmitMinMaxExpr. > > > > > @@ -2261,8 +2319,8 @@ > Value *Op = Emit(TREE_OPERAND(exp, 0), 0); > if (!Op->getType()->isFloatingPoint()) { > Instruction *OpN = BinaryOperator::createNeg(Op, > Op->getName()+"neg",CurBB); > - Value *Cmp = new SetCondInst(Instruction::SetGE, Op, > OpN->getOperand(0), > - "abscond", CurBB); > + Value *Cmp = new ICmpInst(ICmpInst::ICMP_SGE, Op, > OpN->getOperand(0), > + "abscond", CurBB); > return new SelectInst(Cmp, Op, OpN, "abs", CurBB); > } else { > // Turn FP abs into fabs/fabsf. > > > This isn't right. You need to emit a signed or unsigned comparison > depending on TYPE_UNSIGNED. It would make sense to just use a call to > EmitCompare here and have it pick the right one. I know that unsigned > abs doesn't make much sense, but this is how expr.c handles it for > GCC: > > > /* Unsigned abs is simply the operand. Testing here means we > don't > risk generating incorrect code below. */ > if (TYPE_UNSIGNED (type)) > return op0; > > > @@ -2464,8 +2542,13 @@ > LHS = NOOPCastToType(LHS, Ty); > RHS = NOOPCastToType(RHS, Ty); > > > > > - Value *Pred = new SetCondInst((Instruction::BinaryOps)CmpOpc, LHS, > RHS, > - "tmp", CurBB); > + Value *Pred; > + if (LHS->getType()->isFloatingPoint()) > + Pred = new SetCondInst((Instruction::BinaryOps)CmpOpc, LHS, RHS, > + "tmp", CurBB); > + else > + Pred = new ICmpInst((ICmpInst::Predicate)CmpOpc, LHS, RHS, > + "tmp", CurBB); > return new SelectInst(Pred, LHS, RHS, > TREE_CODE(exp) == MAX_EXPR ? "max" : "min", > CurBB); > } > > > Likewise this code is wrong (for max). It should also just call > EmitCompare. > > > -Chris -------------- next part -------------- A non-text attachment was scrubbed... Name: SETCC-LLVMGCC.patch Type: text/x-patch Size: 9347 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061213/9f148a36/attachment.bin From criswell at cs.uiuc.edu Wed Dec 13 13:39:56 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 13:39:56 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/DSAnalysis/.cvsignore Message-ID: <200612131939.NAA17393@choi.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/DSAnalysis: .cvsignore (r1.2) removed --- Log message: Remove DSA tests. --- Diffs of the changes: (+0 -0) 0 files changed From criswell at cs.uiuc.edu Wed Dec 13 13:42:26 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 13:42:26 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp CallTargets.cpp CompleteBottomUp.cpp DataStructure.cpp DataStructureAA.cpp DataStructureOpt.cpp DataStructureStats.cpp EquivClassGraphs.cpp GraphChecker.cpp Local.cpp Makefile Printer.cpp Steensgaard.cpp TopDownClosure.cpp Message-ID: <200612131942.NAA17445@choi.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: BottomUpClosure.cpp (r1.127) removed CallTargets.cpp (r1.7) removed CompleteBottomUp.cpp (r1.39) removed DataStructure.cpp (r1.255) removed DataStructureAA.cpp (r1.40) removed DataStructureOpt.cpp (r1.14) removed DataStructureStats.cpp (r1.24) removed EquivClassGraphs.cpp (r1.53) removed GraphChecker.cpp (r1.23) removed Local.cpp (r1.163) removed Makefile (r1.5) removed Printer.cpp (r1.91) removed Steensgaard.cpp (r1.67) removed TopDownClosure.cpp (r1.95) removed --- Log message: Remove DSA. --- Diffs of the changes: (+0 -0) 0 files changed From clattner at apple.com Wed Dec 13 13:43:01 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 13 Dec 2006 11:43:01 -0800 Subject: [llvm-commits] SETCC Patches (For Review Only) #1: llvm-gcc In-Reply-To: <1166037667.2860.34.camel@bashful.x10sys.com> References: <1165794220.15266.89.camel@bashful.x10sys.com> <0D5449D0-4404-4A49-AD36-D8DC4BD9D295@apple.com> <1166037667.2860.34.camel@bashful.x10sys.com> Message-ID: <96BE3C9B-AE8A-4DEA-86C5-1ECA8A452594@apple.com> On Dec 13, 2006, at 11:21 AM, Reid Spencer wrote: > Chris, > > I rewrote the llvm-gcc portion of the SETCC patch with your > suggestions. > It is much cleaner now. The patch is attached. Hopefully this is > more to > your liking. Very nice, -Chris From criswell at cs.uiuc.edu Wed Dec 13 13:43:24 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 13:43:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/Makefile Message-ID: <200612131943.NAA17491@choi.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: Makefile updated: 1.12 -> 1.13 --- Log message: Changed from PARALLEL_DIRS to DIRS since we're only building one directory. Thanks Reid. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/Makefile diff -u llvm/lib/Analysis/Makefile:1.12 llvm/lib/Analysis/Makefile:1.13 --- llvm/lib/Analysis/Makefile:1.12 Wed Dec 13 10:54:24 2006 +++ llvm/lib/Analysis/Makefile Wed Dec 13 13:42:54 2006 @@ -9,7 +9,7 @@ LEVEL = ../.. LIBRARYNAME = LLVMAnalysis -PARALLEL_DIRS = IPA +DIRS = IPA BUILD_ARCHIVE = 1 include $(LEVEL)/Makefile.common From criswell at cs.uiuc.edu Wed Dec 13 13:57:25 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 13:57:25 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/DataStructure/CallTargets.h DSGraph.h DSGraphTraits.h DSNode.h DSSupport.h DataStructure.h Message-ID: <200612131957.NAA29677@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis/DataStructure: CallTargets.h (r1.1) removed DSGraph.h (r1.112) removed DSGraphTraits.h (r1.25) removed DSNode.h (r1.60) removed DSSupport.h (r1.41) removed DataStructure.h (r1.98) removed --- Log message: Remove DSA. --- Diffs of the changes: (+0 -0) 0 files changed From dpatel at apple.com Wed Dec 13 14:04:06 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 13 Dec 2006 14:04:06 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h Message-ID: <200612132004.kBDK46fh010447@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.59 -> 1.60 --- Log message: Move enum PassDebugLevel from PassManagerT.h to Pass.h. Use PDL as the prefix for these enums. Define and use PassDebugging_New in new PassManager. --- Diffs of the changes: (+5 -0) Pass.h | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.59 llvm/include/llvm/Pass.h:1.60 --- llvm/include/llvm/Pass.h:1.59 Tue Dec 12 20:36:01 2006 +++ llvm/include/llvm/Pass.h Wed Dec 13 14:03:48 2006 @@ -355,6 +355,11 @@ /// @brief This is the storage for the -time-passes option. extern bool TimePassesIsEnabled; +// Different debug levels that can be enabled... +enum PassDebugLevel { + PDLNone, PDLArguments, PDLStructure, PDLExecutions, PDLDetails +}; + } // End llvm namespace // Include support files that contain important APIs commonly used by Passes, From dpatel at apple.com Wed Dec 13 14:04:06 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 13 Dec 2006 14:04:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManager.cpp PassManagerT.h Message-ID: <200612132004.kBDK465W010457@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Pass.cpp updated: 1.78 -> 1.79 PassManager.cpp updated: 1.93 -> 1.94 PassManagerT.h updated: 1.72 -> 1.73 --- Log message: Move enum PassDebugLevel from PassManagerT.h to Pass.h. Use PDL as the prefix for these enums. Define and use PassDebugging_New in new PassManager. --- Diffs of the changes: (+42 -21) Pass.cpp | 8 ++++---- PassManager.cpp | 26 ++++++++++++++++++++++++++ PassManagerT.h | 29 ++++++++++++----------------- 3 files changed, 42 insertions(+), 21 deletions(-) Index: llvm/lib/VMCore/Pass.cpp diff -u llvm/lib/VMCore/Pass.cpp:1.78 llvm/lib/VMCore/Pass.cpp:1.79 --- llvm/lib/VMCore/Pass.cpp:1.78 Tue Dec 12 20:36:01 2006 +++ llvm/lib/VMCore/Pass.cpp Wed Dec 13 14:03:48 2006 @@ -122,7 +122,7 @@ void PMDebug::PrintPassInformation(unsigned Depth, const char *Action, Pass *P, Module *M) { - if (PassDebugging >= Executions) { + if (PassDebugging >= PDLExecutions) { cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '" << P->getPassName(); if (M) cerr << "' on Module '" << M->getModuleIdentifier() << "'\n"; @@ -132,7 +132,7 @@ void PMDebug::PrintPassInformation(unsigned Depth, const char *Action, Pass *P, Function *F) { - if (PassDebugging >= Executions) { + if (PassDebugging >= PDLExecutions) { cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '" << P->getPassName(); if (F) cerr << "' on Function '" << F->getName(); @@ -142,7 +142,7 @@ void PMDebug::PrintPassInformation(unsigned Depth, const char *Action, Pass *P, BasicBlock *BB) { - if (PassDebugging >= Executions) { + if (PassDebugging >= PDLExecutions) { cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '" << P->getPassName(); if (BB) cerr << "' on BasicBlock '" << BB->getName(); @@ -152,7 +152,7 @@ void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg, Pass *P, const std::vector &Set){ - if (PassDebugging >= Details && !Set.empty()) { + if (PassDebugging >= PDLDetails && !Set.empty()) { cerr << (void*)P << std::string(Depth*2+3, ' ') << Msg << " Analyses:"; for (unsigned i = 0; i != Set.size(); ++i) { if (i) cerr << ","; Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.93 llvm/lib/VMCore/PassManager.cpp:1.94 --- llvm/lib/VMCore/PassManager.cpp:1.93 Tue Dec 12 20:36:01 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Dec 13 14:03:48 2006 @@ -13,6 +13,7 @@ #include "llvm/PassManager.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/Support/Streams.h" @@ -84,6 +85,27 @@ // ModulePassManagers. //===----------------------------------------------------------------------===// +namespace llvm { + +//===----------------------------------------------------------------------===// +// Pass debugging information. Often it is useful to find out what pass is +// running when a crash occurs in a utility. When this library is compiled with +// debugging on, a command line option (--debug-pass) is enabled that causes the +// pass name to be printed before it executes. +// + +static cl::opt +PassDebugging_New("debug-pass", cl::Hidden, + cl::desc("Print PassManager debugging information"), + cl::values( + clEnumVal(PDLNone , "disable debug output"), + clEnumVal(PDLArguments , "print pass arguments to pass to 'opt'"), + clEnumVal(PDLStructure , "print pass structure before run()"), + clEnumVal(PDLExecutions, "print pass name before it is executed"), + clEnumVal(PDLDetails , "print pass details when it is executed"), + clEnumValEnd)); +} // End of llvm namespace + #ifndef USE_OLD_PASSMANAGER namespace llvm { @@ -1241,6 +1263,10 @@ bool PassManagerImpl_New::run(Module &M) { bool Changed = false; + + if (PassDebugging_New >= PDLStructure) + dumpPasses(); + for (std::vector::iterator I = passManagersBegin(), E = passManagersEnd(); I != E; ++I) { ModulePassManager *MP = dynamic_cast(*I); Index: llvm/lib/VMCore/PassManagerT.h diff -u llvm/lib/VMCore/PassManagerT.h:1.72 llvm/lib/VMCore/PassManagerT.h:1.73 --- llvm/lib/VMCore/PassManagerT.h:1.72 Sun Dec 10 01:40:46 2006 +++ llvm/lib/VMCore/PassManagerT.h Wed Dec 13 14:03:48 2006 @@ -37,21 +37,16 @@ // pass name to be printed before it executes. // -// Different debug levels that can be enabled... -enum PassDebugLevel { - None, Arguments, Structure, Executions, Details -}; - static cl::opt PassDebugging("debug-pass", cl::Hidden, - cl::desc("Print PassManager debugging information"), - cl::values( - clEnumVal(None , "disable debug output"), - clEnumVal(Arguments , "print pass arguments to pass to 'opt'"), - clEnumVal(Structure , "print pass structure before run()"), - clEnumVal(Executions, "print pass name before it is executed"), - clEnumVal(Details , "print pass details when it is executed"), - clEnumValEnd)); + cl::desc("Print PassManager debugging information"), + cl::values( + clEnumVal(PDLNone , "disable debug output"), + clEnumVal(PDLArguments , "print pass arguments to pass to 'opt'"), + clEnumVal(PDLStructure , "print pass structure before run()"), + clEnumVal(PDLExecutions, "print pass name before it is executed"), + clEnumVal(PDLDetails , "print pass details when it is executed"), + clEnumValEnd)); //===----------------------------------------------------------------------===// // PMDebug class - a set of debugging functions, that are not to be @@ -60,13 +55,13 @@ struct PMDebug { static void PerformPassStartupStuff(Pass *P) { // If debugging is enabled, print out argument information... - if (PassDebugging >= Arguments) { + if (PassDebugging >= PDLArguments) { cerr << "Pass Arguments: "; PrintArgumentInformation(P); cerr << "\n"; // Print the pass execution structure - if (PassDebugging >= Structure) + if (PassDebugging >= PDLStructure) P->dumpPassStructure(); } } @@ -546,7 +541,7 @@ cerr << "Analysis '" << (*I)->getPassName() << "' used but not available!"; assert(0 && "Analysis used but not available!"); - } else if (PassDebugging == Details) { + } else if (PassDebugging == PDLDetails) { if ((*I)->getPassName() != std::string(Impl->getPassName())) cerr << " Interface '" << (*I)->getPassName() << "' implemented by '" << Impl->getPassName() << "'\n"; @@ -635,7 +630,7 @@ cerr << "Analysis '" << (*I)->getPassName() << "' used but not available!"; assert(0 && "Analysis used but not available!"); - } else if (PassDebugging == Details) { + } else if (PassDebugging == PDLDetails) { if ((*I)->getPassName() != std::string(Impl->getPassName())) cerr << " Interface '" << (*I)->getPassName() << "' implemented by '" << Impl->getPassName() << "'\n"; From criswell at cs.uiuc.edu Wed Dec 13 14:04:51 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 14:04:51 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp Heuristic.cpp PointerCompress.cpp PoolAllocate.cpp TransformFunctionBody.cpp Message-ID: <200612132004.OAA31733@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: AccessTrace.cpp updated: 1.6 -> 1.6.2.1 Heuristic.cpp updated: 1.15 -> 1.15.2.1 PointerCompress.cpp updated: 1.72 -> 1.72.2.1 PoolAllocate.cpp updated: 1.127 -> 1.127.2.1 TransformFunctionBody.cpp updated: 1.57 -> 1.57.2.1 --- Log message: Switch to using DSA header files from the llvm-poolalloc project. --- Diffs of the changes: (+16 -11) AccessTrace.cpp | 5 +++-- Heuristic.cpp | 3 ++- PointerCompress.cpp | 5 +++-- PoolAllocate.cpp | 7 ++++--- TransformFunctionBody.cpp | 7 ++++--- 5 files changed, 16 insertions(+), 11 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp diff -u llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.6 llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.6.2.1 --- llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.6 Tue Oct 24 16:43:50 2006 +++ llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp Wed Dec 13 14:04:22 2006 @@ -12,9 +12,10 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "pointercompress" + +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "poolalloc/PoolAllocate.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/Instructions.h" #include "llvm/Module.h" using namespace llvm; Index: llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp diff -u llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.15 llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.15.2.1 --- llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.15 Wed Jul 26 10:07:40 2006 +++ llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp Wed Dec 13 14:04:22 2006 @@ -12,10 +12,11 @@ //===----------------------------------------------------------------------===// #include "Heuristic.h" + +#include "dsa/DSGraphTraits.h" #include "poolalloc/PoolAllocate.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/Analysis/DataStructure/DSGraphTraits.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/Support/CommandLine.h" #include "llvm/Target/TargetData.h" Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.72 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.72.2.1 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.72 Fri Nov 3 14:14:34 2006 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Wed Dec 13 14:04:23 2006 @@ -12,13 +12,14 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "pointercompress" + +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "poolalloc/PoolAllocate.h" #include "Heuristic.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/CommandLine.h" Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.127 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.127.2.1 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.127 Fri Nov 3 14:14:34 2006 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Wed Dec 13 14:04:23 2006 @@ -13,6 +13,9 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "poolalloc" + +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "poolalloc/PoolAllocate.h" #include "Heuristic.h" #include "llvm/Constants.h" @@ -20,13 +23,11 @@ #include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/Constants.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/Support/CFG.h" #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Cloning.h" -#include "llvm/Analysis/DataStructure/CallTargets.h" +#include "dsa/CallTargets.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" Index: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp diff -u llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.57 llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.57.2.1 --- llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.57 Tue Oct 24 16:43:50 2006 +++ llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Wed Dec 13 14:04:23 2006 @@ -12,10 +12,11 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "PoolAllocator" + +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" +#include "dsa/CallTargets.h" #include "poolalloc/PoolAllocate.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Analysis/DataStructure/CallTargets.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" From criswell at cs.uiuc.edu Wed Dec 13 14:07:02 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 14:07:02 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp PointerCompress.cpp PoolAllocate.cpp PoolOptimize.cpp TransformFunctionBody.cpp Message-ID: <200612132007.OAA31763@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: AccessTrace.cpp updated: 1.6 -> 1.7 PointerCompress.cpp updated: 1.72 -> 1.73 PoolAllocate.cpp updated: 1.127 -> 1.128 PoolOptimize.cpp updated: 1.8 -> 1.9 TransformFunctionBody.cpp updated: 1.57 -> 1.58 --- Log message: Updated to LLVM Mainline API. This required changing statistics to be non-templated and switching over to using the new cast instructions. --- Diffs of the changes: (+65 -50) AccessTrace.cpp | 4 ++-- PointerCompress.cpp | 41 +++++++++++++++++++++-------------------- PoolAllocate.cpp | 29 ++++++++++++++++++++--------- PoolOptimize.cpp | 2 +- TransformFunctionBody.cpp | 39 +++++++++++++++++++++------------------ 5 files changed, 65 insertions(+), 50 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp diff -u llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.6 llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.7 --- llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.6 Tue Oct 24 16:43:50 2006 +++ llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp Wed Dec 13 14:06:42 2006 @@ -81,10 +81,10 @@ if (Node == 0) return; Value *PD = FI->PoolDescriptors[Node]; - Ptr = new CastInst(Ptr, VoidPtrTy, Ptr->getName(), I); + Ptr = CastInst::createPointerCast (Ptr, VoidPtrTy, Ptr->getName(), I); if (PD) - PD = new CastInst(PD, VoidPtrTy, PD->getName(), I); + PD = CastInst::createPointerCast (PD, VoidPtrTy, PD->getName(), I); else PD = Constant::getNullValue(VoidPtrTy); Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.72 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.73 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.72 Fri Nov 3 14:14:34 2006 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Wed Dec 13 14:06:42 2006 @@ -54,11 +54,11 @@ cl::desc("Enable Andrew's fixes/hacks")); - Statistic<> NumCompressed("pointercompress", + Statistic NumCompressed("pointercompress", "Number of pools pointer compressed"); - Statistic<> NumNotCompressed("pointercompress", + Statistic NumNotCompressed("pointercompress", "Number of pools not compressible"); - Statistic<> NumCloned ("pointercompress", "Number of functions cloned"); + Statistic NumCloned ("pointercompress", "Number of functions cloned"); class CompressedPoolInfo; @@ -703,7 +703,7 @@ // Add Idx*sizeof(NewElementType) to the index. const Type *ElTy = cast(NTy)->getElementType(); if (Idx->getType() != SCALARUINTTYPE) - Idx = new CastInst(Idx, SCALARUINTTYPE, Idx->getName(), &GEPI); + Idx = CastInst::createSExtOrBitCast(Idx, SCALARUINTTYPE, Idx->getName(), &GEPI); Constant *Scale = ConstantInt::get(SCALARUINTTYPE, TD.getTypeSize(ElTy)); @@ -729,7 +729,7 @@ // type. if (getPoolInfo(&LI)) { Value *NLI = new LoadInst(LI.getOperand(0), LI.getName()+".cp", &LI); - Value *NC = new CastInst(NLI, SCALARUINTTYPE, NLI->getName(), &LI); + Value *NC = CastInst::createZExtOrBitCast(NLI, SCALARUINTTYPE, NLI->getName(), &LI); setTransformedValue(LI, NC); } return; @@ -746,19 +746,19 @@ std::vector Ops; Ops.push_back(getTransformedValue(LI.getOperand(0))); if (Ops[0]->getType() == Type::UShortTy) - Ops[0] = new CastInst(Ops[0], Type::UIntTy, "extend_idx", &LI); + Ops[0] = CastInst::createZExtOrBitCast(Ops[0], Type::UIntTy, "extend_idx", &LI); Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, LI.getOperand(0)->getName()+".pp", &LI); const Type *DestTy = LoadingCompressedPtr ? MEMUINTTYPE : LI.getType(); - SrcPtr = new CastInst(SrcPtr, PointerType::get(DestTy), - SrcPtr->getName(), &LI); + SrcPtr = CastInst::createPointerCast(SrcPtr, PointerType::get(DestTy), + SrcPtr->getName(), &LI); std::string OldName = LI.getName(); LI.setName(""); Value *NewLoad = new LoadInst(SrcPtr, OldName, &LI); if (LoadingCompressedPtr) { // Convert from MEMUINTTYPE to SCALARUINTTYPE if different. if (MEMUINTTYPE != SCALARUINTTYPE) - NewLoad = new CastInst(NewLoad, SCALARUINTTYPE, NewLoad->getName(), &LI); + NewLoad = CastInst::createZExtOrBitCast(NewLoad, SCALARUINTTYPE, NewLoad->getName(), &LI); setTransformedValue(LI, NewLoad); } else { @@ -777,8 +777,8 @@ // cast the index to a pointer type and store that. if (getPoolInfo(SI.getOperand(0))) { Value *SrcVal = getTransformedValue(SI.getOperand(0)); - SrcVal = new CastInst(SrcVal, SI.getOperand(0)->getType(), - SrcVal->getName(), &SI); + SrcVal = CastInst::createPointerCast(SrcVal, SI.getOperand(0)->getType(), + SrcVal->getName(), &SI); SI.setOperand(0, SrcVal); } return; @@ -798,7 +798,7 @@ // If SCALAR type is not the MEM type, reduce it now. if (SrcVal->getType() != MEMUINTTYPE) - SrcVal = new CastInst(SrcVal, MEMUINTTYPE, SrcVal->getName(), &SI); + SrcVal = CastInst::createZExtOrBitCast(SrcVal, MEMUINTTYPE, SrcVal->getName(), &SI); } } else { // FIXME: This assumes that all null pointers are compressed! @@ -812,13 +812,14 @@ std::vector Ops; Ops.push_back(getTransformedValue(SI.getOperand(1))); if (Ops[0]->getType() == Type::UShortTy) - Ops[0] = new CastInst(Ops[0], Type::UIntTy, "extend_idx", &SI); + Ops[0] = CastInst::createZExtOrBitCast(Ops[0], Type::UIntTy, "extend_idx", &SI); Value *DestPtr = new GetElementPtrInst(BasePtr, Ops, SI.getOperand(1)->getName()+".pp", &SI); - DestPtr = new CastInst(DestPtr, PointerType::get(SrcVal->getType()), - DestPtr->getName(), &SI); + DestPtr = CastInst::createPointerCast(DestPtr, + PointerType::get(SrcVal->getType()), + DestPtr->getName(), &SI); new StoreInst(SrcVal, DestPtr, &SI); // Finally, explicitly remove the store from the program, as it does not @@ -951,7 +952,7 @@ Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, CI.getOperand(2)->getName()+".pp", &CI); - SrcPtr = new CastInst(SrcPtr, CI.getOperand(2)->getType(), "", &CI); + SrcPtr = CastInst::createPointerCast(SrcPtr, CI.getOperand(2)->getType(), "", &CI); CI.setOperand(2, SrcPtr); return; } @@ -962,7 +963,7 @@ Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, CI.getOperand(1)->getName()+".pp", &CI); - SrcPtr = new CastInst(SrcPtr, CI.getOperand(1)->getType(), "", &CI); + SrcPtr = CastInst::createPointerCast(SrcPtr, CI.getOperand(1)->getType(), "", &CI); CI.setOperand(1, SrcPtr); return; } @@ -975,7 +976,7 @@ Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, CI.getOperand(1)->getName()+".pp", &CI); - SrcPtr = new CastInst(SrcPtr, CI.getOperand(1)->getType(), "", &CI); + SrcPtr = CastInst::createPointerCast(SrcPtr, CI.getOperand(1)->getType(), "", &CI); CI.setOperand(1, SrcPtr); return; } @@ -989,7 +990,7 @@ Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, CI.getOperand(1)->getName()+".pp", &CI); - SrcPtr = new CastInst(SrcPtr, CI.getOperand(1)->getType(), "", &CI); + SrcPtr = CastInst::createPointerCast(SrcPtr, CI.getOperand(1)->getType(), "", &CI); CI.setOperand(1, SrcPtr); doret = true; } @@ -999,7 +1000,7 @@ Value *BasePtr = DestPI->EmitPoolBaseLoad(CI); Value *SrcPtr = new GetElementPtrInst(BasePtr, Ops, CI.getOperand(2)->getName()+".pp", &CI); - SrcPtr = new CastInst(SrcPtr, CI.getOperand(2)->getType(), "", &CI); + SrcPtr = CastInst::createPointerCast(SrcPtr, CI.getOperand(2)->getType(), "", &CI); CI.setOperand(2, SrcPtr); doret = true; } Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.127 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.128 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.127 Fri Nov 3 14:14:34 2006 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Wed Dec 13 14:06:42 2006 @@ -57,14 +57,14 @@ RegisterPass Y("poolalloc-passing-all-pools", "Pool allocate disjoint data structures"); - Statistic<> NumArgsAdded("poolalloc", "Number of function arguments added"); - Statistic<> MaxArgsAdded("poolalloc", "Maximum function arguments added to one function"); - Statistic<> NumCloned ("poolalloc", "Number of functions cloned"); - Statistic<> NumPools ("poolalloc", "Number of pools allocated"); - Statistic<> NumTSPools ("poolalloc", "Number of typesafe pools"); - Statistic<> NumPoolFree ("poolalloc", "Number of poolfree's elided"); - Statistic<> NumNonprofit("poolalloc", "Number of DSNodes not profitable"); - Statistic<> NumColocated("poolalloc", "Number of DSNodes colocated"); + Statistic NumArgsAdded("poolalloc", "Number of function arguments added"); + Statistic MaxArgsAdded("poolalloc", "Maximum function arguments added to one function"); + Statistic NumCloned ("poolalloc", "Number of functions cloned"); + Statistic NumPools ("poolalloc", "Number of pools allocated"); + Statistic NumTSPools ("poolalloc", "Number of typesafe pools"); + Statistic NumPoolFree ("poolalloc", "Number of poolfree's elided"); + Statistic NumNonprofit("poolalloc", "Number of DSNodes not profitable"); + Statistic NumColocated("poolalloc", "Number of DSNodes colocated"); const Type *VoidPtrTy; @@ -244,7 +244,18 @@ bool CondIsTrue = User->getOpcode() == Instruction::SetNE; User->replaceAllUsesWith(ConstantBool::get(CondIsTrue)); } - } else if (User->getOpcode() == Instruction::Cast) { + } else if ((User->getOpcode() == Instruction::Trunc) || + (User->getOpcode() == Instruction::ZExt) || + (User->getOpcode() == Instruction::SExt) || + (User->getOpcode() == Instruction::FPToUI) || + (User->getOpcode() == Instruction::FPToSI) || + (User->getOpcode() == Instruction::UIToFP) || + (User->getOpcode() == Instruction::SIToFP) || + (User->getOpcode() == Instruction::FPTrunc) || + (User->getOpcode() == Instruction::FPExt) || + (User->getOpcode() == Instruction::PtrToInt) || + (User->getOpcode() == Instruction::IntToPtr) || + (User->getOpcode() == Instruction::BitCast)) { // Casted pointers are also not null. if (isa(User->getType())) OptimizePointerNotNull(User); Index: llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.8 llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.9 --- llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp:1.8 Fri Nov 3 15:07:06 2006 +++ llvm-poolalloc/lib/PoolAllocate/PoolOptimize.cpp Wed Dec 13 14:06:42 2006 @@ -20,7 +20,7 @@ using namespace llvm; namespace { - Statistic<> NumBumpPtr("poolalloc", "Number of bump pointer pools"); + Statistic NumBumpPtr("poolalloc", "Number of bump pointer pools"); struct PoolOptimize : public ModulePass { bool runOnModule(Module &M); Index: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp diff -u llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.57 llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.58 --- llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.57 Tue Oct 24 16:43:50 2006 +++ llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Wed Dec 13 14:06:42 2006 @@ -149,7 +149,7 @@ std::string Name = I->getName(); I->setName(""); if (Size->getType() != Type::UIntTy) - Size = new CastInst(Size, Type::UIntTy, Size->getName(), I); + Size = CastInst::createZExtOrBitCast(Size, Type::UIntTy, Size->getName(), I); // Insert a call to poolalloc Value *PH = getPoolHandle(I); @@ -162,7 +162,7 @@ // Cast to the appropriate type if necessary Instruction *Casted = V; if (V->getType() != I->getType()) - Casted = new CastInst(V, I->getType(), V->getName(), I); + Casted = CastInst::createPointerCast(V, I->getType(), V->getName(), I); // Update def-use info I->replaceAllUsesWith(Casted); @@ -218,7 +218,7 @@ Value *Casted = AI; Instruction *aiNext = AI->getNext(); if (AI->getType() != PointerType::get(Type::SByteTy)) - Casted = new CastInst(AI, PointerType::get(Type::SByteTy), + Casted = CastInst::createPointerCast(AI, PointerType::get(Type::SByteTy), AI->getName()+".casted",aiNext); Instruction *V = new CallInst(PAInfo.PoolRegister, @@ -246,7 +246,7 @@ MI.getOperand(0), "sizetmp", &MI); // TransformAllocationInstr(&MI, AllocSize); - Instruction *Casted = new CastInst(&MI, PointerType::get(Type::SByteTy), + Instruction *Casted = CastInst::createPointerCast(&MI, PointerType::get(Type::SByteTy), MI.getName()+".casted", MI.getNext()); Instruction *V = new CallInst(PAInfo.PoolRegister, make_vector(PH, Casted, AllocSize, 0), "", Casted->getNext()); @@ -263,7 +263,7 @@ // Insert a cast and a call to poolfree... Value *Casted = Arg; if (Arg->getType() != PointerType::get(Type::SByteTy)) { - Casted = new CastInst(Arg, PointerType::get(Type::SByteTy), + Casted = CastInst::createPointerCast(Arg, PointerType::get(Type::SByteTy), Arg->getName()+".casted", Where); G.getScalarMap()[Casted] = G.getScalarMap()[Arg]; } @@ -302,14 +302,14 @@ Value *V1 = CS.getArgument(0); Value *V2 = CS.getArgument(1); if (V1->getType() != V2->getType()) { - V1 = new CastInst(V1, useLong ? Type::ULongTy : Type::UIntTy, V1->getName(), CS.getInstruction()); - V2 = new CastInst(V2, useLong ? Type::ULongTy : Type::UIntTy, V2->getName(), CS.getInstruction()); + V1 = CastInst::createZExtOrBitCast(V1, useLong ? Type::ULongTy : Type::UIntTy, V1->getName(), CS.getInstruction()); + V2 = CastInst::createZExtOrBitCast(V2, useLong ? Type::ULongTy : Type::UIntTy, V2->getName(), CS.getInstruction()); } V2 = BinaryOperator::create(Instruction::Mul, V1, V2, "size", CS.getInstruction()); if (V2->getType() != (useLong ? Type::ULongTy : Type::UIntTy)) - V2 = new CastInst(V2, useLong ? Type::ULongTy : Type::UIntTy, V2->getName(), CS.getInstruction()); + V2 = CastInst::createZExtOrBitCast(V2, useLong ? Type::ULongTy : Type::UIntTy, V2->getName(), CS.getInstruction()); BasicBlock::iterator BBI = TransformAllocationInstr(CS.getInstruction(), V2); @@ -324,7 +324,7 @@ Type::UIntTy, NULL); if (Ptr->getType() != PointerType::get(Type::SByteTy)) - Ptr = new CastInst(Ptr, PointerType::get(Type::SByteTy), Ptr->getName(), + Ptr = CastInst::createPointerCast(Ptr, PointerType::get(Type::SByteTy), Ptr->getName(), BBI); // We know that the memory returned by poolalloc is at least 4 byte aligned. @@ -342,11 +342,11 @@ Value *Size = CS.getArgument(1); if (Size->getType() != Type::UIntTy) - Size = new CastInst(Size, Type::UIntTy, Size->getName(), I); + Size = CastInst::createZExtOrBitCast(Size, Type::UIntTy, Size->getName(), I); static Type *VoidPtrTy = PointerType::get(Type::SByteTy); if (OldPtr->getType() != VoidPtrTy) - OldPtr = new CastInst(OldPtr, VoidPtrTy, OldPtr->getName(), I); + OldPtr = CastInst::createPointerCast(OldPtr, VoidPtrTy, OldPtr->getName(), I); std::string Name = I->getName(); I->setName(""); Instruction *V = new CallInst(PAInfo.PoolRealloc, make_vector(PH, OldPtr, @@ -354,7 +354,7 @@ Name, I); Instruction *Casted = V; if (V->getType() != I->getType()) - Casted = new CastInst(V, I->getType(), V->getName(), I); + Casted = CastInst::createPointerCast(V, I->getType(), V->getName(), I); // Update def-use info I->replaceAllUsesWith(Casted); @@ -409,13 +409,13 @@ static const Type *PtrPtr=PointerType::get(PointerType::get(Type::SByteTy)); if (ResultDest->getType() != PtrPtr) - ResultDest = new CastInst(ResultDest, PtrPtr, ResultDest->getName(), I); + ResultDest = CastInst::createPointerCast(ResultDest, PtrPtr, ResultDest->getName(), I); } if (Align->getType() != Type::UIntTy) - Align = new CastInst(Align, Type::UIntTy, Align->getName(), I); + Align = CastInst::createZExtOrBitCast(Align, Type::UIntTy, Align->getName(), I); if (Size->getType() != Type::UIntTy) - Size = new CastInst(Size, Type::UIntTy, Size->getName(), I); + Size = CastInst::createZExtOrBitCast(Size, Type::UIntTy, Size->getName(), I); std::string Name = I->getName(); I->setName(""); Instruction *V = new CallInst(PAInfo.PoolMemAlign, @@ -423,7 +423,7 @@ Instruction *Casted = V; if (V->getType() != I->getType()) - Casted = new CastInst(V, I->getType(), V->getName(), I); + Casted = CastInst::createPointerCast(V, I->getType(), V->getName(), I); if (ResultDest) new StoreInst(V, ResultDest, I); @@ -456,8 +456,11 @@ Function *CF = CS.getCalledFunction(); Instruction *TheCall = CS.getInstruction(); + // If the called function is casted from one function type to another, peer + // into the cast instruction and pull out the actual function being called. if (ConstantExpr *CE = dyn_cast(CS.getCalledValue())) - if (CE->getOpcode() == Instruction::Cast && isa(CE->getOperand(0))) + if (CE->getOpcode() == Instruction::BitCast && + isa(CE->getOperand(0))) CF = cast(CE->getOperand(0)); if (isa(TheCall->getOperand(0))) { @@ -601,7 +604,7 @@ PointerType *PFTy = PointerType::get(FTy); // If there are any pool arguments cast the func ptr to the right type. - NewCallee = new CastInst(CS.getCalledValue(), PFTy, "tmp", TheCall); + NewCallee = CastInst::createPointerCast(CS.getCalledValue(), PFTy, "tmp", TheCall); } Function::arg_iterator FAI = CF->arg_begin(), E = CF->arg_end(); From criswell at cs.uiuc.edu Wed Dec 13 13:56:22 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 13:56:22 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/LinkAllPasses.h Message-ID: <200612131956.NAA28803@choi.cs.uiuc.edu> Changes in directory llvm/include/llvm: LinkAllPasses.h updated: 1.5 -> 1.6 --- Log message: Remove DSA header files. --- Diffs of the changes: (+0 -2) LinkAllPasses.h | 2 -- 1 files changed, 2 deletions(-) Index: llvm/include/llvm/LinkAllPasses.h diff -u llvm/include/llvm/LinkAllPasses.h:1.5 llvm/include/llvm/LinkAllPasses.h:1.6 --- llvm/include/llvm/LinkAllPasses.h:1.5 Wed Dec 13 10:53:17 2006 +++ llvm/include/llvm/LinkAllPasses.h Wed Dec 13 13:55:53 2006 @@ -22,8 +22,6 @@ #include "llvm/Analysis/Passes.h" #include "llvm/Analysis/PostDominators.h" #include "llvm/Analysis/ScalarEvolution.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/CallTargets.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Function.h" #include "llvm/Transforms/Instrumentation.h" From evan.cheng at apple.com Wed Dec 13 14:52:15 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 13 Dec 2006 14:52:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200612132052.kBDKqFBB011320@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.93 -> 1.94 --- Log message: Add getTypeToExpandTo() which recursively walks TransformToType to determine the intrinsic type to expand to. --- Diffs of the changes: (+20 -0) TargetLowering.h | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.93 llvm/include/llvm/Target/TargetLowering.h:1.94 --- llvm/include/llvm/Target/TargetLowering.h:1.93 Wed Dec 13 00:12:35 2006 +++ llvm/include/llvm/Target/TargetLowering.h Wed Dec 13 14:52:00 2006 @@ -176,6 +176,26 @@ return TransformToType[VT]; } + /// getTypeToExpandTo - For types supported by the target, this is an + /// identity function. For types that must be expanded (i.e. integer types + /// that are larger than the largest integer register or illegal floating + /// point types), this returns the largest legal type it will be expanded to. + MVT::ValueType getTypeToExpandTo(MVT::ValueType VT) const { + while (true) { + switch (getTypeAction(VT)) { + case Legal: + return VT; + case Expand: + VT = TransformToType[VT]; + break; + default: + assert(false && "Type is not legal nor is it to be expanded!"); + return VT; + } + } + return VT; + } + /// getPackedTypeBreakdown - Packed types are broken down into some number of /// legal first class types. For example, <8 x float> maps to 2 MVT::v4f32 /// with Altivec or SSE1, or 8 promoted MVT::f64 values with the X86 FP stack. From evan.cheng at apple.com Wed Dec 13 14:57:23 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 13 Dec 2006 14:57:23 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp SelectionDAGISel.cpp Message-ID: <200612132057.kBDKvNpG011523@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.439 -> 1.440 SelectionDAGISel.cpp updated: 1.330 -> 1.331 --- Log message: More soft-fp work. --- Diffs of the changes: (+41 -37) LegalizeDAG.cpp | 13 +++++++--- SelectionDAGISel.cpp | 65 +++++++++++++++++++++++++-------------------------- 2 files changed, 41 insertions(+), 37 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.439 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.440 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.439 Tue Dec 12 21:19:57 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Dec 13 14:57:08 2006 @@ -488,9 +488,9 @@ } } -/// ExpandConstantFP - Expands the ConstantFP node by either converting it to -/// integer constant or spilling the constant to memory. -static SDOperand ExpandConstantFP(ConstantFPSDNode *CFP, bool ToMem, +/// ExpandConstantFP - Expands the ConstantFP node to an integer constant or +/// a load from the constant pool. +static SDOperand ExpandConstantFP(ConstantFPSDNode *CFP, bool UseCP, SelectionDAG &DAG, TargetLowering &TLI) { bool Extend = false; @@ -502,7 +502,7 @@ bool isDouble = VT == MVT::f64; ConstantFP *LLVMC = ConstantFP::get(isDouble ? Type::DoubleTy : Type::FloatTy, CFP->getValue()); - if (!ToMem) { + if (!UseCP) { double Val = LLVMC->getValue(); return isDouble ? DAG.getConstant(DoubleToBits(Val), MVT::i64) @@ -4434,6 +4434,8 @@ case ISD::ConstantFP: { ConstantFPSDNode *CFP = cast(Node); Lo = ExpandConstantFP(CFP, false, DAG, TLI); + if (getTypeAction(Lo.getValueType()) == Expand) + ExpandOp(Lo, Lo, Hi); break; } case ISD::BUILD_PAIR: @@ -4526,6 +4528,9 @@ // f32->i32 or f64->i64 one to one expansion. // Remember that we legalized the chain. AddLegalizedOperand(SDOperand(Node, 1), LegalizeOp(Lo.getValue(1))); + // Recursively expand the new load. + if (getTypeAction(NVT) == Expand) + ExpandOp(Lo, Lo, Hi); break; } Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.330 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.331 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.330 Tue Dec 12 18:50:17 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Dec 13 14:57:08 2006 @@ -346,13 +346,10 @@ // If this value is represented with multiple target registers, make sure // to create enough consecutive registers of the right (smaller) type. - unsigned NT = VT-1; // Find the type to use. - while (TLI.getNumElements((MVT::ValueType)NT) != 1) - --NT; - - unsigned R = MakeReg((MVT::ValueType)NT); + VT = TLI.getTypeToExpandTo(VT); + unsigned R = MakeReg(VT); for (unsigned i = 1; i != NV*NumVectorRegs; ++i) - MakeReg((MVT::ValueType)NT); + MakeReg(VT); return R; } @@ -689,19 +686,26 @@ // If this type is not legal, make it so now. if (VT != MVT::Vector) { - MVT::ValueType DestVT = TLI.getTypeToTransformTo(VT); - - N = DAG.getCopyFromReg(DAG.getEntryNode(), InReg, DestVT); - if (DestVT < VT) { + if (TLI.getTypeAction(VT) == TargetLowering::Expand) { // Source must be expanded. This input value is actually coming from the // register pair VMI->second and VMI->second+1. - N = DAG.getNode(ISD::BUILD_PAIR, VT, N, - DAG.getCopyFromReg(DAG.getEntryNode(), InReg+1, DestVT)); - } else if (DestVT > VT) { // Promotion case - if (MVT::isFloatingPoint(VT)) - N = DAG.getNode(ISD::FP_ROUND, VT, N); - else - N = DAG.getNode(ISD::TRUNCATE, VT, N); + MVT::ValueType DestVT = TLI.getTypeToExpandTo(VT); + unsigned NumVals = TLI.getNumElements(VT); + N = DAG.getCopyFromReg(DAG.getEntryNode(), InReg, DestVT); + if (NumVals == 1) + N = DAG.getNode(ISD::BIT_CONVERT, VT, N); + else { + assert(NumVals == 2 && "1 to 4 (and more) expansion not implemented!"); + N = DAG.getNode(ISD::BUILD_PAIR, VT, N, + DAG.getCopyFromReg(DAG.getEntryNode(), InReg+1, DestVT)); + } + } else { + MVT::ValueType DestVT = TLI.getTypeToTransformTo(VT); + N = DAG.getCopyFromReg(DAG.getEntryNode(), InReg, DestVT); + if (TLI.getTypeAction(VT) == TargetLowering::Promote) // Promotion case + N = MVT::isFloatingPoint(VT) + ? DAG.getNode(ISD::FP_ROUND, VT, N) + : DAG.getNode(ISD::TRUNCATE, VT, N); } } else { // Otherwise, if this is a vector, make it available as a generic vector @@ -2916,12 +2920,8 @@ // If this is a large integer, it needs to be broken up into small // integers. Figure out what the destination type is and how many small // integers it turns into. - MVT::ValueType NVT = VT; - unsigned NumVals = 1; - while (getTypeAction(NVT) == Expand) { - NVT = getTypeToTransformTo(NVT); - NumVals *= MVT::getSizeInBits(VT)/MVT::getSizeInBits(NVT); - } + MVT::ValueType NVT = getTypeToExpandTo(VT); + unsigned NumVals = getNumElements(VT); for (unsigned i = 0; i != NumVals; ++i) RetVals.push_back(NVT); } else { @@ -3131,12 +3131,8 @@ // If this is a large integer, it needs to be reassembled from small // integers. Figure out what the source elt type is and how many small // integers it is. - MVT::ValueType NVT = VT; - unsigned NumVals = 1; - while (getTypeAction(NVT) == Expand) { - NVT = getTypeToTransformTo(NVT); - NumVals *= MVT::getSizeInBits(VT)/MVT::getSizeInBits(NVT); - } + MVT::ValueType NVT = getTypeToExpandTo(VT); + unsigned NumVals = getNumElements(VT); for (unsigned i = 0; i != NumVals; ++i) RetTys.push_back(NVT); } else { @@ -3935,17 +3931,20 @@ } return DAG.getNode(ISD::TokenFactor, MVT::Other, &OutChains[0], OutChains.size()); - } else if (SrcVT < DestVT) { + } else if (TLI.getTypeAction(SrcVT) == TargetLowering::Promote) { // The src value is promoted to the register. if (MVT::isFloatingPoint(SrcVT)) Op = DAG.getNode(ISD::FP_EXTEND, DestVT, Op); else Op = DAG.getNode(ISD::ANY_EXTEND, DestVT, Op); return DAG.getCopyToReg(getRoot(), Reg, Op); - } else if (SrcVT == MVT::f32 || SrcVT == MVT::f64) { - return DAG.getCopyToReg(getRoot(), Reg, - DAG.getNode(ISD::BIT_CONVERT, DestVT, Op)); } else { + DestVT = TLI.getTypeToExpandTo(SrcVT); + unsigned NumVals = TLI.getNumElements(SrcVT); + if (NumVals == 1) + return DAG.getCopyToReg(getRoot(), Reg, + DAG.getNode(ISD::BIT_CONVERT, DestVT, Op)); + assert(NumVals == 2 && "1 to 4 (and more) expansion not implemented!"); // The src value is expanded into multiple registers. SDOperand Lo = DAG.getNode(ISD::EXTRACT_ELEMENT, DestVT, Op, DAG.getConstant(0, TLI.getPointerTy())); From criswell at cs.uiuc.edu Wed Dec 13 14:58:33 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 14:58:33 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/autoconf/AutoRegen.sh Message-ID: <200612132058.OAA06149@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/autoconf: AutoRegen.sh added (r1.1.2.1) --- Log message: Added AutoRegen.sh script from the SAFECode project, which is based on the original one from the LLVM project. --- Diffs of the changes: (+30 -0) AutoRegen.sh | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+) Index: llvm-poolalloc/autoconf/AutoRegen.sh diff -c /dev/null llvm-poolalloc/autoconf/AutoRegen.sh:1.1.2.1 *** /dev/null Wed Dec 13 14:58:15 2006 --- llvm-poolalloc/autoconf/AutoRegen.sh Wed Dec 13 14:58:04 2006 *************** *** 0 **** --- 1,30 ---- + #!/bin/sh + die () { + echo "$@" 1>&2 + exit 1 + } + test -d autoconf && test -f autoconf/configure.ac && cd autoconf + test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first" + autoconf --version | egrep '2\.5[0-9]' > /dev/null + if test $? -ne 0 ; then + die "Your autoconf was not detected as being 2.5x" + fi + cwd=`pwd` + if test -d ../../../autoconf/m4 ; then + cd ../../../autoconf/m4 + llvm_m4=`pwd` + cd $cwd + elif test -d ../../llvm/autoconf/m4 ; then + cd ../../llvm/autoconf/m4 + llvm_m4=`pwd` + cd $cwd + else + die "Can't find the LLVM autoconf/m4 directory. The project should be checked out to projects directory" + fi + echo "Regenerating aclocal.m4 with aclocal" + rm -f aclocal.m4 + aclocal -I $llvm_m4 -I "$llvm_m4/.." || die "aclocal failed" + echo "Regenerating configure with autoconf 2.5x" + autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed" + cd .. + exit 0 From evan.cheng at apple.com Wed Dec 13 14:59:58 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 13 Dec 2006 14:59:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README-SSE.txt Message-ID: <200612132059.kBDKxwPk011586@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README-SSE.txt updated: 1.11 -> 1.12 --- Log message: Add note. --- Diffs of the changes: (+5 -0) README-SSE.txt | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/lib/Target/X86/README-SSE.txt diff -u llvm/lib/Target/X86/README-SSE.txt:1.11 llvm/lib/Target/X86/README-SSE.txt:1.12 --- llvm/lib/Target/X86/README-SSE.txt:1.11 Sun Dec 10 19:01:03 2006 +++ llvm/lib/Target/X86/README-SSE.txt Wed Dec 13 14:59:43 2006 @@ -535,3 +535,8 @@ Floating point max / min are commutable when -enable-unsafe-fp-path is specified. We should turn int_x86_sse_max_ss and X86ISD::FMIN etc. into other nodes which are selected to max / min instructions that are marked commutable. + +//===---------------------------------------------------------------------===// + +Add MOVDI2SSrr and MOVDSS2DIrr to X86RegisterInfo::foldMemoryOperand() once the +recent X86 JIT regressions have been identified and fixed. From dpatel at apple.com Wed Dec 13 15:13:48 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 13 Dec 2006 15:13:48 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Pass.h Message-ID: <200612132113.kBDLDm0g011828@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Pass.h updated: 1.60 -> 1.61 --- Log message: Using PDL as a prefix for PassDebugLevel enums is not a good idea. Fix it. --- Diffs of the changes: (+0 -5) Pass.h | 5 ----- 1 files changed, 5 deletions(-) Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.60 llvm/include/llvm/Pass.h:1.61 --- llvm/include/llvm/Pass.h:1.60 Wed Dec 13 14:03:48 2006 +++ llvm/include/llvm/Pass.h Wed Dec 13 15:13:31 2006 @@ -355,11 +355,6 @@ /// @brief This is the storage for the -time-passes option. extern bool TimePassesIsEnabled; -// Different debug levels that can be enabled... -enum PassDebugLevel { - PDLNone, PDLArguments, PDLStructure, PDLExecutions, PDLDetails -}; - } // End llvm namespace // Include support files that contain important APIs commonly used by Passes, From dpatel at apple.com Wed Dec 13 15:13:48 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 13 Dec 2006 15:13:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Pass.cpp PassManager.cpp PassManagerT.h Message-ID: <200612132113.kBDLDmtY011837@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Pass.cpp updated: 1.79 -> 1.80 PassManager.cpp updated: 1.94 -> 1.95 PassManagerT.h updated: 1.73 -> 1.74 --- Log message: Using PDL as a prefix for PassDebugLevel enums is not a good idea. Fix it. --- Diffs of the changes: (+29 -19) Pass.cpp | 8 ++++---- PassManager.cpp | 17 +++++++++++------ PassManagerT.h | 23 ++++++++++++++--------- 3 files changed, 29 insertions(+), 19 deletions(-) Index: llvm/lib/VMCore/Pass.cpp diff -u llvm/lib/VMCore/Pass.cpp:1.79 llvm/lib/VMCore/Pass.cpp:1.80 --- llvm/lib/VMCore/Pass.cpp:1.79 Wed Dec 13 14:03:48 2006 +++ llvm/lib/VMCore/Pass.cpp Wed Dec 13 15:13:31 2006 @@ -122,7 +122,7 @@ void PMDebug::PrintPassInformation(unsigned Depth, const char *Action, Pass *P, Module *M) { - if (PassDebugging >= PDLExecutions) { + if (PassDebugging >= Executions) { cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '" << P->getPassName(); if (M) cerr << "' on Module '" << M->getModuleIdentifier() << "'\n"; @@ -132,7 +132,7 @@ void PMDebug::PrintPassInformation(unsigned Depth, const char *Action, Pass *P, Function *F) { - if (PassDebugging >= PDLExecutions) { + if (PassDebugging >= Executions) { cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '" << P->getPassName(); if (F) cerr << "' on Function '" << F->getName(); @@ -142,7 +142,7 @@ void PMDebug::PrintPassInformation(unsigned Depth, const char *Action, Pass *P, BasicBlock *BB) { - if (PassDebugging >= PDLExecutions) { + if (PassDebugging >= Executions) { cerr << (void*)P << std::string(Depth*2+1, ' ') << Action << " '" << P->getPassName(); if (BB) cerr << "' on BasicBlock '" << BB->getName(); @@ -152,7 +152,7 @@ void PMDebug::PrintAnalysisSetInfo(unsigned Depth, const char *Msg, Pass *P, const std::vector &Set){ - if (PassDebugging >= PDLDetails && !Set.empty()) { + if (PassDebugging >= Details && !Set.empty()) { cerr << (void*)P << std::string(Depth*2+3, ' ') << Msg << " Analyses:"; for (unsigned i = 0; i != Set.size(); ++i) { if (i) cerr << ","; Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.94 llvm/lib/VMCore/PassManager.cpp:1.95 --- llvm/lib/VMCore/PassManager.cpp:1.94 Wed Dec 13 14:03:48 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Dec 13 15:13:31 2006 @@ -94,15 +94,20 @@ // pass name to be printed before it executes. // +// Different debug levels that can be enabled... +enum PassDebugLevel { + None, Arguments, Structure, Executions, Details +}; + static cl::opt PassDebugging_New("debug-pass", cl::Hidden, cl::desc("Print PassManager debugging information"), cl::values( - clEnumVal(PDLNone , "disable debug output"), - clEnumVal(PDLArguments , "print pass arguments to pass to 'opt'"), - clEnumVal(PDLStructure , "print pass structure before run()"), - clEnumVal(PDLExecutions, "print pass name before it is executed"), - clEnumVal(PDLDetails , "print pass details when it is executed"), + clEnumVal(None , "disable debug output"), + clEnumVal(Arguments , "print pass arguments to pass to 'opt'"), + clEnumVal(Structure , "print pass structure before run()"), + clEnumVal(Executions, "print pass name before it is executed"), + clEnumVal(Details , "print pass details when it is executed"), clEnumValEnd)); } // End of llvm namespace @@ -1264,7 +1269,7 @@ bool Changed = false; - if (PassDebugging_New >= PDLStructure) + if (PassDebugging_New >= Structure) dumpPasses(); for (std::vector::iterator I = passManagersBegin(), Index: llvm/lib/VMCore/PassManagerT.h diff -u llvm/lib/VMCore/PassManagerT.h:1.73 llvm/lib/VMCore/PassManagerT.h:1.74 --- llvm/lib/VMCore/PassManagerT.h:1.73 Wed Dec 13 14:03:48 2006 +++ llvm/lib/VMCore/PassManagerT.h Wed Dec 13 15:13:31 2006 @@ -37,15 +37,20 @@ // pass name to be printed before it executes. // +// Different debug levels that can be enabled... +enum PassDebugLevel { + None, Arguments, Structure, Executions, Details +}; + static cl::opt PassDebugging("debug-pass", cl::Hidden, cl::desc("Print PassManager debugging information"), cl::values( - clEnumVal(PDLNone , "disable debug output"), - clEnumVal(PDLArguments , "print pass arguments to pass to 'opt'"), - clEnumVal(PDLStructure , "print pass structure before run()"), - clEnumVal(PDLExecutions, "print pass name before it is executed"), - clEnumVal(PDLDetails , "print pass details when it is executed"), + clEnumVal(None , "disable debug output"), + clEnumVal(Arguments , "print pass arguments to pass to 'opt'"), + clEnumVal(Structure , "print pass structure before run()"), + clEnumVal(Executions, "print pass name before it is executed"), + clEnumVal(Details , "print pass details when it is executed"), clEnumValEnd)); //===----------------------------------------------------------------------===// @@ -55,13 +60,13 @@ struct PMDebug { static void PerformPassStartupStuff(Pass *P) { // If debugging is enabled, print out argument information... - if (PassDebugging >= PDLArguments) { + if (PassDebugging >= Arguments) { cerr << "Pass Arguments: "; PrintArgumentInformation(P); cerr << "\n"; // Print the pass execution structure - if (PassDebugging >= PDLStructure) + if (PassDebugging >= Structure) P->dumpPassStructure(); } } @@ -541,7 +546,7 @@ cerr << "Analysis '" << (*I)->getPassName() << "' used but not available!"; assert(0 && "Analysis used but not available!"); - } else if (PassDebugging == PDLDetails) { + } else if (PassDebugging == Details) { if ((*I)->getPassName() != std::string(Impl->getPassName())) cerr << " Interface '" << (*I)->getPassName() << "' implemented by '" << Impl->getPassName() << "'\n"; @@ -630,7 +635,7 @@ cerr << "Analysis '" << (*I)->getPassName() << "' used but not available!"; assert(0 && "Analysis used but not available!"); - } else if (PassDebugging == PDLDetails) { + } else if (PassDebugging == Details) { if ((*I)->getPassName() != std::string(Impl->getPassName())) cerr << " Interface '" << (*I)->getPassName() << "' implemented by '" << Impl->getPassName() << "'\n"; From sabre at nondot.org Wed Dec 13 15:55:45 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 13 Dec 2006 15:55:45 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassAnalysisSupport.h Message-ID: <200612132155.kBDLtjan012663@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassAnalysisSupport.h updated: 1.25 -> 1.26 --- Log message: fit in 80 cols --- Diffs of the changes: (+3 -4) PassAnalysisSupport.h | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) Index: llvm/include/llvm/PassAnalysisSupport.h diff -u llvm/include/llvm/PassAnalysisSupport.h:1.25 llvm/include/llvm/PassAnalysisSupport.h:1.26 --- llvm/include/llvm/PassAnalysisSupport.h:1.25 Tue Dec 12 20:36:01 2006 +++ llvm/include/llvm/PassAnalysisSupport.h Wed Dec 13 15:55:30 2006 @@ -213,10 +213,9 @@ #ifdef USE_OLD_PASSMANAGER assert(Resolver && "Pass has not been inserted into a PassManager object!"); #else - assert(Resolver_New && "Pass has not been inserted into a PassManager object!"); + assert(Resolver_New&&"Pass has not been inserted into a PassManager object!"); #endif - const PassInfo *PI = getClassPassInfo(); - return getAnalysisID(PI); + return getAnalysisID(getClassPassInfo()); } template @@ -239,7 +238,7 @@ } } #else - assert(Resolver_New && "Pass has not been inserted into a PassManager object!"); + assert(Resolver_New&&"Pass has not been inserted into a PassManager object!"); // PI *must* appear in AnalysisImpls. Because the number of passes used // should be a small number, we just do a linear search over a (dense) // vector. From sabre at nondot.org Wed Dec 13 15:56:25 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 13 Dec 2006 15:56:25 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612132156.kBDLuPU8012723@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.95 -> 1.96 --- Log message: fit in 80 cols --- Diffs of the changes: (+7 -6) PassManager.cpp | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.95 llvm/lib/VMCore/PassManager.cpp:1.96 --- llvm/lib/VMCore/PassManager.cpp:1.95 Wed Dec 13 15:13:31 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Dec 13 15:56:10 2006 @@ -366,10 +366,10 @@ //===----------------------------------------------------------------------===// // FunctionPassManagerImpl_New // -/// FunctionPassManagerImpl_New manages FunctionPasses and BasicBlockPassManagers. -/// It batches all function passes and basic block pass managers together and -/// sequence them to process one function at a time before processing next -/// function. +/// FunctionPassManagerImpl_New manages FunctionPasses and +/// BasicBlockPassManagers. It batches all function passes and basic block pass +/// managers together and sequence them to process one function at a time before +/// processing next function. class FunctionPassManagerImpl_New : public ModulePass, public PMDataManager, public PMTopLevelManager { @@ -1184,8 +1184,9 @@ activeFunctionPassManager->setTopLevelManager(this->getTopLevelManager()); // Add new manager into top level manager's indirect passes list - PMDataManager *PMD = dynamic_cast(activeFunctionPassManager); - assert (PMD && "Manager is not Pass Manager"); + PMDataManager *PMD = + dynamic_cast(activeFunctionPassManager); + assert(PMD && "Manager is not Pass Manager"); TPM->addIndirectPassManager(PMD); // Add pass into new manager. This time it must succeed. From criswell at cs.uiuc.edu Wed Dec 13 15:57:07 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 15:57:07 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/autoconf/AutoRegen.sh aclocal.m4 configure.ac Message-ID: <200612132157.PAA32067@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/autoconf: AutoRegen.sh updated: 1.1.2.1 -> 1.1.2.2 aclocal.m4 updated: 1.5 -> 1.5.2.1 configure.ac updated: 1.10 -> 1.10.2.1 --- Log message: Updated to a newer version of the project autoconf files. Fixed the generation of configure so that it correctly finds the tools for installing Makefiles. Added options for enabling SAFECode extensions, SAFECode bounds checking extensions, and pool inference. --- Diffs of the changes: (+119 -6170) AutoRegen.sh | 26 aclocal.m4 | 6186 ----------------------------------------------------------- configure.ac | 77 3 files changed, 119 insertions(+), 6170 deletions(-) Index: llvm-poolalloc/autoconf/AutoRegen.sh diff -u llvm-poolalloc/autoconf/AutoRegen.sh:1.1.2.1 llvm-poolalloc/autoconf/AutoRegen.sh:1.1.2.2 --- llvm-poolalloc/autoconf/AutoRegen.sh:1.1.2.1 Wed Dec 13 14:58:04 2006 +++ llvm-poolalloc/autoconf/AutoRegen.sh Wed Dec 13 15:56:38 2006 @@ -7,20 +7,42 @@ test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first" autoconf --version | egrep '2\.5[0-9]' > /dev/null if test $? -ne 0 ; then - die "Your autoconf was not detected as being 2.5x" + die "Your autoconf was not detected as being 2.5x" fi cwd=`pwd` if test -d ../../../autoconf/m4 ; then cd ../../../autoconf/m4 llvm_m4=`pwd` + llvm_src_root='`(cd ../..; pwd)`' + llvm_obj_root='`(cd ../..; pwd)`' cd $cwd elif test -d ../../llvm/autoconf/m4 ; then cd ../../llvm/autoconf/m4 llvm_m4=`pwd` + llvm_src_root='`(cd ../..; pwd)`' + llvm_obj_root='`(cd ../..; pwd)`' cd $cwd else - die "Can't find the LLVM autoconf/m4 directory. The project should be checked out to projects directory" + while true ; do + echo "LLVM source root not found." + read -p "Enter full path to LLVM source:" + if test -d "$REPLY/autoconf/m4" ; then + llvm_src_root="$REPLY" + llvm_m4="$REPLY/autoconf/m4" + read -p "Enter full path to LLVM objects (empty for same as source):" + if test -d "$REPLY" ; then + llvm_obj_root="$REPLY" + else + llvm_obj_root="$llvm_src_root" + fi + break + fi + done fi +# Patch the LLVM_ROOT in configure.ac, if it needs it +cp configure.ac configure.bak +sed -e "s#^LLVM_SRC_ROOT=.*#LLVM_SRC_ROOT=\"$llvm_src_root\"#" \ + -e "s#^LLVM_OBJ_ROOT=.*#LLVM_OBJ_ROOT=\"$llvm_obj_root\"#" configure.bak > configure.ac echo "Regenerating aclocal.m4 with aclocal" rm -f aclocal.m4 aclocal -I $llvm_m4 -I "$llvm_m4/.." || die "aclocal failed" Index: llvm-poolalloc/autoconf/aclocal.m4 diff -u llvm-poolalloc/autoconf/aclocal.m4:1.5 llvm-poolalloc/autoconf/aclocal.m4:1.5.2.1 --- llvm-poolalloc/autoconf/aclocal.m4:1.5 Wed May 18 14:56:21 2005 +++ llvm-poolalloc/autoconf/aclocal.m4 Wed Dec 13 15:56:38 2006 @@ -1,6136 +1,64 @@ -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -## Copyright 1996, 1997, 1998, 1999, 2000, 2001 -## Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit , 1996 -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -## -## As a special exception to the GNU General Public License, if you -## distribute this file as part of a program that contains a -## configuration script generated by Autoconf, you may include it under -## the same distribution terms that you use for the rest of that program. +# generated automatically by aclocal 1.9.2 -*- Autoconf -*- -# serial 47 AC_PROG_LIBTOOL - - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# AC_PROG_LIBTOOL -# --------------- -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX - ])]) -dnl And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], - defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) -])])# AC_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/mklib' -AC_SUBST(LIBTOOL)dnl - -# Prevent multiple expansion -define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL - - -# AC_LIBTOOL_SETUP -# ---------------- -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl - -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -_LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=mklib -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -enable_win32_dll=yes, enable_win32_dll=no) - -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP - - -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER - - -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX - - -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT - - -# _LT_AC_PROG_ECHO_BACKSLASH -# -------------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -echo=${ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - testring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ - = "XX$testring") >/dev/null 2>&1 && - new_result=`expr "X$testring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - testring=$testring$testring - done - testring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - - -# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ------------------------------------------------------------------ -AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -}] -EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_unknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_AC_TRY_DLOPEN_SELF - - -# AC_LIBTOOL_DLOPEN_SELF -# ------------------- -AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -])# AC_LIBTOOL_DLOPEN_SELF - - -# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) -# --------------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler -AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - # According to Tom Tromey, Ian Lance Taylor reported there are C compilers - # that will create temporary files in the current directory regardless of - # the output directory. Thus, making CWD read-only will cause this test - # to fail, enabling locking or at least warning the user not to do parallel - # builds. - chmod -w . - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* out/* - rmdir out - cd .. - rmdir conftest - $rm conftest* -]) -])# AC_LIBTOOL_PROG_CC_C_O - - -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- -# Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - -hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS - - -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR - - -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- -# Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) -fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP - - -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- -# PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# AC_LIBTOOL_WIN32_DLL -# -------------------- -# declare package support for building win32 dll's -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([shared], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# AC_DISABLE_SHARED -# ----------------- -#- set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no) -])# AC_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([static], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# AC_DISABLE_STATIC -# ----------------- -# set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no) -])# AC_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([fast-install], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# AC_DISABLE_FAST_INSTALL -# ----------------------- -# set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no) -])# AC_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default) -])# AC_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool at gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -])# AC_PATH_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the path to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no]) -AC_REQUIRE([LT_AC_PROG_SED])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - case $host_cpu in - alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh*) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the path to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_NM - - -# AC_CHECK_LIBM -# ------------- -# check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single -# quotes!). If your package is not flat and you're not using automake, -# define top_builddir and top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, lt_dlinit, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,CXX" | sed 's/^,//'`]) -])# _LT_AC_LANG_CXX - - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,F77" | sed 's/^,//'`]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], - [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], - [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], - [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,GCJ" | sed 's/^,//'`]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,RC" | sed 's/^,//'`]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) - -# Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) - -# Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" - -# Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) - -# The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) - -# Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) - -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) - -__EOF__ - -ifelse([$1],[], [ - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGISTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $CC in - icc|ecc) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi4*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C - - -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) - - -# old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -# This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL]) - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ -# LT_AC_PROG_SED -# -------------- -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -AC_DEFUN([LT_AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -SED=$lt_cv_path_SED -]) -AC_MSG_RESULT([$SED]) -]) -############################################################################# -# Additional Macros -############################################################################# - -# -# Check for C++ namespace support. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html -# -AC_DEFUN([AC_CXX_NAMESPACES], -[AC_CACHE_CHECK(whether the compiler implements namespaces, -ac_cv_cxx_namespaces, -[AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], - [using namespace Outer::Inner; return i;], - ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_namespaces" = yes; then - AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) -fi -]) - -# -# Check for hash_map extension. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_map.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_HASH_MAP], -[AC_CACHE_CHECK(whether the compiler has ext/hash_map, -ac_cv_cxx_have_ext_hash_map, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[hash_map t; return 0;], - ac_cv_cxx_have_ext_hash_map=std, ac_cv_cxx_have_ext_hash_map=no) - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[hash_map t; return 0;], - ac_cv_cxx_have_ext_hash_map=gnu, ac_cv_cxx_have_ext_hash_map=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_hash_map" = std; then - AC_DEFINE(HAVE_STD_EXT_HASH_MAP,,[define if the compiler has ext/hash_map]) -fi -if test "$ac_cv_cxx_have_ext_hash_map" = gnu; then - AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,,[define if the compiler has ext/hash_map]) -fi -]) - -# -# Check for hash_set extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_HASH_SET], -[AC_CACHE_CHECK(whether the compiler has ext/hash_set, -ac_cv_cxx_have_ext_hash_set, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[hash_set t; return 0;], - ac_cv_cxx_have_ext_hash_set=std, ac_cv_cxx_have_ext_hash_set=no) - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[hash_set t; return 0;], - ac_cv_cxx_have_ext_hash_set=gnu, ac_cv_cxx_have_ext_hash_set=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_hash_set" = std; then - AC_DEFINE(HAVE_STD_EXT_HASH_SET,,[define if the compiler has ext/hash_set in std]) -fi -if test "$ac_cv_cxx_have_ext_hash_set" = gnu; then - AC_DEFINE(HAVE_GNU_EXT_HASH_SET,,[define if the compiler has ext/hash_set in __gnu_cc]) -fi -]) - -# -# Check for standard iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_STD_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has the standard iterator, -ac_cv_cxx_have_std_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[iterator t; return 0;], - ac_cv_cxx_have_std_iterator=yes, ac_cv_cxx_have_std_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_std_iterator" = yes; then - AC_DEFINE(HAVE_STD_ITERATOR,,[define if the compiler has STL iterators]) -fi -]) - -# -# Check for bidirectional iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_BI_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has the bidirectional iterator, -ac_cv_cxx_have_bi_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[bidirectional_iterator t; return 0;], - ac_cv_cxx_have_bi_iterator=yes, ac_cv_cxx_have_bi_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_bi_iterator" = yes; then - AC_DEFINE(HAVE_BI_ITERATOR,,[define if the compiler has bidirectional iterator]) -fi -]) - -# -# Check for forward iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_FWD_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has forward iterators, -ac_cv_cxx_have_fwd_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[forward_iterator t; return 0;], - ac_cv_cxx_have_fwd_iterator=yes, ac_cv_cxx_have_fwd_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_fwd_iterator" = yes; then - AC_DEFINE(HAVE_FWD_ITERATOR,,[define if the compiler has STL iterators]) -fi -]) - -# -# Check for slist extension. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_SLIST], -[AC_CACHE_CHECK(whether the compiler has ext/slist, -ac_cv_cxx_have_ext_slist, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[slist s; return 0;], - ac_cv_cxx_have_ext_slist=std, ac_cv_cxx_have_ext_slist=no) - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[slist s; return 0;], - ac_cv_cxx_have_ext_slist=gnu, ac_cv_cxx_have_ext_slist=no) - - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_slist" = std; then - AC_DEFINE(HAVE_EXT_SLIST,std,[define if the compiler has ext/slist]) -fi -if test "$ac_cv_cxx_have_ext_slist" = gnu; then - AC_DEFINE(HAVE_EXT_SLIST,gnu,[define if the compiler has ext/slist]) -fi -]) +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. # -# Check for FLEX. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html +# Configure a Makefile without clobbering it if it exists and is not out of +# date. This macro is unique to LLVM. # -AC_DEFUN([AC_PROG_FLEX], -[AC_CACHE_CHECK(, -ac_cv_has_flex, -[AC_PROG_LEX() -]) -if test "$LEX" != "flex"; then - AC_MSG_ERROR([flex not found but required]) -fi +AC_DEFUN([AC_CONFIG_MAKEFILE], +[AC_CONFIG_COMMANDS($1, + [${llvm_src}/autoconf/mkinstalldirs `dirname $1` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/$1 $1]) ]) # -# Check for Bison. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html +# Provide the arguments and other processing needed for an LLVM project # -AC_DEFUN([AC_PROG_BISON], -[AC_CACHE_CHECK(, -ac_cv_has_bison, -[AC_PROG_YACC() -]) -if test "$YACC" != "bison -y"; then - AC_MSG_ERROR([bison not found but required]) -else - AC_SUBST(YACC,[bison],[location of bison]) -fi +AC_DEFUN([LLVM_CONFIG_PROJECT], + [AC_ARG_WITH([llvmsrc], + AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]), + [llvm_src="$withval"],[llvm_src="]$1["]) + AC_SUBST(LLVM_SRC,$llvm_src) + AC_ARG_WITH([llvmobj], + AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]), + [llvm_obj="$withval"],[llvm_obj="]$2["]) + AC_SUBST(LLVM_OBJ,$llvm_obj) + AC_CONFIG_COMMANDS([setup],,[llvm_src="${LLVM_SRC}"]) ]) # -# Check for GNU Make. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html -# -AC_DEFUN( - [CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command, - _cv_gnu_make_command='' ; -dnl Search all the common names for GNU make - for a in "$MAKE" make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then - _cv_gnu_make_command=$a ; - break; - fi - done ; - ) ; -dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise - if test "x$_cv_gnu_make_command" != "x" ; then - ifGNUmake='' ; - else - ifGNUmake='#' ; - AC_MSG_RESULT("Not found"); - fi - AC_SUBST(ifGNUmake) -] ) - -# -# Check for the ability to mmap a file. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html +# Check for the ability to mmap a file. # AC_DEFUN([AC_FUNC_MMAP_FILE], [AC_CACHE_CHECK(for mmap of files, ac_cv_func_mmap_file, -[AC_LANG_SAVE - AC_LANG_C - AC_TRY_RUN([ -#ifdef HAVE_SYS_MMAN_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H +[ AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ #include -#endif - -#ifdef HAVE_FCNTL_H +#include #include -#endif - +]],[[ int fd; - int main () { - fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != MAP_FAILED);}], - ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no) - AC_LANG_RESTORE + fd = creat ("foo",0777); + fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); + unlink ("foo"); + return (fd != (int) MAP_FAILED);]])], + [ac_cv_func_mmap_file=yes],[ac_cv_func_mmap_file=no],[ac_cv_func_mmap_file=no]) + AC_LANG_POP([C]) ]) if test "$ac_cv_func_mmap_file" = yes; then - AC_DEFINE(HAVE_MMAP_FILE) + AC_DEFINE([HAVE_MMAP_FILE],[],[Define if mmap() can map files into memory]) AC_SUBST(MMAP_FILE,[yes]) fi ]) @@ -6142,37 +70,25 @@ AC_DEFUN([AC_HEADER_MMAP_ANONYMOUS], [AC_CACHE_CHECK(for MAP_ANONYMOUS vs. MAP_ANON, ac_cv_header_mmap_anon, -[AC_LANG_SAVE - AC_LANG_C - AC_TRY_COMPILE([#include - #include - #include ], - [mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);], - ac_cv_header_mmap_anon=yes, ac_cv_header_mmap_anon=no) - AC_LANG_RESTORE +[ AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include +#include +#include ]], + [[mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);]])], + ac_cv_header_mmap_anon=yes, + ac_cv_header_mmap_anon=no) + AC_LANG_POP([C]) ]) if test "$ac_cv_header_mmap_anon" = yes; then - AC_DEFINE(HAVE_MMAP_ANONYMOUS) + AC_DEFINE([HAVE_MMAP_ANONYMOUS],[1],[Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if it uses MAP_ANON]) fi ]) # -# Configure a Makefile without clobbering it if it exists and is not out of -# date. This is modified from: -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_CONFIG_MAKEFILE], -[AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1,${srcdir}/autoconf/mkinstalldirs `dirname $1`) -]) - -# # When allocating RWX memory, check whether we need to use /dev/zero # as the file descriptor or not. # -# Note: -# Originally from llvm/autoconf/m4/need_dev_zero_for_mmap.m4, written by -# Reid Spencer. -# AC_DEFUN([AC_NEED_DEV_ZERO_FOR_MMAP], [AC_CACHE_CHECK([if /dev/zero is needed for mmap], ac_cv_need_dev_zero_for_mmap, Index: llvm-poolalloc/autoconf/configure.ac diff -u llvm-poolalloc/autoconf/configure.ac:1.10 llvm-poolalloc/autoconf/configure.ac:1.10.2.1 --- llvm-poolalloc/autoconf/configure.ac:1.10 Fri May 27 08:52:00 2005 +++ llvm-poolalloc/autoconf/configure.ac Wed Dec 13 15:56:38 2006 @@ -1,26 +1,27 @@ -dnl Autoconf requirements -dnl AC_INIT(package, version, bug-report-address) -dnl information on the package -dnl checks for programs -dnl checks for libraries -dnl checks for header files -dnl checks for types -dnl checks for structures -dnl checks for compiler characteristics -dnl checks for library functions -dnl checks for system services -dnl AC_CONFIG_FILES([file...]) -dnl AC_OUTPUT - dnl ************************************************************************** dnl * Initialize dnl ************************************************************************** AC_INIT([[[Pool Allocation]]],[[[1.0]]],[llvmbugs at cs.uiuc.edu]) -dnl Place all of the extra autoconf files into the config subdirectory -AC_CONFIG_AUX_DIR([autoconf]) +dnl Identify where LLVM source tree is +LLVM_SRC_ROOT="`(cd ../..; pwd)`" +LLVM_OBJ_ROOT="`(cd ../..; pwd)`" +dnl Tell autoconf that the auxilliary files are actually located in +dnl the LLVM autoconf directory, not here. +AC_CONFIG_AUX_DIR($LLVM_SRC_ROOT/autoconf) + +dnl Tell autoconf that this is an LLVM project being configured +dnl This provides the --with-llvmsrc and --with-llvmobj options +LLVM_CONFIG_PROJECT($LLVM_SRC_ROOT,$LLVM_OBJ_ROOT) + +dnl Verify that the source directory is valid +AC_CONFIG_SRCDIR(["Makefile.common.in"]) + +dnl Configure a common Makefile +AC_CONFIG_FILES(Makefile.common) -dnl Configure Makefiles +dnl Configure project makefiles +dnl List every Makefile that exists within your source tree AC_CONFIG_MAKEFILE(Makefile) AC_CONFIG_MAKEFILE(lib/Makefile) AC_CONFIG_MAKEFILE(lib/PoolAllocate/Makefile) @@ -37,22 +38,12 @@ dnl * Check for programs. dnl ************************************************************************** -dnl Verify that the source directory is valid -AC_CONFIG_SRCDIR(["Makefile.common.in"]) - dnl ************************************************************************** dnl * Check for libraries. dnl ************************************************************************** dnl ************************************************************************** dnl * Checks for header files. -dnl * Chances are, if the standard C or POSIX type header files are missing, -dnl * then LLVM just isn't going to compile. However, it is possible that -dnl * the necessary functions/macros will be included from other -dnl * (non-standard and non-obvious) header files. -dnl * -dnl * So, we'll be gracious, give it a chance, and try to go on without -dnl * them. dnl ************************************************************************** AC_HEADER_MMAP_ANONYMOUS AC_HEADER_STAT @@ -73,18 +64,38 @@ dnl * Enable various compile-time options dnl ************************************************************************** +dnl --enable-safecode: Enable SAFECode functionality +AC_ARG_ENABLE(safecode, + AS_HELP_STRING(--enable-safecode, + [Enable SAFECode functionality (default is NO)]), + AC_DEFINE(SAFECODE,[[1]]), + ) + +dnl --enable-boundscheck: Enable SAFECode Bounds Check functionality +AC_ARG_ENABLE(boundscheck, + AS_HELP_STRING(--enable-boundschecks, + [Enable SAFECode bounds checking (default is NO)]), + AC_DEFINE(BOUNDS_CHECK,[[1]]), + ) + +dnl --enable-llva-kernel: Compile DSA for pool inference +AC_ARG_ENABLE(kernel, + AS_HELP_STRING(--enable-kernel, + [Use SAFECode for use with Linux Kernel (default is NO)]), + AC_DEFINE(LLVA_KERNEL,[[1]]), + ) + dnl ************************************************************************** dnl * Set the location of various third-party software packages dnl ************************************************************************** -dnl Location of LLVM source code -AC_ARG_WITH(llvmsrc,AC_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),AC_SUBST(LLVM_SRC,[$withval]),AC_SUBST(LLVM_SRC,[`cd ${srcdir}/../..; pwd`])) - -dnl Location of LLVM object code -AC_ARG_WITH(llvmobj,AC_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),AC_SUBST(LLVM_OBJ,[$withval]),AC_SUBST(LLVM_OBJ,[`cd ../..; pwd`])) +dnl Location of SAFECode +AC_ARG_WITH(safecodesrc,AS_HELP_STRING(--with-safecode,Location of SAFECode Source Code),AC_SUBST(SAFECODESRC,[$withval]),AC_SUBST(SAFECODESRC,[`cd ../safecode; pwd`])) dnl ************************************************************************** dnl * Create the output files dnl ************************************************************************** AC_CONFIG_HEADERS(include/poolalloc/Config/config.h) -AC_OUTPUT(Makefile.common) + +dnl This must be last +AC_OUTPUT From criswell at cs.uiuc.edu Wed Dec 13 15:57:38 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 15:57:38 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/configure Message-ID: <200612132157.PAA32080@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc: configure updated: 1.11 -> 1.11.2.1 --- Log message: Added options for enabling SAFECode, SAFECode bounds checking, and pool inference. --- Diffs of the changes: (+632 -336) configure | 968 ++++++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 632 insertions(+), 336 deletions(-) Index: llvm-poolalloc/configure diff -u llvm-poolalloc/configure:1.11 llvm-poolalloc/configure:1.11.2.1 --- llvm-poolalloc/configure:1.11 Fri May 27 08:51:57 2005 +++ llvm-poolalloc/configure Wed Dec 13 15:57:18 2006 @@ -1,11 +1,10 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for [Pool Allocation] [1.0]. +# Generated by GNU Autoconf 2.59 for [Pool Allocation] [1.0]. # # Report bugs to . # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -22,9 +21,10 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -43,7 +43,7 @@ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -220,16 +220,17 @@ if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -310,7 +311,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP MMAP_FILE LLVM_SRC LLVM_OBJ LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP MMAP_FILE SAFECODESRC LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -669,7 +670,7 @@ # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir + localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in @@ -709,10 +710,10 @@ # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -804,9 +805,9 @@ cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -840,11 +841,20 @@ esac cat <<\_ACEOF +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-safecode Enable SAFECode functionality (default is NO) + --enable-boundschecks Enable SAFECode bounds checking (default is NO) + --enable-kernel Use SAFECode for use with Linux Kernel (default is + NO) + Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-llvmsrc Location of LLVM Source Code --with-llvmobj Location of LLVM Object Code + --with-safecode Location of SAFECode Source Code Some influential environment variables: CC C compiler command @@ -892,12 +902,45 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. @@ -908,7 +951,7 @@ echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then + test -f $ac_srcdir/configure.in; then echo $ac_configure --help else @@ -922,10 +965,9 @@ if $ac_init_version; then cat <<\_ACEOF [Pool Allocation] configure [1.0] -generated by GNU Autoconf 2.57 +generated by GNU Autoconf 2.59 -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -937,7 +979,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by [Pool Allocation] $as_me [1.0], which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1014,19 +1056,19 @@ 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. + ac_must_keep_next=false # Got value, back to normal. else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. @@ -1060,12 +1102,12 @@ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } @@ -1094,7 +1136,7 @@ for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi @@ -1113,7 +1155,7 @@ echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core core.* *.core && + rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 @@ -1193,7 +1235,7 @@ # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" @@ -1210,13 +1252,13 @@ ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. @@ -1273,8 +1315,10 @@ +LLVM_SRC_ROOT="`(cd ../..; pwd)`" +LLVM_OBJ_ROOT="`(cd ../..; pwd)`" ac_aux_dir= -for ac_dir in autoconf $srcdir/autoconf; do +for ac_dir in $LLVM_SRC_ROOT/autoconf $srcdir/$LLVM_SRC_ROOT/autoconf; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -1290,8 +1334,8 @@ fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $LLVM_SRC_ROOT/autoconf $srcdir/$LLVM_SRC_ROOT/autoconf" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $LLVM_SRC_ROOT/autoconf $srcdir/$LLVM_SRC_ROOT/autoconf" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" @@ -1299,6 +1343,35 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Check whether --with-llvmsrc or --without-llvmsrc was given. +if test "${with_llvmsrc+set}" = set; then + withval="$with_llvmsrc" + llvm_src="$withval" +else + llvm_src="$LLVM_SRC_ROOT" +fi; + LLVM_SRC=$llvm_src + + +# Check whether --with-llvmobj or --without-llvmobj was given. +if test "${with_llvmobj+set}" = set; then + withval="$with_llvmobj" + llvm_obj="$withval" +else + llvm_obj="$LLVM_OBJ_ROOT" +fi; + LLVM_OBJ=$llvm_obj + + ac_config_commands="$ac_config_commands setup" + + + + + + ac_config_files="$ac_config_files Makefile.common" + + ac_config_commands="$ac_config_commands Makefile" @@ -1324,8 +1397,6 @@ - - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -1662,7 +1733,6 @@ (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1682,8 +1752,8 @@ # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 @@ -1703,23 +1773,23 @@ test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; + ;; conftest.$ac_ext ) - # This is the source file. - ;; + # This is the source file. + ;; [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; + # We found the default executable, but exeext='' is most + # certainly right. + break;; *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; * ) - break;; + break;; esac done else @@ -1793,8 +1863,8 @@ case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; + export ac_cv_exeext + break;; * ) break;; esac done @@ -1819,7 +1889,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1870,7 +1939,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1890,11 +1958,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1907,7 +1985,7 @@ ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi @@ -1923,7 +2001,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1940,11 +2017,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1957,7 +2044,7 @@ ac_cv_prog_cc_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 @@ -1984,7 +2071,6 @@ ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2012,6 +2098,16 @@ va_end (v); return s; } + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2038,11 +2134,21 @@ CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2055,7 +2161,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC @@ -2083,19 +2189,28 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ - ''\ - '#include ' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -2103,14 +2218,13 @@ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include $ac_declaration +#include int main () { @@ -2121,11 +2235,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2138,9 +2262,8 @@ continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2157,11 +2280,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2173,7 +2306,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -2187,7 +2320,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2200,24 +2333,21 @@ if test "${ac_cv_header_mmap_anon+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - - ac_ext=c + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include - #include - #include +#include +#include int main () { @@ -2228,11 +2358,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2245,7 +2385,7 @@ ac_cv_header_mmap_anon=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2257,7 +2397,8 @@ echo "$as_me:$LINENO: result: $ac_cv_header_mmap_anon" >&5 echo "${ECHO_T}$ac_cv_header_mmap_anon" >&6 if test "$ac_cv_header_mmap_anon" = yes; then - cat >>confdefs.h <<\_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP_ANONYMOUS 1 _ACEOF @@ -2291,7 +2432,6 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2302,7 +2442,7 @@ #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2314,6 +2454,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2334,7 +2475,6 @@ # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2352,6 +2492,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2398,7 +2539,6 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2409,7 +2549,7 @@ #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2421,6 +2561,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2441,7 +2582,6 @@ # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2459,6 +2599,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2519,7 +2660,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2578,7 +2718,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2599,11 +2738,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2616,12 +2765,11 @@ ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2643,7 +2791,6 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2668,7 +2815,6 @@ : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2680,9 +2826,9 @@ # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -2693,7 +2839,7 @@ int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -2718,7 +2864,7 @@ ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -2743,7 +2889,7 @@ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h + inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -2752,7 +2898,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2764,11 +2909,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2781,7 +2936,7 @@ eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -2813,7 +2968,6 @@ echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2824,11 +2978,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2841,7 +3005,7 @@ ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -2849,7 +3013,6 @@ echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2867,6 +3030,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2886,33 +3050,32 @@ echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf at gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf at gnu.org. ## -## ------------------------------------ ## +## ----------------------------------- ## +## Report this to llvmbugs at cs.uiuc.edu ## +## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -2923,7 +3086,7 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -2958,7 +3121,6 @@ echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2969,11 +3131,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2986,7 +3158,7 @@ ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -2994,7 +3166,6 @@ echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3012,6 +3183,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -3031,33 +3203,32 @@ echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf at gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf at gnu.org. ## -## ------------------------------------ ## +## ----------------------------------- ## +## Report this to llvmbugs at cs.uiuc.edu ## +## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -3068,7 +3239,7 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -3093,21 +3264,28 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -3138,11 +3316,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3155,7 +3343,8 @@ eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -3176,7 +3365,6 @@ ac_cv_func_mmap_fixed_mapped=no else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3284,9 +3472,9 @@ data2 = (char *) malloc (2 * pagesize); if (!data2) exit (1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) + MAP_PRIVATE | MAP_FIXED, fd, 0L)) exit (1); for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) @@ -3329,7 +3517,7 @@ ( exit $ac_status ) ac_cv_func_mmap_fixed_mapped=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 @@ -3348,44 +3536,39 @@ if test "${ac_cv_func_mmap_file+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - - ac_ext=c + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + ac_cv_func_mmap_file=no else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ + + /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#ifdef HAVE_SYS_MMAN_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H #include -#endif - -#ifdef HAVE_FCNTL_H +#include #include -#endif + +int +main () +{ int fd; - int main () { - fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != MAP_FAILED);} + fd = creat ("foo",0777); + fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); + unlink ("foo"); + return (fd != (int) MAP_FAILED); + ; + return 0; +} _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 @@ -3407,7 +3590,7 @@ ( exit $ac_status ) ac_cv_func_mmap_file=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3420,8 +3603,9 @@ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_file" >&5 echo "${ECHO_T}$ac_cv_func_mmap_file" >&6 if test "$ac_cv_func_mmap_file" = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_MMAP_FILE 1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MMAP_FILE _ACEOF MMAP_FILE=yes @@ -3451,32 +3635,48 @@ fi +# Check whether --enable-safecode or --disable-safecode was given. +if test "${enable_safecode+set}" = set; then + enableval="$enable_safecode" + cat >>confdefs.h <<\_ACEOF +#define SAFECODE 1 +_ACEOF +fi; -# Check whether --with-llvmsrc or --without-llvmsrc was given. -if test "${with_llvmsrc+set}" = set; then - withval="$with_llvmsrc" - LLVM_SRC=$withval +# Check whether --enable-boundscheck or --disable-boundscheck was given. +if test "${enable_boundscheck+set}" = set; then + enableval="$enable_boundscheck" + cat >>confdefs.h <<\_ACEOF +#define BOUNDS_CHECK 1 +_ACEOF -else - LLVM_SRC=`cd ${srcdir}/../..; pwd` +fi; + +# Check whether --enable-kernel or --disable-kernel was given. +if test "${enable_kernel+set}" = set; then + enableval="$enable_kernel" + cat >>confdefs.h <<\_ACEOF +#define LLVA_KERNEL 1 +_ACEOF fi; -# Check whether --with-llvmobj or --without-llvmobj was given. -if test "${with_llvmobj+set}" = set; then - withval="$with_llvmobj" - LLVM_OBJ=$withval + +# Check whether --with-safecodesrc or --without-safecodesrc was given. +if test "${with_safecodesrc+set}" = set; then + withval="$with_safecodesrc" + SAFECODESRC=$withval else - LLVM_OBJ=`cd ../..; pwd` + SAFECODESRC=`cd ../safecode; pwd` fi; ac_config_headers="$ac_config_headers include/poolalloc/Config/config.h" - ac_config_files="$ac_config_files Makefile.common" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -3505,13 +3705,13 @@ # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -3541,13 +3741,13 @@ # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ + ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; +s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; -s/^[^=]*=[ ]*$//; +s/^[^=]*=[ ]*$//; }' fi @@ -3558,7 +3758,7 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' @@ -3602,9 +3802,10 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -3623,7 +3824,7 @@ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -3802,16 +4003,17 @@ if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -3838,7 +4040,7 @@ cat >&5 <<_CSEOF This file was extended by [Pool Allocation] $as_me [1.0], which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -3882,9 +4084,9 @@ -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + instantiate the configuration file FILE --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + instantiate the configuration header FILE Configuration files: $config_files @@ -3901,11 +4103,10 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ [Pool Allocation] config.status [1.0] -configured by $0, generated by GNU Autoconf 2.57, +configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir @@ -3999,13 +4200,7 @@ # INIT-COMMANDS section. # -${srcdir}/autoconf/mkinstalldirs `dirname Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/PoolAllocate/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname runtime/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname runtime/PoolAllocator/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname runtime/FreeListAllocator/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Makefile` +llvm_src="${LLVM_SRC}" _ACEOF @@ -4017,6 +4212,7 @@ case "$ac_config_target" in # Handling of arguments. "Makefile.common" ) CONFIG_FILES="$CONFIG_FILES Makefile.common" ;; + "setup" ) CONFIG_COMMANDS="$CONFIG_COMMANDS setup" ;; "Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "lib/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Makefile" ;; "lib/PoolAllocate/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/PoolAllocate/Makefile" ;; @@ -4110,6 +4306,8 @@ s, at ECHO_N@,$ECHO_N,;t t s, at ECHO_T@,$ECHO_T,;t t s, at LIBS@,$LIBS,;t t +s, at LLVM_SRC@,$LLVM_SRC,;t t +s, at LLVM_OBJ@,$LLVM_OBJ,;t t s, at CC@,$CC,;t t s, at CFLAGS@,$CFLAGS,;t t s, at LDFLAGS@,$LDFLAGS,;t t @@ -4120,8 +4318,7 @@ s, at CPP@,$CPP,;t t s, at EGREP@,$EGREP,;t t s, at MMAP_FILE@,$MMAP_FILE,;t t -s, at LLVM_SRC@,$LLVM_SRC,;t t -s, at LLVM_OBJ@,$LLVM_OBJ,;t t +s, at SAFECODESRC@,$SAFECODESRC,;t t s, at LIBOBJS@,$LIBOBJS,;t t s, at LTLIBOBJS@,$LTLIBOBJS,;t t CEOF @@ -4153,9 +4350,9 @@ (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end @@ -4173,21 +4370,21 @@ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4203,10 +4400,10 @@ as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4244,12 +4441,45 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac @@ -4267,7 +4497,7 @@ configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." + sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. @@ -4276,24 +4506,24 @@ case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } _ACEOF @@ -4334,12 +4564,12 @@ # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' @@ -4348,11 +4578,11 @@ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac @@ -4366,28 +4596,29 @@ case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF @@ -4410,9 +4641,9 @@ s,[\\$`],\\&,g t clear : clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times @@ -4426,13 +4657,13 @@ # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail @@ -4441,7 +4672,7 @@ # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -4468,7 +4699,7 @@ # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -4502,10 +4733,10 @@ else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4521,10 +4752,10 @@ as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4556,16 +4787,41 @@ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. if test "$ac_dir" != .; then @@ -4591,24 +4847,64 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in - Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; - lib/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; - lib/PoolAllocate/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/PoolAllocate/Makefile lib/PoolAllocate/Makefile ;; - runtime/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/runtime/Makefile runtime/Makefile ;; - runtime/PoolAllocator/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/runtime/PoolAllocator/Makefile runtime/PoolAllocator/Makefile ;; - runtime/FreeListAllocator/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/runtime/FreeListAllocator/Makefile runtime/FreeListAllocator/Makefile ;; - test/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Makefile test/Makefile ;; + Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; + lib/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; + lib/PoolAllocate/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/PoolAllocate/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/PoolAllocate/Makefile lib/PoolAllocate/Makefile ;; + runtime/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname runtime/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/runtime/Makefile runtime/Makefile ;; + runtime/PoolAllocator/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname runtime/PoolAllocator/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/runtime/PoolAllocator/Makefile runtime/PoolAllocator/Makefile ;; + runtime/FreeListAllocator/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname runtime/FreeListAllocator/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/runtime/FreeListAllocator/Makefile runtime/FreeListAllocator/Makefile ;; + test/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Makefile test/Makefile ;; esac done _ACEOF From criswell at cs.uiuc.edu Wed Dec 13 15:58:54 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 15:58:54 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/include/poolalloc/Config/config.h.in Message-ID: <200612132158.PAA32125@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/include/poolalloc/Config: config.h.in updated: 1.3 -> 1.3.2.1 --- Log message: Grab configuration information from configure script. --- Diffs of the changes: (+10 -0) config.h.in | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm-poolalloc/include/poolalloc/Config/config.h.in diff -u llvm-poolalloc/include/poolalloc/Config/config.h.in:1.3 llvm-poolalloc/include/poolalloc/Config/config.h.in:1.3.2.1 --- llvm-poolalloc/include/poolalloc/Config/config.h.in:1.3 Wed May 18 14:56:23 2005 +++ llvm-poolalloc/include/poolalloc/Config/config.h.in Wed Dec 13 15:58:21 2006 @@ -463,3 +463,13 @@ /* Define to `unsigned' if does not define. */ #undef size_t + +/* Define to 1 if enabling SAFECode */ +#undef SAFECODE + +/* Define to 1 if enabling SAFECode bounds checking */ +#undef BOUNDS_CHECK + +/* Define to 1 if compiling for pool inference */ +#undef LLVA_KERNEL + From criswell at cs.uiuc.edu Wed Dec 13 15:58:54 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 15:58:54 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/include/dsa/DSGraph.h DataStructure.h Message-ID: <200612132158.PAA32129@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/include/dsa: DSGraph.h updated: 1.110.2.3 -> 1.110.2.4 DataStructure.h updated: 1.98.2.2 -> 1.98.2.3 --- Log message: Grab configuration information from configure script. --- Diffs of the changes: (+3 -2) DSGraph.h | 2 ++ DataStructure.h | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) Index: llvm-poolalloc/include/dsa/DSGraph.h diff -u llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.3 llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.4 --- llvm-poolalloc/include/dsa/DSGraph.h:1.110.2.3 Wed Dec 13 10:24:48 2006 +++ llvm-poolalloc/include/dsa/DSGraph.h Wed Dec 13 15:58:18 2006 @@ -18,6 +18,8 @@ #include "dsa/DSNode.h" #include "llvm/ADT/hash_map" #include "llvm/ADT/EquivalenceClasses.h" +#include "poolalloc/Config/config.h" + #include #include #include Index: llvm-poolalloc/include/dsa/DataStructure.h diff -u llvm-poolalloc/include/dsa/DataStructure.h:1.98.2.2 llvm-poolalloc/include/dsa/DataStructure.h:1.98.2.3 --- llvm-poolalloc/include/dsa/DataStructure.h:1.98.2.2 Tue Dec 12 17:20:47 2006 +++ llvm-poolalloc/include/dsa/DataStructure.h Wed Dec 13 15:58:18 2006 @@ -20,8 +20,7 @@ #include "llvm/ADT/hash_map" #include "llvm/ADT/hash_set" #include "llvm/ADT/EquivalenceClasses.h" - - +#include "poolalloc/Config/config.h" namespace llvm { From criswell at cs.uiuc.edu Wed Dec 13 15:58:56 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 15:58:56 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Message-ID: <200612132158.PAA32143@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: PoolAllocate.cpp updated: 1.127.2.1 -> 1.127.2.2 --- Log message: Grab configuration information from configure script. --- Diffs of the changes: (+1 -1) PoolAllocate.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.127.2.1 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.127.2.2 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.127.2.1 Wed Dec 13 14:04:23 2006 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Wed Dec 13 15:58:21 2006 @@ -16,6 +16,7 @@ #include "dsa/DataStructure.h" #include "dsa/DSGraph.h" +#include "dsa/CallTargets.h" #include "poolalloc/PoolAllocate.h" #include "Heuristic.h" #include "llvm/Constants.h" @@ -27,7 +28,6 @@ #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Cloning.h" -#include "dsa/CallTargets.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" From criswell at cs.uiuc.edu Wed Dec 13 15:58:55 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 15:58:55 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/lib/DSA/DataStructure.cpp Local.cpp Message-ID: <200612132158.PAA32131@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/DSA: DataStructure.cpp updated: 1.248.2.2 -> 1.248.2.3 Local.cpp updated: 1.158.2.1 -> 1.158.2.2 --- Log message: Grab configuration information from configure script. --- Diffs of the changes: (+2 -0) DataStructure.cpp | 1 + Local.cpp | 1 + 2 files changed, 2 insertions(+) Index: llvm-poolalloc/lib/DSA/DataStructure.cpp diff -u llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.2 llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.3 --- llvm-poolalloc/lib/DSA/DataStructure.cpp:1.248.2.2 Wed Dec 13 10:25:34 2006 +++ llvm-poolalloc/lib/DSA/DataStructure.cpp Wed Dec 13 15:58:21 2006 @@ -30,6 +30,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Support/Timer.h" #include "llvm/ADT/hash_map" +#include "poolalloc/Config/config.h" #include #include using namespace llvm; Index: llvm-poolalloc/lib/DSA/Local.cpp diff -u llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.1 llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.2 --- llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.1 Tue Dec 12 16:42:42 2006 +++ llvm-poolalloc/lib/DSA/Local.cpp Wed Dec 13 15:58:21 2006 @@ -27,6 +27,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Timer.h" +#include "poolalloc/Config/config.h" #include // FIXME: This should eventually be a FunctionPass that is automatically From dpatel at apple.com Wed Dec 13 16:10:15 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 13 Dec 2006 16:10:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612132210.kBDMAFgI016743@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.96 -> 1.97 --- Log message: Add -pass-debug=Arguments support in new manager. --- Diffs of the changes: (+29 -1) PassManager.cpp | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.96 llvm/lib/VMCore/PassManager.cpp:1.97 --- llvm/lib/VMCore/PassManager.cpp:1.96 Wed Dec 13 15:56:10 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Dec 13 16:10:00 2006 @@ -192,6 +192,7 @@ // Print passes managed by this top level manager. void dumpPasses(); + void dumpArguments(); private: @@ -299,6 +300,18 @@ } } + void dumpPassArguments() { + for(std::vector::iterator I = PassVector.begin(), + E = PassVector.end(); I != E; ++I) { + if (PMDataManager *PMD = dynamic_cast(*I)) + PMD->dumpPassArguments(); + else + if (const PassInfo *PI = (*I)->getPassInfo()) + if (!PI->isAnalysisGroup()) + cerr << " -" << PI->getPassArgument(); + } + } + protected: // Collection of pass whose last user asked this manager to claim @@ -360,7 +373,6 @@ dumpLastUses(*I, Offset+1); } } - }; //===----------------------------------------------------------------------===// @@ -651,6 +663,21 @@ } +void PMTopLevelManager::dumpArguments() { + + if (PassDebugging_New < Arguments) + return; + + cerr << "Pass Arguments: "; + for (std::vector::iterator I = PassManagers.begin(), + E = PassManagers.end(); I != E; ++I) { + PMDataManager *PMD = dynamic_cast(*I); + assert(PMD && "This is not a PassManager"); + PMD->dumpPassArguments(); + } + cerr << "\n"; +} + //===----------------------------------------------------------------------===// // PMDataManager implementation @@ -1270,6 +1297,7 @@ bool Changed = false; + dumpArguments(); if (PassDebugging_New >= Structure) dumpPasses(); From criswell at cs.uiuc.edu Wed Dec 13 15:58:55 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 15:58:55 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/include/poolalloc/PoolAllocate.h Message-ID: <200612132158.PAA32139@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/include/poolalloc: PoolAllocate.h updated: 1.51 -> 1.51.2.1 --- Log message: Grab configuration information from configure script. --- Diffs of the changes: (+2 -3) PoolAllocate.h | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm-poolalloc/include/poolalloc/PoolAllocate.h diff -u llvm-poolalloc/include/poolalloc/PoolAllocate.h:1.51 llvm-poolalloc/include/poolalloc/PoolAllocate.h:1.51.2.1 --- llvm-poolalloc/include/poolalloc/PoolAllocate.h:1.51 Wed Jul 26 10:37:25 2006 +++ llvm-poolalloc/include/poolalloc/PoolAllocate.h Wed Dec 13 15:58:21 2006 @@ -16,15 +16,14 @@ #ifndef POOLALLOCATE_H #define POOLALLOCATE_H -//#define SAFECODE 1 -//#define BOUNDS_CHECK 1 -//comment the above two for normal poolallocation + #include "llvm/Pass.h" #include "llvm/DerivedTypes.h" #include "llvm/Support/CallSite.h" #include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/VectorExtras.h" #include "llvm/ADT/hash_set" +#include "poolalloc/Config/config.h" #ifdef SAFECODE //FIXME : make this use some configuration options From criswell at cs.uiuc.edu Wed Dec 13 17:19:17 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 17:19:17 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/lib/DSA/Local.cpp Message-ID: <200612132319.RAA11444@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/DSA: Local.cpp updated: 1.158.2.2 -> 1.158.2.3 --- Log message: By default, compile without pool inference code. --- Diffs of the changes: (+4 -3) Local.cpp | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-poolalloc/lib/DSA/Local.cpp diff -u llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.2 llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.3 --- llvm-poolalloc/lib/DSA/Local.cpp:1.158.2.2 Wed Dec 13 15:58:21 2006 +++ llvm-poolalloc/lib/DSA/Local.cpp Wed Dec 13 17:18:48 2006 @@ -13,7 +13,6 @@ // //===----------------------------------------------------------------------===// -#define LLVA_KERNEL 1 #include "llvm/ADT/Statistic.h" #include "dsa/DataStructure.h" #include "dsa/DSGraph.h" @@ -384,6 +383,7 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) { +#ifdef LLVA_KERNEL #if 1 int debug = 0; if (isa(GEP)) { @@ -400,6 +400,7 @@ } } #endif +#endif DSNodeHandle Value = getValueDest(*GEP.getOperand(0)); if (Value.isNull()) @@ -436,7 +437,6 @@ // If the node had to be folded... exit quickly setDestTo(GEP, Value); // GEP result points to folded node -if (debug) std::cerr << "LLVA: GEP: Funny Return\n"; return; } @@ -551,7 +551,6 @@ } #endif -if (debug) std::cerr << "LLVA: GEP: Normal Return\n"; } void GraphBuilder::visitLoadInst(LoadInst &LI) { @@ -587,6 +586,7 @@ // Avoid adding edges from null, or processing non-"pointer" stores if (isPointerType(StoredTy)) Dest.addEdgeTo(getValueDest(*SI.getOperand(0))); +#ifdef LLVA_KERNEL #if 1 { if (SI.getParent()->getParent()->getName() == "alloc_vfsmnt") { @@ -597,6 +597,7 @@ } } #endif +#endif } void GraphBuilder::visitReturnInst(ReturnInst &RI) { From criswell at cs.uiuc.edu Wed Dec 13 17:23:02 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 17:23:02 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/configure Message-ID: <200612132323.RAA11656@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc: configure updated: 1.11.2.1 -> 1.11.2.2 --- Log message: Fix configuration when srcdir != objdir. --- Diffs of the changes: (+2 -1) configure | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm-poolalloc/configure diff -u llvm-poolalloc/configure:1.11.2.1 llvm-poolalloc/configure:1.11.2.2 --- llvm-poolalloc/configure:1.11.2.1 Wed Dec 13 15:57:18 2006 +++ llvm-poolalloc/configure Wed Dec 13 17:22:40 2006 @@ -1315,8 +1315,9 @@ -LLVM_SRC_ROOT="`(cd ../..; pwd)`" +LLVM_SRC_ROOT="`(cd $srcdir/../..; pwd)`" LLVM_OBJ_ROOT="`(cd ../..; pwd)`" + ac_aux_dir= for ac_dir in $LLVM_SRC_ROOT/autoconf $srcdir/$LLVM_SRC_ROOT/autoconf; do if test -f $ac_dir/install-sh; then From criswell at cs.uiuc.edu Wed Dec 13 17:23:07 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 17:23:07 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-poolalloc/autoconf/AutoRegen.sh configure.ac Message-ID: <200612132323.RAA11662@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/autoconf: AutoRegen.sh updated: 1.1.2.2 -> 1.1.2.3 configure.ac updated: 1.10.2.1 -> 1.10.2.2 --- Log message: Fix configuration when srcdir != objdir. --- Diffs of the changes: (+4 -3) AutoRegen.sh | 4 ++-- configure.ac | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) Index: llvm-poolalloc/autoconf/AutoRegen.sh diff -u llvm-poolalloc/autoconf/AutoRegen.sh:1.1.2.2 llvm-poolalloc/autoconf/AutoRegen.sh:1.1.2.3 --- llvm-poolalloc/autoconf/AutoRegen.sh:1.1.2.2 Wed Dec 13 15:56:38 2006 +++ llvm-poolalloc/autoconf/AutoRegen.sh Wed Dec 13 17:22:45 2006 @@ -41,8 +41,8 @@ fi # Patch the LLVM_ROOT in configure.ac, if it needs it cp configure.ac configure.bak -sed -e "s#^LLVM_SRC_ROOT=.*#LLVM_SRC_ROOT=\"$llvm_src_root\"#" \ - -e "s#^LLVM_OBJ_ROOT=.*#LLVM_OBJ_ROOT=\"$llvm_obj_root\"#" configure.bak > configure.ac +#sed -e "s#^LLVM_SRC_ROOT=.*#LLVM_SRC_ROOT=\"$llvm_src_root\"#" \ +# -e "s#^LLVM_OBJ_ROOT=.*#LLVM_OBJ_ROOT=\"$llvm_obj_root\"#" configure.bak > configure.ac echo "Regenerating aclocal.m4 with aclocal" rm -f aclocal.m4 aclocal -I $llvm_m4 -I "$llvm_m4/.." || die "aclocal failed" Index: llvm-poolalloc/autoconf/configure.ac diff -u llvm-poolalloc/autoconf/configure.ac:1.10.2.1 llvm-poolalloc/autoconf/configure.ac:1.10.2.2 --- llvm-poolalloc/autoconf/configure.ac:1.10.2.1 Wed Dec 13 15:56:38 2006 +++ llvm-poolalloc/autoconf/configure.ac Wed Dec 13 17:22:45 2006 @@ -4,8 +4,9 @@ AC_INIT([[[Pool Allocation]]],[[[1.0]]],[llvmbugs at cs.uiuc.edu]) dnl Identify where LLVM source tree is -LLVM_SRC_ROOT="`(cd ../..; pwd)`" +LLVM_SRC_ROOT="`(cd $srcdir/../..; pwd)`" LLVM_OBJ_ROOT="`(cd ../..; pwd)`" + dnl Tell autoconf that the auxilliary files are actually located in dnl the LLVM autoconf directory, not here. AC_CONFIG_AUX_DIR($LLVM_SRC_ROOT/autoconf) From dpatel at apple.com Wed Dec 13 17:50:59 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 13 Dec 2006 17:50:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612132350.kBDNoxxU018209@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.97 -> 1.98 --- Log message: Add debug-pass=Executions support in new pass manager. --- Diffs of the changes: (+27 -6) PassManager.cpp | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.97 llvm/lib/VMCore/PassManager.cpp:1.98 --- llvm/lib/VMCore/PassManager.cpp:1.97 Wed Dec 13 16:10:00 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Dec 13 17:50:44 2006 @@ -244,7 +244,7 @@ void removeNotPreservedAnalysis(Pass *P); /// Remove dead passes - void removeDeadPasses(Pass *P); + void removeDeadPasses(Pass *P, std::string &Msg); /// Add pass P into the PassVector. Update /// AvailableAnalysis appropriately if ProcessAnalysis is true. @@ -312,6 +312,15 @@ } } + void dumpPassInfo(Pass *P, std::string &Msg1, std::string &Msg2) { + if (PassDebugging_New < Executions) + return; + cerr << (void*)this << std::string(getDepth()*2+1, ' '); + cerr << Msg1; + cerr << P->getPassName(); + cerr << Msg2; + } + protected: // Collection of pass whose last user asked this manager to claim @@ -572,7 +581,6 @@ LastUser[LUI->first] = P; } } - } /// Collect passes whose last user is P @@ -734,13 +742,17 @@ } /// Remove analysis passes that are not used any longer -void PMDataManager::removeDeadPasses(Pass *P) { +void PMDataManager::removeDeadPasses(Pass *P, std::string &Msg) { std::vector DeadPasses; TPM->collectLastUses(DeadPasses, P); for (std::vector::iterator I = DeadPasses.begin(), E = DeadPasses.end(); I != E; ++I) { + + std::string Msg1 = " Freeing Pass '"; + dumpPassInfo(*I, Msg1, Msg); + (*I)->releaseMemory(); std::map::iterator Pos = @@ -910,12 +922,15 @@ for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; + std::string Msg1 = "Executing Pass '"; + std::string Msg2 = "' on BasicBlock '" + (*I).getName() + "'...\n"; + dumpPassInfo(P, Msg1, Msg2); initializeAnalysisImpl(P); BasicBlockPass *BP = dynamic_cast(P); Changed |= BP->runOnBasicBlock(*I); removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); - removeDeadPasses(P); + removeDeadPasses(P, Msg2); } return Changed | doFinalization(F); } @@ -1129,12 +1144,15 @@ for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; + std::string Msg1 = "Executing Pass '"; + std::string Msg2 = "' on Function '" + F.getName() + "'...\n"; + dumpPassInfo(P, Msg1, Msg2); initializeAnalysisImpl(P); FunctionPass *FP = dynamic_cast(P); Changed |= FP->runOnFunction(F); removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); - removeDeadPasses(P); + removeDeadPasses(P, Msg2); } return Changed; } @@ -1258,12 +1276,15 @@ for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; + std::string Msg1 = "Executing Pass '"; + std::string Msg2 = "' on Module '" + M.getModuleIdentifier() + "'...\n"; + dumpPassInfo(P, Msg1, Msg2); initializeAnalysisImpl(P); ModulePass *MP = dynamic_cast(P); Changed |= MP->runOnModule(M); removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); - removeDeadPasses(P); + removeDeadPasses(P, Msg2); } return Changed; } From rspencer at reidspencer.com Wed Dec 13 18:00:04 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 13 Dec 2006 16:00:04 -0800 Subject: [llvm-commits] SETCC Patches #2 In-Reply-To: <5E1FE822-D236-4200-969D-C0EAB47B955E@apple.com> References: <1165794220.15266.89.camel@bashful.x10sys.com> <5E1FE822-D236-4200-969D-C0EAB47B955E@apple.com> Message-ID: <1166054404.2863.13.camel@bashful.x10sys.com> Hi Chris, Some feedback on your review. Please note the attachments which also need to be reviewed. These are for changes to ConstantFolding and ConstantRange. Thanks, Reid. On Sun, 2006-12-10 at 19:05 -0800, Chris Lattner wrote: > Like for div/rem, I strongly recommend a patch (e.g. to instcombine) > that will result in signed comparisons with unsigned operands or > signed operands to unsigned comparisons. Without that, you are not > testing a bunch of hard cases. Yes, good idea. > > > Also, perhaps I just didn't see it, but it seems that the SetCondInst > ctor should assert that the operands are FP types now. Yes, I added that after I made/sent the patch. It only tripped on a few llvm/test casts that had not run llvm-upgrade. I fixed those test cases. > Another question: currently do you handle integer vectors with icmp > and fp vectors with setcondinst? You should verify, as the testsuite > doesn't have good coverage of vectors, but you'll get cranky emails > from me if they break :) fp vectors -> setcondinst int vectors -> icmpinst I haven't really checked for this much. Taken as a to-do item. > > > I'm almost half done reviewing the patch. > > > Comments below, > > > > > --- docs/ProgrammersManual.html 7 Dec 2006 20:04:41 -0000 1.96 > +++ docs/ProgrammersManual.html 10 Dec 2006 23:26:33 -0000 > .. > > > > > The m_Instruction anchor is already used, pick another one. Fixed. > > > > > +
> +
    > +
  • BinaryOperator > +

    This subclasses represents all two operand instructions whose > operands > + must be the same type, except for the comparison > instructions.

  • > +
  • CmpInst > +

    This subclasses respresents the two comparison instructions, > + ICmpInst (integer opreands), > and > + FCmpInst (floating point > operands).

    > +
> + > > > dif -> div. Fixed. > Please ensure this validates. Yes, after commit. > Why not mention CastInst, TerminatorInst, etc here? Okay. > > > > > > > =================================================================== > RCS file: /var/cvs/llvm/llvm/include/llvm/Instruction.h,v > retrieving revision 1.75 > diff -t -d -u -p -5 -r1.75 Instruction.h > --- include/llvm/Instruction.h 27 Nov 2006 01:05:09 -0000 1.75 > +++ include/llvm/Instruction.h 10 Dec 2006 23:26:33 -0000 > @@ -69,10 +69,20 @@ public: > + /// This function determines if the specified instruction executes > the same > + /// operation as the current one. This means that the opcodes, > type, operand > + /// type and any other factors affecting the operation must be the > same. This > + /// is similar to isIdenticalTo excep the operands themselves don't > have to > + /// be identical. > > > typo 'excep'. Fixed. > > > > > + /// This is a static version that you can use without an > instruction. > + /// @brief Return the predicate for a signed operand. > + static Predicate getSignedPredicate(Predicate pred); > > > "for a signed comparison.". The sign of the operand doesn't matter. Fixed. > > > --- lib/VMCore/ConstantFolding.cpp 6 Dec 2006 00:25:09 -0000 1.110 > +++ lib/VMCore/ConstantFolding.cpp 10 Dec 2006 23:26:35 -0000 > @@ -427,13 +427,18 @@ struct VISIBILITY_HIDDEN ConstantPackedR > static Constant *LessThan(const ConstantPacked *V1, const > ConstantPacked *V2){ > return 0; > } > static Constant *EqualTo(const ConstantPacked *V1, const > ConstantPacked *V2) { > for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i) { > - Constant *C = > - > ConstantExpr::getSetEQ(const_cast(V1->getOperand(i)), > - > const_cast(V2->getOperand(i))); > + Constant *C; > + if (V1->getOperand(i)->getType()->isFloatingPoint()) > + C = > ConstantExpr::getSetEQ(const_cast(V1->getOperand(i)), > + > const_cast(V2->getOperand(i))); > + else > + C = ConstantExpr::getICmp(ICmpInst::ICMP_EQ, > + > const_cast(V1->getOperand(i)), > + > const_cast(V2->getOperand(i))); > if (ConstantBool *CB = dyn_cast(C)) > return CB; > } > > > > > It would be better to split up the "EqualTo" predicate here so that > there was one for FP and one for integers. When the FP part of this > lands, you'll want "Unordered" "Equal" and "LessThan" instead of just > LessThan + Equal. Okay, good idea. Could you please review the CF.patch file which is attached. I think this is what you had in mind. > Further, 'lessthan' drops the sign, so the code is apparently wrong. I'm not following this. I thought you weren't allowed to do relational operators on packed type? Are you talking about the ConstantInt case? This: static Constant *LessThan(const ConstantInt *V1, const ConstantInt *V2) { bool R = (BuiltinType)V1->getZExtValue() < (BuiltinType)V2->getZExtValue(); return ConstantBool::get(R); } > > > +/// evaluateICmpRelation - This function determines if there is > anything we can > +/// decide about the two constants provided. This doesn't need to > handle simple > +/// things like integer comparisons, but should instead handle > ConstantExprs > +/// and GlobalValuess. If we can determine that the two constants > have a > > > GlobalValuess -> typo :) Fixed. > > > > > +Constant *llvm::ConstantFoldCompareInstruction( > + unsigned opcode, Constant *C1, Constant *C2, unsigned short > predicate) { > ... > + case ICmpInst::ICMP_ULT: > + case ICmpInst::ICMP_SLT: C = ConstRules::get(C1, C2).lessthan(C1, > C2);break; > + case ICmpInst::ICMP_UGT: > + case ICmpInst::ICMP_SGT: C = ConstRules::get(C1, C2).lessthan(C2, > C1);break; > + case ICmpInst::ICMP_ULE: > + case ICmpInst::ICMP_SLE: // C1 <= C2 === !(C2 < C1) > + C = ConstRules::get(C1, C2).lessthan(C2, C1); > + if (C) return ConstantExpr::getNot(C); > + break; > + case ICmpInst::ICMP_UGE: > + case ICmpInst::ICMP_SGE: // C1 >= C2 === !(C1 < C2) > + C = ConstRules::get(C1, C2).lessthan(C1, C2); > + if (C) return ConstantExpr::getNot(C); > + break; > > > These drop the sign of the comparison, which is a serious bug. I'd > expect this to miscompile things like: > > > %X = iset slt ubyte 0, ubyte 128 > > > ... or whatever the syntax is. The LessThan code above for ConstantInt works fine. It extracts the canonical ZExt form then casts each operand to the correct type before doing the compare: bool R = (BuiltinType)V1->getZExtValue() < (BuiltinType)V2->getZExtValue(); I don't see the problem. > > > > > Index: lib/VMCore/Constants.cpp > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/VMCore/Constants.cpp,v > retrieving revision 1.184 > diff -t -d -u -p -5 -r1.184 Constants.cpp > --- lib/VMCore/Constants.cpp 8 Dec 2006 18:06:15 -0000 1.184 > +++ lib/VMCore/Constants.cpp 10 Dec 2006 23:26:36 -0000 > ... > + case Instruction::ICmp: > + case Instruction::FCmp: > + New = ConstantExpr::getCompare(OldC->getOpcode(), > OldC->getPredicate(), > + > OldC->getOperand(0),OldC->getOperand(1)); > + break; > > > Why does ConstantExpr::getCompare take both an opcode and predicate? > It seems that the predicate would be enough. Likewise I'd > expect ConstantFoldCompareInstruction to just take > the predicate. The opcode is doubly redundant: both the type of the > operands *and* the predicate tell you what the opcode should be :) Good idea. Done. > > > > > > > Instruction::isComparison should probably go away completely when > you're done (when the fp part lands), or at least be inlined in the > header. Yup. Taken as a to-do. > > > > > =================================================================== > RCS file: /var/cvs/llvm/llvm/include/llvm/InstrTypes.h,v > retrieving revision 1.53 > diff -t -d -u -p -5 -r1.53 InstrTypes.h > --- include/llvm/InstrTypes.h 7 Dec 2006 04:18:31 -0000 1.53 > +++ include/llvm/InstrTypes.h 10 Dec 2006 23:26:33 -0000 > + /// @brief Determine if the predicate is an unsigned operation. > + static bool isUnsigned(unsigned short predicate); > + > + /// @brief Determine if the predicate is an signed operation. > + static bool isSigned(unsigned short predicate); > > > The comments should indicate that these return false for ==/!=. Done. > > > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/Analysis/ConstantRange.cpp,v > retrieving revision 1.21 > diff -t -d -u -p -5 -r1.21 ConstantRange.cpp > --- lib/Analysis/ConstantRange.cpp 7 Dec 2006 01:30:31 -0000 1.21 > +++ lib/Analysis/ConstantRange.cpp 10 Dec 2006 23:26:37 -0000 > > > static bool LT(ConstantIntegral *A, ConstantIntegral *B) { > - Constant *C = ConstantExpr::getSetLT(A, B); > + Constant *C = ConstantExpr::getICmp( > + A->getType()->isSigned() ? ICmpInst::ICMP_SLT : > ICmpInst::ICMP_ULT, A, B); > assert(isa(C) && "Constant folding of integrals not > impl??"); > return cast(C)->getValue(); > } > > > > static bool LTE(ConstantIntegral *A, ConstantIntegral *B) { > - Constant *C = ConstantExpr::getSetLE(A, B); > + Constant *C = ConstantExpr::getICmp( > + A->getType()->isSigned() ? ICmpInst::ICMP_SLE : > ICmpInst::ICMP_ULE, A, B); > assert(isa(C) && "Constant folding of integrals not > impl??"); > return cast(C)->getValue(); > } > > > Unless I'm missing something, this looks dangerously wrong. The type > of the operands shouldn't determine the signedness. I thought you > were going to make ConstantRange be signless? If so, the queries > should pass down the sign they want. Yeah, I didn't get a chance yet, but I just made it signless and made all its callers pass the signedness down. Fortunately, there weren't many of them. > > > > > @@ -168,17 +176,19 @@ ConstantRange::ConstantRange(unsigned Se > const Type *ConstantRange::getType() const { return > Lower->getType(); } > > > > /// isFullSet - Return true if this set contains all of the elements > possible > /// for this data-type > bool ConstantRange::isFullSet() const { > - return Lower == Upper && Lower == getMaxValue(getType()); > + return Lower == Upper && > + Lower == getMaxValue(getType(), getType()->isSigned()); > } > > > > /// isEmptySet - Return true if this set contains no members. > /// > bool ConstantRange::isEmptySet() const { > - return Lower == Upper && Lower == getMinValue(getType()); > + return Lower == Upper && > + Lower == getMinValue(getType(), getType()->isSigned()); > } > > > likewise. In the fix to ConstantRange, getMinValue doesn't take an "isSigned" argument. Its always using unsigned. This is allowed because the ConstantInt values used to construct it are also signless. I've attached the diff to ConstantRange.cpp for review in ConstRange.patch. > > --- lib/Analysis/LoopInfo.cpp 7 Dec 2006 01:30:31 -0000 1.81 > +++ lib/Analysis/LoopInfo.cpp 10 Dec 2006 23:26:38 -0000 > @@ -534,29 +534,51 @@ Instruction *Loop::getCanonicalInduction > /// times the loop will be executed. Note that this means that the > backedge of > /// the loop executes N-1 times. If the trip-count cannot be > determined, this > /// returns null. > /// > Value *Loop::getTripCount() const { > - // Canonical loops will end with a 'setne I, V', where I is the > incremented > + // Canonical loops will end with a 'cmp ne I, V', where I is the > incremented > // canonical induction variable and V is the trip count of the > loop. > Instruction *Inc = getCanonicalInductionVariableIncrement(); > if (Inc == 0) return 0; > PHINode *IV = cast(Inc->getOperand(0)); > > > > BasicBlock *BackedgeBlock = > IV->getIncomingBlock(contains(IV->getIncomingBlock(1))); > > > > if (BranchInst *BI = > dyn_cast(BackedgeBlock->getTerminator())) > - if (BI->isConditional()) > - if (SetCondInst *SCI = > dyn_cast(BI->getCondition())) > + if (BI->isConditional()) { > + if (ICmpInst *ICI = dyn_cast(BI->getCondition())) { > + if (ICI->getOperand(0) == Inc) > + if (BI->getSuccessor(0) == getHeader()) { > + if (ICI->getPredicate() == ICmpInst::ICMP_NE) > + return ICI->getOperand(1); > + } else if (ICI->getPredicate() == ICmpInst::ICMP_EQ) { > + return ICI->getOperand(1); > + } > + } > + else if (FCmpInst *FCI = > dyn_cast(BI->getCondition())) { > + if (FCI->getOperand(0) == Inc) > + if (BI->getSuccessor(0) == getHeader()) { > + if (FCI->getPredicate() == FCmpInst::FCMP_UNE || > + FCI->getPredicate() == FCmpInst::FCMP_ONE) > + return FCI->getOperand(1); > + } else if (FCI->getPredicate() == FCmpInst::FCMP_UEQ || > + FCI->getPredicate() == FCmpInst::FCMP_OEQ) { > + return ICI->getOperand(1); > + } > + } > + else if (SetCondInst *SCI = > dyn_cast(BI->getCondition())) { > if (SCI->getOperand(0) == Inc) > if (BI->getSuccessor(0) == getHeader()) { > if (SCI->getOpcode() == Instruction::SetNE) > return SCI->getOperand(1); > } else if (SCI->getOpcode() == Instruction::SetEQ) { > return SCI->getOperand(1); > } > + } > + } > > > > The "getCanonicalInductionVariableIncrement" method only returns > non-null in the non-fp case, so please remove all the FP handling code > from this method. > Nice. Deleted. > > > > > > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/Analysis/ScalarEvolution.cpp,v > retrieving revision 1.67 > diff -t -d -u -p -5 -r1.67 ScalarEvolution.cpp > --- lib/Analysis/ScalarEvolution.cpp 7 Dec 2006 01:30:31 -0000 1.67 > +++ lib/Analysis/ScalarEvolution.cpp 10 Dec 2006 23:26:39 -0000 > @@ -1456,121 +1456,252 @@ SCEVHandle ScalarEvolutionsImpl::Compute > // FIXME: we should be able to handle switch instructions (with a > single exit) > // FIXME: We should handle cast of int to bool as well > BranchInst *ExitBr = > dyn_cast(ExitingBlock->getTerminator()); > if (ExitBr == 0) return UnknownValue; > assert(ExitBr->isConditional() && "If unconditional, it can't be in > loop!"); > - SetCondInst *ExitCond = > dyn_cast(ExitBr->getCondition()); > - if (ExitCond == 0) // Not a setcc > - return ComputeIterationCountExhaustively(L, > ExitBr->getCondition(), > - ExitBr->getSuccessor(0) == > ExitBlock); > + if (SetCondInst *ExitCond = > dyn_cast(ExitBr->getCondition())) { > > > Likewise, the SCEV code does not handle any FP compares. > Right. Deleted. > > > + case ICmpInst::ICMP_SLT: > + if (LHS->getType()->isInteger()) { > + SCEVHandle TC = HowManyLessThans(LHS, RHS, L); > + if (!isa(TC)) return TC; > + } > + break; > + case ICmpInst::ICMP_SGT: > + if (LHS->getType()->isInteger()) { > + SCEVHandle TC = HowManyLessThans(RHS, LHS, L); > + if (!isa(TC)) return TC; > + } > + break; > > > The isInteger if's are unneeded. Removed. > > > > > > > @@ -1672,11 +1803,15 @@ ComputeLoadConstantCompareIterationCount > > > > Constant *Result = GetAddressedElementFromGlobal(GV, Indexes); > if (Result == 0) break; // Cannot compute! > > > > // Evaluate the condition for this iteration. > - Result = ConstantExpr::get(SetCCOpcode, Result, RHS); > + if (SetCCOpcode >= ICmpInst::FIRST_ICMP_PREDICATE && > + SetCCOpcode <= ICmpInst::LAST_ICMP_PREDICATE) > + Result = ConstantExpr::getICmp(SetCCOpcode, Result, RHS); > + else > + Result = ConstantExpr::get(SetCCOpcode, Result, RHS); > if (!isa(Result)) break; // Couldn't decide for > sure > if (cast(Result)->getValue() == false) { > > > I believe this can only be integer comparisons, but please check. Yes, its an implementation method internal to the file and there is only one call. The predicate value passed in is derived from ICmpInst::getPredicate() so I dumped the entire if statement and just: Result = ConstantExpr::getICmp(SetCCOpcode, Result, RHS); > > > > > @@ -2182,11 +2324,13 @@ SCEVHandle ScalarEvolutionsImpl::HowFarT > > > > // If the value is a constant, check to see if it is known to be > non-zero > // already. If so, the backedge will execute zero times. > if (SCEVConstant *C = dyn_cast(V)) { > Constant *Zero = > Constant::getNullValue(C->getValue()->getType()); > - Constant *NonZero = ConstantExpr::getSetNE(C->getValue(), Zero); > + Constant *NonZero = Zero->getType()->isFloatingPoint() ? > + ConstantExpr::getSetNE(C->getValue(), Zero) : > + ConstantExpr::getICmp(ICmpInst::ICMP_NE, C->getValue(), Zero); > if (NonZero == ConstantBool::getTrue()) > return getSCEV(Zero); > return UnknownValue; // Otherwise it will loop infinitely. > } > > > > SCEVConstant can only be for integers, drop the FP handling case. Yup. Done. > > > > > @@ -2243,44 +2387,86 @@ HowManyLessThans(SCEV *LHS, SCEV *RHS, c > if (!LoopEntryPredicate) return UnknownValue; > } > > > > // Now that we found a conditional branch that dominates the > loop, check to > // see if it is the comparison we are looking for. > - SetCondInst *SCI > =dyn_cast(LoopEntryPredicate->getCondition()); > - if (!SCI) return UnknownValue; > - Value *PreCondLHS = SCI->getOperand(0); > - Value *PreCondRHS = SCI->getOperand(1); > - Instruction::BinaryOps Cond; > - if (LoopEntryPredicate->getSuccessor(0) == PreheaderDest) > - Cond = SCI->getOpcode(); > - else > - Cond = SCI->getInverseCondition(); > + if (SetCondInst *SCI = dyn_cast( > + LoopEntryPredicate->getCondition())) { > + Value *PreCondLHS = SCI->getOperand(0); > + Value *PreCondRHS = SCI->getOperand(1); > + Instruction::BinaryOps Cond; > + if (LoopEntryPredicate->getSuccessor(0) == PreheaderDest) > + Cond = SCI->getOpcode(); > + else > + Cond = SCI->getInverseCondition(); > > > likewise, only integer. Yup. Done previously. SetCondInst does not now appear in ScalarEvolution.cpp > -Chris -------------- next part -------------- A non-text attachment was scrubbed... Name: CF.patch Type: text/x-patch Size: 27647 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061213/3d575b3f/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: ConstRange.patch Type: text/x-patch Size: 14581 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061213/3d575b3f/attachment-0001.bin From dpatel at apple.com Wed Dec 13 18:08:19 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 13 Dec 2006 18:08:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612140008.kBE08JJo018469@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.98 -> 1.99 --- Log message: Add " Made Modification " messages in debug-pass=Executions output. --- Diffs of the changes: (+26 -3) PassManager.cpp | 29 ++++++++++++++++++++++++++--- 1 files changed, 26 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.98 llvm/lib/VMCore/PassManager.cpp:1.99 --- llvm/lib/VMCore/PassManager.cpp:1.98 Wed Dec 13 17:50:44 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Dec 13 18:08:04 2006 @@ -918,16 +918,23 @@ bool Changed = doInitialization(F); initializeAnalysisInfo(); + std::string Msg1 = "Executing Pass '"; + std::string Msg3 = "' Made Modification '"; + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; - std::string Msg1 = "Executing Pass '"; std::string Msg2 = "' on BasicBlock '" + (*I).getName() + "'...\n"; dumpPassInfo(P, Msg1, Msg2); initializeAnalysisImpl(P); + BasicBlockPass *BP = dynamic_cast(P); Changed |= BP->runOnBasicBlock(*I); + + if (Changed) + dumpPassInfo(P, Msg3, Msg2); + removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); removeDeadPasses(P, Msg2); @@ -1141,15 +1148,23 @@ initializeAnalysisInfo(); + std::string Msg1 = "Executing Pass '"; + std::string Msg3 = "' Made Modification '"; + for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; - std::string Msg1 = "Executing Pass '"; + std::string Msg2 = "' on Function '" + F.getName() + "'...\n"; dumpPassInfo(P, Msg1, Msg2); + initializeAnalysisImpl(P); FunctionPass *FP = dynamic_cast(P); Changed |= FP->runOnFunction(F); + + if (Changed) + dumpPassInfo(P, Msg3, Msg2); + removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); removeDeadPasses(P, Msg2); @@ -1273,15 +1288,23 @@ bool Changed = false; initializeAnalysisInfo(); + std::string Msg1 = "Executing Pass '"; + std::string Msg3 = "' Made Modification '"; + for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; - std::string Msg1 = "Executing Pass '"; + std::string Msg2 = "' on Module '" + M.getModuleIdentifier() + "'...\n"; dumpPassInfo(P, Msg1, Msg2); + initializeAnalysisImpl(P); ModulePass *MP = dynamic_cast(P); Changed |= MP->runOnModule(M); + + if (Changed) + dumpPassInfo(P, Msg3, Msg2); + removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); removeDeadPasses(P, Msg2); From dpatel at apple.com Wed Dec 13 18:25:21 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 13 Dec 2006 18:25:21 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612140025.kBE0PLBO018740@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.99 -> 1.100 --- Log message: Add debug-pass=Details support to print Required and Preserved Set info. --- Diffs of the changes: (+26 -1) PassManager.cpp | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.99 llvm/lib/VMCore/PassManager.cpp:1.100 --- llvm/lib/VMCore/PassManager.cpp:1.99 Wed Dec 13 18:08:04 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Dec 13 18:25:06 2006 @@ -321,6 +321,17 @@ cerr << Msg2; } + void dumpAnalysisSetInfo(const char *Msg, Pass *P, + const std::vector &Set) { + if (PassDebugging_New >= Details && !Set.empty()) { + cerr << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:"; + for (unsigned i = 0; i != Set.size(); ++i) { + if (i) cerr << ","; + cerr << " " << Set[i]->getPassName(); + } + cerr << "\n"; + } + } protected: // Collection of pass whose last user asked this manager to claim @@ -925,8 +936,13 @@ for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; + AnalysisUsage AnUsage; + P->getAnalysisUsage(AnUsage); + std::string Msg2 = "' on BasicBlock '" + (*I).getName() + "'...\n"; dumpPassInfo(P, Msg1, Msg2); + dumpAnalysisSetInfo("Required", P, AnUsage.getRequiredSet()); + initializeAnalysisImpl(P); BasicBlockPass *BP = dynamic_cast(P); @@ -934,6 +950,7 @@ if (Changed) dumpPassInfo(P, Msg3, Msg2); + dumpAnalysisSetInfo("Preserved", P, AnUsage.getPreservedSet()); removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); @@ -1154,9 +1171,12 @@ for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; + AnalysisUsage AnUsage; + P->getAnalysisUsage(AnUsage); std::string Msg2 = "' on Function '" + F.getName() + "'...\n"; dumpPassInfo(P, Msg1, Msg2); + dumpAnalysisSetInfo("Required", P, AnUsage.getRequiredSet()); initializeAnalysisImpl(P); FunctionPass *FP = dynamic_cast(P); @@ -1164,6 +1184,7 @@ if (Changed) dumpPassInfo(P, Msg3, Msg2); + dumpAnalysisSetInfo("Preserved", P, AnUsage.getPreservedSet()); removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); @@ -1294,9 +1315,12 @@ for (std::vector::iterator itr = passVectorBegin(), e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; + AnalysisUsage AnUsage; + P->getAnalysisUsage(AnUsage); std::string Msg2 = "' on Module '" + M.getModuleIdentifier() + "'...\n"; dumpPassInfo(P, Msg1, Msg2); + dumpAnalysisSetInfo("Required", P, AnUsage.getRequiredSet()); initializeAnalysisImpl(P); ModulePass *MP = dynamic_cast(P); @@ -1304,7 +1328,8 @@ if (Changed) dumpPassInfo(P, Msg3, Msg2); - + dumpAnalysisSetInfo("Preserved", P, AnUsage.getPreservedSet()); + removeNotPreservedAnalysis(P); recordAvailableAnalysis(P); removeDeadPasses(P, Msg2); From dpatel at apple.com Wed Dec 13 18:59:57 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 13 Dec 2006 18:59:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612140059.kBE0xvKM019260@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.100 -> 1.101 --- Log message: Add -time-passes support. --- Diffs of the changes: (+87 -1) PassManager.cpp | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 87 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.100 llvm/lib/VMCore/PassManager.cpp:1.101 --- llvm/lib/VMCore/PassManager.cpp:1.100 Wed Dec 13 18:25:06 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Dec 13 18:59:42 2006 @@ -14,9 +14,11 @@ #include "llvm/PassManager.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Timer.h" #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/Support/Streams.h" +#include "llvm/Support/ManagedStatic.h" #include #include using namespace llvm; @@ -571,6 +573,55 @@ ModulePassManager *activeManager; }; +//===----------------------------------------------------------------------===// +// TimingInfo Class - This class is used to calculate information about the +// amount of time each pass takes to execute. This only happens when +// -time-passes is enabled on the command line. +// + +class TimingInfo { + std::map TimingData; + TimerGroup TG; + +public: + // Use 'create' member to get this. + TimingInfo() : TG("... Pass execution timing report ...") {} + + // TimingDtor - Print out information about timing information + ~TimingInfo() { + // Delete all of the timers... + TimingData.clear(); + // TimerGroup is deleted next, printing the report. + } + + // createTheTimeInfo - This method either initializes the TheTimeInfo pointer + // to a non null value (if the -time-passes option is enabled) or it leaves it + // null. It may be called multiple times. + static void createTheTimeInfo(); + + void passStarted(Pass *P) { + + if (dynamic_cast(P)) + return; + + std::map::iterator I = TimingData.find(P); + if (I == TimingData.end()) + I=TimingData.insert(std::make_pair(P, Timer(P->getPassName(), TG))).first; + I->second.startTimer(); + } + void passEnded(Pass *P) { + + if (dynamic_cast(P)) + return; + + std::map::iterator I = TimingData.find(P); + assert (I != TimingData.end() && "passStarted/passEnded not nested right!"); + I->second.stopTimer(); + } +}; + +static TimingInfo *TheTimeInfo; + } // End of llvm namespace //===----------------------------------------------------------------------===// @@ -764,8 +815,10 @@ std::string Msg1 = " Freeing Pass '"; dumpPassInfo(*I, Msg1, Msg); + if (TheTimeInfo) TheTimeInfo->passStarted(P); (*I)->releaseMemory(); - + if (TheTimeInfo) TheTimeInfo->passEnded(P); + std::map::iterator Pos = AvailableAnalysis.find((*I)->getPassInfo()); @@ -946,7 +999,9 @@ initializeAnalysisImpl(P); BasicBlockPass *BP = dynamic_cast(P); + if (TheTimeInfo) TheTimeInfo->passStarted(P); Changed |= BP->runOnBasicBlock(*I); + if (TheTimeInfo) TheTimeInfo->passEnded(P); if (Changed) dumpPassInfo(P, Msg3, Msg2); @@ -1180,7 +1235,10 @@ initializeAnalysisImpl(P); FunctionPass *FP = dynamic_cast(P); + + if (TheTimeInfo) TheTimeInfo->passStarted(P); Changed |= FP->runOnFunction(F); + if (TheTimeInfo) TheTimeInfo->passEnded(P); if (Changed) dumpPassInfo(P, Msg3, Msg2); @@ -1324,7 +1382,10 @@ initializeAnalysisImpl(P); ModulePass *MP = dynamic_cast(P); + + if (TheTimeInfo) TheTimeInfo->passStarted(P); Changed |= MP->runOnModule(M); + if (TheTimeInfo) TheTimeInfo->passEnded(P); if (Changed) dumpPassInfo(P, Msg3, Msg2); @@ -1366,6 +1427,8 @@ bool Changed = false; + TimingInfo::createTheTimeInfo(); + dumpArguments(); if (PassDebugging_New >= Structure) dumpPasses(); @@ -1408,4 +1471,27 @@ return PM->run(M); } +//===----------------------------------------------------------------------===// +// TimingInfo Class - This class is used to calculate information about the +// amount of time each pass takes to execute. This only happens with +// -time-passes is enabled on the command line. +// +bool llvm::TimePassesIsEnabled = false; +static cl::opt +EnableTiming("time-passes", cl::location(TimePassesIsEnabled), + cl::desc("Time each pass, printing elapsed time for each on exit")); + +// createTheTimeInfo - This method either initializes the TheTimeInfo pointer to +// a non null value (if the -time-passes option is enabled) or it leaves it +// null. It may be called multiple times. +void TimingInfo::createTheTimeInfo() { + if (!TimePassesIsEnabled || TheTimeInfo) return; + + // Constructed the first time this is called, iff -time-passes is enabled. + // This guarantees that the object will be constructed before static globals, + // thus it will be destroyed before them. + static ManagedStatic TTI; + TheTimeInfo = &*TTI; +} + #endif From criswell at cs.uiuc.edu Wed Dec 13 23:51:32 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 23:51:32 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/configure Message-ID: <200612140551.XAA13208@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc: configure updated: 1.11 -> 1.12 --- Log message: Merged from release_19 branch. This adds correct compilation of DSA, pool inference, and configure script fixes to mainline. --- Diffs of the changes: (+633 -336) configure | 969 ++++++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 633 insertions(+), 336 deletions(-) Index: llvm-poolalloc/configure diff -u llvm-poolalloc/configure:1.11 llvm-poolalloc/configure:1.12 --- llvm-poolalloc/configure:1.11 Fri May 27 08:51:57 2005 +++ llvm-poolalloc/configure Wed Dec 13 23:51:03 2006 @@ -1,11 +1,10 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57 for [Pool Allocation] [1.0]. +# Generated by GNU Autoconf 2.59 for [Pool Allocation] [1.0]. # # Report bugs to . # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -22,9 +21,10 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -43,7 +43,7 @@ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -220,16 +220,17 @@ if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -310,7 +311,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP MMAP_FILE LLVM_SRC LLVM_OBJ LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS LLVM_SRC LLVM_OBJ CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP MMAP_FILE SAFECODESRC LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -669,7 +670,7 @@ # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir + localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in @@ -709,10 +710,10 @@ # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -804,9 +805,9 @@ cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -840,11 +841,20 @@ esac cat <<\_ACEOF +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-safecode Enable SAFECode functionality (default is NO) + --enable-boundschecks Enable SAFECode bounds checking (default is NO) + --enable-kernel Use SAFECode for use with Linux Kernel (default is + NO) + Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-llvmsrc Location of LLVM Source Code --with-llvmobj Location of LLVM Object Code + --with-safecode Location of SAFECode Source Code Some influential environment variables: CC C compiler command @@ -892,12 +902,45 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. @@ -908,7 +951,7 @@ echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then + test -f $ac_srcdir/configure.in; then echo $ac_configure --help else @@ -922,10 +965,9 @@ if $ac_init_version; then cat <<\_ACEOF [Pool Allocation] configure [1.0] -generated by GNU Autoconf 2.57 +generated by GNU Autoconf 2.59 -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -937,7 +979,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by [Pool Allocation] $as_me [1.0], which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1014,19 +1056,19 @@ 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. + ac_must_keep_next=false # Got value, back to normal. else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. @@ -1060,12 +1102,12 @@ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } @@ -1094,7 +1136,7 @@ for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi @@ -1113,7 +1155,7 @@ echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 - rm -f core core.* *.core && + rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 @@ -1193,7 +1235,7 @@ # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" @@ -1210,13 +1252,13 @@ ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. @@ -1273,8 +1315,11 @@ +LLVM_SRC_ROOT="`(cd $srcdir/../..; pwd)`" +LLVM_OBJ_ROOT="`(cd ../..; pwd)`" + ac_aux_dir= -for ac_dir in autoconf $srcdir/autoconf; do +for ac_dir in $LLVM_SRC_ROOT/autoconf $srcdir/$LLVM_SRC_ROOT/autoconf; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -1290,8 +1335,8 @@ fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&5 -echo "$as_me: error: cannot find install-sh or install.sh in autoconf $srcdir/autoconf" >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $LLVM_SRC_ROOT/autoconf $srcdir/$LLVM_SRC_ROOT/autoconf" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $LLVM_SRC_ROOT/autoconf $srcdir/$LLVM_SRC_ROOT/autoconf" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" @@ -1299,6 +1344,35 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Check whether --with-llvmsrc or --without-llvmsrc was given. +if test "${with_llvmsrc+set}" = set; then + withval="$with_llvmsrc" + llvm_src="$withval" +else + llvm_src="$LLVM_SRC_ROOT" +fi; + LLVM_SRC=$llvm_src + + +# Check whether --with-llvmobj or --without-llvmobj was given. +if test "${with_llvmobj+set}" = set; then + withval="$with_llvmobj" + llvm_obj="$withval" +else + llvm_obj="$LLVM_OBJ_ROOT" +fi; + LLVM_OBJ=$llvm_obj + + ac_config_commands="$ac_config_commands setup" + + + + + + ac_config_files="$ac_config_files Makefile.common" + + ac_config_commands="$ac_config_commands Makefile" @@ -1324,8 +1398,6 @@ - - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -1662,7 +1734,6 @@ (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1682,8 +1753,8 @@ # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 @@ -1703,23 +1774,23 @@ test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; + ;; conftest.$ac_ext ) - # This is the source file. - ;; + # This is the source file. + ;; [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; + # We found the default executable, but exeext='' is most + # certainly right. + break;; *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; * ) - break;; + break;; esac done else @@ -1793,8 +1864,8 @@ case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; + export ac_cv_exeext + break;; * ) break;; esac done @@ -1819,7 +1890,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1870,7 +1940,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1890,11 +1959,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1907,7 +1986,7 @@ ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi @@ -1923,7 +2002,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1940,11 +2018,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -1957,7 +2045,7 @@ ac_cv_prog_cc_g=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 @@ -1984,7 +2072,6 @@ ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2012,6 +2099,16 @@ va_end (v); return s; } + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2038,11 +2135,21 @@ CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2055,7 +2162,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext +rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC @@ -2083,19 +2190,28 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ - ''\ - '#include ' \ + '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ @@ -2103,14 +2219,13 @@ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include $ac_declaration +#include int main () { @@ -2121,11 +2236,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2138,9 +2263,8 @@ continue fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2157,11 +2281,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2173,7 +2307,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then @@ -2187,7 +2321,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2200,24 +2334,21 @@ if test "${ac_cv_header_mmap_anon+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - - ac_ext=c + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include - #include - #include +#include +#include int main () { @@ -2228,11 +2359,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2245,7 +2386,7 @@ ac_cv_header_mmap_anon=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -2257,7 +2398,8 @@ echo "$as_me:$LINENO: result: $ac_cv_header_mmap_anon" >&5 echo "${ECHO_T}$ac_cv_header_mmap_anon" >&6 if test "$ac_cv_header_mmap_anon" = yes; then - cat >>confdefs.h <<\_ACEOF + +cat >>confdefs.h <<\_ACEOF #define HAVE_MMAP_ANONYMOUS 1 _ACEOF @@ -2291,7 +2433,6 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2302,7 +2443,7 @@ #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2314,6 +2455,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2334,7 +2476,6 @@ # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2352,6 +2493,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2398,7 +2540,6 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2409,7 +2550,7 @@ #else # include #endif - Syntax error + Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -2421,6 +2562,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2441,7 +2583,6 @@ # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2459,6 +2600,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2519,7 +2661,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2578,7 +2719,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2599,11 +2739,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2616,12 +2766,11 @@ ac_cv_header_stdc=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2643,7 +2792,6 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2668,7 +2816,6 @@ : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2680,9 +2827,9 @@ # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -2693,7 +2840,7 @@ int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) + || toupper (i) != TOUPPER (i)) exit(2); exit (0); } @@ -2718,7 +2865,7 @@ ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi @@ -2743,7 +2890,7 @@ for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h + inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 @@ -2752,7 +2899,6 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2764,11 +2910,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2781,7 +2937,7 @@ eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -2813,7 +2969,6 @@ echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2824,11 +2979,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2841,7 +3006,7 @@ ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -2849,7 +3014,6 @@ echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2867,6 +3031,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -2886,33 +3051,32 @@ echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf at gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf at gnu.org. ## -## ------------------------------------ ## +## ----------------------------------- ## +## Report this to llvmbugs at cs.uiuc.edu ## +## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -2923,7 +3087,7 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -2958,7 +3122,6 @@ echo "$as_me:$LINENO: checking $ac_header usability" >&5 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -2969,11 +3132,21 @@ _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -2986,7 +3159,7 @@ ac_header_compiler=no fi -rm -f conftest.$ac_objext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 @@ -2994,7 +3167,6 @@ echo "$as_me:$LINENO: checking $ac_header presence" >&5 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3012,6 +3184,7 @@ (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi @@ -3031,33 +3204,32 @@ echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf at gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes ;; - no:yes ) + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf at gnu.org. ## -## ------------------------------------ ## +## ----------------------------------- ## +## Report this to llvmbugs at cs.uiuc.edu ## +## ----------------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 @@ -3068,7 +3240,7 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 @@ -3093,21 +3265,28 @@ echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ + #ifdef __STDC__ # include #else # include #endif + +#undef $ac_func + /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" @@ -3138,11 +3317,21 @@ _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? @@ -3155,7 +3344,8 @@ eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 @@ -3176,7 +3366,6 @@ ac_cv_func_mmap_fixed_mapped=no else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3284,9 +3473,9 @@ data2 = (char *) malloc (2 * pagesize); if (!data2) exit (1); - data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1); if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) + MAP_PRIVATE | MAP_FIXED, fd, 0L)) exit (1); for (i = 0; i < pagesize; ++i) if (*(data + i) != *(data2 + i)) @@ -3329,7 +3518,7 @@ ( exit $ac_status ) ac_cv_func_mmap_fixed_mapped=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5 @@ -3348,44 +3537,39 @@ if test "${ac_cv_func_mmap_file+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - - - ac_ext=c + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } + ac_cv_func_mmap_file=no else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ + + /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#ifdef HAVE_SYS_MMAN_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H #include -#endif - -#ifdef HAVE_FCNTL_H +#include #include -#endif + +int +main () +{ int fd; - int main () { - fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != MAP_FAILED);} + fd = creat ("foo",0777); + fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); + unlink ("foo"); + return (fd != (int) MAP_FAILED); + ; + return 0; +} _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 @@ -3407,7 +3591,7 @@ ( exit $ac_status ) ac_cv_func_mmap_file=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3420,8 +3604,9 @@ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_file" >&5 echo "${ECHO_T}$ac_cv_func_mmap_file" >&6 if test "$ac_cv_func_mmap_file" = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_MMAP_FILE 1 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MMAP_FILE _ACEOF MMAP_FILE=yes @@ -3451,32 +3636,48 @@ fi +# Check whether --enable-safecode or --disable-safecode was given. +if test "${enable_safecode+set}" = set; then + enableval="$enable_safecode" + cat >>confdefs.h <<\_ACEOF +#define SAFECODE 1 +_ACEOF +fi; -# Check whether --with-llvmsrc or --without-llvmsrc was given. -if test "${with_llvmsrc+set}" = set; then - withval="$with_llvmsrc" - LLVM_SRC=$withval +# Check whether --enable-boundscheck or --disable-boundscheck was given. +if test "${enable_boundscheck+set}" = set; then + enableval="$enable_boundscheck" + cat >>confdefs.h <<\_ACEOF +#define BOUNDS_CHECK 1 +_ACEOF -else - LLVM_SRC=`cd ${srcdir}/../..; pwd` +fi; + +# Check whether --enable-kernel or --disable-kernel was given. +if test "${enable_kernel+set}" = set; then + enableval="$enable_kernel" + cat >>confdefs.h <<\_ACEOF +#define LLVA_KERNEL 1 +_ACEOF fi; -# Check whether --with-llvmobj or --without-llvmobj was given. -if test "${with_llvmobj+set}" = set; then - withval="$with_llvmobj" - LLVM_OBJ=$withval + +# Check whether --with-safecodesrc or --without-safecodesrc was given. +if test "${with_safecodesrc+set}" = set; then + withval="$with_safecodesrc" + SAFECODESRC=$withval else - LLVM_OBJ=`cd ../..; pwd` + SAFECODESRC=`cd ../safecode; pwd` fi; ac_config_headers="$ac_config_headers include/poolalloc/Config/config.h" - ac_config_files="$ac_config_files Makefile.common" + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -3505,13 +3706,13 @@ # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | @@ -3541,13 +3742,13 @@ # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ + ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; +s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; -s/^[^=]*=[ ]*$//; +s/^[^=]*=[ ]*$//; }' fi @@ -3558,7 +3759,7 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' @@ -3602,9 +3803,10 @@ elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi +DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false @@ -3623,7 +3825,7 @@ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var @@ -3802,16 +4004,17 @@ if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS @@ -3838,7 +4041,7 @@ cat >&5 <<_CSEOF This file was extended by [Pool Allocation] $as_me [1.0], which was -generated by GNU Autoconf 2.57. Invocation command line was +generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -3882,9 +4085,9 @@ -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + instantiate the configuration file FILE --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + instantiate the configuration header FILE Configuration files: $config_files @@ -3901,11 +4104,10 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ [Pool Allocation] config.status [1.0] -configured by $0, generated by GNU Autoconf 2.57, +configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir @@ -3999,13 +4201,7 @@ # INIT-COMMANDS section. # -${srcdir}/autoconf/mkinstalldirs `dirname Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname lib/PoolAllocate/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname runtime/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname runtime/PoolAllocator/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname runtime/FreeListAllocator/Makefile` -${srcdir}/autoconf/mkinstalldirs `dirname test/Makefile` +llvm_src="${LLVM_SRC}" _ACEOF @@ -4017,6 +4213,7 @@ case "$ac_config_target" in # Handling of arguments. "Makefile.common" ) CONFIG_FILES="$CONFIG_FILES Makefile.common" ;; + "setup" ) CONFIG_COMMANDS="$CONFIG_COMMANDS setup" ;; "Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS Makefile" ;; "lib/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/Makefile" ;; "lib/PoolAllocate/Makefile" ) CONFIG_COMMANDS="$CONFIG_COMMANDS lib/PoolAllocate/Makefile" ;; @@ -4110,6 +4307,8 @@ s, at ECHO_N@,$ECHO_N,;t t s, at ECHO_T@,$ECHO_T,;t t s, at LIBS@,$LIBS,;t t +s, at LLVM_SRC@,$LLVM_SRC,;t t +s, at LLVM_OBJ@,$LLVM_OBJ,;t t s, at CC@,$CC,;t t s, at CFLAGS@,$CFLAGS,;t t s, at LDFLAGS@,$LDFLAGS,;t t @@ -4120,8 +4319,7 @@ s, at CPP@,$CPP,;t t s, at EGREP@,$EGREP,;t t s, at MMAP_FILE@,$MMAP_FILE,;t t -s, at LLVM_SRC@,$LLVM_SRC,;t t -s, at LLVM_OBJ@,$LLVM_OBJ,;t t +s, at SAFECODESRC@,$SAFECODESRC,;t t s, at LIBOBJS@,$LIBOBJS,;t t s, at LTLIBOBJS@,$LTLIBOBJS,;t t CEOF @@ -4153,9 +4351,9 @@ (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end @@ -4173,21 +4371,21 @@ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4203,10 +4401,10 @@ as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4244,12 +4442,45 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac @@ -4267,7 +4498,7 @@ configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." + sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. @@ -4276,24 +4507,24 @@ case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } _ACEOF @@ -4334,12 +4565,12 @@ # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' @@ -4348,11 +4579,11 @@ # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac @@ -4366,28 +4597,29 @@ case $f in -) echo $tmp/stdin ;; [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - echo $f;; + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } - fi;; + fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF @@ -4410,9 +4642,9 @@ s,[\\$`],\\&,g t clear : clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times @@ -4426,13 +4658,13 @@ # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail @@ -4441,7 +4673,7 @@ # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -4468,7 +4700,7 @@ # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS @@ -4502,10 +4734,10 @@ else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4521,10 +4753,10 @@ as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } @@ -4556,16 +4788,41 @@ ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. if test "$ac_dir" != .; then @@ -4591,24 +4848,64 @@ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in - Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; - lib/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; - lib/PoolAllocate/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/lib/PoolAllocate/Makefile lib/PoolAllocate/Makefile ;; - runtime/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/runtime/Makefile runtime/Makefile ;; - runtime/PoolAllocator/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/runtime/PoolAllocator/Makefile runtime/PoolAllocator/Makefile ;; - runtime/FreeListAllocator/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/runtime/FreeListAllocator/Makefile runtime/FreeListAllocator/Makefile ;; - test/Makefile ) ${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/test/Makefile test/Makefile ;; + Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/Makefile Makefile ;; + lib/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/Makefile lib/Makefile ;; + lib/PoolAllocate/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname lib/PoolAllocate/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/lib/PoolAllocate/Makefile lib/PoolAllocate/Makefile ;; + runtime/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname runtime/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/runtime/Makefile runtime/Makefile ;; + runtime/PoolAllocator/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname runtime/PoolAllocator/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/runtime/PoolAllocator/Makefile runtime/PoolAllocator/Makefile ;; + runtime/FreeListAllocator/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname runtime/FreeListAllocator/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/runtime/FreeListAllocator/Makefile runtime/FreeListAllocator/Makefile ;; + test/Makefile ) ${llvm_src}/autoconf/mkinstalldirs `dirname test/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/test/Makefile test/Makefile ;; esac done _ACEOF From criswell at cs.uiuc.edu Wed Dec 13 23:51:53 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 23:51:53 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/include/poolalloc/Config/config.h.in Message-ID: <200612140551.XAA13267@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/include/poolalloc/Config: config.h.in updated: 1.3 -> 1.4 --- Log message: Merged from release_19 branch. This adds correct compilation of DSA, pool inference, and configure script fixes to mainline. --- Diffs of the changes: (+10 -0) config.h.in | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm-poolalloc/include/poolalloc/Config/config.h.in diff -u llvm-poolalloc/include/poolalloc/Config/config.h.in:1.3 llvm-poolalloc/include/poolalloc/Config/config.h.in:1.4 --- llvm-poolalloc/include/poolalloc/Config/config.h.in:1.3 Wed May 18 14:56:23 2005 +++ llvm-poolalloc/include/poolalloc/Config/config.h.in Wed Dec 13 23:51:06 2006 @@ -463,3 +463,13 @@ /* Define to `unsigned' if does not define. */ #undef size_t + +/* Define to 1 if enabling SAFECode */ +#undef SAFECODE + +/* Define to 1 if enabling SAFECode bounds checking */ +#undef BOUNDS_CHECK + +/* Define to 1 if compiling for pool inference */ +#undef LLVA_KERNEL + From criswell at cs.uiuc.edu Wed Dec 13 23:51:55 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 23:51:55 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/include/poolalloc/PoolAllocate.h Message-ID: <200612140551.XAA13272@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/include/poolalloc: PoolAllocate.h updated: 1.51 -> 1.52 --- Log message: Merged from release_19 branch. This adds correct compilation of DSA, pool inference, and configure script fixes to mainline. --- Diffs of the changes: (+3 -4) PoolAllocate.h | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) Index: llvm-poolalloc/include/poolalloc/PoolAllocate.h diff -u llvm-poolalloc/include/poolalloc/PoolAllocate.h:1.51 llvm-poolalloc/include/poolalloc/PoolAllocate.h:1.52 --- llvm-poolalloc/include/poolalloc/PoolAllocate.h:1.51 Wed Jul 26 10:37:25 2006 +++ llvm-poolalloc/include/poolalloc/PoolAllocate.h Wed Dec 13 23:51:06 2006 @@ -16,19 +16,18 @@ #ifndef POOLALLOCATE_H #define POOLALLOCATE_H -//#define SAFECODE 1 -//#define BOUNDS_CHECK 1 -//comment the above two for normal poolallocation + #include "llvm/Pass.h" #include "llvm/DerivedTypes.h" #include "llvm/Support/CallSite.h" #include "llvm/ADT/EquivalenceClasses.h" #include "llvm/ADT/VectorExtras.h" #include "llvm/ADT/hash_set" +#include "poolalloc/Config/config.h" #ifdef SAFECODE //FIXME : make this use some configuration options -#include "/home/vadve/dhurjati/llvm/projects/safecode.typesafe/include/ConvertUnsafeAllocas.h" +#include "/home/vadve/criswell/src/latestllvm/projects/safecode/include/ConvertUnsafeAllocas.h" #endif From criswell at cs.uiuc.edu Wed Dec 13 23:51:55 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 23:51:55 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/include/dsa/DSGraph.h DSGraphTraits.h DSNode.h DataStructure.h Message-ID: <200612140551.XAA13317@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/include/dsa: DSGraph.h updated: 1.112 -> 1.113 DSGraphTraits.h updated: 1.25 -> 1.26 DSNode.h updated: 1.60 -> 1.61 DataStructure.h updated: 1.98 -> 1.99 --- Log message: Merged from release_19 branch. This adds correct compilation of DSA, pool inference, and configure script fixes to mainline. --- Diffs of the changes: (+113 -11) DSGraph.h | 103 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- DSGraphTraits.h | 2 - DSNode.h | 11 ++++- DataStructure.h | 8 +++- 4 files changed, 113 insertions(+), 11 deletions(-) Index: llvm-poolalloc/include/dsa/DSGraph.h diff -u llvm-poolalloc/include/dsa/DSGraph.h:1.112 llvm-poolalloc/include/dsa/DSGraph.h:1.113 --- llvm-poolalloc/include/dsa/DSGraph.h:1.112 Wed Dec 6 19:30:30 2006 +++ llvm-poolalloc/include/dsa/DSGraph.h Wed Dec 13 23:51:06 2006 @@ -15,13 +15,18 @@ #ifndef LLVM_ANALYSIS_DSGRAPH_H #define LLVM_ANALYSIS_DSGRAPH_H -#include "llvm/Analysis/DataStructure/DSNode.h" +#include "dsa/DSNode.h" #include "llvm/ADT/hash_map" #include "llvm/ADT/EquivalenceClasses.h" -#include +#include "poolalloc/Config/config.h" +#include +#include +#include namespace llvm { + //typedef map PoolDescriptorMapType; + class GlobalValue; //===----------------------------------------------------------------------===// @@ -170,6 +175,62 @@ }; +#ifdef LLVA_KERNEL +class MetaPool; +class MetaPoolHandle { + MetaPool *Rep; + Instruction * Creator; +public: + MetaPoolHandle(MetaPool *mp, Instruction * Maker = 0); + + MetaPool *getMetaPool() { + return Rep; + } + void setMetaPool(MetaPool *v) { + Rep = v; + } + ~MetaPoolHandle() { + //do nothing for now + } + const std::string &getName(); + Value *getMetaPoolValue(); + void merge(MetaPoolHandle *other); +}; + + class MetaPool { + Value *MPD; + hash_set HandleSet; + + public: + MetaPool(Value *mpd) : MPD(mpd) { + } + void addMetaPoolHandles(hash_set & mpHS) { + HandleSet.insert(mpHS.begin(), mpHS.end()); + } + hash_set& getHandleSet() { + return HandleSet; + } + Value * getMetaPoolValue() { + return MPD; + } + void setMetaPoolValue(Value *V) { + MPD = V; + } + void insert(MetaPoolHandle *mph) { + HandleSet.insert(mph); + } + const std::string& getName() { + return MPD->getName(); + } + ~MetaPool() { + HandleSet.clear(); + } + }; + +#endif + + + //===----------------------------------------------------------------------===// /// DSGraph - The graph that represents a function. /// @@ -219,13 +280,18 @@ /// constructed for. const TargetData &TD; +#ifdef LLVA_KERNEL + hash_map PoolDescriptors; +#endif + + + void operator=(const DSGraph &); // DO NOT IMPLEMENT DSGraph(const DSGraph&); // DO NOT IMPLEMENT public: // Create a new, empty, DSGraph. DSGraph(EquivalenceClasses &ECs, const TargetData &td) - : GlobalsGraph(0), PrintAuxCalls(false), ScalarMap(ECs), TD(td) {} - + : GlobalsGraph(0), PrintAuxCalls(false), ScalarMap(ECs), TD(td) { } // Compute the local DSGraph DSGraph(EquivalenceClasses &ECs, const TargetData &TD, Function &F, DSGraph *GlobalsGraph); @@ -238,13 +304,38 @@ // source. You need to set a new GlobalsGraph with the setGlobalsGraph // method. // - DSGraph(const DSGraph &DSG, EquivalenceClasses &ECs, + DSGraph( DSGraph &DSG, EquivalenceClasses &ECs, unsigned CloneFlags = 0); ~DSGraph(); DSGraph *getGlobalsGraph() const { return GlobalsGraph; } void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; } +#ifdef LLVA_KERNEL +#if 1 + hash_map& getPoolDescriptorsMap() { + return PoolDescriptors; + } + MetaPoolHandle *getPoolForNode(const DSNode *N) { + if (PoolDescriptors.count(N) > 0) { + return PoolDescriptors[N]; + } + return 0; + } +#else + hash_map& getPoolDescriptorsMap() { + return PoolDescriptors; + } + MetaPoolHandle *getPoolForNode(const DSNodeHandle *N) { + if (PoolDescriptors.count(N) > 0) { + return PoolDescriptors[N]; + } + return 0; + } +#endif + +#endif + /// getGlobalECs - Return the set of equivalence classes that the global /// variables in the program form. EquivalenceClasses &getGlobalECs() const { @@ -472,7 +563,7 @@ /// /// The CloneFlags member controls various aspects of the cloning process. /// - void cloneInto(const DSGraph &G, unsigned CloneFlags = 0); + void cloneInto(DSGraph &G, unsigned CloneFlags = 0); /// getFunctionArgumentsForCall - Given a function that is currently in this /// graph, return the DSNodeHandles that correspond to the pointer-compatible Index: llvm-poolalloc/include/dsa/DSGraphTraits.h diff -u llvm-poolalloc/include/dsa/DSGraphTraits.h:1.25 llvm-poolalloc/include/dsa/DSGraphTraits.h:1.26 --- llvm-poolalloc/include/dsa/DSGraphTraits.h:1.25 Thu Nov 2 19:43:47 2006 +++ llvm-poolalloc/include/dsa/DSGraphTraits.h Wed Dec 13 23:51:06 2006 @@ -16,7 +16,7 @@ #ifndef LLVM_ANALYSIS_DSGRAPHTRAITS_H #define LLVM_ANALYSIS_DSGRAPHTRAITS_H -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DSGraph.h" #include "llvm/ADT/GraphTraits.h" #include "llvm/ADT/iterator" #include "llvm/ADT/STLExtras.h" Index: llvm-poolalloc/include/dsa/DSNode.h diff -u llvm-poolalloc/include/dsa/DSNode.h:1.60 llvm-poolalloc/include/dsa/DSNode.h:1.61 --- llvm-poolalloc/include/dsa/DSNode.h:1.60 Wed Dec 6 19:30:30 2006 +++ llvm-poolalloc/include/dsa/DSNode.h Wed Dec 13 23:51:06 2006 @@ -14,7 +14,7 @@ #ifndef LLVM_ANALYSIS_DSNODE_H #define LLVM_ANALYSIS_DSNODE_H -#include "llvm/Analysis/DataStructure/DSSupport.h" +#include "dsa/DSSupport.h" #include "llvm/ADT/hash_map" namespace llvm { @@ -91,8 +91,9 @@ Read = 1 << 6, // This node is read in this context Array = 1 << 7, // This node is treated like an array + External = 1 << 8, // This node comes from an external source //#ifndef NDEBUG - DEAD = 1 << 8, // This node is dead and should not be pointed to + DEAD = 1 << 9, // This node is dead and should not be pointed to //#endif Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode @@ -118,10 +119,14 @@ /// DSNode(const DSNode &, DSGraph *G, bool NullLinks = false); +#if 0 ~DSNode() { dropAllReferences(); assert(hasNoReferrers() && "Referrers to dead node exist!"); } +#else + ~DSNode(); +#endif // Iterator for graph interface... Defined in DSGraphTraits.h typedef DSNodeIterator iterator; @@ -340,12 +345,14 @@ bool isIncomplete() const { return NodeType & Incomplete; } bool isComplete() const { return !isIncomplete(); } bool isDeadNode() const { return NodeType & DEAD; } + bool isExternalNode() const { return NodeType & External; } DSNode *setAllocaNodeMarker() { NodeType |= AllocaNode; return this; } DSNode *setHeapNodeMarker() { NodeType |= HeapNode; return this; } DSNode *setGlobalNodeMarker() { NodeType |= GlobalNode; return this; } DSNode *setUnknownNodeMarker() { NodeType |= UnknownNode; return this; } + DSNode *setExternalMarker() { NodeType |= External; return this; } DSNode *setIncompleteMarker() { NodeType |= Incomplete; return this; } DSNode *setModifiedMarker() { NodeType |= Modified; return this; } DSNode *setReadMarker() { NodeType |= Read; return this; } Index: llvm-poolalloc/include/dsa/DataStructure.h diff -u llvm-poolalloc/include/dsa/DataStructure.h:1.98 llvm-poolalloc/include/dsa/DataStructure.h:1.99 --- llvm-poolalloc/include/dsa/DataStructure.h:1.98 Mon Oct 23 14:52:54 2006 +++ llvm-poolalloc/include/dsa/DataStructure.h Wed Dec 13 23:51:06 2006 @@ -20,6 +20,7 @@ #include "llvm/ADT/hash_map" #include "llvm/ADT/hash_set" #include "llvm/ADT/EquivalenceClasses.h" +#include "poolalloc/Config/config.h" namespace llvm { @@ -30,11 +31,11 @@ class DSCallSite; class DSNode; class DSNodeHandle; +typedef std::map PoolDescriptorMapType; FunctionPass *createDataStructureStatsPass(); FunctionPass *createDataStructureGraphCheckerPass(); - // FIXME: move this stuff to a private header namespace DataStructureAnalysis { /// isPointerType - Return true if this first class type is big enough to hold @@ -43,7 +44,6 @@ bool isPointerType(const Type *Ty); } - // LocalDataStructures - The analysis that computes the local data structure // graphs for all of the functions in the program. // @@ -55,6 +55,10 @@ hash_map DSInfo; DSGraph *GlobalsGraph; +#ifdef LLVA_KERNEL + Function *AddPoolDescToMetaPool; +#endif + /// GlobalECs - The equivalence classes for each global value that is merged /// with other global values in the DSGraphs. EquivalenceClasses GlobalECs; From criswell at cs.uiuc.edu Wed Dec 13 23:51:55 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 23:51:55 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp Heuristic.cpp PointerCompress.cpp PoolAllocate.cpp TransformFunctionBody.cpp Message-ID: <200612140551.XAA13327@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/PoolAllocate: AccessTrace.cpp updated: 1.7 -> 1.8 Heuristic.cpp updated: 1.15 -> 1.16 PointerCompress.cpp updated: 1.73 -> 1.74 PoolAllocate.cpp updated: 1.128 -> 1.129 TransformFunctionBody.cpp updated: 1.58 -> 1.59 --- Log message: Merged from release_19 branch. This adds correct compilation of DSA, pool inference, and configure script fixes to mainline. --- Diffs of the changes: (+16 -11) AccessTrace.cpp | 5 +++-- Heuristic.cpp | 3 ++- PointerCompress.cpp | 5 +++-- PoolAllocate.cpp | 7 ++++--- TransformFunctionBody.cpp | 7 ++++--- 5 files changed, 16 insertions(+), 11 deletions(-) Index: llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp diff -u llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.7 llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.8 --- llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp:1.7 Wed Dec 13 14:06:42 2006 +++ llvm-poolalloc/lib/PoolAllocate/AccessTrace.cpp Wed Dec 13 23:51:06 2006 @@ -12,9 +12,10 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "pointercompress" + +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "poolalloc/PoolAllocate.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/Instructions.h" #include "llvm/Module.h" using namespace llvm; Index: llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp diff -u llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.15 llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.16 --- llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp:1.15 Wed Jul 26 10:07:40 2006 +++ llvm-poolalloc/lib/PoolAllocate/Heuristic.cpp Wed Dec 13 23:51:07 2006 @@ -12,10 +12,11 @@ //===----------------------------------------------------------------------===// #include "Heuristic.h" + +#include "dsa/DSGraphTraits.h" #include "poolalloc/PoolAllocate.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/Analysis/DataStructure/DSGraphTraits.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/Support/CommandLine.h" #include "llvm/Target/TargetData.h" Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.73 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.74 --- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.73 Wed Dec 13 14:06:42 2006 +++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Wed Dec 13 23:51:07 2006 @@ -12,13 +12,14 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "pointercompress" + +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "poolalloc/PoolAllocate.h" #include "Heuristic.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/CommandLine.h" Index: llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp diff -u llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.128 llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.129 --- llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp:1.128 Wed Dec 13 14:06:42 2006 +++ llvm-poolalloc/lib/PoolAllocate/PoolAllocate.cpp Wed Dec 13 23:51:07 2006 @@ -13,6 +13,10 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "poolalloc" + +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" +#include "dsa/CallTargets.h" #include "poolalloc/PoolAllocate.h" #include "Heuristic.h" #include "llvm/Constants.h" @@ -20,13 +24,10 @@ #include "llvm/Instructions.h" #include "llvm/Module.h" #include "llvm/Constants.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" #include "llvm/Support/CFG.h" #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/Transforms/Utils/Cloning.h" -#include "llvm/Analysis/DataStructure/CallTargets.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" Index: llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp diff -u llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.58 llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.59 --- llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp:1.58 Wed Dec 13 14:06:42 2006 +++ llvm-poolalloc/lib/PoolAllocate/TransformFunctionBody.cpp Wed Dec 13 23:51:07 2006 @@ -12,10 +12,11 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "PoolAllocator" + +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" +#include "dsa/CallTargets.h" #include "poolalloc/PoolAllocate.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Analysis/DataStructure/CallTargets.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" From criswell at cs.uiuc.edu Wed Dec 13 23:51:55 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 23:51:55 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/Makefile Message-ID: <200612140551.XAA13303@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib: Makefile updated: 1.3 -> 1.4 --- Log message: Merged from release_19 branch. This adds correct compilation of DSA, pool inference, and configure script fixes to mainline. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-poolalloc/lib/Makefile diff -u llvm-poolalloc/lib/Makefile:1.3 llvm-poolalloc/lib/Makefile:1.4 --- llvm-poolalloc/lib/Makefile:1.3 Wed May 18 14:56:25 2005 +++ llvm-poolalloc/lib/Makefile Wed Dec 13 23:51:06 2006 @@ -6,6 +6,6 @@ # # List all of the subdirectories that we will compile. # -DIRS=PoolAllocate +PARALLEL_DIRS=DSA PoolAllocate include $(LEVEL)/Makefile.common From criswell at cs.uiuc.edu Wed Dec 13 23:51:55 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 23:51:55 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/lib/DSA/BottomUpClosure.cpp CallTargets.cpp CompleteBottomUp.cpp DataStructure.cpp DataStructureAA.cpp DataStructureOpt.cpp DataStructureStats.cpp EquivClassGraphs.cpp GraphChecker.cpp Local.cpp Makefile Printer.cpp Steensgaard.cpp TopDownClosure.cpp Message-ID: <200612140551.XAA13319@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/lib/DSA: BottomUpClosure.cpp updated: 1.127 -> 1.128 CallTargets.cpp updated: 1.7 -> 1.8 CompleteBottomUp.cpp updated: 1.39 -> 1.40 DataStructure.cpp updated: 1.255 -> 1.256 DataStructureAA.cpp updated: 1.40 -> 1.41 DataStructureOpt.cpp updated: 1.14 -> 1.15 DataStructureStats.cpp updated: 1.24 -> 1.25 EquivClassGraphs.cpp updated: 1.53 -> 1.54 GraphChecker.cpp updated: 1.23 -> 1.24 Local.cpp updated: 1.163 -> 1.164 Makefile updated: 1.5 -> 1.6 Printer.cpp updated: 1.91 -> 1.92 Steensgaard.cpp updated: 1.67 -> 1.68 TopDownClosure.cpp updated: 1.95 -> 1.96 --- Log message: Merged from release_19 branch. This adds correct compilation of DSA, pool inference, and configure script fixes to mainline. --- Diffs of the changes: (+708 -62) BottomUpClosure.cpp | 14 - CallTargets.cpp | 6 CompleteBottomUp.cpp | 4 DataStructure.cpp | 249 ++++++++++++++++++++++++++ DataStructureAA.cpp | 4 DataStructureOpt.cpp | 4 DataStructureStats.cpp | 4 EquivClassGraphs.cpp | 4 GraphChecker.cpp | 4 Local.cpp | 456 ++++++++++++++++++++++++++++++++++++++++++++++--- Makefile | 4 Printer.cpp | 6 Steensgaard.cpp | 5 TopDownClosure.cpp | 6 14 files changed, 708 insertions(+), 62 deletions(-) Index: llvm-poolalloc/lib/DSA/BottomUpClosure.cpp diff -u llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.127 llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.128 --- llvm-poolalloc/lib/DSA/BottomUpClosure.cpp:1.127 Wed Dec 6 19:30:31 2006 +++ llvm-poolalloc/lib/DSA/BottomUpClosure.cpp Wed Dec 13 23:51:06 2006 @@ -15,8 +15,8 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "bu_dsa" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" #include "llvm/ADT/Statistic.h" @@ -588,11 +588,11 @@ ++NumBUInlines; } else { if (!Printed) - cerr << "In Fns: " << Graph.getFunctionNames() << "\n"; - cerr << " calls " << CalledFuncs.size() - << " fns from site: " << CS.getCallSite().getInstruction() - << " " << *CS.getCallSite().getInstruction(); - cerr << " Fns ="; + DEBUG(std::cerr << "In Fns: " << Graph.getFunctionNames() << "\n"); + DEBUG(std::cerr << " calls " << CalledFuncs.size() + << " fns from site: " << CS.getCallSite().getInstruction() + << " " << *CS.getCallSite().getInstruction()); + DEBUG(std::cerr << " Fns ="); unsigned NumPrinted = 0; for (std::vector::iterator I = CalledFuncs.begin(), Index: llvm-poolalloc/lib/DSA/CallTargets.cpp diff -u llvm-poolalloc/lib/DSA/CallTargets.cpp:1.7 llvm-poolalloc/lib/DSA/CallTargets.cpp:1.8 --- llvm-poolalloc/lib/DSA/CallTargets.cpp:1.7 Wed Dec 6 19:30:31 2006 +++ llvm-poolalloc/lib/DSA/CallTargets.cpp Wed Dec 13 23:51:06 2006 @@ -17,11 +17,11 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/CallTargets.h" #include "llvm/Module.h" #include "llvm/Instructions.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" +#include "dsa/CallTargets.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Streams.h" #include "llvm/Constants.h" Index: llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp diff -u llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.39 llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.40 --- llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp:1.39 Wed Dec 6 11:46:31 2006 +++ llvm-poolalloc/lib/DSA/CompleteBottomUp.cpp Wed Dec 13 23:51:06 2006 @@ -14,9 +14,9 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "cbudatastructure" -#include "llvm/Analysis/DataStructure/DataStructure.h" +#include "dsa/DataStructure.h" #include "llvm/Module.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DSGraph.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/Statistic.h" Index: llvm-poolalloc/lib/DSA/DataStructure.cpp diff -u llvm-poolalloc/lib/DSA/DataStructure.cpp:1.255 llvm-poolalloc/lib/DSA/DataStructure.cpp:1.256 --- llvm-poolalloc/lib/DSA/DataStructure.cpp:1.255 Thu Dec 7 14:28:15 2006 +++ llvm-poolalloc/lib/DSA/DataStructure.cpp Wed Dec 13 23:51:06 2006 @@ -1,3 +1,4 @@ +#define JTC 0 //===- DataStructure.cpp - Implement the core data structure analysis -----===// // // The LLVM Compiler Infrastructure @@ -11,7 +12,9 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DSGraphTraits.h" +#include "dsa/DSGraphTraits.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Constants.h" #include "llvm/Function.h" #include "llvm/GlobalVariable.h" @@ -26,11 +29,14 @@ #include "llvm/ADT/SCCIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Timer.h" +#include "llvm/ADT/hash_map" +#include "poolalloc/Config/config.h" + +#include #include using namespace llvm; #define COLLAPSE_ARRAYS_AGGRESSIVELY 0 - namespace { Statistic NumFolds ("dsa", "Number of nodes completely folded"); Statistic NumCallNodesMerged("dsa", "Number of call nodes merged"); @@ -38,6 +44,9 @@ Statistic NumDNE ("dsa", "Number of nodes removed by reachability"); Statistic NumTrivialDNE ("dsa", "Number of nodes trivially removed"); Statistic NumTrivialGlobalDNE("dsa", "Number of globals trivially removed"); +#ifdef LLVA_KERNEL + Statistic LostPools ("dsa", "Number of pools lost to DSNode Merge"); +#endif static cl::opt DSAFieldLimit("dsa-field-limit", cl::Hidden, cl::desc("Number of fields to track before collapsing a node"), @@ -128,6 +137,9 @@ if (T) mergeTypeInfo(T, 0); if (G) G->addNode(this); ++NumNodeAllocated; +#if JTC +std::cerr << "LLVA: Creating (1) DSNode " << this << "\n"; +#endif } // DSNode copy constructor... do not copy over the referrers list! @@ -140,6 +152,27 @@ Links.resize(N.Links.size()); // Create the appropriate number of null links G->addNode(this); ++NumNodeAllocated; +#if JTC +std::cerr << "LLVA: Creating (2) DSNode " << this << "\n"; +#endif +} + +DSNode::~DSNode() { + dropAllReferences(); + assert(hasNoReferrers() && "Referrers to dead node exist!"); + +#ifdef LLVA_KERNEL + // + // Remove all references to this node from the Pool Descriptor Map. + // +#if JTC + std::cerr << "LLVA: Removing " << this << "\n"; +#endif + if (ParentGraph) { + hash_map &pdm=ParentGraph->getPoolDescriptorsMap(); + pdm.erase (this); + } +#endif } /// getTargetData - Get the target data object used to construct this node. @@ -235,10 +268,26 @@ DestNode->Ty = Type::VoidTy; DestNode->Size = 1; DestNode->Globals.swap(Globals); + +#if JTC + std::cerr << "LLVA: foldNode: " << this << " becomes " << DestNode << "\n"; +#endif +#ifdef LLVA_KERNEL + //Again we have created a new DSNode, we need to fill in the + // pool desc map appropriately + assert(ParentGraph && "parent graph is not null \n"); + hash_map &pdm = ParentGraph->getPoolDescriptorsMap(); + if (pdm.count(this) > 0) { + pdm[DestNode] = pdm[this]; + } else { + //do nothing + } +#endif // Start forwarding to the destination node... forwardNode(DestNode, 0); + if (!Links.empty()) { DestNode->Links.reserve(1); @@ -833,7 +882,62 @@ } #endif } - +#ifdef LLVA_KERNEL + DSNode *currNode = CurNodeH.getNode(); + DSNode *NNode = NH.getNode(); + DSGraph *pGraph = currNode->getParentGraph(); + assert((pGraph == NNode->getParentGraph()) && "LLVA_KERNEL : merging nodes in two different graphs?"); + //get the pooldescriptor map + hash_map &pdm = pGraph->getPoolDescriptorsMap(); + if (pdm.count(currNode) == 0) { + if (pdm.count(NNode) == 0) { + //do nothing (common case) + } else { + if (pdm[NNode]) { +#if JTC + std::cerr << "LLVA: 1: currNode (" << currNode << ") becomes " << pdm[NNode]->getName() << "(" << NNode << ")\n"; +#endif + pdm[currNode] = pdm[NNode]; + } + } + } else { + if (pdm.count(NNode) == 0) { +#if 1 + // + // FIXME: + // Verify that this is correct. I believe it is; it seems to make sense + // since either node can be used after the merge. + // +#if JTC +std::cerr << "LLVA: MergeNodes: currnode has something, newnode has nothing\n"; + std::cerr << "LLVA: 2: currNode (" << currNode << ") becomes " << "(" << NNode << ")\n"; +#endif + pdm[NNode] = pdm[currNode]; +#endif + //do nothing + } else { + if (pdm[currNode] != pdm[NNode]) { + //The following is commented because pdm[..] could be null! + //std::cerr << "LLVA: OldPool: " << pdm[currNode]->getName() << "(" + // << pdm[currNode] << ") " + // << " NewPool: " << pdm[NNode]->getName() << "(" + // << pdm[NNode] << ")" << std::endl; + pdm[NNode]->merge(pdm[currNode]); + /* + Value *currN = pdm[currNode]->getMetaPoolValue(); + Value *NN = pdm[NNode]->getMetaPoolValue(); + if (currN != NN) { + std::cerr << "LLVA: Two Pools for one DSNode\n"; + currN->replaceAllUsesWith(NN); + pdm[currNode]->merge(pdm[NNode]); + } else { + //The nodes are same + } + */ + } + } + } +#endif // Merge the type entries of the two nodes together... if (NH.getNode()->Ty != Type::VoidTy) CurNodeH.getNode()->mergeTypeInfo(NH.getNode()->Ty, NOffset); @@ -912,6 +1016,9 @@ /// point to this node). /// void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) { +#if JTC +std::cerr << "LLVA: mergeWith: " << this << " becomes " << NH.getNode() << "\n"; +#endif DSNode *N = NH.getNode(); if (N == this && NH.getOffset() == Offset) return; // Noop @@ -991,6 +1098,21 @@ DSNode *DN = new DSNode(*SN, &Dest, true /* Null out all links */); DN->maskNodeTypes(BitsToKeep); NH = DN; +#if JTC +std::cerr << "LLVA: getClonedNH: " << SN << " becomes " << DN << "\n"; +#endif +#if 1 +#ifdef LLVA_KERNEL + //Again we have created a new DSNode, we need to fill in the + // pool desc map appropriately + hash_map &pdm = Dest.getPoolDescriptorsMap(); + if (pdm.count(SN) > 0) { + pdm[DN] = pdm[SN]; + } else { + //do nothing + } +#endif +#endif // Next, recursively clone all outgoing links as necessary. Note that // adding these links can cause the node to collapse itself at any time, and @@ -1149,7 +1271,58 @@ } } +#if JTC +std::cerr << "LLVA: mergeWith: " << SN << " becomes " << DN << "\n"; +#endif +#ifdef LLVA_KERNEL + //Here some merge is going on just like in DSNode::merge + //I think because of the inplace merging we don't update the pool desc maps + //This is modification from DSNode::MergeNodes + //Here DN and SN may belong to different graphs + DN = NH.getNode(); +#if 0 + DSGraph *destGraph = DN->getParentGraph(); + DSGraph *srcGraph = SN->getParentGraph(); +#else + DSGraph *destGraph = NH.getNode()->getParentGraph(); + DSGraph *srcGraph = SN->getParentGraph(); +#endif + if (destGraph && srcGraph) { + //get the pooldescriptor map + hash_map &destpdm = destGraph->getPoolDescriptorsMap(); + hash_map &srcpdm = srcGraph->getPoolDescriptorsMap(); + if (destpdm.count(DN) == 0) { + if (srcpdm.count(SN) == 0) { + //do nothing (common case) + } else { + if (srcpdm[SN]) { +#if JTC + std::cerr << "LLVA: DN becomes " << srcpdm[SN]->getName() << std::endl; +#endif + destpdm[DN] = srcpdm[SN]; + } + } + } else { + if (srcpdm.count(SN) == 0) { + srcpdm[SN] = destpdm[DN]; + } else { + if (destpdm[DN] != srcpdm[SN]) { + srcpdm[SN]->merge(destpdm[DN]); + /* + Value *dnv = destpdm[DN]->getMetaPoolValue(); + Value *snv = srcpdm[SN]->getMetaPoolValue(); + if (dnv != snv) { + DEBUG(std::cerr << "LLVA: Two Pools for one DSNode\n"); + dnv->replaceAllUsesWith(snv); + destpdm[DN]->setMetaPoolValue(snv); + } + */ + } + } + } + } +#endif // Next, recursively merge all outgoing links as necessary. Note that // adding these links can cause the destination node to collapse itself at // any time, and the current node may be merged with arbitrary other nodes. @@ -1218,6 +1391,53 @@ NH = RC.getClonedNH(Src); } +#ifdef LLVA_KERNEL +// MetaPoolHandle Implementation + //The following should go in a cpp file later + MetaPoolHandle::MetaPoolHandle(MetaPool *mp, Instruction * Maker) { + Rep = mp; + Rep->insert(this); + Creator = Maker; + } + const std::string& MetaPoolHandle::getName() { + assert(Rep != 0 && "Null meta pool ??\n"); + return Rep->getName(); + } + Value *MetaPoolHandle::getMetaPoolValue() { + assert(Rep != 0 && "Null meta pool ??\n"); + return Rep->getMetaPoolValue(); + } + void MetaPoolHandle::merge(MetaPoolHandle *other) { + //after this operation other points to what this points to . + //first replace all uses + Value *dest = getMetaPoolValue(); + Value *curr = other->getMetaPoolValue(); + if (dest != curr) { + std::cerr << "LLVA: Merging metapools: " << this->Creator->getParent()->getParent()->getName() << " : " << other->Creator->getParent()->getParent()->getName() << "\n" + << "LLVA: " << *(this->Creator) << "\n" + << "LLVA: " << *(other->Creator) << "\n"; + curr->replaceAllUsesWith(dest); + } + + //merge the hash sets in to other + hash_set &otherHandleSet = other->getMetaPool()->getHandleSet(); + hash_set::iterator ohsI = otherHandleSet.begin(), ohsE = otherHandleSet.end(); + for (; ohsI != ohsE; ++ohsI) { + MetaPoolHandle *omph = *ohsI; + //now make sure that this omph points to what we point to + omph->setMetaPool(Rep); + Rep->insert(omph); + } + + //now delete others MetaPool + //gd delete other->getMetaPool(); + + //Assign our metapool to other + other->setMetaPool(Rep); +} + +#endif + //===----------------------------------------------------------------------===// // DSGraph Implementation //===----------------------------------------------------------------------===// @@ -1239,7 +1459,7 @@ } -DSGraph::DSGraph(const DSGraph &G, EquivalenceClasses &ECs, +DSGraph::DSGraph(DSGraph &G, EquivalenceClasses &ECs, unsigned CloneFlags) : GlobalsGraph(0), ScalarMap(ECs), TD(G.TD) { PrintAuxCalls = false; @@ -1251,7 +1471,9 @@ AuxFunctionCalls.clear(); ScalarMap.clear(); ReturnNodes.clear(); - +#ifdef LLVA_KERNEL + PoolDescriptors.clear(); +#endif // Drop all intra-node references, so that assertions don't fail... for (node_iterator NI = node_begin(), E = node_end(); NI != E; ++NI) NI->dropAllReferences(); @@ -1309,7 +1531,7 @@ /// /// The CloneFlags member controls various aspects of the cloning process. /// -void DSGraph::cloneInto(const DSGraph &G, unsigned CloneFlags) { +void DSGraph::cloneInto( DSGraph &G, unsigned CloneFlags) { TIME_REGION(X, "cloneInto"); assert(&G != this && "Cannot clone graph into itself!"); @@ -1327,6 +1549,10 @@ DSNode *New = new DSNode(*I, this); New->maskNodeTypes(~BitsToClear); OldNodeMap[I] = New; +#ifdef LLVA_KERNEL + if (G.getPoolForNode(&*I)) + PoolDescriptors[New] = G.getPoolForNode(&*I); +#endif } #ifndef NDEBUG @@ -1404,6 +1630,17 @@ // Merge the scalar map in. ScalarMap.spliceFrom(RHS.ScalarMap); + +#ifdef LLVA_KERNEL + //Take all from the pooldescriptor map +#if 0 + PoolDescriptors.swap(RHS.getPoolDescriptorsMap()); +#else + hash_map& rhsmap = RHS.getPoolDescriptorsMap(); + PoolDescriptors.insert(rhsmap.begin(), rhsmap.end()); +#endif + RHS.getPoolDescriptorsMap().clear(); +#endif } /// spliceFrom - Copy all entries from RHS, then clear RHS. Index: llvm-poolalloc/lib/DSA/DataStructureAA.cpp diff -u llvm-poolalloc/lib/DSA/DataStructureAA.cpp:1.40 llvm-poolalloc/lib/DSA/DataStructureAA.cpp:1.41 --- llvm-poolalloc/lib/DSA/DataStructureAA.cpp:1.40 Sun Aug 27 19:42:29 2006 +++ llvm-poolalloc/lib/DSA/DataStructureAA.cpp Wed Dec 13 23:51:06 2006 @@ -17,8 +17,8 @@ #include "llvm/Module.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/Passes.h" -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" using namespace llvm; namespace { Index: llvm-poolalloc/lib/DSA/DataStructureOpt.cpp diff -u llvm-poolalloc/lib/DSA/DataStructureOpt.cpp:1.14 llvm-poolalloc/lib/DSA/DataStructureOpt.cpp:1.15 --- llvm-poolalloc/lib/DSA/DataStructureOpt.cpp:1.14 Wed Dec 6 11:46:31 2006 +++ llvm-poolalloc/lib/DSA/DataStructureOpt.cpp Wed Dec 13 23:51:06 2006 @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Analysis/Passes.h" #include "llvm/Module.h" #include "llvm/Constant.h" Index: llvm-poolalloc/lib/DSA/DataStructureStats.cpp diff -u llvm-poolalloc/lib/DSA/DataStructureStats.cpp:1.24 llvm-poolalloc/lib/DSA/DataStructureStats.cpp:1.25 --- llvm-poolalloc/lib/DSA/DataStructureStats.cpp:1.24 Wed Dec 6 19:30:31 2006 +++ llvm-poolalloc/lib/DSA/DataStructureStats.cpp Wed Dec 13 23:51:06 2006 @@ -11,8 +11,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/Pass.h" Index: llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp diff -u llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp:1.53 llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp:1.54 --- llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp:1.53 Wed Dec 6 19:30:31 2006 +++ llvm-poolalloc/lib/DSA/EquivClassGraphs.cpp Wed Dec 13 23:51:06 2006 @@ -15,11 +15,11 @@ //===----------------------------------------------------------------------===// #define DEBUG_TYPE "ECGraphs" -#include "llvm/Analysis/DataStructure/DataStructure.h" +#include "dsa/DataStructure.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" #include "llvm/Pass.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DSGraph.h" #include "llvm/Support/CallSite.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/SCCIterator.h" Index: llvm-poolalloc/lib/DSA/GraphChecker.cpp diff -u llvm-poolalloc/lib/DSA/GraphChecker.cpp:1.23 llvm-poolalloc/lib/DSA/GraphChecker.cpp:1.24 --- llvm-poolalloc/lib/DSA/GraphChecker.cpp:1.23 Wed Dec 6 19:30:31 2006 +++ llvm-poolalloc/lib/DSA/GraphChecker.cpp Wed Dec 13 23:51:06 2006 @@ -23,8 +23,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Streams.h" #include "llvm/Value.h" Index: llvm-poolalloc/lib/DSA/Local.cpp diff -u llvm-poolalloc/lib/DSA/Local.cpp:1.163 llvm-poolalloc/lib/DSA/Local.cpp:1.164 --- llvm-poolalloc/lib/DSA/Local.cpp:1.163 Wed Dec 6 19:30:31 2006 +++ llvm-poolalloc/lib/DSA/Local.cpp Wed Dec 13 23:51:06 2006 @@ -1,3 +1,4 @@ +#define JTC 0 //===- Local.cpp - Compute a local data structure graph for a function ----===// // // The LLVM Compiler Infrastructure @@ -12,8 +13,9 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "llvm/ADT/Statistic.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/Instructions.h" @@ -24,6 +26,8 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Timer.h" +#include "poolalloc/Config/config.h" +#include // FIXME: This should eventually be a FunctionPass that is automatically // aggregated into a Pass. @@ -32,6 +36,12 @@ using namespace llvm; +#ifdef LLVA_KERNEL +static Statistic CacheAllocs ("dsa", "Number of kmem_cache_alloc calls"); +static Statistic KMallocs ("dsa", "Number of kmalloc calls"); +static Statistic GlobalPools ("dsa", "Number of global pools"); +#endif + static RegisterPass X("datastructure", "Local Data Structure Analysis"); @@ -90,27 +100,59 @@ DSNodeHandle *RetNode; // Node that gets returned... DSScalarMap &ScalarMap; std::list *FunctionCalls; - + Value * KMallocPool; public: GraphBuilder(Function &f, DSGraph &g, DSNodeHandle &retNode, std::list &fc) : G(g), RetNode(&retNode), ScalarMap(G.getScalarMap()), FunctionCalls(&fc) { - + // Find the type unsafe pool in the program + KMallocPool = f.getParent()->getNamedGlobal ("KmallocPool"); + +#if 1 + // + // Determine if the function somehow escapes + // + bool escapes = false; + if (!(f.hasInternalLinkage())) { + escapes = true; + } + Value::use_iterator U; + for (U=f.use_begin(); U != f.use_end(); ++U) { + if (isa(U)) { + std::cerr << "LLVA: isa: " << f.getName() << " " << *U << std::endl; + escapes = true; + break; + } + } +#endif // Create scalar nodes for all pointer arguments... for (Function::arg_iterator I = f.arg_begin(), E = f.arg_end(); - I != E; ++I) - if (isPointerType(I->getType())) - getValueDest(*I); + I != E; ++I) { + if (isPointerType(I->getType())) { + DSNode * Node = getValueDest(*I).getNode(); + if (!(f.hasInternalLinkage())) { + Node->setExternalMarker(); + } + } + } visit(f); // Single pass over the function +#if JTC +std::cerr << "LLVA: Function " << f.getName() << "\n"; + for (DSScalarMap::iterator I = ScalarMap.begin(), E=ScalarMap.end(); + I != E; + ++I) + { + std::cerr << "LLVA:\t" << I->first->getName() << ": " << (void *)(I->second.getNode()) << "\n"; + } +#endif } // GraphBuilder ctor for working on the globals graph GraphBuilder(DSGraph &g) : G(g), RetNode(0), ScalarMap(G.getScalarMap()), FunctionCalls(0) { } - void mergeInGlobalInitializer(GlobalVariable *GV); private: @@ -345,6 +387,26 @@ void GraphBuilder::visitGetElementPtrInst(User &GEP) { + +#ifdef LLVA_KERNEL +#if 1 + int debug = 0; + if (isa(GEP)) { + Instruction * IGEP = (Instruction *)(&GEP); + if (IGEP->getParent()->getParent()->getName() == "alloc_vfsmnt") + { +#if 0 + if (G.getPoolDescriptorsMap().count(N) != 0) + if (G.getPoolDescriptorsMap()[N]) + std::cerr << "LLVA: GEP[" << count << "]: Pool for " << GEP.getName() << " is " << G.getPoolDescriptorsMap()[N]->getMetaPoolValue()->getName() << "\n"; +#else + debug = 1; +#endif + } + } +#endif +#endif + DSNodeHandle Value = getValueDest(*GEP.getOperand(0)); if (Value.isNull()) Value = createNode(); @@ -364,6 +426,11 @@ if (AllZeros || (!Value.isNull() && Value.getNode()->isNodeCompletelyFolded())) { setDestTo(GEP, Value); +#if 0 +if (debug) std::cerr << "LLVA: GEP: All Zeros\n"; + if (G.getPoolDescriptorsMap()[Value.getNode()]) + std::cerr << "LLVA: GEP: Pool for " << GEP.getName() << " is " << G.getPoolDescriptorsMap()[Value.getNode()]->getName() << "\n"; +#endif return; } @@ -374,6 +441,7 @@ if (Value.getNode()->mergeTypeInfo(CurTy, Value.getOffset())) { // If the node had to be folded... exit quickly setDestTo(GEP, Value); // GEP result points to folded node + return; } @@ -472,9 +540,22 @@ N->foldNodeCompletely(); } } - + // Value is now the pointer we want to GEP to be... setDestTo(GEP, Value); +#if 0 + if (debug && (isa(GEP))) { + Instruction * IGEP = (Instruction *)(&GEP); + DSNode * N = Value.getNode(); + if (IGEP->getParent()->getParent()->getName() == "alloc_vfsmnt") + { + if (G.getPoolDescriptorsMap().count(N) != 0) + if (G.getPoolDescriptorsMap()[N]) + std::cerr << "LLVA: GEP[" << 0 << "]: Pool for " << GEP.getName() << " is " << G.getPoolDescriptorsMap()[N]->getName() << "\n"; + } + } +#endif + } void GraphBuilder::visitLoadInst(LoadInst &LI) { @@ -490,6 +571,10 @@ if (isPointerType(LI.getType())) setDestTo(LI, getLink(Ptr)); +#if 0 + if (G.getPoolDescriptorsMap()[getLink(Ptr).getNode()]) + std::cerr << "LLVA: Load: Pool for " << LI.getName() << " is " << G.getPoolDescriptorsMap()[getLink(Ptr).getNode()]->getName() << "\n"; +#endif } void GraphBuilder::visitStoreInst(StoreInst &SI) { @@ -506,6 +591,18 @@ // Avoid adding edges from null, or processing non-"pointer" stores if (isPointerType(StoredTy)) Dest.addEdgeTo(getValueDest(*SI.getOperand(0))); +#ifdef LLVA_KERNEL +#if 1 + { + if (SI.getParent()->getParent()->getName() == "alloc_vfsmnt") { + DSNode * N = getValueDest(*SI.getOperand(1)).getNode(); + if (G.getPoolDescriptorsMap().count(N) != 0) + if (G.getPoolDescriptorsMap()[N]) + std::cerr << "LLVA: Store: Pool for " << SI.getName() << " is " << G.getPoolDescriptorsMap()[N]->getName() << "\n"; + } + } +#endif +#endif } void GraphBuilder::visitReturnInst(ReturnInst &RI) { @@ -1004,7 +1101,155 @@ if (DSNode *N = getValueDest(**(CS.arg_begin() + 1)).getNode()) N->setReadMarker(); return true; +#ifdef LLVA_KERNEL_0 + } else if (F->getName() == "kmem_cache_alloc") { + DEBUG(std::cerr << "LLVA: kmem_cache_alloc" << std::endl); + // Update the statistics count + ++CacheAllocs; + + // Create a new DSNode for this memory allocation + DSNode *N = createNode(); + N->setHeapNodeMarker(); + setDestTo(*CS.getInstruction(), N); + + // Get the pool handle + if (CS.arg_begin() == CS.arg_end()) { + abort(); //Hanlde this later + // Treat it as a kmalloc + N->foldNodeCompletely(); + //This becomes a kmalloc pool + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(KMallocPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } else { + Value *actualPD = *(CS.arg_begin()); + if (!isa(actualPD)) { + std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n"; + } else { + ++GlobalPools; + } + Value *TheMetaPool = actualPD; + if (G.getPoolDescriptorsMap().count(N)== 0) { + //Here we insert a global meta pool + //Get the Module first + Module * M = F->getParent(); + //Now create a meta pool for this value, DSN Node + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + TheMetaPool = new GlobalVariable( + /*type=*/ VoidPtrType, + /*isConstant=*/ false, + /*Linkage=*/ GlobalValue::InternalLinkage, + /*initializer=*/ Constant::getNullValue(VoidPtrType), + /*name=*/ "_metaPool_", + /*parent=*/ M ); + //Inserted a global meta pool + } + //Now insert a function call that takes care of adding this pool to the global pool + + //First get the Insert point + Instruction *InsertPoint = CS.getInstruction(); + + //Assumes AddPoolDescToMetaPool is in the module + CastInst *CastMetaPool = + CastInst::createPointerCast (TheMetaPool, + PointerType::get(Type::SByteTy), "metapool.casted", InsertPoint); + CastInst *CastActualPD = + CastInst::createPointerCast (actualPD, + PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint); + + // Create the call to AddPoolDescToMetaPool + std::vector args(1,CastMetaPool); + args.push_back(CastActualPD); + new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint); + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } + } else if (F->getName() == "poolalloc") { + if (CS.getCaller()->getName() == "kmem_cache_alloc") + return; + // Update the statistics + ++KMallocs; + + // Create a DSNode for the memory allocated by this function call + DSNode *N = createNode(); + N->setHeapNodeMarker(); + setDestTo(*CS.getInstruction(), N); + + // Get the pool handle, if possible + if (CS.arg_begin() == CS.arg_end()) { + abort(); //handle later + // Treat it as kmalloc + N->foldNodeCompletely(); + //This becomes a kmalloc pool + //So get the kmalloc pool + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(KMallocPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } else { + Value *actualPD = *(CS.arg_begin()); + if (!isa(actualPD)) { + std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n"; + } else { + ++GlobalPools; + } + Value *TheMetaPool = actualPD; + if (G.getPoolDescriptorsMap().count(N)== 0) { + //Here we insert a global meta pool + //Get the Module first + Module * M = F->getParent(); + //Now create a meta pool for this value, DSN Node + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + TheMetaPool = new GlobalVariable( + /*type=*/ VoidPtrType, + /*isConstant=*/ false, + /*Linkage=*/ GlobalValue::InternalLinkage, + /*initializer=*/ Constant::getNullValue(VoidPtrType), + /*name=*/ "_metaPool_", + /*parent=*/ M ); + //Inserted a global meta pool + } + //Now insert a function call that takes care of adding this pool to the global pool + //First get the Insert point + Instruction *InsertPoint = CS.getInstruction(); + + //Assumes AddPoolDescToMetaPool is in the module + CastInst *CastMetaPool = + CastInst::createPointerCast (TheMetaPool, + PointerType::get(Type::SByteTy), "metapool.casted", InsertPoint); + CastInst *CastActualPD = + CastInst::createPointerCast (actualPD, + PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint); + + // Create the call to AddPoolDescToMetaPool + std::vector args(1,CastMetaPool); + args.push_back(CastActualPD); + new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint); + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } +#endif +#ifdef LLVA_KERNEL + } else if (F->getName() == "llva_memcpy") { + if (CS.getCaller()->getName() == "kmem_cache_alloc") + return false; + // Merge the first & second arguments, and mark the memory read and + // modified. + DSNodeHandle RetNH = getValueDest(**CS.arg_begin()); + RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1))); + if (DSNode *N = RetNH.getNode()) + N->setModifiedMarker()->setReadMarker(); + return true; + } else if (F->getName() == "__generic_copy_from_user") { + if (CS.getCaller()->getName() == "kmem_cache_alloc") + return false; + // Merge the first & second arguments, and mark the memory read and + // modified. + DSNodeHandle RetNH = getValueDest(**CS.arg_begin()); + RetNH.mergeWith(getValueDest(**(CS.arg_begin()+1))); + if (DSNode *N = RetNH.getNode()) + N->setModifiedMarker()->setReadMarker(); + return true; +#endif } + return false; } @@ -1012,29 +1257,192 @@ Value *Callee = CS.getCalledValue(); // Special case handling of certain libc allocation functions here. - if (Function *F = dyn_cast(Callee)) + if (Function *F = dyn_cast(Callee)) { +#ifdef LLVA_KERNEL + if (F->getName() == "kmem_cache_alloc") { + DEBUG(std::cerr << "LLVA: kmem_cache_alloc" << std::endl); + // Update the statistics count + ++CacheAllocs; + + // Create a new DSNode for this memory allocation + DSNode *N = createNode(); + N->setHeapNodeMarker(); + setDestTo(*CS.getInstruction(), N); + + // Get the pool handle + if (CS.arg_begin() == CS.arg_end()) { + abort(); //Handle this later + // Treat it as a kmalloc + N->foldNodeCompletely(); + //This becomes a kmalloc pool + MetaPoolHandle* mpvh = new MetaPoolHandle(new MetaPool(KMallocPool)); + G.getPoolDescriptorsMap()[N] = mpvh; + } else { + Value *actualPD = *(CS.arg_begin()); + if (!isa(actualPD)) { + std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n"; + } else { + ++GlobalPools; + } + Value *TheMetaPool = actualPD; + //Get the Module first + Module * M = F->getParent(); + if (G.getPoolDescriptorsMap().count(N)== 0) { + //Here we insert a global meta pool + //Now create a meta pool for this value, DSN Node + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + TheMetaPool = new GlobalVariable( + /*type=*/ VoidPtrType, + /*isConstant=*/ false, + /*Linkage=*/ GlobalValue::InternalLinkage, + /*initializer=*/ Constant::getNullValue(VoidPtrType), + /*name=*/ "_metaPool_", + /*parent=*/ M ); + //Inserted a global meta pool + } +#if 1 + else { + // Lookup the meta pool + TheMetaPool = G.getPoolForNode(N)->getMetaPoolValue(); + } +#endif + //Now insert a function call that takes care of adding this pool to the global pool + + //First get the Insert point + Instruction *InsertPoint = CS.getInstruction(); + + //Assumes AddPoolDescToMetaPool is in the module + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + const Type * VoidPtrPtrType = PointerType::get(VoidPtrType); + CastInst *CastMetaPool = + CastInst::createPointerCast (TheMetaPool, + VoidPtrPtrType, "metapool.casted", InsertPoint); + CastInst *CastActualPD = + CastInst::createPointerCast (actualPD, + PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint); + + // Create the call to AddPoolDescToMetaPool + std::vector args(1,CastMetaPool); + args.push_back(CastActualPD); + + //Get the AddPoolDescToMetaPool function from the module + //FIXME optimize it by getting it once per module + std::vector Arg(1, VoidPtrPtrType); + Arg.push_back(VoidPtrType); + FunctionType *AddPoolDescToMetaPoolTy = + FunctionType::get(Type::VoidTy,Arg, false); + Function *AddPoolDescToMetaPool = M->getOrInsertFunction("AddPoolDescToMetaPool", AddPoolDescToMetaPoolTy); + + + new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint); +#if 0 + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool)); +#else + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool), CS.getInstruction()); +#endif + G.getPoolDescriptorsMap()[N] = tmpvh; + } + return; + } else if (F->getName() == "poolalloc") { + if (CS.getCaller()->getName() == "kmem_cache_alloc") + return; + // Update the statistics + ++KMallocs; + + // Create a DSNode for the memory allocated by this function call + DSNode *N = createNode(); + N->setHeapNodeMarker(); + setDestTo(*CS.getInstruction(), N); + + // Get the pool handle, if possible + if (CS.arg_begin() == CS.arg_end()) { + abort() ; //Handle this later + // Treat it as kmalloc + N->foldNodeCompletely(); + //This becomes a kmalloc pool + //So get the kmalloc pool + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(KMallocPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } else { + Value *actualPD = *(CS.arg_begin()); + if (!isa(actualPD)) { + std::cerr << "WARNING: Pool is not global. Function = " << CS.getCaller()->getName() << "\n"; + } else { + ++GlobalPools; + } + Value *TheMetaPool = actualPD; + Module * M = F->getParent(); + if (G.getPoolDescriptorsMap().count(N)== 0) { + //Here we insert a global meta pool + //Get the Module first + //Now create a meta pool for this value, DSN Node + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + TheMetaPool = new GlobalVariable( + /*type=*/ VoidPtrType, + /*isConstant=*/ false, + /*Linkage=*/ GlobalValue::InternalLinkage, + /*initializer=*/ Constant::getNullValue(VoidPtrType), + /*name=*/ "_metaPool_", + /*parent=*/ M ); + //Inserted a global meta pool + } + //Now insert a function call that takes care of adding this pool to the global pool + //First get the Insert point + Instruction *InsertPoint = CS.getInstruction(); + + //Assumes AddPoolDescToMetaPool is in the module + const Type * VoidPtrType = PointerType::get(Type::SByteTy); + const Type * VoidPtrPtrType = PointerType::get(VoidPtrType); + CastInst *CastMetaPool = + CastInst::createPointerCast (TheMetaPool, + VoidPtrPtrType, "metapool.casted", InsertPoint); + CastInst *CastActualPD = + CastInst::createPointerCast (actualPD, + PointerType::get(Type::SByteTy), "poolhandle.lscasted", InsertPoint); + + // Create the call to AddPoolDescToMetaPool + std::vector args(1,CastMetaPool); + args.push_back(CastActualPD); + + //FIXME optimize it by getting it once per module + std::vector Arg(1, VoidPtrPtrType); + Arg.push_back(VoidPtrType); + FunctionType *AddPoolDescToMetaPoolTy = + FunctionType::get(Type::VoidTy,Arg, false); + Function *AddPoolDescToMetaPool = M->getOrInsertFunction("AddPoolDescToMetaPool", AddPoolDescToMetaPoolTy); + + new CallInst(AddPoolDescToMetaPool,args,"", InsertPoint); + MetaPoolHandle* tmpvh = new MetaPoolHandle(new MetaPool(TheMetaPool)); + G.getPoolDescriptorsMap()[N] = tmpvh; + } + return; + } +#endif if (F->isExternal()) if (F->isIntrinsic() && visitIntrinsic(CS, F)) return; else { // Determine if the called function is one of the specified heap // allocation functions - if (AllocList.end() != std::find(AllocList.begin(), AllocList.end(), F->getName())) { - setDestTo(*CS.getInstruction(), - createNode()->setHeapNodeMarker()->setModifiedMarker()); - return; - } + if (AllocList.end() != std::find(AllocList.begin(), AllocList.end(), F->getName())) { + setDestTo(*CS.getInstruction(), + createNode()->setHeapNodeMarker()->setModifiedMarker()); + return; + } // Determine if the called function is one of the specified heap // free functions - if (FreeList.end() != std::find(FreeList.begin(), FreeList.end(), F->getName())) { - // Mark that the node is written to... - if (DSNode *N = getValueDest(*(CS.getArgument(0))).getNode()) - N->setModifiedMarker()->setHeapNodeMarker(); - return; - } - if (visitExternal(CS,F)) - return; + if (FreeList.end() != std::find(FreeList.begin(), FreeList.end(), + F->getName())) { + // Mark that the node is written to... + if (DSNode *N = getValueDest(*(CS.getArgument(0))).getNode()) + N->setModifiedMarker()->setHeapNodeMarker(); + return; + } + + if (visitExternal(CS,F)) + return; + // Unknown function, warn if it returns a pointer type or takes a // pointer argument. bool Warn = isPointerType(CS.getInstruction()->getType()); @@ -1050,6 +1458,7 @@ << F->getName() << "' will cause pessimistic results!\n"; } } + } // Set up the return value... DSNodeHandle RetVal; @@ -1294,7 +1703,6 @@ if (!I->isExternal()) DSInfo.insert(std::make_pair(I, new DSGraph(GlobalECs, TD, *I, GlobalsGraph))); - GlobalsGraph->removeTriviallyDeadNodes(); GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs); Index: llvm-poolalloc/lib/DSA/Makefile diff -u llvm-poolalloc/lib/DSA/Makefile:1.5 llvm-poolalloc/lib/DSA/Makefile:1.6 --- llvm-poolalloc/lib/DSA/Makefile:1.5 Sun Oct 23 20:08:20 2005 +++ llvm-poolalloc/lib/DSA/Makefile Wed Dec 13 23:51:06 2006 @@ -1,4 +1,4 @@ -##===- lib/Analysis/DataStructure/Makefile -----------------*- Makefile -*-===## +##===- lib/DSA/Makefile ------------------------------------*- Makefile -*-===## # # The LLVM Compiler Infrastructure # @@ -7,7 +7,7 @@ # ##===----------------------------------------------------------------------===## -LEVEL = ../../.. +LEVEL = ../.. LIBRARYNAME = LLVMDataStructure include $(LEVEL)/Makefile.common Index: llvm-poolalloc/lib/DSA/Printer.cpp diff -u llvm-poolalloc/lib/DSA/Printer.cpp:1.91 llvm-poolalloc/lib/DSA/Printer.cpp:1.92 --- llvm-poolalloc/lib/DSA/Printer.cpp:1.91 Wed Dec 6 19:30:31 2006 +++ llvm-poolalloc/lib/DSA/Printer.cpp Wed Dec 13 23:51:06 2006 @@ -11,9 +11,9 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" -#include "llvm/Analysis/DataStructure/DSGraphTraits.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" +#include "dsa/DSGraphTraits.h" #include "llvm/Module.h" #include "llvm/Constants.h" #include "llvm/Assembly/Writer.h" Index: llvm-poolalloc/lib/DSA/Steensgaard.cpp diff -u llvm-poolalloc/lib/DSA/Steensgaard.cpp:1.67 llvm-poolalloc/lib/DSA/Steensgaard.cpp:1.68 --- llvm-poolalloc/lib/DSA/Steensgaard.cpp:1.67 Wed Dec 6 19:30:31 2006 +++ llvm-poolalloc/lib/DSA/Steensgaard.cpp Wed Dec 13 23:51:06 2006 @@ -14,8 +14,8 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Analysis/DataStructure/DataStructure.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DataStructure.h" +#include "dsa/DSGraph.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/Passes.h" #include "llvm/Module.h" @@ -28,6 +28,7 @@ DSGraph *ResultGraph; EquivalenceClasses GlobalECs; // Always empty + PoolDescriptorMapType PoolDescriptors; public: Steens() : ResultGraph(0) {} ~Steens() { Index: llvm-poolalloc/lib/DSA/TopDownClosure.cpp diff -u llvm-poolalloc/lib/DSA/TopDownClosure.cpp:1.95 llvm-poolalloc/lib/DSA/TopDownClosure.cpp:1.96 --- llvm-poolalloc/lib/DSA/TopDownClosure.cpp:1.95 Wed Dec 6 11:46:31 2006 +++ llvm-poolalloc/lib/DSA/TopDownClosure.cpp Wed Dec 13 23:51:06 2006 @@ -14,10 +14,11 @@ // //===----------------------------------------------------------------------===// #define DEBUG_TYPE "td_dsa" -#include "llvm/Analysis/DataStructure/DataStructure.h" + +#include "dsa/DataStructure.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" -#include "llvm/Analysis/DataStructure/DSGraph.h" +#include "dsa/DSGraph.h" #include "llvm/Support/Debug.h" #include "llvm/Support/Timer.h" #include "llvm/ADT/Statistic.h" @@ -372,7 +373,6 @@ } else { // Otherwise, create a new DSGraph to represent this. IndCallGraph = new DSGraph(DSG.getGlobalECs(), DSG.getTargetData()); - // Make a nullary dummy call site, which will eventually get some content // merged into it. The actual callee function doesn't matter here, so we // just pass it something to keep the ctor happy. From criswell at cs.uiuc.edu Wed Dec 13 23:51:56 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 13 Dec 2006 23:51:56 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/autoconf/AutoRegen.sh aclocal.m4 configure.ac Message-ID: <200612140551.XAA13335@choi.cs.uiuc.edu> Changes in directory llvm-poolalloc/autoconf: AutoRegen.sh updated: 1.1 -> 1.2 aclocal.m4 updated: 1.5 -> 1.6 configure.ac updated: 1.10 -> 1.11 --- Log message: Merged from release_19 branch. This adds correct compilation of DSA, pool inference, and configure script fixes to mainline. --- Diffs of the changes: (+148 -6168) AutoRegen.sh | 52 aclocal.m4 | 6186 ----------------------------------------------------------- configure.ac | 78 3 files changed, 148 insertions(+), 6168 deletions(-) Index: llvm-poolalloc/autoconf/AutoRegen.sh diff -u /dev/null llvm-poolalloc/autoconf/AutoRegen.sh:1.2 --- /dev/null Wed Dec 13 23:51:16 2006 +++ llvm-poolalloc/autoconf/AutoRegen.sh Wed Dec 13 23:51:05 2006 @@ -0,0 +1,52 @@ +#!/bin/sh +die () { + echo "$@" 1>&2 + exit 1 +} +test -d autoconf && test -f autoconf/configure.ac && cd autoconf +test -f configure.ac || die "Can't find 'autoconf' dir; please cd into it first" +autoconf --version | egrep '2\.5[0-9]' > /dev/null +if test $? -ne 0 ; then + die "Your autoconf was not detected as being 2.5x" +fi +cwd=`pwd` +if test -d ../../../autoconf/m4 ; then + cd ../../../autoconf/m4 + llvm_m4=`pwd` + llvm_src_root='`(cd ../..; pwd)`' + llvm_obj_root='`(cd ../..; pwd)`' + cd $cwd +elif test -d ../../llvm/autoconf/m4 ; then + cd ../../llvm/autoconf/m4 + llvm_m4=`pwd` + llvm_src_root='`(cd ../..; pwd)`' + llvm_obj_root='`(cd ../..; pwd)`' + cd $cwd +else + while true ; do + echo "LLVM source root not found." + read -p "Enter full path to LLVM source:" + if test -d "$REPLY/autoconf/m4" ; then + llvm_src_root="$REPLY" + llvm_m4="$REPLY/autoconf/m4" + read -p "Enter full path to LLVM objects (empty for same as source):" + if test -d "$REPLY" ; then + llvm_obj_root="$REPLY" + else + llvm_obj_root="$llvm_src_root" + fi + break + fi + done +fi +# Patch the LLVM_ROOT in configure.ac, if it needs it +cp configure.ac configure.bak +#sed -e "s#^LLVM_SRC_ROOT=.*#LLVM_SRC_ROOT=\"$llvm_src_root\"#" \ +# -e "s#^LLVM_OBJ_ROOT=.*#LLVM_OBJ_ROOT=\"$llvm_obj_root\"#" configure.bak > configure.ac +echo "Regenerating aclocal.m4 with aclocal" +rm -f aclocal.m4 +aclocal -I $llvm_m4 -I "$llvm_m4/.." || die "aclocal failed" +echo "Regenerating configure with autoconf 2.5x" +autoconf --warnings=all -o ../configure configure.ac || die "autoconf failed" +cd .. +exit 0 Index: llvm-poolalloc/autoconf/aclocal.m4 diff -u llvm-poolalloc/autoconf/aclocal.m4:1.5 llvm-poolalloc/autoconf/aclocal.m4:1.6 --- llvm-poolalloc/autoconf/aclocal.m4:1.5 Wed May 18 14:56:21 2005 +++ llvm-poolalloc/autoconf/aclocal.m4 Wed Dec 13 23:51:05 2006 @@ -1,6136 +1,64 @@ -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -## Copyright 1996, 1997, 1998, 1999, 2000, 2001 -## Free Software Foundation, Inc. -## Originally by Gordon Matzigkeit , 1996 -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. -## -## This program is distributed in the hope that it will be useful, but -## WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -## General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program; if not, write to the Free Software -## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -## -## As a special exception to the GNU General Public License, if you -## distribute this file as part of a program that contains a -## configuration script generated by Autoconf, you may include it under -## the same distribution terms that you use for the rest of that program. +# generated automatically by aclocal 1.9.2 -*- Autoconf -*- -# serial 47 AC_PROG_LIBTOOL - - -# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) -# ----------------------------------------------------------- -# If this macro is not defined by Autoconf, define it here. -m4_ifdef([AC_PROVIDE_IFELSE], - [], - [m4_define([AC_PROVIDE_IFELSE], - [m4_ifdef([AC_PROVIDE_$1], - [$2], [$3])])]) - - -# AC_PROG_LIBTOOL -# --------------- -AC_DEFUN([AC_PROG_LIBTOOL], -[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl -dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX -dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. - AC_PROVIDE_IFELSE([AC_PROG_CXX], - [AC_LIBTOOL_CXX], - [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX - ])]) -dnl And a similar setup for Fortran 77 support - AC_PROVIDE_IFELSE([AC_PROG_F77], - [AC_LIBTOOL_F77], - [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 -])]) - -dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. -dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run -dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. - AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], - [AC_LIBTOOL_GCJ], - [ifdef([AC_PROG_GCJ], - [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([A][M_PROG_GCJ], - [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) - ifdef([LT_AC_PROG_GCJ], - [define([LT_AC_PROG_GCJ], - defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) -])])# AC_PROG_LIBTOOL - - -# _AC_PROG_LIBTOOL -# ---------------- -AC_DEFUN([_AC_PROG_LIBTOOL], -[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl -AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl -AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl -AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/mklib' -AC_SUBST(LIBTOOL)dnl - -# Prevent multiple expansion -define([AC_PROG_LIBTOOL], []) -])# _AC_PROG_LIBTOOL - - -# AC_LIBTOOL_SETUP -# ---------------- -AC_DEFUN([AC_LIBTOOL_SETUP], -[AC_PREREQ(2.50)dnl -AC_REQUIRE([AC_ENABLE_SHARED])dnl -AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_LD])dnl -AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl -AC_REQUIRE([AC_PROG_NM])dnl - -AC_REQUIRE([AC_PROG_LN_S])dnl -AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl -# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! -AC_REQUIRE([AC_OBJEXT])dnl -AC_REQUIRE([AC_EXEEXT])dnl -dnl - -AC_LIBTOOL_SYS_MAX_CMD_LEN -AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -AC_LIBTOOL_OBJDIR - -AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -_LT_AC_PROG_ECHO_BACKSLASH - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='sed -e s/^X//' -[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] - -# Same as above, but do not quote variable references. -[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -# Constants: -rm="rm -f" - -# Global variables: -default_ofile=mklib -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except M$VC, -# which needs '.lib'). -libext=a -ltmain="$ac_aux_dir/ltmain.sh" -ofile="$default_ofile" -with_gnu_ld="$lt_cv_prog_gnu_ld" - -AC_CHECK_TOOL(AR, ar, false) -AC_CHECK_TOOL(RANLIB, ranlib, :) -AC_CHECK_TOOL(STRIP, strip, :) - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -test -z "$AS" && AS=as -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$DLLTOOL" && DLLTOOL=dlltool -test -z "$LD" && LD=ld -test -z "$LN_S" && LN_S="ln -s" -test -z "$MAGIC_CMD" && MAGIC_CMD=file -test -z "$NM" && NM=nm -test -z "$SED" && SED=sed -test -z "$OBJDUMP" && OBJDUMP=objdump -test -z "$RANLIB" && RANLIB=: -test -z "$STRIP" && STRIP=: -test -z "$ac_objext" && ac_objext=o - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" - ;; - *) - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -# Only perform the check for file, if the check method requires it -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - AC_PATH_MAGIC - fi - ;; -esac - -AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -enable_win32_dll=yes, enable_win32_dll=no) - -AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -AC_ARG_WITH([pic], - [AC_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) -test -z "$pic_mode" && pic_mode=default - -# Use C for the default configuration in the libtool script -tagname= -AC_LIBTOOL_LANG_C_CONFIG -_LT_AC_TAGCONFIG -])# AC_LIBTOOL_SETUP - - -# _LT_AC_SYS_COMPILER -# ------------------- -AC_DEFUN([_LT_AC_SYS_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_AC_SYS_COMPILER - - -# _LT_AC_SYS_LIBPATH_AIX -# ---------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], -[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'`; fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_AC_SYS_LIBPATH_AIX - - -# _LT_AC_SHELL_INIT(ARG) -# ---------------------- -AC_DEFUN([_LT_AC_SHELL_INIT], -[ifdef([AC_DIVERSION_NOTICE], - [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], - [AC_DIVERT_PUSH(NOTICE)]) -$1 -AC_DIVERT_POP -])# _LT_AC_SHELL_INIT - - -# _LT_AC_PROG_ECHO_BACKSLASH -# -------------------------- -# Add some code to the start of the generated configure script which -# will find an echo command which doesn't interpret backslashes. -AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], -[_LT_AC_SHELL_INIT([ -# Check that we are running under the correct shell. -SHELL=${CONFIG_SHELL-/bin/sh} - -case X$ECHO in -X*--fallback-echo) - # Remove one level of quotation (which was required for Make). - ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` - ;; -esac - -echo=${ECHO-echo} -if test "X[$]1" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift -elif test "X[$]1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then - # Yippee, $echo works! - : -else - # Restart under the correct shell. - exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} -fi - -if test "X[$]1" = X--fallback-echo; then - # used as fallback echo - shift - cat </dev/null && - echo_test_string="`eval $cmd`" && - (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null - then - break - fi - done -fi - -if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - : -else - # The Solaris, AIX, and Digital Unix default echo programs unquote - # backslashes. This makes it impossible to quote backslashes using - # echo "$something" | sed 's/\\/\\\\/g' - # - # So, first we look for a working echo in the user's PATH. - - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for dir in $PATH /usr/ucb; do - IFS="$lt_save_ifs" - if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && - test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$dir/echo" - break - fi - done - IFS="$lt_save_ifs" - - if test "X$echo" = Xecho; then - # We didn't find a better echo, so look for alternatives. - if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # This shell has a builtin print -r that does the trick. - echo='print -r' - elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && - test "X$CONFIG_SHELL" != X/bin/ksh; then - # If we have ksh, try running configure again with it. - ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} - export ORIGINAL_CONFIG_SHELL - CONFIG_SHELL=/bin/ksh - export CONFIG_SHELL - exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} - else - # Try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && - echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - # Cool, printf works - : - elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL - export CONFIG_SHELL - SHELL="$CONFIG_SHELL" - export SHELL - echo="$CONFIG_SHELL [$]0 --fallback-echo" - elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && - test "X$echo_testing_string" = 'X\t' && - echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && - test "X$echo_testing_string" = "X$echo_test_string"; then - echo="$CONFIG_SHELL [$]0 --fallback-echo" - else - # maybe with a smaller string... - prev=: - - for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do - if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null - then - break - fi - prev="$cmd" - done - - if test "$prev" != 'sed 50q "[$]0"'; then - echo_test_string=`eval $prev` - export echo_test_string - exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} - else - # Oops. We lost completely, so just stick with echo. - echo=echo - fi - fi - fi - fi -fi -fi - -# Copy echo and quote the copy suitably for passing to libtool from -# the Makefile, instead of quoting the original, which is used later. -ECHO=$echo -if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then - ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" -fi - -AC_SUBST(ECHO) -])])# _LT_AC_PROG_ECHO_BACKSLASH - - -# _LT_AC_LOCK -# ----------- -AC_DEFUN([_LT_AC_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AC_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line __oline__ "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case "`/usr/bin/file conftest.o`" in - *32-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], -[*-*-cygwin* | *-*-mingw* | *-*-pw32*) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; - ]) -esac - -need_locks="$enable_libtool_lock" - -])# _LT_AC_LOCK - - -# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s conftest.err; then - $2=yes - fi - fi - $rm conftest* -]) - -if test x"[$]$2" = xyes; then - ifelse([$5], , :, [$5]) -else - ifelse([$6], , :, [$6]) -fi -])# AC_LIBTOOL_COMPILER_OPTION - - -# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ------------------------------------------------------------ -# Check whether the given compiler option works -AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], -[AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - printf "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - else - $2=yes - fi - fi - $rm conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - ifelse([$4], , :, [$4]) -else - ifelse([$5], , :, [$5]) -fi -])# AC_LIBTOOL_LINKER_OPTION - - -# AC_LIBTOOL_SYS_MAX_CMD_LEN -# -------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], -[# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - testring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - *) - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ - = "XX$testring") >/dev/null 2>&1 && - new_result=`expr "X$testring" : ".*" 2>&1` && - lt_cv_sys_max_cmd_len=$new_result && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - testring=$testring$testring - done - testring= - # Add a significant safety factor because C++ compilers can tack on massive - # amounts of additional arguments before passing them to the linker. - # It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -])# AC_LIBTOOL_SYS_MAX_CMD_LEN - - -# _LT_AC_CHECK_DLFCN -# -------------------- -AC_DEFUN([_LT_AC_CHECK_DLFCN], -[AC_CHECK_HEADERS(dlfcn.h)dnl -])# _LT_AC_CHECK_DLFCN - - -# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ------------------------------------------------------------------ -AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext < -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -#ifdef __cplusplus -extern "C" void exit (int); -#endif - -void fnord() { int i=42;} -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - /* dlclose (self); */ - } - - exit (status); -}] -EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_unknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_AC_TRY_DLOPEN_SELF - - -# AC_LIBTOOL_DLOPEN_SELF -# ------------------- -AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], -[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - LDFLAGS="$LDFLAGS $link_static_flag" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_AC_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -])# AC_LIBTOOL_DLOPEN_SELF - - -# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) -# --------------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler -AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $rm -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - # According to Tom Tromey, Ian Lance Taylor reported there are C compilers - # that will create temporary files in the current directory regardless of - # the output directory. Thus, making CWD read-only will cause this test - # to fail, enabling locking or at least warning the user not to do parallel - # builds. - chmod -w . - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - if test ! -s out/conftest.err; then - _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . - $rm conftest* out/* - rmdir out - cd .. - rmdir conftest - $rm conftest* -]) -])# AC_LIBTOOL_PROG_CC_C_O - - -# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) -# ----------------------------------------- -# Check to see if we can do hard links to lock some files if needed -AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], -[AC_REQUIRE([_LT_AC_LOCK])dnl - -hard_links="nottested" -if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $rm conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS - - -# AC_LIBTOOL_OBJDIR -# ----------------- -AC_DEFUN([AC_LIBTOOL_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -])# AC_LIBTOOL_OBJDIR - - -# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) -# ---------------------------------------------- -# Check hardcoding attributes. -AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_AC_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ - test -n "$_LT_AC_TAGVAR(runpath_var $1)" || \ - test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)"="Xyes" ; then - - # We can hardcode non-existant directories. - if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_AC_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_AC_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_AC_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH - - -# AC_LIBTOOL_SYS_LIB_STRIP -# ------------------------ -AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], -[striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) -fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -])# AC_LIBTOOL_SYS_LIB_STRIP - - -# AC_LIBTOOL_SYS_DYNAMIC_LINKER -# ----------------------------- -# PORTME Fill in your ld.so characteristics -AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], -[AC_MSG_CHECKING([dynamic linker characteristics]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -if test "$GCC" = yes; then - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix4* | aix5*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi4*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32*) - version_type=windows - shrext=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $rm \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" - ;; - mingw*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"` - if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH printed by - # mingw gcc, but we are running on Cygwin. Gcc prints its search - # path with ; separators, and with drive letters. We can handle the - # drive letters (cygwin fileutils understands them), so leave them, - # especially as we might pass files found there to a mingw objdump, - # which wouldn't understand a cygwinified path. Ahh. - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. - library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext='$(test .$module = .yes && echo .so || echo .dylib)' - # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same. - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"` - fi - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd*) - objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - *) # from 3.2 on - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case "$host_cpu" in - ia64*) - shrext='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555. - postinstall_cmds='chmod 555 $lib' - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -nto-qnx) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -openbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -sco3.2v5*) - version_type=osf - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - export_dynamic_flag_spec='${wl}-Blargedynsym' - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no -])# AC_LIBTOOL_SYS_DYNAMIC_LINKER - - -# _LT_AC_TAGCONFIG -# ---------------- -AC_DEFUN([_LT_AC_TAGCONFIG], -[AC_ARG_WITH([tags], - [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], - [include additional configurations @<:@automatic@:>@])], - [tagnames="$withval"]) - -if test -f "$ltmain" && test -n "$tagnames"; then - if test ! -f "${ofile}"; then - AC_MSG_WARN([output file `$ofile' does not exist]) - fi - - if test -z "$LTCC"; then - eval "`$SHELL ${ofile} --config | grep '^LTCC='`" - if test -z "$LTCC"; then - AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) - else - AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) - fi - fi - - # Extract list of available tagged configurations in $ofile. - # Note that this assumes the entire list is on one line. - available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` - - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for tagname in $tagnames; do - IFS="$lt_save_ifs" - # Check whether tagname contains only valid characters - case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in - "") ;; - *) AC_MSG_ERROR([invalid tag name: $tagname]) - ;; - esac - - if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null - then - AC_MSG_ERROR([tag name \"$tagname\" already exists]) - fi - - # Update the list of available tags. - if test -n "$tagname"; then - echo appending configuration tag \"$tagname\" to $ofile - - case $tagname in - CXX) - if test -n "$CXX" && test "X$CXX" != "Xno"; then - AC_LIBTOOL_LANG_CXX_CONFIG - else - tagname="" - fi - ;; - - F77) - if test -n "$F77" && test "X$F77" != "Xno"; then - AC_LIBTOOL_LANG_F77_CONFIG - else - tagname="" - fi - ;; - - GCJ) - if test -n "$GCJ" && test "X$GCJ" != "Xno"; then - AC_LIBTOOL_LANG_GCJ_CONFIG - else - tagname="" - fi - ;; - - RC) - AC_LIBTOOL_LANG_RC_CONFIG - ;; - - *) - AC_MSG_ERROR([Unsupported tag name: $tagname]) - ;; - esac - - # Append the new tag name to the list of available tags. - if test -n "$tagname" ; then - available_tags="$available_tags $tagname" - fi - fi - done - IFS="$lt_save_ifs" - - # Now substitute the updated list of available tags. - if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then - mv "${ofile}T" "$ofile" - chmod +x "$ofile" - else - rm -f "${ofile}T" - AC_MSG_ERROR([unable to update list of available tagged configurations.]) - fi -fi -])# _LT_AC_TAGCONFIG - - -# AC_LIBTOOL_DLOPEN -# ----------------- -# enable checks for dlopen support -AC_DEFUN([AC_LIBTOOL_DLOPEN], - [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_DLOPEN - - -# AC_LIBTOOL_WIN32_DLL -# -------------------- -# declare package support for building win32 dll's -AC_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) -])# AC_LIBTOOL_WIN32_DLL - - -# AC_ENABLE_SHARED([DEFAULT]) -# --------------------------- -# implement the --enable-shared flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_SHARED], -[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([shared], - [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]AC_ENABLE_SHARED_DEFAULT) -])# AC_ENABLE_SHARED - - -# AC_DISABLE_SHARED -# ----------------- -#- set the default shared flag to --disable-shared -AC_DEFUN([AC_DISABLE_SHARED], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_SHARED(no) -])# AC_DISABLE_SHARED - - -# AC_ENABLE_STATIC([DEFAULT]) -# --------------------------- -# implement the --enable-static flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_STATIC], -[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([static], - [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]AC_ENABLE_STATIC_DEFAULT) -])# AC_ENABLE_STATIC - - -# AC_DISABLE_STATIC -# ----------------- -# set the default static flag to --disable-static -AC_DEFUN([AC_DISABLE_STATIC], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_STATIC(no) -])# AC_DISABLE_STATIC - - -# AC_ENABLE_FAST_INSTALL([DEFAULT]) -# --------------------------------- -# implement the --enable-fast-install flag -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -AC_DEFUN([AC_ENABLE_FAST_INSTALL], -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl -AC_ARG_ENABLE([fast-install], - [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) -])# AC_ENABLE_FAST_INSTALL - - -# AC_DISABLE_FAST_INSTALL -# ----------------------- -# set the default to --disable-fast-install -AC_DEFUN([AC_DISABLE_FAST_INSTALL], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -AC_ENABLE_FAST_INSTALL(no) -])# AC_DISABLE_FAST_INSTALL - - -# AC_LIBTOOL_PICMODE([MODE]) -# -------------------------- -# implement the --with-pic flag -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -AC_DEFUN([AC_LIBTOOL_PICMODE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl -pic_mode=ifelse($#,1,$1,default) -])# AC_LIBTOOL_PICMODE - - -# AC_PROG_EGREP -# ------------- -# This is predefined starting with Autoconf 2.54, so this conditional -# definition can be removed once we require Autoconf 2.54 or later. -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) -])]) - - -# AC_PATH_TOOL_PREFIX -# ------------------- -# find a file program which can recognise shared library -AC_DEFUN([AC_PATH_TOOL_PREFIX], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="ifelse([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool at gnu.org - -EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -])# AC_PATH_TOOL_PREFIX - - -# AC_PATH_MAGIC -# ------------- -# find a file program which can recognise a shared library -AC_DEFUN([AC_PATH_MAGIC], -[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# AC_PATH_MAGIC - - -# AC_PROG_LD -# ---------- -# find the path to the GNU or non-GNU linker -AC_DEFUN([AC_PROG_LD], -[AC_ARG_WITH([gnu-ld], - [AC_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no]) -AC_REQUIRE([LT_AC_PROG_SED])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case "$host_cpu" in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - irix5* | nonstopux*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" - ;; - *) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" - ;; - esac - lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux*) - case $host_cpu in - alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh*) - lt_cv_deplibs_check_method=pass_all ;; - *) - # glibc up to 2.1.1 does not perform some relocations on ARM - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; - esac - lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -nto-qnx) - lt_cv_deplibs_check_method=unknown - ;; - -openbsd*) - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' - else - lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' - fi - ;; - -osf3* | osf4* | osf5*) - # this will be overridden with pass_all, but let us keep it just in case - lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' - lt_cv_file_magic_test_file=/shlib/libc.so - lt_cv_deplibs_check_method=pass_all - ;; - -sco3.2v5*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - lt_cv_file_magic_test_file=/lib/libc.so - ;; - -sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown -])# AC_DEPLIBS_CHECK_METHOD - - -# AC_PROG_NM -# ---------- -# find the path to a BSD-compatible name lister -AC_DEFUN([AC_PROG_NM], -[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/${ac_tool_prefix}nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - esac - fi - done - IFS="$lt_save_ifs" - test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm -fi]) -NM="$lt_cv_path_NM" -])# AC_PROG_NM - - -# AC_CHECK_LIBM -# ------------- -# check for math library -AC_DEFUN([AC_CHECK_LIBM], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -])# AC_CHECK_LIBM - - -# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl convenience library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will -# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with -# '${top_srcdir}/' (note the single quotes!). If your package is not -# flat and you're not using automake, define top_builddir and -# top_srcdir appropriately in the Makefiles. -AC_DEFUN([AC_LIBLTDL_CONVENIENCE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - case $enable_ltdl_convenience in - no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; - "") enable_ltdl_convenience=yes - ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; - esac - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_CONVENIENCE - - -# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) -# ----------------------------------- -# sets LIBLTDL to the link flags for the libltdl installable library and -# LTDLINCL to the include flags for the libltdl header and adds -# --enable-ltdl-install to the configure arguments. Note that LIBLTDL -# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If -# DIRECTORY is not provided and an installed libltdl is not found, it is -# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' -# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single -# quotes!). If your package is not flat and you're not using automake, -# define top_builddir and top_srcdir appropriately in the Makefiles. -# In the future, this macro may have to be called after AC_PROG_LIBTOOL. -AC_DEFUN([AC_LIBLTDL_INSTALLABLE], -[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl - AC_CHECK_LIB(ltdl, lt_dlinit, - [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], - [if test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - else - enable_ltdl_install=yes - fi - ]) - if test x"$enable_ltdl_install" = x"yes"; then - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la - LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) - else - ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLINCL= - fi - # For backwards non-gettext consistent compatibility... - INCLTDL="$LTDLINCL" -])# AC_LIBLTDL_INSTALLABLE - - -# AC_LIBTOOL_CXX -# -------------- -# enable support for C++ libraries -AC_DEFUN([AC_LIBTOOL_CXX], -[AC_REQUIRE([_LT_AC_LANG_CXX]) -])# AC_LIBTOOL_CXX - - -# _LT_AC_LANG_CXX -# --------------- -AC_DEFUN([_LT_AC_LANG_CXX], -[AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,CXX" | sed 's/^,//'`]) -])# _LT_AC_LANG_CXX - - -# AC_LIBTOOL_F77 -# -------------- -# enable support for Fortran 77 libraries -AC_DEFUN([AC_LIBTOOL_F77], -[AC_REQUIRE([_LT_AC_LANG_F77]) -])# AC_LIBTOOL_F77 - - -# _LT_AC_LANG_F77 -# --------------- -AC_DEFUN([_LT_AC_LANG_F77], -[AC_REQUIRE([AC_PROG_F77]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,F77" | sed 's/^,//'`]) -])# _LT_AC_LANG_F77 - - -# AC_LIBTOOL_GCJ -# -------------- -# enable support for GCJ libraries -AC_DEFUN([AC_LIBTOOL_GCJ], -[AC_REQUIRE([_LT_AC_LANG_GCJ]) -])# AC_LIBTOOL_GCJ - - -# _LT_AC_LANG_GCJ -# --------------- -AC_DEFUN([_LT_AC_LANG_GCJ], -[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], - [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], - [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], - [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], - [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,GCJ" | sed 's/^,//'`]) -])# _LT_AC_LANG_GCJ - - -# AC_LIBTOOL_RC -# -------------- -# enable support for Windows resource files -AC_DEFUN([AC_LIBTOOL_RC], -[AC_REQUIRE([LT_AC_PROG_RC]) -_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,RC" | sed 's/^,//'`]) -])# AC_LIBTOOL_RC - - -# AC_LIBTOOL_LANG_C_CONFIG -# ------------------------ -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) -AC_DEFUN([_LT_AC_LANG_C_CONFIG], -[lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}\n' - -_LT_AC_SYS_COMPILER - -# -# Check for any special shared library compilation flags. -# -_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= -if test "$GCC" = no; then - case $host_os in - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' - ;; - esac -fi -if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then - AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) - if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : - else - AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) - _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no - fi -fi - - -# -# Check to make sure the static flag actually works. -# -AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), - $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), - [], - [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) - - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -# Report which librarie types wil actually be built -AC_MSG_CHECKING([if libtool supports shared libraries]) -AC_MSG_RESULT([$can_build_shared]) - -AC_MSG_CHECKING([whether to build shared libraries]) -test "$can_build_shared" = "no" && enable_shared=no - -# On AIX, shared libraries and static libraries use the same namespace, and -# are all built from PIC. -case "$host_os" in -aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - -aix4*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - output_verbose_link_cmd='echo' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring' - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; -esac -AC_MSG_RESULT([$enable_shared]) - -AC_MSG_CHECKING([whether to build static libraries]) -# Make sure either enable_shared or enable_static is yes. -test "$enable_shared" = yes || enable_static=yes -AC_MSG_RESULT([$enable_static]) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC="$lt_save_CC" -])# AC_LIBTOOL_LANG_C_CONFIG - - -# AC_LIBTOOL_LANG_CXX_CONFIG -# -------------------------- -# Ensure that the configuration vars for the C compiler are -# suitably defined. Those variables are subsequently used by -# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. -AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) -AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], -[AC_LANG_PUSH(C++) -AC_REQUIRE([AC_PROG_CXX]) -AC_REQUIRE([AC_PROG_CXXCPP]) - -_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_AC_TAGVAR(allow_undefined_flag, $1)= -_LT_AC_TAGVAR(always_export_symbols, $1)=no -_LT_AC_TAGVAR(archive_expsym_cmds, $1)= -_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_direct, $1)=no -_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= -_LT_AC_TAGVAR(hardcode_minus_L, $1)=no -_LT_AC_TAGVAR(hardcode_automatic, $1)=no -_LT_AC_TAGVAR(module_cmds, $1)= -_LT_AC_TAGVAR(module_expsym_cmds, $1)= -_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown -_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_AC_TAGVAR(no_undefined_flag, $1)= -_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= -_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Dependencies to place before and after the object being linked: -_LT_AC_TAGVAR(predep_objects, $1)= -_LT_AC_TAGVAR(postdep_objects, $1)= -_LT_AC_TAGVAR(predeps, $1)= -_LT_AC_TAGVAR(postdeps, $1)= -_LT_AC_TAGVAR(compiler_lib_search_path, $1)= - -# Source file extension for C++ test sources. -ac_ext=cc - -# Object file extension for compiled C++ test sources. -objext=o -_LT_AC_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;\n" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_AC_SYS_COMPILER - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_LD=$LD -lt_save_GCC=$GCC -GCC=$GXX -lt_save_with_gnu_ld=$with_gnu_ld -lt_save_path_LD=$lt_cv_path_LD -if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx -else - unset lt_cv_prog_gnu_ld -fi -if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX -else - unset lt_cv_path_LD -fi -test -z "${LDCXX+set}" || LD=$LDCXX -CC=${CXX-"c++"} -compiler=$CC -_LT_AC_TAGVAR(compiler, $1)=$CC -cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` - -# We don't want -fno-exception wen compiling C++ code, so set the -# no_builtin_flag separately -if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' -else - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -fi - -if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - AC_PROG_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ - grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - -else - GXX=no - with_gnu_ld=no - wlarc= -fi - -# PORTME: fill in a description of your system's C++ link characteristics -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -_LT_AC_TAGVAR(ld_shlibs, $1)=yes -case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; - - dgux*) - case $cc_basename in - ec++) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before switch to ELF - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - freebsd-elf*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - freebsd*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - ;; - gnu*) - ;; - hpux9*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | egrep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - *) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - aCC) - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case "$host_cpu" in - ia64*|hppa*64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - irix5* | irix6*) - case $cc_basename in - CC) - # SGI C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib' - fi - fi - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - linux*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc) - # Intel C++ - with_gnu_ld=yes - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - cxx) - # Compaq C++ - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - esac - ;; - lynxos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - m88k*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - mvs*) - case $cc_basename in - cxx) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - osf3*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - osf4* | osf5*) - case $cc_basename in - KCC) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' - ;; - RCC) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - cxx) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ - $rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - psos*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - sco*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case $cc_basename in - CC) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - lcc) - # Lucid - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The C++ compiler is used as linker so we must use $wl - # flag to pass the commands to the underlying system - # linker. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | grep -v '^2\.7' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" - fi - - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - fi - ;; - esac - ;; - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - vxworks*) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; -esac -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_AC_TAGVAR(GCC, $1)="$GXX" -_LT_AC_TAGVAR(LD, $1)="$LD" - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -AC_LIBTOOL_POSTDEP_PREDEP($1) -AC_LIBTOOL_PROG_COMPILER_PIC($1) -AC_LIBTOOL_PROG_CC_C_O($1) -AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) -AC_LIBTOOL_PROG_LD_SHLIBS($1) -AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) -AC_LIBTOOL_SYS_LIB_STRIP -AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) -AC_LIBTOOL_DLOPEN_SELF($1) - -AC_LIBTOOL_CONFIG($1) - -AC_LANG_POP -CC=$lt_save_CC -LDCXX=$LD -LD=$lt_save_LD -GCC=$lt_save_GCC -with_gnu_ldcxx=$with_gnu_ld -with_gnu_ld=$lt_save_with_gnu_ld -lt_cv_path_LDCXX=$lt_cv_path_LD -lt_cv_path_LD=$lt_save_path_LD -lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld -lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -])# AC_LIBTOOL_LANG_CXX_CONFIG - -# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) -# ------------------------ -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" -ifelse([$1], [], -[#! $SHELL - -# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 -# Free Software Foundation, Inc. -# -# This file is part of GNU Libtool: -# Originally by Gordon Matzigkeit , 1996 -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e s/^X//" - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi - -# The names of the tagged configurations supported by this script. -available_tags= - -# ### BEGIN LIBTOOL CONFIG], -[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) - -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) - -# Whether or not to disallow shared libs when runtime libs are static -allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# The host system. -host_alias=$host_alias -host=$host - -# An echo program that does not interpret backslashes. -echo=$lt_echo - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A C compiler. -LTCC=$lt_LTCC - -# A language-specific compiler. -CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) - -# Is the compiler the GNU C compiler? -with_gcc=$_LT_AC_TAGVAR(GCC, $1) - -# An ERE matcher. -EGREP=$lt_EGREP - -# The linker used to build libraries. -LD=$lt_[]_LT_AC_TAGVAR(LD, $1) - -# Whether we need hard or soft links. -LN_S=$lt_LN_S - -# A BSD-compatible nm program. -NM=$lt_NM - -# A symbol stripping program -STRIP=$STRIP - -# Used to examine libraries when file_magic_cmd begins "file" -MAGIC_CMD=$MAGIC_CMD - -# Used on cygwin: DLL creation program. -DLLTOOL="$DLLTOOL" - -# Used on cygwin: object dumper. -OBJDUMP="$OBJDUMP" - -# Used on cygwin: assembler. -AS="$AS" - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# How to pass a linker flag through the compiler. -wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - -# Object file suffix (normally "o"). -objext="$ac_objext" - -# Old archive suffix (normally "a"). -libext="$libext" - -# Shared library suffix (normally ".so"). -shrext='$shrext' - -# Executable file suffix (normally ""). -exeext="$exeext" - -# Additional compiler flags for building library objects. -pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) -pic_mode=$pic_mode - -# What is the maximum length of a command? -max_cmd_len=$lt_cv_sys_max_cmd_len - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) - -# Must we lock files when doing compilation ? -need_locks=$lt_need_locks - -# Do we need the lib prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) - -# Compiler flag to generate thread-safe objects. -thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) - -# Library versioning type. -version_type=$version_type - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME. -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Commands used to build and install an old-style archive. -RANLIB=$lt_RANLIB -old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) - -# Commands used to build and install a shared archive. -archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) -archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) -postinstall_cmds=$lt_postinstall_cmds -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to build a loadable module (assumed same as above if empty) -module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1) -module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1) - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - -# Dependencies to place before the objects being linked to create a -# shared library. -predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) - -# Dependencies to place before the objects being linked to create a -# shared library. -predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) - -# Dependencies to place after the objects being linked to create a -# shared library. -postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == file_magic. -file_magic_cmd=$lt_file_magic_cmd - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) - -# Flag that forces no undefined symbols. -no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# Same as above, but a single script fragment to be evaled but not shown. -finish_eval=$lt_finish_eval - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# This is the shared library runtime path variable. -runpath_var=$runpath_var - -# This is the shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# How to hardcode a shared library path into an executable. -hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) - -# If ld is used when linking, flag to hardcode \$libdir into -# a binary during linking. This must work even if \$libdir does -# not exist. -hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) - -# Whether we need a single -rpath flag with a separated argument. -hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) - -# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the -# resulting binary. -hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) - -# Set to yes if using the -LDIR flag during linking hardcodes DIR into the -# resulting binary. -hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) - -# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into -# the resulting binary. -hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) - -# Set to yes if building a shared library automatically hardcodes DIR into the library -# and all subsequent libraries and executables linked against it. -hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1) - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at relink time. -variables_saved_for_relink="$variables_saved_for_relink" - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) - -# Compile-time system search path for libraries -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" - -# Set to yes if exported symbols are required. -always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) - -# The commands to list exported symbols. -export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) - -# Symbols that must always be exported. -include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) - -ifelse([$1],[], -[# ### END LIBTOOL CONFIG], -[# ### END LIBTOOL TAG CONFIG: $tagname]) - -__EOF__ - -ifelse([$1],[], [ - case $host_os in - aix3*) - cat <<\EOF >> "$cfgfile" - -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -EOF - ;; - esac - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || \ - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -]) -else - # If there is no Makefile yet, we rely on a make rule to execute - # `config.status --recheck' to rerun these tests and create the - # libtool script then. - test -f Makefile && make "$ltmain" -fi -])# AC_LIBTOOL_CONFIG - - -# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], -[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl - -_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - - AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI - - -# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE -# --------------------------------- -AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], -[AC_REQUIRE([AC_CANONICAL_HOST]) -AC_REQUIRE([AC_PROG_NM]) -AC_REQUIRE([AC_OBJEXT]) -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \2\3 \3' - -# Transform an extracted symbol line into a proper C declaration -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) # Its linker distinguishes data from code symbols - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris* | sysv5*) - symcode='[[BDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGISTW]]' ;; -esac - -# Try without a prefix undercore, then with it. -for ac_symprfx in "" "_"; do - - # Write the raw and C identifiers. - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if grep ' nm_test_var$' "$nlist" >/dev/null; then - if grep ' nm_test_func$' "$nlist" >/dev/null; then - cat < conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' - - cat <> conftest.$ac_ext -#if defined (__STDC__) && __STDC__ -# define lt_ptr_t void * -#else -# define lt_ptr_t char * -# define const -#endif - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - lt_ptr_t address; -} -lt_preloaded_symbols[[]] = -{ -EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext - cat <<\EOF >> conftest.$ac_ext - {0, (lt_ptr_t) 0} -}; - -#ifdef __cplusplus -} -#endif -EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -f conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi -]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE - - -# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) -# --------------------------------------- -AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], -[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) - ifelse([$1],[CXX],[ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | os2* | pw32*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix4* | aix5*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68) - # Green Hills C++ Compiler - # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux*) - case $cc_basename in - KCC) - # KAI C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - icpc) - # Intel C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - cxx) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC) - # Rational C++ 2.4.1 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx) - # Digital/Compaq C++ - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - sco*) - case $cc_basename in - CC) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - *) - ;; - esac - ;; - solaris*) - case $cc_basename in - CC) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx) - # Green Hills C++ Compiler - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC) - # Sun C++ 4.x - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc) - # Lucid - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC) - # NonStop-UX NCC 3.20 - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - unixware*) - ;; - vxworks*) - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - - beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - hpux*) - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | pw32* | os2*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case "$host_cpu" in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - newsos6) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - linux*) - case $CC in - icc|ecc) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - ccc) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - esac - ;; - - osf3* | osf4* | osf5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' - ;; - - solaris*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sunos4*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - uts4*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then - AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], - _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), - [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -case "$host_os" in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])" - ;; -esac -]) - - -# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) -# ------------------------------------ -# See if the linker supports building shared libraries. -AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], -[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -ifelse([$1],[CXX],[ - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix4* | aix5*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw*) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -],[ - runpath_var= - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_AC_TAGVAR(archive_cmds, $1)= - _LT_AC_TAGVAR(archive_expsym_cmds, $1)= - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= - _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown - _LT_AC_TAGVAR(hardcode_automatic, $1)=no - _LT_AC_TAGVAR(module_cmds, $1)= - _LT_AC_TAGVAR(module_expsym_cmds, $1)= - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_AC_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - if test "$with_gnu_ld" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # See if GNU ld supports shared libraries. - case $host_os in - aix3* | aix4* | aix5*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: the GNU linker, at least up to release 2.9.1, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to modify your PATH -*** so that a non-GNU linker is found, and then restart. - -EOF - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - - # Samuel A. Falvo II reports - # that the semantics of dynamic libraries on AmigaOS, at least up - # to version 4, is to share data among multiple programs linked - # with the same dynamic library. Since this doesn't match the - # behavior of shared libraries on other platforms, we can't use - # them. - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32*) - # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=no - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris* | sysv5*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - _LT_AC_TAGVAR(ld_shlibs, $1)=no - cat <&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -EOF - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sunos4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_AC_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then - runpath_var=LD_RUN_PATH - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= - fi - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$link_static_flag"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix4* | aix5*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - if $NM -V 2>&1 | grep 'GNU' > /dev/null; then - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - else - _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_AC_TAGVAR(archive_cmds, $1)='' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - else - # We have old collect2 - _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an empty executable. - _LT_AC_SYS_LIBPATH_AIX - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - # -bexpall does not export symbols beginning with underscore (_) - _LT_AC_TAGVAR(always_export_symbols, $1)=yes - # Exported symbols can be pulled into shared objects from archives - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds it's shared libraries. - _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - # see comment about different semantics on the GNU ld section - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - bsdi4*) - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - case "$host_os" in - rhapsody* | darwin1.[[012]]) - _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' - ;; - *) # Darwin 1.3 on - test -z ${LD_TWOLEVEL_NAMESPACE} && _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' - ;; - esac - # FIXME: Relying on posixy $() will cause problems for - # cross-compilation, but unfortunately the echo tests do not - # yet detect zsh echo's removal of \ escapes. Also zsh mangles - # `"' quotes if we put them in here... so don't! - lt_int_apple_cc_single_mod=no - output_verbose_link_cmd='echo' - if $CC -dumpspecs 2>&1 | grep 'single_module' >/dev/null ; then - lt_int_apple_cc_single_mod=yes - fi - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring' - fi - _LT_AC_TAGVAR(module_cmds, $1)='$CC -bundle ${wl}-bind_at_load $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags' - # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin ld's - if test "X$lt_int_apple_cc_single_mod" = Xyes ; then - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - else - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -bundle $allow_undefined_flag -o $lib $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_automatic, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - fi - ;; - - dgux*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10* | hpux11*) - if test "$GCC" = yes -a "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case "$host_cpu" in - hppa*64*|ia64*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - ;; - esac - fi - if test "$with_gnu_ld" = no; then - case "$host_cpu" in - hppa*64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - ia64*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - *) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - openbsd*) - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - ;; - - os2*) - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ - $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - sco3.2v5*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ;; - - solaris*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; - esac - _LT_AC_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_AC_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_AC_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4.2uw2*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_direct, $1)=yes - _LT_AC_TAGVAR(hardcode_minus_L, $1)=no - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - hardcode_runpath_var=yes - runpath_var=LD_RUN_PATH - ;; - - sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) - _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' - if test "$GCC" = yes; then - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - runpath_var='LD_RUN_PATH' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv5*) - _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' - # $CC -shared without GNU ld will not create a library from C++ - # object files and a static libstdc++, better avoid it by now - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - ;; - - uts4*) - _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_AC_TAGVAR(ld_shlibs, $1)=no - ;; - esac - fi -]) -AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) -test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -# -# Do we need to explicitly link libc? -# -case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_AC_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_MSG_CHECKING([whether -lc should be explicitly linked in]) - $rm conftest* - printf "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) - _LT_AC_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) - then - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no - else - _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $rm conftest* - AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) - ;; - esac - fi - ;; -esac -])# AC_LIBTOOL_PROG_LD_SHLIBS - - -# _LT_AC_FILE_LTDLL_C -# ------------------- -# Be careful that the start marker always follows a newline. -AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ -# /* ltdll.c starts here */ -# #define WIN32_LEAN_AND_MEAN -# #include -# #undef WIN32_LEAN_AND_MEAN -# #include -# -# #ifndef __CYGWIN__ -# # ifdef __CYGWIN32__ -# # define __CYGWIN__ __CYGWIN32__ -# # endif -# #endif -# -# #ifdef __cplusplus -# extern "C" { -# #endif -# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); -# #ifdef __cplusplus -# } -# #endif -# -# #ifdef __CYGWIN__ -# #include -# DECLARE_CYGWIN_DLL( DllMain ); -# #endif -# HINSTANCE __hDllInstance_base; -# -# BOOL APIENTRY -# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) -# { -# __hDllInstance_base = hInst; -# return TRUE; -# } -# /* ltdll.c ends here */ -])# _LT_AC_FILE_LTDLL_C - - -# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) -# --------------------------------- -AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) - - -# old names -AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) -AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) -AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) -AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) -AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) - -# This is just to silence aclocal about the macro not being used -ifelse([AC_DISABLE_FAST_INSTALL]) - -AC_DEFUN([LT_AC_PROG_GCJ], -[AC_CHECK_TOOL(GCJ, gcj, no) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS) -]) - -AC_DEFUN([LT_AC_PROG_RC], -[AC_CHECK_TOOL(RC, windres, no) -]) - -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ -# LT_AC_PROG_SED -# -------------- -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -AC_DEFUN([LT_AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && break - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -SED=$lt_cv_path_SED -]) -AC_MSG_RESULT([$SED]) -]) -############################################################################# -# Additional Macros -############################################################################# - -# -# Check for C++ namespace support. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html -# -AC_DEFUN([AC_CXX_NAMESPACES], -[AC_CACHE_CHECK(whether the compiler implements namespaces, -ac_cv_cxx_namespaces, -[AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([namespace Outer { namespace Inner { int i = 0; }}], - [using namespace Outer::Inner; return i;], - ac_cv_cxx_namespaces=yes, ac_cv_cxx_namespaces=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_namespaces" = yes; then - AC_DEFINE(HAVE_NAMESPACES,,[define if the compiler implements namespaces]) -fi -]) - -# -# Check for hash_map extension. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_map.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_HASH_MAP], -[AC_CACHE_CHECK(whether the compiler has ext/hash_map, -ac_cv_cxx_have_ext_hash_map, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[hash_map t; return 0;], - ac_cv_cxx_have_ext_hash_map=std, ac_cv_cxx_have_ext_hash_map=no) - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[hash_map t; return 0;], - ac_cv_cxx_have_ext_hash_map=gnu, ac_cv_cxx_have_ext_hash_map=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_hash_map" = std; then - AC_DEFINE(HAVE_STD_EXT_HASH_MAP,,[define if the compiler has ext/hash_map]) -fi -if test "$ac_cv_cxx_have_ext_hash_map" = gnu; then - AC_DEFINE(HAVE_GNU_EXT_HASH_MAP,,[define if the compiler has ext/hash_map]) -fi -]) - -# -# Check for hash_set extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_HASH_SET], -[AC_CACHE_CHECK(whether the compiler has ext/hash_set, -ac_cv_cxx_have_ext_hash_set, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[hash_set t; return 0;], - ac_cv_cxx_have_ext_hash_set=std, ac_cv_cxx_have_ext_hash_set=no) - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[hash_set t; return 0;], - ac_cv_cxx_have_ext_hash_set=gnu, ac_cv_cxx_have_ext_hash_set=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_hash_set" = std; then - AC_DEFINE(HAVE_STD_EXT_HASH_SET,,[define if the compiler has ext/hash_set in std]) -fi -if test "$ac_cv_cxx_have_ext_hash_set" = gnu; then - AC_DEFINE(HAVE_GNU_EXT_HASH_SET,,[define if the compiler has ext/hash_set in __gnu_cc]) -fi -]) - -# -# Check for standard iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_STD_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has the standard iterator, -ac_cv_cxx_have_std_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[iterator t; return 0;], - ac_cv_cxx_have_std_iterator=yes, ac_cv_cxx_have_std_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_std_iterator" = yes; then - AC_DEFINE(HAVE_STD_ITERATOR,,[define if the compiler has STL iterators]) -fi -]) - -# -# Check for bidirectional iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_BI_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has the bidirectional iterator, -ac_cv_cxx_have_bi_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[bidirectional_iterator t; return 0;], - ac_cv_cxx_have_bi_iterator=yes, ac_cv_cxx_have_bi_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_bi_iterator" = yes; then - AC_DEFINE(HAVE_BI_ITERATOR,,[define if the compiler has bidirectional iterator]) -fi -]) - -# -# Check for forward iterator extension. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_hash_set.html -# -AC_DEFUN([AC_CXX_HAVE_FWD_ITERATOR], -[AC_CACHE_CHECK(whether the compiler has forward iterators, -ac_cv_cxx_have_fwd_iterator, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[forward_iterator t; return 0;], - ac_cv_cxx_have_fwd_iterator=yes, ac_cv_cxx_have_fwd_iterator=no) - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_fwd_iterator" = yes; then - AC_DEFINE(HAVE_FWD_ITERATOR,,[define if the compiler has STL iterators]) -fi -]) - -# -# Check for slist extension. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_CXX_HAVE_EXT_SLIST], -[AC_CACHE_CHECK(whether the compiler has ext/slist, -ac_cv_cxx_have_ext_slist, -[AC_REQUIRE([AC_CXX_NAMESPACES]) - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace std; -#endif],[slist s; return 0;], - ac_cv_cxx_have_ext_slist=std, ac_cv_cxx_have_ext_slist=no) - AC_TRY_COMPILE([#include -#ifdef HAVE_NAMESPACES -using namespace __gnu_cxx; -#endif],[slist s; return 0;], - ac_cv_cxx_have_ext_slist=gnu, ac_cv_cxx_have_ext_slist=no) - - AC_LANG_RESTORE -]) -if test "$ac_cv_cxx_have_ext_slist" = std; then - AC_DEFINE(HAVE_EXT_SLIST,std,[define if the compiler has ext/slist]) -fi -if test "$ac_cv_cxx_have_ext_slist" = gnu; then - AC_DEFINE(HAVE_EXT_SLIST,gnu,[define if the compiler has ext/slist]) -fi -]) +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 +# Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. # -# Check for FLEX. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html +# Configure a Makefile without clobbering it if it exists and is not out of +# date. This macro is unique to LLVM. # -AC_DEFUN([AC_PROG_FLEX], -[AC_CACHE_CHECK(, -ac_cv_has_flex, -[AC_PROG_LEX() -]) -if test "$LEX" != "flex"; then - AC_MSG_ERROR([flex not found but required]) -fi +AC_DEFUN([AC_CONFIG_MAKEFILE], +[AC_CONFIG_COMMANDS($1, + [${llvm_src}/autoconf/mkinstalldirs `dirname $1` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/$1 $1]) ]) # -# Check for Bison. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_namespaces.html +# Provide the arguments and other processing needed for an LLVM project # -AC_DEFUN([AC_PROG_BISON], -[AC_CACHE_CHECK(, -ac_cv_has_bison, -[AC_PROG_YACC() -]) -if test "$YACC" != "bison -y"; then - AC_MSG_ERROR([bison not found but required]) -else - AC_SUBST(YACC,[bison],[location of bison]) -fi +AC_DEFUN([LLVM_CONFIG_PROJECT], + [AC_ARG_WITH([llvmsrc], + AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]), + [llvm_src="$withval"],[llvm_src="]$1["]) + AC_SUBST(LLVM_SRC,$llvm_src) + AC_ARG_WITH([llvmobj], + AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]), + [llvm_obj="$withval"],[llvm_obj="]$2["]) + AC_SUBST(LLVM_OBJ,$llvm_obj) + AC_CONFIG_COMMANDS([setup],,[llvm_src="${LLVM_SRC}"]) ]) # -# Check for GNU Make. This is from -# http://www.gnu.org/software/ac-archive/htmldoc/check_gnu_make.html -# -AC_DEFUN( - [CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command, - _cv_gnu_make_command='' ; -dnl Search all the common names for GNU make - for a in "$MAKE" make gmake gnumake ; do - if test -z "$a" ; then continue ; fi ; - if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then - _cv_gnu_make_command=$a ; - break; - fi - done ; - ) ; -dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise - if test "x$_cv_gnu_make_command" != "x" ; then - ifGNUmake='' ; - else - ifGNUmake='#' ; - AC_MSG_RESULT("Not found"); - fi - AC_SUBST(ifGNUmake) -] ) - -# -# Check for the ability to mmap a file. This is modified from -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html +# Check for the ability to mmap a file. # AC_DEFUN([AC_FUNC_MMAP_FILE], [AC_CACHE_CHECK(for mmap of files, ac_cv_func_mmap_file, -[AC_LANG_SAVE - AC_LANG_C - AC_TRY_RUN([ -#ifdef HAVE_SYS_MMAN_H -#include -#endif - -#ifdef HAVE_SYS_TYPES_H +[ AC_LANG_PUSH([C]) + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ #include -#endif - -#ifdef HAVE_FCNTL_H +#include #include -#endif - +]],[[ int fd; - int main () { - fd = creat ("foo",0777); fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); unlink ("foo"); return (fd != MAP_FAILED);}], - ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no) - AC_LANG_RESTORE + fd = creat ("foo",0777); + fd = (int) mmap (0, 1, PROT_READ, MAP_SHARED, fd, 0); + unlink ("foo"); + return (fd != (int) MAP_FAILED);]])], + [ac_cv_func_mmap_file=yes],[ac_cv_func_mmap_file=no],[ac_cv_func_mmap_file=no]) + AC_LANG_POP([C]) ]) if test "$ac_cv_func_mmap_file" = yes; then - AC_DEFINE(HAVE_MMAP_FILE) + AC_DEFINE([HAVE_MMAP_FILE],[],[Define if mmap() can map files into memory]) AC_SUBST(MMAP_FILE,[yes]) fi ]) @@ -6142,37 +70,25 @@ AC_DEFUN([AC_HEADER_MMAP_ANONYMOUS], [AC_CACHE_CHECK(for MAP_ANONYMOUS vs. MAP_ANON, ac_cv_header_mmap_anon, -[AC_LANG_SAVE - AC_LANG_C - AC_TRY_COMPILE([#include - #include - #include ], - [mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);], - ac_cv_header_mmap_anon=yes, ac_cv_header_mmap_anon=no) - AC_LANG_RESTORE +[ AC_LANG_PUSH([C]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include +#include +#include ]], + [[mmap (0, 1, PROT_READ, MAP_ANONYMOUS, -1, 0); return (0);]])], + ac_cv_header_mmap_anon=yes, + ac_cv_header_mmap_anon=no) + AC_LANG_POP([C]) ]) if test "$ac_cv_header_mmap_anon" = yes; then - AC_DEFINE(HAVE_MMAP_ANONYMOUS) + AC_DEFINE([HAVE_MMAP_ANONYMOUS],[1],[Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if it uses MAP_ANON]) fi ]) # -# Configure a Makefile without clobbering it if it exists and is not out of -# date. This is modified from: -# http://www.gnu.org/software/ac-archive/htmldoc/ac_cxx_have_ext_slist.html -# -AC_DEFUN([AC_CONFIG_MAKEFILE], -[AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1,${srcdir}/autoconf/mkinstalldirs `dirname $1`) -]) - -# # When allocating RWX memory, check whether we need to use /dev/zero # as the file descriptor or not. # -# Note: -# Originally from llvm/autoconf/m4/need_dev_zero_for_mmap.m4, written by -# Reid Spencer. -# AC_DEFUN([AC_NEED_DEV_ZERO_FOR_MMAP], [AC_CACHE_CHECK([if /dev/zero is needed for mmap], ac_cv_need_dev_zero_for_mmap, Index: llvm-poolalloc/autoconf/configure.ac diff -u llvm-poolalloc/autoconf/configure.ac:1.10 llvm-poolalloc/autoconf/configure.ac:1.11 --- llvm-poolalloc/autoconf/configure.ac:1.10 Fri May 27 08:52:00 2005 +++ llvm-poolalloc/autoconf/configure.ac Wed Dec 13 23:51:06 2006 @@ -1,26 +1,28 @@ -dnl Autoconf requirements -dnl AC_INIT(package, version, bug-report-address) -dnl information on the package -dnl checks for programs -dnl checks for libraries -dnl checks for header files -dnl checks for types -dnl checks for structures -dnl checks for compiler characteristics -dnl checks for library functions -dnl checks for system services -dnl AC_CONFIG_FILES([file...]) -dnl AC_OUTPUT - dnl ************************************************************************** dnl * Initialize dnl ************************************************************************** AC_INIT([[[Pool Allocation]]],[[[1.0]]],[llvmbugs at cs.uiuc.edu]) -dnl Place all of the extra autoconf files into the config subdirectory -AC_CONFIG_AUX_DIR([autoconf]) +dnl Identify where LLVM source tree is +LLVM_SRC_ROOT="`(cd $srcdir/../..; pwd)`" +LLVM_OBJ_ROOT="`(cd ../..; pwd)`" + +dnl Tell autoconf that the auxilliary files are actually located in +dnl the LLVM autoconf directory, not here. +AC_CONFIG_AUX_DIR($LLVM_SRC_ROOT/autoconf) + +dnl Tell autoconf that this is an LLVM project being configured +dnl This provides the --with-llvmsrc and --with-llvmobj options +LLVM_CONFIG_PROJECT($LLVM_SRC_ROOT,$LLVM_OBJ_ROOT) + +dnl Verify that the source directory is valid +AC_CONFIG_SRCDIR(["Makefile.common.in"]) + +dnl Configure a common Makefile +AC_CONFIG_FILES(Makefile.common) -dnl Configure Makefiles +dnl Configure project makefiles +dnl List every Makefile that exists within your source tree AC_CONFIG_MAKEFILE(Makefile) AC_CONFIG_MAKEFILE(lib/Makefile) AC_CONFIG_MAKEFILE(lib/PoolAllocate/Makefile) @@ -37,22 +39,12 @@ dnl * Check for programs. dnl ************************************************************************** -dnl Verify that the source directory is valid -AC_CONFIG_SRCDIR(["Makefile.common.in"]) - dnl ************************************************************************** dnl * Check for libraries. dnl ************************************************************************** dnl ************************************************************************** dnl * Checks for header files. -dnl * Chances are, if the standard C or POSIX type header files are missing, -dnl * then LLVM just isn't going to compile. However, it is possible that -dnl * the necessary functions/macros will be included from other -dnl * (non-standard and non-obvious) header files. -dnl * -dnl * So, we'll be gracious, give it a chance, and try to go on without -dnl * them. dnl ************************************************************************** AC_HEADER_MMAP_ANONYMOUS AC_HEADER_STAT @@ -73,18 +65,38 @@ dnl * Enable various compile-time options dnl ************************************************************************** +dnl --enable-safecode: Enable SAFECode functionality +AC_ARG_ENABLE(safecode, + AS_HELP_STRING(--enable-safecode, + [Enable SAFECode functionality (default is NO)]), + AC_DEFINE(SAFECODE,[[1]]), + ) + +dnl --enable-boundscheck: Enable SAFECode Bounds Check functionality +AC_ARG_ENABLE(boundscheck, + AS_HELP_STRING(--enable-boundschecks, + [Enable SAFECode bounds checking (default is NO)]), + AC_DEFINE(BOUNDS_CHECK,[[1]]), + ) + +dnl --enable-llva-kernel: Compile DSA for pool inference +AC_ARG_ENABLE(kernel, + AS_HELP_STRING(--enable-kernel, + [Use SAFECode for use with Linux Kernel (default is NO)]), + AC_DEFINE(LLVA_KERNEL,[[1]]), + ) + dnl ************************************************************************** dnl * Set the location of various third-party software packages dnl ************************************************************************** -dnl Location of LLVM source code -AC_ARG_WITH(llvmsrc,AC_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),AC_SUBST(LLVM_SRC,[$withval]),AC_SUBST(LLVM_SRC,[`cd ${srcdir}/../..; pwd`])) - -dnl Location of LLVM object code -AC_ARG_WITH(llvmobj,AC_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),AC_SUBST(LLVM_OBJ,[$withval]),AC_SUBST(LLVM_OBJ,[`cd ../..; pwd`])) +dnl Location of SAFECode +AC_ARG_WITH(safecodesrc,AS_HELP_STRING(--with-safecode,Location of SAFECode Source Code),AC_SUBST(SAFECODESRC,[$withval]),AC_SUBST(SAFECODESRC,[`cd ../safecode; pwd`])) dnl ************************************************************************** dnl * Create the output files dnl ************************************************************************** AC_CONFIG_HEADERS(include/poolalloc/Config/config.h) -AC_OUTPUT(Makefile.common) + +dnl This must be last +AC_OUTPUT From evan.cheng at apple.com Thu Dec 14 01:54:20 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 14 Dec 2006 01:54:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/VirtRegMap.cpp Message-ID: <200612140754.kBE7sKhC025946@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: VirtRegMap.cpp updated: 1.88 -> 1.89 --- Log message: Fix a long-standing spiller bug: If a spillslot value is available in a register, and there is a noop copy that targets that register, the spiller correctly decide not to invalidate the spillslot register. However, even though the noop copy does not clobbers the value. It does start a new intersecting live range. That means the spillslot register is available for use but should not be reused for a two-address instruction modref operand which would clobber the new live range. When we remove the noop copy, update the available information by clearing the canClobber bit. --- Diffs of the changes: (+35 -1) VirtRegMap.cpp | 36 +++++++++++++++++++++++++++++++++++- 1 files changed, 35 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/VirtRegMap.cpp diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.88 llvm/lib/CodeGen/VirtRegMap.cpp:1.89 --- llvm/lib/CodeGen/VirtRegMap.cpp:1.88 Fri Dec 8 12:45:48 2006 +++ llvm/lib/CodeGen/VirtRegMap.cpp Thu Dec 14 01:54:05 2006 @@ -272,6 +272,8 @@ // invalidate entries in SpillSlotsAvailable when a physreg is modified. std::multimap PhysRegsAvailable; + void disallowClobberPhysRegOnly(unsigned PhysReg); + void ClobberPhysRegOnly(unsigned PhysReg); public: AvailableSpills(const MRegisterInfo *mri, const TargetInstrInfo *tii) @@ -303,7 +305,7 @@ DOUT << "Remembering SS#" << Slot << " in physreg " << MRI->getName(Reg) << "\n"; } - + /// canClobberPhysReg - Return true if the spiller is allowed to change the /// value of the specified stackslot register if it desires. The specified /// stack slot must be available in a physreg for this query to make sense. @@ -312,6 +314,11 @@ return SpillSlotsAvailable.find(Slot)->second & 1; } + /// disallowClobberPhysReg - Unset the CanClobber bit of the specified + /// stackslot register. The register is still available but is no longer + /// allowed to be modifed. + void disallowClobberPhysReg(unsigned PhysReg); + /// ClobberPhysReg - This is called when the specified physreg changes /// value. We use this to invalidate any info about stuff we thing lives in /// it and any of its aliases. @@ -324,6 +331,32 @@ }; } +/// disallowClobberPhysRegOnly - Unset the CanClobber bit of the specified +/// stackslot register. The register is still available but is no longer +/// allowed to be modifed. +void AvailableSpills::disallowClobberPhysRegOnly(unsigned PhysReg) { + std::multimap::iterator I = + PhysRegsAvailable.lower_bound(PhysReg); + while (I != PhysRegsAvailable.end() && I->first == PhysReg) { + int Slot = I->second; + I++; + assert((SpillSlotsAvailable[Slot] >> 1) == PhysReg && + "Bidirectional map mismatch!"); + SpillSlotsAvailable[Slot] &= ~1; + DOUT << "PhysReg " << MRI->getName(PhysReg) + << " copied, it is available for use but can no longer be modified\n"; + } +} + +/// disallowClobberPhysReg - Unset the CanClobber bit of the specified +/// stackslot register and its aliases. The register and its aliases may +/// still available but is no longer allowed to be modifed. +void AvailableSpills::disallowClobberPhysReg(unsigned PhysReg) { + for (const unsigned *AS = MRI->getAliasSet(PhysReg); *AS; ++AS) + disallowClobberPhysRegOnly(*AS); + disallowClobberPhysRegOnly(PhysReg); +} + /// ClobberPhysRegOnly - This is called when the specified physreg changes /// value. We use this to invalidate any info about stuff we thing lives in it. void AvailableSpills::ClobberPhysRegOnly(unsigned PhysReg) { @@ -822,6 +855,7 @@ DOUT << "Removing now-noop copy: " << MI; MBB.erase(&MI); VRM.RemoveFromFoldedVirtMap(&MI); + Spills.disallowClobberPhysReg(VirtReg); goto ProcessNextInst; } From rafael.espindola at gmail.com Thu Dec 14 07:31:44 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 14 Dec 2006 07:31:44 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/addSubConstant.ll Message-ID: <200612141331.kBEDViIA008283@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: addSubConstant.ll added (r1.1) --- Log message: Avoid creating invalid sub/add instructions on the prolog/epilog patch by Lauro --- Diffs of the changes: (+19 -0) addSubConstant.ll | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/test/Regression/CodeGen/ARM/addSubConstant.ll diff -c /dev/null llvm/test/Regression/CodeGen/ARM/addSubConstant.ll:1.1 *** /dev/null Thu Dec 14 07:31:37 2006 --- llvm/test/Regression/CodeGen/ARM/addSubConstant.ll Thu Dec 14 07:31:27 2006 *************** *** 0 **** --- 1,19 ---- + ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm && + ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | not grep "805306384" + + + int %main() { + entry: + %retval = alloca int, align 4 ; [#uses=2] + %tmp = alloca int, align 4 ; [#uses=2] + %a = alloca [805306369 x sbyte], align 16 ; <[805306369 x sbyte]*> [#uses=0] + "alloca point" = bitcast int 0 to int ; [#uses=0] + store int 0, int* %tmp + %tmp = load int* %tmp ; [#uses=1] + store int %tmp, int* %retval + br label %return + + return: ; preds = %entry + %retval = load int* %retval ; [#uses=1] + ret int %retval + } From rafael.espindola at gmail.com Thu Dec 14 07:31:44 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 14 Dec 2006 07:31:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMRegisterInfo.cpp Message-ID: <200612141331.kBEDVi2G008277@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMRegisterInfo.cpp updated: 1.28 -> 1.29 --- Log message: Avoid creating invalid sub/add instructions on the prolog/epilog patch by Lauro --- Diffs of the changes: (+86 -10) ARMRegisterInfo.cpp | 96 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 86 insertions(+), 10 deletions(-) Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.28 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.29 --- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.28 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Thu Dec 14 07:31:27 2006 @@ -35,6 +35,80 @@ return NoFramePointerElim || MFI->hasVarSizedObjects(); } +#define ROTATE32L(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) + +#define ROTATE32R(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) + +// finds the end position of largest sequence of zeros in binary representation +// of 'immediate'. +static int findLargestZeroSequence(unsigned immediate){ + int max_zero_pos; + int max_zero_length = 0; + int zero_pos; + int zero_length; + int pos = 0; + int end_pos; + + while ((immediate & 0x3) == 0) { + immediate = ROTATE32R(immediate, 2); + pos+=2; + } + end_pos = pos+32; + + while (pos max_zero_length){ + max_zero_length = zero_length; + max_zero_pos = zero_pos % 32; + } + + } + + return (max_zero_pos + max_zero_length) % 32; +} + +static void splitInstructionWithImmediate(MachineBasicBlock &BB, + MachineBasicBlock::iterator I, + const TargetInstrDescriptor &TID, + unsigned DestReg, + unsigned OrigReg, + unsigned immediate){ + + if (immediate == 0){ + BuildMI(BB, I, TID, DestReg).addReg(OrigReg).addImm(0) + .addImm(0).addImm(ARMShift::LSL); + return; + } + + int start_pos = findLargestZeroSequence(immediate); + unsigned immediate_tmp = ROTATE32R(immediate, start_pos); + + int pos = 0; + while (pos < 32){ + while(((immediate_tmp&0x3) == 0)&&(pos<32)){ + immediate_tmp = ROTATE32R(immediate_tmp,2); + pos+=2; + } + if (pos < 32){ + BuildMI(BB, I, TID, DestReg).addReg(OrigReg) + .addImm(ROTATE32L(immediate_tmp&0xFF, (start_pos + pos) % 32 )) + .addImm(0).addImm(ARMShift::LSL); + immediate_tmp = ROTATE32R(immediate_tmp,8); + pos+=8; + } + } + +} + ARMRegisterInfo::ARMRegisterInfo(const TargetInstrInfo &tii) : ARMGenRegisterInfo(ARM::ADJCALLSTACKDOWN, ARM::ADJCALLSTACKUP), TII(tii) { @@ -110,13 +184,13 @@ if (Old->getOpcode() == ARM::ADJCALLSTACKDOWN) { // sub sp, sp, amount - BuildMI(MBB, I, TII.get(ARM::SUB), ARM::R13).addReg(ARM::R13).addImm(Amount) - .addImm(0).addImm(ARMShift::LSL); + splitInstructionWithImmediate(MBB, I, TII.get(ARM::SUB), ARM::R13, + ARM::R13, Amount); } else { // add sp, sp, amount assert(Old->getOpcode() == ARM::ADJCALLSTACKUP); - BuildMI(MBB, I, TII.get(ARM::ADD), ARM::R13).addReg(ARM::R13).addImm(Amount) - .addImm(0).addImm(ARMShift::LSL); + splitInstructionWithImmediate(MBB, I, TII.get(ARM::ADD), ARM::R13, + ARM::R13, Amount); } } } @@ -156,8 +230,8 @@ // Insert a set of r12 with the full address // r12 = r13 + offset MachineBasicBlock *MBB2 = MI.getParent(); - BuildMI(*MBB2, II, TII.get(ARM::ADD), ARM::R12).addReg(BaseRegister) - .addImm(Offset).addImm(0).addImm(ARMShift::LSL); + splitInstructionWithImmediate(*MBB2, II, TII.get(ARM::ADD), ARM::R12, + BaseRegister, Offset); // Replace the FrameIndex with r12 MI.getOperand(FrameIdx).ChangeToRegister(ARM::R12, false); @@ -192,8 +266,9 @@ MFI->setStackSize(NumBytes); //sub sp, sp, #NumBytes - BuildMI(MBB, MBBI, TII.get(ARM::SUB), ARM::R13).addReg(ARM::R13).addImm(NumBytes) - .addImm(0).addImm(ARMShift::LSL); + splitInstructionWithImmediate(MBB, MBBI, TII.get(ARM::SUB), ARM::R13, + ARM::R13, NumBytes); + if (HasFP) { BuildMI(MBB, MBBI, TII.get(ARM::STR)) @@ -219,8 +294,9 @@ } //add sp, sp, #NumBytes - BuildMI(MBB, MBBI, TII.get(ARM::ADD), ARM::R13).addReg(ARM::R13).addImm(NumBytes) - .addImm(0).addImm(ARMShift::LSL); + splitInstructionWithImmediate(MBB, MBBI, TII.get(ARM::ADD), ARM::R13, + ARM::R13, NumBytes); + } unsigned ARMRegisterInfo::getRARegister() const { From jlaskey at apple.com Thu Dec 14 11:20:05 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 14 Dec 2006 11:20:05 -0600 Subject: [llvm-commits] CVS: llvm/docs/CodeGenerator.html Message-ID: <200612141720.kBEHK51c012425@zion.cs.uiuc.edu> Changes in directory llvm/docs: CodeGenerator.html updated: 1.42 -> 1.43 --- Log message: Start of PowerPC info. --- Diffs of the changes: (+223 -1) CodeGenerator.html | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 223 insertions(+), 1 deletion(-) Index: llvm/docs/CodeGenerator.html diff -u llvm/docs/CodeGenerator.html:1.42 llvm/docs/CodeGenerator.html:1.43 --- llvm/docs/CodeGenerator.html:1.42 Wed Oct 11 13:00:22 2006 +++ llvm/docs/CodeGenerator.html Thu Dec 14 11:19:50 2006 @@ -84,6 +84,13 @@
  • Target-specific Implementation Notes
  • @@ -1723,6 +1730,221 @@
    + + + +
    +

    The PowerPC code generator lives in the lib/Target/PowerPC directory. The +code generation is retargetable to several variations or subtargets of +the PowerPC ISA; including ppc32, ppc64 and altivec. +

    +
    + + + + +
    +

    LLVM follows the AIX PowerPC ABI, with two deviations. LLVM uses a PC +relative (PIC) or static addressing for accessing global values, so no TOC (r2) +is used. Second, r31 is used as a frame pointer to allow dynamic growth of a +stack frame. LLVM takes advantage of having no TOC to provide space to save +the frame pointer in the PowerPC linkage area of the caller frame. Other +details of PowerPC ABI can be found at PowerPC ABI. Note: +This link describes the 32 bit ABI. The 64 bit ABI is similar except space for +GPRs are 8 bytes wide (not 4) and r13 is reserved for system use.

    +
    + + + + +
    +

    The size of a PowerPC frame is usually fixed for the duration of a +function's invocation. Since the frame is fixed size, all references into +the frame can be accessed via fixed offsets from the stack pointer. The +exception to this is when dynamic alloca or variable sized arrays are present, +then a base pointer (r31) is used as a proxy for the stack pointer and stack +pointer is free to grow or shrink. A base pointer is also used if llvm-gcc is +not passed the -fomit-frame-pointer flag. The stack pointer is always aligned to +16 bytes, so that space allocated for altivec vectors will be properly +aligned.

    +

    An invocation frame is layed out as follows (low memory at top);

    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + +
    Linkage

    Parameter area

    Dynamic area

    Locals area

    Saved registers area


    Previous Frame

    +
    + +
    +

    The linkage area is used by a callee to save special registers prior +to allocating its own frame. Only three entries are relevant to LLVM. The +first entry is the previous stack pointer (sp), aka link. This allows probing +tools like gdb or exception handlers to quickly scan the frames in the stack. A +function epilog can also use the link to pop the frame from the stack. The +third entry in the linkage area is used to save the return address from the lr +register. Finally, as mentioned above, the last entry is used to save the +previous frame pointer (r31.) The entries in the linkage area are the size of a +GPR, thus the linkage area is 24 bytes long in 32 bit mode and 48 bytes in 64 +bit mode.

    +
    + +
    +

    32 bit linkage area

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    0Saved SP (r1)
    4Saved CR
    8Saved LR
    12Reserved
    16Reserved
    20Saved FP (r31)
    +
    + +
    +

    64 bit linkage area

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    0Saved SP (r1)
    8Saved CR
    16Saved LR
    24Reserved
    32Reserved
    40Saved FP (r31)
    +
    + +
    +

    The parameter area is used to store arguments being passed to a callee +function. Following the PowerPC ABI, the first few arguments are actually +passed in registers, with the space in the parameter area unused. However, if +there are not enough registers or the callee is a thunk or vararg function, +these register arguments can be spilled into the parameter area. Thus, the +parameter area must be large enough to store all the parameters for the largest +call sequence made by the caller. The size must also be mimimally large enough +to spill registers r3-r10. This allows callees blind to the call signature, +such as thunks and vararg functions, enough space to cache the argument +registers. Therefore, the parameter area is minimally 32 bytes (64 bytes in 64 +bit mode.) Also note that since the parameter area is a fixed offset from the +top of the frame, that a callee can access its spilt arguments using fixed +offsets from the stack pointer (or base pointer.)

    +
    + +
    +

    Combining the information about the linkage, parameter areas and alignment. A +stack frame is minimally 64 bytes in 32 bit mode and 128 bytes in 64 bit +mode.

    +
    + +
    +

    The dynamic area starts out as size zero. If a function uses dynamic +alloca then space is added to the stack, the linkage and parameter areas are +shifted to top of stack, and the new space is available immediately below the +linkage and parameter areas. The cost of shifting the linkage and parameter +areas is minor since only the link value needs to be copied. The link value can +be easily fetched by adding the original frame size to the base pointer. Note +that allocations in the dynamic space need to observe 16 byte aligment.

    +
    + +
    +

    The locals area is where the llvm compiler reserves space for local +variables.

    +
    + +
    +

    The saved registers area is where the llvm compiler spills callee saved +registers on entry to the callee.

    +
    + + + + +
    +

    The llvm prolog and epilog are the same as described in the PowerPC ABI, with +the following exceptions. Callee saved registers are spilled after the frame is +created. This allows the llvm epilog/prolog support to be common with other +targets. The base pointer callee saved register r31 is saved in the TOC slot of +linkage area. This simplifies allocation of space for the base pointer and +makes it convenient to locate programatically and during debugging.

    +
    + + + + +
    +

    +
    + +TODO - More to come. + +
    @@ -1733,7 +1955,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/10/11 18:00:22 $ + Last modified: $Date: 2006/12/14 17:19:50 $
    From sabre at nondot.org Thu Dec 14 12:22:29 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 14 Dec 2006 12:22:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612141822.kBEIMTwK013401@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.101 -> 1.102 --- Log message: random minor typographical changes --- Diffs of the changes: (+9 -14) PassManager.cpp | 23 +++++++++-------------- 1 files changed, 9 insertions(+), 14 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.101 llvm/lib/VMCore/PassManager.cpp:1.102 --- llvm/lib/VMCore/PassManager.cpp:1.101 Wed Dec 13 18:59:42 2006 +++ llvm/lib/VMCore/PassManager.cpp Thu Dec 14 12:22:14 2006 @@ -33,12 +33,12 @@ // o If Analysis information is dirtied by a pass then regenerate Analysis // information before it is consumed by another pass. // -// Pass Manager Infrastructure uses multipe pass managers. They are PassManager, -// FunctionPassManager, ModulePassManager, BasicBlockPassManager. This class -// hierarcy uses multiple inheritance but pass managers do not derive from -// another pass manager. +// Pass Manager Infrastructure uses multiple pass managers. They are +// PassManager, FunctionPassManager, ModulePassManager, BasicBlockPassManager. +// This class hierarcy uses multiple inheritance but pass managers do not derive +// from another pass manager. // -// PassManager and FunctionPassManager are two top level pass manager that +// PassManager and FunctionPassManager are two top-level pass manager that // represents the external interface of this entire pass manager infrastucture. // // Important classes : @@ -124,7 +124,6 @@ /// PMTopLevelManager manages LastUser info and collects common APIs used by /// top level pass managers. class PMTopLevelManager { - public: inline std::vector::iterator passManagersBegin() { @@ -160,7 +159,6 @@ } virtual ~PMTopLevelManager() { - for (std::vector::iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) delete *I; @@ -219,9 +217,7 @@ /// PMDataManager provides the common place to manage the analysis data /// used by pass managers. class PMDataManager { - public: - PMDataManager(int D) : TPM(NULL), Depth(D) { initializeAnalysisInfo(); } @@ -250,7 +246,7 @@ /// Add pass P into the PassVector. Update /// AvailableAnalysis appropriately if ProcessAnalysis is true. - void addPassToManager (Pass *P, bool ProcessAnalysis = true); + void addPassToManager(Pass *P, bool ProcessAnalysis = true); /// Initialize available analysis information. void initializeAnalysisInfo() { @@ -364,7 +360,7 @@ /// pass together and sequence them to process one basic block before /// processing next basic block. class BasicBlockPassManager : public PMDataManager, - public FunctionPass { + public FunctionPass { public: BasicBlockPassManager(int D) : PMDataManager(D) { } @@ -482,8 +478,7 @@ /// ModulePassManager manages ModulePasses and function pass managers. /// It batches all Module passes passes and function pass managers together and /// sequence them to process one module. -class ModulePassManager : public Pass, - public PMDataManager { +class ModulePassManager : public Pass, public PMDataManager { public: ModulePassManager(int D) : PMDataManager(D) { @@ -965,7 +960,7 @@ if (!manageablePass(P)) return false; - addPassToManager (BP); + addPassToManager(BP); return true; } From rafael.espindola at gmail.com Thu Dec 14 12:58:54 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 14 Dec 2006 12:58:54 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/constants.ll Message-ID: <200612141858.kBEIwsFx013967@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: constants.ll updated: 1.5 -> 1.6 --- Log message: avoid using a constant table when a constant can be used inline --- Diffs of the changes: (+10 -0) constants.ll | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm/test/Regression/CodeGen/ARM/constants.ll diff -u llvm/test/Regression/CodeGen/ARM/constants.ll:1.5 llvm/test/Regression/CodeGen/ARM/constants.ll:1.6 --- llvm/test/Regression/CodeGen/ARM/constants.ll:1.5 Sat Dec 9 20:53:14 2006 +++ llvm/test/Regression/CodeGen/ARM/constants.ll Thu Dec 14 12:58:37 2006 @@ -5,6 +5,7 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ".word.*257" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #-1073741761" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #1008" | wc -l | grep 1 && +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "cmp r0, #65536" | wc -l | grep 1 && ; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "\.comm.*a,4,4" | wc -l | grep 1 %a = internal global int 0 @@ -32,3 +33,12 @@ uint %f6() { ret uint 1008 } + +void %f7(uint %a) { +entry: + %b = setgt uint %a, 65536 + br bool %b, label %r, label %r + +r: + ret void +} From rafael.espindola at gmail.com Thu Dec 14 12:58:53 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 14 Dec 2006 12:58:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Message-ID: <200612141858.kBEIwrYK013962@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.91 -> 1.92 --- Log message: avoid using a constant table when a constant can be used inline --- Diffs of the changes: (+82 -24) ARMISelDAGToDAG.cpp | 106 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 82 insertions(+), 24 deletions(-) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.91 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.92 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.91 Tue Dec 12 11:10:13 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Thu Dec 14 12:58:37 2006 @@ -660,14 +660,91 @@ return DAG.getConstant(DAGFPCCToARMCC(CC), MVT::i32); } +static bool isUInt8Immediate(uint32_t x) { + return x < (1 << 8); +} + +static uint32_t rotateL(uint32_t x) { + uint32_t bit31 = (x & (1 << 31)) >> 31; + uint32_t t = x << 1; + return t | bit31; +} + +static bool isRotInt8Immediate(uint32_t x) { + int r; + for (r = 0; r < 16; r++) { + if (isUInt8Immediate(x)) + return true; + x = rotateL(rotateL(x)); + } + return false; +} + +static void LowerCMP(SDOperand &Cmp, SDOperand &ARMCC, SDOperand LHS, + SDOperand RHS, ISD::CondCode CC, SelectionDAG &DAG) { + MVT::ValueType vt = LHS.getValueType(); + if (vt == MVT::i32) { + assert(!isa(LHS)); + if (ConstantSDNode *SD_C = dyn_cast(RHS.Val)) { + uint32_t C = SD_C->getValue(); + + uint32_t NC; + switch(CC) { + default: + NC = C; break; + case ISD::SETLT: + case ISD::SETULT: + case ISD::SETGE: + case ISD::SETUGE: + NC = C - 1; break; + case ISD::SETLE: + case ISD::SETULE: + case ISD::SETGT: + case ISD::SETUGT: + NC = C + 1; break; + } + + ISD::CondCode NCC; + switch(CC) { + default: + NCC = CC; break; + case ISD::SETLT: + NCC = ISD::SETLE; break; + case ISD::SETULT: + NCC = ISD::SETULE; break; + case ISD::SETGE: + NCC = ISD::SETGT; break; + case ISD::SETUGE: + NCC = ISD::SETUGT; break; + case ISD::SETLE: + NCC = ISD::SETLT; break; + case ISD::SETULE: + NCC = ISD::SETULT; break; + case ISD::SETGT: + NCC = ISD::SETGE; break; + case ISD::SETUGT: + NCC = ISD::SETUGE; break; + } + + if (!isRotInt8Immediate(C) && isRotInt8Immediate(NC)) { + RHS = DAG.getConstant(NC, MVT::i32); + CC = NCC; + } + } + } + Cmp = GetCMP(CC, LHS, RHS, DAG); + ARMCC = GetARMCC(CC, vt, DAG); +} + static SDOperand LowerSELECT_CC(SDOperand Op, SelectionDAG &DAG) { SDOperand LHS = Op.getOperand(0); SDOperand RHS = Op.getOperand(1); ISD::CondCode CC = cast(Op.getOperand(4))->get(); SDOperand TrueVal = Op.getOperand(2); SDOperand FalseVal = Op.getOperand(3); - SDOperand Cmp = GetCMP(CC, LHS, RHS, DAG); - SDOperand ARMCC = GetARMCC(CC, LHS.getValueType(), DAG); + SDOperand Cmp; + SDOperand ARMCC; + LowerCMP(Cmp, ARMCC, LHS, RHS, CC, DAG); return DAG.getNode(ARMISD::SELECT, MVT::i32, TrueVal, FalseVal, ARMCC, Cmp); } @@ -677,8 +754,9 @@ SDOperand LHS = Op.getOperand(2); SDOperand RHS = Op.getOperand(3); SDOperand Dest = Op.getOperand(4); - SDOperand Cmp = GetCMP(CC, LHS, RHS, DAG); - SDOperand ARMCC = GetARMCC(CC, LHS.getValueType(), DAG); + SDOperand Cmp; + SDOperand ARMCC; + LowerCMP(Cmp, ARMCC, LHS, RHS, CC, DAG); return DAG.getNode(ARMISD::BR, MVT::Other, Chain, Dest, ARMCC, Cmp); } @@ -820,26 +898,6 @@ return isInt12Immediate(Op.Val, Imm); } -static uint32_t rotateL(uint32_t x) { - uint32_t bit31 = (x & (1 << 31)) >> 31; - uint32_t t = x << 1; - return t | bit31; -} - -static bool isUInt8Immediate(uint32_t x) { - return x < (1 << 8); -} - -static bool isRotInt8Immediate(uint32_t x) { - int r; - for (r = 0; r < 16; r++) { - if (isUInt8Immediate(x)) - return true; - x = rotateL(rotateL(x)); - } - return false; -} - bool ARMDAGToDAGISel::SelectAddrMode1(SDOperand Op, SDOperand N, SDOperand &Arg, From jlaskey at apple.com Thu Dec 14 13:17:52 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 14 Dec 2006 13:17:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612141917.kBEJHqXW014329@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.440 -> 1.441 --- Log message: 1. Tidy up jump table info. 2. Allow the jit to handle PIC relocable jump tables. --- Diffs of the changes: (+12 -5) LegalizeDAG.cpp | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.440 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.441 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.440 Wed Dec 13 14:57:08 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Dec 14 13:17:33 2006 @@ -14,6 +14,7 @@ #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFrameInfo.h" +#include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetMachine.h" @@ -1275,13 +1276,19 @@ SDOperand Index = Result.getOperand(2); MVT::ValueType PTy = TLI.getPointerTy(); - bool isPIC = TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_; - // PIC jump table entries are 32-bit values. - unsigned EntrySize = isPIC ? 4 : MVT::getSizeInBits(PTy)/8; + MachineFunction &MF = DAG.getMachineFunction(); + unsigned EntrySize = MF.getJumpTableInfo()->getEntrySize(); Index= DAG.getNode(ISD::MUL, PTy, Index, DAG.getConstant(EntrySize, PTy)); SDOperand Addr = DAG.getNode(ISD::ADD, PTy, Index, Table); - SDOperand LD = DAG.getLoad(isPIC ? MVT::i32 : PTy, Chain, Addr, NULL, 0); - if (isPIC) { + + SDOperand LD; + switch (EntrySize) { + default: assert(0 && "Size of jump table not supported yet."); break; + case 4: LD = DAG.getLoad(MVT::i32, Chain, Addr, NULL, 0); break; + case 8: LD = DAG.getLoad(MVT::i64, Chain, Addr, NULL, 0); break; + } + + if (TLI.getTargetMachine().getRelocationModel() == Reloc::PIC_) { // For PIC, the sequence is: // BRIND(load(Jumptable + index) + RelocBase) // RelocBase is the JumpTable on PPC and X86, GOT on Alpha From jlaskey at apple.com Thu Dec 14 13:17:52 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 14 Dec 2006 13:17:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineFunction.cpp AsmPrinter.cpp Message-ID: <200612141917.kBEJHq9Q014326@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineFunction.cpp updated: 1.105 -> 1.106 AsmPrinter.cpp updated: 1.124 -> 1.125 --- Log message: 1. Tidy up jump table info. 2. Allow the jit to handle PIC relocable jump tables. --- Diffs of the changes: (+32 -37) AsmPrinter.cpp | 51 +++++++++++++++++++++++---------------------------- MachineFunction.cpp | 18 +++++++++--------- 2 files changed, 32 insertions(+), 37 deletions(-) Index: llvm/lib/CodeGen/MachineFunction.cpp diff -u llvm/lib/CodeGen/MachineFunction.cpp:1.105 llvm/lib/CodeGen/MachineFunction.cpp:1.106 --- llvm/lib/CodeGen/MachineFunction.cpp:1.105 Thu Dec 7 14:28:15 2006 +++ llvm/lib/CodeGen/MachineFunction.cpp Thu Dec 14 13:17:33 2006 @@ -21,6 +21,7 @@ #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Target/TargetData.h" +#include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Function.h" @@ -117,7 +118,14 @@ MFInfo = 0; FrameInfo = new MachineFrameInfo(); ConstantPool = new MachineConstantPool(TM.getTargetData()); - JumpTableInfo = new MachineJumpTableInfo(TM.getTargetData()); + + // Set up jump table. + const TargetData &TD = *TM.getTargetData(); + bool IsPic = TM.getRelocationModel() == Reloc::PIC_; + unsigned EntrySize = IsPic ? 4 : TD.getPointerSize(); + unsigned Alignment = IsPic ? TD.getIntAlignment() : TD.getPointerAlignment(); + JumpTableInfo = new MachineJumpTableInfo(EntrySize, Alignment); + BasicBlocks.Parent = this; } @@ -380,14 +388,6 @@ } } -unsigned MachineJumpTableInfo::getEntrySize() const { - return TD->getPointerSize(); -} - -unsigned MachineJumpTableInfo::getAlignment() const { - return TD->getPointerAlignment(); -} - void MachineJumpTableInfo::dump() const { print(*cerr.stream()); } Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.124 llvm/lib/CodeGen/AsmPrinter.cpp:1.125 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.124 Mon Dec 11 23:18:19 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Thu Dec 14 13:17:33 2006 @@ -188,36 +188,31 @@ MachineFunction &MF) { const std::vector &JT = MJTI->getJumpTables(); if (JT.empty()) return; - const TargetData *TD = TM.getTargetData(); + bool IsPic = TM.getRelocationModel() == Reloc::PIC_; - // JTEntryDirective is a string to print sizeof(ptr) for non-PIC jump tables, - // and 32 bits for PIC since PIC jump table entries are differences, not - // pointers to blocks. - // Use the architecture specific relocation directive, if it is set + // Use JumpTableDirective otherwise honor the entry size from the jump table + // info. const char *JTEntryDirective = TAI->getJumpTableDirective(); - if (!JTEntryDirective) - JTEntryDirective = TAI->getData32bitsDirective(); + bool HadJTEntryDirective = JTEntryDirective != NULL; + if (!HadJTEntryDirective) { + JTEntryDirective = MJTI->getEntrySize() == 4 ? + TAI->getData32bitsDirective() : TAI->getData64bitsDirective(); + } // Pick the directive to use to print the jump table entries, and switch to // the appropriate section. - if (TM.getRelocationModel() == Reloc::PIC_) { - TargetLowering *LoweringInfo = TM.getTargetLowering(); - if (LoweringInfo && LoweringInfo->usesGlobalOffsetTable()) { - SwitchToDataSection(TAI->getJumpTableDataSection()); - if (TD->getPointerSize() == 8 && !JTEntryDirective) - JTEntryDirective = TAI->getData64bitsDirective(); - } else { - // In PIC mode, we need to emit the jump table to the same section as the - // function body itself, otherwise the label differences won't make sense. - const Function *F = MF.getFunction(); - SwitchToTextSection(getSectionForFunction(*F).c_str(), F); - } + TargetLowering *LoweringInfo = TM.getTargetLowering(); + + if (IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) { + // In PIC mode, we need to emit the jump table to the same section as the + // function body itself, otherwise the label differences won't make sense. + const Function *F = MF.getFunction(); + SwitchToTextSection(getSectionForFunction(*F).c_str(), F); } else { SwitchToDataSection(TAI->getJumpTableDataSection()); - if (TD->getPointerSize() == 8) - JTEntryDirective = TAI->getData64bitsDirective(); } - EmitAlignment(Log2_32(TD->getPointerAlignment())); + + EmitAlignment(Log2_32(MJTI->getAlignment())); for (unsigned i = 0, e = JT.size(); i != e; ++i) { const std::vector &JTBBs = JT[i].MBBs; @@ -229,7 +224,7 @@ // the number of relocations the assembler will generate for the jump table. // Set directives are all printed before the jump table itself. std::set EmittedSets; - if (TAI->getSetDirective() && TM.getRelocationModel() == Reloc::PIC_) + if (TAI->getSetDirective() && IsPic) for (unsigned ii = 0, ee = JTBBs.size(); ii != ee; ++ii) if (EmittedSets.insert(JTBBs[ii]).second) printSetLabel(i, JTBBs[ii]); @@ -247,12 +242,12 @@ if (!EmittedSets.empty()) { O << TAI->getPrivateGlobalPrefix() << getFunctionNumber() << '_' << i << "_set_" << JTBBs[ii]->getNumber(); - } else if (TM.getRelocationModel() == Reloc::PIC_) { + } else if (IsPic) { printBasicBlockLabel(JTBBs[ii], false, false); - //If the arch uses custom Jump Table directives, don't calc relative to JT - if (!TAI->getJumpTableDirective()) - O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" - << getFunctionNumber() << '_' << i; + //If the arch uses custom Jump Table directives, don't calc relative to JT + if (!HadJTEntryDirective) + O << '-' << TAI->getPrivateGlobalPrefix() << "JTI" + << getFunctionNumber() << '_' << i; } else { printBasicBlockLabel(JTBBs[ii], false, false); } From jlaskey at apple.com Thu Dec 14 13:17:55 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 14 Dec 2006 13:17:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Message-ID: <200612141917.kBEJHtgb014336@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JITEmitter.cpp updated: 1.121 -> 1.122 --- Log message: 1. Tidy up jump table info. 2. Allow the jit to handle PIC relocable jump tables. --- Diffs of the changes: (+36 -17) JITEmitter.cpp | 53 ++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 36 insertions(+), 17 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.121 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.122 --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.121 Thu Dec 7 14:04:42 2006 +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Dec 14 13:17:33 2006 @@ -25,6 +25,7 @@ #include "llvm/ExecutionEngine/GenericValue.h" #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetJITInfo.h" +#include "llvm/Target/TargetMachine.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MutexGuard.h" #include "llvm/ADT/Statistic.h" @@ -700,7 +701,7 @@ void emitConstantPool(MachineConstantPool *MCP); void initJumpTableInfo(MachineJumpTableInfo *MJTI); - void emitJumpTableInfo(MachineJumpTableInfo *MJTI); + void emitJumpTableInfo(MachineJumpTableInfo *MJTI, Reloc::Model RM); virtual void startFunctionStub(unsigned StubSize, unsigned Alignment = 1); virtual void* finishFunctionStub(const Function *F); @@ -791,7 +792,7 @@ abort(); } - emitJumpTableInfo(F.getJumpTableInfo()); + emitJumpTableInfo(F.getJumpTableInfo(), F.getTarget().getRelocationModel()); // FnStart is the start of the text, not the start of the constant pool and // other per-function data. @@ -821,7 +822,7 @@ MR.doesntNeedFunctionStub()); } else if (MR.isBasicBlock()) { ResultPtr = (void*)getMachineBasicBlockAddress(MR.getBasicBlock()); - } else if (MR.isConstantPoolIndex()){ + } else if (MR.isConstantPoolIndex()) { ResultPtr=(void*)getConstantPoolEntryAddress(MR.getConstantPoolIndex()); } else { assert(MR.isJumpTableIndex()); @@ -914,22 +915,38 @@ JumpTableBase = allocateSpace(NumEntries * EntrySize, MJTI->getAlignment()); } -void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI) { +void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI, Reloc::Model RM){ const std::vector &JT = MJTI->getJumpTables(); if (JT.empty() || JumpTableBase == 0) return; - - assert(MJTI->getEntrySize() == sizeof(void*) && "Cross JIT'ing?"); - // For each jump table, map each target in the jump table to the address of - // an emitted MachineBasicBlock. - intptr_t *SlotPtr = (intptr_t*)JumpTableBase; - - for (unsigned i = 0, e = JT.size(); i != e; ++i) { - const std::vector &MBBs = JT[i].MBBs; - // Store the address of the basic block for this jump table slot in the - // memory we allocated for the jump table in 'initJumpTableInfo' - for (unsigned mi = 0, me = MBBs.size(); mi != me; ++mi) - *SlotPtr++ = getMachineBasicBlockAddress(MBBs[mi]); + if (RM == Reloc::PIC_) { + assert(MJTI->getEntrySize() == 4 && "Cross JIT'ing?"); + // For each jump table, place the offset from the beginning of the table + // to the target address. + int *SlotPtr = (int*)JumpTableBase; + + for (unsigned i = 0, e = JT.size(); i != e; ++i) { + const std::vector &MBBs = JT[i].MBBs; + // Store the offset of the basic block for this jump table slot in the + // memory we allocated for the jump table in 'initJumpTableInfo' + intptr_t Base = (intptr_t)SlotPtr; + for (unsigned mi = 0, me = MBBs.size(); mi != me; ++mi) + *SlotPtr++ = (intptr_t)getMachineBasicBlockAddress(MBBs[mi]) - Base; + } + } else { + assert(MJTI->getEntrySize() == sizeof(void*) && "Cross JIT'ing?"); + + // For each jump table, map each target in the jump table to the address of + // an emitted MachineBasicBlock. + intptr_t *SlotPtr = (intptr_t*)JumpTableBase; + + for (unsigned i = 0, e = JT.size(); i != e; ++i) { + const std::vector &MBBs = JT[i].MBBs; + // Store the address of the basic block for this jump table slot in the + // memory we allocated for the jump table in 'initJumpTableInfo' + for (unsigned mi = 0, me = MBBs.size(); mi != me; ++mi) + *SlotPtr++ = getMachineBasicBlockAddress(MBBs[mi]); + } } } @@ -972,7 +989,9 @@ unsigned EntrySize = JumpTable->getEntrySize(); for (unsigned i = 0; i < Index; ++i) - Offset += JT[i].MBBs.size() * EntrySize; + Offset += JT[i].MBBs.size(); + + Offset *= EntrySize; return (intptr_t)((char *)JumpTableBase + Offset); } From jlaskey at apple.com Thu Dec 14 13:17:55 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 14 Dec 2006 13:17:55 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Message-ID: <200612141917.kBEJHtWJ014341@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineJumpTableInfo.h updated: 1.8 -> 1.9 --- Log message: 1. Tidy up jump table info. 2. Allow the jit to handle PIC relocable jump tables. --- Diffs of the changes: (+6 -3) MachineJumpTableInfo.h | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h diff -u llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.8 llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.9 --- llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.8 Sat Oct 28 13:21:51 2006 +++ llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Thu Dec 14 13:17:33 2006 @@ -39,9 +39,11 @@ class MachineJumpTableInfo { const TargetData *TD; + unsigned EntrySize; std::vector JumpTables; public: - MachineJumpTableInfo(const TargetData *td) : TD(td) {} + MachineJumpTableInfo(const TargetData *td, unsigned ES) + : TD(td), EntrySize(ES) {} /// getJumpTableIndex - Create a new jump table or return an existing one. /// @@ -77,8 +79,9 @@ return MadeChange; } - /// getEntrySize - returns the size of an individual field in a jump table - unsigned getEntrySize() const; + /// getEntrySize - Returns the size of an individual field in a jump table. + /// + unsigned getEntrySize() const { return EntrySize; } /// getAlignment - returns the target's preferred alignment for jump tables unsigned getAlignment() const; From evan.cheng at apple.com Thu Dec 14 13:43:26 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 14 Dec 2006 13:43:26 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrSSE.td Message-ID: <200612141943.kBEJhQNS014745@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrSSE.td updated: 1.173 -> 1.174 --- Log message: - Rename MOVDSS2DIrr to MOVSS2DIrr for consistency sake. - Add MOVDI2SSrm and MOVSS2DImr to fold load / store for i32 <-> f32 bit_convert patterns. --- Diffs of the changes: (+9 -3) X86InstrSSE.td | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86InstrSSE.td diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.173 llvm/lib/Target/X86/X86InstrSSE.td:1.174 --- llvm/lib/Target/X86/X86InstrSSE.td:1.173 Tue Dec 5 12:45:06 2006 +++ llvm/lib/Target/X86/X86InstrSSE.td Thu Dec 14 13:43:11 2006 @@ -1687,6 +1687,9 @@ "movd {$src, $dst|$dst, $src}", [(set FR32:$dst, (bitconvert GR32:$src))]>; +def MOVDI2SSrm : PDI<0x6E, MRMSrcMem, (ops FR32:$dst, i32mem:$src), + "movd {$src, $dst|$dst, $src}", + [(set FR32:$dst, (bitconvert (loadi32 addr:$src)))]>; // SSE2 instructions with XS prefix def MOVQI2PQIrm : I<0x7E, MRMSrcMem, (ops VR128:$dst, i64mem:$src), @@ -1729,9 +1732,12 @@ [(store (i32 (vector_extract (v4i32 VR128:$src), (iPTR 0))), addr:$dst)]>; -def MOVDSS2DIrr : PDI<0x7E, MRMDestReg, (ops GR32:$dst, FR32:$src), - "movd {$src, $dst|$dst, $src}", - [(set GR32:$dst, (bitconvert FR32:$src))]>; +def MOVSS2DIrr : PDI<0x7E, MRMDestReg, (ops GR32:$dst, FR32:$src), + "movd {$src, $dst|$dst, $src}", + [(set GR32:$dst, (bitconvert FR32:$src))]>; +def MOVSS2DImr : PDI<0x7E, MRMDestMem, (ops i32mem:$dst, FR32:$src), + "movd {$src, $dst|$dst, $src}", + [(store (i32 (bitconvert FR32:$src)), addr:$dst)]>; // Move to lower bits of a VR128, leaving upper bits alone. From evan.cheng at apple.com Thu Dec 14 13:45:00 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 14 Dec 2006 13:45:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200612141945.kBEJj07u014781@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86RegisterInfo.cpp updated: 1.184 -> 1.185 --- Log message: Added MOVSS2DIrr and MOVDI2SSrr to foldMemeoryOperand(). --- Diffs of the changes: (+2 -0) X86RegisterInfo.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.184 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.185 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.184 Thu Dec 7 16:21:48 2006 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Thu Dec 14 13:44:45 2006 @@ -511,6 +511,7 @@ { X86::MOVPQIto64rr,X86::MOVPQIto64mr }, { X86::MOVPS2SSrr, X86::MOVPS2SSmr }, { X86::MOVSDrr, X86::MOVSDmr }, + { X86::MOVSS2DIrr, X86::MOVSS2DImr }, { X86::MOVSSrr, X86::MOVSSmr }, { X86::MOVUPDrr, X86::MOVUPDmr }, { X86::MOVUPSrr, X86::MOVUPSmr }, @@ -612,6 +613,7 @@ { X86::MOVAPSrr, X86::MOVAPSrm }, { X86::MOVDDUPrr, X86::MOVDDUPrm }, { X86::MOVDI2PDIrr, X86::MOVDI2PDIrm }, + { X86::MOVDI2SSrr, X86::MOVDI2SSrm }, { X86::MOVSD2PDrr, X86::MOVSD2PDrm }, { X86::MOVSDrr, X86::MOVSDrm }, { X86::MOVSHDUPrr, X86::MOVSHDUPrm }, From evan.cheng at apple.com Thu Dec 14 13:45:47 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 14 Dec 2006 13:45:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README-SSE.txt Message-ID: <200612141945.kBEJjlTT014820@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README-SSE.txt updated: 1.12 -> 1.13 --- Log message: This is done. --- Diffs of the changes: (+0 -5) README-SSE.txt | 5 ----- 1 files changed, 5 deletions(-) Index: llvm/lib/Target/X86/README-SSE.txt diff -u llvm/lib/Target/X86/README-SSE.txt:1.12 llvm/lib/Target/X86/README-SSE.txt:1.13 --- llvm/lib/Target/X86/README-SSE.txt:1.12 Wed Dec 13 14:59:43 2006 +++ llvm/lib/Target/X86/README-SSE.txt Thu Dec 14 13:45:32 2006 @@ -535,8 +535,3 @@ Floating point max / min are commutable when -enable-unsafe-fp-path is specified. We should turn int_x86_sse_max_ss and X86ISD::FMIN etc. into other nodes which are selected to max / min instructions that are marked commutable. - -//===---------------------------------------------------------------------===// - -Add MOVDI2SSrr and MOVDSS2DIrr to X86RegisterInfo::foldMemoryOperand() once the -recent X86 JIT regressions have been identified and fixed. From evan.cheng at apple.com Thu Dec 14 13:46:21 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 14 Dec 2006 13:46:21 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrX86-64.td Message-ID: <200612141946.kBEJkLVG014842@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrX86-64.td updated: 1.11 -> 1.12 --- Log message: Fix a couple of typo's. --- Diffs of the changes: (+2 -2) X86InstrX86-64.td | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86InstrX86-64.td diff -u llvm/lib/Target/X86/X86InstrX86-64.td:1.11 llvm/lib/Target/X86/X86InstrX86-64.td:1.12 --- llvm/lib/Target/X86/X86InstrX86-64.td:1.11 Tue Dec 5 13:50:18 2006 +++ llvm/lib/Target/X86/X86InstrX86-64.td Thu Dec 14 13:46:06 2006 @@ -1119,10 +1119,10 @@ (v2i64 (scalar_to_vector (loadi64 addr:$src))))]>; def MOVPQIto64rr : RPDI<0x7E, MRMDestReg, (ops GR64:$dst, VR128:$src), - "movd {$src, $dst|$dst, $src}", + "movq {$src, $dst|$dst, $src}", [(set GR64:$dst, (vector_extract (v2i64 VR128:$src), (iPTR 0)))]>; def MOVPQIto64mr : RPDI<0x7E, MRMDestMem, (ops i64mem:$dst, VR128:$src), - "movd {$src, $dst|$dst, $src}", + "movq {$src, $dst|$dst, $src}", [(store (i64 (vector_extract (v2i64 VR128:$src), (iPTR 0))), addr:$dst)]>; From jlaskey at apple.com Thu Dec 14 15:03:32 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 14 Dec 2006 15:03:32 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Message-ID: <200612142103.kBEL3WbU016053@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineJumpTableInfo.h updated: 1.9 -> 1.10 --- Log message: File missing from last check in. --- Diffs of the changes: (+4 -4) MachineJumpTableInfo.h | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h diff -u llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.9 llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.10 --- llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.9 Thu Dec 14 13:17:33 2006 +++ llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Thu Dec 14 15:03:17 2006 @@ -38,12 +38,12 @@ }; class MachineJumpTableInfo { - const TargetData *TD; unsigned EntrySize; + unsigned Alignment; std::vector JumpTables; public: - MachineJumpTableInfo(const TargetData *td, unsigned ES) - : TD(td), EntrySize(ES) {} + MachineJumpTableInfo(unsigned Size, unsigned Align) + : EntrySize(Size), Alignment(Align) {} /// getJumpTableIndex - Create a new jump table or return an existing one. /// @@ -84,7 +84,7 @@ unsigned getEntrySize() const { return EntrySize; } /// getAlignment - returns the target's preferred alignment for jump tables - unsigned getAlignment() const; + unsigned getAlignment() const { return Alignment; } /// print - Used by the MachineFunction printer to print information about /// jump tables. Implemented in MachineFunction.cpp From evan.cheng at apple.com Thu Dec 14 15:55:54 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 14 Dec 2006 15:55:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86InstrX86-64.td X86RegisterInfo.cpp Message-ID: <200612142155.kBELtshc017038@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.305 -> 1.306 X86InstrX86-64.td updated: 1.12 -> 1.13 X86RegisterInfo.cpp updated: 1.185 -> 1.186 --- Log message: f64 <-> i64 bit_convert using movq in 64-bit mode. --- Diffs of the changes: (+16 -4) X86ISelLowering.cpp | 4 ---- X86InstrX86-64.td | 14 ++++++++++++++ X86RegisterInfo.cpp | 2 ++ 3 files changed, 16 insertions(+), 4 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.305 llvm/lib/Target/X86/X86ISelLowering.cpp:1.306 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.305 Sun Dec 10 17:12:42 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Dec 14 15:55:39 2006 @@ -158,10 +158,6 @@ setOperationAction(ISD::BIT_CONVERT , MVT::f32 , Expand); setOperationAction(ISD::BIT_CONVERT , MVT::i32 , Expand); } - if (Subtarget->is64Bit()) { - setOperationAction(ISD::BIT_CONVERT , MVT::f64 , Expand); - setOperationAction(ISD::BIT_CONVERT , MVT::i64 , Expand); - } setOperationAction(ISD::BR_JT , MVT::Other, Expand); setOperationAction(ISD::BRCOND , MVT::Other, Custom); Index: llvm/lib/Target/X86/X86InstrX86-64.td diff -u llvm/lib/Target/X86/X86InstrX86-64.td:1.12 llvm/lib/Target/X86/X86InstrX86-64.td:1.13 --- llvm/lib/Target/X86/X86InstrX86-64.td:1.12 Thu Dec 14 13:46:06 2006 +++ llvm/lib/Target/X86/X86InstrX86-64.td Thu Dec 14 15:55:39 2006 @@ -1126,3 +1126,17 @@ "movq {$src, $dst|$dst, $src}", [(store (i64 (vector_extract (v2i64 VR128:$src), (iPTR 0))), addr:$dst)]>; + +def MOV64toSDrr : RPDI<0x6E, MRMSrcReg, (ops FR64:$dst, GR64:$src), + "movq {$src, $dst|$dst, $src}", + [(set FR64:$dst, (bitconvert GR64:$src))]>; +def MOV64toSDrm : RPDI<0x6E, MRMSrcMem, (ops FR64:$dst, i64mem:$src), + "movq {$src, $dst|$dst, $src}", + [(set FR64:$dst, (bitconvert (loadi64 addr:$src)))]>; + +def MOVSDto64rr : RPDI<0x7E, MRMDestReg, (ops GR64:$dst, FR64:$src), + "movq {$src, $dst|$dst, $src}", + [(set GR64:$dst, (bitconvert FR64:$src))]>; +def MOVSDto64mr : RPDI<0x7E, MRMDestMem, (ops i64mem:$dst, FR64:$src), + "movq {$src, $dst|$dst, $src}", + [(store (i64 (bitconvert FR64:$src)), addr:$dst)]>; Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.185 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.186 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.185 Thu Dec 14 13:44:45 2006 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Thu Dec 14 15:55:39 2006 @@ -511,6 +511,7 @@ { X86::MOVPQIto64rr,X86::MOVPQIto64mr }, { X86::MOVPS2SSrr, X86::MOVPS2SSmr }, { X86::MOVSDrr, X86::MOVSDmr }, + { X86::MOVSDto64rr, X86::MOVSDto64mr }, { X86::MOVSS2DIrr, X86::MOVSS2DImr }, { X86::MOVSSrr, X86::MOVSSmr }, { X86::MOVUPDrr, X86::MOVUPDmr }, @@ -608,6 +609,7 @@ { X86::MOV32rr, X86::MOV32rm }, { X86::MOV64rr, X86::MOV64rm }, { X86::MOV64toPQIrr, X86::MOV64toPQIrm }, + { X86::MOV64toSDrr, X86::MOV64toSDrm }, { X86::MOV8rr, X86::MOV8rm }, { X86::MOVAPDrr, X86::MOVAPDrm }, { X86::MOVAPSrr, X86::MOVAPSrm }, From jlaskey at apple.com Thu Dec 14 16:53:57 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 14 Dec 2006 16:53:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Message-ID: <200612142253.kBEMrvcx017970@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JITEmitter.cpp updated: 1.122 -> 1.123 --- Log message: Simplify the fetching of relocation mode. --- Diffs of the changes: (+4 -4) JITEmitter.cpp | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.122 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.123 --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.122 Thu Dec 14 13:17:33 2006 +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Dec 14 16:53:42 2006 @@ -701,7 +701,7 @@ void emitConstantPool(MachineConstantPool *MCP); void initJumpTableInfo(MachineJumpTableInfo *MJTI); - void emitJumpTableInfo(MachineJumpTableInfo *MJTI, Reloc::Model RM); + void emitJumpTableInfo(MachineJumpTableInfo *MJTI); virtual void startFunctionStub(unsigned StubSize, unsigned Alignment = 1); virtual void* finishFunctionStub(const Function *F); @@ -792,7 +792,7 @@ abort(); } - emitJumpTableInfo(F.getJumpTableInfo(), F.getTarget().getRelocationModel()); + emitJumpTableInfo(F.getJumpTableInfo()); // FnStart is the start of the text, not the start of the constant pool and // other per-function data. @@ -915,11 +915,11 @@ JumpTableBase = allocateSpace(NumEntries * EntrySize, MJTI->getAlignment()); } -void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI, Reloc::Model RM){ +void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI) { const std::vector &JT = MJTI->getJumpTables(); if (JT.empty() || JumpTableBase == 0) return; - if (RM == Reloc::PIC_) { + if (TargetMachine::getRelocationModel() == Reloc::PIC_) { assert(MJTI->getEntrySize() == 4 && "Cross JIT'ing?"); // For each jump table, place the offset from the beginning of the table // to the target address. From dpatel at apple.com Thu Dec 14 18:08:41 2006 From: dpatel at apple.com (Devang Patel) Date: Thu, 14 Dec 2006 18:08:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612150008.kBF08f2O019240@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.102 -> 1.103 --- Log message: s/ForcedLastUses/TransferLastUses/g Register pass has the its last user, otherwise sometimes no one will claim LastUse. Handle transferred last uses from child pass manager. --- Diffs of the changes: (+26 -12) PassManager.cpp | 38 ++++++++++++++++++++++++++------------ 1 files changed, 26 insertions(+), 12 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.102 llvm/lib/VMCore/PassManager.cpp:1.103 --- llvm/lib/VMCore/PassManager.cpp:1.102 Thu Dec 14 12:22:14 2006 +++ llvm/lib/VMCore/PassManager.cpp Thu Dec 14 18:08:26 2006 @@ -250,7 +250,7 @@ /// Initialize available analysis information. void initializeAnalysisInfo() { - ForcedLastUses.clear(); + TransferLastUses.clear(); AvailableAnalysis.clear(); } @@ -330,12 +330,18 @@ cerr << "\n"; } } + + std::vector& getTransferredLastUses() { + return TransferLastUses; + } + protected: - // Collection of pass whose last user asked this manager to claim - // last use. If a FunctionPass F is the last user of ModulePass info M + // If a FunctionPass F is the last user of ModulePass info M // then the F's manager, not F, records itself as a last user of M. - std::vector ForcedLastUses; + // Current pass manage is requesting parent manager to record parent + // manager as the last user of these TrransferLastUses passes. + std::vector TransferLastUses; // Top level manager. PMTopLevelManager *TPM; @@ -853,7 +859,7 @@ LastUses.push_back(PRequired); else if (PDepth > RDepth) { // Let the parent claim responsibility of last use - ForcedLastUses.push_back(PRequired); + TransferLastUses.push_back(PRequired); } else { // Note : This feature is not yet implemented assert (0 && @@ -861,8 +867,8 @@ } } - if (!LastUses.empty()) - TPM->setLastUser(LastUses, P); + LastUses.push_back(P); + TPM->setLastUser(LastUses, P); // Take a note of analysis required and made available by this pass. // Remove the analysis not preserved by this pass @@ -1161,10 +1167,14 @@ // Add pass into new manager. This time it must succeed. if (!activeBBPassManager->addPass(BP)) assert(0 && "Unable to add Pass"); + + // If activeBBPassManager transfered any Last Uses then handle them here. + std::vector &TLU = activeBBPassManager->getTransferredLastUses(); + if (!TLU.empty()) + TPM->setLastUser(TLU, this); + } - if (!ForcedLastUses.empty()) - TPM->setLastUser(ForcedLastUses, this); return true; } @@ -1326,10 +1336,14 @@ // Add pass into new manager. This time it must succeed. if (!activeFunctionPassManager->addPass(FP)) assert(0 && "Unable to add pass"); - } - if (!ForcedLastUses.empty()) - TPM->setLastUser(ForcedLastUses, this); + // If activeFunctionPassManager transfered any Last Uses then + // handle them here. + std::vector &TLU = + activeFunctionPassManager->getTransferredLastUses(); + if (!TLU.empty()) + TPM->setLastUser(TLU, this); + } return true; } From evan.cheng at apple.com Thu Dec 14 21:00:11 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 14 Dec 2006 21:00:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612150300.kBF30B49021807@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.441 -> 1.442 --- Log message: Expand FP compares to soft-fp call(s) --- Diffs of the changes: (+102 -7) LegalizeDAG.cpp | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 102 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.441 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.442 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.441 Thu Dec 14 13:17:33 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Dec 14 20:59:56 2006 @@ -2011,10 +2011,10 @@ isCustom = true; // FALLTHROUGH. case TargetLowering::Legal: - Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Node->getOperand(2)); + Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Tmp3); if (isCustom) { - Tmp3 = TLI.LowerOperation(Result, DAG); - if (Tmp3.Val) Result = Tmp3; + Tmp4 = TLI.LowerOperation(Result, DAG); + if (Tmp4.Val) Result = Tmp4; } break; case TargetLowering::Promote: { @@ -2045,7 +2045,7 @@ } Tmp1 = LegalizeOp(Tmp1); Tmp2 = LegalizeOp(Tmp2); - Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Node->getOperand(2)); + Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Tmp3); Result = LegalizeOp(Result); break; } @@ -2055,7 +2055,7 @@ MVT::ValueType VT = Node->getValueType(0); Result = DAG.getNode(ISD::SELECT_CC, VT, Tmp1, Tmp2, DAG.getConstant(1, VT), DAG.getConstant(0, VT), - Node->getOperand(2)); + Tmp3); break; } break; @@ -3533,10 +3533,104 @@ } } break; - case Expand: + case Expand: { + MVT::ValueType VT = LHS.getValueType(); + if (VT == MVT::f32 || VT == MVT::f64) { + // Expand into one or more soft-fp libcall(s). + const char *FnName1 = NULL, *FnName2 = NULL; + ISD::CondCode CC1, CC2; + switch (cast(CC)->get()) { + case ISD::SETEQ: + case ISD::SETOEQ: + FnName1 = (VT == MVT::f32) ? "__eqsf2" : "__eqdf2"; + CC1 = ISD::SETEQ; + break; + case ISD::SETNE: + case ISD::SETUNE: + FnName1 = (VT == MVT::f32) ? "__nesf2" : "__nedf2"; + CC1 = ISD::SETNE; + break; + case ISD::SETGE: + case ISD::SETOGE: + FnName1 = (VT == MVT::f32) ? "__gesf2" : "__gedf2"; + CC1 = ISD::SETGE; + break; + case ISD::SETLT: + case ISD::SETOLT: + FnName1 = (VT == MVT::f32) ? "__ltsf2" : "__ltdf2"; + CC1 = ISD::SETLT; + break; + case ISD::SETLE: + case ISD::SETOLE: + FnName1 = (VT == MVT::f32) ? "__lesf2" : "__ledf2"; + CC1 = ISD::SETLE; + break; + case ISD::SETGT: + case ISD::SETOGT: + FnName1 = (VT == MVT::f32) ? "__gtsf2" : "__gtdf2"; + CC1 = ISD::SETGT; + break; + case ISD::SETUO: + case ISD::SETO: + FnName1 = (VT == MVT::f32) ? "__unordsf2" : "__unorddf2"; + CC1 = cast(CC)->get() == ISD::SETO + ? ISD::SETEQ : ISD::SETNE; + break; + default: + FnName1 = (VT == MVT::f32) ? "__unordsf2" : "__unorddf2"; + CC1 = ISD::SETNE; + switch (cast(CC)->get()) { + case ISD::SETONE: + // SETONE = SETOLT | SETOGT + FnName1 = (VT == MVT::f32) ? "__ltsf2" : "__ltdf2"; + CC1 = ISD::SETLT; + // Fallthrough + case ISD::SETUGT: + FnName2 = (VT == MVT::f32) ? "__gtsf2" : "__gtdf2"; + CC2 = ISD::SETGT; + break; + case ISD::SETUGE: + FnName2 = (VT == MVT::f32) ? "__gesf2" : "__gedf2"; + CC2 = ISD::SETGE; + break; + case ISD::SETULT: + FnName2 = (VT == MVT::f32) ? "__ltsf2" : "__ltdf2"; + CC2 = ISD::SETLT; + break; + case ISD::SETULE: + FnName2 = (VT == MVT::f32) ? "__lesf2" : "__ledf2"; + CC2 = ISD::SETLE; + break; + case ISD::SETUEQ: + FnName2 = (VT == MVT::f32) ? "__eqsf2" : "__eqdf2"; + CC2 = ISD::SETEQ; + break; + default: assert(0 && "Unsupported FP setcc!"); + } + } + + SDOperand Dummy; + Tmp1 = ExpandLibCall(FnName1, + DAG.getNode(ISD::MERGE_VALUES, VT, LHS, RHS).Val, Dummy); + Tmp2 = DAG.getConstant(0, MVT::i32); + CC = DAG.getCondCode(CC1); + if (FnName2) { + Tmp1 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultTy(), Tmp1, Tmp2, CC); + LHS = ExpandLibCall(FnName2, + DAG.getNode(ISD::MERGE_VALUES, VT, LHS, RHS).Val, Dummy); + Tmp2 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultTy(), LHS, Tmp2, + DAG.getCondCode(CC2)); + Tmp1 = DAG.getNode(ISD::OR, Tmp1.getValueType(), Tmp1, Tmp2); + Tmp2 = SDOperand(); + } + LHS = Tmp1; + RHS = Tmp2; + return; + } + SDOperand LHSLo, LHSHi, RHSLo, RHSHi; ExpandOp(LHS, LHSLo, LHSHi); - ExpandOp(RHS, RHSLo, RHSHi); + ExpandOp(RHS, RHSLo, RHSHi); switch (cast(CC)->get()) { case ISD::SETEQ: case ISD::SETNE: @@ -3596,6 +3690,7 @@ Tmp2 = SDOperand(); } } + } LHS = Tmp1; RHS = Tmp2; } From rspencer at reidspencer.com Thu Dec 14 21:48:09 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Thu, 14 Dec 2006 19:48:09 -0800 Subject: [llvm-commits] SETCC Patches: #3 In-Reply-To: <27C0F155-7340-4DE8-9EBA-DD2D4224D4E7@apple.com> References: <1165794220.15266.89.camel@bashful.x10sys.com> <27C0F155-7340-4DE8-9EBA-DD2D4224D4E7@apple.com> Message-ID: <1166154489.2855.35.camel@bashful.x10sys.com> Hi Chris, Some feedback on your review .. On Mon, 2006-12-11 at 22:51 -0800, Chris Lattner wrote: > > On Dec 10, 2006, at 3:43 PM, Reid Spencer wrote: > > > All, > > > > > > Here's the SETCC patch to convert SetCondInst (SetCC) instructions > > into > > ICmpInst. Here's somethings you should know about this patch: > > > > This is all the rest, except for instcombine. Most of the changes you suggested were just done. There's a couple questions below that I need the answers for. > > > Index: tools/llvm-upgrade/UpgradeParser.y > =================================================================== > RCS file: /var/cvs/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y,v > retrieving revision 1.24 > diff -t -d -u -p -5 -r1.24 UpgradeParser.y > --- tools/llvm-upgrade/UpgradeParser.y 9 Dec 2006 19:40:41 -0000 1.24 > +++ tools/llvm-upgrade/UpgradeParser.y 10 Dec 2006 23:27:00 -0000 > @@ -21,11 +21,11 @@ > #include > > > > #define YYERROR_VERBOSE 1 > #define YYINCLUDED_STDLIB_H > #define YYDEBUG 1 > -#define UPGRADE_SETCOND_OPS 0 > +#define UPGRADE_SETCOND_OPS 1 > #define GENERATE_FCMP_INSTS 0 > > > > int yylex(); // declaration" of xxx warnings. > int yyparse(); > extern int yydebug; > > > This #ifdef should go away now, since it's always on. Yup. Done. > > > > > Index: lib/ExecutionEngine/Interpreter/Execution.cpp > =================================================================== > RCS > file: /var/cvs/llvm/llvm/lib/ExecutionEngine/Interpreter/Execution.cpp,v > retrieving revision 1.152 > diff -t -d -u -p -5 -r1.152 Execution.cpp > --- lib/ExecutionEngine/Interpreter/Execution.cpp 7 Dec 2006 01:30:31 > -0000 1.152 > +++ lib/ExecutionEngine/Interpreter/Execution.cpp 10 Dec 2006 23:26:54 > -0000 > ... > > > +static GenericValue executeICMP_ULT(GenericValue Src1, GenericValue > Src2, > + const Type *Ty) { > + GenericValue Dest; > + switch (Ty->getTypeID()) { > + IMPLEMENT_CMP(<, UByte); > + IMPLEMENT_CMP(<, UShort); > + IMPLEMENT_CMP(<, UInt); > + IMPLEMENT_CMP(<, ULong); > + IMPLEMENT_POINTERCMP(<); > + default: > + cerr << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n"; > + abort(); > + } > + return Dest; > +} > > > The interpreter is broken: all unsigned comparisons with signed > operands will hit the unhandled type case. Yup. Fixed the macro to take two arguments. The first is to match the type of the operand. The second is the type to use to pull the values out of the GenericValue union, effecitvely doing the type cast by field selection. > > > > > Index: lib/Target/CBackend/Writer.cpp > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/Target/CBackend/Writer.cpp,v > retrieving revision 1.294 > diff -t -d -u -p -5 -r1.294 Writer.cpp > --- lib/Target/CBackend/Writer.cpp 7 Dec 2006 23:41:45 -0000 1.294 > +++ lib/Target/CBackend/Writer.cpp 10 Dec 2006 23:26:54 -0000 > @@ -712,10 +717,44 @@ void CWriter::printConstant(Constant *CP > case Instruction::SetGT: Out << " > "; break; > case Instruction::SetGE: Out << " >= "; break; > case Instruction::Shl: Out << " << "; break; > case Instruction::LShr: > case Instruction::AShr: Out << " >> "; break; > + case Instruction::ICmp: > + switch (CE->getPredicate()) { > + case ICmpInst::ICMP_EQ: Out << " == "; break; > + case ICmpInst::ICMP_NE: Out << " != "; break; > + case ICmpInst::ICMP_SLT: > + case ICmpInst::ICMP_ULT: Out << " < "; break; > + case ICmpInst::ICMP_SLE: > + case ICmpInst::ICMP_ULE: Out << " <= "; break; > ... > > > This apparently doesn't cast the operands of icmp constant exprs to > the right sign. It does, you just didn't see it in the patch because that part didn't change. > > > > > > > @@ -1122,10 +1161,65 @@ void CWriter::writeOperandWithCast(Value > + > +// generateCompilerSpecificCode - This is where we add conditional > compilation > +// directives to cater to specific compilers as need be. > +// > + > // generateCompilerSpecificCode - This is where we add conditional > compilation > // directives to cater to specific compilers as need be. > // > > > ... There ya go again, trying to inflate your LOC count. Just a blunder. > > > > > @@ -1982,10 +2076,49 @@ void CWriter::visitBinaryOperator(Instru > if (needsCast) { > Out << "))"; > } > } > > > > +void CWriter::visitICmpInst(Instruction &I) { > + // icmp instruction. > + assert(isa(I)); > + > > > Drop the isa and later casts, change the argument to visitICmpInst to > ICmpInst. Yup. The patch didn't catch up with the visitICmpInst change. This was actually a bug. It provided an overload of visitICmpInst that would never be called. Unfortunately there's no -Woverload-nonvirtual option :) > > > > > Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > =================================================================== > RCS > file: /var/cvs/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp,v > retrieving revision 1.326 > diff -t -d -u -p -5 -r1.326 SelectionDAGISel.cpp > --- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 9 Dec 2006 02:42:38 > -0000 1.326 > +++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp 10 Dec 2006 23:26:53 > -0000 > > + BOp = cast(Cond); > + ISD::CondCode Condition; > + if (SetCondInst *SCI = dyn_cast(Cond)) { > + ISD::CondCode SignCond, UnsCond, FPCond; > + switch (BOp->getOpcode()) { > + default: assert(0 && "Unknown setcc opcode!"); > + case Instruction::SetEQ: > + SignCond = ISD::SETEQ; > + UnsCond = ISD::SETEQ; > + FPCond = ISD::SETOEQ; > + break; > + case Instruction::SetNE: > + SignCond = ISD::SETNE; > + UnsCond = ISD::SETNE; > + FPCond = ISD::SETUNE; > + break; > + case Instruction::SetLE: > + SignCond = ISD::SETLE; > + UnsCond = ISD::SETULE; > + FPCond = ISD::SETOLE; > + break; > + case Instruction::SetGE: > + SignCond = ISD::SETGE; > + UnsCond = ISD::SETUGE; > + FPCond = ISD::SETOGE; > + break; > + case Instruction::SetLT: > + SignCond = ISD::SETLT; > + UnsCond = ISD::SETULT; > + FPCond = ISD::SETOLT; > + break; > + case Instruction::SetGT: > + SignCond = ISD::SETGT; > + UnsCond = ISD::SETUGT; > + FPCond = ISD::SETOGT; > + break; > + } > + const Type *OpType = SCI->getOperand(0)->getType(); > + if (const PackedType *PTy = dyn_cast(OpType)) > + OpType = PTy->getElementType(); > + > + if (!FiniteOnlyFPMath() && OpType->isFloatingPoint()) > + Condition = FPCond; > + else if (OpType->isUnsigned()) > + Condition = UnsCond; > + else > + Condition = SignCond; > > > You can drop UnsCond here, as SetCondInst doesn't apply to integers > anymore. Yup. Done. I changed it to FOCond (FiniteOnly) and FPCond. > > > > > + } else if (FCmpInst *FC = dyn_cast(Cond)) { > + switch (FC->getPredicate()) { > + default: assert(0 && "Unknown fcmp predicate opcode!"); > + case FCmpInst::FCMP_FALSE: Condition = ISD::SETFALSE; break; > + case FCmpInst::FCMP_OEQ: Condition = ISD::SETOEQ; break; > + case FCmpInst::FCMP_OGT: Condition = ISD::SETOGT; break; > + case FCmpInst::FCMP_OGE: Condition = ISD::SETOGE; break; > + case FCmpInst::FCMP_OLT: Condition = ISD::SETOLT; break; > + case FCmpInst::FCMP_OLE: Condition = ISD::SETOLE; break; > + case FCmpInst::FCMP_ONE: Condition = ISD::SETONE; break; > + case FCmpInst::FCMP_ORD: Condition = ISD::SETO; break; > + case FCmpInst::FCMP_UNO: Condition = ISD::SETUO; break; > + case FCmpInst::FCMP_UEQ: Condition = ISD::SETUEQ; break; > + case FCmpInst::FCMP_UGT: Condition = ISD::SETUGT; break; > + case FCmpInst::FCMP_UGE: Condition = ISD::SETUGE; break; > + case FCmpInst::FCMP_ULT: Condition = ISD::SETULT; break; > + case FCmpInst::FCMP_ULE: Condition = ISD::SETULE; break; > + case FCmpInst::FCMP_UNE: Condition = ISD::SETUNE; break; > + case FCmpInst::FCMP_TRUE: Condition = ISD::SETTRUE; break; > + } > > > This (when it becomes active) isn't sufficient. When FiniteOnlyFPMath > is enabled, all the 'o's and 'u's should get dropped. Right, missed that. One question: For the FCMP_ORD and FCMP_UNO cases, what should the FininteOnlyFPMath condition be? There isn't really a mapping for it, right? Just make it the same as the regular case? > > > void SelectionDAGLowering::visitFCmp(User &I) { > + FCmpInst::Predicate predicate = FCmpInst::BAD_FCMP_PREDICATE; > + if (FCmpInst *FC = dyn_cast(&I)) > > > likewise. Right. > > > diff -t -d -u -p -5 -r1.107 SimplifyCFG.cpp > --- lib/Transforms/Utils/SimplifyCFG.cpp 27 Nov 2006 01:05:10 -0000 > 1.107 > +++ lib/Transforms/Utils/SimplifyCFG.cpp 10 Dec 2006 23:26:51 -0000 > @@ -388,23 +390,43 @@ static bool DominatesMergePoint(Value *V > } > > > > return true; > } > > > > -// GatherConstantSetEQs - Given a potentially 'or'd together > collection of seteq > -// instructions that compare a value against a constant, return the > value being > -// compared, and stick the constant into the Values vector. > +// GatherConstantSetEQs - Given a potentially 'or'd together > collection of > +// icmp_eq instructions that compare a value against a constant, > return the > +// value being compared, and stick the constant into the Values > vector. > static Value *GatherConstantSetEQs(Value *V, > std::vector &Values){ > if (Instruction *Inst = dyn_cast(V)) > if (Inst->getOpcode() == Instruction::SetEQ) { > if (ConstantInt *C = > dyn_cast(Inst->getOperand(1))) { > Values.push_back(C); > return Inst->getOperand(0); > } else if (ConstantInt *C = > dyn_cast(Inst->getOperand(0))) { > Values.push_back(C); > return Inst->getOperand(1); > } > > > This code is dead because integer seteq can't exist anymore (it's > icmp). > > > + } else if (Inst->getOpcode() == Instruction::ICmp && > + cast(Inst)->getPredicate() == ICmpInst::ICMP_EQ) { > + if (ConstantInt *C = > dyn_cast(Inst->getOperand(1))) { > + Values.push_back(C); > + return Inst->getOperand(0); > + } else if (ConstantInt *C = > dyn_cast(Inst->getOperand(0))) { > + Values.push_back(C); > + return Inst->getOperand(1); > + } > + } else if (FCmpInst *FCI = dyn_cast(Inst)) { > + FCmpInst::Predicate pred = FCI->getPredicate(); > + if (pred == FCmpInst::FCMP_ONE || pred == FCmpInst::FCMP_UNE) { > + if (ConstantInt *C = > dyn_cast(Inst->getOperand(1))) { > + Values.push_back(C); > + return Inst->getOperand(0); > + } else if (ConstantInt *C = > dyn_cast(Inst->getOperand(0))){ > + Values.push_back(C); > + return Inst->getOperand(1); > + } > + } > > > FCmpInst's can't have constantint operands, this code is dead. Done. > > > @@ -423,10 +445,30 @@ static Value *GatherConstantSetNEs(Value > return Inst->getOperand(0); > } else if (ConstantInt *C = > dyn_cast(Inst->getOperand(0))) { > Values.push_back(C); > return Inst->getOperand(1); > } > + } else if (Inst->getOpcode() == Instruction::ICmp && > + cast(Inst)->getPredicate() == > ICmpInst::ICMP_NE) { > + if (ConstantInt *C = > dyn_cast(Inst->getOperand(1))) { > + Values.push_back(C); > + return Inst->getOperand(0); > + } else if (ConstantInt *C = > dyn_cast(Inst->getOperand(0))) { > + Values.push_back(C); > + return Inst->getOperand(1); > + } > + } else if (FCmpInst *FCI = dyn_cast(Inst)) { > + FCmpInst::Predicate pred = FCI->getPredicate(); > + if (pred == FCmpInst::FCMP_ONE || pred == FCmpInst::FCMP_UNE) { > + if (ConstantInt *C = > dyn_cast(Inst->getOperand(1))) { > + Values.push_back(C); > + return Inst->getOperand(0); > + } else if (ConstantInt *C = > dyn_cast(Inst->getOperand(0))){ > + Values.push_back(C); > + return Inst->getOperand(1); > + } > + } > > > > > Likewise. Since you're handling integers, you can nuke the old > SetCondInst code here. Done. > > > > > > > > > @@ -845,12 +887,11 @@ static bool HoistThenElseCodeToIf(Branch > // identical order. > BasicBlock *BB1 = BI->getSuccessor(0); // The true destination. > BasicBlock *BB2 = BI->getSuccessor(1); // The false destination > > > > Instruction *I1 = BB1->begin(), *I2 = BB2->begin(); > - if (I1->getOpcode() != I2->getOpcode() || !I1->isIdenticalTo(I2) || > - isa(I1) || isa(I1)) > + if (!I1->isIdenticalTo(I2) || isa(I1) || > isa(I1)) > return false; > > > > // If we get here, we can hoist at least one instruction. > BasicBlock *BIParent = BI->getParent(); > > > > > > Why did you drop the opcode check? It is a fast reject path. Because it is redundant with isIdenticalTo. I'll put it back to save the function call. > > @@ -868,11 +909,11 @@ static bool HoistThenElseCodeToIf(Branch > I2->replaceAllUsesWith(I1); > BB2->getInstList().erase(I2); > > > > I1 = BB1->begin(); > I2 = BB2->begin(); > - } while (I1->getOpcode() == I2->getOpcode() && > I1->isIdenticalTo(I2)); > + } while (I1->isIdenticalTo(I2)); > > > likewise. > I put it back. > > > Index: lib/Transforms/Utils/CloneFunction.cpp > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/Transforms/Utils/CloneFunction.cpp,v > retrieving revision 1.33 > diff -t -d -u -p -5 -r1.33 CloneFunction.cpp > --- lib/Transforms/Utils/CloneFunction.cpp 5 Nov 2006 19:31:28 -0000 > 1.33 > +++ lib/Transforms/Utils/CloneFunction.cpp 10 Dec 2006 23:26:50 -0000 > @@ -276,16 +276,19 @@ void PruningFunctionCloner::CloneBlock(c > > > > /// ConstantFoldMappedInstruction - Constant fold the specified > instruction, > /// mapping its operands through ValueMap if they are available. > Constant *PruningFunctionCloner:: > ConstantFoldMappedInstruction(const Instruction *I) { > - if (isa(I) || isa(I)) { > + if (isa(I) || isa(I) || isa(I)) > { > if (Constant *Op0 = > dyn_cast_or_null(MapValue(I->getOperand(0), > > ValueMap))) > if (Constant *Op1 = > dyn_cast_or_null(MapValue(I->getOperand(1), > > ValueMap))) > - return ConstantExpr::get(I->getOpcode(), Op0, Op1); > + return isa(I) ? > + ConstantExpr::getCompare(I->getOpcode(), > + cast(I)->getPredicate(), Op0, Op1) : > + ConstantExpr::get(I->getOpcode(), Op0, Op1); > return 0; > } > > > > It seems more natural to split CmpInst out from binop/shift handling > into a separate if, to eliminate the ternary operator. Okay, I split it out. > > > > > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/Reassociate.cpp,v > retrieving revision 1.68 > diff -t -d -u -p -5 -r1.68 Reassociate.cpp > --- lib/Transforms/Scalar/Reassociate.cpp 7 Dec 2006 20:04:42 -0000 > 1.68 > +++ lib/Transforms/Scalar/Reassociate.cpp 10 Dec 2006 23:26:49 -0000 > @@ -754,12 +755,12 @@ void Reassociate::ReassociateBB(BasicBlo > MadeChange = true; > BI = NI; > } > > > > // Reject cases where it is pointless to do this. > - if (!isa(BI) || BI->getType()->isFloatingPoint() > || > - isa(BI->getType())) > + if (!isa(BI) || BI->getType()->isFloatingPoint() > || > + isa(BI->getType())) > continue; // Floating point ops are not associative. > > > > > This change looks like an incorrect indentation change. Yeah, I think I had a change in there and then backed it out. We actually don't want to match CmpInst and now that CmpInst is not a subclass of BinaryOperator, that's exactly what it gives us. I'll fix the indentation. > > > > > > > Index: lib/Transforms/Scalar/LoopUnswitch.cpp > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp,v > retrieving revision 1.51 > diff -t -d -u -p -5 -r1.51 LoopUnswitch.cpp > --- lib/Transforms/Scalar/LoopUnswitch.cpp 6 Dec 2006 17:46:33 -0000 > 1.51 > +++ lib/Transforms/Scalar/LoopUnswitch.cpp 10 Dec 2006 23:26:48 -0000 > @@ -486,11 +486,14 @@ static void EmitPreheaderBranchOnConditi > Instruction *InsertPt) { > // Insert a conditional branch on LIC to the two preheaders. The > original > // code is the true version and the new code is the false version. > Value *BranchVal = LIC; > if (!isa(Val)) { > - BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", > InsertPt); > + if (Val->getType()->isFloatingPoint()) > + BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", > InsertPt); > + else > + BranchVal = new ICmpInst(ICmpInst::ICMP_EQ, LIC, Val, "tmp", > InsertPt); > } else if (Val != ConstantBool::getTrue()) { > // We want to enter the new loop when the condition is true. > std::swap(TrueDest, FalseDest); > } > > > > It's not obvious from immediate context, but this is always an integer > comparison. Okay, I deleted the FP case and removed the (now) unnecessary { and } > > > > diff -t -d -u -p -5 -r1.98 LoopStrengthReduce.cpp > --- lib/Transforms/Scalar/LoopStrengthReduce.cpp 7 Dec 2006 01:30:31 > -0000 1.98 > +++ lib/Transforms/Scalar/LoopStrengthReduce.cpp 10 Dec 2006 23:26:48 > -0000 > @@ -1187,14 +1187,20 @@ void LoopStrengthReduce::OptimizeIndvars > PHINode *SomePHI = cast(L->getHeader()->begin()); > BasicBlock *Preheader = L->getLoopPreheader(); > BasicBlock *LatchBlock = > SomePHI->getIncomingBlock(SomePHI->getIncomingBlock(0) == > Preheader); > BranchInst *TermBr = > dyn_cast(LatchBlock->getTerminator()); > + bool isICmp; > if (!TermBr || TermBr->isUnconditional() || > - !isa(TermBr->getCondition())) > + (!(isICmp = isa(TermBr->getCondition()) && > + !isa(TermBr->getCondition())))) > return; > - SetCondInst *Cond = cast(TermBr->getCondition()); > + Instruction *Cond; > + if (isICmp) > + Cond = cast(TermBr->getCondition()); > + else > + Cond = cast(TermBr->getCondition()); > > > > > This code only cares about integer comparisons. Please change Cond to > be ICmpInst*. Okay. Done. > > > > > > > @@ -1223,11 +1229,14 @@ void LoopStrengthReduce::OptimizeIndvars > if (&*++BasicBlock::iterator(Cond) != (Instruction*)TermBr) { > if (Cond->hasOneUse()) { // Condition has a single use, just > move it. > Cond->moveBefore(TermBr); > } else { > // Otherwise, clone the terminating condition and insert into > the loopend. > - Cond = cast(Cond->clone()); > + if (isICmp) > + Cond = cast(Cond->clone()); > + else > + Cond = cast(Cond->clone()); > Cond->setName(L->getHeader()->getName() + ".termcond"); > LatchBlock->getInstList().insert(TermBr, Cond); > > > > // Clone the IVUse, as the old use still exists! > IVUsesByStride[*CondStride].addUser(CondUse->Offset, Cond, > > > Likewise. Done. > > > @@ -1344,19 +1353,26 @@ void LoopStrengthReduce::runOnLoop(Loop > // If all four cases above are true, then we can remove both > the add and > // the cann indvar. > // FIXME: this needs to eliminate an induction variable even if > it's being > // compared against some value to decide loop termination. > if (PN->hasOneUse()) { > - BinaryOperator *BO = > dyn_cast(*(PN->use_begin())); > - if (BO && BO->hasOneUse()) { > - if (PN == *(BO->use_begin())) { > + if (BinaryOperator *BO = > dyn_cast(*(PN->use_begin()))) { > + if (BO->hasOneUse() && PN == *(BO->use_begin())) { > DeadInsts.insert(BO); > // Break the cycle, then delete the PHI. > PN->replaceAllUsesWith(UndefValue::get(PN->getType())); > SE->deleteInstructionFromRecords(PN); > PN->eraseFromParent(); > } > + } else if (CmpInst *CI = > dyn_cast(*(PN->use_begin()))) { > + if (CI->hasOneUse() && PN == *(CI->use_begin())) { > + DeadInsts.insert(CI); > + // Break the cycle, then delete the PHI. > + PN->replaceAllUsesWith(UndefValue::get(PN->getType())); > + SE->deleteInstructionFromRecords(PN); > + PN->eraseFromParent(); > + } > > Instead of cloning the code, how about something like: > > > // FIXME: this needs to eliminate an induction variable even if > it's being > // compared against some value to decide loop termination. > if (PN->hasOneUse()) { > Instruction *BO = *PN->use_begin(); > if (isa(BO) || isa(BO)) { > + if (BO->hasOneUse() && PN == *(BO->use_begin())) { > DeadInsts.insert(BO); > // Break the cycle, then delete the PHI. > PN->replaceAllUsesWith(UndefValue::get(PN->getType())); > SE->deleteInstructionFromRecords(PN); > PN->eraseFromParent(); > } Yes, that's much better. > > > > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp,v > retrieving revision 1.74 > diff -t -d -u -p -5 -r1.74 SimplifyLibCalls.cpp > --- lib/Transforms/IPO/SimplifyLibCalls.cpp 6 Dec 2006 17:46:32 -0000 > 1.74 > +++ lib/Transforms/IPO/SimplifyLibCalls.cpp 10 Dec 2006 23:26:42 -0000 > @@ -941,10 +941,16 @@ static bool IsOnlyUsedInEqualsZeroCompar > if (User->getOpcode() == Instruction::SetNE || > User->getOpcode() == Instruction::SetEQ) { > if (isa(User->getOperand(1)) && > cast(User->getOperand(1))->isNullValue()) > continue; > + } else if (ICmpInst *IC = dyn_cast(User)) { > + if ((IC->getPredicate() == ICmpInst::ICMP_NE || > + IC->getPredicate() == ICmpInst::ICMP_EQ) && > + isa(IC->getOperand(1)) && > + cast(IC->getOperand(1))->isNullValue()) > + continue; > } else if (CastInst *CI = dyn_cast(User)) > if (CI->getType() == Type::BoolTy) > continue; > // Unknown instruction. > return false; > > > The FP case is dead here. Removed. > > > @@ -1769,13 +1775,13 @@ public: > // isascii(c) -> (unsigned)c < 128 > Value *V = CI->getOperand(1); > if (V->getType()->isSigned()) > V = CastInst::createInferredCast(V, > V->getType()->getUnsignedVersion(), > V->getName(), CI); > - Value *Cmp = BinaryOperator::createSetLT(V, > ConstantInt::get(V->getType(), > - > 128), > - V->getName()+".isascii", > CI); > + Value *Cmp = new ICmpInst(ICmpInst::ICMP_ULT, V, > + ConstantInt::get(V->getType(), 128), > + V->getName()+".isascii", CI); > if (Cmp->getType() != CI->getType()) > Cmp = CastInst::createInferredCast( > Cmp, CI->getType(), Cmp->getName(), CI); > CI->replaceAllUsesWith(Cmp); > CI->eraseFromParent(); > > > > > > > You can drop the createInferredCast (which should have been a bitcast) > now that compares are signless? Yup, gone. > > > diff -t -d -u -p -5 -r1.78 GlobalOpt.cpp > --- lib/Transforms/IPO/GlobalOpt.cpp 7 Dec 2006 01:30:31 -0000 1.78 > +++ lib/Transforms/IPO/GlobalOpt.cpp 10 Dec 2006 23:26:41 -0000 > @@ -722,15 +722,53 @@ static GlobalVariable *OptimizeGlobalAdd > std::vector Stores; > while (!GV->use_empty()) > if (LoadInst *LI = dyn_cast(GV->use_back())) { > while (!LI->use_empty()) { > Use &LoadUse = LI->use_begin().getUse(); > - if (!isa(LoadUse.getUser())) > - LoadUse = RepValue; > - else { > + if (CmpInst *CI = dyn_cast(LoadUse.getUser())) { > + // Replace the cmp X, 0 with a use of the bool value. > + Value *LV = new LoadInst(InitBool, > InitBool->getName()+".val", CI); > + InitBoolUsed = true; > + switch (CI->getPredicate()) { > + default: assert(0 && "Unknown ICmp Predicate!"); > + case FCmpInst::FCMP_OLT: > + case FCmpInst::FCMP_ULT: > + case ICmpInst::ICMP_ULT: > + case ICmpInst::ICMP_SLT: > + LV = ConstantBool::getFalse(); // X < null -> always > false > + break; > + case FCmpInst::FCMP_ULE: > + case FCmpInst::FCMP_OLE: > + case FCmpInst::FCMP_OEQ: > + case FCmpInst::FCMP_UEQ: > + case ICmpInst::ICMP_ULE: > + case ICmpInst::ICMP_SLE: > + case ICmpInst::ICMP_EQ: > + LV = BinaryOperator::createNot(LV, "notinit", CI); > + break; > + case ICmpInst::ICMP_NE: > + case ICmpInst::ICMP_UGE: > + case ICmpInst::ICMP_SGE: > + case ICmpInst::ICMP_UGT: > + case ICmpInst::ICMP_SGT: > + case FCmpInst::FCMP_FALSE: > + case FCmpInst::FCMP_OGT: > + case FCmpInst::FCMP_OGE: > + case FCmpInst::FCMP_ONE: > + case FCmpInst::FCMP_ORD: > + case FCmpInst::FCMP_UNO: > + case FCmpInst::FCMP_UGT: > + case FCmpInst::FCMP_UGE: > + case FCmpInst::FCMP_UNE: > + case FCmpInst::FCMP_TRUE: > + break; // no change. > + } > + CI->replaceAllUsesWith(LV); > + CI->eraseFromParent(); > + } > + else if (SetCondInst *SCI = > dyn_cast(LoadUse.getUser())) { > // Replace the setcc X, 0 with a use of the bool value. > > > > > This code is walking the use list of a global variable, so all the FP > cases (including the SetCondInst case) are dead: only pointer compares > are possible. Yup, that's much cleaner. > > > > > @@ -746,10 +784,12 @@ static GlobalVariable *OptimizeGlobalAdd > break; // no change. > } > SCI->replaceAllUsesWith(LV); > SCI->eraseFromParent(); > } > + else > + LoadUse = RepValue; > } > LI->eraseFromParent(); > > > > > I strongly prefer that you restore this code to its original order. > Putting the short case at the bottom makes it harder to read the code, > even if it makes dyn_cast more natural. Okay. Done. > > > > > Index: lib/Transforms/ExprTypeConvert.cpp > =================================================================== > RCS file: /var/cvs/llvm/llvm/lib/Transforms/ExprTypeConvert.cpp,v > retrieving revision 1.115 > diff -t -d -u -p -5 -r1.115 ExprTypeConvert.cpp > --- lib/Transforms/ExprTypeConvert.cpp 7 Dec 2006 01:30:31 -0000 1.115 > +++ lib/Transforms/ExprTypeConvert.cpp 10 Dec 2006 23:26:40 -0000 > @@ -456,10 +456,27 @@ static bool OperandConvertibleToType(Use > > > > > > > + case Instruction::FCmp: { > + FCmpInst::Predicate pred = cast(I)->getPredicate(); > + if (pred == FCmpInst::FCMP_OEQ || pred == FCmpInst::FCMP_UEQ || > + pred == FCmpInst::FCMP_ONE || pred == FCmpInst::FCMP_UNE) { > + Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : > 0); > + return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD); > + } > + return false; > + } > case Instruction::SetEQ: > case Instruction::SetNE: { > Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0); > return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD); > } > > > This code (FCmp and SetEQ/SetNE) is dead, only integer types can get > this far. Okay. Done. > > > @@ -721,10 +738,37 @@ static void ConvertOperandToType(User *U > ... > Res->setOperand(!OtherIdx, NewVal) > ;+ case Instruction::FCmp: { > + FCmpInst::Predicate pred = cast(I)->getPredicate(); > + if (pred == FCmpInst::FCMP_OEQ || pred == FCmpInst::FCMP_UEQ || > + pred == FCmpInst::FCMP_ONE || pred == FCmpInst::FCMP_UNE) { > + Res = new FCmpInst(pred, Dummy, Dummy, Name); > + VMC.ExprMap[I] = Res; // Add node to expression eagerly > + unsigned OtherIdx = (OldVal == I->getOperand(0)) ? 1 : 0; > + Value *OtherOp = I->getOperand(OtherIdx); > + Res->setOperand(!OtherIdx, NewVal); > + Value *NewOther = ConvertExpressionToType(OtherOp, NewTy, > VMC, TD); > + Res->setOperand(OtherIdx, NewOther); > + } > + break; > + } > case Instruction::Shl: > case Instruction::LShr: > case Instruction::AShr: > assert(I->getOperand(0) == OldVal); > Res = new ShiftInst(cast(I)->getOpcode(), NewVal, > > > Likewise. Done. > > > > > -Chris > > From evan.cheng at apple.com Thu Dec 14 23:50:54 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 14 Dec 2006 23:50:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README-SSE.txt Message-ID: <200612150550.kBF5osPR024345@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README-SSE.txt updated: 1.13 -> 1.14 --- Log message: This is done. --- Diffs of the changes: (+0 -5) README-SSE.txt | 5 ----- 1 files changed, 5 deletions(-) Index: llvm/lib/Target/X86/README-SSE.txt diff -u llvm/lib/Target/X86/README-SSE.txt:1.13 llvm/lib/Target/X86/README-SSE.txt:1.14 --- llvm/lib/Target/X86/README-SSE.txt:1.13 Thu Dec 14 13:45:32 2006 +++ llvm/lib/Target/X86/README-SSE.txt Thu Dec 14 23:50:39 2006 @@ -18,11 +18,6 @@ //===---------------------------------------------------------------------===// -Bitcast to<->from SSE registers should use movd/movq instead of going through -the stack. Testcase here: CodeGen/X86/bitcast.ll - -//===---------------------------------------------------------------------===// - This testcase should have no SSE instructions in it, and only one load from a constant pool: From evan.cheng at apple.com Fri Dec 15 00:37:23 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 15 Dec 2006 00:37:23 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetInstrInfo.h Message-ID: <200612150637.kBF6bNqO025523@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetInstrInfo.h updated: 1.109 -> 1.110 --- Log message: Silly assertion. Forgot variable_ops instructions can have arbitrary number of operands. --- Diffs of the changes: (+4 -2) TargetInstrInfo.h | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Target/TargetInstrInfo.h diff -u llvm/include/llvm/Target/TargetInstrInfo.h:1.109 llvm/include/llvm/Target/TargetInstrInfo.h:1.110 --- llvm/include/llvm/Target/TargetInstrInfo.h:1.109 Fri Dec 8 12:44:26 2006 +++ llvm/include/llvm/Target/TargetInstrInfo.h Fri Dec 15 00:37:08 2006 @@ -132,8 +132,10 @@ /// it is set. Returns -1 if it is not set. int getOperandConstraint(unsigned OpNum, TOI::OperandConstraint Constraint) const { - assert(OpNum < numOperands && "Invalid operand # of TargetInstrInfo"); - if (OpInfo[OpNum].Constraints & (1 << Constraint)) { + assert((OpNum < numOperands || (Flags & M_VARIABLE_OPS)) && + "Invalid operand # of TargetInstrInfo"); + if (OpNum < numOperands && + (OpInfo[OpNum].Constraints & (1 << Constraint))) { unsigned Pos = 16 + Constraint * 4; return (int)(OpInfo[OpNum].Constraints >> Pos) & 0xf; } From clattner at apple.com Fri Dec 15 00:40:41 2006 From: clattner at apple.com (Chris Lattner) Date: Thu, 14 Dec 2006 22:40:41 -0800 Subject: [llvm-commits] fix for !__builtin_isunordered(X, Y); Message-ID: <034BE474-785F-4DFB-97F0-F91C84016C2B@apple.com> This fixes a bug compiling: int test2(float X, float Y) { return !__builtin_isunordered(X, Y); } because we checked the wrong 'opcode', we compiled it to the same code as: int test1(float X, float Y) { return __builtin_isunordered(X, Y); } Reid/Sheng, please make sure that the corresponding patch makes it into your llvm-gcc changes, thx. -Chris Index: llvm-convert.cpp =================================================================== --- llvm-convert.cpp (revision 121370) +++ llvm-convert.cpp (working copy) @@ -2329,7 +2329,7 @@ Result = IsUnord; // If this is an ORDERED_EXPR, invert the result of the isunordered call. - if (Opc == ORDERED_EXPR) + if (TREE_CODE(exp) == ORDERED_EXPR) Result = BinaryOperator::createNot(Result, "tmp", CurBB); } From evan.cheng at apple.com Fri Dec 15 00:41:16 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 15 Dec 2006 00:41:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/VirtRegMap.cpp Message-ID: <200612150641.kBF6fGQQ025640@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: VirtRegMap.cpp updated: 1.89 -> 1.90 --- Log message: Minor clean up. --- Diffs of the changes: (+3 -2) VirtRegMap.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/VirtRegMap.cpp diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.89 llvm/lib/CodeGen/VirtRegMap.cpp:1.90 --- llvm/lib/CodeGen/VirtRegMap.cpp:1.89 Thu Dec 14 01:54:05 2006 +++ llvm/lib/CodeGen/VirtRegMap.cpp Fri Dec 15 00:41:01 2006 @@ -573,7 +573,8 @@ // Loop over all of the implicit defs, clearing them from our available // sets. - const unsigned *ImpDef = TII->getImplicitDefs(MI.getOpcode()); + const TargetInstrDescriptor *TID = MI.getInstrDescriptor(); + const unsigned *ImpDef = TID->ImplicitDefs; if (ImpDef) { for ( ; *ImpDef; ++ImpDef) { PhysRegsUsed[*ImpDef] = true; @@ -626,7 +627,7 @@ // aren't allowed to modify the reused register. If none of these cases // apply, reuse it. bool CanReuse = true; - int ti = MI.getInstrDescriptor()->getOperandConstraint(i, TOI::TIED_TO); + int ti = TID->getOperandConstraint(i, TOI::TIED_TO); if (ti != -1 && MI.getOperand(ti).isReg() && MI.getOperand(ti).getReg() == VirtReg) { From sabre at nondot.org Fri Dec 15 00:49:35 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 15 Dec 2006 00:49:35 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-12-14-ordered_expr.c Message-ID: <200612150649.kBF6nZGd025792@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2006-12-14-ordered_expr.c added (r1.1) --- Log message: New testcase for llvm-gcc bugfix --- Diffs of the changes: (+7 -0) 2006-12-14-ordered_expr.c | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/test/Regression/CFrontend/2006-12-14-ordered_expr.c diff -c /dev/null llvm/test/Regression/CFrontend/2006-12-14-ordered_expr.c:1.1 *** /dev/null Fri Dec 15 00:49:30 2006 --- llvm/test/Regression/CFrontend/2006-12-14-ordered_expr.c Fri Dec 15 00:49:20 2006 *************** *** 0 **** --- 1,7 ---- + // RUN: %llvmgcc -O3 -S %s -o - | grep llvm.isunordered && + // RUN: %llvmgcc -O3 -S %s -o - | grep xor + + int test2(float X, float Y) { + return !__builtin_isunordered(X, Y); + } + From sabre at nondot.org Fri Dec 15 01:32:54 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 15 Dec 2006 01:32:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200612150732.kBF7Wslv026544@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ScalarReplAggregates.cpp updated: 1.57 -> 1.58 --- Log message: re-enable a temporarily-reverted patch --- Diffs of the changes: (+132 -53) ScalarReplAggregates.cpp | 185 +++++++++++++++++++++++++++++++++-------------- 1 files changed, 132 insertions(+), 53 deletions(-) Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.57 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.58 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.57 Tue Dec 12 20:26:45 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Fri Dec 15 01:32:38 2006 @@ -419,39 +419,64 @@ /// types are incompatible, return true, otherwise update Accum and return /// false. /// -/// There are two cases we handle here: -/// 1) An effectively integer union, where the pieces are stored into as +/// There are three cases we handle here: +/// 1) An effectively-integer union, where the pieces are stored into as /// smaller integers (common with byte swap and other idioms). -/// 2) A union of a vector and its elements. Here we turn element accesses -/// into insert/extract element operations. +/// 2) A union of vector types of the same size and potentially its elements. +/// Here we turn element accesses into insert/extract element operations. +/// 3) A union of scalar types, such as int/float or int/pointer. Here we +/// merge together into integers, allowing the xform to work with #1 as +/// well. static bool MergeInType(const Type *In, const Type *&Accum, const TargetData &TD) { // If this is our first type, just use it. const PackedType *PTy; if (Accum == Type::VoidTy || In == Accum) { Accum = In; + } else if (In == Type::VoidTy) { + // Noop. } else if (In->isIntegral() && Accum->isIntegral()) { // integer union. // Otherwise pick whichever type is larger. if (In->getTypeID() > Accum->getTypeID()) Accum = In; } else if (isa(In) && isa(Accum)) { // Pointer unions just stay as one of the pointers. - } else if ((PTy = dyn_cast(Accum)) && - PTy->getElementType() == In) { - // Accum is a vector, and we are accessing an element: ok. - } else if ((PTy = dyn_cast(In)) && - PTy->getElementType() == Accum) { - // In is a vector, and accum is an element: ok, remember In. - Accum = In; - } else if (isa(In) && Accum->isIntegral()) { - // Pointer/Integer unions merge together as integers. - return MergeInType(TD.getIntPtrType(), Accum, TD); - } else if (isa(Accum) && In->isIntegral()) { - // Pointer/Integer unions merge together as integers. - Accum = TD.getIntPtrType(); - return MergeInType(In, Accum, TD); + } else if (isa(In) || isa(Accum)) { + if ((PTy = dyn_cast(Accum)) && + PTy->getElementType() == In) { + // Accum is a vector, and we are accessing an element: ok. + } else if ((PTy = dyn_cast(In)) && + PTy->getElementType() == Accum) { + // In is a vector, and accum is an element: ok, remember In. + Accum = In; + } else if ((PTy = dyn_cast(In)) && isa(Accum) && + PTy->getBitWidth() == cast(Accum)->getBitWidth()) { + // Two vectors of the same size: keep Accum. + } else { + // Cannot insert an short into a <4 x int> or handle + // <2 x int> -> <4 x int> + return true; + } } else { - return true; + // Pointer/FP/Integer unions merge together as integers. + switch (Accum->getTypeID()) { + case Type::PointerTyID: Accum = TD.getIntPtrType(); break; + case Type::FloatTyID: Accum = Type::UIntTy; break; + case Type::DoubleTyID: Accum = Type::ULongTy; break; + default: + assert(Accum->isIntegral() && "Unknown FP type!"); + break; + } + + switch (In->getTypeID()) { + case Type::PointerTyID: In = TD.getIntPtrType(); break; + case Type::FloatTyID: In = Type::UIntTy; break; + case Type::DoubleTyID: In = Type::ULongTy; break; + default: + assert(In->isIntegral() && "Unknown FP type!"); + break; + } + return MergeInType(In, Accum, TD); } return false; } @@ -493,8 +518,7 @@ if (MergeInType(SI->getOperand(0)->getType(), UsedType, TD)) return 0; - } else if (CastInst *CI = dyn_cast(User)) { - if (!isa(CI->getType())) return 0; + } else if (BitCastInst *CI = dyn_cast(User)) { IsNotTrivial = true; const Type *SubTy = CanConvertToScalar(CI, IsNotTrivial); if (!SubTy || MergeInType(SubTy, UsedType, TD)) return 0; @@ -608,24 +632,54 @@ Value *NV = new LoadInst(NewAI, LI->getName(), LI); if (NV->getType() != LI->getType()) { if (const PackedType *PTy = dyn_cast(NV->getType())) { - // Must be an element access. - unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); - NV = new ExtractElementInst(NV, ConstantInt::get(Type::UIntTy, Elt), - "tmp", LI); + // If the result alloca is a packed type, this is either an element + // access or a bitcast to another packed type. + if (isa(LI->getType())) { + NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI); + } else { + // Must be an element access. + unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); + NV = new ExtractElementInst(NV, ConstantInt::get(Type::UIntTy, Elt), + "tmp", LI); + } + } else if (isa(NV->getType())) { + assert(isa(LI->getType())); + // Must be ptr->ptr cast. Anything else would result in NV being + // an integer. + NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI); } else { - if (Offset) { - assert(NV->getType()->isInteger() && "Unknown promotion!"); - if (Offset < TD.getTypeSize(NV->getType())*8) { - NV = new ShiftInst(Instruction::LShr, NV, - ConstantInt::get(Type::UByteTy, Offset), - LI->getName(), LI); + assert(NV->getType()->isInteger() && "Unknown promotion!"); + if (Offset && Offset < TD.getTypeSize(NV->getType())*8) { + NV = new ShiftInst(Instruction::LShr, NV, + ConstantInt::get(Type::UByteTy, Offset), + LI->getName(), LI); + } + + // If the result is an integer, this is a trunc or bitcast. + if (LI->getType()->isIntegral()) { + NV = CastInst::createTruncOrBitCast(NV, LI->getType(), + LI->getName(), LI); + } else if (LI->getType()->isFloatingPoint()) { + // If needed, truncate the integer to the appropriate size. + if (NV->getType()->getPrimitiveSize() > + LI->getType()->getPrimitiveSize()) { + switch (LI->getType()->getTypeID()) { + default: assert(0 && "Unknown FP type!"); + case Type::FloatTyID: + NV = new TruncInst(NV, Type::UIntTy, LI->getName(), LI); + break; + case Type::DoubleTyID: + NV = new TruncInst(NV, Type::ULongTy, LI->getName(), LI); + break; + } } + + // Then do a bitcast. + NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI); } else { - assert((NV->getType()->isInteger() || - isa(NV->getType())) && "Unknown promotion!"); + // Otherwise must be a pointer. + NV = new IntToPtrInst(NV, LI->getType(), LI->getName(), LI); } - NV = CastInst::createInferredCast(NV, LI->getType(), LI->getName(), - LI); } } LI->replaceAllUsesWith(NV); @@ -641,30 +695,55 @@ Value *Old = new LoadInst(NewAI, NewAI->getName()+".in", SI); if (const PackedType *PTy = dyn_cast(AllocaType)) { - // Must be an element insertion. - unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); - SV = new InsertElementInst(Old, SV, - ConstantInt::get(Type::UIntTy, Elt), - "tmp", SI); + // If the result alloca is a packed type, this is either an element + // access or a bitcast to another packed type. + if (isa(SV->getType())) { + SV = new BitCastInst(SV, AllocaType, SV->getName(), SI); + } else { + // Must be an element insertion. + unsigned Elt = Offset/(TD.getTypeSize(PTy->getElementType())*8); + SV = new InsertElementInst(Old, SV, + ConstantInt::get(Type::UIntTy, Elt), + "tmp", SI); + } } else { - // Always zero extend the value. - if (SV->getType()->isSigned()) - SV = CastInst::createInferredCast(SV, - SV->getType()->getUnsignedVersion(), SV->getName(), SI); - SV = CastInst::createInferredCast(SV, Old->getType(), SV->getName(), - SI); - if (Offset && Offset < TD.getTypeSize(SV->getType())*8) + // If SV is a float, convert it to the appropriate integer type. + // If it is a pointer, do the same, and also handle ptr->ptr casts + // here. + switch (SV->getType()->getTypeID()) { + default: + assert(!SV->getType()->isFloatingPoint() && "Unknown FP type!"); + break; + case Type::FloatTyID: + SV = new BitCastInst(SV, Type::UIntTy, SV->getName(), SI); + break; + case Type::DoubleTyID: + SV = new BitCastInst(SV, Type::ULongTy, SV->getName(), SI); + break; + case Type::PointerTyID: + if (isa(AllocaType)) + SV = new BitCastInst(SV, AllocaType, SV->getName(), SI); + else + SV = new PtrToIntInst(SV, TD.getIntPtrType(), SV->getName(), SI); + break; + } + + unsigned SrcSize = TD.getTypeSize(SV->getType())*8; + + // Always zero extend the value if needed. + if (SV->getType() != AllocaType) + SV = CastInst::createZExtOrBitCast(SV, AllocaType, + SV->getName(), SI); + if (Offset && Offset < AllocaType->getPrimitiveSizeInBits()) SV = new ShiftInst(Instruction::Shl, SV, ConstantInt::get(Type::UByteTy, Offset), SV->getName()+".adj", SI); // Mask out the bits we are about to insert from the old value. unsigned TotalBits = TD.getTypeSize(SV->getType())*8; - unsigned InsertBits = TD.getTypeSize(SI->getOperand(0)->getType())*8; - if (TotalBits != InsertBits) { - assert(TotalBits > InsertBits); - uint64_t Mask = ~(((1ULL << InsertBits)-1) << Offset); - if (TotalBits != 64) - Mask = Mask & ((1ULL << TotalBits)-1); + if (TotalBits != SrcSize) { + assert(TotalBits > SrcSize); + uint64_t Mask = ~(((1ULL << SrcSize)-1) << Offset); + Mask = Mask & SV->getType()->getIntegralTypeMask(); Old = BinaryOperator::createAnd(Old, ConstantInt::get(Old->getType(), Mask), Old->getName()+".mask", SI); From sabre at nondot.org Fri Dec 15 01:33:05 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 15 Dec 2006 01:33:05 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll union-packed.ll Message-ID: <200612150733.kBF7X5aB026558@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ScalarRepl: union-fp-int.ll updated: 1.2 -> 1.3 union-packed.ll updated: 1.2 -> 1.3 --- Log message: reenable these --- Diffs of the changes: (+0 -4) union-fp-int.ll | 2 -- union-packed.ll | 2 -- 2 files changed, 4 deletions(-) Index: llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll diff -u llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll:1.2 llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll:1.3 --- llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll:1.2 Wed Dec 13 11:42:40 2006 +++ llvm/test/Regression/Transforms/ScalarRepl/union-fp-int.ll Fri Dec 15 01:32:49 2006 @@ -1,8 +1,6 @@ ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | not grep alloca && ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | grep 'bitcast.*float.*int' -; XFAIL: * - int %test(float %X) { %X_addr = alloca float store float %X, float* %X_addr Index: llvm/test/Regression/Transforms/ScalarRepl/union-packed.ll diff -u llvm/test/Regression/Transforms/ScalarRepl/union-packed.ll:1.2 llvm/test/Regression/Transforms/ScalarRepl/union-packed.ll:1.3 --- llvm/test/Regression/Transforms/ScalarRepl/union-packed.ll:1.2 Wed Dec 13 11:42:40 2006 +++ llvm/test/Regression/Transforms/ScalarRepl/union-packed.ll Fri Dec 15 01:32:49 2006 @@ -1,8 +1,6 @@ ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | not grep alloca && ; RUN: llvm-upgrade < %s | llvm-as | opt -scalarrepl | llvm-dis | grep 'bitcast' -; XFAIL: * - target endian = little <4 x int> %test(<4 x float> %X) { From sabre at nondot.org Fri Dec 15 01:36:35 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 15 Dec 2006 01:36:35 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612150736.kBF7aZZ1026638@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.442 -> 1.443 --- Log message: silence a bogus warning --- Diffs of the changes: (+1 -1) LegalizeDAG.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.442 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.443 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.442 Thu Dec 14 20:59:56 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Dec 15 01:36:19 2006 @@ -3538,7 +3538,7 @@ if (VT == MVT::f32 || VT == MVT::f64) { // Expand into one or more soft-fp libcall(s). const char *FnName1 = NULL, *FnName2 = NULL; - ISD::CondCode CC1, CC2; + ISD::CondCode CC1, CC2 = ISD::SETCC_INVALID; switch (cast(CC)->get()) { case ISD::SETEQ: case ISD::SETOEQ: From clattner at apple.com Fri Dec 15 01:38:36 2006 From: clattner at apple.com (Chris Lattner) Date: Thu, 14 Dec 2006 23:38:36 -0800 Subject: [llvm-commits] SETCC Patches: #3 In-Reply-To: <1166154489.2855.35.camel@bashful.x10sys.com> References: <1165794220.15266.89.camel@bashful.x10sys.com> <27C0F155-7340-4DE8-9EBA-DD2D4224D4E7@apple.com> <1166154489.2855.35.camel@bashful.x10sys.com> Message-ID: <7A918C6E-F4F8-4209-8CBD-E182F146E035@apple.com> On Dec 14, 2006, at 7:48 PM, Reid Spencer wrote: >> >> The interpreter is broken: all unsigned comparisons with signed >> operands will hit the unhandled type case. > > Yup. Fixed the macro to take two arguments. The first is to match the > type of the operand. > The second is the type to use to pull the values out of the > GenericValue > union, effecitvely doing the type cast by field selection. Ok >> --- lib/Target/CBackend/Writer.cpp 7 Dec 2006 23:41:45 -0000 1.294 >> +++ lib/Target/CBackend/Writer.cpp 10 Dec 2006 23:26:54 -0000 >> @@ -712,10 +717,44 @@ void CWriter::printConstant(Constant *CP >> case Instruction::SetGT: Out << " > "; break; >> >> This apparently doesn't cast the operands of icmp constant exprs to >> the right sign. > > It does, you just didn't see it in the patch because that part didn't > change. Ok. >> ... There ya go again, trying to inflate your LOC count. > > Just a blunder. Uh huh, sure... right... :) >> >> This (when it becomes active) isn't sufficient. When >> FiniteOnlyFPMath >> is enabled, all the 'o's and 'u's should get dropped. > > Right, missed that. One question: > > For the FCMP_ORD and FCMP_UNO cases, what should the FininteOnlyFPMath > condition be? > There isn't really a mapping for it, right? Just make it the same > as the > regular case? Yeah, please just make them do the 'correct' thing, even though they strictly don't have to. I'm still behind in patch review, I'll try to respond to your other email tomorrow, -Chris From jlaskey at apple.com Fri Dec 15 04:41:11 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 15 Dec 2006 04:41:11 -0600 Subject: [llvm-commits] CVS: llvm/docs/CodeGenerator.html Message-ID: <200612151041.kBFAfB0Y006030@zion.cs.uiuc.edu> Changes in directory llvm/docs: CodeGenerator.html updated: 1.43 -> 1.44 --- Log message: Pass html validation. --- Diffs of the changes: (+18 -19) CodeGenerator.html | 37 ++++++++++++++++++------------------- 1 files changed, 18 insertions(+), 19 deletions(-) Index: llvm/docs/CodeGenerator.html diff -u llvm/docs/CodeGenerator.html:1.43 llvm/docs/CodeGenerator.html:1.44 --- llvm/docs/CodeGenerator.html:1.43 Thu Dec 14 11:19:50 2006 +++ llvm/docs/CodeGenerator.html Fri Dec 15 04:40:48 2006 @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + The LLVM Target-Independent Code Generator @@ -84,15 +85,14 @@
  • Target-specific Implementation Notes -
  • + + @@ -381,7 +381,7 @@
  • the type to use for shift amounts
  • various high-level characteristics, like whether it is profitable to turn division by a constant into a multiplication sequence
  • - + @@ -1114,7 +1114,7 @@ fragment can match multiple different patterns.
  • We don't automatically infer flags like isStore/isLoad yet.
  • We don't automatically generate the set of supported registers and - operations for the Legalizer yet.
  • + operations for the Legalizer yet.
  • We don't have a way of tying in custom legalized nodes yet.
  • @@ -1155,7 +1155,6 @@
    1. Optional function-at-a-time selection.
    2. Auto-generate entire selector from .td file.
    3. -
    @@ -1246,8 +1245,6 @@

    More to come...

    - - @@ -1307,10 +1304,10 @@
    -bool RegMapping_Fer::compatible_class(MachineFunction &mf,
    +bool RegMapping_Fer::compatible_class(MachineFunction &mf,
                                           unsigned v_reg,
                                           unsigned p_reg) {
    -  assert(MRegisterInfo::isPhysicalRegister(p_reg) &&
    +  assert(MRegisterInfo::isPhysicalRegister(p_reg) &&
              "Target register must be physical");
       const TargetRegisterClass *trc = mf.getSSARegMap()->getRegClass(v_reg);
       return trc->contains(p_reg);
    @@ -1753,11 +1750,11 @@
     is used. Second, r31 is used as a frame pointer to allow dynamic growth of a
     stack frame.  LLVM takes advantage of having no TOC to provide space to save
     the frame pointer in the PowerPC linkage area of the caller frame.  Other
    -details of PowerPC ABI can be found at PowerPC ABI. Note:
    -This link describes the 32 bit ABI.  The 64 bit ABI is similar except space for
    -GPRs are 8 bytes wide (not 4) and r13 is reserved for system use.

    +details of PowerPC ABI can be found at PowerPC ABI. Note: This link describes the 32 bit ABI. The +64 bit ABI is similar except space for GPRs are 8 bytes wide (not 4) and r13 is +reserved for system use.

    @@ -1767,7 +1764,7 @@

    The size of a PowerPC frame is usually fixed for the duration of a -function's invocation. Since the frame is fixed size, all references into +function’s invocation. Since the frame is fixed size, all references into the frame can be accessed via fixed offsets from the stack pointer. The exception to this is when dynamic alloca or variable sized arrays are present, then a base pointer (r31) is used as a proxy for the stack pointer and stack @@ -1942,7 +1939,9 @@

    -TODO - More to come. +
    +

    TODO - More to come.

    +
    @@ -1955,7 +1954,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/12/14 17:19:50 $ + Last modified: $Date: 2006/12/15 10:40:48 $ From jlaskey at apple.com Fri Dec 15 08:33:13 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 15 Dec 2006 08:33:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200612151433.kBFEXD0E009377@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.244 -> 1.245 --- Log message: Provide support for FP_TO_UINT. --- Diffs of the changes: (+3 -1) PPCISelLowering.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.244 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.245 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.244 Mon Dec 11 17:22:45 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Fri Dec 15 08:32:57 2006 @@ -181,9 +181,11 @@ if (TM.getSubtarget().has64BitSupport()) { // They also have instructions for converting between i64 and fp. setOperationAction(ISD::FP_TO_SINT, MVT::i64, Custom); + setOperationAction(ISD::FP_TO_UINT, MVT::i64, Expand); setOperationAction(ISD::SINT_TO_FP, MVT::i64, Custom); setOperationAction(ISD::UINT_TO_FP, MVT::i64, Expand); - + setOperationAction(ISD::FP_TO_UINT, MVT::i32, Expand); + // FIXME: disable this lowered code. This generates 64-bit register values, // and we don't model the fact that the top part is clobbered by calls. We // need to flag these together so that the value isn't live across a call. From jlaskey at apple.com Fri Dec 15 08:34:26 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 15 Dec 2006 08:34:26 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstr64Bit.td Message-ID: <200612151434.kBFEYQYF009408@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstr64Bit.td updated: 1.34 -> 1.35 --- Log message: Provide 64-bit support for i64 sextload. --- Diffs of the changes: (+4 -0) PPCInstr64Bit.td | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.34 llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.35 --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.34 Tue Dec 12 07:23:43 2006 +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td Fri Dec 15 08:34:11 2006 @@ -491,6 +491,10 @@ (LBZ8 iaddr:$src)>; def : Pat<(extloadi1 xaddr:$src), (LBZX8 xaddr:$src)>; +def : Pat<(sextloadi8 iaddr:$src), + (EXTSB8 (LBZ8 iaddr:$src))>; +def : Pat<(sextloadi8 xaddr:$src), + (EXTSB8 (LBZX8 xaddr:$src))>; def : Pat<(extloadi8 iaddr:$src), (LBZ8 iaddr:$src)>; def : Pat<(extloadi8 xaddr:$src), From jlaskey at apple.com Fri Dec 15 08:35:48 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 15 Dec 2006 10:35:48 -0400 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp In-Reply-To: <200612151433.kBFEXD0E009377@zion.cs.uiuc.edu> References: <200612151433.kBFEXD0E009377@zion.cs.uiuc.edu> Message-ID: Should read Provide ppc64 support for FP_TO_UINT On 15-Dec-06, at 10:33 AM, Jim Laskey wrote: > Provide support for FP_TO_UINT. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061215/a8f0aebd/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061215/a8f0aebd/attachment.bin From jlaskey at apple.com Fri Dec 15 10:44:25 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 15 Dec 2006 10:44:25 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp Message-ID: <200612151644.kBFGiPKS011700@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCCodeEmitter.cpp updated: 1.73 -> 1.74 --- Log message: Missing load/store relocations. --- Diffs of the changes: (+7 -1) PPCCodeEmitter.cpp | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.73 llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.74 --- llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.73 Mon Dec 11 17:22:44 2006 +++ llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp Fri Dec 15 10:44:10 2006 @@ -152,17 +152,23 @@ case PPC::LA: // Loads. case PPC::LBZ: + case PPC::LBZ8: case PPC::LHA: + case PPC::LHA8: case PPC::LHZ: + case PPC::LHZ8: case PPC::LWZ: + case PPC::LWZ8: case PPC::LFS: case PPC::LFD: - case PPC::LWZ8: // Stores. case PPC::STB: + case PPC::STB8: case PPC::STH: + case PPC::STH8: case PPC::STW: + case PPC::STW8: case PPC::STFS: case PPC::STFD: Reloc = PPC::reloc_absolute_low; From alenhar2 at cs.uiuc.edu Fri Dec 15 11:35:07 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 15 Dec 2006 11:35:07 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Linker/weakextern.ll testlink1.ll Message-ID: <200612151735.kBFHZ70C002827@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Linker: weakextern.ll added (r1.1) testlink1.ll updated: 1.12 -> 1.13 --- Log message: extern_weak link test --- Diffs of the changes: (+15 -0) testlink1.ll | 2 ++ weakextern.ll | 13 +++++++++++++ 2 files changed, 15 insertions(+) Index: llvm/test/Regression/Linker/weakextern.ll diff -c /dev/null llvm/test/Regression/Linker/weakextern.ll:1.1 *** /dev/null Fri Dec 15 11:34:47 2006 --- llvm/test/Regression/Linker/weakextern.ll Fri Dec 15 11:34:37 2006 *************** *** 0 **** --- 1,13 ---- + ; RUN: llvm-as < %s > %t.bc + ; RUN: llvm-as < `dirname %s`/testlink1.ll > %t2.bc + ; RUN: llvm-link %t.bc %t.bc %t2.bc -o %t1.bc + ; RUN: llvm-dis < %t1.bc |grep "kallsyms_names = extern_weak" && + ; RUN: llvm-dis < %t1.bc |grep "MyVar = external global int" && + ; RUN: llvm-dis < %t1.bc |grep "Inte = global int" + + %kallsyms_names = extern_weak global [0 x ubyte] + %MyVar = extern_weak global int + %Inte = extern_weak global int + + implementation + Index: llvm/test/Regression/Linker/testlink1.ll diff -u llvm/test/Regression/Linker/testlink1.ll:1.12 llvm/test/Regression/Linker/testlink1.ll:1.13 --- llvm/test/Regression/Linker/testlink1.ll:1.12 Thu Nov 23 09:14:52 2006 +++ llvm/test/Regression/Linker/testlink1.ll Fri Dec 15 11:34:37 2006 @@ -6,6 +6,8 @@ %MyIntList = global { \2 *, int } { { \2, int }* null, int 17 } external global int ; int*:0 +%Inte = global int 1 + %AConst = linkonce constant int 123 %Intern1 = internal constant int 42 From alenhar2 at cs.uiuc.edu Fri Dec 15 11:35:52 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Fri, 15 Dec 2006 11:35:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp Message-ID: <200612151735.kBFHZqg9002858@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkModules.cpp updated: 1.123 -> 1.124 --- Log message: extern_weak linkage. fixes PR1038: http://llvm.org/PR1038 --- Diffs of the changes: (+5 -1) LinkModules.cpp | 6 +++++- 1 files changed, 5 insertions(+), 1 deletion(-) Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.123 llvm/lib/Linker/LinkModules.cpp:1.124 --- llvm/lib/Linker/LinkModules.cpp:1.123 Mon Dec 11 23:04:59 2006 +++ llvm/lib/Linker/LinkModules.cpp Fri Dec 15 11:35:32 2006 @@ -365,6 +365,10 @@ LinkFromSrc = true; LT = Src->getLinkage(); } + } else if (Dest->hasExternalWeakLinkage()) { + //If the Dest is weak, use the source linkage + LinkFromSrc = true; + LT = Src->getLinkage(); } else { LinkFromSrc = false; LT = Dest->getLinkage(); @@ -446,7 +450,7 @@ if (DGV && DGV->hasInternalLinkage()) DGV = 0; - assert(SGV->hasInitializer() || + assert(SGV->hasInitializer() || SGV->hasExternalWeakLinkage() || SGV->hasExternalLinkage() || SGV->hasDLLImportLinkage() && "Global must either be external or have an initializer!"); From jlaskey at apple.com Fri Dec 15 12:45:47 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 15 Dec 2006 12:45:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstr64Bit.td Message-ID: <200612151845.kBFIjlYw016956@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstr64Bit.td updated: 1.35 -> 1.36 --- Log message: Not needed. Misinterpreted error message from other bug (Missing load/store relocations.) --- Diffs of the changes: (+0 -4) PPCInstr64Bit.td | 4 ---- 1 files changed, 4 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.35 llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.36 --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.35 Fri Dec 15 08:34:11 2006 +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td Fri Dec 15 12:45:32 2006 @@ -491,10 +491,6 @@ (LBZ8 iaddr:$src)>; def : Pat<(extloadi1 xaddr:$src), (LBZX8 xaddr:$src)>; -def : Pat<(sextloadi8 iaddr:$src), - (EXTSB8 (LBZ8 iaddr:$src))>; -def : Pat<(sextloadi8 xaddr:$src), - (EXTSB8 (LBZX8 xaddr:$src))>; def : Pat<(extloadi8 iaddr:$src), (LBZ8 iaddr:$src)>; def : Pat<(extloadi8 xaddr:$src), From jlaskey at apple.com Fri Dec 15 12:51:16 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 15 Dec 2006 12:51:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstr64Bit.td Message-ID: <200612151851.kBFIpGdL017047@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstr64Bit.td updated: 1.36 -> 1.37 --- Log message: Not all test cases are created equal. This fix is needed. --- Diffs of the changes: (+4 -0) PPCInstr64Bit.td | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.36 llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.37 --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.36 Fri Dec 15 12:45:32 2006 +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td Fri Dec 15 12:51:01 2006 @@ -491,6 +491,10 @@ (LBZ8 iaddr:$src)>; def : Pat<(extloadi1 xaddr:$src), (LBZX8 xaddr:$src)>; +def : Pat<(sextloadi8 iaddr:$src), + (EXTSB8 (LBZ8 iaddr:$src))>; +def : Pat<(sextloadi8 xaddr:$src), + (EXTSB8 (LBZX8 xaddr:$src))>; def : Pat<(extloadi8 iaddr:$src), (LBZ8 iaddr:$src)>; def : Pat<(extloadi8 xaddr:$src), From dpatel at apple.com Fri Dec 15 13:39:45 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 15 Dec 2006 13:39:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612151939.kBFJdjga018046@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.103 -> 1.104 --- Log message: Move PMTopLevelManager and TImingInfo into anon namespace. --- Diffs of the changes: (+15 -8) PassManager.cpp | 23 +++++++++++++++-------- 1 files changed, 15 insertions(+), 8 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.103 llvm/lib/VMCore/PassManager.cpp:1.104 --- llvm/lib/VMCore/PassManager.cpp:1.103 Thu Dec 14 18:08:26 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Dec 15 13:39:30 2006 @@ -21,7 +21,9 @@ #include "llvm/Support/ManagedStatic.h" #include #include + using namespace llvm; +class llvm::PMDataManager; //===----------------------------------------------------------------------===// // Overview: @@ -114,16 +116,14 @@ } // End of llvm namespace #ifndef USE_OLD_PASSMANAGER -namespace llvm { - -class PMDataManager; +namespace { //===----------------------------------------------------------------------===// // PMTopLevelManager // /// PMTopLevelManager manages LastUser info and collects common APIs used by /// top level pass managers. -class PMTopLevelManager { +class VISIBILITY_HIDDEN PMTopLevelManager { public: inline std::vector::iterator passManagersBegin() { @@ -210,10 +210,13 @@ /// Immutable passes are managed by top level manager. std::vector ImmutablePasses; }; + +} // End of anon namespace //===----------------------------------------------------------------------===// // PMDataManager +namespace llvm { /// PMDataManager provides the common place to manage the analysis data /// used by pass managers. class PMDataManager { @@ -365,7 +368,7 @@ /// BasicBlockPassManager manages BasicBlockPass. It batches all the /// pass together and sequence them to process one basic block before /// processing next basic block. -class BasicBlockPassManager : public PMDataManager, +class VISIBILITY_HIDDEN BasicBlockPassManager : public PMDataManager, public FunctionPass { public: @@ -390,7 +393,7 @@ // Print passes managed by this manager void dumpPassStructure(unsigned Offset) { - llvm::cerr << std::string(Offset*2, ' ') << "BasicBLockPass Manager\n"; + llvm::cerr << std::string(Offset*2, ' ') << "BasicBlockPass Manager\n"; for (std::vector::iterator I = passVectorBegin(), E = passVectorEnd(); I != E; ++I) { (*I)->dumpPassStructure(Offset + 1); @@ -574,13 +577,17 @@ ModulePassManager *activeManager; }; +} // End of llvm namespace + +namespace { + //===----------------------------------------------------------------------===// // TimingInfo Class - This class is used to calculate information about the // amount of time each pass takes to execute. This only happens when // -time-passes is enabled on the command line. // -class TimingInfo { +class VISIBILITY_HIDDEN TimingInfo { std::map TimingData; TimerGroup TG; @@ -623,7 +630,7 @@ static TimingInfo *TheTimeInfo; -} // End of llvm namespace +} // End of anon namespace //===----------------------------------------------------------------------===// // PMTopLevelManager implementation From reid at x10sys.com Fri Dec 15 13:45:06 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 15 Dec 2006 13:45:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Archive/Archive.cpp ArchiveReader.cpp ArchiveWriter.cpp Message-ID: <200612151945.kBFJj6kQ018290@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Archive: Archive.cpp updated: 1.14 -> 1.15 ArchiveReader.cpp updated: 1.47 -> 1.48 ArchiveWriter.cpp updated: 1.32 -> 1.33 --- Log message: For PR1050: http://llvm.org/PR1050 : Convert asserts into error messages. --- Diffs of the changes: (+27 -6) Archive.cpp | 7 ++++++- ArchiveReader.cpp | 13 +++++++++++-- ArchiveWriter.cpp | 13 ++++++++++--- 3 files changed, 27 insertions(+), 6 deletions(-) Index: llvm/lib/Bytecode/Archive/Archive.cpp diff -u llvm/lib/Bytecode/Archive/Archive.cpp:1.14 llvm/lib/Bytecode/Archive/Archive.cpp:1.15 --- llvm/lib/Bytecode/Archive/Archive.cpp:1.14 Thu Aug 24 18:45:08 2006 +++ llvm/lib/Bytecode/Archive/Archive.cpp Fri Dec 15 13:44:51 2006 @@ -62,7 +62,12 @@ // different file, presumably as an update to the member. It also makes sure // the flags are reset correctly. bool ArchiveMember::replaceWith(const sys::Path& newFile, std::string* ErrMsg) { - assert(newFile.exists() && "Can't replace with a non-existent file"); + if (!newFile.exists()) { + if (ErrMsg) + *ErrMsg = "Can not replace an archive member with a non-existent file"; + return true; + } + data = 0; path = newFile; Index: llvm/lib/Bytecode/Archive/ArchiveReader.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.47 llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.48 --- llvm/lib/Bytecode/Archive/ArchiveReader.cpp:1.47 Fri Aug 25 12:43:11 2006 +++ llvm/lib/Bytecode/Archive/ArchiveReader.cpp Fri Dec 15 13:44:51 2006 @@ -68,7 +68,11 @@ ArchiveMember* Archive::parseMemberHeader(const char*& At, const char* End, std::string* error) { - assert(At + sizeof(ArchiveMemberHeader) < End && "Not enough data"); + if (At + sizeof(ArchiveMemberHeader) >= End) { + if (error) + *error = "Unexpected end of file"; + return 0; + } // Cast archive member header ArchiveMemberHeader* Hdr = (ArchiveMemberHeader*)At; @@ -498,7 +502,12 @@ std::set& result, std::string* error) { - assert(mapfile && base && "Can't findModulesDefiningSymbols on new archive"); + if (!mapfile || !base) { + if (error) + *error = "Empty archive invalid for finding modules defining symbols"; + return false; + } + if (symTab.empty()) { // We don't have a symbol table, so we must build it now but lets also // make sure that we populate the modules table as we do this to ensure Index: llvm/lib/Bytecode/Archive/ArchiveWriter.cpp diff -u llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.32 llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.33 --- llvm/lib/Bytecode/Archive/ArchiveWriter.cpp:1.32 Tue Nov 28 16:49:32 2006 +++ llvm/lib/Bytecode/Archive/ArchiveWriter.cpp Fri Dec 15 13:44:51 2006 @@ -153,7 +153,11 @@ bool Archive::addFileBefore(const sys::Path& filePath, iterator where, std::string* ErrMsg) { - assert(filePath.exists() && "Can't add a non-existent file"); + if (!filePath.exists()) { + if (ErrMsg) + *ErrMsg = "Can not add a non-existent file to archive"; + return true; + } ArchiveMember* mbr = new ArchiveMember(this); @@ -385,8 +389,11 @@ { // Make sure they haven't opened up the file, not loaded it, // but are now trying to write it which would wipe out the file. - assert(!(members.empty() && mapfile->size() > 8) && - "Can't write an archive not opened for writing"); + if (members.empty() && mapfile->size() > 8) { + if (ErrMsg) + *ErrMsg = "Can't write an archive not opened for writing"; + return true; + } // Create a temporary file to store the archive in sys::Path TmpArchive = archPath; From reid at x10sys.com Fri Dec 15 13:49:38 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 15 Dec 2006 13:49:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp ReaderWrappers.cpp Message-ID: <200612151949.kBFJncY4018427@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.213 -> 1.214 ReaderWrappers.cpp updated: 1.59 -> 1.60 --- Log message: Fix long standing issue with propagating error message back to caller. This has been a problem since exceptions were removed from the BytecodeReader. Error messages are now captured from ModuleProvider::releaseModule as well as after a longjmp. --- Diffs of the changes: (+17 -7) Reader.cpp | 14 ++++++++++++-- ReaderWrappers.cpp | 10 +++++----- 2 files changed, 17 insertions(+), 7 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.213 llvm/lib/Bytecode/Reader/Reader.cpp:1.214 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.213 Mon Dec 11 17:20:20 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Fri Dec 15 13:49:23 2006 @@ -1758,8 +1758,13 @@ /// @see ParseBytecode bool BytecodeReader::ParseFunction(Function* Func, std::string* ErrMsg) { - if (setjmp(context)) + if (setjmp(context)) { + // Set caller's error message, if requested + if (ErrMsg) + *ErrMsg = ErrorMsg; + // Indicate an error occurred return true; + } // Find {start, end} pointers and slot in the map. If not there, we're done. LazyFunctionMap::iterator Fi = LazyFunctionLoadMap.find(Func); @@ -1788,8 +1793,13 @@ /// to materialize the functions. /// @see ParseBytecode bool BytecodeReader::ParseAllFunctionBodies(std::string* ErrMsg) { - if (setjmp(context)) + if (setjmp(context)) { + // Set caller's error message, if requested + if (ErrMsg) + *ErrMsg = ErrorMsg; + // Indicate an error occurred return true; + } LazyFunctionMap::iterator Fi = LazyFunctionLoadMap.begin(); LazyFunctionMap::iterator Fe = LazyFunctionLoadMap.end(); Index: llvm/lib/Bytecode/Reader/ReaderWrappers.cpp diff -u llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.59 llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.60 --- llvm/lib/Bytecode/Reader/ReaderWrappers.cpp:1.59 Thu Dec 7 14:28:15 2006 +++ llvm/lib/Bytecode/Reader/ReaderWrappers.cpp Fri Dec 15 13:49:23 2006 @@ -309,7 +309,7 @@ ModuleProvider *MP = getBytecodeBufferModuleProvider(Buffer, Length, ModuleID, ErrMsg, 0); if (!MP) return 0; - Module *M = MP->releaseModule(); + Module *M = MP->releaseModule(ErrMsg); delete MP; return M; } @@ -341,7 +341,7 @@ std::string *ErrMsg) { ModuleProvider* MP = getBytecodeModuleProvider(Filename, ErrMsg); if (!MP) return 0; - Module *M = MP->releaseModule(); + Module *M = MP->releaseModule(ErrMsg); delete MP; return M; } @@ -356,7 +356,7 @@ BytecodeHandler* AH = createBytecodeAnalyzerHandler(bca,output); ModuleProvider* MP = getBytecodeModuleProvider(Filename, ErrMsg, AH); if (!MP) return 0; - Module *M = MP->releaseModule(); + Module *M = MP->releaseModule(ErrMsg); delete MP; return M; } @@ -375,7 +375,7 @@ ModuleProvider* MP = getBytecodeBufferModuleProvider(Buffer, Length, ModuleID, ErrMsg, hdlr); if (!MP) return 0; - Module *M = MP->releaseModule(); + Module *M = MP->releaseModule(ErrMsg); delete MP; return M; } @@ -388,7 +388,7 @@ deplibs.clear(); return true; } - Module* M = MP->releaseModule(); + Module* M = MP->releaseModule(ErrMsg); deplibs = M->getLibraries(); delete M; delete MP; From evan.cheng at apple.com Fri Dec 15 13:59:13 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 15 Dec 2006 13:59:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrX86-64.td Message-ID: <200612151959.kBFJxD7E018597@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrX86-64.td updated: 1.13 -> 1.14 --- Log message: Some AT&T syntax assembler (e.g. Mac OS X) does not recognize the movq alias for i64 <-> XMM moves. --- Diffs of the changes: (+8 -8) X86InstrX86-64.td | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/lib/Target/X86/X86InstrX86-64.td diff -u llvm/lib/Target/X86/X86InstrX86-64.td:1.13 llvm/lib/Target/X86/X86InstrX86-64.td:1.14 --- llvm/lib/Target/X86/X86InstrX86-64.td:1.13 Thu Dec 14 15:55:39 2006 +++ llvm/lib/Target/X86/X86InstrX86-64.td Fri Dec 15 13:58:58 2006 @@ -1110,33 +1110,33 @@ // Move instructions... def MOV64toPQIrr : RPDI<0x6E, MRMSrcReg, (ops VR128:$dst, GR64:$src), - "movq {$src, $dst|$dst, $src}", + "mov{d|q} {$src, $dst|$dst, $src}", [(set VR128:$dst, (v2i64 (scalar_to_vector GR64:$src)))]>; def MOV64toPQIrm : RPDI<0x6E, MRMSrcMem, (ops VR128:$dst, i64mem:$src), - "movq {$src, $dst|$dst, $src}", + "mov{d|q} {$src, $dst|$dst, $src}", [(set VR128:$dst, (v2i64 (scalar_to_vector (loadi64 addr:$src))))]>; def MOVPQIto64rr : RPDI<0x7E, MRMDestReg, (ops GR64:$dst, VR128:$src), - "movq {$src, $dst|$dst, $src}", + "mov{d|q} {$src, $dst|$dst, $src}", [(set GR64:$dst, (vector_extract (v2i64 VR128:$src), (iPTR 0)))]>; def MOVPQIto64mr : RPDI<0x7E, MRMDestMem, (ops i64mem:$dst, VR128:$src), - "movq {$src, $dst|$dst, $src}", + "mov{d|q} {$src, $dst|$dst, $src}", [(store (i64 (vector_extract (v2i64 VR128:$src), (iPTR 0))), addr:$dst)]>; def MOV64toSDrr : RPDI<0x6E, MRMSrcReg, (ops FR64:$dst, GR64:$src), - "movq {$src, $dst|$dst, $src}", + "mov{d|q} {$src, $dst|$dst, $src}", [(set FR64:$dst, (bitconvert GR64:$src))]>; def MOV64toSDrm : RPDI<0x6E, MRMSrcMem, (ops FR64:$dst, i64mem:$src), - "movq {$src, $dst|$dst, $src}", + "mov{d|q} {$src, $dst|$dst, $src}", [(set FR64:$dst, (bitconvert (loadi64 addr:$src)))]>; def MOVSDto64rr : RPDI<0x7E, MRMDestReg, (ops GR64:$dst, FR64:$src), - "movq {$src, $dst|$dst, $src}", + "mov{d|q} {$src, $dst|$dst, $src}", [(set GR64:$dst, (bitconvert FR64:$src))]>; def MOVSDto64mr : RPDI<0x7E, MRMDestMem, (ops i64mem:$dst, FR64:$src), - "movq {$src, $dst|$dst, $src}", + "mov{d|q} {$src, $dst|$dst, $src}", [(store (i64 (bitconvert FR64:$src)), addr:$dst)]>; From dpatel at apple.com Fri Dec 15 14:13:16 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 15 Dec 2006 14:13:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612152013.kBFKDGG1018869@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.104 -> 1.105 --- Log message: Mark dump* routines const routines. --- Diffs of the changes: (+61 -54) PassManager.cpp | 115 +++++++++++++++++++++++++++++--------------------------- 1 files changed, 61 insertions(+), 54 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.104 llvm/lib/VMCore/PassManager.cpp:1.105 --- llvm/lib/VMCore/PassManager.cpp:1.104 Fri Dec 15 13:39:30 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Dec 15 14:13:01 2006 @@ -191,8 +191,8 @@ } // Print passes managed by this top level manager. - void dumpPasses(); - void dumpArguments(); + void dumpPasses() const; + void dumpArguments() const; private: @@ -284,55 +284,14 @@ PMTopLevelManager *getTopLevelManager() { return TPM; } void setTopLevelManager(PMTopLevelManager *T) { TPM = T; } - unsigned getDepth() { return Depth; } - - // Print list of passes that are last used by P. - void dumpLastUses(Pass *P, unsigned Offset) { - - std::vector LUses; - - assert (TPM && "Top Level Manager is missing"); - TPM->collectLastUses(LUses, P); - - for (std::vector::iterator I = LUses.begin(), - E = LUses.end(); I != E; ++I) { - llvm::cerr << "--" << std::string(Offset*2, ' '); - (*I)->dumpPassStructure(0); - } - } - - void dumpPassArguments() { - for(std::vector::iterator I = PassVector.begin(), - E = PassVector.end(); I != E; ++I) { - if (PMDataManager *PMD = dynamic_cast(*I)) - PMD->dumpPassArguments(); - else - if (const PassInfo *PI = (*I)->getPassInfo()) - if (!PI->isAnalysisGroup()) - cerr << " -" << PI->getPassArgument(); - } - } - - void dumpPassInfo(Pass *P, std::string &Msg1, std::string &Msg2) { - if (PassDebugging_New < Executions) - return; - cerr << (void*)this << std::string(getDepth()*2+1, ' '); - cerr << Msg1; - cerr << P->getPassName(); - cerr << Msg2; - } + unsigned getDepth() const { return Depth; } + // Print routines used by debug-pass + void dumpLastUses(Pass *P, unsigned Offset) const; + void dumpPassArguments() const; + void dumpPassInfo(Pass *P, std::string &Msg1, std::string &Msg2) const; void dumpAnalysisSetInfo(const char *Msg, Pass *P, - const std::vector &Set) { - if (PassDebugging_New >= Details && !Set.empty()) { - cerr << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:"; - for (unsigned i = 0; i != Set.size(); ++i) { - if (i) cerr << ","; - cerr << " " << Set[i]->getPassName(); - } - cerr << "\n"; - } - } + const std::vector &Set) const; std::vector& getTransferredLastUses() { return TransferLastUses; @@ -728,26 +687,25 @@ } // Print passes managed by this top level manager. -void PMTopLevelManager::dumpPasses() { +void PMTopLevelManager::dumpPasses() const { // Print out the immutable passes for (unsigned i = 0, e = ImmutablePasses.size(); i != e; ++i) { ImmutablePasses[i]->dumpPassStructure(0); } - for (std::vector::iterator I = PassManagers.begin(), + for (std::vector::const_iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) (*I)->dumpPassStructure(1); - } -void PMTopLevelManager::dumpArguments() { +void PMTopLevelManager::dumpArguments() const { if (PassDebugging_New < Arguments) return; cerr << "Pass Arguments: "; - for (std::vector::iterator I = PassManagers.begin(), + for (std::vector::const_iterator I = PassManagers.begin(), E = PassManagers.end(); I != E; ++I) { PMDataManager *PMD = dynamic_cast(*I); assert(PMD && "This is not a PassManager"); @@ -948,6 +906,55 @@ return NULL; } +// Print list of passes that are last used by P. +void PMDataManager::dumpLastUses(Pass *P, unsigned Offset) const{ + + std::vector LUses; + + assert (TPM && "Top Level Manager is missing"); + TPM->collectLastUses(LUses, P); + + for (std::vector::iterator I = LUses.begin(), + E = LUses.end(); I != E; ++I) { + llvm::cerr << "--" << std::string(Offset*2, ' '); + (*I)->dumpPassStructure(0); + } +} + +void PMDataManager::dumpPassArguments() const { + for(std::vector::const_iterator I = PassVector.begin(), + E = PassVector.end(); I != E; ++I) { + if (PMDataManager *PMD = dynamic_cast(*I)) + PMD->dumpPassArguments(); + else + if (const PassInfo *PI = (*I)->getPassInfo()) + if (!PI->isAnalysisGroup()) + cerr << " -" << PI->getPassArgument(); + } +} + +void PMDataManager:: dumpPassInfo(Pass *P, std::string &Msg1, + std::string &Msg2) const { + if (PassDebugging_New < Executions) + return; + cerr << (void*)this << std::string(getDepth()*2+1, ' '); + cerr << Msg1; + cerr << P->getPassName(); + cerr << Msg2; +} + +void PMDataManager::dumpAnalysisSetInfo(const char *Msg, Pass *P, + const std::vector &Set) + const { + if (PassDebugging_New >= Details && !Set.empty()) { + cerr << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:"; + for (unsigned i = 0; i != Set.size(); ++i) { + if (i) cerr << ","; + cerr << " " << Set[i]->getPassName(); + } + cerr << "\n"; + } +} //===----------------------------------------------------------------------===// // NOTE: Is this the right place to define this method ? From jlaskey at apple.com Fri Dec 15 15:38:53 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 15 Dec 2006 15:38:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200612152138.kBFLcrH6008815@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.261 -> 1.262 --- Log message: This code was usurping the sextload expand in teh legalizer. Just make sure the right conditions are checked. --- Diffs of the changes: (+9 -7) DAGCombiner.cpp | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.261 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.262 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.261 Mon Dec 11 22:16:14 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Dec 15 15:38:30 2006 @@ -1943,13 +1943,15 @@ if ((ISD::isSEXTLoad(N0.Val) || ISD::isEXTLoad(N0.Val)) && N0.hasOneUse()) { LoadSDNode *LN0 = cast(N0); MVT::ValueType EVT = LN0->getLoadedVT(); - SDOperand ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, LN0->getChain(), - LN0->getBasePtr(), LN0->getSrcValue(), - LN0->getSrcValueOffset(), EVT); - CombineTo(N, ExtLoad); - CombineTo(N0.Val, DAG.getNode(ISD::TRUNCATE, N0.getValueType(), ExtLoad), - ExtLoad.getValue(1)); - return SDOperand(N, 0); // Return N so it doesn't get rechecked! + if (!AfterLegalize || TLI.isLoadXLegal(ISD::SEXTLOAD, EVT)) { + SDOperand ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, VT, LN0->getChain(), + LN0->getBasePtr(), LN0->getSrcValue(), + LN0->getSrcValueOffset(), EVT); + CombineTo(N, ExtLoad); + CombineTo(N0.Val, DAG.getNode(ISD::TRUNCATE, N0.getValueType(), ExtLoad), + ExtLoad.getValue(1)); + return SDOperand(N, 0); // Return N so it doesn't get rechecked! + } } return SDOperand(); From jlaskey at apple.com Fri Dec 15 15:39:48 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 15 Dec 2006 15:39:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstr64Bit.td Message-ID: <200612152139.kBFLdmAF009168@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstr64Bit.td updated: 1.37 -> 1.38 --- Log message: Patterns no longer needed due to fix in the DAG combiner. --- Diffs of the changes: (+0 -4) PPCInstr64Bit.td | 4 ---- 1 files changed, 4 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.37 llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.38 --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.37 Fri Dec 15 12:51:01 2006 +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td Fri Dec 15 15:39:31 2006 @@ -491,10 +491,6 @@ (LBZ8 iaddr:$src)>; def : Pat<(extloadi1 xaddr:$src), (LBZX8 xaddr:$src)>; -def : Pat<(sextloadi8 iaddr:$src), - (EXTSB8 (LBZ8 iaddr:$src))>; -def : Pat<(sextloadi8 xaddr:$src), - (EXTSB8 (LBZX8 xaddr:$src))>; def : Pat<(extloadi8 iaddr:$src), (LBZ8 iaddr:$src)>; def : Pat<(extloadi8 xaddr:$src), From reid at x10sys.com Fri Dec 15 15:46:52 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 15 Dec 2006 15:46:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Analyzer.cpp Message-ID: <200612152146.kBFLkqFM010150@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Analyzer.cpp updated: 1.25 -> 1.26 --- Log message: Remove an extraneous { at the end of a block. --- Diffs of the changes: (+1 -1) Analyzer.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Bytecode/Reader/Analyzer.cpp diff -u llvm/lib/Bytecode/Reader/Analyzer.cpp:1.25 llvm/lib/Bytecode/Reader/Analyzer.cpp:1.26 --- llvm/lib/Bytecode/Reader/Analyzer.cpp:1.25 Mon Nov 13 22:47:22 2006 +++ llvm/lib/Bytecode/Reader/Analyzer.cpp Fri Dec 15 15:46:37 2006 @@ -387,7 +387,7 @@ virtual void handleBasicBlockEnd(unsigned blocknum) { if (os) - *os << " } END BLOCK: BasicBlock #" << blocknum << "{\n"; + *os << " } END BLOCK: BasicBlock #" << blocknum << "\n"; } virtual void handleGlobalConstantsBegin() { From jeffc at jolt-lang.org Fri Dec 15 15:47:19 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 15 Dec 2006 15:47:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200612152147.kBFLlJUK010179@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.187 -> 1.188 --- Log message: Partial unbreak of VC++ (stream stuff has no easy fix). --- Diffs of the changes: (+1 -0) Constants.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.187 llvm/lib/VMCore/Constants.cpp:1.188 --- llvm/lib/VMCore/Constants.cpp:1.187 Tue Dec 12 17:36:14 2006 +++ llvm/lib/VMCore/Constants.cpp Fri Dec 15 15:47:01 2006 @@ -1371,6 +1371,7 @@ return new CompareConstantExpr(Instruction::FCmp, V.predicate, V.operands[0], V.operands[1]); assert(0 && "Invalid ConstantExpr!"); + return 0; } }; From jeffc at jolt-lang.org Fri Dec 15 15:47:22 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 15 Dec 2006 15:47:22 -0600 Subject: [llvm-commits] CVS: llvm/win32/VMCore/VMCore.vcproj Message-ID: <200612152147.kBFLlMQw010191@zion.cs.uiuc.edu> Changes in directory llvm/win32/VMCore: VMCore.vcproj updated: 1.23 -> 1.24 --- Log message: Partial unbreak of VC++ (stream stuff has no easy fix). --- Diffs of the changes: (+0 -9) VMCore.vcproj | 9 --------- 1 files changed, 9 deletions(-) Index: llvm/win32/VMCore/VMCore.vcproj diff -u llvm/win32/VMCore/VMCore.vcproj:1.23 llvm/win32/VMCore/VMCore.vcproj:1.24 --- llvm/win32/VMCore/VMCore.vcproj:1.23 Fri Dec 1 20:22:01 2006 +++ llvm/win32/VMCore/VMCore.vcproj Fri Dec 15 15:47:01 2006 @@ -113,9 +113,6 @@ RelativePath="..\..\lib\VMCore\AsmWriter.cpp"> - - - - - - Changes in directory llvm/win32/Analysis: Analysis.vcproj updated: 1.21 -> 1.22 --- Log message: Partial unbreak of VC++ (stream stuff has no easy fix). --- Diffs of the changes: (+0 -68) Analysis.vcproj | 68 -------------------------------------------------------- 1 files changed, 68 deletions(-) Index: llvm/win32/Analysis/Analysis.vcproj diff -u llvm/win32/Analysis/Analysis.vcproj:1.21 llvm/win32/Analysis/Analysis.vcproj:1.22 --- llvm/win32/Analysis/Analysis.vcproj:1.21 Fri Dec 1 20:22:01 2006 +++ llvm/win32/Analysis/Analysis.vcproj Fri Dec 15 15:47:01 2006 @@ -193,52 +193,6 @@ RelativePath="..\..\lib\Analysis\Ipa\GlobalsModRef.cpp"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From jeffc at jolt-lang.org Fri Dec 15 16:06:24 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 15 Dec 2006 16:06:24 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveInterval.h MachineInstr.h Message-ID: <200612152206.kBFM6OJC011009@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveInterval.h updated: 1.30 -> 1.31 MachineInstr.h updated: 1.205 -> 1.206 --- Log message: Complete unbreak of VC++ (Chris identified the simple fix). --- Diffs of the changes: (+2 -0) LiveInterval.h | 1 + MachineInstr.h | 1 + 2 files changed, 2 insertions(+) Index: llvm/include/llvm/CodeGen/LiveInterval.h diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.30 llvm/include/llvm/CodeGen/LiveInterval.h:1.31 --- llvm/include/llvm/CodeGen/LiveInterval.h:1.30 Wed Dec 6 19:30:31 2006 +++ llvm/include/llvm/CodeGen/LiveInterval.h Fri Dec 15 16:06:08 2006 @@ -26,6 +26,7 @@ #include #include #include +#include namespace llvm { class MRegisterInfo; Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.205 llvm/include/llvm/CodeGen/MachineInstr.h:1.206 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.205 Wed Dec 6 19:30:31 2006 +++ llvm/include/llvm/CodeGen/MachineInstr.h Fri Dec 15 16:06:08 2006 @@ -22,6 +22,7 @@ #include #include #include +#include namespace llvm { From evan.cheng at apple.com Fri Dec 15 16:43:10 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 15 Dec 2006 16:43:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612152243.kBFMhAlL012372@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.443 -> 1.444 --- Log message: Fix select_cc, select expansion to soft-fp bugs. --- Diffs of the changes: (+11 -3) LegalizeDAG.cpp | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.443 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.444 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.443 Fri Dec 15 01:36:19 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Dec 15 16:42:55 2006 @@ -4705,18 +4705,24 @@ SDOperand LL, LH, RL, RH; ExpandOp(Node->getOperand(1), LL, LH); ExpandOp(Node->getOperand(2), RL, RH); + if (getTypeAction(NVT) == Expand) + NVT = TLI.getTypeToExpandTo(NVT); Lo = DAG.getNode(ISD::SELECT, NVT, Node->getOperand(0), LL, RL); - Hi = DAG.getNode(ISD::SELECT, NVT, Node->getOperand(0), LH, RH); + if (VT != MVT::f32) + Hi = DAG.getNode(ISD::SELECT, NVT, Node->getOperand(0), LH, RH); break; } case ISD::SELECT_CC: { SDOperand TL, TH, FL, FH; ExpandOp(Node->getOperand(2), TL, TH); ExpandOp(Node->getOperand(3), FL, FH); + if (getTypeAction(NVT) == Expand) + NVT = TLI.getTypeToExpandTo(NVT); Lo = DAG.getNode(ISD::SELECT_CC, NVT, Node->getOperand(0), Node->getOperand(1), TL, FL, Node->getOperand(4)); - Hi = DAG.getNode(ISD::SELECT_CC, NVT, Node->getOperand(0), - Node->getOperand(1), TH, FH, Node->getOperand(4)); + if (VT != MVT::f32) + Hi = DAG.getNode(ISD::SELECT_CC, NVT, Node->getOperand(0), + Node->getOperand(1), TH, FH, Node->getOperand(4)); break; } case ISD::ANY_EXTEND: @@ -4761,6 +4767,8 @@ // f32 / f64 must be expanded to i32 / i64. if (VT == MVT::f32 || VT == MVT::f64) { Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0)); + if (getTypeAction(NVT) == Expand) + ExpandOp(Lo, Lo, Hi); break; } From jeffc at jolt-lang.org Fri Dec 15 16:57:29 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 15 Dec 2006 16:57:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp Message-ID: <200612152257.kBFMvTP2012735@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.40 -> 1.41 MachineBasicBlock.cpp updated: 1.36 -> 1.37 MachineInstr.cpp updated: 1.138 -> 1.139 --- Log message: An even better unbreakage... --- Diffs of the changes: (+24 -0) LiveInterval.cpp | 7 +++++++ MachineBasicBlock.cpp | 5 +++++ MachineInstr.cpp | 12 ++++++++++++ 3 files changed, 24 insertions(+) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.40 llvm/lib/CodeGen/LiveInterval.cpp:1.41 --- llvm/lib/CodeGen/LiveInterval.cpp:1.40 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/LiveInterval.cpp Fri Dec 15 16:57:14 2006 @@ -24,6 +24,7 @@ #include "llvm/Target/MRegisterInfo.h" #include #include +#include using namespace llvm; // An example for liveAt(): @@ -509,3 +510,9 @@ void LiveInterval::dump() const { cerr << *this << "\n"; } + + +OStream& llvm::operator<<(OStream& os, const LiveRange &LR) { + if (os.stream()) *os.stream() << LR; + return os; +} Index: llvm/lib/CodeGen/MachineBasicBlock.cpp diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.37 --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 Thu Dec 7 14:28:15 2006 +++ llvm/lib/CodeGen/MachineBasicBlock.cpp Fri Dec 15 16:57:14 2006 @@ -31,6 +31,11 @@ return OS; } +OStream& llvm::operator<<(OStream &OS, const MachineBasicBlock &MBB) { + if (OS.stream()) *OS.stream() << MBB; + return OS; +} + // MBBs start out as #-1. When a MBB is added to a MachineFunction, it // gets the next available unique MBB number. If it is removed from a // MachineFunction, it goes back to being #-1. Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.138 llvm/lib/CodeGen/MachineInstr.cpp:1.139 --- llvm/lib/CodeGen/MachineInstr.cpp:1.138 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/MachineInstr.cpp Fri Dec 15 16:57:14 2006 @@ -18,6 +18,7 @@ #include "llvm/Target/MRegisterInfo.h" #include "llvm/Support/LeakDetector.h" #include "llvm/Support/Streams.h" +#include using namespace llvm; /// MachineInstr ctor - This constructor creates a dummy MachineInstr with @@ -363,3 +364,14 @@ return OS; } + +OStream& llvm::operator<<(OStream& os, const MachineInstr& minstr) { + if (os.stream()) *os.stream() << minstr; + return os; +} + +OStream& llvm::operator<<(OStream& os, const MachineOperand& mop) { + if (os.stream()) *os.stream() << mop; + return os; +} + From jeffc at jolt-lang.org Fri Dec 15 16:57:31 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 15 Dec 2006 16:57:31 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveInterval.h MachineBasicBlock.h MachineInstr.h Message-ID: <200612152257.kBFMvVg7012744@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveInterval.h updated: 1.31 -> 1.32 MachineBasicBlock.h updated: 1.51 -> 1.52 MachineInstr.h updated: 1.206 -> 1.207 --- Log message: An even better unbreakage... --- Diffs of the changes: (+4 -18) LiveInterval.h | 6 +----- MachineBasicBlock.h | 5 +---- MachineInstr.h | 11 ++--------- 3 files changed, 4 insertions(+), 18 deletions(-) Index: llvm/include/llvm/CodeGen/LiveInterval.h diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.31 llvm/include/llvm/CodeGen/LiveInterval.h:1.32 --- llvm/include/llvm/CodeGen/LiveInterval.h:1.31 Fri Dec 15 16:06:08 2006 +++ llvm/include/llvm/CodeGen/LiveInterval.h Fri Dec 15 16:57:14 2006 @@ -26,7 +26,6 @@ #include #include #include -#include namespace llvm { class MRegisterInfo; @@ -63,10 +62,7 @@ }; std::ostream& operator<<(std::ostream& os, const LiveRange &LR); - inline OStream& operator<<(OStream& os, const LiveRange &LR) { - if (os.stream()) *os.stream() << LR; - return os; - } + OStream& operator<<(OStream& os, const LiveRange &LR); inline bool operator<(unsigned V, const LiveRange &LR) { return V < LR.start; Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.51 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.52 --- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.51 Wed Dec 6 19:30:31 2006 +++ llvm/include/llvm/CodeGen/MachineBasicBlock.h Fri Dec 15 16:57:14 2006 @@ -226,10 +226,7 @@ }; std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB); -inline OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB){ - if (OS.stream()) *OS.stream() << MBB; - return OS; -} +OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB); //===--------------------------------------------------------------------===// // GraphTraits specializations for machine basic block graphs (machine-CFGs) Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.206 llvm/include/llvm/CodeGen/MachineInstr.h:1.207 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.206 Fri Dec 15 16:06:08 2006 +++ llvm/include/llvm/CodeGen/MachineInstr.h Fri Dec 15 16:57:14 2006 @@ -22,7 +22,6 @@ #include #include #include -#include namespace llvm { @@ -286,10 +285,7 @@ IsDead = false; } - friend OStream& operator<<(OStream& os, const MachineOperand& mop) { - if (os.stream()) *os.stream() << mop; - return os; - } + friend OStream& operator<<(OStream& os, const MachineOperand& mop); friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop); friend class MachineInstr; @@ -403,10 +399,7 @@ } void print(std::ostream &OS, const TargetMachine *TM) const; void dump() const; - friend OStream& operator<<(OStream& os, const MachineInstr& minstr){ - if (os.stream()) *os.stream() << minstr; - return os; - } + friend OStream& operator<<(OStream& os, const MachineInstr& minstr); friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr); //===--------------------------------------------------------------------===// From dpatel at apple.com Fri Dec 15 16:58:04 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 15 Dec 2006 16:58:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612152258.kBFMw4lW012791@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.105 -> 1.106 --- Log message: Cosmetic changes, based on Chris's review. --- Diffs of the changes: (+21 -27) PassManager.cpp | 48 +++++++++++++++++++++--------------------------- 1 files changed, 21 insertions(+), 27 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.105 llvm/lib/VMCore/PassManager.cpp:1.106 --- llvm/lib/VMCore/PassManager.cpp:1.105 Fri Dec 15 14:13:01 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Dec 15 16:57:49 2006 @@ -221,7 +221,7 @@ /// used by pass managers. class PMDataManager { public: - PMDataManager(int D) : TPM(NULL), Depth(D) { + PMDataManager(int Depth) : TPM(NULL), Depth(Depth) { initializeAnalysisInfo(); } @@ -331,7 +331,7 @@ public FunctionPass { public: - BasicBlockPassManager(int D) : PMDataManager(D) { } + BasicBlockPassManager(int Depth) : PMDataManager(Depth) { } /// Add a pass into a passmanager queue. bool addPass(Pass *p); @@ -372,7 +372,7 @@ public PMDataManager, public PMTopLevelManager { public: - FunctionPassManagerImpl_New(int D) : PMDataManager(D) { + FunctionPassManagerImpl_New(int Depth) : PMDataManager(Depth) { activeBBPassManager = NULL; } ~FunctionPassManagerImpl_New() { /* TODO */ }; @@ -449,7 +449,7 @@ class ModulePassManager : public Pass, public PMDataManager { public: - ModulePassManager(int D) : PMDataManager(D) { + ModulePassManager(int Depth) : PMDataManager(Depth) { activeFunctionPassManager = NULL; } @@ -490,7 +490,7 @@ public: - PassManagerImpl_New(int D) : PMDataManager(D) { + PassManagerImpl_New(int Depth) : PMDataManager(Depth) { activeManager = NULL; } @@ -674,12 +674,9 @@ // If Pass not found then check the interfaces implemented by Immutable Pass if (!P) { - const std::vector &ImmPI = - PI->getInterfacesImplemented(); - for (unsigned Index = 0, End = ImmPI.size(); - P == NULL && Index != End; ++Index) - if (ImmPI[Index] == AID) - P = *I; + const std::vector &ImmPI = PI->getInterfacesImplemented(); + if (std::find(ImmPI.begin(), ImmPI.end(), AID) != ImmPI.end()) + P = *I; } } @@ -756,16 +753,13 @@ const std::vector &PreservedSet = AnUsage.getPreservedSet(); for (std::map::iterator I = AvailableAnalysis.begin(), E = AvailableAnalysis.end(); I != E; ) { - if (std::find(PreservedSet.begin(), PreservedSet.end(), I->first) == + std::map::iterator Info = I++; + if (std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) == PreservedSet.end()) { // Remove this analysis - if (!dynamic_cast(I->second)) { - std::map::iterator J = I++; - AvailableAnalysis.erase(J); - } else - ++I; - } else - ++I; + if (!dynamic_cast(Info->second)) + AvailableAnalysis.erase(Info); + } } } @@ -975,8 +969,8 @@ if (!BP) return false; - // If this pass does not preserve anlysis that is used by other passes - // managed by this manager than it is not a suiable pass for this manager. + // If this pass does not preserve analysis that is used by other passes + // managed by this manager than it is not a suitable pass for this manager. if (!manageablePass(P)) return false; @@ -1026,7 +1020,7 @@ recordAvailableAnalysis(P); removeDeadPasses(P, Msg2); } - return Changed | doFinalization(F); + return Changed |= doFinalization(F); } // Implement doInitialization and doFinalization @@ -1197,8 +1191,8 @@ if (!FP) return false; - // If this pass does not preserve anlysis that is used by other passes - // managed by this manager than it is not a suiable pass for this manager. + // If this pass does not preserve analysis that is used by other passes + // managed by this manager than it is not a suitable pass for this manager. if (!manageablePass(P)) return false; @@ -1224,7 +1218,7 @@ for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) this->runOnFunction(*I); - return Changed | doFinalization(M); + return Changed |= doFinalization(M); } /// Execute all of the passes scheduled for execution by invoking @@ -1366,8 +1360,8 @@ if (!MP) return false; - // If this pass does not preserve anlysis that is used by other passes - // managed by this manager than it is not a suiable pass for this manager. + // If this pass does not preserve analysis that is used by other passes + // managed by this manager than it is not a suitable pass for this manager. if (!manageablePass(P)) return false; From isanbard at gmail.com Fri Dec 15 17:10:53 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 15 Dec 2006 15:10:53 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp In-Reply-To: <200612152257.kBFMvTP2012735@zion.cs.uiuc.edu> References: <200612152257.kBFMvTP2012735@zion.cs.uiuc.edu> Message-ID: <36FAA7BD-A7F1-4020-BD1C-D377927DDD4C@gmail.com> Hold on. If you make these non-inlined, then the only chance for the compiler to remove potentially dead code (when o.stream() == 0) is through link time optimizations. Because this is still compiled by GCC right now, this won't be done and debug outputs will still be in the code. That is, they won't output anything, but the call will still be there. -bw On Dec 15, 2006, at 2:57 PM, Jeff Cohen wrote: > > > Changes in directory llvm/lib/CodeGen: > > LiveInterval.cpp updated: 1.40 -> 1.41 > MachineBasicBlock.cpp updated: 1.36 -> 1.37 > MachineInstr.cpp updated: 1.138 -> 1.139 > --- > Log message: > > An even better unbreakage... > > --- > Diffs of the changes: (+24 -0) > > LiveInterval.cpp | 7 +++++++ > MachineBasicBlock.cpp | 5 +++++ > MachineInstr.cpp | 12 ++++++++++++ > 3 files changed, 24 insertions(+) > > > Index: llvm/lib/CodeGen/LiveInterval.cpp > diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.40 llvm/lib/CodeGen/ > LiveInterval.cpp:1.41 > --- llvm/lib/CodeGen/LiveInterval.cpp:1.40 Wed Dec 6 19:30:31 2006 > +++ llvm/lib/CodeGen/LiveInterval.cpp Fri Dec 15 16:57:14 2006 > @@ -24,6 +24,7 @@ > #include "llvm/Target/MRegisterInfo.h" > #include > #include > +#include > using namespace llvm; > > // An example for liveAt(): > @@ -509,3 +510,9 @@ > void LiveInterval::dump() const { > cerr << *this << "\n"; > } > + > + > +OStream& llvm::operator<<(OStream& os, const LiveRange &LR) { > + if (os.stream()) *os.stream() << LR; > + return os; > +} > > > Index: llvm/lib/CodeGen/MachineBasicBlock.cpp > diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 llvm/lib/ > CodeGen/MachineBasicBlock.cpp:1.37 > --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 Thu Dec 7 14:28:15 > 2006 > +++ llvm/lib/CodeGen/MachineBasicBlock.cpp Fri Dec 15 16:57:14 2006 > @@ -31,6 +31,11 @@ > return OS; > } > > +OStream& llvm::operator<<(OStream &OS, const MachineBasicBlock > &MBB) { > + if (OS.stream()) *OS.stream() << MBB; > + return OS; > +} > + > // MBBs start out as #-1. When a MBB is added to a > MachineFunction, it > // gets the next available unique MBB number. If it is removed from a > // MachineFunction, it goes back to being #-1. > > > Index: llvm/lib/CodeGen/MachineInstr.cpp > diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.138 llvm/lib/CodeGen/ > MachineInstr.cpp:1.139 > --- llvm/lib/CodeGen/MachineInstr.cpp:1.138 Wed Dec 6 19:30:31 2006 > +++ llvm/lib/CodeGen/MachineInstr.cpp Fri Dec 15 16:57:14 2006 > @@ -18,6 +18,7 @@ > #include "llvm/Target/MRegisterInfo.h" > #include "llvm/Support/LeakDetector.h" > #include "llvm/Support/Streams.h" > +#include > using namespace llvm; > > /// MachineInstr ctor - This constructor creates a dummy > MachineInstr with > @@ -363,3 +364,14 @@ > > return OS; > } > + > +OStream& llvm::operator<<(OStream& os, const MachineInstr& minstr) { > + if (os.stream()) *os.stream() << minstr; > + return os; > +} > + > +OStream& llvm::operator<<(OStream& os, const MachineOperand& mop) { > + if (os.stream()) *os.stream() << mop; > + return os; > +} > + > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jeffc at jolt-lang.org Fri Dec 15 17:16:14 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 15 Dec 2006 15:16:14 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp In-Reply-To: <36FAA7BD-A7F1-4020-BD1C-D377927DDD4C@gmail.com> References: <200612152257.kBFMvTP2012735@zion.cs.uiuc.edu> <36FAA7BD-A7F1-4020-BD1C-D377927DDD4C@gmail.com> Message-ID: <45832CBE.5060507@jolt-lang.org> Chris asked me to not include from header files, and to move stuff out of the header files if possible to make it so. Bill Wendling wrote: > Hold on. If you make these non-inlined, then the only chance for the > compiler to remove potentially dead code (when o.stream() == 0) is > through link time optimizations. Because this is still compiled by GCC > right now, this won't be done and debug outputs will still be in the > code. That is, they won't output anything, but the call will still be > there. > > -bw > > On Dec 15, 2006, at 2:57 PM, Jeff Cohen wrote: > >> >> >> Changes in directory llvm/lib/CodeGen: >> >> LiveInterval.cpp updated: 1.40 -> 1.41 >> MachineBasicBlock.cpp updated: 1.36 -> 1.37 >> MachineInstr.cpp updated: 1.138 -> 1.139 >> --- >> Log message: >> >> An even better unbreakage... >> >> --- >> Diffs of the changes: (+24 -0) >> >> LiveInterval.cpp | 7 +++++++ >> MachineBasicBlock.cpp | 5 +++++ >> MachineInstr.cpp | 12 ++++++++++++ >> 3 files changed, 24 insertions(+) >> >> >> Index: llvm/lib/CodeGen/LiveInterval.cpp >> diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.40 >> llvm/lib/CodeGen/LiveInterval.cpp:1.41 >> --- llvm/lib/CodeGen/LiveInterval.cpp:1.40 Wed Dec 6 19:30:31 2006 >> +++ llvm/lib/CodeGen/LiveInterval.cpp Fri Dec 15 16:57:14 2006 >> @@ -24,6 +24,7 @@ >> #include "llvm/Target/MRegisterInfo.h" >> #include >> #include >> +#include >> using namespace llvm; >> >> // An example for liveAt(): >> @@ -509,3 +510,9 @@ >> void LiveInterval::dump() const { >> cerr << *this << "\n"; >> } >> + >> + >> +OStream& llvm::operator<<(OStream& os, const LiveRange &LR) { >> + if (os.stream()) *os.stream() << LR; >> + return os; >> +} >> >> >> Index: llvm/lib/CodeGen/MachineBasicBlock.cpp >> diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 >> llvm/lib/CodeGen/MachineBasicBlock.cpp:1.37 >> --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 Thu Dec 7 >> 14:28:15 2006 >> +++ llvm/lib/CodeGen/MachineBasicBlock.cpp Fri Dec 15 16:57:14 2006 >> @@ -31,6 +31,11 @@ >> return OS; >> } >> >> +OStream& llvm::operator<<(OStream &OS, const MachineBasicBlock &MBB) { >> + if (OS.stream()) *OS.stream() << MBB; >> + return OS; >> +} >> + >> // MBBs start out as #-1. When a MBB is added to a MachineFunction, it >> // gets the next available unique MBB number. If it is removed from a >> // MachineFunction, it goes back to being #-1. >> >> >> Index: llvm/lib/CodeGen/MachineInstr.cpp >> diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.138 >> llvm/lib/CodeGen/MachineInstr.cpp:1.139 >> --- llvm/lib/CodeGen/MachineInstr.cpp:1.138 Wed Dec 6 19:30:31 2006 >> +++ llvm/lib/CodeGen/MachineInstr.cpp Fri Dec 15 16:57:14 2006 >> @@ -18,6 +18,7 @@ >> #include "llvm/Target/MRegisterInfo.h" >> #include "llvm/Support/LeakDetector.h" >> #include "llvm/Support/Streams.h" >> +#include >> using namespace llvm; >> >> /// MachineInstr ctor - This constructor creates a dummy >> MachineInstr with >> @@ -363,3 +364,14 @@ >> >> return OS; >> } >> + >> +OStream& llvm::operator<<(OStream& os, const MachineInstr& minstr) { >> + if (os.stream()) *os.stream() << minstr; >> + return os; >> +} >> + >> +OStream& llvm::operator<<(OStream& os, const MachineOperand& mop) { >> + if (os.stream()) *os.stream() << mop; >> + return os; >> +} >> + >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > > From isanbard at gmail.com Fri Dec 15 17:31:52 2006 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 15 Dec 2006 15:31:52 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp In-Reply-To: <45832CBE.5060507@jolt-lang.org> References: <200612152257.kBFMvTP2012735@zion.cs.uiuc.edu> <36FAA7BD-A7F1-4020-BD1C-D377927DDD4C@gmail.com> <45832CBE.5060507@jolt-lang.org> Message-ID: <689BCAC5-A1AE-4556-A67C-292F3376AEF2@gmail.com> That's reasonable. So then a better solution would be to keep everything in the .h file, but change operator<<(OStream&) to call the "print()" function directly. So something like this: #include // ... OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB) { if (*OS.stream()) MBB->print(*OS.stream()); return OS; } I'm still working on a nice way of implementing something like this: template class BaseStream { StreamTy *stream; public: operator StreamTy () { return *stream; } }; but I'm having problems figuring out the "null" stream semantics (right now, it uses "stream = 0" as an indication that it's "null"). But the above hack should suffice in the meantime. -bw On Dec 15, 2006, at 3:16 PM, Jeff Cohen wrote: > Chris asked me to not include from header files, and to > move stuff out of the header files if possible to make it so. > > Bill Wendling wrote: >> Hold on. If you make these non-inlined, then the only chance for >> the compiler to remove potentially dead code (when o.stream() == >> 0) is through link time optimizations. Because this is still >> compiled by GCC right now, this won't be done and debug outputs >> will still be in the code. That is, they won't output anything, >> but the call will still be there. >> >> -bw >> >> On Dec 15, 2006, at 2:57 PM, Jeff Cohen wrote: >> >>> >>> >>> Changes in directory llvm/lib/CodeGen: >>> >>> LiveInterval.cpp updated: 1.40 -> 1.41 >>> MachineBasicBlock.cpp updated: 1.36 -> 1.37 >>> MachineInstr.cpp updated: 1.138 -> 1.139 >>> --- >>> Log message: >>> >>> An even better unbreakage... >>> >>> --- >>> Diffs of the changes: (+24 -0) >>> >>> LiveInterval.cpp | 7 +++++++ >>> MachineBasicBlock.cpp | 5 +++++ >>> MachineInstr.cpp | 12 ++++++++++++ >>> 3 files changed, 24 insertions(+) >>> >>> >>> Index: llvm/lib/CodeGen/LiveInterval.cpp >>> diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.40 llvm/lib/CodeGen/ >>> LiveInterval.cpp:1.41 >>> --- llvm/lib/CodeGen/LiveInterval.cpp:1.40 Wed Dec 6 19:30:31 >>> 2006 >>> +++ llvm/lib/CodeGen/LiveInterval.cpp Fri Dec 15 16:57:14 2006 >>> @@ -24,6 +24,7 @@ >>> #include "llvm/Target/MRegisterInfo.h" >>> #include >>> #include >>> +#include >>> using namespace llvm; >>> >>> // An example for liveAt(): >>> @@ -509,3 +510,9 @@ >>> void LiveInterval::dump() const { >>> cerr << *this << "\n"; >>> } >>> + >>> + >>> +OStream& llvm::operator<<(OStream& os, const LiveRange &LR) { >>> + if (os.stream()) *os.stream() << LR; >>> + return os; >>> +} >>> >>> >>> Index: llvm/lib/CodeGen/MachineBasicBlock.cpp >>> diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 llvm/lib/ >>> CodeGen/MachineBasicBlock.cpp:1.37 >>> --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 Thu Dec 7 >>> 14:28:15 2006 >>> +++ llvm/lib/CodeGen/MachineBasicBlock.cpp Fri Dec 15 16:57:14 >>> 2006 >>> @@ -31,6 +31,11 @@ >>> return OS; >>> } >>> >>> +OStream& llvm::operator<<(OStream &OS, const MachineBasicBlock >>> &MBB) { >>> + if (OS.stream()) *OS.stream() << MBB; >>> + return OS; >>> +} >>> + >>> // MBBs start out as #-1. When a MBB is added to a >>> MachineFunction, it >>> // gets the next available unique MBB number. If it is removed >>> from a >>> // MachineFunction, it goes back to being #-1. >>> >>> >>> Index: llvm/lib/CodeGen/MachineInstr.cpp >>> diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.138 llvm/lib/CodeGen/ >>> MachineInstr.cpp:1.139 >>> --- llvm/lib/CodeGen/MachineInstr.cpp:1.138 Wed Dec 6 >>> 19:30:31 2006 >>> +++ llvm/lib/CodeGen/MachineInstr.cpp Fri Dec 15 16:57:14 2006 >>> @@ -18,6 +18,7 @@ >>> #include "llvm/Target/MRegisterInfo.h" >>> #include "llvm/Support/LeakDetector.h" >>> #include "llvm/Support/Streams.h" >>> +#include >>> using namespace llvm; >>> >>> /// MachineInstr ctor - This constructor creates a dummy >>> MachineInstr with >>> @@ -363,3 +364,14 @@ >>> >>> return OS; >>> } >>> + >>> +OStream& llvm::operator<<(OStream& os, const MachineInstr& >>> minstr) { >>> + if (os.stream()) *os.stream() << minstr; >>> + return os; >>> +} >>> + >>> +OStream& llvm::operator<<(OStream& os, const MachineOperand& mop) { >>> + if (os.stream()) *os.stream() << mop; >>> + return os; >>> +} >>> + >>> >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> >> >> > From evan.cheng at apple.com Fri Dec 15 18:52:55 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 15 Dec 2006 18:52:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612160052.kBG0qtTj014646@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.444 -> 1.445 --- Log message: Expand fabs / fneg to and / xor. --- Diffs of the changes: (+22 -3) LegalizeDAG.cpp | 25 ++++++++++++++++++++++--- 1 files changed, 22 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.444 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.445 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.444 Fri Dec 15 16:42:55 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Dec 15 18:52:40 2006 @@ -5055,9 +5055,6 @@ case ISD::SREM: Lo = ExpandLibCall("__moddi3" , Node, Hi); break; case ISD::UREM: Lo = ExpandLibCall("__umoddi3", Node, Hi); break; - case ISD::FNEG: - Lo = ExpandLibCall(((VT == MVT::f32) ? "__negsf2" : "__negdf2"), Node, Hi); - break; case ISD::FADD: Lo = ExpandLibCall(((VT == MVT::f32) ? "__addsf3" : "__adddf3"), Node, Hi); break; @@ -5107,6 +5104,28 @@ Lo = ExpandLibCall(FnName, Node, Hi); break; } + case ISD::FABS: { + SDOperand Mask = (VT == MVT::f64) + ? DAG.getConstantFP(BitsToDouble(~(1ULL << 63)), VT) + : DAG.getConstantFP(BitsToFloat(~(1U << 31)), VT); + Mask = DAG.getNode(ISD::BIT_CONVERT, NVT, Mask); + Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0)); + Lo = DAG.getNode(ISD::AND, NVT, Lo, Mask); + if (getTypeAction(NVT) == Expand) + ExpandOp(Lo, Lo, Hi); + break; + } + case ISD::FNEG: { + SDOperand Mask = (VT == MVT::f64) + ? DAG.getConstantFP(BitsToDouble(1ULL << 63), VT) + : DAG.getConstantFP(BitsToFloat(1U << 31), VT); + Mask = DAG.getNode(ISD::BIT_CONVERT, NVT, Mask); + Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0)); + Lo = DAG.getNode(ISD::XOR, NVT, Lo, Mask); + if (getTypeAction(NVT) == Expand) + ExpandOp(Lo, Lo, Hi); + break; + } } // Make sure the resultant values have been legalized themselves, unless this From dpatel at apple.com Fri Dec 15 18:56:41 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 15 Dec 2006 18:56:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200612160056.kBG0ufoD014709@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.106 -> 1.107 --- Log message: Add getNumContainedPasses() and getContainedPass() inteface and use it instead of passVectorBegin/End(). --- Diffs of the changes: (+91 -95) PassManager.cpp | 186 +++++++++++++++++++++++++++----------------------------- 1 files changed, 91 insertions(+), 95 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.106 llvm/lib/VMCore/PassManager.cpp:1.107 --- llvm/lib/VMCore/PassManager.cpp:1.106 Fri Dec 15 16:57:49 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Dec 15 18:56:26 2006 @@ -272,14 +272,6 @@ /// then return NULL. Pass *findAnalysisPass(AnalysisID AID, bool Direction); - inline std::vector::iterator passVectorBegin() { - return PassVector.begin(); - } - - inline std::vector::iterator passVectorEnd() { - return PassVector.end(); - } - // Access toplevel manager PMTopLevelManager *getTopLevelManager() { return TPM; } void setTopLevelManager(PMTopLevelManager *T) { TPM = T; } @@ -297,6 +289,10 @@ return TransferLastUses; } + virtual unsigned getNumContainedPasses() { + return PassVector.size(); + } + protected: // If a FunctionPass F is the last user of ModulePass info M @@ -308,6 +304,9 @@ // Top level manager. PMTopLevelManager *TPM; + // Collection of pass that are managed by this manager + std::vector PassVector; + private: // Set of available Analysis. This information is used while scheduling // pass. If a pass requires an analysis which is not not available then @@ -315,9 +314,6 @@ // scheduled to run. std::map AvailableAnalysis; - // Collection of pass that are managed by this manager - std::vector PassVector; - unsigned Depth; }; @@ -353,12 +349,18 @@ // Print passes managed by this manager void dumpPassStructure(unsigned Offset) { llvm::cerr << std::string(Offset*2, ' ') << "BasicBlockPass Manager\n"; - for (std::vector::iterator I = passVectorBegin(), - E = passVectorEnd(); I != E; ++I) { - (*I)->dumpPassStructure(Offset + 1); - dumpLastUses(*I, Offset+1); + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + BasicBlockPass *BP = getContainedPass(Index); + BP->dumpPassStructure(Offset + 1); + dumpLastUses(BP, Offset+1); } } + + BasicBlockPass *getContainedPass(unsigned N) { + assert ( N < PassVector.size() && "Pass number out of range!"); + BasicBlockPass *BP = static_cast(PassVector[N]); + return BP; + } }; //===----------------------------------------------------------------------===// @@ -427,14 +429,20 @@ // Print passes managed by this manager void dumpPassStructure(unsigned Offset) { - llvm::cerr << std::string(Offset*2, ' ') << "FunctionPass Manager\n"; - for (std::vector::iterator I = passVectorBegin(), - E = passVectorEnd(); I != E; ++I) { - (*I)->dumpPassStructure(Offset + 1); - dumpLastUses(*I, Offset+1); + llvm::cerr << std::string(Offset*2, ' ') << "FunctionPass Manager 42\n"; + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + FunctionPass *FP = getContainedPass(Index); + FP->dumpPassStructure(Offset + 1); + dumpLastUses(FP, Offset+1); } } + FunctionPass *getContainedPass(unsigned N) { + assert ( N < PassVector.size() && "Pass number out of range!"); + FunctionPass *FP = static_cast(PassVector[N]); + return FP; + } + private: // Active Pass Managers BasicBlockPassManager *activeBBPassManager; @@ -468,13 +476,19 @@ // Print passes managed by this manager void dumpPassStructure(unsigned Offset) { llvm::cerr << std::string(Offset*2, ' ') << "ModulePass Manager\n"; - for (std::vector::iterator I = passVectorBegin(), - E = passVectorEnd(); I != E; ++I) { - (*I)->dumpPassStructure(Offset + 1); - dumpLastUses(*I, Offset+1); + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + ModulePass *MP = getContainedPass(Index); + MP->dumpPassStructure(Offset + 1); + dumpLastUses(MP, Offset+1); } } + ModulePass *getContainedPass(unsigned N) { + assert ( N < PassVector.size() && "Pass number out of range!"); + ModulePass *MP = static_cast(PassVector[N]); + return MP; + } + private: // Active Pass Manager FunctionPassManagerImpl_New *activeFunctionPassManager; @@ -995,30 +1009,28 @@ std::string Msg3 = "' Made Modification '"; for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) - for (std::vector::iterator itr = passVectorBegin(), - e = passVectorEnd(); itr != e; ++itr) { - Pass *P = *itr; + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + BasicBlockPass *BP = getContainedPass(Index); AnalysisUsage AnUsage; - P->getAnalysisUsage(AnUsage); + BP->getAnalysisUsage(AnUsage); std::string Msg2 = "' on BasicBlock '" + (*I).getName() + "'...\n"; - dumpPassInfo(P, Msg1, Msg2); - dumpAnalysisSetInfo("Required", P, AnUsage.getRequiredSet()); + dumpPassInfo(BP, Msg1, Msg2); + dumpAnalysisSetInfo("Required", BP, AnUsage.getRequiredSet()); - initializeAnalysisImpl(P); + initializeAnalysisImpl(BP); - BasicBlockPass *BP = dynamic_cast(P); - if (TheTimeInfo) TheTimeInfo->passStarted(P); + if (TheTimeInfo) TheTimeInfo->passStarted(BP); Changed |= BP->runOnBasicBlock(*I); - if (TheTimeInfo) TheTimeInfo->passEnded(P); + if (TheTimeInfo) TheTimeInfo->passEnded(BP); if (Changed) - dumpPassInfo(P, Msg3, Msg2); - dumpAnalysisSetInfo("Preserved", P, AnUsage.getPreservedSet()); + dumpPassInfo(BP, Msg3, Msg2); + dumpAnalysisSetInfo("Preserved", BP, AnUsage.getPreservedSet()); - removeNotPreservedAnalysis(P); - recordAvailableAnalysis(P); - removeDeadPasses(P, Msg2); + removeNotPreservedAnalysis(BP); + recordAvailableAnalysis(BP); + removeDeadPasses(BP, Msg2); } return Changed |= doFinalization(F); } @@ -1027,10 +1039,8 @@ inline bool BasicBlockPassManager::doInitialization(Module &M) { bool Changed = false; - for (std::vector::iterator itr = passVectorBegin(), - e = passVectorEnd(); itr != e; ++itr) { - Pass *P = *itr; - BasicBlockPass *BP = dynamic_cast(P); + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + BasicBlockPass *BP = getContainedPass(Index); Changed |= BP->doInitialization(M); } @@ -1040,10 +1050,8 @@ inline bool BasicBlockPassManager::doFinalization(Module &M) { bool Changed = false; - for (std::vector::iterator itr = passVectorBegin(), - e = passVectorEnd(); itr != e; ++itr) { - Pass *P = *itr; - BasicBlockPass *BP = dynamic_cast(P); + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + BasicBlockPass *BP = getContainedPass(Index); Changed |= BP->doFinalization(M); } @@ -1053,10 +1061,8 @@ inline bool BasicBlockPassManager::doInitialization(Function &F) { bool Changed = false; - for (std::vector::iterator itr = passVectorBegin(), - e = passVectorEnd(); itr != e; ++itr) { - Pass *P = *itr; - BasicBlockPass *BP = dynamic_cast(P); + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + BasicBlockPass *BP = getContainedPass(Index); Changed |= BP->doInitialization(F); } @@ -1066,10 +1072,8 @@ inline bool BasicBlockPassManager::doFinalization(Function &F) { bool Changed = false; - for (std::vector::iterator itr = passVectorBegin(), - e = passVectorEnd(); itr != e; ++itr) { - Pass *P = *itr; - BasicBlockPass *BP = dynamic_cast(P); + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + BasicBlockPass *BP = getContainedPass(Index); Changed |= BP->doFinalization(F); } @@ -1236,30 +1240,29 @@ std::string Msg1 = "Executing Pass '"; std::string Msg3 = "' Made Modification '"; - for (std::vector::iterator itr = passVectorBegin(), - e = passVectorEnd(); itr != e; ++itr) { - Pass *P = *itr; + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + FunctionPass *FP = getContainedPass(Index); + AnalysisUsage AnUsage; - P->getAnalysisUsage(AnUsage); + FP->getAnalysisUsage(AnUsage); std::string Msg2 = "' on Function '" + F.getName() + "'...\n"; - dumpPassInfo(P, Msg1, Msg2); - dumpAnalysisSetInfo("Required", P, AnUsage.getRequiredSet()); + dumpPassInfo(FP, Msg1, Msg2); + dumpAnalysisSetInfo("Required", FP, AnUsage.getRequiredSet()); - initializeAnalysisImpl(P); - FunctionPass *FP = dynamic_cast(P); + initializeAnalysisImpl(FP); - if (TheTimeInfo) TheTimeInfo->passStarted(P); + if (TheTimeInfo) TheTimeInfo->passStarted(FP); Changed |= FP->runOnFunction(F); - if (TheTimeInfo) TheTimeInfo->passEnded(P); + if (TheTimeInfo) TheTimeInfo->passEnded(FP); if (Changed) - dumpPassInfo(P, Msg3, Msg2); - dumpAnalysisSetInfo("Preserved", P, AnUsage.getPreservedSet()); + dumpPassInfo(FP, Msg3, Msg2); + dumpAnalysisSetInfo("Preserved", FP, AnUsage.getPreservedSet()); - removeNotPreservedAnalysis(P); - recordAvailableAnalysis(P); - removeDeadPasses(P, Msg2); + removeNotPreservedAnalysis(FP); + recordAvailableAnalysis(FP); + removeDeadPasses(FP, Msg2); } return Changed; } @@ -1268,11 +1271,8 @@ inline bool FunctionPassManagerImpl_New::doInitialization(Module &M) { bool Changed = false; - for (std::vector::iterator itr = passVectorBegin(), - e = passVectorEnd(); itr != e; ++itr) { - Pass *P = *itr; - - FunctionPass *FP = dynamic_cast(P); + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + FunctionPass *FP = getContainedPass(Index); Changed |= FP->doInitialization(M); } @@ -1282,11 +1282,8 @@ inline bool FunctionPassManagerImpl_New::doFinalization(Module &M) { bool Changed = false; - for (std::vector::iterator itr = passVectorBegin(), - e = passVectorEnd(); itr != e; ++itr) { - Pass *P = *itr; - - FunctionPass *FP = dynamic_cast(P); + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + FunctionPass *FP = getContainedPass(Index); Changed |= FP->doFinalization(M); } @@ -1387,30 +1384,29 @@ std::string Msg1 = "Executing Pass '"; std::string Msg3 = "' Made Modification '"; - for (std::vector::iterator itr = passVectorBegin(), - e = passVectorEnd(); itr != e; ++itr) { - Pass *P = *itr; + for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) { + ModulePass *MP = getContainedPass(Index); + AnalysisUsage AnUsage; - P->getAnalysisUsage(AnUsage); + MP->getAnalysisUsage(AnUsage); std::string Msg2 = "' on Module '" + M.getModuleIdentifier() + "'...\n"; - dumpPassInfo(P, Msg1, Msg2); - dumpAnalysisSetInfo("Required", P, AnUsage.getRequiredSet()); + dumpPassInfo(MP, Msg1, Msg2); + dumpAnalysisSetInfo("Required", MP, AnUsage.getRequiredSet()); - initializeAnalysisImpl(P); - ModulePass *MP = dynamic_cast(P); + initializeAnalysisImpl(MP); - if (TheTimeInfo) TheTimeInfo->passStarted(P); + if (TheTimeInfo) TheTimeInfo->passStarted(MP); Changed |= MP->runOnModule(M); - if (TheTimeInfo) TheTimeInfo->passEnded(P); + if (TheTimeInfo) TheTimeInfo->passEnded(MP); if (Changed) - dumpPassInfo(P, Msg3, Msg2); - dumpAnalysisSetInfo("Preserved", P, AnUsage.getPreservedSet()); + dumpPassInfo(MP, Msg3, Msg2); + dumpAnalysisSetInfo("Preserved", MP, AnUsage.getPreservedSet()); - removeNotPreservedAnalysis(P); - recordAvailableAnalysis(P); - removeDeadPasses(P, Msg2); + removeNotPreservedAnalysis(MP); + recordAvailableAnalysis(MP); + removeDeadPasses(MP, Msg2); } return Changed; } From clattner at apple.com Fri Dec 15 19:58:24 2006 From: clattner at apple.com (Chris Lattner) Date: Fri, 15 Dec 2006 17:58:24 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp In-Reply-To: <689BCAC5-A1AE-4556-A67C-292F3376AEF2@gmail.com> References: <200612152257.kBFMvTP2012735@zion.cs.uiuc.edu> <36FAA7BD-A7F1-4020-BD1C-D377927DDD4C@gmail.com> <45832CBE.5060507@jolt-lang.org> <689BCAC5-A1AE-4556-A67C-292F3376AEF2@gmail.com> Message-ID: On Dec 15, 2006, at 3:31 PM, Bill Wendling wrote: > That's reasonable. So then a better solution would be to keep > everything in the .h file, but change operator<<(OStream&) to call > the "print()" function directly. So something like this: > > #include > > // ... > > OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB) { > if (*OS.stream()) MBB->print(*OS.stream()); > return OS; > } > > I'm still working on a nice way of implementing something like this: > > template > class BaseStream { > StreamTy *stream; > public: > operator StreamTy () { return *stream; } > }; > > but I'm having problems figuring out the "null" stream semantics > (right now, it uses "stream = 0" as an indication that it's "null"). > But the above hack should suffice in the meantime. This is better, nice catch Bill! -Chris > > -bw > > On Dec 15, 2006, at 3:16 PM, Jeff Cohen wrote: > >> Chris asked me to not include from header files, and to >> move stuff out of the header files if possible to make it so. >> >> Bill Wendling wrote: >>> Hold on. If you make these non-inlined, then the only chance for >>> the compiler to remove potentially dead code (when o.stream() == >>> 0) is through link time optimizations. Because this is still >>> compiled by GCC right now, this won't be done and debug outputs >>> will still be in the code. That is, they won't output anything, >>> but the call will still be there. >>> >>> -bw >>> >>> On Dec 15, 2006, at 2:57 PM, Jeff Cohen wrote: >>> >>>> >>>> >>>> Changes in directory llvm/lib/CodeGen: >>>> >>>> LiveInterval.cpp updated: 1.40 -> 1.41 >>>> MachineBasicBlock.cpp updated: 1.36 -> 1.37 >>>> MachineInstr.cpp updated: 1.138 -> 1.139 >>>> --- >>>> Log message: >>>> >>>> An even better unbreakage... >>>> >>>> --- >>>> Diffs of the changes: (+24 -0) >>>> >>>> LiveInterval.cpp | 7 +++++++ >>>> MachineBasicBlock.cpp | 5 +++++ >>>> MachineInstr.cpp | 12 ++++++++++++ >>>> 3 files changed, 24 insertions(+) >>>> >>>> >>>> Index: llvm/lib/CodeGen/LiveInterval.cpp >>>> diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.40 llvm/lib/CodeGen/ >>>> LiveInterval.cpp:1.41 >>>> --- llvm/lib/CodeGen/LiveInterval.cpp:1.40 Wed Dec 6 19:30:31 >>>> 2006 >>>> +++ llvm/lib/CodeGen/LiveInterval.cpp Fri Dec 15 16:57:14 2006 >>>> @@ -24,6 +24,7 @@ >>>> #include "llvm/Target/MRegisterInfo.h" >>>> #include >>>> #include >>>> +#include >>>> using namespace llvm; >>>> >>>> // An example for liveAt(): >>>> @@ -509,3 +510,9 @@ >>>> void LiveInterval::dump() const { >>>> cerr << *this << "\n"; >>>> } >>>> + >>>> + >>>> +OStream& llvm::operator<<(OStream& os, const LiveRange &LR) { >>>> + if (os.stream()) *os.stream() << LR; >>>> + return os; >>>> +} >>>> >>>> >>>> Index: llvm/lib/CodeGen/MachineBasicBlock.cpp >>>> diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 llvm/lib/ >>>> CodeGen/MachineBasicBlock.cpp:1.37 >>>> --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.36 Thu Dec 7 >>>> 14:28:15 2006 >>>> +++ llvm/lib/CodeGen/MachineBasicBlock.cpp Fri Dec 15 16:57:14 >>>> 2006 >>>> @@ -31,6 +31,11 @@ >>>> return OS; >>>> } >>>> >>>> +OStream& llvm::operator<<(OStream &OS, const MachineBasicBlock >>>> &MBB) { >>>> + if (OS.stream()) *OS.stream() << MBB; >>>> + return OS; >>>> +} >>>> + >>>> // MBBs start out as #-1. When a MBB is added to a >>>> MachineFunction, it >>>> // gets the next available unique MBB number. If it is removed >>>> from a >>>> // MachineFunction, it goes back to being #-1. >>>> >>>> >>>> Index: llvm/lib/CodeGen/MachineInstr.cpp >>>> diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.138 llvm/lib/CodeGen/ >>>> MachineInstr.cpp:1.139 >>>> --- llvm/lib/CodeGen/MachineInstr.cpp:1.138 Wed Dec 6 >>>> 19:30:31 2006 >>>> +++ llvm/lib/CodeGen/MachineInstr.cpp Fri Dec 15 16:57:14 2006 >>>> @@ -18,6 +18,7 @@ >>>> #include "llvm/Target/MRegisterInfo.h" >>>> #include "llvm/Support/LeakDetector.h" >>>> #include "llvm/Support/Streams.h" >>>> +#include >>>> using namespace llvm; >>>> >>>> /// MachineInstr ctor - This constructor creates a dummy >>>> MachineInstr with >>>> @@ -363,3 +364,14 @@ >>>> >>>> return OS; >>>> } >>>> + >>>> +OStream& llvm::operator<<(OStream& os, const MachineInstr& >>>> minstr) { >>>> + if (os.stream()) *os.stream() << minstr; >>>> + return os; >>>> +} >>>> + >>>> +OStream& llvm::operator<<(OStream& os, const MachineOperand& >>>> mop) { >>>> + if (os.stream()) *os.stream() << mop; >>>> + return os; >>>> +} >>>> + >>>> >>>> >>>> >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >>> >>> >>> >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From jeffc at jolt-lang.org Fri Dec 15 17:58:06 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 15 Dec 2006 15:58:06 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp In-Reply-To: <689BCAC5-A1AE-4556-A67C-292F3376AEF2@gmail.com> References: <200612152257.kBFMvTP2012735@zion.cs.uiuc.edu> <36FAA7BD-A7F1-4020-BD1C-D377927DDD4C@gmail.com> <45832CBE.5060507@jolt-lang.org> <689BCAC5-A1AE-4556-A67C-292F3376AEF2@gmail.com> Message-ID: <4583368E.6020402@jolt-lang.org> I'll look into making this change. Part of the problem is that VC++ doesn't like *OS.stream() in a header file when isn't included, even if the declaration of std::basic_ostream shouldn't be needed (but doesn't have a problem with it in a .cpp file, probably because it isn't inlined then). This would appear to be a bug, but it also constrains my options. I could also just undo the change and go back to including in the header files. Gcc must be doing it implicitly anyway, as that's the only way some of that code can compile (which does need the declaration of std::basic_ostream). Bill Wendling wrote: > That's reasonable. So then a better solution would be to keep > everything in the .h file, but change operator<<(OStream&) to call the > "print()" function directly. So something like this: > > #include > > // ... > > OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB) { > if (*OS.stream()) MBB->print(*OS.stream()); > return OS; > } > > I'm still working on a nice way of implementing something like this: > > template > class BaseStream { > StreamTy *stream; > public: > operator StreamTy () { return *stream; } > }; > > but I'm having problems figuring out the "null" stream semantics > (right now, it uses "stream = 0" as an indication that it's "null"). > But the above hack should suffice in the meantime. > > -bw From clattner at apple.com Fri Dec 15 20:04:36 2006 From: clattner at apple.com (Chris Lattner) Date: Fri, 15 Dec 2006 18:04:36 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp In-Reply-To: <4583368E.6020402@jolt-lang.org> References: <200612152257.kBFMvTP2012735@zion.cs.uiuc.edu> <36FAA7BD-A7F1-4020-BD1C-D377927DDD4C@gmail.com> <45832CBE.5060507@jolt-lang.org> <689BCAC5-A1AE-4556-A67C-292F3376AEF2@gmail.com> <4583368E.6020402@jolt-lang.org> Message-ID: On Dec 15, 2006, at 3:58 PM, Jeff Cohen wrote: > I'll look into making this change. > > Part of the problem is that VC++ doesn't like *OS.stream() in a header > file when isn't included, even if the declaration of > std::basic_ostream shouldn't be needed (but doesn't have a problem > with > it in a .cpp file, probably because it isn't inlined then). This > would > appear to be a bug, but it also constrains my options. > > I could also just undo the change and go back to including > in > the header files. Gcc must be doing it implicitly anyway, as > that's the > only way some of that code can compile (which does need the > declaration > of std::basic_ostream). If *OS.stream() isn't working, it seems likely that LLVMStream.h isn't getting #included. Alternatively, perhaps isn't? -Chris > > Bill Wendling wrote: >> That's reasonable. So then a better solution would be to keep >> everything in the .h file, but change operator<<(OStream&) to call >> the >> "print()" function directly. So something like this: >> >> #include >> >> // ... >> >> OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB) { >> if (*OS.stream()) MBB->print(*OS.stream()); >> return OS; >> } >> >> I'm still working on a nice way of implementing something like this: >> >> template >> class BaseStream { >> StreamTy *stream; >> public: >> operator StreamTy () { return *stream; } >> }; >> >> but I'm having problems figuring out the "null" stream semantics >> (right now, it uses "stream = 0" as an indication that it's "null"). >> But the above hack should suffice in the meantime. >> >> -bw > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Fri Dec 15 20:10:45 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 15 Dec 2006 20:10:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612160210.kBG2Aj6k015828@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.445 -> 1.446 --- Log message: Allow promoted FP_TO_UINT / FP_TO_SINT to expand operand. --- Diffs of the changes: (+1 -2) LegalizeDAG.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.445 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.446 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.445 Fri Dec 15 18:52:40 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Dec 15 20:10:30 2006 @@ -3155,6 +3155,7 @@ case ISD::FP_TO_UINT: switch (getTypeAction(Node->getOperand(0).getValueType())) { case Legal: + case Expand: Tmp1 = Node->getOperand(0); break; case Promote: @@ -3162,8 +3163,6 @@ // special. Tmp1 = PromoteOp(Node->getOperand(0)); break; - case Expand: - assert(0 && "not implemented"); } // If we're promoting a UINT to a larger size, check to see if the new node // will be legal. If it isn't, check to see if FP_TO_SINT is legal, since From jeffc at jolt-lang.org Fri Dec 15 20:11:49 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 15 Dec 2006 18:11:49 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp In-Reply-To: References: <200612152257.kBFMvTP2012735@zion.cs.uiuc.edu> <36FAA7BD-A7F1-4020-BD1C-D377927DDD4C@gmail.com> <45832CBE.5060507@jolt-lang.org> <689BCAC5-A1AE-4556-A67C-292F3376AEF2@gmail.com> <4583368E.6020402@jolt-lang.org> Message-ID: <458355E5.5020307@jolt-lang.org> I got it to work... I'll be committing shortly. I'm not sure what the problem was, but it seems to have something to do with resolving the overload of operator<< and almost certainly is a VC++ bug. It won't accept a forward declared type when it ought to. Chris Lattner wrote: > > On Dec 15, 2006, at 3:58 PM, Jeff Cohen wrote: > >> I'll look into making this change. >> >> Part of the problem is that VC++ doesn't like *OS.stream() in a header >> file when isn't included, even if the declaration of >> std::basic_ostream shouldn't be needed (but doesn't have a problem with >> it in a .cpp file, probably because it isn't inlined then). This would >> appear to be a bug, but it also constrains my options. >> >> I could also just undo the change and go back to including in >> the header files. Gcc must be doing it implicitly anyway, as that's the >> only way some of that code can compile (which does need the declaration >> of std::basic_ostream). > > If *OS.stream() isn't working, it seems likely that LLVMStream.h isn't > getting #included. Alternatively, perhaps isn't? > > -Chris > >> >> Bill Wendling wrote: >>> That's reasonable. So then a better solution would be to keep >>> everything in the .h file, but change operator<<(OStream&) to call the >>> "print()" function directly. So something like this: >>> >>> #include >>> >>> // ... >>> >>> OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB) { >>> if (*OS.stream()) MBB->print(*OS.stream()); >>> return OS; >>> } >>> >>> I'm still working on a nice way of implementing something like this: >>> >>> template >>> class BaseStream { >>> StreamTy *stream; >>> public: >>> operator StreamTy () { return *stream; } >>> }; >>> >>> but I'm having problems figuring out the "null" stream semantics >>> (right now, it uses "stream = 0" as an indication that it's "null"). >>> But the above hack should suffice in the meantime. >>> >>> -bw >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > > From jeffc at jolt-lang.org Fri Dec 15 20:16:01 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 15 Dec 2006 20:16:01 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LiveInterval.h MachineBasicBlock.h MachineInstr.h Message-ID: <200612160216.kBG2G1D2015976@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LiveInterval.h updated: 1.32 -> 1.33 MachineBasicBlock.h updated: 1.52 -> 1.53 MachineInstr.h updated: 1.207 -> 1.208 --- Log message: The best unbreakage yet, addressing Bill's concerns. --- Diffs of the changes: (+30 -6) LiveInterval.h | 7 ++++++- MachineBasicBlock.h | 5 ++++- MachineInstr.h | 24 ++++++++++++++++++++---- 3 files changed, 30 insertions(+), 6 deletions(-) Index: llvm/include/llvm/CodeGen/LiveInterval.h diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.32 llvm/include/llvm/CodeGen/LiveInterval.h:1.33 --- llvm/include/llvm/CodeGen/LiveInterval.h:1.32 Fri Dec 15 16:57:14 2006 +++ llvm/include/llvm/CodeGen/LiveInterval.h Fri Dec 15 20:15:42 2006 @@ -56,13 +56,18 @@ } void dump() const; + void print(std::ostream &os) const; private: LiveRange(); // DO NOT IMPLEMENT }; std::ostream& operator<<(std::ostream& os, const LiveRange &LR); - OStream& operator<<(OStream& os, const LiveRange &LR); + inline OStream& operator<<(OStream& os, const LiveRange &LR) { + if (os.stream()) LR.print(*os.stream()); + return os; + } + inline bool operator<(unsigned V, const LiveRange &LR) { return V < LR.start; Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.52 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.53 --- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.52 Fri Dec 15 16:57:14 2006 +++ llvm/include/llvm/CodeGen/MachineBasicBlock.h Fri Dec 15 20:15:42 2006 @@ -226,7 +226,10 @@ }; std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB); -OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB); +inline OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB) { + if (OS.stream()) MBB.print(*OS.stream()); + return OS; +} //===--------------------------------------------------------------------===// // GraphTraits specializations for machine basic block graphs (machine-CFGs) Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.207 llvm/include/llvm/CodeGen/MachineInstr.h:1.208 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.207 Fri Dec 15 16:57:14 2006 +++ llvm/include/llvm/CodeGen/MachineInstr.h Fri Dec 15 20:15:42 2006 @@ -76,6 +76,9 @@ int offset; MachineOperand() {} + + void print(std::ostream &os) const; + public: MachineOperand(const MachineOperand &M) { *this = M; @@ -285,8 +288,14 @@ IsDead = false; } - friend OStream& operator<<(OStream& os, const MachineOperand& mop); - friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop); + friend OStream& operator<<(OStream& os, const MachineOperand& mop) { + if (os.stream()) mop.print(*os.stream()); + return os; + } + friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop) { + mop.print(os); + return os; + } friend class MachineInstr; }; @@ -398,9 +407,16 @@ if (OS.stream()) print(*OS.stream(), TM); } void print(std::ostream &OS, const TargetMachine *TM) const; + void print(std::ostream &OS) const; void dump() const; - friend OStream& operator<<(OStream& os, const MachineInstr& minstr); - friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr); + friend OStream& operator<<(OStream& os, const MachineInstr& minstr) { + if (os.stream()) minstr.print(*os.stream()); + return os; + } + friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr){ + minstr.print(os); + return os; + } //===--------------------------------------------------------------------===// // Accessors to add operands when building up machine instructions. From jeffc at jolt-lang.org Fri Dec 15 20:16:01 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 15 Dec 2006 20:16:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp Message-ID: <200612160216.kBG2G1Rx015969@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveInterval.cpp updated: 1.41 -> 1.42 MachineBasicBlock.cpp updated: 1.37 -> 1.38 MachineInstr.cpp updated: 1.139 -> 1.140 --- Log message: The best unbreakage yet, addressing Bill's concerns. --- Diffs of the changes: (+30 -49) LiveInterval.cpp | 5 +-- MachineBasicBlock.cpp | 5 --- MachineInstr.cpp | 69 ++++++++++++++++++++------------------------------ 3 files changed, 30 insertions(+), 49 deletions(-) Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.41 llvm/lib/CodeGen/LiveInterval.cpp:1.42 --- llvm/lib/CodeGen/LiveInterval.cpp:1.41 Fri Dec 15 16:57:14 2006 +++ llvm/lib/CodeGen/LiveInterval.cpp Fri Dec 15 20:15:42 2006 @@ -512,7 +512,6 @@ } -OStream& llvm::operator<<(OStream& os, const LiveRange &LR) { - if (os.stream()) *os.stream() << LR; - return os; +void LiveRange::print(std::ostream &os) const { + os << *this; } Index: llvm/lib/CodeGen/MachineBasicBlock.cpp diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.37 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.38 --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.37 Fri Dec 15 16:57:14 2006 +++ llvm/lib/CodeGen/MachineBasicBlock.cpp Fri Dec 15 20:15:42 2006 @@ -31,11 +31,6 @@ return OS; } -OStream& llvm::operator<<(OStream &OS, const MachineBasicBlock &MBB) { - if (OS.stream()) *OS.stream() << MBB; - return OS; -} - // MBBs start out as #-1. When a MBB is added to a MachineFunction, it // gets the next available unique MBB number. If it is removed from a // MachineFunction, it goes back to being #-1. Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.139 llvm/lib/CodeGen/MachineInstr.cpp:1.140 --- llvm/lib/CodeGen/MachineInstr.cpp:1.139 Fri Dec 15 16:57:14 2006 +++ llvm/lib/CodeGen/MachineInstr.cpp Fri Dec 15 20:15:42 2006 @@ -304,74 +304,61 @@ OS << "\n"; } -std::ostream &llvm::operator<<(std::ostream &os, const MachineInstr &MI) { +void MachineInstr::print(std::ostream &os) const { // If the instruction is embedded into a basic block, we can find the target // info for the instruction. - if (const MachineBasicBlock *MBB = MI.getParent()) { + if (const MachineBasicBlock *MBB = getParent()) { const MachineFunction *MF = MBB->getParent(); if (MF) - MI.print(os, &MF->getTarget()); + print(os, &MF->getTarget()); else - MI.print(os, 0); - return os; + print(os, 0); } // Otherwise, print it out in the "raw" format without symbolic register names // and such. - os << MI.getInstrDescriptor()->Name; + os << getInstrDescriptor()->Name; - for (unsigned i = 0, N = MI.getNumOperands(); i < N; i++) { - os << "\t" << MI.getOperand(i); - if (MI.getOperand(i).isReg() && MI.getOperand(i).isDef()) + for (unsigned i = 0, N = getNumOperands(); i < N; i++) { + os << "\t" << getOperand(i); + if (getOperand(i).isReg() && getOperand(i).isDef()) os << ""; } - return os << "\n"; + os << "\n"; } -std::ostream &llvm::operator<<(std::ostream &OS, const MachineOperand &MO) { - switch (MO.getType()) { - case MachineOperand::MO_Register: - OutputReg(OS, MO.getReg()); +void MachineOperand::print(std::ostream &OS) const { + switch (getType()) { + case MO_Register: + OutputReg(OS, getReg()); break; - case MachineOperand::MO_Immediate: - OS << (long)MO.getImmedValue(); + case MO_Immediate: + OS << (long)getImmedValue(); break; - case MachineOperand::MO_MachineBasicBlock: + case MO_MachineBasicBlock: OS << "getBasicBlock())->getName() - << "@" << (void*)MO.getMachineBasicBlock() << ">"; + << ((Value*)getMachineBasicBlock()->getBasicBlock())->getName() + << "@" << (void*)getMachineBasicBlock() << ">"; break; - case MachineOperand::MO_FrameIndex: - OS << ""; + case MO_FrameIndex: + OS << ""; break; - case MachineOperand::MO_ConstantPoolIndex: - OS << ""; + case MO_ConstantPoolIndex: + OS << ""; break; - case MachineOperand::MO_JumpTableIndex: - OS << ""; + case MO_JumpTableIndex: + OS << ""; break; - case MachineOperand::MO_GlobalAddress: - OS << "getName() << ">"; + case MO_GlobalAddress: + OS << "getName() << ">"; break; - case MachineOperand::MO_ExternalSymbol: - OS << ""; + case MO_ExternalSymbol: + OS << ""; break; default: assert(0 && "Unrecognized operand type"); break; } - - return OS; -} - -OStream& llvm::operator<<(OStream& os, const MachineInstr& minstr) { - if (os.stream()) *os.stream() << minstr; - return os; -} - -OStream& llvm::operator<<(OStream& os, const MachineOperand& mop) { - if (os.stream()) *os.stream() << mop; - return os; } From evan.cheng at apple.com Fri Dec 15 20:21:05 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 15 Dec 2006 20:21:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200612160221.kBG2L5hq016083@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.446 -> 1.447 --- Log message: Expand FP undef --- Diffs of the changes: (+1 -0) LegalizeDAG.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.446 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.447 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.446 Fri Dec 15 20:10:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Dec 15 20:20:50 2006 @@ -4523,6 +4523,7 @@ assert(0 && "Do not know how to expand this operator!"); abort(); case ISD::UNDEF: + NVT = TLI.getTypeToExpandTo(VT); Lo = DAG.getNode(ISD::UNDEF, NVT); Hi = DAG.getNode(ISD::UNDEF, NVT); break; From sabre at nondot.org Fri Dec 15 20:25:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 15 Dec 2006 20:25:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp Message-ID: <200612160225.kBG2Po93016290@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Verifier.cpp updated: 1.173 -> 1.174 --- Log message: Fix PR1042: http://llvm.org/PR1042 , by tightening up the subtle rules with invoke value use. --- Diffs of the changes: (+37 -3) Verifier.cpp | 40 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 37 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/Verifier.cpp diff -u llvm/lib/VMCore/Verifier.cpp:1.173 llvm/lib/VMCore/Verifier.cpp:1.174 --- llvm/lib/VMCore/Verifier.cpp:1.173 Tue Dec 12 22:45:46 2006 +++ llvm/lib/VMCore/Verifier.cpp Fri Dec 15 20:25:35 2006 @@ -355,7 +355,8 @@ // Check that the argument values match the function type for this function... unsigned i = 0; - for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++i) { + for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); + I != E; ++I, ++i) { Assert2(I->getType() == FT->getParamType(i), "Argument value does not match function argument type!", I, FT->getParamType(i)); @@ -898,9 +899,42 @@ if (!isa(I)) { // Invoke results are only usable in the normal destination, not in the // exceptional destination. - if (InvokeInst *II = dyn_cast(Op)) + if (InvokeInst *II = dyn_cast(Op)) { OpBlock = II->getNormalDest(); - else if (OpBlock == BB) { + + // If the normal successor of an invoke instruction has multiple + // predecessors, then the normal edge from the invoke is critical, so + // the invoke value can only be live if the destination block + // dominates all of it's predecessors (other than the invoke) or if + // the invoke value is only used by a phi in the successor. + if (!OpBlock->getSinglePredecessor() && + EF->dominates(&BB->getParent()->getEntryBlock(), BB)) { + // The first case we allow is if the use is a PHI operand in the + // normal block, and if that PHI operand corresponds to the invoke's + // block. + bool Bad = true; + if (PHINode *PN = dyn_cast(&I)) + if (PN->getParent() == OpBlock && + PN->getIncomingBlock(i/2) == Op->getParent()) + Bad = false; + + // If it is used by something non-phi, then the other case is that + // 'OpBlock' dominates all of its predecessors other than the + // invoke. In this case, the invoke value can still be used. + if (Bad) { + Bad = false; + for (pred_iterator PI = pred_begin(OpBlock), + E = pred_end(OpBlock); PI != E; ++PI) { + if (*PI != II->getParent() && !EF->dominates(OpBlock, *PI)) { + Bad = true; + break; + } + } + } + Assert1(!Bad, + "Invoke value defined on critical edge but not dead!", &I); + } + } else if (OpBlock == BB) { // If they are in the same basic block, make sure that the definition // comes before the use. Assert2(InstsInThisBlock.count(Op) || From sabre at nondot.org Fri Dec 15 20:27:12 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 15 Dec 2006 20:27:12 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Verifier/invoke-1.ll invoke-2.ll Message-ID: <200612160227.kBG2RCjj016367@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Verifier: invoke-1.ll added (r1.1) invoke-2.ll added (r1.1) --- Log message: testcases for PR1042: http://llvm.org/PR1042 --- Diffs of the changes: (+23 -0) invoke-1.ll | 10 ++++++++++ invoke-2.ll | 13 +++++++++++++ 2 files changed, 23 insertions(+) Index: llvm/test/Regression/Verifier/invoke-1.ll diff -c /dev/null llvm/test/Regression/Verifier/invoke-1.ll:1.1 *** /dev/null Fri Dec 15 20:27:07 2006 --- llvm/test/Regression/Verifier/invoke-1.ll Fri Dec 15 20:26:57 2006 *************** *** 0 **** --- 1,10 ---- + ; RUN: not llvm-as < %s -o /dev/null -f + ; PR1042 + + int %foo() { + %A = invoke int %foo( ) + to label %L unwind label %L ; [#uses=1] + + L: ; preds = %0, %0 + ret int %A + } Index: llvm/test/Regression/Verifier/invoke-2.ll diff -c /dev/null llvm/test/Regression/Verifier/invoke-2.ll:1.1 *** /dev/null Fri Dec 15 20:27:12 2006 --- llvm/test/Regression/Verifier/invoke-2.ll Fri Dec 15 20:26:57 2006 *************** *** 0 **** --- 1,13 ---- + ; RUN: not llvm-as < %s -o /dev/null -f + ; PR1042 + + int %foo() { + br bool false, label %L1, label %L2 + L1: + %A = invoke int %foo() to label %L unwind label %L + + L2: + br label %L + L: + ret int %A + } From sabre at nondot.org Fri Dec 15 20:29:37 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 15 Dec 2006 20:29:37 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll Message-ID: <200612160229.kBG2TbCB016450@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/SimplifyCFG: 2003-08-05-InvokeCrash.ll updated: 1.3 -> 1.4 --- Log message: fix buggy testcase --- Diffs of the changes: (+3 -1) 2003-08-05-InvokeCrash.ll | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll diff -u llvm/test/Regression/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll:1.3 llvm/test/Regression/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll:1.4 --- llvm/test/Regression/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll:1.3 Fri Dec 1 22:23:10 2006 +++ llvm/test/Regression/Transforms/SimplifyCFG/2003-08-05-InvokeCrash.ll Fri Dec 15 20:29:22 2006 @@ -3,7 +3,9 @@ ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output int %test() { - %A = invoke int %test() to label %Ret except label %Ret + %A = invoke int %test() to label %Ret except label %Ret2 Ret: ret int %A +Ret2: + ret int undef } From sabre at nondot.org Fri Dec 15 20:30:39 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 15 Dec 2006 20:30:39 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll Message-ID: <200612160230.kBG2Ud4F016499@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2003-10-29-CallSiteResolve.ll updated: 1.2 -> 1.3 --- Log message: Fix borken testcase --- Diffs of the changes: (+3 -1) 2003-10-29-CallSiteResolve.ll | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll diff -u llvm/test/Regression/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll:1.2 llvm/test/Regression/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll:1.3 --- llvm/test/Regression/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll:1.2 Fri Dec 1 22:23:09 2006 +++ llvm/test/Regression/Transforms/InstCombine/2003-10-29-CallSiteResolve.ll Fri Dec 15 20:30:24 2006 @@ -4,8 +4,10 @@ float* %foo() { %tmp.11 = invoke float* cast (int* ()* %bar to float* ()*)() - to label %invoke_cont except label %invoke_cont + to label %invoke_cont except label %X invoke_cont: ret float *%tmp.11 +X: + ret float *null } From evan.cheng at apple.com Sat Dec 16 00:22:10 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 16 Dec 2006 00:22:10 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h Message-ID: <200612160622.kBG6MAEB020626@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.162 -> 1.163 --- Log message: Typo. --- Diffs of the changes: (+1 -1) SelectionDAGNodes.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.162 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.163 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.162 Thu Nov 9 11:53:01 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Sat Dec 16 00:21:55 2006 @@ -1481,7 +1481,7 @@ unsigned getAlignment() const { return Alignment; } bool isVolatile() const { return IsVolatile; } - static bool classof(const LoadSDNode *) { return true; } + static bool classof(const StoreSDNode *) { return true; } static bool classof(const SDNode *N) { return N->getOpcode() == ISD::STORE; } From evan.cheng at apple.com Sat Dec 16 00:25:39 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 16 Dec 2006 00:25:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200612160625.kBG6PdrJ020712@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.262 -> 1.263 --- Log message: Cannot combine an indexed load / store any further. --- Diffs of the changes: (+10 -1) DAGCombiner.cpp | 11 ++++++++++- 1 files changed, 10 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.262 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.263 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.262 Fri Dec 15 15:38:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Dec 16 00:25:23 2006 @@ -2727,12 +2727,17 @@ SDOperand Ptr; MVT::ValueType VT; if (LoadSDNode *LD = dyn_cast(N)) { + if (LD->getAddressingMode() != ISD::UNINDEXED) + return false; VT = LD->getLoadedVT(); - if (!TLI.isIndexedLoadLegal(ISD::PRE_INC, VT) && + if (LD->getAddressingMode() != ISD::UNINDEXED && + !TLI.isIndexedLoadLegal(ISD::PRE_INC, VT) && !TLI.isIndexedLoadLegal(ISD::PRE_DEC, VT)) return false; Ptr = LD->getBasePtr(); } else if (StoreSDNode *ST = dyn_cast(N)) { + if (ST->getAddressingMode() != ISD::UNINDEXED) + return false; VT = ST->getStoredVT(); if (!TLI.isIndexedStoreLegal(ISD::PRE_INC, VT) && !TLI.isIndexedStoreLegal(ISD::PRE_DEC, VT)) @@ -2846,12 +2851,16 @@ SDOperand Ptr; MVT::ValueType VT; if (LoadSDNode *LD = dyn_cast(N)) { + if (LD->getAddressingMode() != ISD::UNINDEXED) + return false; VT = LD->getLoadedVT(); if (!TLI.isIndexedLoadLegal(ISD::POST_INC, VT) && !TLI.isIndexedLoadLegal(ISD::POST_DEC, VT)) return false; Ptr = LD->getBasePtr(); } else if (StoreSDNode *ST = dyn_cast(N)) { + if (ST->getAddressingMode() != ISD::UNINDEXED) + return false; VT = ST->getStoredVT(); if (!TLI.isIndexedStoreLegal(ISD::POST_INC, VT) && !TLI.isIndexedStoreLegal(ISD::POST_DEC, VT)) From clattner at apple.com Sat Dec 16 13:45:49 2006 From: clattner at apple.com (Chris Lattner) Date: Sat, 16 Dec 2006 11:45:49 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveInterval.cpp MachineBasicBlock.cpp MachineInstr.cpp In-Reply-To: <458355E5.5020307@jolt-lang.org> References: <200612152257.kBFMvTP2012735@zion.cs.uiuc.edu> <36FAA7BD-A7F1-4020-BD1C-D377927DDD4C@gmail.com> <45832CBE.5060507@jolt-lang.org> <689BCAC5-A1AE-4556-A67C-292F3376AEF2@gmail.com> <4583368E.6020402@jolt-lang.org> <458355E5.5020307@jolt-lang.org> Message-ID: On Dec 15, 2006, at 6:11 PM, Jeff Cohen wrote: > I got it to work... I'll be committing shortly. I'm not sure what > the problem was, but it seems to have something to do with > resolving the overload of operator<< and almost certainly is a VC++ > bug. It won't accept a forward declared type when it ought to. Nice, thanks again Jeff! -Chris From sabre at nondot.org Sat Dec 16 14:23:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 16 Dec 2006 14:23:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp Message-ID: <200612162023.kBGKNxWr014170@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCMachOWriter.cpp updated: 1.8 -> 1.9 --- Log message: Apply B. Scott Michel's patch for PR1054: http://llvm.org/PR1054 , thanks! --- Diffs of the changes: (+3 -3) PPCMachOWriter.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Target/PowerPC/PPCMachOWriter.cpp diff -u llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.8 llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.9 --- llvm/lib/Target/PowerPC/PPCMachOWriter.cpp:1.8 Sun Dec 10 20:20:45 2006 +++ llvm/lib/Target/PowerPC/PPCMachOWriter.cpp Sat Dec 16 14:23:42 2006 @@ -24,11 +24,11 @@ public: PPCMachOWriter(std::ostream &O, PPCTargetMachine &TM) : MachOWriter(O, TM) { if (TM.getTargetData()->getPointerSizeInBits() == 64) { - Header.cputype = MachOHeader::CPU_TYPE_POWERPC64; + Header.cputype = MachOHeader::HDR_CPU_TYPE_POWERPC64; } else { - Header.cputype = MachOHeader::CPU_TYPE_POWERPC; + Header.cputype = MachOHeader::HDR_CPU_TYPE_POWERPC; } - Header.cpusubtype = MachOHeader::CPU_SUBTYPE_POWERPC_ALL; + Header.cpusubtype = MachOHeader::HDR_CPU_SUBTYPE_POWERPC_ALL; } virtual void GetTargetRelocation(MachineRelocation &MR, MachOSection &From, From sabre at nondot.org Sat Dec 16 14:23:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 16 Dec 2006 14:23:59 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachOWriter.h Message-ID: <200612162023.kBGKNx2Y014175@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachOWriter.h updated: 1.8 -> 1.9 --- Log message: Apply B. Scott Michel's patch for PR1054: http://llvm.org/PR1054 , thanks! --- Diffs of the changes: (+71 -16) MachOWriter.h | 87 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 71 insertions(+), 16 deletions(-) Index: llvm/include/llvm/CodeGen/MachOWriter.h diff -u llvm/include/llvm/CodeGen/MachOWriter.h:1.8 llvm/include/llvm/CodeGen/MachOWriter.h:1.9 --- llvm/include/llvm/CodeGen/MachOWriter.h:1.8 Sun Dec 10 20:20:45 2006 +++ llvm/include/llvm/CodeGen/MachOWriter.h Sat Dec 16 14:23:42 2006 @@ -138,23 +138,60 @@ /// up for emission to the file. DataBuffer HeaderData; + // The various CPU_TYPE_* constants are already defined by at least one + // system header file and create compilation errors if not respected. +#if !defined(CPU_TYPE_I386) +#define CPU_TYPE_I386 7 +#endif +#if !defined(CPU_TYPE_X86_64) +#define CPU_TYPE_X86_64 (CPU_TYPE_I386 | 0x1000000) +#endif +#if !defined(CPU_TYPE_ARM) +#define CPU_TYPE_ARM 12 +#endif +#if !defined(CPU_TYPE_SPARC) +#define CPU_TYPE_SPARC 14 +#endif +#if !defined(CPU_TYPE_POWERPC) +#define CPU_TYPE_POWERPC 18 +#endif +#if !defined(CPU_TYPE_POWERPC64) +#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | 0x1000000) +#endif + // Constants for the cputype field // see - enum { CPU_TYPE_I386 = 7, - CPU_TYPE_X86_64 = 7 | 0x1000000, - CPU_TYPE_ARM = 12, - CPU_TYPE_SPARC = 14, - CPU_TYPE_POWERPC = 18, - CPU_TYPE_POWERPC64 = 18 | 0x1000000 + enum { HDR_CPU_TYPE_I386 = CPU_TYPE_I386, + HDR_CPU_TYPE_X86_64 = CPU_TYPE_X86_64, + HDR_CPU_TYPE_ARM = CPU_TYPE_ARM, + HDR_CPU_TYPE_SPARC = CPU_TYPE_SPARC, + HDR_CPU_TYPE_POWERPC = CPU_TYPE_POWERPC, + HDR_CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC64 }; +#if !defined(CPU_SUBTYPE_I386_ALL) +#define CPU_SUBTYPE_I386_ALL 3 +#endif +#if !defined(CPU_SUBTYPE_X86_64_ALL) +#define CPU_SUBTYPE_X86_64_ALL 3 +#endif +#if !defined(CPU_SUBTYPE_ARM_ALL) +#define CPU_SUBTYPE_ARM_ALL 0 +#endif +#if !defined(CPU_SUBTYPE_SPARC_ALL) +#define CPU_SUBTYPE_SPARC_ALL 0 +#endif +#if !defined(CPU_SUBTYPE_POWERPC_ALL) +#define CPU_SUBTYPE_POWERPC_ALL 0 + +#endif // Constants for the cpusubtype field // see - enum { CPU_SUBTYPE_I386_ALL = 3, - CPU_SUBTYPE_X86_64_ALL = 3, - CPU_SUBTYPE_ARM_ALL = 0, - CPU_SUBTYPE_SPARC_ALL = 0, - CPU_SUBTYPE_POWERPC_ALL = 0 + enum { HDR_CPU_SUBTYPE_I386_ALL = CPU_SUBTYPE_I386_ALL, + HDR_CPU_SUBTYPE_X86_64_ALL = CPU_SUBTYPE_X86_64_ALL, + HDR_CPU_SUBTYPE_ARM_ALL = CPU_SUBTYPE_ARM_ALL, + HDR_CPU_SUBTYPE_SPARC_ALL = CPU_SUBTYPE_SPARC_ALL, + HDR_CPU_SUBTYPE_POWERPC_ALL = CPU_SUBTYPE_POWERPC_ALL }; // Constants for the filetype field @@ -267,13 +304,31 @@ uint32_t nsects; // number of sections in this segment uint32_t flags; // flags + // The following constants are getting pulled in by one of the + // system headers, which creates a neat clash with the enum. +#if !defined(VM_PROT_NONE) +#define VM_PROT_NONE 0x00 +#endif +#if !defined(VM_PROT_READ) +#define VM_PROT_READ 0x01 +#endif +#if !defined(VM_PROT_WRITE) +#define VM_PROT_WRITE 0x02 +#endif +#if !defined(VM_PROT_EXECUTE) +#define VM_PROT_EXECUTE 0x04 +#endif +#if !defined(VM_PROT_ALL) +#define VM_PROT_ALL 0x07 +#endif + // Constants for the vm protection fields // see - enum { VM_PROT_NONE = 0x00, - VM_PROT_READ = 0x01, // read permission - VM_PROT_WRITE = 0x02, // write permission - VM_PROT_EXECUTE = 0x04, // execute permission, - VM_PROT_ALL = 0x07 + enum { SEG_VM_PROT_NONE = VM_PROT_NONE, + SEG_VM_PROT_READ = VM_PROT_READ, // read permission + SEG_VM_PROT_WRITE = VM_PROT_WRITE, // write permission + SEG_VM_PROT_EXECUTE = VM_PROT_EXECUTE, + SEG_VM_PROT_ALL = VM_PROT_ALL }; // Constants for the cmd field From sabre at nondot.org Sat Dec 16 14:27:58 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 16 Dec 2006 14:27:58 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/CBackend/2003-06-28-InvokeSupport.ll Message-ID: <200612162027.kBGKRwqG014272@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/CBackend: 2003-06-28-InvokeSupport.ll updated: 1.3 -> 1.4 --- Log message: Fix one more broken testcase --- Diffs of the changes: (+1 -1) 2003-06-28-InvokeSupport.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/CBackend/2003-06-28-InvokeSupport.ll diff -u llvm/test/Regression/CodeGen/CBackend/2003-06-28-InvokeSupport.ll:1.3 llvm/test/Regression/CodeGen/CBackend/2003-06-28-InvokeSupport.ll:1.4 --- llvm/test/Regression/CodeGen/CBackend/2003-06-28-InvokeSupport.ll:1.3 Fri Dec 1 22:23:08 2006 +++ llvm/test/Regression/CodeGen/CBackend/2003-06-28-InvokeSupport.ll Sat Dec 16 14:27:43 2006 @@ -8,7 +8,7 @@ %A = invoke int %callee(int %X, int 5) to label %Ok except label %Threw Ok: %B = phi int [%A, %0], [-1, %Threw] - ret int %A + ret int %B Threw: br label %Ok } From sabre at nondot.org Sat Dec 16 15:13:05 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 16 Dec 2006 15:13:05 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll Message-ID: <200612162113.kBGLD5Ce015091@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2006-12-16-InlineAsmCrash.ll added (r1.1) --- Log message: testcase for pr1049: http://llvm.org/PR1049 --- Diffs of the changes: (+34 -0) 2006-12-16-InlineAsmCrash.ll | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll diff -c /dev/null llvm/test/Regression/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll:1.1 *** /dev/null Sat Dec 16 15:12:59 2006 --- llvm/test/Regression/CodeGen/Generic/2006-12-16-InlineAsmCrash.ll Sat Dec 16 15:12:49 2006 *************** *** 0 **** --- 1,34 ---- + ; RUN: llvm-as < %s | llc -march=x86 + ; PR1049 + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + %struct.QBasicAtomic = type { int } + %struct.QByteArray = type { "struct.QByteArray::Data"* } + "struct.QByteArray::Data" = type { %struct.QBasicAtomic, int, int, sbyte*, [1 x sbyte] } + %struct.QFactoryLoader = type { %struct.QObject } + %struct.QImageIOHandler = type { int (...)**, %struct.QImageIOHandlerPrivate* } + %struct.QImageIOHandlerPrivate = type opaque + %struct.QImageWriter = type { %struct.QImageWriterPrivate* } + %struct.QImageWriterPrivate = type { %struct.QByteArray, %struct.QFactoryLoader*, bool, %struct.QImageIOHandler*, int, float, %struct.QString, %struct.QString, uint, %struct.QString, %struct.QImageWriter* } + "struct.QList" = type { "struct.QList::._20" } + "struct.QList::._20" = type { %struct.QListData } + %struct.QListData = type { "struct.QListData::Data"* } + "struct.QListData::Data" = type { %struct.QBasicAtomic, int, int, int, ubyte, [1 x sbyte*] } + %struct.QObject = type { int (...)**, %struct.QObjectData* } + %struct.QObjectData = type { int (...)**, %struct.QObject*, %struct.QObject*, "struct.QList", ubyte, [3 x ubyte], int, int } + %struct.QString = type { "struct.QString::Data"* } + "struct.QString::Data" = type { %struct.QBasicAtomic, int, int, ushort*, ubyte, ubyte, [1 x ushort] } + + implementation ; Functions: + + bool %_ZNK12QImageWriter8canWriteEv() { + %tmp62 = load %struct.QImageWriterPrivate** null ; <%struct.QImageWriterPrivate*> [#uses=1] + %tmp = getelementptr %struct.QImageWriterPrivate* %tmp62, int 0, uint 9 ; <%struct.QString*> [#uses=1] + %tmp75 = call %struct.QString* %_ZN7QStringaSERKS_( %struct.QString* %tmp, %struct.QString* null ) ; <%struct.QString*> [#uses=0] + call void asm sideeffect "lock\0Adecl $0\0Asetne 1", "==m"( int* null ) + ret bool false + } + + declare %struct.QString* %_ZN7QStringaSERKS_(%struct.QString*, %struct.QString*) From sabre at nondot.org Sat Dec 16 15:15:03 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 16 Dec 2006 15:15:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200612162115.kBGLF3Zr015172@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.331 -> 1.332 --- Log message: Fix PR1049: http://llvm.org/PR1049 and CodeGen/Generic/2006-12-16-InlineAsmCrash.ll by producing target constants instead of constants. Constants can get selected to li/movri instructions, which causes the scheduler to explode. --- Diffs of the changes: (+2 -1) SelectionDAGISel.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.331 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.332 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.331 Wed Dec 13 14:57:08 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Sat Dec 16 15:14:48 2006 @@ -4399,7 +4399,8 @@ } // Add this to the output node. - Ops.push_back(DAG.getConstant(4/*MEM*/ | (SelOps.size() << 3), MVT::i32)); + Ops.push_back(DAG.getTargetConstant(4/*MEM*/ | (SelOps.size() << 3), + MVT::i32)); Ops.insert(Ops.end(), SelOps.begin(), SelOps.end()); i += 2; } From sabre at nondot.org Sat Dec 16 15:22:08 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 16 Dec 2006 15:22:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Message-ID: <200612162122.kBGLM8Cw015351@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: DeadArgumentElimination.cpp updated: 1.31 -> 1.32 --- Log message: when inserting a dummy argument to work-around the CBE not supporting zero arg vararg functions, pass undef instead of 'int 0', which is cheaper. --- Diffs of the changes: (+1 -3) DeadArgumentElimination.cpp | 4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) Index: llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp diff -u llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.31 llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.32 --- llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp:1.31 Wed Dec 6 11:46:32 2006 +++ llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp Sat Dec 16 15:21:53 2006 @@ -499,8 +499,6 @@ // Work around LLVM bug PR56: the CWriter cannot emit varargs functions which // have zero fixed arguments. // - // FIXME: once this bug is fixed in the CWriter, this hack should be removed. - // bool ExtraArgHack = false; if (Params.empty() && FTy->isVarArg()) { ExtraArgHack = true; @@ -530,7 +528,7 @@ Args.push_back(*AI); if (ExtraArgHack) - Args.push_back(Constant::getNullValue(Type::IntTy)); + Args.push_back(UndefValue::get(Type::IntTy)); // Push any varargs arguments on the list for (; AI != CS.arg_end(); ++AI) From reid at x10sys.com Sat Dec 16 16:08:07 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 16 Dec 2006 16:08:07 -0600 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200612162208.kBGM87X9016189@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.255 -> 1.256 --- Log message: Allow an --enable-pic option to turn on -fPIC compiler option when building. The default is disabled until we know this doesn't break anyone. --- Diffs of the changes: (+14 -0) configure.ac | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.255 llvm/autoconf/configure.ac:1.256 --- llvm/autoconf/configure.ac:1.255 Sun Dec 10 17:12:42 2006 +++ llvm/autoconf/configure.ac Sat Dec 16 16:07:52 2006 @@ -322,6 +322,20 @@ esac AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled]) +dnl Allow building with position independent code +AC_ARG_ENABLE(pic, + AS_HELP_STRING([--enable-pic], + [Build LLVM with Position Independent Code (default is NO)]),, + enableval=default) +case "$enableval" in + yes) AC_SUBST(ENABLE_PIC,[1]) ;; + no) AC_SUBST(ENABLE_PIC,[0]) ;; + default) AC_SUBST(ENABLE_PIC,[0]) ;; + *) AC_MSG_ERROR([Invalid setting for --enable-pic. Use "yes" or "no"]) ;; +esac +AC_DEFINE_UNQUOTED([ENABLE_PIC],$ENABLE_PIC, + [Define if position independent code is enabled]) + dnl Allow specific targets to be specified for building (or not) TARGETS_TO_BUILD="" AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets], From reid at x10sys.com Sat Dec 16 16:08:09 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 16 Dec 2006 16:08:09 -0600 Subject: [llvm-commits] CVS: llvm/configure Makefile.config.in Makefile.rules Message-ID: <200612162208.kBGM89fW016198@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.260 -> 1.261 Makefile.config.in updated: 1.71 -> 1.72 Makefile.rules updated: 1.415 -> 1.416 --- Log message: Allow an --enable-pic option to turn on -fPIC compiler option when building. The default is disabled until we know this doesn't break anyone. --- Diffs of the changes: (+68 -28) Makefile.config.in | 3 + Makefile.rules | 13 +++++++- configure | 80 +++++++++++++++++++++++++++++++++++------------------ 3 files changed, 68 insertions(+), 28 deletions(-) Index: llvm/configure diff -u llvm/configure:1.260 llvm/configure:1.261 --- llvm/configure:1.260 Sun Dec 10 17:29:19 2006 +++ llvm/configure Sat Dec 16 16:07:52 2006 @@ -835,6 +835,7 @@ TARGET_HAS_JIT ENABLE_DOXYGEN ENABLE_THREADS +ENABLE_PIC TARGETS_TO_BUILD ENABLE_CBE_PRINTF_A EXTRA_OPTIONS @@ -1525,6 +1526,8 @@ --enable-jit Enable Just In Time Compiling (default is YES) --enable-doxygen Build doxygen documentation (default is NO) --enable-threads Use threads if available (default is YES) + --enable-pic Build LLVM with Position Independent Code (default + is NO) --enable-targets Build specific host targets: all,host-only,{target-name} (default=all) --enable-cbe-printf-a Enable C Backend output with hex floating point via @@ -4652,6 +4655,30 @@ _ACEOF +# Check whether --enable-pic was given. +if test "${enable_pic+set}" = set; then + enableval=$enable_pic; +else + enableval=default +fi + +case "$enableval" in + yes) ENABLE_PIC=1 + ;; + no) ENABLE_PIC=0 + ;; + default) ENABLE_PIC=0 + ;; + *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-pic. Use \"yes\" or \"no\"" >&5 +echo "$as_me: error: Invalid setting for --enable-pic. Use \"yes\" or \"no\"" >&2;} + { (exit 1); exit 1; }; } ;; +esac + +cat >>confdefs.h <<_ACEOF +#define ENABLE_PIC $ENABLE_PIC +_ACEOF + + TARGETS_TO_BUILD="" # Check whether --enable-targets was given. if test "${enable_targets+set}" = set; then @@ -10299,7 +10326,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 12473 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14161,11 +14188,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14164: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14191: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14168: \$? = $ac_status" >&5 + echo "$as_me:14195: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14429,11 +14456,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14432: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14459: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14436: \$? = $ac_status" >&5 + echo "$as_me:14463: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14533,11 +14560,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14536: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14563: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14540: \$? = $ac_status" >&5 + echo "$as_me:14567: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16985,7 +17012,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19483: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19460: \$? = $ac_status" >&5 + echo "$as_me:19487: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -19557,11 +19584,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19560: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19587: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19564: \$? = $ac_status" >&5 + echo "$as_me:19591: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21127,11 +21154,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21130: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21157: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21134: \$? = $ac_status" >&5 + echo "$as_me:21161: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -21231,11 +21258,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21234: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21261: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21238: \$? = $ac_status" >&5 + echo "$as_me:21265: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23466,11 +23493,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23469: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23496: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23473: \$? = $ac_status" >&5 + echo "$as_me:23500: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -23734,11 +23761,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23737: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23764: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23741: \$? = $ac_status" >&5 + echo "$as_me:23768: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -23838,11 +23865,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23841: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23868: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:23845: \$? = $ac_status" >&5 + echo "$as_me:23872: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -34170,6 +34197,7 @@ TARGET_HAS_JIT!$TARGET_HAS_JIT$ac_delim ENABLE_DOXYGEN!$ENABLE_DOXYGEN$ac_delim ENABLE_THREADS!$ENABLE_THREADS$ac_delim +ENABLE_PIC!$ENABLE_PIC$ac_delim TARGETS_TO_BUILD!$TARGETS_TO_BUILD$ac_delim ENABLE_CBE_PRINTF_A!$ENABLE_CBE_PRINTF_A$ac_delim EXTRA_OPTIONS!$EXTRA_OPTIONS$ac_delim @@ -34187,7 +34215,6 @@ ifGNUmake!$ifGNUmake$ac_delim LN_S!$LN_S$ac_delim CMP!$CMP$ac_delim -CP!$CP$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then @@ -34229,6 +34256,7 @@ ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF +CP!$CP$ac_delim DATE!$DATE$ac_delim FIND!$FIND$ac_delim MKDIR!$MKDIR$ac_delim @@ -34296,7 +34324,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 65; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 66; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 Index: llvm/Makefile.config.in diff -u llvm/Makefile.config.in:1.71 llvm/Makefile.config.in:1.72 --- llvm/Makefile.config.in:1.71 Tue Dec 12 19:15:18 2006 +++ llvm/Makefile.config.in Sat Dec 16 16:07:52 2006 @@ -224,6 +224,9 @@ # Do we want to enable threads? ENABLE_THREADS := @ENABLE_THREADS@ +# Do we want to build with position independent code? +ENABLE_PIC := @ENABLE_PIC@ + # This option tells the Makefiles to produce verbose output. # It essentially prints the commands that make is executing #VERBOSE = 1 Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.415 llvm/Makefile.rules:1.416 --- llvm/Makefile.rules:1.415 Sat Dec 9 22:56:38 2006 +++ llvm/Makefile.rules Sat Dec 16 16:07:52 2006 @@ -255,6 +255,11 @@ C.Flags += -D_DEBUG endif +ifeq ($(ENABLE_PIC),1) + CXX.Flags += -fPIC + C.Flags += -fPIC +endif + CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual C.Flags += $(CFLAGS) CPP.BaseFlags += $(CPPFLAGS) @@ -264,8 +269,12 @@ # Make Floating point IEEE compliant on Alpha. ifeq ($(ARCH),Alpha) - CXX.Flags += -mieee -fPIC - CPP.BaseFlags += -mieee -fPIC + CXX.Flags += -mieee + CPP.BaseFlags += -mieee +ifeq ($(ENABLE_PIC),0) + CXX.Flags += -fPIC + CPP.BaseFlags += -fPIC +endif endif #-------------------------------------------------------------------- From isanbard at gmail.com Sat Dec 16 23:15:47 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/Debug.cpp Streams.cpp Message-ID: <200612170515.kBH5Fl0v022974@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: Debug.cpp updated: 1.10 -> 1.11 Streams.cpp updated: 1.2 -> 1.3 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+3 -3) Debug.cpp | 4 ++-- Streams.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Support/Debug.cpp diff -u llvm/lib/Support/Debug.cpp:1.10 llvm/lib/Support/Debug.cpp:1.11 --- llvm/lib/Support/Debug.cpp:1.10 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Support/Debug.cpp Sat Dec 16 23:15:13 2006 @@ -68,9 +68,9 @@ // places the std::c* I/O streams into one .cpp file and relieves the whole // program from having to have hundreds of static c'tor/d'tors for them. // -OStream llvm::getErrorOutputStream(const char *DebugType) { +OStream &llvm::getErrorOutputStream(const char *DebugType) { if (DebugFlag && isCurrentDebugType(DebugType)) return cerr; else - return NullStream; + return cnull; } Index: llvm/lib/Support/Streams.cpp diff -u llvm/lib/Support/Streams.cpp:1.2 llvm/lib/Support/Streams.cpp:1.3 --- llvm/lib/Support/Streams.cpp:1.2 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Support/Streams.cpp Sat Dec 16 23:15:13 2006 @@ -16,7 +16,7 @@ #include using namespace llvm; -OStream llvm::NullStream; +OStream llvm::cnull; OStream llvm::cout(std::cout); OStream llvm::cerr(std::cerr); IStream llvm::cin(std::cin); From isanbard at gmail.com Sat Dec 16 23:15:48 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp Message-ID: <200612170515.kBH5FmqF023001@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.137 -> 1.138 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+2 -0) Writer.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.137 llvm/lib/Bytecode/Writer/Writer.cpp:1.138 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.137 Fri Dec 8 12:06:15 2006 +++ llvm/lib/Bytecode/Writer/Writer.cpp Sat Dec 16 23:15:12 2006 @@ -1297,4 +1297,6 @@ // make sure it hits disk now Out.stream()->flush(); + void * p; + Out << std::hex << p << "\n"; } From isanbard at gmail.com Sat Dec 16 23:15:50 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:50 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/SubtargetFeature.h Message-ID: <200612170515.kBH5FoRT023033@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: SubtargetFeature.h updated: 1.9 -> 1.10 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+1 -0) SubtargetFeature.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/Target/SubtargetFeature.h diff -u llvm/include/llvm/Target/SubtargetFeature.h:1.9 llvm/include/llvm/Target/SubtargetFeature.h:1.10 --- llvm/include/llvm/Target/SubtargetFeature.h:1.9 Tue Dec 12 13:26:50 2006 +++ llvm/include/llvm/Target/SubtargetFeature.h Sat Dec 16 23:15:12 2006 @@ -98,6 +98,7 @@ /// Print feature string. void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } // Dump feature info. void dump() const; From isanbard at gmail.com Sat Dec 16 23:15:50 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:50 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/ConstantRange.h Debug.h Streams.h Message-ID: <200612170515.kBH5Fov7023042@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: ConstantRange.h updated: 1.11 -> 1.12 Debug.h updated: 1.12 -> 1.13 Streams.h updated: 1.6 -> 1.7 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+11 -6) ConstantRange.h | 4 +--- Debug.h | 4 ++-- Streams.h | 9 ++++++++- 3 files changed, 11 insertions(+), 6 deletions(-) Index: llvm/include/llvm/Support/ConstantRange.h diff -u llvm/include/llvm/Support/ConstantRange.h:1.11 llvm/include/llvm/Support/ConstantRange.h:1.12 --- llvm/include/llvm/Support/ConstantRange.h:1.11 Wed Dec 6 19:30:31 2006 +++ llvm/include/llvm/Support/ConstantRange.h Sat Dec 16 23:15:12 2006 @@ -141,10 +141,8 @@ /// print - Print out the bounds to a stream... /// - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// dump - Allow printing from a debugger easily... /// Index: llvm/include/llvm/Support/Debug.h diff -u llvm/include/llvm/Support/Debug.h:1.12 llvm/include/llvm/Support/Debug.h:1.13 --- llvm/include/llvm/Support/Debug.h:1.12 Wed Dec 6 19:30:31 2006 +++ llvm/include/llvm/Support/Debug.h Sat Dec 16 23:15:12 2006 @@ -65,10 +65,10 @@ /// places the std::c* I/O streams into one .cpp file and relieves the whole /// program from having to have hundreds of static c'tor/d'tors for them. /// -OStream getErrorOutputStream(const char *DebugType); +OStream &getErrorOutputStream(const char *DebugType); #ifdef NDEBUG -#define DOUT NullStream +#define DOUT cnull #else #define DOUT getErrorOutputStream(DEBUG_TYPE) #endif Index: llvm/include/llvm/Support/Streams.h diff -u llvm/include/llvm/Support/Streams.h:1.6 llvm/include/llvm/Support/Streams.h:1.7 --- llvm/include/llvm/Support/Streams.h:1.6 Thu Dec 7 17:41:45 2006 +++ llvm/include/llvm/Support/Streams.h Sat Dec 16 23:15:12 2006 @@ -39,6 +39,11 @@ return *this; } +// inline BaseStream &operator << (std::ios &(*Func)(std::ios&)) { +// if (Stream) *Stream << Func; +// return *this; +// } + template BaseStream &operator << (const Ty &Thing) { if (Stream) *Stream << Thing; @@ -51,6 +56,8 @@ return *this; } + operator StreamTy* () { return Stream; } + bool operator == (const StreamTy &S) { return &S == Stream; } bool operator != (const StreamTy &S) { return !(*this == S); } bool operator == (const BaseStream &S) { return S.Stream == Stream; } @@ -61,7 +68,7 @@ typedef BaseStream IStream; typedef BaseStream StringStream; - extern OStream NullStream; + extern OStream cnull; extern OStream cout; extern OStream cerr; extern IStream cin; From isanbard at gmail.com Sat Dec 16 23:15:50 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:50 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h LiveInterval.h LiveIntervalAnalysis.h MachineBasicBlock.h MachineConstantPool.h MachineFunction.h MachineInstr.h MachineJumpTableInfo.h SchedGraphCommon.h Message-ID: <200612170515.kBH5FoMP023063@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LinkAllCodegenComponents.h updated: 1.3 -> 1.4 LiveInterval.h updated: 1.33 -> 1.34 LiveIntervalAnalysis.h updated: 1.65 -> 1.66 MachineBasicBlock.h updated: 1.53 -> 1.54 MachineConstantPool.h updated: 1.24 -> 1.25 MachineFunction.h updated: 1.62 -> 1.63 MachineInstr.h updated: 1.208 -> 1.209 MachineJumpTableInfo.h updated: 1.10 -> 1.11 SchedGraphCommon.h updated: 1.16 -> 1.17 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+19 -55) LinkAllCodegenComponents.h | 1 + LiveInterval.h | 16 ++++------------ LiveIntervalAnalysis.h | 3 +++ MachineBasicBlock.h | 8 +------- MachineConstantPool.h | 13 ++----------- MachineFunction.h | 1 + MachineInstr.h | 14 ++++---------- MachineJumpTableInfo.h | 1 + SchedGraphCommon.h | 17 ++--------------- 9 files changed, 19 insertions(+), 55 deletions(-) Index: llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h diff -u llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.3 llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.4 --- llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.3 Tue Aug 1 14:14:14 2006 +++ llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h Sat Dec 16 23:15:12 2006 @@ -31,6 +31,7 @@ (void) llvm::createSimpleRegisterAllocator(); (void) llvm::createLocalRegisterAllocator(); (void) llvm::createLinearScanRegisterAllocator(); + (void) llvm::createGraphColoringRegisterAllocator(); (void) llvm::createBFS_DAGScheduler(NULL, NULL, NULL); (void) llvm::createSimpleDAGScheduler(NULL, NULL, NULL); Index: llvm/include/llvm/CodeGen/LiveInterval.h diff -u llvm/include/llvm/CodeGen/LiveInterval.h:1.33 llvm/include/llvm/CodeGen/LiveInterval.h:1.34 --- llvm/include/llvm/CodeGen/LiveInterval.h:1.33 Fri Dec 15 20:15:42 2006 +++ llvm/include/llvm/CodeGen/LiveInterval.h Sat Dec 16 23:15:12 2006 @@ -57,16 +57,13 @@ void dump() const; void print(std::ostream &os) const; + void print(std::ostream *os) const { if (os) print(*os); } private: LiveRange(); // DO NOT IMPLEMENT }; std::ostream& operator<<(std::ostream& os, const LiveRange &LR); - inline OStream& operator<<(OStream& os, const LiveRange &LR) { - if (os.stream()) LR.print(*os.stream()); - return os; - } inline bool operator<(unsigned V, const LiveRange &LR) { @@ -260,9 +257,9 @@ return beginNumber() < other.beginNumber(); } - void print(OStream OS, const MRegisterInfo *MRI = 0) const; - void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const { - print(OStream(OS), MRI); + void print(std::ostream &OS, const MRegisterInfo *MRI = 0) const; + void print(std::ostream *OS, const MRegisterInfo *MRI = 0) const { + if (OS) print(*OS, MRI); } void dump() const; @@ -273,11 +270,6 @@ LiveInterval& operator=(const LiveInterval& rhs); // DO NOT IMPLEMENT }; - inline OStream &operator<<(OStream &OS, const LiveInterval &LI) { - LI.print(OS); - return OS; - } - inline std::ostream &operator<<(std::ostream &OS, const LiveInterval &LI) { LI.print(OS); return OS; Index: llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h diff -u llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.65 llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.66 --- llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h:1.65 Wed Nov 15 20:41:50 2006 +++ llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h Sat Dec 16 23:15:12 2006 @@ -161,6 +161,9 @@ /// print - Implement the dump method. virtual void print(std::ostream &O, const Module* = 0) const; + void print(std::ostream *O, const Module* M = 0) const { + if (O) print(*O, M); + } private: /// RemoveMachineInstrFromMaps - This marks the specified machine instr as Index: llvm/include/llvm/CodeGen/MachineBasicBlock.h diff -u llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.53 llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.54 --- llvm/include/llvm/CodeGen/MachineBasicBlock.h:1.53 Fri Dec 15 20:15:42 2006 +++ llvm/include/llvm/CodeGen/MachineBasicBlock.h Sat Dec 16 23:15:12 2006 @@ -189,10 +189,8 @@ // Debugging methods. void dump() const; - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// getNumber - MachineBasicBlocks are uniquely numbered at the function /// level, unless they're not in a MachineFunction yet, in which case this @@ -226,10 +224,6 @@ }; std::ostream& operator<<(std::ostream &OS, const MachineBasicBlock &MBB); -inline OStream& operator<<(OStream &OS, const MachineBasicBlock &MBB) { - if (OS.stream()) MBB.print(*OS.stream()); - return OS; -} //===--------------------------------------------------------------------===// // GraphTraits specializations for machine basic block graphs (machine-CFGs) Index: llvm/include/llvm/CodeGen/MachineConstantPool.h diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.24 llvm/include/llvm/CodeGen/MachineConstantPool.h:1.25 --- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.24 Wed Dec 6 19:30:31 2006 +++ llvm/include/llvm/CodeGen/MachineConstantPool.h Sat Dec 16 23:15:12 2006 @@ -49,17 +49,10 @@ /// print - Implement operator<<... /// - void print(OStream &O) const { - if (O.stream()) print(*O.stream()); - } virtual void print(std::ostream &O) const = 0; + void print(std::ostream *O) const { if (O) print(*O); } }; -inline OStream &operator<<(OStream &OS, - const MachineConstantPoolValue &V) { - V.print(OS); - return OS; -} inline std::ostream &operator<<(std::ostream &OS, const MachineConstantPoolValue &V) { V.print(OS); @@ -143,10 +136,8 @@ /// print - Used by the MachineFunction printer to print information about /// constant pool objects. Implemented in MachineFunction.cpp /// - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// dump - Call print(std::cerr) to be called from the debugger. /// Index: llvm/include/llvm/CodeGen/MachineFunction.h diff -u llvm/include/llvm/CodeGen/MachineFunction.h:1.62 llvm/include/llvm/CodeGen/MachineFunction.h:1.63 --- llvm/include/llvm/CodeGen/MachineFunction.h:1.62 Tue Oct 3 14:18:57 2006 +++ llvm/include/llvm/CodeGen/MachineFunction.h Sat Dec 16 23:15:12 2006 @@ -238,6 +238,7 @@ /// to the specified stream. /// void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// viewCFG - This function is meant for use from the debugger. You can just /// say 'call F->viewCFG()' and a ghostview window should pop up from the Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.208 llvm/include/llvm/CodeGen/MachineInstr.h:1.209 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.208 Fri Dec 15 20:15:42 2006 +++ llvm/include/llvm/CodeGen/MachineInstr.h Sat Dec 16 23:15:12 2006 @@ -78,6 +78,7 @@ MachineOperand() {} void print(std::ostream &os) const; + void print(std::ostream *os) const { if (os) print(*os); } public: MachineOperand(const MachineOperand &M) { @@ -288,10 +289,6 @@ IsDead = false; } - friend OStream& operator<<(OStream& os, const MachineOperand& mop) { - if (os.stream()) mop.print(*os.stream()); - return os; - } friend std::ostream& operator<<(std::ostream& os, const MachineOperand& mop) { mop.print(os); return os; @@ -403,16 +400,13 @@ // // Debugging support // - void print(OStream &OS, const TargetMachine *TM) const { - if (OS.stream()) print(*OS.stream(), TM); + void print(std::ostream *OS, const TargetMachine *TM) const { + if (OS) print(*OS, TM); } void print(std::ostream &OS, const TargetMachine *TM) const; void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } void dump() const; - friend OStream& operator<<(OStream& os, const MachineInstr& minstr) { - if (os.stream()) minstr.print(*os.stream()); - return os; - } friend std::ostream& operator<<(std::ostream& os, const MachineInstr& minstr){ minstr.print(os); return os; Index: llvm/include/llvm/CodeGen/MachineJumpTableInfo.h diff -u llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.10 llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.11 --- llvm/include/llvm/CodeGen/MachineJumpTableInfo.h:1.10 Thu Dec 14 15:03:17 2006 +++ llvm/include/llvm/CodeGen/MachineJumpTableInfo.h Sat Dec 16 23:15:12 2006 @@ -90,6 +90,7 @@ /// jump tables. Implemented in MachineFunction.cpp /// void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// dump - Call print(std::cerr) to be called from the debugger. /// Index: llvm/include/llvm/CodeGen/SchedGraphCommon.h diff -u llvm/include/llvm/CodeGen/SchedGraphCommon.h:1.16 llvm/include/llvm/CodeGen/SchedGraphCommon.h:1.17 --- llvm/include/llvm/CodeGen/SchedGraphCommon.h:1.16 Wed Dec 6 19:30:31 2006 +++ llvm/include/llvm/CodeGen/SchedGraphCommon.h Sat Dec 16 23:15:12 2006 @@ -70,10 +70,8 @@ void dump(int indent=0) const; // Debugging support - void print(OStream &os) const { - if (os.stream()) print(*os.stream()); - } virtual void print(std::ostream &os) const = 0; + void print(std::ostream *os) const { if (os) print(*os); } protected: friend class SchedGraphCommon; @@ -96,11 +94,6 @@ }; // ostream << operator for SchedGraphNode class -inline OStream &operator<<(OStream &os, - const SchedGraphNodeCommon &node) { - node.print(os); - return os; -} inline std::ostream &operator<<(std::ostream &os, const SchedGraphNodeCommon &node) { node.print(os); @@ -188,10 +181,8 @@ public: // Debugging support - void print(OStream &os) const { - if (os.stream()) print(*os.stream()); - } void print(std::ostream &os) const; + void print(std::ostream *os) const { if (os) print(*os); } void dump(int indent=0) const; private: @@ -200,10 +191,6 @@ }; // ostream << operator for SchedGraphNode class -inline OStream &operator<<(OStream &os, const SchedGraphEdge &edge) { - edge.print(os); - return os; -} inline std::ostream &operator<<(std::ostream &os, const SchedGraphEdge &edge) { edge.print(os); return os; From isanbard at gmail.com Sat Dec 16 23:15:48 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:48 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Argument.h BasicBlock.h Constant.h Function.h GlobalVariable.h InlineAsm.h Instruction.h Module.h Pass.h Type.h Value.h Message-ID: <200612170515.kBH5FmI7022999@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Argument.h updated: 1.12 -> 1.13 BasicBlock.h updated: 1.61 -> 1.62 Constant.h updated: 1.32 -> 1.33 Function.h updated: 1.67 -> 1.68 GlobalVariable.h updated: 1.37 -> 1.38 InlineAsm.h updated: 1.13 -> 1.14 Instruction.h updated: 1.75 -> 1.76 Module.h updated: 1.76 -> 1.77 Pass.h updated: 1.61 -> 1.62 Type.h updated: 1.95 -> 1.96 Value.h updated: 1.87 -> 1.88 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+16 -15) Argument.h | 3 +++ BasicBlock.h | 1 + Constant.h | 1 + Function.h | 1 + GlobalVariable.h | 1 + InlineAsm.h | 1 + Instruction.h | 1 + Module.h | 10 ++++------ Pass.h | 4 +--- Type.h | 4 +--- Value.h | 4 +--- 11 files changed, 16 insertions(+), 15 deletions(-) Index: llvm/include/llvm/Argument.h diff -u llvm/include/llvm/Argument.h:1.12 llvm/include/llvm/Argument.h:1.13 --- llvm/include/llvm/Argument.h:1.12 Mon Jun 5 11:29:06 2006 +++ llvm/include/llvm/Argument.h Sat Dec 16 23:15:12 2006 @@ -53,6 +53,9 @@ const Argument *getPrev() const { return Prev; } virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { + if (OS) print(*OS); + } /// classof - Methods for support type inquiry through isa, cast, and /// dyn_cast: Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.61 llvm/include/llvm/BasicBlock.h:1.62 --- llvm/include/llvm/BasicBlock.h:1.61 Sat Sep 30 17:20:34 2006 +++ llvm/include/llvm/BasicBlock.h Sat Dec 16 23:15:12 2006 @@ -152,6 +152,7 @@ InstListType &getInstList() { return InstList; } virtual void print(std::ostream &OS) const { print(OS, 0); } + void print(std::ostream *OS) const { if (OS) print(*OS); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// Methods for support type inquiry through isa, cast, and dyn_cast: Index: llvm/include/llvm/Constant.h diff -u llvm/include/llvm/Constant.h:1.32 llvm/include/llvm/Constant.h:1.33 --- llvm/include/llvm/Constant.h:1.32 Thu Oct 19 19:27:06 2006 +++ llvm/include/llvm/Constant.h Sat Dec 16 23:15:12 2006 @@ -54,6 +54,7 @@ virtual bool isNullValue() const = 0; virtual void print(std::ostream &O) const; + void print(std::ostream *O) const { if (O) print(*O); } /// canTrap - Return true if evaluation of this constant could trap. This is /// true for things like constant expressions that could divide by zero. Index: llvm/include/llvm/Function.h diff -u llvm/include/llvm/Function.h:1.67 llvm/include/llvm/Function.h:1.68 --- llvm/include/llvm/Function.h:1.67 Tue Oct 25 12:58:00 2005 +++ llvm/include/llvm/Function.h Sat Dec 16 23:15:12 2006 @@ -194,6 +194,7 @@ bool arg_empty() const { return ArgumentList.empty(); } virtual void print(std::ostream &OS) const { print(OS, 0); } + void print(std::ostream *OS) const { if (OS) print(*OS); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// viewCFG - This function is meant for use from the debugger. You can just Index: llvm/include/llvm/GlobalVariable.h diff -u llvm/include/llvm/GlobalVariable.h:1.37 llvm/include/llvm/GlobalVariable.h:1.38 --- llvm/include/llvm/GlobalVariable.h:1.37 Sat Sep 30 16:31:26 2006 +++ llvm/include/llvm/GlobalVariable.h Sat Dec 16 23:15:12 2006 @@ -123,6 +123,7 @@ virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const GlobalVariable *) { return true; } Index: llvm/include/llvm/InlineAsm.h diff -u llvm/include/llvm/InlineAsm.h:1.13 llvm/include/llvm/InlineAsm.h:1.14 --- llvm/include/llvm/InlineAsm.h:1.13 Wed Jul 26 11:18:00 2006 +++ llvm/include/llvm/InlineAsm.h Sat Dec 16 23:15:12 2006 @@ -60,6 +60,7 @@ const std::string &getConstraintString() const { return Constraints; } virtual void print(std::ostream &O) const { print(O, 0); } + void print(std::ostream *O) const { if (O) print(*O); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// Verify - This static method can be used by the parser to check to see if Index: llvm/include/llvm/Instruction.h diff -u llvm/include/llvm/Instruction.h:1.75 llvm/include/llvm/Instruction.h:1.76 --- llvm/include/llvm/Instruction.h:1.75 Sun Nov 26 19:05:09 2006 +++ llvm/include/llvm/Instruction.h Sat Dec 16 23:15:12 2006 @@ -169,6 +169,7 @@ static bool isTrapping(unsigned op); virtual void print(std::ostream &OS) const { print(OS, 0); } + void print(std::ostream *OS) const { if (OS) print(*OS); } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; /// Methods for support type inquiry through isa, cast, and dyn_cast: Index: llvm/include/llvm/Module.h diff -u llvm/include/llvm/Module.h:1.76 llvm/include/llvm/Module.h:1.77 --- llvm/include/llvm/Module.h:1.76 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Module.h Sat Dec 16 23:15:12 2006 @@ -295,15 +295,13 @@ /// @{ public: /// Print the module to an output stream - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream(), 0); - } void print(std::ostream &OS) const { print(OS, 0); } + void print(std::ostream *OS) const { if (OS) print(*OS); } /// Print the module to an output stream with AssemblyAnnotationWriter. - void print(OStream &OS, AssemblyAnnotationWriter *AAW) const { - if (OS.stream()) print(*OS.stream(), AAW); - } void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const; + void print(std::ostream *OS, AssemblyAnnotationWriter *AAW) const { + if (OS) print(*OS, AAW); + } /// Dump the module to std::cerr (for debugging). void dump() const; /// This function causes all the subinstructions to "let go" of all references Index: llvm/include/llvm/Pass.h diff -u llvm/include/llvm/Pass.h:1.61 llvm/include/llvm/Pass.h:1.62 --- llvm/include/llvm/Pass.h:1.61 Wed Dec 13 15:13:31 2006 +++ llvm/include/llvm/Pass.h Sat Dec 16 23:15:12 2006 @@ -105,10 +105,8 @@ /// provide the Module* in case the analysis doesn't need it it can just be /// ignored. /// - void print(OStream &O, const Module *M) const { - if (O.stream()) print(*O.stream(), M); - } virtual void print(std::ostream &O, const Module *M) const; + void print(std::ostream *O, const Module *M) const { if (O) print(*O, M); } void dump() const; // dump - call print(std::cerr, 0); // Access AnalysisResolver_New Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.95 llvm/include/llvm/Type.h:1.96 --- llvm/include/llvm/Type.h:1.95 Fri Dec 8 12:06:14 2006 +++ llvm/include/llvm/Type.h Sat Dec 16 23:15:12 2006 @@ -141,10 +141,8 @@ /// mutable std::vector AbstractTypeUsers; public: - void print(OStream &O) const { - if (O.stream()) print(*O.stream()); - } void print(std::ostream &O) const; + void print(std::ostream *O) const { if (O) print(*O); } /// @brief Debugging support: print to stderr void dump() const; Index: llvm/include/llvm/Value.h diff -u llvm/include/llvm/Value.h:1.87 llvm/include/llvm/Value.h:1.88 --- llvm/include/llvm/Value.h:1.87 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Value.h Sat Dec 16 23:15:12 2006 @@ -75,10 +75,8 @@ /// print - Implement operator<< on Value... /// - void print(OStream &O) const { - if (O.stream()) print(*O.stream()); - } virtual void print(std::ostream &O) const = 0; + void print(std::ostream *O) const { if (O) print(*O); } /// All values are typed, get the type of this value. /// From isanbard at gmail.com Sat Dec 16 23:15:52 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Message-ID: <200612170515.kBH5FqEw023068@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: ScheduleDAGSimple.cpp updated: 1.21 -> 1.22 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+13 -11) ScheduleDAGSimple.cpp | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.21 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.22 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.21 Mon Dec 11 13:15:36 2006 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Sat Dec 16 23:15:13 2006 @@ -473,7 +473,8 @@ /// print - Print ordering to specified output stream. /// - void print(OStream &O) const; + void print(std::ostream &O) const; + void print(std::ostream *O) const { if (O) print(*O); } void dump(const char *tag) const; @@ -485,7 +486,8 @@ /// printNI - Print node info. /// - void printNI(OStream &O, NodeInfo *NI) const; + void printNI(std::ostream &O, NodeInfo *NI) const; + void printNI(std::ostream *O, NodeInfo *NI) const { if (O) printNI(O, NI); } /// printChanges - Hilight changes in order caused by scheduling. /// @@ -636,7 +638,7 @@ /// print - Print ordering to specified output stream. /// -void ScheduleDAGSimple::print(OStream &O) const { +void ScheduleDAGSimple::print(std::ostream &O) const { #ifndef NDEBUG O << "Ordering\n"; for (unsigned i = 0, N = Ordering.size(); i < N; i++) { @@ -710,16 +712,16 @@ /// printNI - Print node info. /// -void ScheduleDAGSimple::printNI(OStream &O, NodeInfo *NI) const { +void ScheduleDAGSimple::printNI(std::ostream &O, NodeInfo *NI) const { #ifndef NDEBUG SDNode *Node = NI->Node; - *(O.stream()) << " " - << std::hex << Node << std::dec - << ", Lat=" << NI->Latency - << ", Slot=" << NI->Slot - << ", ARITY=(" << Node->getNumOperands() << "," - << Node->getNumValues() << ")" - << " " << Node->getOperationName(&DAG); + O << " " + << std::hex << Node << std::dec + << ", Lat=" << NI->Latency + << ", Slot=" << NI->Slot + << ", ARITY=(" << Node->getNumOperands() << "," + << Node->getNumValues() << ")" + << " " << Node->getOperationName(&DAG); if (isFlagDefiner(Node)) O << "<#"; if (isFlagUser(Node)) O << ">#"; #endif From isanbard at gmail.com Sat Dec 16 23:15:49 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:49 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Analysis/AliasSetTracker.h CallGraph.h Dominators.h FindUsedTypes.h Interval.h IntervalPartition.h LoopInfo.h ScalarEvolution.h ScalarEvolutionExpressions.h Trace.h Message-ID: <200612170515.kBH5Fn4p023027@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Analysis: AliasSetTracker.h updated: 1.29 -> 1.30 CallGraph.h updated: 1.52 -> 1.53 Dominators.h updated: 1.62 -> 1.63 FindUsedTypes.h updated: 1.28 -> 1.29 Interval.h updated: 1.21 -> 1.22 IntervalPartition.h updated: 1.22 -> 1.23 LoopInfo.h updated: 1.62 -> 1.63 ScalarEvolution.h updated: 1.13 -> 1.14 ScalarEvolutionExpressions.h updated: 1.8 -> 1.9 Trace.h updated: 1.6 -> 1.7 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+45 -40) AliasSetTracker.h | 16 ++-------------- CallGraph.h | 8 ++------ Dominators.h | 15 +++++++++++++++ FindUsedTypes.h | 1 + Interval.h | 1 + IntervalPartition.h | 3 +++ LoopInfo.h | 13 +++++++------ ScalarEvolution.h | 18 +++++------------- ScalarEvolutionExpressions.h | 7 +++++++ Trace.h | 3 ++- 10 files changed, 45 insertions(+), 40 deletions(-) Index: llvm/include/llvm/Analysis/AliasSetTracker.h diff -u llvm/include/llvm/Analysis/AliasSetTracker.h:1.29 llvm/include/llvm/Analysis/AliasSetTracker.h:1.30 --- llvm/include/llvm/Analysis/AliasSetTracker.h:1.29 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Analysis/AliasSetTracker.h Sat Dec 16 23:15:12 2006 @@ -156,10 +156,8 @@ iterator end() const { return iterator(); } bool empty() const { return PtrList == 0; } - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } void dump() const; /// Define an iterator for alias sets... this is just a forward iterator. @@ -248,10 +246,6 @@ bool aliasesCallSite(CallSite CS, AliasAnalysis &AA) const; }; -inline OStream& operator<<(OStream &OS, const AliasSet &AS) { - AS.print(OS); - return OS; -} inline std::ostream& operator<<(std::ostream &OS, const AliasSet &AS) { AS.print(OS); return OS; @@ -361,10 +355,8 @@ iterator begin() { return AliasSets.begin(); } iterator end() { return AliasSets.end(); } - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } void dump() const; private: @@ -390,10 +382,6 @@ AliasSet *findAliasSetForCallSite(CallSite CS); }; -inline OStream& operator<<(OStream &OS, const AliasSetTracker &AST) { - AST.print(OS); - return OS; -} inline std::ostream& operator<<(std::ostream &OS, const AliasSetTracker &AST) { AST.print(OS); return OS; Index: llvm/include/llvm/Analysis/CallGraph.h diff -u llvm/include/llvm/Analysis/CallGraph.h:1.52 llvm/include/llvm/Analysis/CallGraph.h:1.53 --- llvm/include/llvm/Analysis/CallGraph.h:1.52 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Analysis/CallGraph.h Sat Dec 16 23:15:12 2006 @@ -152,10 +152,8 @@ /// void initialize(Module &M); - void print(OStream &o, const Module *M) const { - if (o.stream()) print(*o.stream(), M); - } virtual void print(std::ostream &o, const Module *M) const; + void print(std::ostream *o, const Module *M) const { if (o) print(*o, M); } void dump() const; // stub - dummy function, just ignore it @@ -201,10 +199,8 @@ /// dump - Print out this call graph node. /// void dump() const; - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } //===--------------------------------------------------------------------- // Methods to keep a call graph up to date with a function that has been Index: llvm/include/llvm/Analysis/Dominators.h diff -u llvm/include/llvm/Analysis/Dominators.h:1.62 llvm/include/llvm/Analysis/Dominators.h:1.63 --- llvm/include/llvm/Analysis/Dominators.h:1.62 Sun Nov 5 13:31:28 2006 +++ llvm/include/llvm/Analysis/Dominators.h Sat Dec 16 23:15:12 2006 @@ -144,6 +144,9 @@ /// print - Convert to human readable form /// virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } }; //===------------------------------------- @@ -234,6 +237,9 @@ /// print - Convert to human readable form /// virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } /// dominates - Return true if A dominates B. This performs the special /// checks necessary if A and B are in the same basic block. @@ -410,6 +416,9 @@ /// print - Convert to human readable form /// virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } }; //===------------------------------------- @@ -546,6 +555,9 @@ /// print - Convert to human readable form /// virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } protected: /// getNode - return the (Post)DominatorTree node for the specified basic /// block. This is the same as using operator[] on this class. @@ -635,6 +647,9 @@ /// print - Convert to human readable form /// virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } }; Index: llvm/include/llvm/Analysis/FindUsedTypes.h diff -u llvm/include/llvm/Analysis/FindUsedTypes.h:1.28 llvm/include/llvm/Analysis/FindUsedTypes.h:1.29 --- llvm/include/llvm/Analysis/FindUsedTypes.h:1.28 Wed Jun 7 17:00:25 2006 +++ llvm/include/llvm/Analysis/FindUsedTypes.h Sat Dec 16 23:15:12 2006 @@ -34,6 +34,7 @@ /// symbol table from the module. /// void print(std::ostream &o, const Module *M) const; + void print(std::ostream *o, const Module *M) const { if (o) print(*o, M); } private: /// IncorporateType - Incorporate one type and all of its subtypes into the Index: llvm/include/llvm/Analysis/Interval.h diff -u llvm/include/llvm/Analysis/Interval.h:1.21 llvm/include/llvm/Analysis/Interval.h:1.22 --- llvm/include/llvm/Analysis/Interval.h:1.21 Wed Jul 27 00:53:43 2005 +++ llvm/include/llvm/Analysis/Interval.h Sat Dec 16 23:15:12 2006 @@ -99,6 +99,7 @@ /// print - Show contents in human readable format... void print(std::ostream &O) const; + void print(std::ostream *O) const { if (O) print(*O); } }; /// succ_begin/succ_end - define methods so that Intervals may be used Index: llvm/include/llvm/Analysis/IntervalPartition.h diff -u llvm/include/llvm/Analysis/IntervalPartition.h:1.22 llvm/include/llvm/Analysis/IntervalPartition.h:1.23 --- llvm/include/llvm/Analysis/IntervalPartition.h:1.22 Thu Apr 21 15:16:32 2005 +++ llvm/include/llvm/Analysis/IntervalPartition.h Sat Dec 16 23:15:12 2006 @@ -61,6 +61,9 @@ // print - Show contents in human readable format... virtual void print(std::ostream &O, const Module* = 0) const; + void print(std::ostream *O, const Module* M = 0) const { + if (O) print(*O, M); + } // getRootInterval() - Return the root interval that contains the starting // block of the function. Index: llvm/include/llvm/Analysis/LoopInfo.h diff -u llvm/include/llvm/Analysis/LoopInfo.h:1.62 llvm/include/llvm/Analysis/LoopInfo.h:1.63 --- llvm/include/llvm/Analysis/LoopInfo.h:1.62 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Analysis/LoopInfo.h Sat Dec 16 23:15:12 2006 @@ -217,10 +217,10 @@ /// the mapping in the LoopInfo class. void removeBlockFromLoop(BasicBlock *BB); - void print(OStream &O, unsigned Depth = 0) const { - if (O.stream()) print(*O.stream(), Depth); - } void print(std::ostream &O, unsigned Depth = 0) const; + void print(std::ostream *O, unsigned Depth = 0) const { + if (O) print(*O, Depth); + } void dump() const; private: friend class LoopInfo; @@ -283,10 +283,11 @@ virtual bool runOnFunction(Function &F); virtual void releaseMemory(); - void print(OStream &O, const Module* = 0) const { - if (O.stream()) print(*O.stream()); - } + void print(std::ostream &O, const Module* = 0) const; + void print(std::ostream *O, const Module* M = 0) const { + if (O) print(*O, M); + } virtual void getAnalysisUsage(AnalysisUsage &AU) const; Index: llvm/include/llvm/Analysis/ScalarEvolution.h diff -u llvm/include/llvm/Analysis/ScalarEvolution.h:1.13 llvm/include/llvm/Analysis/ScalarEvolution.h:1.14 --- llvm/include/llvm/Analysis/ScalarEvolution.h:1.13 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Analysis/ScalarEvolution.h Sat Dec 16 23:15:12 2006 @@ -97,20 +97,14 @@ /// print - Print out the internal representation of this scalar to the /// specified stream. This should really only be used for debugging /// purposes. - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } virtual void print(std::ostream &OS) const = 0; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// dump - This method is used for debugging. /// void dump() const; }; - inline OStream &operator<<(OStream &OS, const SCEV &S) { - S.print(OS); - return OS; - } inline std::ostream &operator<<(std::ostream &OS, const SCEV &S) { S.print(OS); return OS; @@ -128,10 +122,8 @@ virtual bool isLoopInvariant(const Loop *L) const; virtual const Type *getType() const; virtual bool hasComputableLoopEvolution(const Loop *L) const; - void print(OStream &OS) const { - if (OS.stream()) print(*OS.stream()); - } virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } virtual SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym, const SCEVHandle &Conc) const; @@ -242,10 +234,10 @@ virtual bool runOnFunction(Function &F); virtual void releaseMemory(); virtual void getAnalysisUsage(AnalysisUsage &AU) const; - void print(OStream &OS, const Module* = 0) const { - if (OS.stream()) print(*OS.stream()); - } virtual void print(std::ostream &OS, const Module* = 0) const; + void print(std::ostream *OS, const Module* M = 0) const { + if (OS) print(*OS, M); + } }; } Index: llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.8 llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.9 --- llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h:1.8 Thu Oct 26 01:15:43 2006 +++ llvm/include/llvm/Analysis/ScalarEvolutionExpressions.h Sat Dec 16 23:15:12 2006 @@ -62,6 +62,7 @@ } virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SCEVConstant *S) { return true; } @@ -108,6 +109,7 @@ virtual ConstantRange getValueRange() const; virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SCEVTruncateExpr *S) { return true; } @@ -154,6 +156,7 @@ } virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SCEVZeroExtendExpr *S) { return true; } @@ -218,6 +221,7 @@ virtual const Type *getType() const { return getOperand(0)->getType(); } virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SCEVCommutativeExpr *S) { return true; } @@ -332,6 +336,7 @@ virtual const Type *getType() const; void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SCEVSDivExpr *S) { return true; } @@ -428,6 +433,7 @@ const SCEVHandle &Conc) const; virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SCEVAddRecExpr *S) { return true; } @@ -472,6 +478,7 @@ virtual const Type *getType() const; virtual void print(std::ostream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } /// Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const SCEVUnknown *S) { return true; } Index: llvm/include/llvm/Analysis/Trace.h diff -u llvm/include/llvm/Analysis/Trace.h:1.6 llvm/include/llvm/Analysis/Trace.h:1.7 --- llvm/include/llvm/Analysis/Trace.h:1.6 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/Analysis/Trace.h Sat Dec 16 23:15:12 2006 @@ -106,7 +106,8 @@ /// print - Write trace to output stream. /// - void print (OStream &O) const; + void print (std::ostream &O) const; + void print (std::ostream *O) const { if (O) print(*O); } /// dump - Debugger convenience method; writes trace to standard error /// output stream. From isanbard at gmail.com Sat Dec 16 23:15:53 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerSwitch.cpp Message-ID: <200612170515.kBH5Fr8H023073@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: LowerSwitch.cpp updated: 1.28 -> 1.29 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+6 -1) LowerSwitch.cpp | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Utils/LowerSwitch.cpp diff -u llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.28 llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.29 --- llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.28 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Transforms/Utils/LowerSwitch.cpp Sat Dec 16 23:15:13 2006 @@ -96,7 +96,8 @@ // operator<< - Used for debugging purposes. // -OStream& operator<<(OStream &O, const std::vector &C) { +std::ostream& operator<<(std::ostream &O, + const std::vector &C) { O << "["; for (std::vector::const_iterator B = C.begin(), @@ -107,6 +108,10 @@ return O << "]"; } +OStream& operator<<(OStream &O, const std::vector &C) { + if (O.stream()) *O.stream() << C; + return O; +} // switchConvert - Convert the switch statement into a binary lookup of // the case values. The function recursively builds this tree. From isanbard at gmail.com Sat Dec 16 23:15:53 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/Trace.cpp Message-ID: <200612170515.kBH5FrHj023076@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: Trace.cpp updated: 1.5 -> 1.6 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+2 -3) Trace.cpp | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/lib/Analysis/Trace.cpp diff -u llvm/lib/Analysis/Trace.cpp:1.5 llvm/lib/Analysis/Trace.cpp:1.6 --- llvm/lib/Analysis/Trace.cpp:1.5 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Analysis/Trace.cpp Sat Dec 16 23:15:12 2006 @@ -31,13 +31,12 @@ /// print - Write trace to output stream. /// -void Trace::print(OStream &O) const { +void Trace::print(std::ostream &O) const { Function *F = getFunction (); O << "; Trace from function " << F->getName() << ", blocks:\n"; for (const_iterator i = begin(), e = end(); i != e; ++i) { O << "; "; - if (O.stream()) - WriteAsOperand(*O.stream(), *i, true, getModule()); + WriteAsOperand(O, *i, true, getModule()); O << "\n"; } O << "; Trace parent function: \n" << *F; From isanbard at gmail.com Sat Dec 16 23:15:53 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/CallGraph.cpp Message-ID: <200612170515.kBH5FriG023094@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: CallGraph.cpp updated: 1.62 -> 1.63 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+2 -2) CallGraph.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/IPA/CallGraph.cpp diff -u llvm/lib/Analysis/IPA/CallGraph.cpp:1.62 llvm/lib/Analysis/IPA/CallGraph.cpp:1.63 --- llvm/lib/Analysis/IPA/CallGraph.cpp:1.62 Wed Dec 6 19:30:31 2006 +++ llvm/lib/Analysis/IPA/CallGraph.cpp Sat Dec 16 23:15:12 2006 @@ -74,8 +74,8 @@ AU.setPreservesAll(); } - void print(OStream &o, const Module *M) const { - if (o.stream()) print(*o.stream(), M); + void print(std::ostream *o, const Module *M) const { + if (o) print(*o, M); } virtual void print(std::ostream &o, const Module *M) const { From isanbard at gmail.com Sat Dec 16 23:15:53 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:53 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ADT/BitSetVector.h Message-ID: <200612170515.kBH5Frfn023097@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ADT: BitSetVector.h updated: 1.18 -> 1.19 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+3 -12) BitSetVector.h | 15 +++------------ 1 files changed, 3 insertions(+), 12 deletions(-) Index: llvm/include/llvm/ADT/BitSetVector.h diff -u llvm/include/llvm/ADT/BitSetVector.h:1.18 llvm/include/llvm/ADT/BitSetVector.h:1.19 --- llvm/include/llvm/ADT/BitSetVector.h:1.18 Wed Dec 6 19:30:30 2006 +++ llvm/include/llvm/ADT/BitSetVector.h Sat Dec 16 23:15:12 2006 @@ -27,7 +27,6 @@ #include "llvm/Support/Streams.h" #include -#include #include namespace llvm { @@ -173,10 +172,8 @@ /// /// Printing and debugging support /// - void print(OStream &O) const { - if (O.stream()) print(*O.stream()); - } void print(std::ostream &O) const; + void print(std::ostream *O) const { if (O) print(*O); } void dump() const { print(cerr); } public: @@ -247,24 +244,18 @@ }; -inline void BitSetVector::print(std::ostream& O) const +inline void BitSetVector::print(llvm_ostream& O) const { for (std::vector::const_iterator I=bitsetVec.begin(), E=bitsetVec.end(); I != E; ++I) O << "<" << (*I) << ">" << (I+1 == E? "\n" : ", "); } -inline OStream& operator<< (OStream& O, const BitSetVector& bset) { - bset.print(O); - return O; -} -inline std::ostream& operator<< (std::ostream& O, const BitSetVector& bset) -{ +inline std::ostream& operator<<(std::ostream& O, const BitSetVector& bset) { bset.print(O); return O; } - /// /// Optimized versions of fundamental comparison operations /// From isanbard at gmail.com Sat Dec 16 23:15:53 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 16 Dec 2006 23:15:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp LiveInterval.cpp VirtRegMap.cpp VirtRegMap.h Message-ID: <200612170515.kBH5FrBU023089@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.107 -> 1.108 LiveInterval.cpp updated: 1.42 -> 1.43 VirtRegMap.cpp updated: 1.90 -> 1.91 VirtRegMap.h updated: 1.24 -> 1.25 --- Log message: Added an automatic cast to "std::ostream*" etc. from OStream. We then can rework the hacks that had us passing OStream in. We pass in std::ostream* instead, check for null, and then dispatch to the correct print() method. --- Diffs of the changes: (+15 -17) DwarfWriter.cpp | 16 ++++++++-------- LiveInterval.cpp | 2 +- VirtRegMap.cpp | 8 +------- VirtRegMap.h | 6 +++++- 4 files changed, 15 insertions(+), 17 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.107 llvm/lib/CodeGen/DwarfWriter.cpp:1.108 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.107 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Sat Dec 16 23:15:12 2006 @@ -137,8 +137,8 @@ } #ifndef NDEBUG - void print(OStream &O) const { - if (O.stream()) print(*O.stream()); + void print(std::ostream *O) const { + if (O) print(*O); } void print(std::ostream &O) const { O << ".debug_" << Tag; @@ -245,8 +245,8 @@ void Emit(const Dwarf &DW) const; #ifndef NDEBUG - void print(OStream &O) { - if (O.stream()) print(*O.stream()); + void print(std::ostream *O) { + if (O) print(*O); } void print(std::ostream &O); void dump(); @@ -335,8 +335,8 @@ void Profile(FoldingSetNodeID &ID) ; #ifndef NDEBUG - void print(OStream &O, unsigned IncIndent = 0) { - if (O.stream()) print(*O.stream(), IncIndent); + void print(std::ostream *O, unsigned IncIndent = 0) { + if (O) print(*O, IncIndent); } void print(std::ostream &O, unsigned IncIndent = 0); void dump(); @@ -386,8 +386,8 @@ virtual void Profile(FoldingSetNodeID &ID) = 0; #ifndef NDEBUG - void print(OStream &O) { - if (O.stream()) print(*O.stream()); + void print(std::ostream *O) { + if (O) print(*O); } virtual void print(std::ostream &O) = 0; void dump(); Index: llvm/lib/CodeGen/LiveInterval.cpp diff -u llvm/lib/CodeGen/LiveInterval.cpp:1.42 llvm/lib/CodeGen/LiveInterval.cpp:1.43 --- llvm/lib/CodeGen/LiveInterval.cpp:1.42 Fri Dec 15 20:15:42 2006 +++ llvm/lib/CodeGen/LiveInterval.cpp Sat Dec 16 23:15:13 2006 @@ -475,7 +475,7 @@ cerr << *this << "\n"; } -void LiveInterval::print(OStream OS, const MRegisterInfo *MRI) const { +void LiveInterval::print(std::ostream &OS, const MRegisterInfo *MRI) const { if (MRI && MRegisterInfo::isPhysicalRegister(reg)) OS << MRI->getName(reg); else Index: llvm/lib/CodeGen/VirtRegMap.cpp diff -u llvm/lib/CodeGen/VirtRegMap.cpp:1.90 llvm/lib/CodeGen/VirtRegMap.cpp:1.91 --- llvm/lib/CodeGen/VirtRegMap.cpp:1.90 Fri Dec 15 00:41:01 2006 +++ llvm/lib/CodeGen/VirtRegMap.cpp Sat Dec 16 23:15:13 2006 @@ -113,11 +113,6 @@ } void VirtRegMap::print(std::ostream &OS) const { - OStream LOS(OS); - print(LOS); -} - -void VirtRegMap::print(OStream &OS) const { const MRegisterInfo* MRI = MF.getTarget().getRegisterInfo(); OS << "********** REGISTER MAP **********\n"; @@ -136,8 +131,7 @@ } void VirtRegMap::dump() const { - OStream OS = DOUT; - print(OS); + print(DOUT); } Index: llvm/lib/CodeGen/VirtRegMap.h diff -u llvm/lib/CodeGen/VirtRegMap.h:1.24 llvm/lib/CodeGen/VirtRegMap.h:1.25 --- llvm/lib/CodeGen/VirtRegMap.h:1.24 Wed Dec 6 19:30:31 2006 +++ llvm/lib/CodeGen/VirtRegMap.h Sat Dec 16 23:15:13 2006 @@ -145,10 +145,14 @@ } void print(std::ostream &OS) const; - void print(OStream &OS) const; + void print(std::ostream *OS) const { if (OS) print(*OS); } void dump() const; }; + inline std::ostream *operator<<(std::ostream *OS, const VirtRegMap &VRM) { + VRM.print(OS); + return OS; + } inline std::ostream &operator<<(std::ostream &OS, const VirtRegMap &VRM) { VRM.print(OS); return OS; From jeffc at jolt-lang.org Sat Dec 16 23:55:28 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 16 Dec 2006 21:55:28 -0800 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp In-Reply-To: <200612170515.kBH5FmqF023001@zion.cs.uiuc.edu> References: <200612170515.kBH5FmqF023001@zion.cs.uiuc.edu> Message-ID: <4584DBD0.4000607@jolt-lang.org> This breaks the VC++ build with a "binary '<<' : no operator found which takes a left-hand operand of type 'llvm::OStream' (or there is no acceptable conversion)" error. I would try to fix it, but what is the purpose of this code other than to print some random hex digits? Bill Wendling wrote: > Changes in directory llvm/lib/Bytecode/Writer: > > Writer.cpp updated: 1.137 -> 1.138 > --- > Log message: > > Added an automatic cast to "std::ostream*" etc. from OStream. We then can > rework the hacks that had us passing OStream in. We pass in std::ostream* > instead, check for null, and then dispatch to the correct print() method. > > > --- > Diffs of the changes: (+2 -0) > > Writer.cpp | 2 ++ > 1 files changed, 2 insertions(+) > > > Index: llvm/lib/Bytecode/Writer/Writer.cpp > diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.137 llvm/lib/Bytecode/Writer/Writer.cpp:1.138 > --- llvm/lib/Bytecode/Writer/Writer.cpp:1.137 Fri Dec 8 12:06:15 2006 > +++ llvm/lib/Bytecode/Writer/Writer.cpp Sat Dec 16 23:15:12 2006 > @@ -1297,4 +1297,6 @@ > > // make sure it hits disk now > Out.stream()->flush(); > + void * p; > + Out << std::hex << p << "\n"; > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > > > From jeffc at jolt-lang.org Sat Dec 16 23:58:37 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sat, 16 Dec 2006 21:58:37 -0800 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h LiveInterval.h LiveIntervalAnalysis.h MachineBasicBlock.h MachineConstantPool.h MachineFunction.h MachineInstr.h MachineJumpTableInfo.h SchedGraphCommon.h In-Reply-To: <200612170515.kBH5FoMP023063@zion.cs.uiuc.edu> References: <200612170515.kBH5FoMP023063@zion.cs.uiuc.edu> Message-ID: <4584DC8D.4000306@jolt-lang.org> This also breaks VC++ as there is no declaration for llvm::createGraphColoringRegisterAllocator(). As in, there isn't one anywhere in LLVM that I can find. I don't know how it compiles with gcc. Bill Wendling wrote: > Index: llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h > diff -u llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.3 llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.4 > --- llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.3 Tue Aug 1 14:14:14 2006 > +++ llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h Sat Dec 16 23:15:12 2006 > @@ -31,6 +31,7 @@ > (void) llvm::createSimpleRegisterAllocator(); > (void) llvm::createLocalRegisterAllocator(); > (void) llvm::createLinearScanRegisterAllocator(); > + (void) llvm::createGraphColoringRegisterAllocator(); > > (void) llvm::createBFS_DAGScheduler(NULL, NULL, NULL); > (void) llvm::createSimpleDAGScheduler(NULL, NULL, NULL); > > > From reid at x10sys.com Sun Dec 17 00:07:45 2006 From: reid at x10sys.com (Reid Spencer) Date: Sun, 17 Dec 2006 00:07:45 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200612170607.kBH67jNO023870@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.107 -> 1.108 --- Log message: Fix problems in the CBE and InstructionCombining which use the isMaxValue and isMinValue methods of ConstantInt. These have been broken since the isSigned parameter was added. It is necessary to use the signed version of the type in the call to isValueValidForType or else incorrect results are returned. --- Diffs of the changes: (+2 -2) Constants.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.107 llvm/include/llvm/Constants.h:1.108 --- llvm/include/llvm/Constants.h:1.107 Tue Dec 12 17:36:14 2006 +++ llvm/include/llvm/Constants.h Sun Dec 17 00:07:30 2006 @@ -205,7 +205,7 @@ int64_t V = getSExtValue(); if (V < 0) return false; // Be careful about wrap-around on 'long's ++V; - return !isValueValidForType(getType(), V) || V < 0; + return !isValueValidForType(getType()->getSignedVersion(), V) || V < 0; } return isAllOnesValue(); } @@ -219,7 +219,7 @@ int64_t V = getSExtValue(); if (V > 0) return false; // Be careful about wrap-around on 'long's --V; - return !isValueValidForType(getType(), V) || V > 0; + return !isValueValidForType(getType()->getSignedVersion(), V) || V > 0; } return getZExtValue() == 0; } From isanbard at gmail.com Sun Dec 17 05:11:33 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 17 Dec 2006 05:11:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp Message-ID: <200612171111.kBHBBXED030646@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.138 -> 1.139 --- Log message: This snuck in. Reverted. --- Diffs of the changes: (+0 -2) Writer.cpp | 2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.138 llvm/lib/Bytecode/Writer/Writer.cpp:1.139 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.138 Sat Dec 16 23:15:12 2006 +++ llvm/lib/Bytecode/Writer/Writer.cpp Sun Dec 17 05:11:10 2006 @@ -1297,6 +1297,4 @@ // make sure it hits disk now Out.stream()->flush(); - void * p; - Out << std::hex << p << "\n"; } From isanbard at gmail.com Sun Dec 17 05:13:28 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 17 Dec 2006 05:13:28 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h Message-ID: <200612171113.kBHBDSTI030690@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: LinkAllCodegenComponents.h updated: 1.4 -> 1.5 --- Log message: Accidental submission. --- Diffs of the changes: (+0 -1) LinkAllCodegenComponents.h | 1 - 1 files changed, 1 deletion(-) Index: llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h diff -u llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.4 llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.5 --- llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.4 Sat Dec 16 23:15:12 2006 +++ llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h Sun Dec 17 05:13:13 2006 @@ -31,7 +31,6 @@ (void) llvm::createSimpleRegisterAllocator(); (void) llvm::createLocalRegisterAllocator(); (void) llvm::createLinearScanRegisterAllocator(); - (void) llvm::createGraphColoringRegisterAllocator(); (void) llvm::createBFS_DAGScheduler(NULL, NULL, NULL); (void) llvm::createSimpleDAGScheduler(NULL, NULL, NULL); From isanbard at gmail.com Sun Dec 17 05:16:09 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 17 Dec 2006 05:16:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Message-ID: <200612171116.kBHBG9PO030744@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: ScheduleDAGSimple.cpp updated: 1.22 -> 1.23 --- Log message: Fixed so that it dereferences the ostream pointer. --- Diffs of the changes: (+1 -1) ScheduleDAGSimple.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.22 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.23 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp:1.22 Sat Dec 16 23:15:13 2006 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Sun Dec 17 05:15:53 2006 @@ -487,7 +487,7 @@ /// printNI - Print node info. /// void printNI(std::ostream &O, NodeInfo *NI) const; - void printNI(std::ostream *O, NodeInfo *NI) const { if (O) printNI(O, NI); } + void printNI(std::ostream *O, NodeInfo *NI) const { if (O) printNI(*O, NI); } /// printChanges - Hilight changes in order caused by scheduling. /// From isanbard at gmail.com Sun Dec 17 05:24:00 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 17 Dec 2006 03:24:00 -0800 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h LiveInterval.h LiveIntervalAnalysis.h MachineBasicBlock.h MachineConstantPool.h MachineFunction.h MachineInstr.h MachineJumpTableInfo.h SchedGraphCommon.h In-Reply-To: <4584DC8D.4000306@jolt-lang.org> References: <200612170515.kBH5FoMP023063@zion.cs.uiuc.edu> <4584DC8D.4000306@jolt-lang.org> Message-ID: <0C4F5D2D-2B28-4E4D-B7F9-C376E59051D6@gmail.com> Hi Jeff (and everyone), This was a mistake. I reverted this patch. I'm sorry that it snuck in there :-( -bw On Dec 16, 2006, at 9:58 PM, Jeff Cohen wrote: > This also breaks VC++ as there is no declaration for > llvm::createGraphColoringRegisterAllocator(). As in, there isn't > one anywhere in LLVM that I can find. I don't know how it compiles > with gcc. > > Bill Wendling wrote: >> Index: llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h >> diff -u llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.3 >> llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.4 >> --- llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h:1.3 Tue >> Aug 1 14:14:14 2006 >> +++ llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h Sat Dec >> 16 23:15:12 2006 >> @@ -31,6 +31,7 @@ >> (void) llvm::createSimpleRegisterAllocator(); >> (void) llvm::createLocalRegisterAllocator(); >> (void) llvm::createLinearScanRegisterAllocator(); >> + (void) llvm::createGraphColoringRegisterAllocator(); >> (void) llvm::createBFS_DAGScheduler(NULL, NULL, NULL); >> (void) llvm::createSimpleDAGScheduler(NULL, NULL, NULL); >> >> >> > From isanbard at gmail.com Sun Dec 17 05:25:40 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 17 Dec 2006 03:25:40 -0800 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp In-Reply-To: <4584DBD0.4000607@jolt-lang.org> References: <200612170515.kBH5FmqF023001@zion.cs.uiuc.edu> <4584DBD0.4000607@jolt-lang.org> Message-ID: Again, I'm really sorry that this cruft got in there...The patch I did was rather big and a few things escaped my attention. -bw On Dec 16, 2006, at 9:55 PM, Jeff Cohen wrote: > This breaks the VC++ build with a "binary '<<' : no operator found > which takes a left-hand operand of type 'llvm::OStream' (or there > is no acceptable conversion)" error. I would try to fix it, but > what is the purpose of this code other than to print some random > hex digits? > > Bill Wendling wrote: >> Changes in directory llvm/lib/Bytecode/Writer: >> >> Writer.cpp updated: 1.137 -> 1.138 >> --- >> Log message: >> >> Added an automatic cast to "std::ostream*" etc. from OStream. We >> then can >> rework the hacks that had us passing OStream in. We pass in >> std::ostream* >> instead, check for null, and then dispatch to the correct print() >> method. >> >> >> --- >> Diffs of the changes: (+2 -0) >> >> Writer.cpp | 2 ++ >> 1 files changed, 2 insertions(+) >> >> >> Index: llvm/lib/Bytecode/Writer/Writer.cpp >> diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.137 llvm/lib/ >> Bytecode/Writer/Writer.cpp:1.138 >> --- llvm/lib/Bytecode/Writer/Writer.cpp:1.137 Fri Dec 8 12:06:15 >> 2006 >> +++ llvm/lib/Bytecode/Writer/Writer.cpp Sat Dec 16 23:15:12 2006 >> @@ -1297,4 +1297,6 @@ >> // make sure it hits disk now >> Out.stream()->flush(); >> + void * p; >> + Out << std::hex << p << "\n"; >> } >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> >> >> > From isanbard at gmail.com Sun Dec 17 05:40:55 2006 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 17 Dec 2006 05:40:55 -0600 Subject: [llvm-commits] CVS: llvm/docs/CodingStandards.html Message-ID: <200612171140.kBHBetUk031178@zion.cs.uiuc.edu> Changes in directory llvm/docs: CodingStandards.html updated: 1.32 -> 1.33 --- Log message: Added example of how to code print() methods so that they will disappear from the code if "cnull" is passed into them. --- Diffs of the changes: (+19 -6) CodingStandards.html | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-) Index: llvm/docs/CodingStandards.html diff -u llvm/docs/CodingStandards.html:1.32 llvm/docs/CodingStandards.html:1.33 --- llvm/docs/CodingStandards.html:1.32 Fri Dec 8 19:35:43 2006 +++ llvm/docs/CodingStandards.html Sun Dec 17 05:40:40 2006 @@ -509,7 +509,7 @@ more pressure on the VM system on low-memory machines. - +
    @@ -520,8 +520,10 @@ - - + + @@ -536,6 +538,12 @@ + + + + @@ -552,9 +560,14 @@ // ... print(std::cerr); - +print(llvm::cerr); + +
      N.B. The second print method is called by the print +expression. It prevents the execution of the first print method if the +stream is cnull.
    +
    Old Way
    #include "llvm/Support/Streams.h"
    DEBUG(std::cerr << ...);
    DOUT << ...;
    DEBUG(std::cerr << ...);
    +DEBUG(dump(std::cerr));
    DOUT << ...;
    +dump(DOUT);
    std::cerr << "Hello world\n";
    llvm::cin >> Var;
    N/A
    llvm::cnull >> Var;
    +
      N.B. Eats up argument Var outputting + nothing.
    std::ostream
    llvm::OStream
    void print(std::ostream &Out);
    +void print(std::ostream *Out) { if (Out) print(*Out) }
     // ...
    -print(*llvm::cerr.stream());
    @@ -752,7 +765,7 @@ Chris Lattner
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/12/09 01:35:43 $ + Last modified: $Date: 2006/12/17 11:40:40 $ From jeffc at jolt-lang.org Sun Dec 17 09:55:34 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Sun, 17 Dec 2006 07:55:34 -0800 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp In-Reply-To: References: <200612170515.kBH5FmqF023001@zion.cs.uiuc.edu> <4584DBD0.4000607@jolt-lang.org> Message-ID: <45856876.5000501@jolt-lang.org> VC++ is happy again. Thanks. Bill Wendling wrote: > Again, I'm really sorry that this cruft got in there...The patch I did > was rather big and a few things escaped my attention. > > -bw > From reid at x10sys.com Sun Dec 17 12:51:06 2006 From: reid at x10sys.com (Reid Spencer) Date: Sun, 17 Dec 2006 12:51:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200612171851.kBHIp6mt005765@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.298 -> 1.299 --- Log message: Fix PR1058: http://llvm.org/PR1058 : Generate the BITCAST_TEMPORARY regardless of the uses or inlinability of the instruction. This temporary is needed to perform the instruction, not provide storage for its results. --- Diffs of the changes: (+13 -8) Writer.cpp | 21 +++++++++++++-------- 1 files changed, 13 insertions(+), 8 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.298 llvm/lib/Target/CBackend/Writer.cpp:1.299 --- llvm/lib/Target/CBackend/Writer.cpp:1.298 Mon Dec 11 23:04:59 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Sun Dec 17 12:50:51 2006 @@ -1696,7 +1696,7 @@ bool PrintedVar = false; // print local variable information for the function - for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I) + for (inst_iterator I = inst_begin(&F), E = inst_end(&F); I != E; ++I) { if (const AllocaInst *AI = isDirectAlloca(&*I)) { Out << " "; printType(Out, AI->getAllocatedType(), Mang->getValueName(AI)); @@ -1714,16 +1714,20 @@ Out << ";\n"; } PrintedVar = true; - } else if (isa(*I) && - ((I->getType()->isFloatingPoint() && - I->getOperand(0)->getType()->isInteger()) || - (I->getType()->isInteger() && - I->getOperand(0)->getType()->isFloatingPoint()))) { - // We need a temporary for the BitCast to use so it can pluck a - // value out of a union to do the BitCast. + } + // We need a temporary for the BitCast to use so it can pluck a value out + // of a uniont to do the BitCast. This is separate from the need for a + // variable to hold the result of the BitCast. + if (isa(*I) && + ((I->getType()->isFloatingPoint() && + I->getOperand(0)->getType()->isInteger()) || + (I->getType()->isInteger() && + I->getOperand(0)->getType()->isFloatingPoint()))) { Out << " llvmBitCastUnion " << Mang->getValueName(&*I) << "__BITCAST_TEMPORARY;\n"; + PrintedVar = true; } + } if (PrintedVar) Out << '\n'; @@ -2026,6 +2030,7 @@ I.getOperand(0)->getType()->isInteger()) || (I.getType()->isInteger() && I.getOperand(0)->getType()->isFloatingPoint()))) { + // These int<->float and long<->double casts need to be handled specially Out << Mang->getValueName(&I) << "__BITCAST_TEMPORARY." << getFloatBitCastField(I.getOperand(0)->getType()) << " = "; From reid at x10sys.com Sun Dec 17 14:25:06 2006 From: reid at x10sys.com (Reid Spencer) Date: Sun, 17 Dec 2006 14:25:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200612172025.kBHKP696007306@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.299 -> 1.300 --- Log message: Use a predicate function to identify bitcast of fp and integer instead of repeating the logic in two different parts of the code. --- Diffs of the changes: (+11 -11) Writer.cpp | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.299 llvm/lib/Target/CBackend/Writer.cpp:1.300 --- llvm/lib/Target/CBackend/Writer.cpp:1.299 Sun Dec 17 12:50:51 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Sun Dec 17 14:24:50 2006 @@ -1676,6 +1676,15 @@ printType(Out, RetTy, FunctionInnards.str()); } +static inline bool isFPIntBitCast(const Instruction &I) { + if (!isa(I)) + return false; + const Type *SrcTy = I.getOperand(0)->getType(); + const Type *DstTy = I.getType(); + return (SrcTy->isFloatingPoint() && DstTy->isInteger()) || + (DstTy->isFloatingPoint() && SrcTy->isInteger()); +} + void CWriter::printFunction(Function &F) { printFunctionSignature(&F, false); Out << " {\n"; @@ -1718,11 +1727,7 @@ // We need a temporary for the BitCast to use so it can pluck a value out // of a uniont to do the BitCast. This is separate from the need for a // variable to hold the result of the BitCast. - if (isa(*I) && - ((I->getType()->isFloatingPoint() && - I->getOperand(0)->getType()->isInteger()) || - (I->getType()->isInteger() && - I->getOperand(0)->getType()->isFloatingPoint()))) { + if (isFPIntBitCast(*I)) { Out << " llvmBitCastUnion " << Mang->getValueName(&*I) << "__BITCAST_TEMPORARY;\n"; PrintedVar = true; @@ -2025,12 +2030,7 @@ const Type *DstTy = I.getType(); const Type *SrcTy = I.getOperand(0)->getType(); Out << '('; - if (isa(I) && - ((I.getType()->isFloatingPoint() && - I.getOperand(0)->getType()->isInteger()) || - (I.getType()->isInteger() && - I.getOperand(0)->getType()->isFloatingPoint()))) { - + if (isFPIntBitCast(I)) { // These int<->float and long<->double casts need to be handled specially Out << Mang->getValueName(&I) << "__BITCAST_TEMPORARY." << getFloatBitCastField(I.getOperand(0)->getType()) << " = "; From sabre at nondot.org Sun Dec 17 15:04:18 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 17 Dec 2006 15:04:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200612172104.kBHL4IGF007931@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JIT.cpp updated: 1.83 -> 1.84 --- Log message: Fix PR1057: http://llvm.org/PR1057 (compilation on macos 10.3), patch by Scott Michel! --- Diffs of the changes: (+8 -8) JIT.cpp | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/lib/ExecutionEngine/JIT/JIT.cpp diff -u llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.83 llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.84 --- llvm/lib/ExecutionEngine/JIT/JIT.cpp:1.83 Mon Dec 11 19:17:41 2006 +++ llvm/lib/ExecutionEngine/JIT/JIT.cpp Sun Dec 17 15:04:02 2006 @@ -31,9 +31,10 @@ #ifdef __APPLE__ #include -#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) || \ - (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \ - __APPLE_CC__ >= 5330) +#if defined(MAC_OS_X_VERSION_10_4) && \ + ((MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) || \ + (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \ + __APPLE_CC__ >= 5330)) // __dso_handle is resolved by Mac OS X dynamic linker. extern void *__dso_handle __attribute__ ((__visibility__ ("hidden"))); #endif @@ -308,10 +309,10 @@ // If the global is external, just remember the address. if (GV->isExternal()) { -#ifdef __APPLE__ -#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) || \ - (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \ - __APPLE_CC__ >= 5330) +#if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_4) && \ + ((MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4) || \ + (MAC_OS_X_VERSION_MIN_REQUIRED == MAC_OS_X_VERSION_10_4 && \ + __APPLE_CC__ >= 5330)) // Apple gcc defaults to -fuse-cxa-atexit (i.e. calls __cxa_atexit instead // of atexit). It passes the address of linker generated symbol __dso_handle // to the function. @@ -319,7 +320,6 @@ if (GV->getName() == "__dso_handle") return (void*)&__dso_handle; #endif -#endif Ptr = sys::DynamicLibrary::SearchForAddressOfSymbol(GV->getName().c_str()); if (Ptr == 0) { cerr << "Could not resolve external global address: " From rspencer at reidspencer.com Sun Dec 17 17:35:08 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Sun, 17 Dec 2006 15:35:08 -0800 Subject: [llvm-commits] SETCC InstructionCombining.cpp Message-ID: <1166398509.2826.12.camel@bashful.x10sys.com> Chris, Attached is the patch to InstructionCombining.cpp for SETCC conversion to ICmpInst. This passes all tests. All your previous feedback has been incorporated and confirmed. The test just completed includes all those changes as well. I'm looking forward to finally committing the SETCC patch so we can finish it off and then start removing unnecessary casts and unifying the integer types. Thanks in advance for your review. Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: IC.diff Type: text/x-patch Size: 142057 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061217/3ae76627/attachment.bin From reid at x10sys.com Sun Dec 17 18:37:52 2006 From: reid at x10sys.com (Reid Spencer) Date: Sun, 17 Dec 2006 18:37:52 -0600 Subject: [llvm-commits] CVS: llvm/utils/findoptdiff Message-ID: <200612180037.kBI0bqjg011377@zion.cs.uiuc.edu> Changes in directory llvm/utils: findoptdiff updated: 1.1 -> 1.2 --- Log message: Remove some clutter and make it keep going instead of stopping at the first difference. --- Diffs of the changes: (+23 -21) findoptdiff | 44 +++++++++++++++++++++++--------------------- 1 files changed, 23 insertions(+), 21 deletions(-) Index: llvm/utils/findoptdiff diff -u llvm/utils/findoptdiff:1.1 llvm/utils/findoptdiff:1.2 --- llvm/utils/findoptdiff:1.1 Mon Dec 11 11:42:12 2006 +++ llvm/utils/findoptdiff Sun Dec 17 18:37:37 2006 @@ -21,7 +21,9 @@ # The script operates by iteratively applying the optimizations that gccas # and gccld run until there is a difference in the assembly resulting # from the optimization. The difference is then reported with the set of -# optimization passes that produce the difference. +# optimization passes that produce the difference. The processing +# continues until all optimization passes have been tried. The differences +# for each pass, if they do differ, are placed in a diffs.# file. # # To work around differences in the assembly language format, the script # can also take two filter arguments that post-process the assembly @@ -50,42 +52,42 @@ bc1=$3 bc2=$4 filt1=$5 +filt2=$6 if [ -z "$filt1" ] ; then filt1="cat" fi -filt2=$6 if [ -z "$filt2" ] ; then filt2="cat" fi -opt1=opt.$bc1 -opt2=opt.$bc2 -ll1=${bc1}.ll -ll2=${bc2}.ll -dir1="/proj/llvm/llvm-test-1/External/SPEC/CINT2000/300.twolf" -opt1="/proj/llvm/llvm-1/Debug/bin/opt" -dis1="/proj/llvm/llvm-1/Debug/bin/llvm-dis" -dir2="/proj/llvm/llvm-test-2/External/SPEC/CINT2000/300.twolf" -opt2="/proj/llvm/llvm-2/Debug/bin/opt" -dis2="/proj/llvm/llvm-2/Debug/bin/llvm-dis" -bcfile="Output/300.twolf.linked.rbc" -optll="opt.ll" +opt1="${bc1}.opt" +opt2="${bc2}.opt" +ll1="${bc1}.ll" +ll2="${bc2}.ll" +opt1ll="${bc1}.opt.ll" +opt2ll="${bc2}.opt.ll" +dis1="$llvm1/Debug/bin/llvm-dis" +dis2="$llvm2/Debug/bin/llvm-dis" +opt1="$llvm1/Debug/bin/opt" +opt2="$llvm2/Debug/bin/opt" all_switches="-verify -lowersetjmp -funcresolve -raiseallocs -simplifycfg -mem2reg -globalopt -globaldce -ipconstprop -deadargelim -instcombine -simplifycfg -prune-eh -inline -simplify-libcalls -argpromotion -raise -tailduplicate -simplifycfg -scalarrepl -instcombine -predsimplify -condprop -tailcallelim -simplifycfg -reassociate -licm -loop-unswitch -instcombine -indvars -loop-unroll -instcombine -load-vn -gcse -sccp -instcombine -condprop -dse -dce -simplifycfg -deadtypeelim -constmerge -funcresolve -internalize -ipsccp -globalopt -constmerge -deadargelim -inline -prune-eh -globalopt -globaldce -argpromotion -instcombine -predsimplify -scalarrepl -globalsmodref-aa -licm -load-vn -gcse -dse -instcombine -simplifycfg -verify" +#counter=0 function tryit { switches_to_use="$1" - cd $dir1 - $opt1 $switches_to_use "$bcfile" -o - | $dis1 | $filt1 > "$optll" - cd $dir2 - $opt2 $switches_to_use "$bcfile" -o - | $dis2 | $filt2 > "$optll" - diff "$dir1/$optll" "$dir2/$optll" > /dev/null + $opt1 $switches_to_use "$bc1" -o - | $dis1 | $filt1 > "$opt1ll" + $opt2 $switches_to_use "$bc2" -o - | $dis2 | $filt2 > "$opt2ll" + diffs="diffs."$((counter++)) + diff "$opt1ll" "$opt2ll" > $diffs if [ $? -ne 0 ] ; then echo echo "Diff fails with these switches:" echo $switches echo "Differences:" - diff "$dir1/$optll" "$dir2/$optll" | head - exit 1 + head $diffs + echo 'Switches:' $switches_to_use >> $diffs + else + rm $diffs fi return 1 } From reid at x10sys.com Sun Dec 17 19:11:19 2006 From: reid at x10sys.com (Reid Spencer) Date: Sun, 17 Dec 2006 19:11:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Message-ID: <200612180111.kBI1BJxr012006@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.114 -> 1.115 --- Log message: Remove the last use of getUnsignedVersion and getSignedVersion from VMCore. ConstantInt doesn't care about the sign of the type it represents. It only cares about the bitwidth so there is no need to make the sign of the type match the SExt or ZExt constant expression. --- Diffs of the changes: (+2 -4) ConstantFolding.cpp | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.114 llvm/lib/VMCore/ConstantFolding.cpp:1.115 --- llvm/lib/VMCore/ConstantFolding.cpp:1.114 Tue Dec 12 17:36:14 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Sun Dec 17 19:11:03 2006 @@ -875,16 +875,14 @@ // A ZExt always produces an unsigned value so we need to cast the value // now before we try to cast it to the destination type if (isa(V)) - V = ConstantInt::get(SrcTy->getUnsignedVersion(), - cast(V)->getZExtValue()); + V = ConstantInt::get(SrcTy, cast(V)->getZExtValue()); break; case Instruction::SIToFP: case Instruction::SExt: // A SExt always produces a signed value so we need to cast the value // now before we try to cast it to the destiniation type. if (isa(V)) - V = ConstantInt::get(SrcTy->getSignedVersion(), - cast(V)->getSExtValue()); + V = ConstantInt::get(SrcTy, cast(V)->getSExtValue()); else if (const ConstantBool *CB = dyn_cast(V)) V = ConstantInt::get(Type::SByteTy, CB->getValue() ? -1 : 0); From reid at x10sys.com Sun Dec 17 19:12:01 2006 From: reid at x10sys.com (Reid Spencer) Date: Sun, 17 Dec 2006 19:12:01 -0600 Subject: [llvm-commits] CVS: llvm/test/Feature/newcasts.ll Message-ID: <200612180112.kBI1C1FO012027@zion.cs.uiuc.edu> Changes in directory llvm/test/Feature: newcasts.ll updated: 1.1 -> 1.2 --- Log message: Add a couple little tests for SExt/ZExt of constants of a sign that doesn't match. --- Diffs of the changes: (+7 -0) newcasts.ll | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/test/Feature/newcasts.ll diff -u llvm/test/Feature/newcasts.ll:1.1 llvm/test/Feature/newcasts.ll:1.2 --- llvm/test/Feature/newcasts.ll:1.1 Fri Dec 1 22:23:07 2006 +++ llvm/test/Feature/newcasts.ll Sun Dec 17 19:11:46 2006 @@ -19,3 +19,10 @@ } +ushort "ZExtConst" () { + ret ushort trunc ( uint zext ( short 42 to uint) to ushort ) +} + +short "SExtConst" () { + ret short trunc (int sext (ushort 42 to int) to short ) +} From rafael.espindola at gmail.com Sun Dec 17 21:37:36 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sun, 17 Dec 2006 21:37:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200612180337.kBI3baFf014259@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.221 -> 1.222 --- Log message: move ExtWeakSymbols to AsmPrinter --- Diffs of the changes: (+3 -15) PPCAsmPrinter.cpp | 18 +++--------------- 1 files changed, 3 insertions(+), 15 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.221 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.222 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.221 Tue Dec 12 14:57:08 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Sun Dec 17 21:37:18 2006 @@ -50,9 +50,6 @@ struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter { std::set FnStubs, GVStubs; const PPCSubtarget &Subtarget; - - // Necessary for external weak linkage support - std::set ExtWeakSymbols; PPCAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T) : AsmPrinter(O, TM, T), Subtarget(TM.getSubtarget()) { @@ -162,7 +159,7 @@ FnStubs.insert(Name); O << "L" << Name << "$stub"; if (GV->hasExternalWeakLinkage()) - ExtWeakSymbols.insert(Name); + ExtWeakSymbols.insert(GV); return; } } @@ -337,7 +334,7 @@ O << Name; if (GV->hasExternalWeakLinkage()) - ExtWeakSymbols.insert(Name); + ExtWeakSymbols.insert(GV); return; } @@ -658,22 +655,13 @@ // reference! if (const GlobalValue *GV = dyn_cast(C)) if (GV->hasExternalWeakLinkage()) - ExtWeakSymbols.insert(Mang->getValueName(GV)); + ExtWeakSymbols.insert(GV); EmitGlobalConstant(C); O << '\n'; } } - if (TAI->getWeakRefDirective()) { - if (ExtWeakSymbols.begin() != ExtWeakSymbols.end()) - SwitchToDataSection(""); - for (std::set::iterator i = ExtWeakSymbols.begin(), - e = ExtWeakSymbols.end(); i != e; ++i) { - O << TAI->getWeakRefDirective() << *i << "\n"; - } - } - bool isPPC64 = TD->getPointerSizeInBits() == 64; // Output stubs for dynamically-linked functions From rafael.espindola at gmail.com Sun Dec 17 21:37:37 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sun, 17 Dec 2006 21:37:37 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200612180337.kBI3bbbQ014264@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.125 -> 1.126 --- Log message: move ExtWeakSymbols to AsmPrinter --- Diffs of the changes: (+12 -0) AsmPrinter.cpp | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.125 llvm/lib/CodeGen/AsmPrinter.cpp:1.126 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.125 Thu Dec 14 13:17:33 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Sun Dec 17 21:37:18 2006 @@ -106,6 +106,18 @@ } bool AsmPrinter::doFinalization(Module &M) { + if (TAI->getWeakRefDirective()) { + if (ExtWeakSymbols.begin() != ExtWeakSymbols.end()) + SwitchToDataSection(""); + + for (std::set::iterator i = ExtWeakSymbols.begin(), + e = ExtWeakSymbols.end(); i != e; ++i) { + const GlobalValue *GV = *i; + std::string Name = Mang->getValueName(GV); + O << TAI->getWeakRefDirective() << Name << "\n"; + } + } + delete Mang; Mang = 0; return false; } From rafael.espindola at gmail.com Sun Dec 17 21:37:40 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sun, 17 Dec 2006 21:37:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86AsmPrinter.h Message-ID: <200612180337.kBI3bexo014274@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.78 -> 1.79 X86AsmPrinter.cpp updated: 1.221 -> 1.222 X86AsmPrinter.h updated: 1.38 -> 1.39 --- Log message: move ExtWeakSymbols to AsmPrinter --- Diffs of the changes: (+2 -14) X86ATTAsmPrinter.cpp | 2 +- X86AsmPrinter.cpp | 11 +---------- X86AsmPrinter.h | 3 --- 3 files changed, 2 insertions(+), 14 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.78 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.79 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.78 Tue Dec 5 13:50:18 2006 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Sun Dec 17 21:37:18 2006 @@ -257,7 +257,7 @@ } if (GV->hasExternalWeakLinkage()) - ExtWeakSymbols.insert(Name); + ExtWeakSymbols.insert(GV); int Offset = MO.getOffset(); if (Offset > 0) Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.221 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.222 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.221 Sat Dec 9 17:14:08 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Sun Dec 17 21:37:18 2006 @@ -250,7 +250,7 @@ // reference! if (const GlobalValue *GV = dyn_cast(C)) if (GV->hasExternalWeakLinkage()) - ExtWeakSymbols.insert(Mang->getValueName(GV)); + ExtWeakSymbols.insert(GV); EmitGlobalConstant(C); O << '\n'; @@ -278,15 +278,6 @@ O << "\t.ascii \" -export:" << *i << "\"\n"; } - if (TAI->getWeakRefDirective()) { - if (ExtWeakSymbols.begin() != ExtWeakSymbols.end()) - SwitchToDataSection(""); - for (std::set::iterator i = ExtWeakSymbols.begin(), - e = ExtWeakSymbols.end(); i != e; ++i) { - O << TAI->getWeakRefDirective() << *i << "\n"; - } - } - if (Subtarget->isTargetDarwin()) { SwitchToDataSection(""); Index: llvm/lib/Target/X86/X86AsmPrinter.h diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.38 llvm/lib/Target/X86/X86AsmPrinter.h:1.39 --- llvm/lib/Target/X86/X86AsmPrinter.h:1.38 Wed Dec 6 12:14:47 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.h Sun Dec 17 21:37:18 2006 @@ -86,9 +86,6 @@ // Necessary for dllexport support std::set DLLExportedFns, DLLExportedGVs; - // Necessary for external weak linkage support - std::set ExtWeakSymbols; - inline static bool isScale(const MachineOperand &MO) { return MO.isImmediate() && (MO.getImmedValue() == 1 || MO.getImmedValue() == 2 || From rafael.espindola at gmail.com Sun Dec 17 21:37:41 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sun, 17 Dec 2006 21:37:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMAsmPrinter.cpp Message-ID: <200612180337.kBI3bfUv014282@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMAsmPrinter.cpp updated: 1.39 -> 1.40 --- Log message: move ExtWeakSymbols to AsmPrinter --- Diffs of the changes: (+1 -10) ARMAsmPrinter.cpp | 11 +---------- 1 files changed, 1 insertion(+), 10 deletions(-) Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.39 llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.40 --- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.39 Sat Dec 9 20:53:14 2006 +++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp Sun Dec 17 21:37:18 2006 @@ -62,8 +62,6 @@ : AsmPrinter(O, TM, T) { } - std::set ExtWeakSymbols; - /// We name each basic block in a Function with a unique number, so /// that we can consistently refer to them later. This is cleared /// at the beginning of each call to runOnMachineFunction(). @@ -246,7 +244,7 @@ std::string Name = Mang->getValueName(GV); O << Name; if (GV->hasExternalWeakLinkage()) { - ExtWeakSymbols.insert(Name); + ExtWeakSymbols.insert(GV); } } break; @@ -337,13 +335,6 @@ } } - if (ExtWeakSymbols.begin() != ExtWeakSymbols.end()) - SwitchToDataSection(""); - for (std::set::iterator i = ExtWeakSymbols.begin(), - e = ExtWeakSymbols.end(); i != e; ++i) { - O << TAI->getWeakRefDirective() << *i << "\n"; - } - AsmPrinter::doFinalization(M); return false; // success } From rafael.espindola at gmail.com Sun Dec 17 21:37:41 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Sun, 17 Dec 2006 21:37:41 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h Message-ID: <200612180337.kBI3bfi8014279@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: AsmPrinter.h updated: 1.57 -> 1.58 --- Log message: move ExtWeakSymbols to AsmPrinter --- Diffs of the changes: (+5 -0) AsmPrinter.h | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/include/llvm/CodeGen/AsmPrinter.h diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.57 llvm/include/llvm/CodeGen/AsmPrinter.h:1.58 --- llvm/include/llvm/CodeGen/AsmPrinter.h:1.57 Wed Nov 1 03:22:43 2006 +++ llvm/include/llvm/CodeGen/AsmPrinter.h Sun Dec 17 21:37:18 2006 @@ -18,6 +18,7 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/Support/DataTypes.h" +#include namespace llvm { class Constant; @@ -39,6 +40,10 @@ /// unsigned FunctionNumber; + protected: + // Necessary for external weak linkage support + std::set ExtWeakSymbols; + public: /// Output stream on which we're printing assembly code. /// From reid at x10sys.com Sun Dec 17 22:11:31 2006 From: reid at x10sys.com (Reid Spencer) Date: Sun, 17 Dec 2006 22:11:31 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Config/config.h.in Message-ID: <200612180411.kBI4BVRN014805@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Config: config.h.in updated: 1.72 -> 1.73 --- Log message: Determine if the -enable-pic option was given. --- Diffs of the changes: (+3 -0) config.h.in | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/include/llvm/Config/config.h.in diff -u llvm/include/llvm/Config/config.h.in:1.72 llvm/include/llvm/Config/config.h.in:1.73 --- llvm/include/llvm/Config/config.h.in:1.72 Sun Dec 10 17:12:42 2006 +++ llvm/include/llvm/Config/config.h.in Sun Dec 17 22:11:16 2006 @@ -14,6 +14,9 @@ /* Define if CBE is enabled for printf %a output */ #undef ENABLE_CBE_PRINTF_A +/* Define if position independent code is enabled */ +#undef ENABLE_PIC + /* Define if threads enabled */ #undef ENABLE_THREADS From reid at x10sys.com Sun Dec 17 22:23:11 2006 From: reid at x10sys.com (Reid Spencer) Date: Sun, 17 Dec 2006 22:23:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Message-ID: <200612180423.kBI4NBkl015003@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.115 -> 1.116 --- Log message: Revert last patch. ConstantInt isn't quite ready for signlessness. --- Diffs of the changes: (+4 -2) ConstantFolding.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.115 llvm/lib/VMCore/ConstantFolding.cpp:1.116 --- llvm/lib/VMCore/ConstantFolding.cpp:1.115 Sun Dec 17 19:11:03 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Sun Dec 17 22:22:56 2006 @@ -875,14 +875,16 @@ // A ZExt always produces an unsigned value so we need to cast the value // now before we try to cast it to the destination type if (isa(V)) - V = ConstantInt::get(SrcTy, cast(V)->getZExtValue()); + V = ConstantInt::get(SrcTy->getUnsignedVersion(), + cast(V)->getZExtValue()); break; case Instruction::SIToFP: case Instruction::SExt: // A SExt always produces a signed value so we need to cast the value // now before we try to cast it to the destiniation type. if (isa(V)) - V = ConstantInt::get(SrcTy, cast(V)->getSExtValue()); + V = ConstantInt::get(SrcTy->getSignedVersion(), + cast(V)->getSExtValue()); else if (const ConstantBool *CB = dyn_cast(V)) V = ConstantInt::get(Type::SByteTy, CB->getValue() ? -1 : 0);