From baldrick at free.fr Mon Sep 10 02:38:56 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 10 Sep 2007 07:38:56 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41793 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200709100738.l8A7cucM017437@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 10 02:38:55 2007 New Revision: 41793 URL: http://llvm.org/viewvc/llvm-project?rev=41793&view=rev Log: Forward port of 41791. Note that the original problem was not visible with 4.2 because it has special handling for the case of an empty filter, however the underlying problem still existed there. Unbreak 64-bit build. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=41793&r1=41792&r2=41793&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Sep 10 02:38:55 2007 @@ -1914,7 +1914,7 @@ Value *Select = Builder.CreateLoad(ExceptionSelectorValue, "tmp"); // Compare with the filter action value. - Value *Zero = ConstantInt::get(Type::Int32Ty, 0); + Value *Zero = ConstantInt::get(Select->getType(), 0); Value *Compare = Builder.CreateICmpSLT(Select, Zero, "tmp"); // Branch on the compare. From dpatel at apple.com Mon Sep 10 13:08:24 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 10 Sep 2007 18:08:24 -0000 Subject: [llvm-commits] [llvm] r41798 - /llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Message-ID: <200709101808.l8AI8O1N011632@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 10 13:08:23 2007 New Revision: 41798 URL: http://llvm.org/viewvc/llvm-project?rev=41798&view=rev Log: Require SCEV before LCSSA. Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=41798&r1=41797&r2=41798&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Mon Sep 10 13:08:23 2007 @@ -75,9 +75,9 @@ bool runOnLoop(Loop *L, LPPassManager &LPM); bool doInitialization(Loop *L, LPPassManager &LPM); virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.addRequired(); AU.addRequiredID(LCSSAID); AU.addRequiredID(LoopSimplifyID); - AU.addRequired(); AU.addRequired(); AU.addPreservedID(LoopSimplifyID); AU.addPreservedID(LCSSAID); From dpatel at apple.com Mon Sep 10 13:12:52 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 10 Sep 2007 18:12:52 -0000 Subject: [llvm-commits] [llvm] r41799 - /llvm/trunk/test/Other/2007-09-10-PassManager.ll Message-ID: <200709101812.l8AICqhH011763@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 10 13:12:52 2007 New Revision: 41799 URL: http://llvm.org/viewvc/llvm-project?rev=41799&view=rev Log: New test. Added: llvm/trunk/test/Other/2007-09-10-PassManager.ll Added: llvm/trunk/test/Other/2007-09-10-PassManager.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/2007-09-10-PassManager.ll?rev=41799&view=auto ============================================================================== --- llvm/trunk/test/Other/2007-09-10-PassManager.ll (added) +++ llvm/trunk/test/Other/2007-09-10-PassManager.ll Mon Sep 10 13:12:52 2007 @@ -0,0 +1,32 @@ +; RUN: llvm-as < %s | opt -loop-unswitch -indvars -disable-output +; Require SCEV before LCSSA. +define void @foo() { +entry: + %i = alloca i32, align 4 ; [#uses=5] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i32 0, i32* %i, align 4 + br label %bb3 + +bb: ; preds = %bb3 + %tmp = load i32* %i, align 4 ; [#uses=1] + call void @bar( i32 %tmp ) + %tmp1 = load i32* %i, align 4 ; [#uses=1] + %tmp2 = add i32 %tmp1, 1 ; [#uses=1] + store i32 %tmp2, i32* %i, align 4 + br label %bb3 + +bb3: ; preds = %bb, %entry + %tmp4 = load i32* %i, align 4 ; [#uses=1] + %tmp5 = icmp sle i32 %tmp4, 9 ; [#uses=1] + %tmp56 = zext i1 %tmp5 to i8 ; [#uses=1] + %toBool = icmp ne i8 %tmp56, 0 ; [#uses=1] + br i1 %toBool, label %bb, label %bb7 + +bb7: ; preds = %bb3 + br label %return + +return: ; preds = %bb7 + ret void +} + +declare void @bar(i32) From dpatel at apple.com Mon Sep 10 13:33:42 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 10 Sep 2007 18:33:42 -0000 Subject: [llvm-commits] [llvm] r41800 - in /llvm/trunk: lib/Transforms/Scalar/LoopIndexSplit.cpp test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll Message-ID: <200709101833.l8AIXgKr012891@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 10 13:33:42 2007 New Revision: 41800 URL: http://llvm.org/viewvc/llvm-project?rev=41800&view=rev Log: Filter exit conditions which are not yet handled. Added: llvm/trunk/test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=41800&r1=41799&r2=41800&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Sep 10 13:33:42 2007 @@ -332,7 +332,9 @@ if (CI->getPredicate() == ICmpInst::ICMP_SGT || CI->getPredicate() == ICmpInst::ICMP_UGT || CI->getPredicate() == ICmpInst::ICMP_SGE - || CI->getPredicate() == ICmpInst::ICMP_UGE) + || CI->getPredicate() == ICmpInst::ICMP_UGE + || CI->getPredicate() == ICmpInst::ICMP_EQ + || CI->getPredicate() == ICmpInst::ICMP_NE) return; ExitCondition = CI; Added: llvm/trunk/test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll?rev=41800&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll (added) +++ llvm/trunk/test/Transforms/LoopIndexSplit/ExitCondition-2007-09-10.ll Mon Sep 10 13:33:42 2007 @@ -0,0 +1,50 @@ +; RUN: llvm-as < %s | opt -loop-index-split -disable-output + + at k = external global i32 ; [#uses=2] + +define void @foobar(i32 %a, i32 %b) { +entry: + br label %bb + +bb: ; preds = %cond_next16, %entry + %i.01.0 = phi i32 [ 0, %entry ], [ %tmp18, %cond_next16 ] ; [#uses=5] + %tsum.18.0 = phi i32 [ 42, %entry ], [ %tsum.013.1, %cond_next16 ] ; [#uses=3] + %tmp1 = icmp slt i32 %i.01.0, 50 ; [#uses=1] + br i1 %tmp1, label %cond_true, label %cond_false + +cond_true: ; preds = %bb + %tmp4 = tail call i32 @foo( i32 %i.01.0 ) ; [#uses=1] + %tmp6 = add i32 %tmp4, %tsum.18.0 ; [#uses=2] + %tmp914 = load i32* @k, align 4 ; [#uses=1] + %tmp1015 = icmp eq i32 %tmp914, 0 ; [#uses=1] + br i1 %tmp1015, label %cond_next16, label %cond_true13 + +cond_false: ; preds = %bb + %tmp8 = tail call i32 @bar( i32 %i.01.0 ) ; [#uses=0] + %tmp9 = load i32* @k, align 4 ; [#uses=1] + %tmp10 = icmp eq i32 %tmp9, 0 ; [#uses=1] + br i1 %tmp10, label %cond_next16, label %cond_true13 + +cond_true13: ; preds = %cond_false, %cond_true + %tsum.013.0 = phi i32 [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; [#uses=1] + %tmp15 = tail call i32 @bar( i32 %i.01.0 ) ; [#uses=0] + br label %cond_next16 + +cond_next16: ; preds = %cond_false, %cond_true, %cond_true13 + %tsum.013.1 = phi i32 [ %tsum.013.0, %cond_true13 ], [ %tmp6, %cond_true ], [ %tsum.18.0, %cond_false ] ; [#uses=2] + %tmp18 = add i32 %i.01.0, 1 ; [#uses=3] + %tmp21 = icmp eq i32 %tmp18, 100 ; [#uses=1] + br i1 %tmp21, label %bb, label %bb24 + +bb24: ; preds = %cond_next16 + %tmp18.lcssa = phi i32 [ %tmp18, %cond_next16 ] ; [#uses=1] + %tsum.013.1.lcssa = phi i32 [ %tsum.013.1, %cond_next16 ] ; [#uses=1] + %tmp27 = tail call i32 @t( i32 %tmp18.lcssa, i32 %tsum.013.1.lcssa ) ; [#uses=0] + ret void +} + +declare i32 @foo(i32) + +declare i32 @bar(i32) + +declare i32 @t(i32, i32) From evan.cheng at apple.com Mon Sep 10 15:27:28 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 10 Sep 2007 13:27:28 -0700 Subject: [llvm-commits] [llvm] r41775 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86InstrX86-64.td test/CodeGen/X86/zero-remat.ll In-Reply-To: <200709072132.l87LWpsP020593@zion.cs.uiuc.edu> References: <200709072132.l87LWpsP020593@zion.cs.uiuc.edu> Message-ID: Hi Dan, This is not safe because xor will clobber flags. It's a miscompilation if the user of the rematerialized value is a conditional move (e.g. cmovne). The current fix is to X86RegisterInfo::reMaterialize() should rematerialize it as a move instruction. Evan On Sep 7, 2007, at 2:32 PM, Dan Gohman wrote: > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) > +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Fri Sep 7 16:32:51 2007 > @@ -2313,6 +2313,7 @@ > > // Alias instructions that map movr0 to xor. > // FIXME: remove when we can teach regalloc that xor reg, reg is ok. > +let isReMaterializable = 1 in { > def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins), > "xor{b}\t$dst, $dst", > [(set GR8:$dst, 0)]>; > @@ -2322,6 +2323,7 @@ > def MOV32r0 : I<0x31, MRMInitReg, (outs GR32:$dst), (ins), > "xor{l}\t$dst, $dst", > [(set GR32:$dst, 0)]>; > +} > From djg at cray.com Mon Sep 10 15:48:29 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 10 Sep 2007 15:48:29 -0500 Subject: [llvm-commits] [llvm] r41775 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86InstrX86-64.td test/CodeGen/X86/zero-remat.ll Message-ID: <20070910204829.GQ4760@village.us.cray.com> > Hi Dan, > > This is not safe because xor will clobber flags. It's a miscompilation > if the user of the rematerialized value is a conditional move (e.g. > cmovne). Thanks for spotting that! > The current fix is to X86RegisterInfo::reMaterialize() should > rematerialize it as a move instruction. Are you saying such a fix exists already, or that this is how a fix should work? If the latter, I'd prefer to just revert the change to the instructions that use xor so that they are not marked rematerializable for now (though the ones that use pxor/xorps/xorpd are ok). Dan -- Dan Gohman, Cray Inc. From evan.cheng at apple.com Mon Sep 10 15:48:54 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 10 Sep 2007 20:48:54 -0000 Subject: [llvm-commits] [llvm] r41802 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200709102048.l8AKmsBh018775@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 10 15:48:53 2007 New Revision: 41802 URL: http://llvm.org/viewvc/llvm-project?rev=41802&view=rev Log: It's not safe to rematerialize MOV32r0 etc. by simply cloning the original instruction. These are implemented with xor which will modify the conditional code. They should be rematerialized as move instructions. Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=41802&r1=41801&r2=41802&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Mon Sep 10 15:48:53 2007 @@ -265,9 +265,28 @@ MachineBasicBlock::iterator I, unsigned DestReg, const MachineInstr *Orig) const { - MachineInstr *MI = Orig->clone(); - MI->getOperand(0).setReg(DestReg); - MBB.insert(I, MI); + // MOV32r0 etc. are implemented with xor which clobbers condition code. + // Re-materialize them as movri instructions to avoid side effects. + switch (Orig->getOpcode()) { + case X86::MOV8r0: + BuildMI(MBB, I, TII.get(X86::MOV8ri), DestReg).addImm(0); + break; + case X86::MOV16r0: + BuildMI(MBB, I, TII.get(X86::MOV16ri), DestReg).addImm(0); + break; + case X86::MOV32r0: + BuildMI(MBB, I, TII.get(X86::MOV32ri), DestReg).addImm(0); + break; + case X86::MOV64r0: + BuildMI(MBB, I, TII.get(X86::MOV64ri32), DestReg).addImm(0); + break; + default: { + MachineInstr *MI = Orig->clone(); + MI->getOperand(0).setReg(DestReg); + MBB.insert(I, MI); + break; + } + } } static const MachineInstrBuilder &FuseInstrAddOperand(MachineInstrBuilder &MIB, From sabre at nondot.org Mon Sep 10 15:58:55 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Sep 2007 20:58:55 -0000 Subject: [llvm-commits] [llvm] r41804 - in /llvm/trunk: lib/Transforms/Scalar/TailRecursionElimination.cpp test/Transforms/TailCallElim/inf-recursion.ll Message-ID: <200709102058.l8AKwtoN019258@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 15:58:55 2007 New Revision: 41804 URL: http://llvm.org/viewvc/llvm-project?rev=41804&view=rev Log: Prevent tailcallelim from breaking "recursive" calls to builtins. Added: llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll Modified: llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp Modified: llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp?rev=41804&r1=41803&r2=41804&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp Mon Sep 10 15:58:55 2007 @@ -302,6 +302,15 @@ if (&BB->front() == Ret) // Make sure there is something before the ret... return false; + + // If the return is in the entry block, then making this transformation would + // turn infinite recursion into an infinite loop. This transformation is ok + // in theory, but breaks some code like: + // double fabs(double f) { return __builtin_fabs(f); } // a 'fabs' call + // disable this xform in this case, because the code generator will lower the + // call to fabs into inline code. + if (BB == &F->getEntryBlock()) + return false; // Scan backwards from the return, checking to see if there is a tail call in // this block. If so, set CI to it. Added: llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll?rev=41804&view=auto ============================================================================== --- llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll (added) +++ llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll Mon Sep 10 15:58:55 2007 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | opt -tailcallelim | grep call +; Don't turn this into an infinite loop, this is probably the implementation +; of fabs and we expect the codegen to lower fabs. + +define double @fabs(double %f) { +entry: + %tmp2 = call double @fabs( double %f ) ; [#uses=1] + ret double %tmp2 +} + From clattner at apple.com Mon Sep 10 16:08:38 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 10 Sep 2007 14:08:38 -0700 Subject: [llvm-commits] [llvm] r41802 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp In-Reply-To: <200709102048.l8AKmsBh018775@zion.cs.uiuc.edu> References: <200709102048.l8AKmsBh018775@zion.cs.uiuc.edu> Message-ID: <2667073D-0E2D-4A6B-9EC0-4182443F37E7@apple.com> Thanks Evan! Can you please add a README entry for this? It's better to use xor reg,reg when the flags are dead (which requires more analysis). -Chris On Sep 10, 2007, at 1:48 PM, Evan Cheng wrote: > Author: evancheng > Date: Mon Sep 10 15:48:53 2007 > New Revision: 41802 > > URL: http://llvm.org/viewvc/llvm-project?rev=41802&view=rev > Log: > It's not safe to rematerialize MOV32r0 etc. by simply cloning the > original > instruction. These are implemented with xor which will modify the > conditional > code. They should be rematerialized as move instructions. > > Modified: > llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp > > Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/ > X86RegisterInfo.cpp?rev=41802&r1=41801&r2=41802&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Mon Sep 10 > 15:48:53 2007 > @@ -265,9 +265,28 @@ > MachineBasicBlock::iterator I, > unsigned DestReg, > const MachineInstr *Orig) const { > - MachineInstr *MI = Orig->clone(); > - MI->getOperand(0).setReg(DestReg); > - MBB.insert(I, MI); > + // MOV32r0 etc. are implemented with xor which clobbers > condition code. > + // Re-materialize them as movri instructions to avoid side effects. > + switch (Orig->getOpcode()) { > + case X86::MOV8r0: > + BuildMI(MBB, I, TII.get(X86::MOV8ri), DestReg).addImm(0); > + break; > + case X86::MOV16r0: > + BuildMI(MBB, I, TII.get(X86::MOV16ri), DestReg).addImm(0); > + break; > + case X86::MOV32r0: > + BuildMI(MBB, I, TII.get(X86::MOV32ri), DestReg).addImm(0); > + break; > + case X86::MOV64r0: > + BuildMI(MBB, I, TII.get(X86::MOV64ri32), DestReg).addImm(0); > + break; > + default: { > + MachineInstr *MI = Orig->clone(); > + MI->getOperand(0).setReg(DestReg); > + MBB.insert(I, MI); > + break; > + } > + } > } > > static const MachineInstrBuilder &FuseInstrAddOperand > (MachineInstrBuilder &MIB, > > > _______________________________________________ > 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 Sep 10 16:15:23 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Sep 2007 21:15:23 -0000 Subject: [llvm-commits] [llvm] r41805 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200709102115.l8ALFNuW019788@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 16:15:22 2007 New Revision: 41805 URL: http://llvm.org/viewvc/llvm-project?rev=41805&view=rev Log: 1. Don't call Value::getName(), which is slow. 2. Lower calls to fabs and friends to FABS nodes etc unless the function has internal linkage. Before we wouldn't lower if it had a definition, which is incorrect. This allows us to compile: define double @fabs(double %f) { %tmp2 = tail call double @fabs( double %f ) ret double %tmp2 } into: _fabs: fabs f1, f1 blr Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=41805&r1=41804&r2=41805&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Sep 10 16:15:22 2007 @@ -2969,50 +2969,64 @@ void SelectionDAGLowering::visitCall(CallInst &I) { const char *RenameFn = 0; if (Function *F = I.getCalledFunction()) { - if (F->isDeclaration()) + if (F->isDeclaration()) { if (unsigned IID = F->getIntrinsicID()) { RenameFn = visitIntrinsicCall(I, IID); if (!RenameFn) return; - } else { // Not an LLVM intrinsic. - const std::string &Name = F->getName(); - if (Name[0] == 'c' && (Name == "copysign" || Name == "copysignf")) { - if (I.getNumOperands() == 3 && // Basic sanity checks. - I.getOperand(1)->getType()->isFloatingPoint() && - I.getType() == I.getOperand(1)->getType() && - I.getType() == I.getOperand(2)->getType()) { - SDOperand LHS = getValue(I.getOperand(1)); - SDOperand RHS = getValue(I.getOperand(2)); - setValue(&I, DAG.getNode(ISD::FCOPYSIGN, LHS.getValueType(), - LHS, RHS)); - return; - } - } else if (Name[0] == 'f' && (Name == "fabs" || Name == "fabsf")) { - if (I.getNumOperands() == 2 && // Basic sanity checks. - I.getOperand(1)->getType()->isFloatingPoint() && - I.getType() == I.getOperand(1)->getType()) { - SDOperand Tmp = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FABS, Tmp.getValueType(), Tmp)); - return; - } - } else if (Name[0] == 's' && (Name == "sin" || Name == "sinf")) { - if (I.getNumOperands() == 2 && // Basic sanity checks. - I.getOperand(1)->getType()->isFloatingPoint() && - I.getType() == I.getOperand(1)->getType()) { - SDOperand Tmp = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FSIN, Tmp.getValueType(), Tmp)); - return; - } - } else if (Name[0] == 'c' && (Name == "cos" || Name == "cosf")) { - if (I.getNumOperands() == 2 && // Basic sanity checks. - I.getOperand(1)->getType()->isFloatingPoint() && - I.getType() == I.getOperand(1)->getType()) { - SDOperand Tmp = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::FCOS, Tmp.getValueType(), Tmp)); - return; - } + } + } + + // Check for well-known libc/libm calls. If the function is internal, it + // can't be a library call. + unsigned NameLen = F->getNameLen(); + if (!F->hasInternalLinkage() && NameLen) { + const char *NameStr = F->getNameStart(); + if (NameStr[0] == 'c' && + ((NameLen == 8 && !strcmp(NameStr, "copysign")) || + (NameLen == 9 && !strcmp(NameStr, "copysignf")))) { + if (I.getNumOperands() == 3 && // Basic sanity checks. + I.getOperand(1)->getType()->isFloatingPoint() && + I.getType() == I.getOperand(1)->getType() && + I.getType() == I.getOperand(2)->getType()) { + SDOperand LHS = getValue(I.getOperand(1)); + SDOperand RHS = getValue(I.getOperand(2)); + setValue(&I, DAG.getNode(ISD::FCOPYSIGN, LHS.getValueType(), + LHS, RHS)); + return; + } + } else if (NameStr[0] == 'f' && + ((NameLen == 4 && !strcmp(NameStr, "fabs")) || + (NameLen == 5 && !strcmp(NameStr, "fabsf")))) { + if (I.getNumOperands() == 2 && // Basic sanity checks. + I.getOperand(1)->getType()->isFloatingPoint() && + I.getType() == I.getOperand(1)->getType()) { + SDOperand Tmp = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(ISD::FABS, Tmp.getValueType(), Tmp)); + return; + } + } else if (NameStr[0] == 's' && + ((NameLen == 3 && !strcmp(NameStr, "sin")) || + (NameLen == 4 && !strcmp(NameStr, "sinf")))) { + if (I.getNumOperands() == 2 && // Basic sanity checks. + I.getOperand(1)->getType()->isFloatingPoint() && + I.getType() == I.getOperand(1)->getType()) { + SDOperand Tmp = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(ISD::FSIN, Tmp.getValueType(), Tmp)); + return; + } + } else if (NameStr[0] == 'c' && + ((NameLen == 3 && !strcmp(NameStr, "cos")) || + (NameLen == 4 && !strcmp(NameStr, "cosf")))) { + if (I.getNumOperands() == 2 && // Basic sanity checks. + I.getOperand(1)->getType()->isFloatingPoint() && + I.getType() == I.getOperand(1)->getType()) { + SDOperand Tmp = getValue(I.getOperand(1)); + setValue(&I, DAG.getNode(ISD::FCOS, Tmp.getValueType(), Tmp)); + return; } } + } } else if (isa(I.getOperand(0))) { visitInlineAsm(I); return; From sabre at nondot.org Mon Sep 10 16:16:23 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Sep 2007 21:16:23 -0000 Subject: [llvm-commits] [llvm] r41806 - /llvm/trunk/test/CodeGen/PowerPC/fabs.ll Message-ID: <200709102116.l8ALGNXQ019824@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 16:16:23 2007 New Revision: 41806 URL: http://llvm.org/viewvc/llvm-project?rev=41806&view=rev Log: this is not infinite recursion. Added: llvm/trunk/test/CodeGen/PowerPC/fabs.ll Added: llvm/trunk/test/CodeGen/PowerPC/fabs.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/fabs.ll?rev=41806&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/fabs.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/fabs.ll Mon Sep 10 16:16:23 2007 @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s | llc -march=ppc32 | grep {fabs f1, f1} + +define double @fabs(double %f) { +entry: + %tmp2 = tail call double @fabs( double %f ) ; [#uses=1] + ret double %tmp2 +} From sabre at nondot.org Mon Sep 10 16:39:07 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Sep 2007 21:39:07 -0000 Subject: [llvm-commits] [llvm] r41807 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200709102139.l8ALd7gr020540@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 16:39:07 2007 New Revision: 41807 URL: http://llvm.org/viewvc/llvm-project?rev=41807&view=rev Log: Emit: cmpl %eax, %ecx setae %al movzbl %al, %eax instead of: cmpl %eax, %ecx setb %al xorb $1, %al movzbl %al, %eax when using logical not of a C comparison. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=41807&r1=41806&r2=41807&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Sep 10 16:39:07 2007 @@ -1941,6 +1941,16 @@ assert(0 && "Unhandled SetCC Equivalent!"); abort(); } + // fold (not (zext (setcc x, y))) -> (zext (not (setcc x, y))) + if (N1C && N1C->getValue() == 1 && N0.getOpcode() == ISD::ZERO_EXTEND && + N0.Val->hasOneUse() && isSetCCEquivalent(N0.getOperand(0), LHS, RHS, CC)){ + SDOperand V = N0.getOperand(0); + V = DAG.getNode(ISD::XOR, V.getValueType(), V, + DAG.getConstant(V.getValueType(), 1)); + AddToWorkList(V.Val); + return DAG.getNode(ISD::ZERO_EXTEND, VT, V); + } + // fold !(x or y) -> (!x and !y) iff x or y are setcc if (N1C && N1C->getValue() == 1 && VT == MVT::i1 && (N0.getOpcode() == ISD::OR || N0.getOpcode() == ISD::AND)) { From sabre at nondot.org Mon Sep 10 16:43:19 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Sep 2007 21:43:19 -0000 Subject: [llvm-commits] [llvm] r41808 - in /llvm/trunk/lib/Target: ARM/README.txt PowerPC/README.txt X86/README.txt Message-ID: <200709102143.l8ALhJI5020695@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 16:43:18 2007 New Revision: 41808 URL: http://llvm.org/viewvc/llvm-project?rev=41808&view=rev Log: Add some notes about better flag handling. Modified: llvm/trunk/lib/Target/ARM/README.txt llvm/trunk/lib/Target/PowerPC/README.txt llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/ARM/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/README.txt?rev=41808&r1=41807&r2=41808&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/README.txt (original) +++ llvm/trunk/lib/Target/ARM/README.txt Mon Sep 10 16:43:18 2007 @@ -528,3 +528,48 @@ This apparently occurs in real code. //===---------------------------------------------------------------------===// + +This: + #include + std::pair full_add(unsigned a, unsigned b) + { return std::make_pair(a + b, a + b < a); } + bool no_overflow(unsigned a, unsigned b) + { return !full_add(a, b).second; } + +Should compile to: + +_Z8full_addjj: + adds r2, r1, r2 + movcc r1, #0 + movcs r1, #1 + str r2, [r0, #0] + strb r1, [r0, #4] + mov pc, lr + +_Z11no_overflowjj: + cmn r0, r1 + movcs r0, #0 + movcc r0, #1 + mov pc, lr + +not: + +__Z8full_addjj: + add r3, r2, r1 + str r3, [r0] + mov r2, #1 + mov r12, #0 + cmp r3, r1 + movlo r12, r2 + str r12, [r0, #+4] + bx lr +__Z11no_overflowjj: + add r3, r1, r0 + mov r2, #1 + mov r1, #0 + cmp r3, r0 + movhs r1, r2 + mov r0, r1 + bx lr + +//===---------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/PowerPC/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/README.txt?rev=41808&r1=41807&r2=41808&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/README.txt (original) +++ llvm/trunk/lib/Target/PowerPC/README.txt Mon Sep 10 16:43:18 2007 @@ -677,5 +677,33 @@ cmplwi cr0, r6, 33920 bne cr0, LBB1_1 -===-------------------------------------------------------------------------=== +//===---------------------------------------------------------------------===// + +This: + #include + inline std::pair full_add(unsigned a, unsigned b) + { return std::make_pair(a + b, a + b < a); } + bool no_overflow(unsigned a, unsigned b) + { return !full_add(a, b).second; } + +Should compile to: + +__Z11no_overflowjj: + add r4,r3,r4 + subfc r3,r3,r4 + li r3,0 + adde r3,r3,r3 + blr + +(or better) not: + +__Z11no_overflowjj: + add r2, r4, r3 + cmplw cr7, r2, r3 + mfcr r2 + rlwinm r2, r2, 29, 31, 31 + xori r3, r2, 1 + blr + +//===---------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=41808&r1=41807&r2=41808&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Mon Sep 10 16:43:18 2007 @@ -1178,3 +1178,30 @@ be pretty easy, and will nuke all the copies. //===---------------------------------------------------------------------===// + +This: + #include + inline std::pair full_add(unsigned a, unsigned b) + { return std::make_pair(a + b, a + b < a); } + bool no_overflow(unsigned a, unsigned b) + { return !full_add(a, b).second; } + +Should compile to: + + + _Z11no_overflowjj: + addl %edi, %esi + setae %al + ret + +on x86-64, not: + +__Z11no_overflowjj: + addl %edi, %esi + cmpl %edi, %esi + setae %al + movzbl %al, %eax + ret + + +//===---------------------------------------------------------------------===// From evan.cheng at apple.com Mon Sep 10 17:11:18 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 10 Sep 2007 22:11:18 -0000 Subject: [llvm-commits] [llvm] r41809 - /llvm/trunk/lib/CodeGen/README.txt Message-ID: <200709102211.l8AMBIHo021843@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 10 17:11:18 2007 New Revision: 41809 URL: http://llvm.org/viewvc/llvm-project?rev=41809&view=rev Log: Observation of rematerialization. Modified: llvm/trunk/lib/CodeGen/README.txt Modified: llvm/trunk/lib/CodeGen/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/README.txt?rev=41809&r1=41808&r2=41809&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/README.txt (original) +++ llvm/trunk/lib/CodeGen/README.txt Mon Sep 10 17:11:18 2007 @@ -143,3 +143,8 @@ ... load [T + 15] //===---------------------------------------------------------------------===// + +It's not always a good idea to choose rematerialization over spilling. If all +the load / store instructions would be folded then spilling is cheaper because +it won't require new live intervals / registers. See 2003-05-31-LongShifts for +an example. From evan.cheng at apple.com Mon Sep 10 17:16:38 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 10 Sep 2007 22:16:38 -0000 Subject: [llvm-commits] [llvm] r41810 - /llvm/trunk/lib/Target/X86/README.txt Message-ID: <200709102216.l8AMGcrY022215@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 10 17:16:37 2007 New Revision: 41810 URL: http://llvm.org/viewvc/llvm-project?rev=41810&view=rev Log: New entry. Modified: llvm/trunk/lib/Target/X86/README.txt Modified: llvm/trunk/lib/Target/X86/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=41810&r1=41809&r2=41810&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/README.txt (original) +++ llvm/trunk/lib/Target/X86/README.txt Mon Sep 10 17:16:37 2007 @@ -1205,3 +1205,6 @@ //===---------------------------------------------------------------------===// + +Re-materialize MOV32r0 etc. with xor instead of changing them to moves if the +condition register is dead. xor reg reg is shorter than mov reg, #0. From evan.cheng at apple.com Mon Sep 10 17:22:24 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 10 Sep 2007 22:22:24 -0000 Subject: [llvm-commits] [llvm] r41812 - /llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Message-ID: <200709102222.l8AMMO1c022443@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 10 17:22:23 2007 New Revision: 41812 URL: http://llvm.org/viewvc/llvm-project?rev=41812&view=rev Log: 80 col. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=41812&r1=41811&r2=41812&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Mon Sep 10 17:22:23 2007 @@ -418,8 +418,9 @@ } // Almost all ARM instructions are predicable. -class I opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz, IndexMode im, - Format f, string opc, string asm, string cstr, list pattern> +class I opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz, + IndexMode im, Format f, string opc, string asm, string cstr, + list pattern> : InstARM { let OutOperandList = oops; let InOperandList = !con(iops, (ops pred:$p)); @@ -431,8 +432,9 @@ // Same as I except it can optionally modify CPSR. Note it's modeled as // an input operand since by default it's a zero register. It will // become an implicit def once it's "flipped". -class sI opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz, IndexMode im, - Format f, string opc, string asm, string cstr, list pattern> +class sI opcod, dag oops, dag iops, AddrMode am, SizeFlagVal sz, + IndexMode im, Format f, string opc, string asm, string cstr, + list pattern> : InstARM { let OutOperandList = oops; let InOperandList = !con(iops, (ops pred:$p, cc_out:$s)); From dalej at apple.com Mon Sep 10 17:48:00 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 10 Sep 2007 22:48:00 -0000 Subject: [llvm-commits] [llvm] r41813 - /llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll Message-ID: <200709102248.l8AMm0bX023249@zion.cs.uiuc.edu> Author: johannes Date: Mon Sep 10 17:47:59 2007 New Revision: 41813 URL: http://llvm.org/viewvc/llvm-project?rev=41813&view=rev Log: Add missing llvm-dis. Modified: llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll Modified: llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll?rev=41813&r1=41812&r2=41813&view=diff ============================================================================== --- llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll (original) +++ llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll Mon Sep 10 17:47:59 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -tailcallelim | grep call +; RUN: llvm-as < %s | opt -tailcallelim | llvm-dis | grep call ; Don't turn this into an infinite loop, this is probably the implementation ; of fabs and we expect the codegen to lower fabs. From dalej at apple.com Mon Sep 10 17:53:13 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 10 Sep 2007 15:53:13 -0700 Subject: [llvm-commits] [llvm] r41804 - in /llvm/trunk: lib/Transforms/Scalar/TailRecursionElimination.cpp test/Transforms/TailCallElim/inf-recursion.ll In-Reply-To: <200709102058.l8AKwtoN019258@zion.cs.uiuc.edu> References: <200709102058.l8AKwtoN019258@zion.cs.uiuc.edu> Message-ID: <8EEC2A18-1411-4095-AA07-81E1A0439783@apple.com> This testcase is missing an llvm-dis; I've fixed it. Also, this patch breaks Transforms/TailCallElim/return-undef.ll, which is testing that this transformation does happen. Can't we detect whether the call is going to be lowered to inline code and disable the transformation only in that case? On Sep 10, 2007, at 1:58 PM, Chris Lattner wrote: > Added: llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ > TailCallElim/inf-recursion.ll?rev=41804&view=auto > > ====================================================================== > ======== > --- llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll (added) > +++ llvm/trunk/test/Transforms/TailCallElim/inf-recursion.ll Mon > Sep 10 15:58:55 2007 > @@ -0,0 +1,10 @@ > +; RUN: llvm-as < %s | opt -tailcallelim | grep call > +; Don't turn this into an infinite loop, this is probably the > implementation > +; of fabs and we expect the codegen to lower fabs. > + > +define double @fabs(double %f) { > +entry: > + %tmp2 = call double @fabs( double %f ) ; > [#uses=1] > + ret double %tmp2 > +} > + From sabre at nondot.org Mon Sep 10 18:23:53 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Sep 2007 23:23:53 -0000 Subject: [llvm-commits] [llvm] r41815 - in /llvm/trunk: lib/AsmParser/llvmAsmParser.y test/Assembler/2007-09-10-AliasFwdRef.ll Message-ID: <200709102323.l8ANNroI024272@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 18:23:53 2007 New Revision: 41815 URL: http://llvm.org/viewvc/llvm-project?rev=41815&view=rev Log: Fix PR1645 by resolving forward alias references. Added: llvm/trunk/test/Assembler/2007-09-10-AliasFwdRef.ll Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=41815&r1=41814&r2=41815&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Mon Sep 10 18:23:53 2007 @@ -2129,6 +2129,27 @@ CurModule.CurrentModule); GA->setVisibility($2); InsertValue(GA, CurModule.Values); + + + // If there was a forward reference of this alias, resolve it now. + + ValID ID; + if (!Name.empty()) + ID = ValID::createGlobalName(Name); + else + ID = ValID::createGlobalID(CurModule.Values.size()-1); + + if (GlobalValue *FWGV = + CurModule.GetForwardRefForGlobal(GA->getType(), ID)) { + // Replace uses of the fwdref with the actual alias. + FWGV->replaceAllUsesWith(GA); + if (GlobalVariable *GV = dyn_cast(FWGV)) + GV->eraseFromParent(); + else + cast(FWGV)->eraseFromParent(); + } + ID.destroy(); + CHECK_FOR_ERROR } | TARGET TargetDefinition { Added: llvm/trunk/test/Assembler/2007-09-10-AliasFwdRef.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2007-09-10-AliasFwdRef.ll?rev=41815&view=auto ============================================================================== --- llvm/trunk/test/Assembler/2007-09-10-AliasFwdRef.ll (added) +++ llvm/trunk/test/Assembler/2007-09-10-AliasFwdRef.ll Mon Sep 10 18:23:53 2007 @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llvm-dis +; PR1645 + + at __gthread_active_ptr.5335 = internal constant i8* bitcast (i32 (i32)* @__gthrw_pthread_cancel to i8*) + at __gthrw_pthread_cancel = alias weak i32 (i32)* @pthread_cancel + + + +declare extern_weak i32 @pthread_cancel(i32) From sabre at nondot.org Mon Sep 10 18:24:14 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Sep 2007 23:24:14 -0000 Subject: [llvm-commits] [llvm] r41816 - in /llvm/trunk/lib/AsmParser: llvmAsmParser.cpp.cvs llvmAsmParser.y.cvs Message-ID: <200709102324.l8ANOEOG024312@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 18:24:14 2007 New Revision: 41816 URL: http://llvm.org/viewvc/llvm-project?rev=41816&view=rev Log: regenerate Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=41816&r1=41815&r2=41816&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Mon Sep 10 18:24:14 2007 @@ -1,5 +1,5 @@ -/* A Bison parser, made from /Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y +/* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y by GNU Bison version 1.28 */ #define YYBISON 1 /* Identify Bison output. */ @@ -155,7 +155,7 @@ #define HIDDEN 398 #define PROTECTED 399 -#line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 14 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1108,7 +1108,7 @@ } -#line 967 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 967 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" typedef union { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1374,16 +1374,16 @@ 1881, 1893, 1915, 1923, 1929, 1940, 1945, 1950, 1956, 1962, 1971, 1975, 1983, 1983, 1986, 1986, 1989, 2001, 2022, 2027, 2035, 2036, 2040, 2040, 2044, 2044, 2047, 2050, 2074, 2085, - 2092, 2095, 2101, 2104, 2111, 2115, 2134, 2137, 2143, 2153, - 2157, 2162, 2164, 2169, 2174, 2183, 2193, 2204, 2208, 2217, - 2226, 2231, 2352, 2352, 2354, 2363, 2363, 2365, 2370, 2382, - 2386, 2391, 2395, 2399, 2403, 2407, 2411, 2415, 2419, 2423, - 2448, 2452, 2462, 2466, 2470, 2475, 2482, 2482, 2488, 2497, - 2501, 2510, 2519, 2528, 2532, 2539, 2543, 2547, 2552, 2562, - 2581, 2590, 2670, 2674, 2681, 2692, 2705, 2715, 2726, 2736, - 2745, 2754, 2757, 2758, 2765, 2769, 2774, 2795, 2812, 2826, - 2840, 2852, 2860, 2867, 2873, 2879, 2885, 2900, 2985, 2990, - 2994, 3001, 3008, 3016, 3023, 3031, 3039, 3053, 3070 + 2092, 2095, 2101, 2104, 2111, 2115, 2155, 2158, 2164, 2174, + 2178, 2183, 2185, 2190, 2195, 2204, 2214, 2225, 2229, 2238, + 2247, 2252, 2373, 2373, 2375, 2384, 2384, 2386, 2391, 2403, + 2407, 2412, 2416, 2420, 2424, 2428, 2432, 2436, 2440, 2444, + 2469, 2473, 2483, 2487, 2491, 2496, 2503, 2503, 2509, 2518, + 2522, 2531, 2540, 2549, 2553, 2560, 2564, 2568, 2573, 2583, + 2602, 2611, 2691, 2695, 2702, 2713, 2726, 2736, 2747, 2757, + 2766, 2775, 2778, 2779, 2786, 2790, 2795, 2816, 2833, 2847, + 2861, 2873, 2881, 2888, 2894, 2900, 2906, 2921, 3006, 3011, + 3015, 3022, 3029, 3037, 3044, 3052, 3060, 3074, 3091 }; #endif @@ -2536,259 +2536,259 @@ switch (yyn) { case 28: -#line 1132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_EQ; ; break;} case 29: -#line 1132 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_NE; ; break;} case 30: -#line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_SLT; ; break;} case 31: -#line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_SGT; ; break;} case 32: -#line 1134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_SLE; ; break;} case 33: -#line 1134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_SGE; ; break;} case 34: -#line 1135 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_ULT; ; break;} case 35: -#line 1135 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_UGT; ; break;} case 36: -#line 1136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_ULE; ; break;} case 37: -#line 1136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_UGE; ; break;} case 38: -#line 1140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_OEQ; ; break;} case 39: -#line 1140 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_ONE; ; break;} case 40: -#line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_OLT; ; break;} case 41: -#line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_OGT; ; break;} case 42: -#line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1142 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_OLE; ; break;} case 43: -#line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1142 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_OGE; ; break;} case 44: -#line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_ORD; ; break;} case 45: -#line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_UNO; ; break;} case 46: -#line 1144 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_UEQ; ; break;} case 47: -#line 1144 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_UNE; ; break;} case 48: -#line 1145 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1145 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_ULT; ; break;} case 49: -#line 1145 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1145 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_UGT; ; break;} case 50: -#line 1146 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_ULE; ; break;} case 51: -#line 1146 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_UGE; ; break;} case 52: -#line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1147 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_TRUE; ; break;} case 53: -#line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1148 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_FALSE; ; break;} case 64: -#line 1157 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1157 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; ; break;} case 65: -#line 1161 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1161 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = yyvsp[-1].StrVal; CHECK_FOR_ERROR ; break;} case 66: -#line 1165 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1165 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; CHECK_FOR_ERROR ; break;} case 70: -#line 1173 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1173 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; CHECK_FOR_ERROR ; break;} case 71: -#line 1178 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1178 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = yyvsp[-1].StrVal; CHECK_FOR_ERROR ; break;} case 72: -#line 1184 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1184 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::InternalLinkage; ; break;} case 73: -#line 1185 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1185 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::WeakLinkage; ; break;} case 74: -#line 1186 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1186 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::LinkOnceLinkage; ; break;} case 75: -#line 1187 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1187 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::AppendingLinkage; ; break;} case 76: -#line 1188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1188 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLExportLinkage; ; break;} case 77: -#line 1192 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1192 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLImportLinkage; ; break;} case 78: -#line 1193 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1193 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; break;} case 79: -#line 1194 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1194 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} case 80: -#line 1198 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1198 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::DefaultVisibility; ; break;} case 81: -#line 1199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1199 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::DefaultVisibility; ; break;} case 82: -#line 1200 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1200 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::HiddenVisibility; ; break;} case 83: -#line 1201 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1201 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::ProtectedVisibility; ; break;} case 84: -#line 1205 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1205 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} case 85: -#line 1206 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1206 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLImportLinkage; ; break;} case 86: -#line 1207 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1207 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; break;} case 87: -#line 1211 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1211 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} case 88: -#line 1212 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1212 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::InternalLinkage; ; break;} case 89: -#line 1213 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1213 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::LinkOnceLinkage; ; break;} case 90: -#line 1214 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1214 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::WeakLinkage; ; break;} case 91: -#line 1215 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1215 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLExportLinkage; ; break;} case 92: -#line 1219 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1219 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} case 93: -#line 1220 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1220 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::WeakLinkage; ; break;} case 94: -#line 1221 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1221 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::InternalLinkage; ; break;} case 95: -#line 1224 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1224 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::C; ; break;} case 96: -#line 1225 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1225 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::C; ; break;} case 97: -#line 1226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1226 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::Fast; ; break;} case 98: -#line 1227 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1227 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::Cold; ; break;} case 99: -#line 1228 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1228 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::X86_StdCall; ; break;} case 100: -#line 1229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1229 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::X86_FastCall; ; break;} case 101: -#line 1230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1230 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) GEN_ERROR("Calling conv too large"); @@ -2797,83 +2797,83 @@ ; break;} case 102: -#line 1237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1237 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ZExt; ; break;} case 103: -#line 1238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ZExt; ; break;} case 104: -#line 1239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1239 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::SExt; ; break;} case 105: -#line 1240 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1240 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::SExt; ; break;} case 106: -#line 1241 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1241 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::InReg; ; break;} case 107: -#line 1242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1242 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::StructRet; ; break;} case 108: -#line 1243 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1243 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::NoAlias; ; break;} case 109: -#line 1244 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1244 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ByVal; ; break;} case 110: -#line 1245 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1245 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::Nest; ; break;} case 111: -#line 1248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1248 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::None; ; break;} case 112: -#line 1249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1249 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs; ; break;} case 113: -#line 1254 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1254 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::NoReturn; ; break;} case 114: -#line 1255 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1255 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::NoUnwind; ; break;} case 115: -#line 1256 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1256 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ZExt; ; break;} case 116: -#line 1257 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1257 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::SExt; ; break;} case 117: -#line 1260 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1260 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::None; ; break;} case 118: -#line 1261 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1261 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs; ; break;} case 119: -#line 1268 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1268 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = 0; ; break;} case 120: -#line 1269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1269 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = yyvsp[0].UInt64Val; if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) @@ -2882,11 +2882,11 @@ ; break;} case 121: -#line 1275 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1275 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = 0; ; break;} case 122: -#line 1276 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1276 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = yyvsp[0].UInt64Val; if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) @@ -2895,7 +2895,7 @@ ; break;} case 123: -#line 1284 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1284 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i) if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\') @@ -2905,23 +2905,23 @@ ; break;} case 124: -#line 1292 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1292 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; ; break;} case 125: -#line 1293 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1293 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = yyvsp[0].StrVal; ; break;} case 126: -#line 1298 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1298 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" {; break;} case 127: -#line 1299 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1299 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" {; break;} case 128: -#line 1300 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1300 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; @@ -2929,7 +2929,7 @@ ; break;} case 129: -#line 1305 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1305 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) GEN_ERROR("Alignment must be a power of two"); @@ -2938,21 +2938,21 @@ ; break;} case 137: -#line 1321 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1321 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeVal = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR ; break;} case 138: -#line 1325 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1325 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); CHECK_FOR_ERROR ; break;} case 139: -#line 1329 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1329 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*yyvsp[-1].TypeVal == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -2962,7 +2962,7 @@ ; break;} case 140: -#line 1336 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1336 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal(yyvsp[0].ValIDVal); CHECK_FOR_ERROR @@ -2970,7 +2970,7 @@ ; break;} case 141: -#line 1341 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1341 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -2981,7 +2981,7 @@ ; break;} case 142: -#line 1349 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1349 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Params; ParamAttrsVector Attrs; @@ -3014,7 +3014,7 @@ ; break;} case 143: -#line 1379 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1379 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Params; ParamAttrsVector Attrs; @@ -3047,7 +3047,7 @@ ; break;} case 144: -#line 1410 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1410 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); delete yyvsp[-1].TypeVal; @@ -3055,7 +3055,7 @@ ; break;} case 145: -#line 1415 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1415 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Vector type? const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) @@ -3070,7 +3070,7 @@ ; break;} case 146: -#line 1427 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1427 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = yyvsp[-1].TypeList->begin(), @@ -3083,14 +3083,14 @@ ; break;} case 147: -#line 1437 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1437 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? yyval.TypeVal = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR ; break;} case 148: -#line 1441 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1441 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; for (std::list::iterator I = yyvsp[-2].TypeList->begin(), @@ -3103,21 +3103,21 @@ ; break;} case 149: -#line 1451 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1451 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? yyval.TypeVal = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR ; break;} case 150: -#line 1458 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1458 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal; yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs; ; break;} case 151: -#line 1465 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1465 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -3127,13 +3127,13 @@ ; break;} case 152: -#line 1472 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1472 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeVal = new PATypeHolder(Type::VoidTy); ; break;} case 153: -#line 1477 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1477 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList = new TypeWithAttrsList(); yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs); @@ -3141,14 +3141,14 @@ ; break;} case 154: -#line 1482 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1482 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs); CHECK_FOR_ERROR ; break;} case 156: -#line 1490 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1490 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -3158,7 +3158,7 @@ ; break;} case 157: -#line 1497 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1497 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -3168,14 +3168,14 @@ ; break;} case 158: -#line 1504 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1504 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList = new TypeWithAttrsList(); CHECK_FOR_ERROR ; break;} case 159: -#line 1512 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1512 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeList = new std::list(); yyval.TypeList->push_back(*yyvsp[0].TypeVal); @@ -3184,7 +3184,7 @@ ; break;} case 160: -#line 1518 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1518 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; @@ -3192,7 +3192,7 @@ ; break;} case 161: -#line 1530 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1530 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -3223,7 +3223,7 @@ ; break;} case 162: -#line 1558 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1558 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -3242,7 +3242,7 @@ ; break;} case 163: -#line 1574 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1574 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -3272,7 +3272,7 @@ ; break;} case 164: -#line 1601 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1601 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -3303,7 +3303,7 @@ ; break;} case 165: -#line 1629 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1629 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast(yyvsp[-3].TypeVal->get()); if (STy == 0) @@ -3332,7 +3332,7 @@ ; break;} case 166: -#line 1655 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1655 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -3355,7 +3355,7 @@ ; break;} case 167: -#line 1675 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1675 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast(yyvsp[-5].TypeVal->get()); if (STy == 0) @@ -3384,7 +3384,7 @@ ; break;} case 168: -#line 1701 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1701 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); @@ -3407,7 +3407,7 @@ ; break;} case 169: -#line 1721 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1721 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3422,7 +3422,7 @@ ; break;} case 170: -#line 1733 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1733 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3432,7 +3432,7 @@ ; break;} case 171: -#line 1740 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1740 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3501,7 +3501,7 @@ ; break;} case 172: -#line 1806 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1806 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3514,7 +3514,7 @@ ; break;} case 173: -#line 1816 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1816 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3527,7 +3527,7 @@ ; break;} case 174: -#line 1826 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1826 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) GEN_ERROR("Constant value doesn't fit in type"); @@ -3536,7 +3536,7 @@ ; break;} case 175: -#line 1832 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1832 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast(yyvsp[-1].PrimType)->getBitWidth(); if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) { @@ -3549,7 +3549,7 @@ ; break;} case 176: -#line 1842 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1842 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) GEN_ERROR("Constant value doesn't fit in type"); @@ -3558,7 +3558,7 @@ ; break;} case 177: -#line 1848 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1848 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast(yyvsp[-1].PrimType)->getBitWidth(); if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) { @@ -3571,7 +3571,7 @@ ; break;} case 178: -#line 1858 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1858 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); yyval.ConstVal = ConstantInt::getTrue(); @@ -3579,7 +3579,7 @@ ; break;} case 179: -#line 1863 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1863 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); yyval.ConstVal = ConstantInt::getFalse(); @@ -3587,7 +3587,7 @@ ; break;} case 180: -#line 1868 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1868 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Float & Double constants if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal)) GEN_ERROR("Floating point constant invalid for type"); @@ -3601,7 +3601,7 @@ ; break;} case 181: -#line 1881 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1881 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3616,7 +3616,7 @@ ; break;} case 182: -#line 1893 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1893 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa(yyvsp[-2].ConstVal->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -3641,7 +3641,7 @@ ; break;} case 183: -#line 1915 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1915 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -3652,7 +3652,7 @@ ; break;} case 184: -#line 1923 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1923 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("Binary operator types must match"); @@ -3661,7 +3661,7 @@ ; break;} case 185: -#line 1929 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1929 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("Logical operator types must match"); @@ -3675,7 +3675,7 @@ ; break;} case 186: -#line 1940 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1940 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("icmp operand types must match"); @@ -3683,7 +3683,7 @@ ; break;} case 187: -#line 1945 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1945 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("fcmp operand types must match"); @@ -3691,7 +3691,7 @@ ; break;} case 188: -#line 1950 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1950 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid extractelement operands"); @@ -3700,7 +3700,7 @@ ; break;} case 189: -#line 1956 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1956 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid insertelement operands"); @@ -3709,7 +3709,7 @@ ; break;} case 190: -#line 1962 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1962 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid shufflevector operands"); @@ -3718,14 +3718,14 @@ ; break;} case 191: -#line 1971 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1971 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); CHECK_FOR_ERROR ; break;} case 192: -#line 1975 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1975 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ConstVector = new std::vector(); yyval.ConstVector->push_back(yyvsp[0].ConstVal); @@ -3733,23 +3733,23 @@ ; break;} case 193: -#line 1983 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1983 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; ; break;} case 194: -#line 1983 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1983 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; ; break;} case 195: -#line 1986 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1986 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; ; break;} case 196: -#line 1986 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1986 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; ; break;} case 197: -#line 1989 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1989 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const Type* VTy = yyvsp[-1].TypeVal->get(); Value *V = getVal(VTy, yyvsp[0].ValIDVal); @@ -3764,7 +3764,7 @@ ; break;} case 198: -#line 2001 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2001 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { Constant *Val = yyvsp[-3].ConstVal; const Type *DestTy = yyvsp[-1].TypeVal->get(); @@ -3779,7 +3779,7 @@ ; break;} case 199: -#line 2022 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2022 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ModuleVal = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -3787,7 +3787,7 @@ ; break;} case 200: -#line 2027 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2027 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ModuleVal = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -3795,34 +3795,34 @@ ; break;} case 203: -#line 2040 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2040 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ; break;} case 204: -#line 2040 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2040 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR ; break;} case 205: -#line 2044 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ; break;} case 206: -#line 2044 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} case 207: -#line 2047 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2047 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} case 208: -#line 2050 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2050 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -3849,7 +3849,7 @@ ; break;} case 209: -#line 2074 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2074 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType); @@ -3863,7 +3863,7 @@ ; break;} case 210: -#line 2085 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2085 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ if (yyvsp[0].ConstVal == 0) @@ -3874,13 +3874,13 @@ ; break;} case 211: -#line 2092 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2092 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ; break;} case 212: -#line 2096 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2096 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[0].ConstVal == 0) GEN_ERROR("Global value initializer is not a constant"); @@ -3889,13 +3889,13 @@ ; break;} case 213: -#line 2101 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2101 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ; break;} case 214: -#line 2105 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2105 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -3905,14 +3905,14 @@ ; break;} case 215: -#line 2111 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2111 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ; break;} case 216: -#line 2115 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2115 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { std::string Name; if (yyvsp[-4].StrVal) { @@ -3930,23 +3930,44 @@ CurModule.CurrentModule); GA->setVisibility(yyvsp[-3].Visibility); InsertValue(GA, CurModule.Values); + + + // If there was a forward reference of this alias, resolve it now. + + ValID ID; + if (!Name.empty()) + ID = ValID::createGlobalName(Name); + else + ID = ValID::createGlobalID(CurModule.Values.size()-1); + + if (GlobalValue *FWGV = + CurModule.GetForwardRefForGlobal(GA->getType(), ID)) { + // Replace uses of the fwdref with the actual alias. + FWGV->replaceAllUsesWith(GA); + if (GlobalVariable *GV = dyn_cast(FWGV)) + GV->eraseFromParent(); + else + cast(FWGV)->eraseFromParent(); + } + ID.destroy(); + CHECK_FOR_ERROR ; break;} case 217: -#line 2134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2155 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} case 218: -#line 2137 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2158 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} case 219: -#line 2143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2164 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) @@ -3958,21 +3979,21 @@ ; break;} case 220: -#line 2153 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2174 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; ; break;} case 221: -#line 2157 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2178 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; ; break;} case 223: -#line 2164 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2185 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; @@ -3980,7 +4001,7 @@ ; break;} case 224: -#line 2169 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2190 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; @@ -3988,13 +4009,13 @@ ; break;} case 225: -#line 2174 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2195 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} case 226: -#line 2183 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2204 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -4007,7 +4028,7 @@ ; break;} case 227: -#line 2193 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2214 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -4020,14 +4041,14 @@ ; break;} case 228: -#line 2204 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2225 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = yyvsp[0].ArgList; CHECK_FOR_ERROR ; break;} case 229: -#line 2208 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2229 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = yyvsp[-2].ArgList; struct ArgListEntry E; @@ -4039,7 +4060,7 @@ ; break;} case 230: -#line 2217 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = new ArgListType; struct ArgListEntry E; @@ -4051,14 +4072,14 @@ ; break;} case 231: -#line 2226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2247 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = 0; CHECK_FOR_ERROR ; break;} case 232: -#line 2232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2253 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { std::string FunctionName(*yyvsp[-6].StrVal); delete yyvsp[-6].StrVal; // Free strdup'd memory! @@ -4180,7 +4201,7 @@ ; break;} case 235: -#line 2354 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2375 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FunctionVal = CurFun.CurrentFunction; @@ -4191,14 +4212,14 @@ ; break;} case 238: -#line 2365 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2386 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR ; break;} case 239: -#line 2370 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2391 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage); CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility); @@ -4208,77 +4229,77 @@ ; break;} case 240: -#line 2382 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2403 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; CHECK_FOR_ERROR ; break;} case 241: -#line 2386 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2407 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; CHECK_FOR_ERROR ; break;} case 242: -#line 2391 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2412 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); CHECK_FOR_ERROR ; break;} case 243: -#line 2395 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2416 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); CHECK_FOR_ERROR ; break;} case 244: -#line 2399 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2420 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); CHECK_FOR_ERROR ; break;} case 245: -#line 2403 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2424 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR ; break;} case 246: -#line 2407 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2428 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR ; break;} case 247: -#line 2411 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2432 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createNull(); CHECK_FOR_ERROR ; break;} case 248: -#line 2415 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2436 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createUndef(); CHECK_FOR_ERROR ; break;} case 249: -#line 2419 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2440 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. yyval.ValIDVal = ValID::createZeroInit(); CHECK_FOR_ERROR ; break;} case 250: -#line 2423 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2444 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); int NumElements = yyvsp[-1].ConstVector->size(); @@ -4306,14 +4327,14 @@ ; break;} case 251: -#line 2448 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2469 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); CHECK_FOR_ERROR ; break;} case 252: -#line 2452 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2473 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal); delete yyvsp[-2].StrVal; @@ -4322,21 +4343,21 @@ ; break;} case 253: -#line 2462 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2483 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal); CHECK_FOR_ERROR ; break;} case 254: -#line 2466 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2487 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal); CHECK_FOR_ERROR ; break;} case 255: -#line 2470 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2491 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; @@ -4344,7 +4365,7 @@ ; break;} case 256: -#line 2475 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2496 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; @@ -4352,7 +4373,7 @@ ; break;} case 259: -#line 2488 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2509 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -4362,21 +4383,21 @@ ; break;} case 260: -#line 2497 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2518 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR ; break;} case 261: -#line 2501 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2522 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR ; break;} case 262: -#line 2510 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2531 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); CHECK_FOR_ERROR @@ -4387,7 +4408,7 @@ ; break;} case 263: -#line 2519 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2540 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast(yyvsp[0].InstVal)) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -4399,14 +4420,14 @@ ; break;} case 264: -#line 2528 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2549 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR ; break;} case 265: -#line 2532 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2553 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal)); delete yyvsp[0].StrVal; @@ -4415,21 +4436,21 @@ ; break;} case 266: -#line 2539 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2560 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); CHECK_FOR_ERROR ; break;} case 267: -#line 2543 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2564 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... yyval.TermInstVal = new ReturnInst(); CHECK_FOR_ERROR ; break;} case 268: -#line 2547 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2568 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); CHECK_FOR_ERROR @@ -4437,7 +4458,7 @@ ; break;} case 269: -#line 2552 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2573 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { assert(cast(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?"); BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal); @@ -4450,7 +4471,7 @@ ; break;} case 270: -#line 2562 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2583 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal); CHECK_FOR_ERROR @@ -4472,7 +4493,7 @@ ; break;} case 271: -#line 2581 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2602 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal); CHECK_FOR_ERROR @@ -4484,7 +4505,7 @@ ; break;} case 272: -#line 2591 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2612 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -4566,21 +4587,21 @@ ; break;} case 273: -#line 2670 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2691 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TermInstVal = new UnwindInst(); CHECK_FOR_ERROR ; break;} case 274: -#line 2674 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2695 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TermInstVal = new UnreachableInst(); CHECK_FOR_ERROR ; break;} case 275: -#line 2681 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2702 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.JumpTable = yyvsp[-5].JumpTable; Constant *V = cast(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); @@ -4594,7 +4615,7 @@ ; break;} case 276: -#line 2692 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2713 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.JumpTable = new std::vector >(); Constant *V = cast(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); @@ -4609,7 +4630,7 @@ ; break;} case 277: -#line 2705 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2726 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal); @@ -4620,7 +4641,7 @@ ; break;} case 278: -#line 2715 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2736 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription()); @@ -4634,7 +4655,7 @@ ; break;} case 279: -#line 2726 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2747 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.PHIList = yyvsp[-6].PHIList; Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal); @@ -4645,7 +4666,7 @@ ; break;} case 280: -#line 2736 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2757 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -4657,7 +4678,7 @@ ; break;} case 281: -#line 2745 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2766 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -4669,15 +4690,15 @@ ; break;} case 282: -#line 2754 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2775 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValueRefList = new ValueRefList(); ; break;} case 283: -#line 2757 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2778 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValueList = new std::vector(); ; break;} case 284: -#line 2758 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2779 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValueList = yyvsp[-2].ValueList; yyval.ValueList->push_back(yyvsp[0].ValueVal); @@ -4685,21 +4706,21 @@ ; break;} case 285: -#line 2765 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2786 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; CHECK_FOR_ERROR ; break;} case 286: -#line 2769 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2790 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; CHECK_FOR_ERROR ; break;} case 287: -#line 2774 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2795 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4723,7 +4744,7 @@ ; break;} case 288: -#line 2795 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2816 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4743,7 +4764,7 @@ ; break;} case 289: -#line 2812 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2833 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4760,7 +4781,7 @@ ; break;} case 290: -#line 2826 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2847 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4777,7 +4798,7 @@ ; break;} case 291: -#line 2840 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2861 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -4792,7 +4813,7 @@ ; break;} case 292: -#line 2852 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2873 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty) GEN_ERROR("select condition must be boolean"); @@ -4803,7 +4824,7 @@ ; break;} case 293: -#line 2860 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2881 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -4813,7 +4834,7 @@ ; break;} case 294: -#line 2867 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2888 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid extractelement operands"); @@ -4822,7 +4843,7 @@ ; break;} case 295: -#line 2873 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2894 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid insertelement operands"); @@ -4831,7 +4852,7 @@ ; break;} case 296: -#line 2879 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2900 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid shufflevector operands"); @@ -4840,7 +4861,7 @@ ; break;} case 297: -#line 2885 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2906 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = yyvsp[0].PHIList->front().first->getType(); if (!Ty->isFirstClassType()) @@ -4858,7 +4879,7 @@ ; break;} case 298: -#line 2901 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2922 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -4945,28 +4966,28 @@ ; break;} case 299: -#line 2985 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3006 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.InstVal = yyvsp[0].InstVal; CHECK_FOR_ERROR ; break;} case 300: -#line 2990 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3011 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; CHECK_FOR_ERROR ; break;} case 301: -#line 2994 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3015 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; CHECK_FOR_ERROR ; break;} case 302: -#line 3001 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3022 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -4976,7 +4997,7 @@ ; break;} case 303: -#line 3008 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3029 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); @@ -4987,7 +5008,7 @@ ; break;} case 304: -#line 3016 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3037 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -4997,7 +5018,7 @@ ; break;} case 305: -#line 3023 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); @@ -5008,7 +5029,7 @@ ; break;} case 306: -#line 3031 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3052 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa(yyvsp[0].ValueVal->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -5018,7 +5039,7 @@ ; break;} case 307: -#line 3039 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3060 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -5035,7 +5056,7 @@ ; break;} case 308: -#line 3053 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3074 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -5055,7 +5076,7 @@ ; break;} case 309: -#line 3070 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3091 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -5294,7 +5315,7 @@ } return 1; } -#line 3087 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3108 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=41816&r1=41815&r2=41816&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Mon Sep 10 18:24:14 2007 @@ -2129,6 +2129,27 @@ CurModule.CurrentModule); GA->setVisibility($2); InsertValue(GA, CurModule.Values); + + + // If there was a forward reference of this alias, resolve it now. + + ValID ID; + if (!Name.empty()) + ID = ValID::createGlobalName(Name); + else + ID = ValID::createGlobalID(CurModule.Values.size()-1); + + if (GlobalValue *FWGV = + CurModule.GetForwardRefForGlobal(GA->getType(), ID)) { + // Replace uses of the fwdref with the actual alias. + FWGV->replaceAllUsesWith(GA); + if (GlobalVariable *GV = dyn_cast(FWGV)) + GV->eraseFromParent(); + else + cast(FWGV)->eraseFromParent(); + } + ID.destroy(); + CHECK_FOR_ERROR } | TARGET TargetDefinition { From dpatel at apple.com Mon Sep 10 18:34:06 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 10 Sep 2007 23:34:06 -0000 Subject: [llvm-commits] [llvm] r41817 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709102334.l8ANY6AP024670@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 10 18:34:06 2007 New Revision: 41817 URL: http://llvm.org/viewvc/llvm-project?rev=41817&view=rev Log: Swap exit condition operands if it works. Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=41817&r1=41816&r2=41817&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Sep 10 18:34:06 2007 @@ -328,14 +328,24 @@ if (!CI) return; - // FIXME + // FIXME + if (CI->getPredicate() == ICmpInst::ICMP_EQ + || CI->getPredicate() == ICmpInst::ICMP_NE) + return; + if (CI->getPredicate() == ICmpInst::ICMP_SGT || CI->getPredicate() == ICmpInst::ICMP_UGT || CI->getPredicate() == ICmpInst::ICMP_SGE - || CI->getPredicate() == ICmpInst::ICMP_UGE - || CI->getPredicate() == ICmpInst::ICMP_EQ - || CI->getPredicate() == ICmpInst::ICMP_NE) - return; + || CI->getPredicate() == ICmpInst::ICMP_UGE) { + + BasicBlock *FirstSuccessor = BR->getSuccessor(0); + // splitLoop() is expecting LT/LE as exit condition predicate. + // Swap operands here if possible to meet this requirement. + if (!L->contains(FirstSuccessor)) + CI->swapOperands(); + else + return; + } ExitCondition = CI; From sabre at nondot.org Mon Sep 10 18:42:42 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Sep 2007 23:42:42 -0000 Subject: [llvm-commits] [llvm] r41818 - in /llvm/trunk: lib/VMCore/ConstantFold.cpp test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll Message-ID: <200709102342.l8ANgg0i024879@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 18:42:42 2007 New Revision: 41818 URL: http://llvm.org/viewvc/llvm-project?rev=41818&view=rev Log: Fix a buggy constant folding transformation when handling aliases. Added: llvm/trunk/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=41818&r1=41817&r2=41818&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Mon Sep 10 18:42:42 2007 @@ -23,6 +23,7 @@ #include "llvm/Instructions.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" +#include "llvm/GlobalAlias.h" #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/GetElementPtrTypeIterator.h" @@ -951,12 +952,14 @@ // Now we know that the RHS is a GlobalValue or simple constant, // which (since the types must match) means that it's a ConstantPointerNull. if (const GlobalValue *CPR2 = dyn_cast(V2)) { - if (!CPR1->hasExternalWeakLinkage() || !CPR2->hasExternalWeakLinkage()) - return ICmpInst::ICMP_NE; + // Don't try to decide equality of aliases. + if (!isa(CPR1) && !isa(CPR2)) + if (!CPR1->hasExternalWeakLinkage() || !CPR2->hasExternalWeakLinkage()) + return ICmpInst::ICMP_NE; } else { - // GlobalVals can never be null. assert(isa(V2) && "Canonicalization guarantee!"); - if (!CPR1->hasExternalWeakLinkage()) + // GlobalVals can never be null. Don't try to evaluate aliases. + if (!CPR1->hasExternalWeakLinkage() && !isa(CPR1)) return ICmpInst::ICMP_NE; } } else { Added: llvm/trunk/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll?rev=41818&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2007-09-10-AliasConstFold.ll Mon Sep 10 18:42:42 2007 @@ -0,0 +1,13 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep icmp +; PR1646 + + at __gthrw_pthread_cancel = alias weak i32 (i32)* @pthread_cancel ; [#uses=1] + at __gthread_active_ptr.5335 = internal constant i8* bitcast (i32 (i32)* @__gthrw_pthread_cancel to i8*) ; [#uses=1] +declare extern_weak i32 @pthread_cancel(i32) + +define i1 @__gthread_active_p() { +entry: + %tmp1 = load i8** @__gthread_active_ptr.5335, align 4 ; [#uses=1] + %tmp2 = icmp ne i8* %tmp1, null ; [#uses=1] + ret i1 %tmp2 +} From sabre at nondot.org Mon Sep 10 18:46:29 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Sep 2007 23:46:29 -0000 Subject: [llvm-commits] [llvm] r41819 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200709102346.l8ANkTvq024996@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 18:46:29 2007 New Revision: 41819 URL: http://llvm.org/viewvc/llvm-project?rev=41819&view=rev Log: remove some dead code, this is handled by constant folding. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=41819&r1=41818&r2=41819&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Sep 10 18:46:29 2007 @@ -4691,14 +4691,6 @@ if (isa(Op1)) // X icmp undef -> undef return ReplaceInstUsesWith(I, UndefValue::get(Type::Int1Ty)); - // icmp of GlobalValues can never equal each other as long as they aren't - // external weak linkage type. - if (GlobalValue *GV0 = dyn_cast(Op0)) - if (GlobalValue *GV1 = dyn_cast(Op1)) - if (!GV0->hasExternalWeakLinkage() || !GV1->hasExternalWeakLinkage()) - return ReplaceInstUsesWith(I, ConstantInt::get(Type::Int1Ty, - !isTrueWhenEqual(I))); - // icmp , - Global/Stack value // addresses never equal each other! We already know that Op0 != Op1. if ((isa(Op0) || isa(Op0) || @@ -6399,6 +6391,7 @@ // of casts in the input. if (I->getOpcode() == CastOpc) return true; + break; default: // TODO: Can handle more cases here. From sabre at nondot.org Mon Sep 10 18:51:41 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Sep 2007 23:51:41 -0000 Subject: [llvm-commits] [llvm] r41820 - /llvm/trunk/test/Transforms/TailCallElim/return-undef.ll Message-ID: <200709102351.l8ANpf8e025176@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 18:51:41 2007 New Revision: 41820 URL: http://llvm.org/viewvc/llvm-project?rev=41820&view=rev Log: remove obsolete testcase Removed: llvm/trunk/test/Transforms/TailCallElim/return-undef.ll Removed: llvm/trunk/test/Transforms/TailCallElim/return-undef.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/TailCallElim/return-undef.ll?rev=41819&view=auto ============================================================================== --- llvm/trunk/test/Transforms/TailCallElim/return-undef.ll (original) +++ llvm/trunk/test/Transforms/TailCallElim/return-undef.ll (removed) @@ -1,9 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -tailcallelim | llvm-dis > %t -; RUN: grep sub %t -; RUN: not grep call %t - -int %test(int %X) { - %Y = sub int %X, 1 - %Z = call int %test(int %Y) - ret int undef -} From clattner at apple.com Mon Sep 10 18:53:13 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 10 Sep 2007 16:53:13 -0700 Subject: [llvm-commits] [llvm] r41804 - in /llvm/trunk: lib/Transforms/Scalar/TailRecursionElimination.cpp test/Transforms/TailCallElim/inf-recursion.ll In-Reply-To: <8EEC2A18-1411-4095-AA07-81E1A0439783@apple.com> References: <200709102058.l8AKwtoN019258@zion.cs.uiuc.edu> <8EEC2A18-1411-4095-AA07-81E1A0439783@apple.com> Message-ID: On Sep 10, 2007, at 3:53 PM, Dale Johannesen wrote: > This testcase is missing an llvm-dis; I've fixed it. Thanks, sorry about that :( > Also, this > patch breaks Transforms/TailCallElim/return-undef.ll, > which is testing that this transformation does happen. Ok, I just removed it. It wasn't a very useful testcase anyway. :) > Can't we > detect whether the call is going to be lowered > to inline code and disable the transformation only in that case? To be honest, I'm not really very happy with this approach (disabling tail recursion from the entry block), it's quite a hack. However, I can't think of a good way to handle this: one possibility would be to add a new "is a builtin" attribute, and attach it to the call, but that is gross in its own way. -Chris From dpatel at apple.com Mon Sep 10 18:57:58 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 10 Sep 2007 23:57:58 -0000 Subject: [llvm-commits] [llvm] r41821 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709102357.l8ANvwK7025347@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 10 18:57:58 2007 New Revision: 41821 URL: http://llvm.org/viewvc/llvm-project?rev=41821&view=rev Log: Check all terminators inside loop. Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=41821&r1=41820&r2=41821&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Sep 10 18:57:58 2007 @@ -379,7 +379,6 @@ SplitInfo SD; // Check all basic block's terminators. - for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); I != E; ++I) { BasicBlock *BB = *I; @@ -395,10 +394,10 @@ ICmpInst *CI = dyn_cast(BR->getCondition()); if (!CI || CI == ExitCondition) - return; + continue; if (CI->getPredicate() == ICmpInst::ICMP_NE) - return; + continue; // If split condition predicate is GT or GE then first execute // false branch of split condition. @@ -508,7 +507,7 @@ // SplitCondition : icmp eq i32 IndVar, SplitValue // into // c1 = icmp uge i32 SplitValue, StartValue - // c2 = icmp ult i32 vSplitValue, ExitValue + // c2 = icmp ult i32 SplitValue, ExitValue // and i32 c1, c2 bool SignedPredicate = ExitCondition->isSignedPredicate(); Instruction *C1 = new ICmpInst(SignedPredicate ? From dalej at apple.com Mon Sep 10 19:08:49 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 10 Sep 2007 17:08:49 -0700 Subject: [llvm-commits] [llvm] r41804 - in /llvm/trunk: lib/Transforms/Scalar/TailRecursionElimination.cpp test/Transforms/TailCallElim/inf-recursion.ll In-Reply-To: References: <200709102058.l8AKwtoN019258@zion.cs.uiuc.edu> <8EEC2A18-1411-4095-AA07-81E1A0439783@apple.com> Message-ID: <59D114DA-BCC5-46D6-A26C-28A01D03AE7C@apple.com> On Sep 10, 2007, at 4:53 PM, Chris Lattner wrote: >> Can't we >> detect whether the call is going to be lowered >> to inline code and disable the transformation only in that case? > > To be honest, I'm not really very happy with this approach (disabling > tail recursion from the entry block), it's quite a hack. However, I > can't think of a good way to handle this: one possibility would be to > add a new "is a builtin" attribute, and attach it to the call, but > that is gross in its own way. > > -Chris Well, it is, but the optimizers really should know which are the builtins; some of them have special semantics. Perhaps builtins should not be marked as tail calls? From dpatel at apple.com Mon Sep 10 19:12:57 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 11 Sep 2007 00:12:57 -0000 Subject: [llvm-commits] [llvm] r41822 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709110012.l8B0CvDc026061@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 10 19:12:56 2007 New Revision: 41822 URL: http://llvm.org/viewvc/llvm-project?rev=41822&view=rev Log: Split condition does not have to be ICmpInst in all cases. Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=41822&r1=41821&r2=41822&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Sep 10 19:12:56 2007 @@ -64,8 +64,8 @@ // Induction variable's range is split at this value. Value *SplitValue; - // This compare instruction compares IndVar against SplitValue. - ICmpInst *SplitCondition; + // This instruction compares IndVar against SplitValue. + Instruction *SplitCondition; // True if after loop index split, first loop will execute split condition's // true branch. @@ -221,7 +221,8 @@ for (SmallVector::iterator SI = SplitData.begin(), E = SplitData.end(); SI != E;) { SplitInfo &SD = *SI; - if (SD.SplitCondition->getPredicate() == ICmpInst::ICMP_EQ) { + ICmpInst *CI = dyn_cast(SD.SplitCondition); + if (CI && CI->getPredicate() == ICmpInst::ICMP_EQ) { Changed = processOneIterationLoop(SD); if (Changed) { ++NumIndexSplit; @@ -790,7 +791,8 @@ /// based on split value. void LoopIndexSplit::calculateLoopBounds(SplitInfo &SD) { - ICmpInst::Predicate SP = SD.SplitCondition->getPredicate(); + ICmpInst *SC = cast(SD.SplitCondition); + ICmpInst::Predicate SP = SC->getPredicate(); const Type *Ty = SD.SplitValue->getType(); bool Sign = ExitCondition->isSignedPredicate(); BasicBlock *Preheader = L->getLoopPreheader(); @@ -1140,7 +1142,8 @@ ICmpInst *B_SplitCondition = cast(ValueMap[SD.SplitCondition]); moveExitCondition(A_SplitCondBlock, A_ActiveBranch, A_ExitBlock, ExitCondition, - SD.SplitCondition, IndVar, IndVarIncrement, ALoop); + cast(SD.SplitCondition), IndVar, IndVarIncrement, + ALoop); moveExitCondition(B_SplitCondBlock, B_ActiveBranch, B_ExitBlock, B_ExitCondition, B_SplitCondition, B_IndVar, B_IndVarIncrement, BLoop); From dpatel at apple.com Mon Sep 10 19:23:57 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 11 Sep 2007 00:23:57 -0000 Subject: [llvm-commits] [llvm] r41823 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709110023.l8B0NvY4026357@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 10 19:23:56 2007 New Revision: 41823 URL: http://llvm.org/viewvc/llvm-project?rev=41823&view=rev Log: Clear split info object. Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=41823&r1=41822&r2=41823&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Sep 10 19:23:56 2007 @@ -382,6 +382,7 @@ // Check all basic block's terminators. for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); I != E; ++I) { + SD.clear(); BasicBlock *BB = *I; // If this basic block does not terminate in a conditional branch From sabre at nondot.org Mon Sep 10 19:39:43 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 11 Sep 2007 00:39:43 -0000 Subject: [llvm-commits] [llvm] r41824 - /llvm/trunk/test/C++Frontend/2007-09-10-RecursiveTypeResolution.cpp Message-ID: <200709110039.l8B0dhw5026771@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 19:39:43 2007 New Revision: 41824 URL: http://llvm.org/viewvc/llvm-project?rev=41824&view=rev Log: Testcase for PR1634 Added: llvm/trunk/test/C++Frontend/2007-09-10-RecursiveTypeResolution.cpp Added: llvm/trunk/test/C++Frontend/2007-09-10-RecursiveTypeResolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/C%2B%2BFrontend/2007-09-10-RecursiveTypeResolution.cpp?rev=41824&view=auto ============================================================================== --- llvm/trunk/test/C++Frontend/2007-09-10-RecursiveTypeResolution.cpp (added) +++ llvm/trunk/test/C++Frontend/2007-09-10-RecursiveTypeResolution.cpp Mon Sep 10 19:39:43 2007 @@ -0,0 +1,88 @@ +// RUN: %llvmgxx -c -emit-llvm %s -o - +// PR1634 + +namespace Manta +{ + class CallbackHandle + { + protected:virtual ~ CallbackHandle (void) + { + } + }; +template < typename Data1 > class CallbackBase_1Data:public CallbackHandle + { + }; +} + +namespace __gnu_cxx +{ + template < typename _Iterator, typename _Container > + class __normal_iterator + { + _Iterator _M_current; + }; +} + +namespace std +{ + template < typename _Tp > struct allocator + { + typedef _Tp *pointer; + }; + template < typename _InputIterator, + typename _Tp > inline void find (_InputIterator __last, + const _Tp & __val) + { + }; +} + +namespace Manta +{ + template < typename _Tp, typename _Alloc> struct _Vector_base + { + struct _Vector_impl + { + _Tp *_M_start; + }; + public: + _Vector_impl _M_impl; + }; + template < typename _Tp, typename _Alloc = std::allocator < _Tp > > + class vector:protected _Vector_base < _Tp,_Alloc > + { + public: + typedef __gnu_cxx::__normal_iterator < typename _Alloc::pointer, + vector < _Tp, _Alloc > > iterator; + iterator end () + { + } + }; + class MantaInterface + { + }; + class RTRT + { + virtual CallbackHandle *registerTerminationCallback (CallbackBase_1Data < + MantaInterface * >*); + virtual void unregisterCallback (CallbackHandle *); + typedef vector < CallbackBase_1Data < int >*>PRCallbackMapType; + PRCallbackMapType parallelPreRenderCallbacks; + }; +} +using namespace Manta; +CallbackHandle * +RTRT::registerTerminationCallback (CallbackBase_1Data < MantaInterface * >*cb) +{ + return cb; +} + +void +RTRT::unregisterCallback (CallbackHandle * callback) +{ + { + typedef CallbackBase_1Data < int > callback_t; + callback_t *cb = static_cast < callback_t * >(callback); + find (parallelPreRenderCallbacks.end (), cb); + } +} + From sabre at nondot.org Mon Sep 10 19:41:35 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 11 Sep 2007 00:41:35 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41825 - /llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Message-ID: <200709110041.l8B0fZsa026839@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 19:41:34 2007 New Revision: 41825 URL: http://llvm.org/viewvc/llvm-project?rev=41825&view=rev Log: When converting a tree function type to an llvm function type, make sure to keep the argument types as PATypeHolders: conversion of later argument types can cause earlier argument types to be resolved, and patypeholders are required to prevent dangling pointers. This fixes PR1634 and test/C++Frontend/2007-09-10-RecursiveTypeResolution.cpp Thanks to Nicholas and Anton for reducing the testcase! Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=41825&r1=41824&r2=41825&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Mon Sep 10 19:41:34 2007 @@ -207,6 +207,19 @@ // opaque*, and remember that they did this in PointersToReresolve. +/// GetFunctionType - This is just a helper like FunctionType::get but that +/// takes PATypeHolders. +static FunctionType *GetFunctionType(const PATypeHolder &Res, + std::vector &ArgTys, + bool isVarArg, + const ParamAttrsList *Attrs) { + std::vector ArgTysP; + ArgTysP.reserve(ArgTys.size()); + for (unsigned i = 0, e = ArgTys.size(); i != e; ++i) + ArgTysP.push_back(ArgTys[0]); + + return FunctionType::get(Res, ArgTysP, isVarArg, Attrs); +} //===----------------------------------------------------------------------===// // Type Conversion Utilities @@ -845,13 +858,13 @@ namespace { class FunctionTypeConversion : public DefaultABIClient { - const Type *&RetTy; - std::vector &ArgTypes; + PATypeHolder &RetTy; + std::vector &ArgTypes; unsigned &CallingConv; bool isStructRet; bool KNRPromotion; public: - FunctionTypeConversion(const Type *&retty, std::vector &AT, + FunctionTypeConversion(PATypeHolder &retty, std::vector &AT, unsigned &CC, bool KNR) : RetTy(retty), ArgTypes(AT), CallingConv(CC), KNRPromotion(KNR) { CallingConv = CallingConv::C; @@ -903,6 +916,7 @@ }; } + /// ConvertParamListToLLVMSignature - This method is used to build the argument /// type list for K&R prototyped functions. In this case, we have to figure out /// the type list (to build a FunctionType) from the actual DECL_ARGUMENTS list @@ -912,8 +926,8 @@ const FunctionType *TypeConverter:: ConvertArgListToFnType(tree ReturnType, tree Args, tree static_chain, unsigned &CallingConv) { - std::vector ArgTys; - const Type *RetTy; + std::vector ArgTys; + PATypeHolder RetTy(Type::VoidTy); FunctionTypeConversion Client(RetTy, ArgTys, CallingConv, true /*K&R*/); TheLLVMABI ABIConverter(Client); @@ -927,15 +941,15 @@ for (; Args && TREE_TYPE(Args) != void_type_node; Args = TREE_CHAIN(Args)) ABIConverter.HandleArgument(TREE_TYPE(Args)); - return FunctionType::get(RetTy, ArgTys, false, 0); + return GetFunctionType(RetTy, ArgTys, false, 0); } const FunctionType *TypeConverter::ConvertFunctionType(tree type, tree decl, tree static_chain, unsigned &CallingConv) { - const Type *RetTy = 0; - std::vector ArgTypes; + PATypeHolder RetTy = Type::VoidTy; + std::vector ArgTypes; bool isVarArg = false; FunctionTypeConversion Client(RetTy, ArgTypes, CallingConv, false/*not K&R*/); TheLLVMABI ABIConverter(Client); @@ -950,7 +964,7 @@ // Compute whether the result needs to be zext or sext'd, adding an attribute // if so. ParamAttrsVector Attrs; - if (isa(RetTy)) { + if (isa(RetTy.get())) { uint16_t RAttributes = ParamAttr::None; tree ResultTy = TREE_TYPE(type); if (TREE_INT_CST_LOW(TYPE_SIZE(ResultTy)) < INT_TYPE_SIZE) { @@ -996,7 +1010,8 @@ if (CallingConv == CallingConv::C) ArgTypes.clear(); else - ArgTypes.resize(1); // Don't nuke last argument. + // Don't nuke last argument. + ArgTypes.erase(ArgTypes.begin()+1, ArgTypes.end()); Args = 0; break; } @@ -1053,7 +1068,7 @@ PAL = ParamAttrsList::get(Attrs); // Finally, make the function type - return FunctionType::get(RetTy, ArgTypes, isVarArg, PAL); + return GetFunctionType(RetTy, ArgTypes, isVarArg, PAL); } //===----------------------------------------------------------------------===// From dpatel at apple.com Mon Sep 10 19:42:56 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 11 Sep 2007 00:42:56 -0000 Subject: [llvm-commits] [llvm] r41826 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709110042.l8B0gubI026895@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 10 19:42:56 2007 New Revision: 41826 URL: http://llvm.org/viewvc/llvm-project?rev=41826&view=rev Log: Refactor code into a separate method. Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=41826&r1=41825&r2=41826&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Sep 10 19:42:56 2007 @@ -89,6 +89,13 @@ }; private: + + // safeIcmpInst - CI is considered safe instruction if one of the operand + // is SCEVAddRecExpr based on induction variable and other operand is + // loop invariant. If CI is safe then populate SplitInfo object SD appropriately + // and return true; + bool safeICmpInst(ICmpInst *CI, SplitInfo &SD); + /// Find condition inside a loop that is suitable candidate for index split. void findSplitCondition(); @@ -411,37 +418,49 @@ // If one operand is loop invariant and second operand is SCEVAddRecExpr // based on induction variable then CI is a candidate split condition. - Value *V0 = CI->getOperand(0); - Value *V1 = CI->getOperand(1); + if (safeICmpInst(CI, SD)) + SplitData.push_back(SD); + } +} - SCEVHandle SH0 = SE->getSCEV(V0); - SCEVHandle SH1 = SE->getSCEV(V1); +// safeIcmpInst - CI is considered safe instruction if one of the operand +// is SCEVAddRecExpr based on induction variable and other operand is +// loop invariant. If CI is safe then populate SplitInfo object SD appropriately +// and return true; +bool LoopIndexSplit::safeICmpInst(ICmpInst *CI, SplitInfo &SD) { - if (SH0->isLoopInvariant(L) && isa(SH1)) { - SD.SplitValue = V0; - SD.SplitCondition = CI; - if (PHINode *PN = dyn_cast(V1)) { - if (PN == IndVar) - SplitData.push_back(SD); - } - else if (Instruction *Insn = dyn_cast(V1)) { - if (IndVarIncrement && IndVarIncrement == Insn) - SplitData.push_back(SD); - } + Value *V0 = CI->getOperand(0); + Value *V1 = CI->getOperand(1); + + SCEVHandle SH0 = SE->getSCEV(V0); + SCEVHandle SH1 = SE->getSCEV(V1); + + if (SH0->isLoopInvariant(L) && isa(SH1)) { + SD.SplitValue = V0; + SD.SplitCondition = CI; + if (PHINode *PN = dyn_cast(V1)) { + if (PN == IndVar) + return true; } - else if (SH1->isLoopInvariant(L) && isa(SH0)) { - SD.SplitValue = V1; - SD.SplitCondition = CI; - if (PHINode *PN = dyn_cast(V0)) { - if (PN == IndVar) - SplitData.push_back(SD); - } - else if (Instruction *Insn = dyn_cast(V0)) { - if (IndVarIncrement && IndVarIncrement == Insn) - SplitData.push_back(SD); - } + else if (Instruction *Insn = dyn_cast(V1)) { + if (IndVarIncrement && IndVarIncrement == Insn) + return true; + } + } + else if (SH1->isLoopInvariant(L) && isa(SH0)) { + SD.SplitValue = V1; + SD.SplitCondition = CI; + if (PHINode *PN = dyn_cast(V0)) { + if (PN == IndVar) + return true; + } + else if (Instruction *Insn = dyn_cast(V0)) { + if (IndVarIncrement && IndVarIncrement == Insn) + return true; } } + + return false; } /// processOneIterationLoop - Current loop L contains compare instruction From sabre at nondot.org Mon Sep 10 19:48:12 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 11 Sep 2007 00:48:12 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41827 - /llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Message-ID: <200709110048.l8B0mC8X027057@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 19:48:12 2007 New Revision: 41827 URL: http://llvm.org/viewvc/llvm-project?rev=41827&view=rev Log: Fix obvious typo Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=41827&r1=41826&r2=41827&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Mon Sep 10 19:48:12 2007 @@ -216,7 +216,7 @@ std::vector ArgTysP; ArgTysP.reserve(ArgTys.size()); for (unsigned i = 0, e = ArgTys.size(); i != e; ++i) - ArgTysP.push_back(ArgTys[0]); + ArgTysP.push_back(ArgTys[i]); return FunctionType::get(Res, ArgTysP, isVarArg, Attrs); } From sabre at nondot.org Mon Sep 10 19:50:50 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 11 Sep 2007 00:50:50 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41828 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200709110050.l8B0ooPl027164@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 19:50:50 2007 New Revision: 41828 URL: http://llvm.org/viewvc/llvm-project?rev=41828&view=rev Log: Fix PR1634 in 4.2 Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=41828&r1=41827&r2=41828&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Mon Sep 10 19:50:50 2007 @@ -207,6 +207,19 @@ // opaque*, and remember that they did this in PointersToReresolve. +/// GetFunctionType - This is just a helper like FunctionType::get but that +/// takes PATypeHolders. +static FunctionType *GetFunctionType(const PATypeHolder &Res, + std::vector &ArgTys, + bool isVarArg, + const ParamAttrsList *Attrs) { + std::vector ArgTysP; + ArgTysP.reserve(ArgTys.size()); + for (unsigned i = 0, e = ArgTys.size(); i != e; ++i) + ArgTysP.push_back(ArgTys[i]); + + return FunctionType::get(Res, ArgTysP, isVarArg, Attrs); +} //===----------------------------------------------------------------------===// // Type Conversion Utilities @@ -877,13 +890,13 @@ namespace { class FunctionTypeConversion : public DefaultABIClient { - const Type *&RetTy; - std::vector &ArgTypes; + PATypeHolder &RetTy; + std::vector &ArgTypes; unsigned &CallingConv; bool isStructRet; bool KNRPromotion; public: - FunctionTypeConversion(const Type *&retty, std::vector &AT, + FunctionTypeConversion(PATypeHolder &retty, std::vector &AT, unsigned &CC, bool KNR) : RetTy(retty), ArgTypes(AT), CallingConv(CC), KNRPromotion(KNR) { CallingConv = CallingConv::C; @@ -935,6 +948,7 @@ }; } + /// ConvertParamListToLLVMSignature - This method is used to build the argument /// type list for K&R prototyped functions. In this case, we have to figure out /// the type list (to build a FunctionType) from the actual DECL_ARGUMENTS list @@ -944,8 +958,8 @@ const FunctionType *TypeConverter:: ConvertArgListToFnType(tree ReturnType, tree Args, tree static_chain, unsigned &CallingConv) { - std::vector ArgTys; - const Type *RetTy; + std::vector ArgTys; + PATypeHolder RetTy(Type::VoidTy); FunctionTypeConversion Client(RetTy, ArgTys, CallingConv, true /*K&R*/); TheLLVMABI ABIConverter(Client); @@ -959,15 +973,15 @@ for (; Args && TREE_TYPE(Args) != void_type_node; Args = TREE_CHAIN(Args)) ABIConverter.HandleArgument(TREE_TYPE(Args)); - return FunctionType::get(RetTy, ArgTys, false, 0); + return GetFunctionType(RetTy, ArgTys, false, 0); } const FunctionType *TypeConverter::ConvertFunctionType(tree type, tree decl, tree static_chain, unsigned &CallingConv) { - const Type *RetTy = 0; - std::vector ArgTypes; + PATypeHolder RetTy = Type::VoidTy; + std::vector ArgTypes; bool isVarArg = false; FunctionTypeConversion Client(RetTy, ArgTypes, CallingConv, false/*not K&R*/); TheLLVMABI ABIConverter(Client); @@ -982,7 +996,7 @@ // Compute whether the result needs to be zext or sext'd, adding an attribute // if so. ParamAttrsVector Attrs; - if (isa(RetTy)) { + if (isa(RetTy.get())) { uint16_t RAttributes = ParamAttr::None; tree ResultTy = TREE_TYPE(type); if (TREE_INT_CST_LOW(TYPE_SIZE(ResultTy)) < INT_TYPE_SIZE) { @@ -1028,7 +1042,8 @@ if (CallingConv == CallingConv::C) ArgTypes.clear(); else - ArgTypes.resize(1); // Don't nuke last argument. + // Don't nuke last argument. + ArgTypes.erase(ArgTypes.begin()+1, ArgTypes.end()); Args = 0; break; } @@ -1085,7 +1100,7 @@ PAL = ParamAttrsList::get(Attrs); // Finally, make the function type - return FunctionType::get(RetTy, ArgTypes, isVarArg, PAL); + return GetFunctionType(RetTy, ArgTypes, isVarArg, PAL); } //===----------------------------------------------------------------------===// From dpatel at apple.com Mon Sep 10 20:10:45 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 11 Sep 2007 01:10:45 -0000 Subject: [llvm-commits] [llvm] r41829 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709110110.l8B1AjQk027782@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 10 20:10:45 2007 New Revision: 41829 URL: http://llvm.org/viewvc/llvm-project?rev=41829&view=rev Log: Avoid negative logic. Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=41829&r1=41828&r2=41829&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Sep 10 20:10:45 2007 @@ -410,10 +410,10 @@ // If split condition predicate is GT or GE then first execute // false branch of split condition. - if (CI->getPredicate() != ICmpInst::ICMP_ULT - && CI->getPredicate() != ICmpInst::ICMP_SLT - && CI->getPredicate() != ICmpInst::ICMP_ULE - && CI->getPredicate() != ICmpInst::ICMP_SLE) + if (CI->getPredicate() == ICmpInst::ICMP_UGT + || CI->getPredicate() == ICmpInst::ICMP_SGT + || CI->getPredicate() == ICmpInst::ICMP_UGE + || CI->getPredicate() == ICmpInst::ICMP_SGE) SD.UseTrueBranchFirst = false; // If one operand is loop invariant and second operand is SCEVAddRecExpr From dberlin at dberlin.org Mon Sep 10 20:38:08 2007 From: dberlin at dberlin.org (Daniel Berlin) Date: Tue, 11 Sep 2007 01:38:08 -0000 Subject: [llvm-commits] [llvm] r41830 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h Message-ID: <200709110138.l8B1c8Vt028636@zion.cs.uiuc.edu> Author: dannyb Date: Mon Sep 10 20:38:07 2007 New Revision: 41830 URL: http://llvm.org/viewvc/llvm-project?rev=41830&view=rev Log: Add remaining functions necessary for andersen's Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=41830&r1=41829&r2=41830&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original) +++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Mon Sep 10 20:38:07 2007 @@ -195,6 +195,15 @@ return changed; } + // Return true if we have any bits in common with RHS + bool intersects(const SparseBitVectorElement &RHS) const { + for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i) { + if (RHS.Bits[i] & Bits[i]) + return true; + } + return false; + } + // Intersect this Element with RHS and return true if this one changed. // BecameZero is set to true if this element became all-zero bits. bool intersectWith(const SparseBitVectorElement &RHS, @@ -216,6 +225,28 @@ BecameZero = !allzero; return changed; } + // Intersect this Element with the complement of RHS and return true if this + // one changed. BecameZero is set to true if this element became all-zero + // bits. + bool intersectWithComplement(const SparseBitVectorElement &RHS, + bool &BecameZero) { + bool changed = false; + bool allzero = true; + + BecameZero = false; + for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i) { + BitWord old = changed ? 0 : Bits[i]; + + Bits[i] &= ~RHS.Bits[i]; + if (Bits[i] != 0) + allzero = false; + + if (old != Bits[i]) + changed = true; + } + BecameZero = !allzero; + return changed; + } }; template @@ -265,11 +296,11 @@ // Iterator to walk set bits in the bitmap. This iterator is a lot uglier // than it would be, in order to be efficient. - struct SparseBitVectorIterator { + class SparseBitVectorIterator { private: bool AtEnd; - SparseBitVector &BitVector; + const SparseBitVector *BitVector; // Current element inside of bitmap. ElementListConstIter Iter; @@ -287,11 +318,11 @@ void AdvanceToFirstNonZero() { if (AtEnd) return; - if (BitVector.Elements.empty()) { + if (BitVector->Elements.empty()) { AtEnd = true; return; } - Iter = BitVector.Elements.begin(); + Iter = BitVector->Elements.begin(); BitNumber = (*Iter)->index() * ElementSize; unsigned BitPos = (*Iter)->find_first(); BitNumber += BitPos; @@ -319,7 +350,7 @@ WordNumber = 0; // We may run out of elements in the bitmap. - if (Iter == BitVector.Elements.end()) { + if (Iter == BitVector->Elements.end()) { AtEnd = true; return; } @@ -369,10 +400,13 @@ bool operator!=(const SparseBitVectorIterator &RHS) const { return !(*this == RHS); } - - explicit SparseBitVectorIterator(SparseBitVector &RHS, - bool end = false):BitVector(RHS) { - Iter = BitVector.Elements.begin(); + SparseBitVectorIterator(): BitVector(NULL) { + } + + + SparseBitVectorIterator(const SparseBitVector *RHS, + bool end = false):BitVector(RHS) { + Iter = BitVector->Elements.begin(); BitNumber = 0; Bits = 0; WordNumber = ~0; @@ -382,7 +416,6 @@ }; public: typedef SparseBitVectorIterator iterator; - typedef const SparseBitVectorIterator const_iterator; SparseBitVector () { CurrElementIter = Elements.begin (); @@ -464,6 +497,13 @@ } Element->set(Idx % ElementSize); } + + bool test_and_set (unsigned Idx) { + bool old = test(Idx); + if (!old) + set(Idx); + return !old; + } // Union our bitmap with the RHS and return true if we changed. bool operator|=(const SparseBitVector &RHS) { @@ -547,14 +587,156 @@ return changed; } + // Intersect our bitmap with the complement of the RHS and return true if ours + // changed. + bool intersectWithComplement(const SparseBitVector &RHS) { + bool changed = false; + ElementListIter Iter1 = Elements.begin(); + ElementListConstIter Iter2 = RHS.Elements.begin(); + + // IE They may both be end. + if (Iter1 == Iter2) + return false; + + // See if the first bitmap element is the same in both. This is only + // possible if they are the same bitmap. + if (Iter1 != Elements.end() && Iter2 != RHS.Elements.end()) + if (*Iter1 == *Iter2) { + Elements.clear(); + return true; + } + + // Loop through, intersecting as we go, erasing elements when necessary. + while (Iter2 != RHS.Elements.end()) { + if (Iter1 == Elements.end()) + return changed; + + if ((*Iter1)->index() > (*Iter2)->index()) { + Iter2++; + } else if ((*Iter1)->index() == (*Iter2)->index()) { + bool BecameZero; + changed |= (*Iter1)->intersectWithComplement(*(*Iter2), BecameZero); + if (BecameZero) { + ElementListIter IterTmp = Iter1; + delete *IterTmp; + Elements.erase(IterTmp); + Iter1++; + } else { + Iter1++; + } + Iter2++; + } else { + ElementListIter IterTmp = Iter1; + Iter1++; + delete *IterTmp; + Elements.erase(IterTmp); + } + } + CurrElementIter = Elements.begin(); + return changed; + } + + bool intersectWithComplement(const SparseBitVector *RHS) const { + return intersectWithComplement(*RHS); + } + + + bool intersects(const SparseBitVector *RHS) const { + return intersects(*RHS); + } + + // Return true if we share any bits in common with RHS + bool intersects(const SparseBitVector &RHS) const { + ElementListConstIter Iter1 = Elements.begin(); + ElementListConstIter Iter2 = RHS.Elements.begin(); + + // IE They may both be end. + if (Iter1 == Iter2) + return false; + + // See if the first bitmap element is the same in both. This is only + // possible if they are the same bitmap. + if (Iter1 != Elements.end() && Iter2 != RHS.Elements.end()) + if (*Iter1 == *Iter2) { + return true; + } + + // Loop through, intersecting stopping when we hit bits in common. + while (Iter2 != RHS.Elements.end()) { + if (Iter1 == Elements.end()) + return false; + + if ((*Iter1)->index() > (*Iter2)->index()) { + Iter2++; + } else if ((*Iter1)->index() == (*Iter2)->index()) { + if ((*Iter1)->intersects(*(*Iter2))) + return true; + Iter1++; + Iter2++; + } else { + Iter1++; + } + } + return false; + } + + // Return the first set bit in the bitmap. Return -1 if no bits are set. + int find_first() const { + if (Elements.empty()) + return -1; + const SparseBitVectorElement *First = *(Elements.begin()); + return (First->index() * ElementSize) + First->find_first(); + } + + // Return true if the SparseBitVector is empty + bool empty() const { + return Elements.empty(); + } + + unsigned count() const { + unsigned BitCount = 0; + for (ElementListConstIter Iter = Elements.begin(); + Iter != Elements.end(); + ++Iter) + BitCount += (*Iter)->count(); + + return BitCount; + } iterator begin() const { - return iterator(*this); + return iterator(this); } iterator end() const { - return iterator(*this, ~0); + return iterator(this, ~0); } }; + +// Convenience functions to allow Or and And without dereferencing in the user +// code. +template +inline void operator |=(SparseBitVector *LHS, + const SparseBitVector &RHS) { + LHS->operator|=(RHS); +} + +template +inline void operator |=(SparseBitVector *LHS, + const SparseBitVector *RHS) { + LHS->operator|=(RHS); +} + +template +inline void operator &=(SparseBitVector *LHS, + const SparseBitVector &RHS) { + LHS->operator&=(RHS); +} + +template +inline void operator &=(SparseBitVector *LHS, + const SparseBitVector *RHS) { + LHS->operator&=(RHS); +} + } #endif From clattner at apple.com Mon Sep 10 21:57:57 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 10 Sep 2007 19:57:57 -0700 Subject: [llvm-commits] [llvm] r41830 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h In-Reply-To: <200709110138.l8B1c8Vt028636@zion.cs.uiuc.edu> References: <200709110138.l8B1c8Vt028636@zion.cs.uiuc.edu> Message-ID: <26B10ADA-1D85-4F7F-8AE2-7564DB3F635C@apple.com> On Sep 10, 2007, at 6:38 PM, Daniel Berlin wrote: > +// Convenience functions to allow Or and And without dereferencing > in the user > +// code. It is generally bad form to overload operators like this. Usually having the extra dereference is a good thing from the consistency and "magic reduction" standpoint. Do you really need these? -Chris > +template > +inline void operator |=(SparseBitVector *LHS, > + const SparseBitVector &RHS) { > + LHS->operator|=(RHS); > +} > + > +template > +inline void operator |=(SparseBitVector *LHS, > + const SparseBitVector *RHS) { > + LHS->operator|=(RHS); > +} > + > +template > +inline void operator &=(SparseBitVector *LHS, > + const SparseBitVector &RHS) { > + LHS->operator&=(RHS); > +} > + > +template > +inline void operator &=(SparseBitVector *LHS, > + const SparseBitVector *RHS) { From resistor at mac.com Mon Sep 10 22:48:09 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 11 Sep 2007 03:48:09 -0000 Subject: [llvm-commits] [llvm] r41831 - /llvm/trunk/include/llvm/ADT/DenseMap.h Message-ID: <200709110348.l8B3m9su000612@zion.cs.uiuc.edu> Author: resistor Date: Mon Sep 10 22:48:08 2007 New Revision: 41831 URL: http://llvm.org/viewvc/llvm-project?rev=41831&view=rev Log: Fix non-deterministic behavior in the DenseMap copy constructor. Modified: llvm/trunk/include/llvm/ADT/DenseMap.h Modified: llvm/trunk/include/llvm/ADT/DenseMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=41831&r1=41830&r2=41831&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) +++ llvm/trunk/include/llvm/ADT/DenseMap.h Mon Sep 10 22:48:08 2007 @@ -181,7 +181,7 @@ private: void CopyFrom(const DenseMap& other) { - if (NumEntries != 0) { + if (NumBuckets != 0 && !KeyInfoT::isPod()) { const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey(); for (BucketT *P = Buckets, *E = Buckets+NumBuckets; P != E; ++P) { if (P->first != EmptyKey && P->first != TombstoneKey) @@ -197,8 +197,14 @@ delete[] reinterpret_cast(Buckets); Buckets = reinterpret_cast(new char[sizeof(BucketT) * other.NumBuckets]); - memcpy(Buckets, other.Buckets, other.NumBuckets * sizeof(BucketT)); + if (KeyInfoT::isPod()) + memcpy(Buckets, other.Buckets, other.NumBuckets * sizeof(BucketT)); + else + for (size_t i = 0; i < other.NumBuckets; ++i) { + new (Buckets[i].first) KeyT(other.Buckets[i].first); + new (Buckets[i].second) ValueT(other.Buckets[i].second); + } NumBuckets = other.NumBuckets; } From clattner at apple.com Mon Sep 10 22:59:09 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 10 Sep 2007 20:59:09 -0700 Subject: [llvm-commits] [llvm] r41831 - /llvm/trunk/include/llvm/ADT/DenseMap.h In-Reply-To: <200709110348.l8B3m9su000612@zion.cs.uiuc.edu> References: <200709110348.l8B3m9su000612@zion.cs.uiuc.edu> Message-ID: <7B0D6D89-152A-4546-A06E-F91E472279F0@apple.com> > private: > void CopyFrom(const DenseMap& other) { > - if (NumEntries != 0) { > + if (NumBuckets != 0 && !KeyInfoT::isPod()) { ... > + if (KeyInfoT::isPod()) Shouldn't this require that the key and value both be pod? > + memcpy(Buckets, other.Buckets, other.NumBuckets * sizeof > (BucketT)); > + else > + for (size_t i = 0; i < other.NumBuckets; ++i) { > + new (Buckets[i].first) KeyT(other.Buckets[i].first); > + new (Buckets[i].second) ValueT(other.Buckets[i].second); This should not construct keys/values for buckets that are not valid. -Chris From dberlin at dberlin.org Mon Sep 10 23:11:28 2007 From: dberlin at dberlin.org (Daniel Berlin) Date: Tue, 11 Sep 2007 04:11:28 -0000 Subject: [llvm-commits] [llvm] r41832 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h Message-ID: <200709110411.l8B4BTeH001539@zion.cs.uiuc.edu> Author: dannyb Date: Mon Sep 10 23:11:28 2007 New Revision: 41832 URL: http://llvm.org/viewvc/llvm-project?rev=41832&view=rev Log: Fix bugs with &=, intersect with complement. Add three argument version of intersect with complement. Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=41832&r1=41831&r2=41832&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original) +++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Mon Sep 10 23:11:28 2007 @@ -199,11 +199,11 @@ bool intersects(const SparseBitVectorElement &RHS) const { for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i) { if (RHS.Bits[i] & Bits[i]) - return true; + return true; } return false; } - + // Intersect this Element with RHS and return true if this one changed. // BecameZero is set to true if this element became all-zero bits. bool intersectWith(const SparseBitVectorElement &RHS, @@ -247,6 +247,22 @@ BecameZero = !allzero; return changed; } + // Three argument version of intersectWithComplement that intersects + // RHS1 & ~RHS2 into this element + void intersectWithComplement(const SparseBitVectorElement &RHS1, + const SparseBitVectorElement &RHS2, + bool &BecameZero) { + bool allzero = true; + + BecameZero = false; + for (unsigned i = 0; i < BITWORDS_PER_ELEMENT; ++i) { + Bits[i] = RHS1.Bits[i] & ~RHS2.Bits[i]; + if (Bits[i] != 0) + allzero = false; + } + BecameZero = !allzero; + } + }; template @@ -346,7 +362,7 @@ int NextSetBitNumber = (*Iter)->find_next(BitNumber % ElementSize) ; // If we ran out of set bits in this element, move to next element. if (NextSetBitNumber == -1 || (BitNumber % ElementSize == 0)) { - Iter++; + ++Iter; WordNumber = 0; // We may run out of elements in the bitmap. @@ -371,7 +387,7 @@ public: // Preincrement. inline SparseBitVectorIterator& operator++() { - BitNumber++; + ++BitNumber; Bits >>= 1; AdvanceToNextNonZero(); return *this; @@ -400,10 +416,10 @@ bool operator!=(const SparseBitVectorIterator &RHS) const { return !(*this == RHS); } - SparseBitVectorIterator(): BitVector(NULL) { + SparseBitVectorIterator(): BitVector(NULL) { } - - + + SparseBitVectorIterator(const SparseBitVector *RHS, bool end = false):BitVector(RHS) { Iter = BitVector->Elements.begin(); @@ -497,7 +513,7 @@ } Element->set(Idx % ElementSize); } - + bool test_and_set (unsigned Idx) { bool old = test(Idx); if (!old) @@ -527,14 +543,14 @@ NewElem = new SparseBitVectorElement(*(*Iter2)); Elements.insert(Iter1, NewElem); - Iter2++; + ++Iter2; changed = true; } else if ((*Iter1)->index() == (*Iter2)->index()) { changed |= (*Iter1)->unionWith(*(*Iter2)); - Iter1++; - Iter2++; + ++Iter1; + ++Iter2; } else { - Iter1++; + ++Iter1; } } CurrElementIter = Elements.begin(); @@ -563,7 +579,7 @@ return changed; if ((*Iter1)->index() > (*Iter2)->index()) { - Iter2++; + ++Iter2; } else if ((*Iter1)->index() == (*Iter2)->index()) { bool BecameZero; changed |= (*Iter1)->intersectWith(*(*Iter2), BecameZero); @@ -571,18 +587,19 @@ ElementListIter IterTmp = Iter1; delete *IterTmp; Elements.erase(IterTmp); - Iter1++; - } else { - Iter1++; } - Iter2++; + ++Iter1; + ++Iter2; } else { ElementListIter IterTmp = Iter1; - Iter1++; + ++Iter1; delete *IterTmp; Elements.erase(IterTmp); } } + for_each(Iter1, Elements.end(), + deleter >); + Elements.erase(Iter1, Elements.end()); CurrElementIter = Elements.begin(); return changed; } @@ -602,17 +619,19 @@ // possible if they are the same bitmap. if (Iter1 != Elements.end() && Iter2 != RHS.Elements.end()) if (*Iter1 == *Iter2) { + for_each(Elements.begin(), Elements.end(), + deleter >); Elements.clear(); return true; } - + // Loop through, intersecting as we go, erasing elements when necessary. while (Iter2 != RHS.Elements.end()) { if (Iter1 == Elements.end()) return changed; if ((*Iter1)->index() > (*Iter2)->index()) { - Iter2++; + ++Iter2; } else if ((*Iter1)->index() == (*Iter2)->index()) { bool BecameZero; changed |= (*Iter1)->intersectWithComplement(*(*Iter2), BecameZero); @@ -620,14 +639,12 @@ ElementListIter IterTmp = Iter1; delete *IterTmp; Elements.erase(IterTmp); - Iter1++; - } else { - Iter1++; } - Iter2++; + ++Iter1; + ++Iter2; } else { ElementListIter IterTmp = Iter1; - Iter1++; + ++Iter1; delete *IterTmp; Elements.erase(IterTmp); } @@ -639,12 +656,77 @@ bool intersectWithComplement(const SparseBitVector *RHS) const { return intersectWithComplement(*RHS); } - - + + + // Three argument version of intersectWithComplement. Result of RHS1 & ~RHS2 + // is stored into this bitmap. + void intersectWithComplement(const SparseBitVector &RHS1, + const SparseBitVector &RHS2) + { + for_each(Elements.begin(), Elements.end(), + deleter >); + Elements.clear(); + + ElementListConstIter Iter1 = RHS1.Elements.begin(); + ElementListConstIter Iter2 = RHS2.Elements.begin(); + + // IE They may both be end. + if (Iter1 == Iter2) + return; + + // See if the first bitmap element is the same in both. This is only + // possible if they are the same bitmap. + if (Iter1 != RHS1.Elements.end() && Iter2 != RHS2.Elements.end()) + if (*Iter1 == *Iter2) { + return; + } + + // Loop through, intersecting as we go, erasing elements when necessary. + while (Iter2 != RHS2.Elements.end()) { + if (Iter1 == RHS1.Elements.end()) + return; + + if ((*Iter1)->index() > (*Iter2)->index()) { + ++Iter2; + } else if ((*Iter1)->index() == (*Iter2)->index()) { + bool BecameZero = false; + SparseBitVectorElement *NewElement = + new SparseBitVectorElement((*Iter1)->index()); + + NewElement->intersectWithComplement(*(*Iter1), *(*Iter2), BecameZero); + if (BecameZero) { + delete NewElement; + } else { + Elements.push_back(NewElement); + } + + ++Iter1; + ++Iter2; + } else { + ++Iter1; + } + } + // copy the remaining elements + + while (Iter1 != RHS1.Elements.end()) { + SparseBitVectorElement *NewElement = + new SparseBitVectorElement(*(*Iter1)); + Elements.push_back(NewElement); + } + + CurrElementIter = Elements.begin(); + return; + } + + void intersectWithComplement(const SparseBitVector *RHS1, + const SparseBitVector *RHS2) { + intersectWithComplement(*RHS1, *RHS2); + } + bool intersects(const SparseBitVector *RHS) const { return intersects(*RHS); } - + // Return true if we share any bits in common with RHS bool intersects(const SparseBitVector &RHS) const { ElementListConstIter Iter1 = Elements.begin(); @@ -660,26 +742,26 @@ if (*Iter1 == *Iter2) { return true; } - + // Loop through, intersecting stopping when we hit bits in common. while (Iter2 != RHS.Elements.end()) { if (Iter1 == Elements.end()) return false; if ((*Iter1)->index() > (*Iter2)->index()) { - Iter2++; + ++Iter2; } else if ((*Iter1)->index() == (*Iter2)->index()) { if ((*Iter1)->intersects(*(*Iter2))) return true; - Iter1++; - Iter2++; + ++Iter1; + ++Iter2; } else { - Iter1++; + ++Iter1; } } return false; } - + // Return the first set bit in the bitmap. Return -1 if no bits are set. int find_first() const { if (Elements.empty()) @@ -692,14 +774,14 @@ bool empty() const { return Elements.empty(); } - + unsigned count() const { unsigned BitCount = 0; for (ElementListConstIter Iter = Elements.begin(); Iter != Elements.end(); ++Iter) BitCount += (*Iter)->count(); - + return BitCount; } iterator begin() const { @@ -712,31 +794,32 @@ }; // Convenience functions to allow Or and And without dereferencing in the user -// code. +// code. + template -inline void operator |=(SparseBitVector *LHS, - const SparseBitVector &RHS) { - LHS->operator|=(RHS); +inline bool operator |=(SparseBitVector &LHS, + const SparseBitVector *RHS) { + return LHS |= *RHS; } template -inline void operator |=(SparseBitVector *LHS, - const SparseBitVector *RHS) { - LHS->operator|=(RHS); +inline bool operator |=(SparseBitVector *LHS, + const SparseBitVector &RHS) { + return LHS->operator|=(RHS); } template -inline void operator &=(SparseBitVector *LHS, +inline bool operator &=(SparseBitVector *LHS, const SparseBitVector &RHS) { - LHS->operator&=(RHS); + return LHS->operator&=(RHS); } template -inline void operator &=(SparseBitVector *LHS, +inline bool operator &=(SparseBitVector &LHS, const SparseBitVector *RHS) { - LHS->operator&=(RHS); + return LHS &= (*RHS); } - + } #endif From resistor at mac.com Mon Sep 10 23:31:00 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 11 Sep 2007 04:31:00 -0000 Subject: [llvm-commits] [llvm] r41833 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Message-ID: <200709110431.l8B4V1PK002211@zion.cs.uiuc.edu> Author: resistor Date: Mon Sep 10 23:31:00 2007 New Revision: 41833 URL: http://llvm.org/viewvc/llvm-project?rev=41833&view=rev Log: Fix a typo in memdep, which was causing PR1648. Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=41833&r1=41832&r2=41833&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Mon Sep 10 23:31:00 2007 @@ -425,7 +425,7 @@ reverseDep.erase(rem); } - if (depGraphNonLocal.count(rem)) { + if (reverseDepNonLocal.count(rem)) { SmallPtrSet& set = reverseDepNonLocal[rem]; for (SmallPtrSet::iterator I = set.begin(), E = set.end(); I != E; ++I) From resistor at mac.com Mon Sep 10 23:43:51 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 11 Sep 2007 04:43:51 -0000 Subject: [llvm-commits] [llvm] r41834 - /llvm/trunk/include/llvm/ADT/DenseMap.h Message-ID: <200709110443.l8B4hp1J002784@zion.cs.uiuc.edu> Author: resistor Date: Mon Sep 10 23:43:51 2007 New Revision: 41834 URL: http://llvm.org/viewvc/llvm-project?rev=41834&view=rev Log: Don't bother to initialize values corresponding to empty or tombstone keys. Modified: llvm/trunk/include/llvm/ADT/DenseMap.h Modified: llvm/trunk/include/llvm/ADT/DenseMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=41834&r1=41833&r2=41834&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) +++ llvm/trunk/include/llvm/ADT/DenseMap.h Mon Sep 10 23:43:51 2007 @@ -203,7 +203,9 @@ else for (size_t i = 0; i < other.NumBuckets; ++i) { new (Buckets[i].first) KeyT(other.Buckets[i].first); - new (Buckets[i].second) ValueT(other.Buckets[i].second); + if (Buckets[i].first != getEmptyKey() && + Buckets[i].first != getTombstoneKey()) + new (Buckets[i].second) ValueT(other.Buckets[i].second); } NumBuckets = other.NumBuckets; } From sabre at nondot.org Mon Sep 10 23:55:22 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 11 Sep 2007 04:55:22 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41835 - /llvm-gcc-4.0/trunk/gcc/fold-const.c Message-ID: <200709110455.l8B4tMkF003249@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 23:55:22 2007 New Revision: 41835 URL: http://llvm.org/viewvc/llvm-project?rev=41835&view=rev Log: Stop GCC from folding x*x -> pow/powf to work around PR1631 Modified: llvm-gcc-4.0/trunk/gcc/fold-const.c Modified: llvm-gcc-4.0/trunk/gcc/fold-const.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/fold-const.c?rev=41835&r1=41834&r2=41835&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/fold-const.c (original) +++ llvm-gcc-4.0/trunk/gcc/fold-const.c Mon Sep 10 23:55:22 2007 @@ -7997,6 +7997,9 @@ } } + /* LLVM LOCAL Disable pow generation (FIXME: PR1631) */ +#ifndef ENABLE_LLVM + /* Optimize x*x as pow(x,2.0), which is expanded as x*x. */ if (! optimize_size && operand_equal_p (arg0, arg1, 0)) @@ -8011,6 +8014,8 @@ return build_function_call_expr (powfn, arglist); } } + /* LLVM LOCAL Disable pow generation (FIXME: PR1631) */ +#endif /*ENABLE_LLVM*/ } } goto associate; From sabre at nondot.org Mon Sep 10 23:56:31 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 11 Sep 2007 04:56:31 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41836 - /llvm-gcc-4.2/trunk/gcc/fold-const.c Message-ID: <200709110456.l8B4uVTc003306@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 10 23:56:31 2007 New Revision: 41836 URL: http://llvm.org/viewvc/llvm-project?rev=41836&view=rev Log: Stop GCC from folding x*x -> pow/powf to work around PR1631 Modified: llvm-gcc-4.2/trunk/gcc/fold-const.c Modified: llvm-gcc-4.2/trunk/gcc/fold-const.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/fold-const.c?rev=41836&r1=41835&r2=41836&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/fold-const.c (original) +++ llvm-gcc-4.2/trunk/gcc/fold-const.c Mon Sep 10 23:56:31 2007 @@ -9380,6 +9380,9 @@ } } + /* LLVM LOCAL Disable pow generation (FIXME: PR1631) */ +#ifndef ENABLE_LLVM + /* Optimize x*x as pow(x,2.0), which is expanded as x*x. */ if (! optimize_size && operand_equal_p (arg0, arg1, 0)) @@ -9394,6 +9397,8 @@ return build_function_call_expr (powfn, arglist); } } + /* LLVM LOCAL Disable pow generation (FIXME: PR1631) */ +#endif /*ENABLE_LLVM*/ } } goto associate; From clattner at apple.com Tue Sep 11 00:06:11 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 10 Sep 2007 22:06:11 -0700 Subject: [llvm-commits] [llvm] r41804 - in /llvm/trunk: lib/Transforms/Scalar/TailRecursionElimination.cpp test/Transforms/TailCallElim/inf-recursion.ll In-Reply-To: <59D114DA-BCC5-46D6-A26C-28A01D03AE7C@apple.com> References: <200709102058.l8AKwtoN019258@zion.cs.uiuc.edu> <8EEC2A18-1411-4095-AA07-81E1A0439783@apple.com> <59D114DA-BCC5-46D6-A26C-28A01D03AE7C@apple.com> Message-ID: On Sep 10, 2007, at 5:08 PM, Dale Johannesen wrote: > On Sep 10, 2007, at 4:53 PM, Chris Lattner wrote: >>> Can't we >>> detect whether the call is going to be lowered >>> to inline code and disable the transformation only in that case? >> >> To be honest, I'm not really very happy with this approach (disabling >> tail recursion from the entry block), it's quite a hack. However, I >> can't think of a good way to handle this: one possibility would be to >> add a new "is a builtin" attribute, and attach it to the call, but >> that is gross in its own way. >> >> -Chris > > Well, it is, but the optimizers really should know which are the > builtins; some of them have special semantics. Well I agree to some extent. The problem is that the compiler treats functions like "fabs" as builtins, regardless of whether they are written as "__builtin_fabs" or "fabs". This argues for having an attribute on the functions, which would also make it easier to handle things like -fno-builtins and -fno-builtin-abs. The problem with this is that it requires the front-end to know all of the builtins recognized by the optimizers and code generator, which is it's own issue. > Perhaps builtins should not be marked as tail calls? This won't work: tailcallelim is the one that infers the tail marker in most cases. The tail marker is a confusingly named marker that indicates that the callee doesn't access the caller's stack frame. It doesn't have anything to do with tailcallelim persay except being a required-but-not-sufficient property. -Chris From resistor at mac.com Tue Sep 11 00:08:05 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 11 Sep 2007 05:08:05 -0000 Subject: [llvm-commits] [llvm] r41837 - /llvm/trunk/include/llvm/ADT/DenseMap.h Message-ID: <200709110508.l8B5850x003801@zion.cs.uiuc.edu> Author: resistor Date: Tue Sep 11 00:08:05 2007 New Revision: 41837 URL: http://llvm.org/viewvc/llvm-project?rev=41837&view=rev Log: Add a ValueInfoT template parameter to DenseMap so that it can properly make decisions based on whether the key AND the value require ctors/dtors. Modified: llvm/trunk/include/llvm/ADT/DenseMap.h Modified: llvm/trunk/include/llvm/ADT/DenseMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=41837&r1=41836&r2=41837&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) +++ llvm/trunk/include/llvm/ADT/DenseMap.h Tue Sep 11 00:08:05 2007 @@ -41,15 +41,29 @@ static bool isPod() { return true; } }; +template +struct DenseMapValueInfo { + //static bool isPod() +}; + +// Provide DenseMapValueInfo for all pointers. +template +struct DenseMapValueInfo { + static bool isPod() { return true; } +}; + template > + typename KeyInfoT = DenseMapKeyInfo, + typename ValueInfoT = DenseMapValueInfo > class DenseMapIterator; template > + typename KeyInfoT = DenseMapKeyInfo, + typename ValueInfoT = DenseMapValueInfo > class DenseMapConstIterator; template > + typename KeyInfoT = DenseMapKeyInfo, + typename ValueInfoT = DenseMapValueInfo > class DenseMap { typedef std::pair BucketT; unsigned NumBuckets; @@ -181,7 +195,7 @@ private: void CopyFrom(const DenseMap& other) { - if (NumBuckets != 0 && !KeyInfoT::isPod()) { + if (NumBuckets != 0 && (!KeyInfoT::isPod() || !ValueInfoT::isPod())) { const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey(); for (BucketT *P = Buckets, *E = Buckets+NumBuckets; P != E; ++P) { if (P->first != EmptyKey && P->first != TombstoneKey) @@ -198,13 +212,13 @@ Buckets = reinterpret_cast(new char[sizeof(BucketT) * other.NumBuckets]); - if (KeyInfoT::isPod()) + if (KeyInfoT::isPod() && ValueInfoT::isPod()) memcpy(Buckets, other.Buckets, other.NumBuckets * sizeof(BucketT)); else for (size_t i = 0; i < other.NumBuckets; ++i) { new (Buckets[i].first) KeyT(other.Buckets[i].first); if (Buckets[i].first != getEmptyKey() && - Buckets[i].first != getTombstoneKey()) + Buckets[i].first != getTombstoneKey()) new (Buckets[i].second) ValueT(other.Buckets[i].second); } NumBuckets = other.NumBuckets; @@ -373,7 +387,7 @@ } }; -template +template class DenseMapIterator { typedef std::pair BucketT; protected: @@ -416,7 +430,7 @@ } }; -template +template class DenseMapConstIterator : public DenseMapIterator { public: DenseMapConstIterator(const std::pair *Pos, From clattner at apple.com Tue Sep 11 00:14:57 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 10 Sep 2007 22:14:57 -0700 Subject: [llvm-commits] [llvm] r41837 - /llvm/trunk/include/llvm/ADT/DenseMap.h In-Reply-To: <200709110508.l8B5850x003801@zion.cs.uiuc.edu> References: <200709110508.l8B5850x003801@zion.cs.uiuc.edu> Message-ID: <4A950205-ED29-4637-AFC8-373EEF75C31C@apple.com> > Log: > Add a ValueInfoT template parameter to DenseMap so that it can > properly make decisions > based on whether the key AND the value require ctors/dtors. Ah, interesting :) How about renaming DenseMapKeyInfo/DenseMapValueInfo -> DenseMapInfo? Is there any reason to keep them separate? That will give you: > template + typename KeyInfoT = DenseMapInfo, > + typename ValueInfoT = DenseMapInfo > And mean that you don't have to provide specializations for both. -Chris > Modified: > llvm/trunk/include/llvm/ADT/DenseMap.h > > Modified: llvm/trunk/include/llvm/ADT/DenseMap.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ > ADT/DenseMap.h?rev=41837&r1=41836&r2=41837&view=diff > > ====================================================================== > ======== > --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) > +++ llvm/trunk/include/llvm/ADT/DenseMap.h Tue Sep 11 00:08:05 2007 > @@ -41,15 +41,29 @@ > static bool isPod() { return true; } > }; > > +template > +struct DenseMapValueInfo { > + //static bool isPod() > +}; > + > +// Provide DenseMapValueInfo for all pointers. > +template > +struct DenseMapValueInfo { > + static bool isPod() { return true; } > +}; > + > template - typename KeyInfoT = DenseMapKeyInfo > > + typename KeyInfoT = DenseMapKeyInfo, > + typename ValueInfoT = DenseMapValueInfo > > class DenseMapIterator; > template - typename KeyInfoT = DenseMapKeyInfo > > + typename KeyInfoT = DenseMapKeyInfo, > + typename ValueInfoT = DenseMapValueInfo > > class DenseMapConstIterator; > > template - typename KeyInfoT = DenseMapKeyInfo > > + typename KeyInfoT = DenseMapKeyInfo, > + typename ValueInfoT = DenseMapValueInfo > > class DenseMap { > typedef std::pair BucketT; > unsigned NumBuckets; > @@ -181,7 +195,7 @@ > > private: > void CopyFrom(const DenseMap& other) { > - if (NumBuckets != 0 && !KeyInfoT::isPod()) { > + if (NumBuckets != 0 && (!KeyInfoT::isPod() || ! > ValueInfoT::isPod())) { > const KeyT EmptyKey = getEmptyKey(), TombstoneKey = > getTombstoneKey(); > for (BucketT *P = Buckets, *E = Buckets+NumBuckets; P != E; + > +P) { > if (P->first != EmptyKey && P->first != TombstoneKey) > @@ -198,13 +212,13 @@ > Buckets = reinterpret_cast(new char[sizeof(BucketT) * > other.NumBuckets]); > > - if (KeyInfoT::isPod()) > + if (KeyInfoT::isPod() && ValueInfoT::isPod()) > memcpy(Buckets, other.Buckets, other.NumBuckets * sizeof > (BucketT)); > else > for (size_t i = 0; i < other.NumBuckets; ++i) { > new (Buckets[i].first) KeyT(other.Buckets[i].first); > if (Buckets[i].first != getEmptyKey() && > - Buckets[i].first != getTombstoneKey()) > + Buckets[i].first != getTombstoneKey()) > new (Buckets[i].second) ValueT(other.Buckets[i].second); > } > NumBuckets = other.NumBuckets; > @@ -373,7 +387,7 @@ > } > }; > > -template > +template typename ValueInfoT> > class DenseMapIterator { > typedef std::pair BucketT; > protected: > @@ -416,7 +430,7 @@ > } > }; > > -template > +template typename ValueInfoT> > class DenseMapConstIterator : public DenseMapIterator ValueT, KeyInfoT> { > public: > DenseMapConstIterator(const std::pair *Pos, > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Tue Sep 11 03:27:22 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Sep 2007 08:27:22 -0000 Subject: [llvm-commits] [llvm] r41838 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86ATTAsmPrinter.cpp lib/Target/X86/X86AsmPrinter.cpp lib/Target/X86/X86AsmPrinter.h lib/Target/X86/X86TargetAsmInfo.cpp Message-ID: <200709110827.l8B8RObE018366@zion.cs.uiuc.edu> Author: void Date: Tue Sep 11 03:27:17 2007 New Revision: 41838 URL: http://llvm.org/viewvc/llvm-project?rev=41838&view=rev Log: The personality function on Darwin needs a global stub. We then refer to that global stub instead of doing the ".set" thingy we were doing before. Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/CodeGen/DwarfWriter.cpp llvm/trunk/lib/Target/TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp llvm/trunk/lib/Target/X86/X86AsmPrinter.h llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=41838&r1=41837&r2=41838&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Sep 11 03:27:17 2007 @@ -110,6 +110,12 @@ const char *FunctionAddrPrefix; // Defaults to "" const char *FunctionAddrSuffix; // Defaults to "" + /// PersonalityPrefix/Suffix - If these are nonempty, these strings will + /// enclose any personality function in the common frame section. + /// + const char *PersonalityPrefix; // Defaults to "" + const char *PersonalitySuffix; // Defaults to "" + /// InlineAsmStart/End - If these are nonempty, they contain a directive to /// emit before and after an inline assembly statement. const char *InlineAsmStart; // Defaults to "#APP\n" @@ -428,6 +434,12 @@ const char *getFunctionAddrSuffix() const { return FunctionAddrSuffix; } + const char *getPersonalityPrefix() const { + return PersonalityPrefix; + } + const char *getPersonalitySuffix() const { + return PersonalitySuffix; + } const char *getInlineAsmStart() const { return InlineAsmStart; } Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=41838&r1=41837&r2=41838&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Tue Sep 11 03:27:17 2007 @@ -2789,26 +2789,15 @@ if (Personality) { Asm->EmitULEB128Bytes(7); Asm->EOL("Augmentation Size"); - Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4); - Asm->EOL("Personality (pcrel sdata4)"); + Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect); + Asm->EOL("Personality (pcrel sdata4 indirect)"); - if (TAI->needsSet()) { - O << "\t.set\t"; - PrintLabelName("set", SetCounter); - O << ","; - Asm->EmitExternalGlobal((const GlobalVariable *)(Personality)); - O << "-" << TAI->getPCSymbol(); - Asm->EOL("Set Personality"); - PrintRelDirective(); - PrintLabelName("set", SetCounter); - Asm->EOL("Personality"); - ++SetCounter; - } else { - PrintRelDirective(); - Asm->EmitExternalGlobal((const GlobalVariable *)(Personality)); - O << "-" << TAI->getPCSymbol(); - Asm->EOL("Personality"); - } + PrintRelDirective(); + O << TAI->getPersonalityPrefix(); + Asm->EmitExternalGlobal((const GlobalVariable *)(Personality)); + O << TAI->getPersonalitySuffix(); + O << "-" << TAI->getPCSymbol(); + Asm->EOL("Personality"); Asm->EmitULEB128Bytes(DW_EH_PE_pcrel); Asm->EOL("LSDA Encoding (pcrel)"); @@ -3297,7 +3286,7 @@ const std::vector Personalities = MMI->getPersonalities(); for (unsigned i =0; i < Personalities.size(); ++i) EmitCommonEHFrame(Personalities[i], i); - + for (std::vector::iterator I = EHFrames.begin(), E = EHFrames.end(); I != E; ++I) EmitEHFrame(*I); Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=41838&r1=41837&r2=41838&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Tue Sep 11 03:27:17 2007 @@ -38,6 +38,8 @@ GlobalVarAddrSuffix(""), FunctionAddrPrefix(""), FunctionAddrSuffix(""), + PersonalityPrefix(""), + PersonalitySuffix(""), InlineAsmStart("#APP"), InlineAsmEnd("#NO_APP"), AssemblerDialect(0), Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=41838&r1=41837&r2=41838&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Tue Sep 11 03:27:17 2007 @@ -74,7 +74,8 @@ if (TAI->doesSupportDebugInformation()) { // Let PassManager know we need debug information and relay // the MachineModuleInfo address on to DwarfWriter. - DW.SetModuleInfo(&getAnalysis()); + MMI = &getAnalysis(); + DW.SetModuleInfo(MMI); } SetupMachineFunction(MF); Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=41838&r1=41837&r2=41838&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Tue Sep 11 03:27:17 2007 @@ -352,6 +352,15 @@ O << "\n"; + if (MMI) { + // Add the (possibly multiple) personalities to the set of global values. + const std::vector& Personalities = MMI->getPersonalities(); + + for (std::vector::const_iterator I = Personalities.begin(), + E = Personalities.end(); I != E; ++I) + if (*I) GVStubs.insert("_" + (*I)->getName()); + } + // Output stubs for external and common global variables. if (GVStubs.begin() != GVStubs.end()) SwitchToDataSection( Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.h?rev=41838&r1=41837&r2=41838&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.h (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.h Tue Sep 11 03:27:17 2007 @@ -30,10 +30,11 @@ struct VISIBILITY_HIDDEN X86SharedAsmPrinter : public AsmPrinter { DwarfWriter DW; + MachineModuleInfo *MMI; X86SharedAsmPrinter(std::ostream &O, X86TargetMachine &TM, const TargetAsmInfo *T) - : AsmPrinter(O, TM, T), DW(O, this, T) { + : AsmPrinter(O, TM, T), DW(O, this, T), MMI(0) { Subtarget = &TM.getSubtarget(); } Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=41838&r1=41837&r2=41838&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Tue Sep 11 03:27:17 2007 @@ -68,6 +68,8 @@ StaticCtorsSection = ".mod_init_func"; StaticDtorsSection = ".mod_term_func"; } + PersonalityPrefix = "L"; + PersonalitySuffix = "$non_lazy_ptr"; InlineAsmStart = "# InlineAsm Start"; InlineAsmEnd = "# InlineAsm End"; SetDirective = "\t.set"; From asl at math.spbu.ru Tue Sep 11 03:52:29 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 11 Sep 2007 12:52:29 +0400 Subject: [llvm-commits] [llvm] r41838 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86ATTAsmPrinter.cpp lib/Target/X86/X86AsmPrinter.cpp lib/Target/X86/X86AsmPrinter.h lib/Target/X86/X86TargetAsmInfo.cpp In-Reply-To: <200709110827.l8B8RObE018366.SS8009SS@zion.cs.uiuc.edu> References: <200709110827.l8B8RObE018366.SS8009SS@zion.cs.uiuc.edu> Message-ID: <1189500749.11114.100.camel@asl.dorms.spbu.ru> Bill, > The personality function on Darwin needs a global stub. We then refer to > that global stub instead of doing the ".set" thingy we were doing before. This breaks linux. The problem is indirect encoding of personality symbol. It shouldn't be so for linux. It seems we need another knob for it :( -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From baldrick at free.fr Tue Sep 11 07:09:24 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 11 Sep 2007 12:09:24 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41839 - /llvm-gcc-4.2/trunk/gcc/c-typeck.c Message-ID: <200709111209.l8BC9OqN027385@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 11 07:09:22 2007 New Revision: 41839 URL: http://llvm.org/viewvc/llvm-project?rev=41839&view=rev Log: Revert r41761 because it is not needed for 4.2. Modified: llvm-gcc-4.2/trunk/gcc/c-typeck.c Modified: llvm-gcc-4.2/trunk/gcc/c-typeck.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-typeck.c?rev=41839&r1=41838&r2=41839&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-typeck.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-typeck.c Tue Sep 11 07:09:22 2007 @@ -6453,13 +6453,7 @@ if (value == error_mark_node) constructor_erroneous = 1; - else if (!(TREE_CONSTANT (value) - || (DECL_P (value) - && DECL_INITIAL (value) - && DECL_INITIAL (value) != error_mark_node - && ! TREE_THIS_VOLATILE (value) - && ! TYPE_P (DECL_INITIAL (value)) - && TREE_CONSTANT (DECL_INITIAL (value))))) + else if (!TREE_CONSTANT (value)) constructor_constant = 0; else if (!initializer_constant_valid_p (value, TREE_TYPE (value)) || ((TREE_CODE (constructor_type) == RECORD_TYPE From baldrick at free.fr Tue Sep 11 07:30:25 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 11 Sep 2007 12:30:25 -0000 Subject: [llvm-commits] [llvm] r41840 - /llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Message-ID: <200709111230.l8BCUQnQ027952@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 11 07:30:25 2007 New Revision: 41840 URL: http://llvm.org/viewvc/llvm-project?rev=41840&view=rev Log: My compiler warns about the semicolon. Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=41840&r1=41839&r2=41840&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Tue Sep 11 07:30:25 2007 @@ -256,7 +256,7 @@ while (Start != BB.begin() && prior(Start) != PrevI) --Start; cerr << "Inserted instructions:\n\t"; Start->print(*cerr.stream(), &MF.getTarget()); - while (++Start != next(I)); + while (++Start != next(I)) {} } dumpStack(); ); From baldrick at free.fr Tue Sep 11 09:10:24 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 11 Sep 2007 14:10:24 -0000 Subject: [llvm-commits] [llvm] r41841 - in /llvm/trunk: docs/ include/llvm/ include/llvm/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ Message-ID: <200709111410.l8BEAPY1031467@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 11 09:10:23 2007 New Revision: 41841 URL: http://llvm.org/viewvc/llvm-project?rev=41841&view=rev Log: Fold the adjust_trampoline intrinsic into init_trampoline. There is now only one trampoline intrinsic. Modified: llvm/trunk/docs/LangRef.html llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/include/llvm/Intrinsics.td llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Tue Sep 11 09:10:23 2007 @@ -200,10 +200,9 @@
  • 'llvm.memory.barrier' Intrinsic
  • -
  • Trampoline Intrinsics +
  • Trampoline Intrinsic
    1. 'llvm.init.trampoline' Intrinsic
    2. -
    3. 'llvm.adjust.trampoline' Intrinsic
  • General intrinsics @@ -5149,12 +5148,12 @@

    - These intrinsics make it possible to excise one parameter, marked with + This intrinsic makes it possible to excise one parameter, marked with the nest attribute, from a function. The result is a callable function pointer lacking the nest parameter - the caller does not need to provide a value for it. Instead, the value to use is stored in @@ -5168,11 +5167,10 @@ i32 f(i8* nest %c, i32 %x, i32 %y) then the resulting function pointer has signature i32 (i32, i32)*. It can be created as follows:

    -  %tramp1 = alloca [10 x i8], align 4 ; size and alignment only correct for X86
    -  %tramp = getelementptr [10 x i8]* %tramp1, i32 0, i32 0
    -  call void @llvm.init.trampoline( i8* %tramp, i8* bitcast (i32 (i8* nest , i32, i32)* @f to i8*), i8* %nval )
    -  %adj = call i8* @llvm.adjust.trampoline( i8* %tramp )
    -  %fp = bitcast i8* %adj to i32 (i32, i32)*
    +  %tramp = alloca [10 x i8], align 4 ; size and alignment only correct for X86
    +  %tramp1 = getelementptr [10 x i8]* %tramp, i32 0, i32 0
    +  %p = call i8* @llvm.init.trampoline( i8* %tramp1, i8* bitcast (i32 (i8* nest , i32, i32)* @f to i8*), i8* %nval )
    +  %fp = bitcast i8* %p to i32 (i32, i32)*
     
    The call %val = call i32 %fp( i32 %x, i32 %y ) is then equivalent to %val = call i32 %f( i8* %nval, i32 %x, i32 %y ). @@ -5186,11 +5184,12 @@
    Syntax:
    -declare void @llvm.init.trampoline(i8* <tramp>, i8* <func>, i8* <nval>)
    +declare i8* @llvm.init.trampoline(i8* <tramp>, i8* <func>, i8* <nval>)
     
    Overview:

    - This initializes the memory pointed to by tramp as a trampoline. + This fills the memory pointed to by tramp with code + and returns a function pointer suitable for executing it.

    Arguments:

    @@ -5205,42 +5204,18 @@

    Semantics:

    The block of memory pointed to by tramp is filled with target - dependent code, turning it into a function. - The new function's signature is the same as that of func with - any arguments marked with the nest attribute removed. At most - one such nest argument is allowed, and it must be of pointer - type. Calling the new function is equivalent to calling func - with the same argument list, but with nval used for the missing - nest argument. -

    -
    - - - -
    -
    Syntax:
    -
    -declare i8* @llvm.adjust.trampoline(i8* <tramp>)
    -
    -
    Overview:
    -

    - This intrinsic returns a function pointer suitable for executing - the trampoline code pointed to by tramp. -

    -
    Arguments:
    -

    - The llvm.adjust.trampoline takes one argument, a pointer to a - trampoline initialized by the - 'llvm.init.trampoline' intrinsic. -

    -
    Semantics:
    -

    - A function pointer that can be used to execute the trampoline code in - tramp is returned. The returned value should be bitcast to an + dependent code, turning it into a function. A pointer to this function is + returned, but needs to be bitcast to an appropriate function pointer type - before being called. + before being called. The new function's signature is the same as that of + func with any arguments marked with the nest attribute + removed. At most one such nest argument is allowed, and it must be + of pointer type. Calling the new function is equivalent to calling + func with the same argument list, but with nval used for the + missing nest argument. If, after calling + llvm.init.trampoline, the memory pointed to by tramp is + modified, then the effect of any later call to the returned function pointer is + undefined.

    Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Tue Sep 11 09:10:23 2007 @@ -540,16 +540,13 @@ // produces a token chain as output. DEBUG_LOC, - // ADJUST_TRAMP - This corresponds to the adjust_trampoline intrinsic. - // It takes a value as input and returns a value as output. - ADJUST_TRAMP, - // TRAMPOLINE - This corresponds to the init_trampoline intrinsic. // It takes as input a token chain, the pointer to the trampoline, // the pointer to the nested function, the pointer to pass for the // 'nest' parameter, a SRCVALUE for the trampoline and another for // the nested function (allowing targets to access the original - // Function*). It produces a token chain as output. + // Function*). It produces the result of the intrinsic and a token + // chain as output. TRAMPOLINE, // BUILTIN_OP_END - This must be the last enum value in this list. Modified: llvm/trunk/include/llvm/Intrinsics.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/include/llvm/Intrinsics.td (original) +++ llvm/trunk/include/llvm/Intrinsics.td Tue Sep 11 09:10:23 2007 @@ -243,11 +243,9 @@ //===------------------------ Trampoline Intrinsics -----------------------===// // -def int_init_trampoline : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_ptr_ty, - llvm_ptr_ty], []>, - GCCBuiltin<"__builtin_init_trampoline">; -def int_adjust_trampoline : Intrinsic<[llvm_ptr_ty, llvm_ptr_ty], [IntrNoMem]>, - GCCBuiltin<"__builtin_adjust_trampoline">; +def int_init_trampoline : Intrinsic<[llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty, + llvm_ptr_ty], []>, + GCCBuiltin<"__builtin_init_trampoline">; //===----------------------------------------------------------------------===// // Target-specific intrinsics Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Sep 11 09:10:23 2007 @@ -3384,21 +3384,6 @@ } break; } - case ISD::ADJUST_TRAMP: { - Tmp1 = LegalizeOp(Node->getOperand(0)); - switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) { - default: assert(0 && "This action is not supported yet!"); - case TargetLowering::Custom: - Result = DAG.UpdateNodeOperands(Result, Tmp1); - Result = TLI.LowerOperation(Result, DAG); - if (Result.Val) break; - // FALL THROUGH - case TargetLowering::Expand: - Result = Tmp1; - break; - } - break; - } case ISD::TRAMPOLINE: { SDOperand Ops[6]; for (unsigned i = 0; i != 6; ++i) @@ -3407,7 +3392,14 @@ // The only option for this node is to custom lower it. Result = TLI.LowerOperation(Result, DAG); assert(Result.Val && "Should always custom lower!"); - break; + + // Since trampoline produces two values, make sure to remember that we + // legalized both of them. + Tmp1 = LegalizeOp(Result.getValue(1)); + Result = LegalizeOp(Result); + AddLegalizedOperand(SDOperand(Node, 0), Result); + AddLegalizedOperand(SDOperand(Node, 1), Tmp1); + return Op.ResNo ? Tmp1 : Result; } } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 11 09:10:23 2007 @@ -3643,8 +3643,7 @@ case ISD::DEBUG_LOC: return "debug_loc"; // Trampolines - case ISD::ADJUST_TRAMP: return "adjust_tramp"; - case ISD::TRAMPOLINE: return "trampoline"; + case ISD::TRAMPOLINE: return "trampoline"; case ISD::CONDCODE: switch (cast(this)->get()) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Sep 11 09:10:23 2007 @@ -2881,12 +2881,6 @@ // Discard annotate attributes return 0; - case Intrinsic::adjust_trampoline: { - SDOperand Arg = getValue(I.getOperand(1)); - setValue(&I, DAG.getNode(ISD::ADJUST_TRAMP, TLI.getPointerTy(), Arg)); - return 0; - } - case Intrinsic::init_trampoline: { const Function *F = cast(IntrinsicInst::StripPointerCasts(I.getOperand(2))); @@ -2899,7 +2893,13 @@ Ops[4] = DAG.getSrcValue(I.getOperand(1)); Ops[5] = DAG.getSrcValue(F); - DAG.setRoot(DAG.getNode(ISD::TRAMPOLINE, MVT::Other, Ops, 6)); + SDOperand Tmp = DAG.getNode(ISD::TRAMPOLINE, + DAG.getNodeValueTypes(TLI.getPointerTy(), + MVT::Other), 2, + Ops, 6); + + setValue(&I, Tmp); + DAG.setRoot(Tmp.getValue(1)); return 0; } } Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Tue Sep 11 09:10:23 2007 @@ -191,11 +191,6 @@ setOperationAction(ISD::MEMCPY , MVT::Other, Custom); setOperationAction(ISD::MEMMOVE , MVT::Other, Expand); - if (Subtarget->isThumb()) - setOperationAction(ISD::ADJUST_TRAMP, MVT::i32, Custom); - else - setOperationAction(ISD::ADJUST_TRAMP, MVT::i32, Expand); - // Use the default implementation. setOperationAction(ISD::VASTART , MVT::Other, Expand); setOperationAction(ISD::VAARG , MVT::Other, Expand); @@ -1418,14 +1413,6 @@ return Chain; } -SDOperand ARMTargetLowering::LowerADJUST_TRAMP(SDOperand Op, - SelectionDAG &DAG) { - // Thumb trampolines should be entered in thumb mode, so set the bottom bit - // of the address. - return DAG.getNode(ISD::OR, MVT::i32, Op.getOperand(0), - DAG.getConstant(1, MVT::i32)); -} - SDOperand ARMTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { switch (Op.getOpcode()) { default: assert(0 && "Don't know how to custom lower this!"); abort(); @@ -1457,7 +1444,6 @@ case ISD::FRAMEADDR: break; case ISD::GLOBAL_OFFSET_TABLE: return LowerGLOBAL_OFFSET_TABLE(Op, DAG); case ISD::MEMCPY: return LowerMEMCPY(Op, DAG); - case ISD::ADJUST_TRAMP: return LowerADJUST_TRAMP(Op, DAG); } return SDOperand(); } Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Tue Sep 11 09:10:23 2007 @@ -138,7 +138,6 @@ SDOperand LowerFORMAL_ARGUMENTS(SDOperand Op, SelectionDAG &DAG); SDOperand LowerBR_JT(SDOperand Op, SelectionDAG &DAG); SDOperand LowerMEMCPY(SDOperand Op, SelectionDAG &DAG); - SDOperand LowerADJUST_TRAMP(SDOperand Op, SelectionDAG &DAG); }; } Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Tue Sep 11 09:10:23 2007 @@ -124,9 +124,6 @@ setOperationAction(ISD::ExternalSymbol, MVT::i64, Custom); setOperationAction(ISD::GlobalTLSAddress, MVT::i64, Custom); - setOperationAction(ISD::ADJUST_TRAMP, MVT::i32, Expand); - setOperationAction(ISD::ADJUST_TRAMP, MVT::i64, Expand); - setOperationAction(ISD::VASTART, MVT::Other, Custom); setOperationAction(ISD::VAEND, MVT::Other, Expand); setOperationAction(ISD::VACOPY, MVT::Other, Custom); Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Tue Sep 11 09:10:23 2007 @@ -97,8 +97,6 @@ setOperationAction(ISD::ROTR , MVT::i64 , Expand); setOperationAction(ISD::BSWAP, MVT::i64 , Expand); // mux @rev - setOperationAction(ISD::ADJUST_TRAMP, MVT::i64, Expand); - // VASTART needs to be custom lowered to use the VarArgsFrameIndex setOperationAction(ISD::VAARG , MVT::Other, Custom); setOperationAction(ISD::VASTART , MVT::Other, Custom); Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Tue Sep 11 09:10:23 2007 @@ -105,8 +105,6 @@ setOperationAction(ISD::STACKSAVE, MVT::Other, Expand); setOperationAction(ISD::STACKRESTORE, MVT::Other, Expand); - setOperationAction(ISD::ADJUST_TRAMP, MVT::i32, Expand); - setStackPointerRegisterToSaveRestore(Mips::SP); computeRegisterProperties(); } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Tue Sep 11 09:10:23 2007 @@ -171,9 +171,6 @@ // RET must be custom lowered, to meet ABI requirements setOperationAction(ISD::RET , MVT::Other, Custom); - setOperationAction(ISD::ADJUST_TRAMP, MVT::i32, Expand); - setOperationAction(ISD::ADJUST_TRAMP, MVT::i64, Expand); - // VASTART needs to be custom lowered to use the VarArgsFrameIndex setOperationAction(ISD::VASTART , MVT::Other, Custom); Modified: llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp Tue Sep 11 09:10:23 2007 @@ -216,8 +216,6 @@ // RET must be custom lowered, to meet ABI requirements setOperationAction(ISD::RET , MVT::Other, Custom); - setOperationAction(ISD::ADJUST_TRAMP, MVT::i32, Expand); - // VASTART needs to be custom lowered to use the VarArgsFrameIndex. setOperationAction(ISD::VASTART , MVT::Other, Custom); // VAARG needs to be lowered to not do unaligned accesses for doubles. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=41841&r1=41840&r2=41841&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Sep 11 09:10:23 2007 @@ -246,9 +246,7 @@ } setOperationAction(ISD::FRAME_TO_ARGS_OFFSET, MVT::i32, Custom); - setOperationAction(ISD::ADJUST_TRAMP, MVT::i32, Expand); - setOperationAction(ISD::ADJUST_TRAMP, MVT::i64, Expand); - setOperationAction(ISD::TRAMPOLINE, MVT::Other, Custom); + setOperationAction(ISD::TRAMPOLINE, MVT::Other, Custom); // VASTART needs to be custom lowered to use the VarArgsFrameIndex setOperationAction(ISD::VASTART , MVT::Other, Custom); @@ -4406,7 +4404,9 @@ OutChains[3] = DAG.getStore(Root, Disp, Addr, TrmpSV->getValue(), TrmpSV->getOffset() + 6, false, 1); - return DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains, 4); + SDOperand Ops[] = + { Trmp, DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains, 4) }; + return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(), Ops, 2); } } From baldrick at free.fr Tue Sep 11 09:18:58 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 11 Sep 2007 14:18:58 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41842 - in /llvm-gcc-4.0/trunk/gcc: builtins.c builtins.def llvm-convert.cpp llvm-internal.h tree-nested.c tree.c Message-ID: <200709111418.l8BEIwCW031778@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 11 09:18:58 2007 New Revision: 41842 URL: http://llvm.org/viewvc/llvm-project?rev=41842&view=rev Log: Fold adjust_trampoline into init_trampoline. Store the function pointer for the trampoline in the frame struct rather than the trampoline itself. Modified: llvm-gcc-4.0/trunk/gcc/builtins.c llvm-gcc-4.0/trunk/gcc/builtins.def llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp llvm-gcc-4.0/trunk/gcc/llvm-internal.h llvm-gcc-4.0/trunk/gcc/tree-nested.c llvm-gcc-4.0/trunk/gcc/tree.c Modified: llvm-gcc-4.0/trunk/gcc/builtins.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/builtins.c?rev=41842&r1=41841&r2=41842&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/builtins.c (original) +++ llvm-gcc-4.0/trunk/gcc/builtins.c Tue Sep 11 09:18:58 2007 @@ -4986,25 +4986,13 @@ trampolines_created = 1; INITIALIZE_TRAMPOLINE (r_tramp, r_func, r_chain); - return const0_rtx; -} - -static rtx -expand_builtin_adjust_trampoline (tree arglist) -{ - rtx tramp; - - if (!validate_arglist (arglist, POINTER_TYPE, VOID_TYPE)) - return NULL_RTX; - - tramp = expand_expr (TREE_VALUE (arglist), NULL_RTX, VOIDmode, 0); - tramp = round_trampoline_addr (tramp); #ifdef TRAMPOLINE_ADJUST_ADDRESS - TRAMPOLINE_ADJUST_ADDRESS (tramp); + TRAMPOLINE_ADJUST_ADDRESS (r_tramp); #endif - return tramp; + return r_tramp; } +/* LLVM local end */ /* Expand a call to the built-in signbit, signbitf or signbitl function. Return NULL_RTX if a normal call should be emitted rather than expanding @@ -5784,8 +5772,7 @@ case BUILT_IN_INIT_TRAMPOLINE: return expand_builtin_init_trampoline (arglist); - case BUILT_IN_ADJUST_TRAMPOLINE: - return expand_builtin_adjust_trampoline (arglist); + /* LLVM local deleted 2 lines */ case BUILT_IN_FORK: case BUILT_IN_EXECL: Modified: llvm-gcc-4.0/trunk/gcc/builtins.def URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/builtins.def?rev=41842&r1=41841&r2=41842&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/builtins.def (original) +++ llvm-gcc-4.0/trunk/gcc/builtins.def Tue Sep 11 09:18:58 2007 @@ -635,7 +635,7 @@ /* Implementing nested functions. */ DEF_BUILTIN_STUB (BUILT_IN_INIT_TRAMPOLINE, "__builtin_init_trampoline") -DEF_BUILTIN_STUB (BUILT_IN_ADJUST_TRAMPOLINE, "__builtin_adjust_trampoline") +/* LLVM local deleted 1 line */ DEF_BUILTIN_STUB (BUILT_IN_NONLOCAL_GOTO, "__builtin_nonlocal_goto") /* Implementing variable sized local variables. */ Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=41842&r1=41841&r2=41842&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Tue Sep 11 09:18:58 2007 @@ -4274,9 +4274,7 @@ case BUILT_IN_FROB_RETURN_ADDR: return EmitBuiltinFrobReturnAddr(exp, Result); case BUILT_IN_INIT_TRAMPOLINE: - return EmitBuiltinInitTrampoline(exp); - case BUILT_IN_ADJUST_TRAMPOLINE: - return EmitBuiltinAdjustTrampoline(exp, Result); + return EmitBuiltinInitTrampoline(exp, Result); // Builtins used by the exception handling runtime. case BUILT_IN_DWARF_CFA: @@ -4936,7 +4934,7 @@ return true; } -bool TreeToLLVM::EmitBuiltinInitTrampoline(tree exp) { +bool TreeToLLVM::EmitBuiltinInitTrampoline(tree exp, Value *&Result) { tree arglist = TREE_OPERAND(exp, 1); if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) @@ -4957,22 +4955,7 @@ Function *Intr = Intrinsic::getDeclaration(TheModule, Intrinsic::init_trampoline); - Builder.CreateCall(Intr, Ops, Ops+3); - return true; -} - -bool TreeToLLVM::EmitBuiltinAdjustTrampoline(tree exp, Value *&Result) { - tree arglist = TREE_OPERAND(exp, 1); - if (!validate_arglist(arglist, POINTER_TYPE, VOID_TYPE)) - return false; - - Value *Tramp = Emit(TREE_VALUE(arglist), 0); - Tramp = CastToType(Instruction::BitCast, Tramp, - PointerType::get(Type::Int8Ty)); - - Function *Intr = Intrinsic::getDeclaration(TheModule, - Intrinsic::adjust_trampoline); - Result = Builder.CreateCall(Intr, Tramp, "adj"); + Result = Builder.CreateCall(Intr, Ops, Ops+3, "tramp"); return true; } Modified: llvm-gcc-4.0/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-internal.h?rev=41842&r1=41841&r2=41842&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-internal.h Tue Sep 11 09:18:58 2007 @@ -583,8 +583,7 @@ bool EmitBuiltinEHReturn(tree_node *exp, Value *&Result); bool EmitBuiltinInitDwarfRegSizes(tree_node *exp, Value *&Result); bool EmitBuiltinUnwindInit(tree_node *exp, Value *&Result); - bool EmitBuiltinInitTrampoline(tree_node *exp); - bool EmitBuiltinAdjustTrampoline(tree_node *exp, Value *&Result); + bool EmitBuiltinInitTrampoline(tree_node *exp, Value *&Result); // Complex Math Expressions. void EmitLoadFromComplex(Value *&Real, Value *&Imag, Value *SrcComplex, Modified: llvm-gcc-4.0/trunk/gcc/tree-nested.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/tree-nested.c?rev=41842&r1=41841&r2=41842&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/tree-nested.c (original) +++ llvm-gcc-4.0/trunk/gcc/tree-nested.c Tue Sep 11 09:18:58 2007 @@ -395,16 +395,20 @@ /* Build or return the type used to represent a nested function trampoline. */ -static GTY(()) tree trampoline_type; +/* LLVM local */ +static GTY(()) tree trampoline_storage_type; static tree -get_trampoline_type (void) +/* LLVM local */ +get_trampoline_storage_type (void) { tree record, t; unsigned align, size; - if (trampoline_type) - return trampoline_type; + /* LLVM local begin */ + if (trampoline_storage_type) + return trampoline_storage_type; + /* LLVM local end */ align = TRAMPOLINE_ALIGNMENT; size = TRAMPOLINE_SIZE; @@ -460,8 +464,9 @@ { field = make_node (FIELD_DECL); DECL_NAME (field) = DECL_NAME (decl); - TREE_TYPE (field) = get_trampoline_type (); - TREE_ADDRESSABLE (field) = 1; + /* LLVM local begin */ + TREE_TYPE (field) = TYPE_POINTER_TO (TREE_TYPE (decl)); + /* LLVM local end */ insert_field_into_struct (get_frame_type (info), field); @@ -1190,17 +1195,14 @@ { struct walk_stmt_info *wi = data; struct nesting_info *info = wi->info, *i; - tree t = *tp, decl, target_context, x, arg; + /* LLVM local */ + tree t = *tp, decl, target_context, x; *walk_subtrees = 0; switch (TREE_CODE (t)) { case ADDR_EXPR: - /* Build - T.1 = &CHAIN->tramp; - T.2 = __builtin_adjust_trampoline (T.1); - T.3 = (func_type)T.2; - */ + /* LLVM local deleted 5 lines */ decl = TREE_OPERAND (t, 0); if (TREE_CODE (decl) != FUNCTION_DECL) @@ -1220,22 +1222,12 @@ we need to insert the trampoline. */ for (i = info; i->context != target_context; i = i->outer) continue; - x = lookup_tramp_for_decl (i, decl, INSERT); + /* LLVM local begin */ - /* Compute the address of the field holding the trampoline. */ + /* Lookup the trampoline. */ + x = lookup_tramp_for_decl (i, decl, INSERT); x = get_frame_field (info, target_context, x, &wi->tsi); - x = build_addr (x); - x = tsi_gimplify_val (info, x, &wi->tsi); - arg = tree_cons (NULL, x, NULL); - - /* Do machine-specific ugliness. Normally this will involve - computing extra alignment, but it can really be anything. */ - x = implicit_built_in_decls[BUILT_IN_ADJUST_TRAMPOLINE]; - x = build_function_call_expr (x, arg); - x = init_tmp_var (info, x, &wi->tsi); - - /* Cast back to the proper function type. */ - x = build1 (NOP_EXPR, TREE_TYPE (t), x); + /* LLVM local end */ x = init_tmp_var (info, x, &wi->tsi); *tp = x; @@ -1390,7 +1382,8 @@ struct nesting_info *i; for (i = root->inner; i ; i = i->next) { - tree arg, x, field; + /* LLVM local */ + tree arg, x, y, field; field = lookup_tramp_for_decl (root, i->context, NO_INSERT); if (!field) @@ -1405,13 +1398,27 @@ x = build_addr (i->context); arg = tree_cons (NULL, x, arg); - x = build (COMPONENT_REF, TREE_TYPE (field), - root->frame_decl, field, NULL_TREE); - x = build_addr (x); + /* LLVM local begin */ + /* Create a local variable to hold the trampoline code. */ + y = create_tmp_var_for (root, get_trampoline_storage_type(), + "TRAMP"); + x = build_addr (y); arg = tree_cons (NULL, x, arg); x = implicit_built_in_decls[BUILT_IN_INIT_TRAMPOLINE]; x = build_function_call_expr (x, arg); + y = create_tmp_var_for (root, TREE_TYPE(x), NULL); + x = build2 (MODIFY_EXPR, TREE_TYPE (x), y, x); + append_to_statement_list (x, &stmt_list); + + /* Cast back to the proper function type. */ + y = build1 (NOP_EXPR, TREE_TYPE (field), y); + + /* Initialize the trampoline. */ + x = build3 (COMPONENT_REF, TREE_TYPE (field), + root->frame_decl, field, NULL_TREE); + x = build2 (MODIFY_EXPR, TREE_TYPE (field), x, y); + /* LLVM local end */ append_to_statement_list (x, &stmt_list); } Modified: llvm-gcc-4.0/trunk/gcc/tree.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/tree.c?rev=41842&r1=41841&r2=41842&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/tree.c (original) +++ llvm-gcc-4.0/trunk/gcc/tree.c Tue Sep 11 09:18:58 2007 @@ -6001,17 +6001,12 @@ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (void_type_node, tmp); + /* LLVM local begin */ + ftype = build_function_type (ptr_type_node, tmp); local_define_builtin ("__builtin_init_trampoline", ftype, BUILT_IN_INIT_TRAMPOLINE, "__builtin_init_trampoline", ECF_NOTHROW); - - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (ptr_type_node, tmp); - local_define_builtin ("__builtin_adjust_trampoline", ftype, - BUILT_IN_ADJUST_TRAMPOLINE, - "__builtin_adjust_trampoline", - ECF_CONST | ECF_NOTHROW); + /* LLVM local end */ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); From baldrick at free.fr Tue Sep 11 09:22:57 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 11 Sep 2007 14:22:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41843 - in /llvm-gcc-4.2/trunk/gcc: builtins.c builtins.def llvm-convert.cpp llvm-internal.h tree-nested.c tree.c Message-ID: <200709111422.l8BEMvXZ032011@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 11 09:22:56 2007 New Revision: 41843 URL: http://llvm.org/viewvc/llvm-project?rev=41843&view=rev Log: Fold adjust_trampoline into init_trampoline. Store the function pointer for the trampoline in the frame struct rather than the trampoline itself. Modified: llvm-gcc-4.2/trunk/gcc/builtins.c llvm-gcc-4.2/trunk/gcc/builtins.def llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-internal.h llvm-gcc-4.2/trunk/gcc/tree-nested.c llvm-gcc-4.2/trunk/gcc/tree.c Modified: llvm-gcc-4.2/trunk/gcc/builtins.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/builtins.c?rev=41843&r1=41842&r2=41843&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/builtins.c (original) +++ llvm-gcc-4.2/trunk/gcc/builtins.c Tue Sep 11 09:22:56 2007 @@ -5281,25 +5281,14 @@ trampolines_created = 1; INITIALIZE_TRAMPOLINE (r_tramp, r_func, r_chain); - return const0_rtx; -} - -static rtx -expand_builtin_adjust_trampoline (tree arglist) -{ - rtx tramp; - - if (!validate_arglist (arglist, POINTER_TYPE, VOID_TYPE)) - return NULL_RTX; - - tramp = expand_normal (TREE_VALUE (arglist)); - tramp = round_trampoline_addr (tramp); +/* LLVM local begin */ #ifdef TRAMPOLINE_ADJUST_ADDRESS - TRAMPOLINE_ADJUST_ADDRESS (tramp); + TRAMPOLINE_ADJUST_ADDRESS (r_tramp); #endif - return tramp; + return r_tramp; } +/* LLVM local end */ /* Expand a call to the built-in signbit, signbitf or signbitl function. Return NULL_RTX if a normal call should be emitted rather than expanding @@ -6285,8 +6274,7 @@ case BUILT_IN_INIT_TRAMPOLINE: return expand_builtin_init_trampoline (arglist); - case BUILT_IN_ADJUST_TRAMPOLINE: - return expand_builtin_adjust_trampoline (arglist); + /* LLVM local deleted 2 lines */ case BUILT_IN_FORK: case BUILT_IN_EXECL: Modified: llvm-gcc-4.2/trunk/gcc/builtins.def URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/builtins.def?rev=41843&r1=41842&r2=41843&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/builtins.def (original) +++ llvm-gcc-4.2/trunk/gcc/builtins.def Tue Sep 11 09:22:56 2007 @@ -691,7 +691,7 @@ /* Implementing nested functions. */ DEF_BUILTIN_STUB (BUILT_IN_INIT_TRAMPOLINE, "__builtin_init_trampoline") -DEF_BUILTIN_STUB (BUILT_IN_ADJUST_TRAMPOLINE, "__builtin_adjust_trampoline") +/* LLVM local deleted 1 line */ DEF_BUILTIN_STUB (BUILT_IN_NONLOCAL_GOTO, "__builtin_nonlocal_goto") /* Implementing __builtin_setjmp. */ Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=41843&r1=41842&r2=41843&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Sep 11 09:22:56 2007 @@ -3845,9 +3845,7 @@ case BUILT_IN_FROB_RETURN_ADDR: return EmitBuiltinFrobReturnAddr(exp, Result); case BUILT_IN_INIT_TRAMPOLINE: - return EmitBuiltinInitTrampoline(exp); - case BUILT_IN_ADJUST_TRAMPOLINE: - return EmitBuiltinAdjustTrampoline(exp, Result); + return EmitBuiltinInitTrampoline(exp, Result); // Builtins used by the exception handling runtime. case BUILT_IN_DWARF_CFA: @@ -4513,7 +4511,7 @@ return true; } -bool TreeToLLVM::EmitBuiltinInitTrampoline(tree exp) { +bool TreeToLLVM::EmitBuiltinInitTrampoline(tree exp, Value *&Result) { tree arglist = TREE_OPERAND(exp, 1); if (!validate_arglist (arglist, POINTER_TYPE, POINTER_TYPE, POINTER_TYPE, VOID_TYPE)) @@ -4534,22 +4532,7 @@ Function *Intr = Intrinsic::getDeclaration(TheModule, Intrinsic::init_trampoline); - Builder.CreateCall(Intr, Ops, Ops+3); - return true; -} - -bool TreeToLLVM::EmitBuiltinAdjustTrampoline(tree exp, Value *&Result) { - tree arglist = TREE_OPERAND(exp, 1); - if (!validate_arglist(arglist, POINTER_TYPE, VOID_TYPE)) - return false; - - Value *Tramp = Emit(TREE_VALUE(arglist), 0); - Tramp = CastToType(Instruction::BitCast, Tramp, - PointerType::get(Type::Int8Ty)); - - Function *Intr = Intrinsic::getDeclaration(TheModule, - Intrinsic::adjust_trampoline); - Result = Builder.CreateCall(Intr, Tramp, "adj"); + Result = Builder.CreateCall(Intr, Ops, Ops+3, "tramp"); return true; } Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=41843&r1=41842&r2=41843&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Tue Sep 11 09:22:56 2007 @@ -527,8 +527,7 @@ bool EmitBuiltinEHReturn(tree_node *exp, Value *&Result); bool EmitBuiltinInitDwarfRegSizes(tree_node *exp, Value *&Result); bool EmitBuiltinUnwindInit(tree_node *exp, Value *&Result); - bool EmitBuiltinInitTrampoline(tree_node *exp); - bool EmitBuiltinAdjustTrampoline(tree_node *exp, Value *&Result); + bool EmitBuiltinInitTrampoline(tree_node *exp, Value *&Result); // Complex Math Expressions. void EmitLoadFromComplex(Value *&Real, Value *&Imag, Value *SrcComplex, Modified: llvm-gcc-4.2/trunk/gcc/tree-nested.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-nested.c?rev=41843&r1=41842&r2=41843&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree-nested.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree-nested.c Tue Sep 11 09:22:56 2007 @@ -425,16 +425,20 @@ /* Build or return the type used to represent a nested function trampoline. */ -static GTY(()) tree trampoline_type; +/* LLVM local */ +static GTY(()) tree trampoline_storage_type; static tree -get_trampoline_type (void) +/* LLVM local */ +get_trampoline_storage_type (void) { tree record, t; unsigned align, size; - if (trampoline_type) - return trampoline_type; + /* LLVM local begin */ + if (trampoline_storage_type) + return trampoline_storage_type; + /* LLVM local end */ align = TRAMPOLINE_ALIGNMENT; size = TRAMPOLINE_SIZE; @@ -490,8 +494,9 @@ { field = make_node (FIELD_DECL); DECL_NAME (field) = DECL_NAME (decl); - TREE_TYPE (field) = get_trampoline_type (); - TREE_ADDRESSABLE (field) = 1; + /* LLVM local begin */ + TREE_TYPE (field) = TYPE_POINTER_TO (TREE_TYPE (decl)); + /* LLVM local end */ insert_field_into_struct (get_frame_type (info), field); @@ -1618,17 +1623,14 @@ { struct walk_stmt_info *wi = (struct walk_stmt_info *) data; struct nesting_info *info = wi->info, *i; - tree t = *tp, decl, target_context, x, arg; + /* LLVM local */ + tree t = *tp, decl, target_context, x; *walk_subtrees = 0; switch (TREE_CODE (t)) { case ADDR_EXPR: - /* Build - T.1 = &CHAIN->tramp; - T.2 = __builtin_adjust_trampoline (T.1); - T.3 = (func_type)T.2; - */ + /* LLVM local deleted 5 lines */ decl = TREE_OPERAND (t, 0); if (TREE_CODE (decl) != FUNCTION_DECL) @@ -1648,22 +1650,12 @@ we need to insert the trampoline. */ for (i = info; i->context != target_context; i = i->outer) continue; - x = lookup_tramp_for_decl (i, decl, INSERT); + /* LLVM local begin */ - /* Compute the address of the field holding the trampoline. */ + /* Lookup the trampoline. */ + x = lookup_tramp_for_decl (i, decl, INSERT); x = get_frame_field (info, target_context, x, &wi->tsi); - x = build_addr (x, target_context); - x = tsi_gimplify_val (info, x, &wi->tsi); - arg = tree_cons (NULL, x, NULL); - - /* Do machine-specific ugliness. Normally this will involve - computing extra alignment, but it can really be anything. */ - x = implicit_built_in_decls[BUILT_IN_ADJUST_TRAMPOLINE]; - x = build_function_call_expr (x, arg); - x = init_tmp_var (info, x, &wi->tsi); - - /* Cast back to the proper function type. */ - x = build1 (NOP_EXPR, TREE_TYPE (t), x); + /* LLVM local end */ x = init_tmp_var (info, x, &wi->tsi); *tp = x; @@ -1858,7 +1850,8 @@ struct nesting_info *i; for (i = root->inner; i ; i = i->next) { - tree arg, x, field; + /* LLVM local */ + tree arg, x, y, field; field = lookup_tramp_for_decl (root, i->context, NO_INSERT); if (!field) @@ -1873,13 +1866,27 @@ x = build_addr (i->context, context); arg = tree_cons (NULL, x, arg); - x = build3 (COMPONENT_REF, TREE_TYPE (field), - root->frame_decl, field, NULL_TREE); - x = build_addr (x, context); + /* LLVM local begin */ + /* Create a local variable to hold the trampoline code. */ + y = create_tmp_var_for (root, get_trampoline_storage_type(), + "TRAMP"); + x = build_addr (y, context); arg = tree_cons (NULL, x, arg); x = implicit_built_in_decls[BUILT_IN_INIT_TRAMPOLINE]; x = build_function_call_expr (x, arg); + y = create_tmp_var_for (root, TREE_TYPE(x), NULL); + x = build2 (MODIFY_EXPR, TREE_TYPE (x), y, x); + append_to_statement_list (x, &stmt_list); + + /* Cast back to the proper function type. */ + y = build1 (NOP_EXPR, TREE_TYPE (field), y); + + /* Initialize the trampoline. */ + x = build3 (COMPONENT_REF, TREE_TYPE (field), + root->frame_decl, field, NULL_TREE); + x = build2 (MODIFY_EXPR, TREE_TYPE (field), x, y); + /* LLVM local end */ append_to_statement_list (x, &stmt_list); } Modified: llvm-gcc-4.2/trunk/gcc/tree.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree.c?rev=41843&r1=41842&r2=41843&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree.c Tue Sep 11 09:22:56 2007 @@ -6772,17 +6772,12 @@ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (void_type_node, tmp); + /* LLVM local begin */ + ftype = build_function_type (ptr_type_node, tmp); local_define_builtin ("__builtin_init_trampoline", ftype, BUILT_IN_INIT_TRAMPOLINE, "__builtin_init_trampoline", ECF_NOTHROW); - - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (ptr_type_node, tmp); - local_define_builtin ("__builtin_adjust_trampoline", ftype, - BUILT_IN_ADJUST_TRAMPOLINE, - "__builtin_adjust_trampoline", - ECF_CONST | ECF_NOTHROW); + /* LLVM local end */ tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); From baldrick at free.fr Tue Sep 11 09:35:43 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 11 Sep 2007 14:35:43 -0000 Subject: [llvm-commits] [llvm] r41844 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200709111435.l8BEZj3w032506@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 11 09:35:41 2007 New Revision: 41844 URL: http://llvm.org/viewvc/llvm-project?rev=41844&view=rev Log: Turn calls to trampolines into calls to the underlying nested function. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=41844&r1=41843&r2=41844&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Sep 11 09:35:41 2007 @@ -39,6 +39,7 @@ #include "llvm/Pass.h" #include "llvm/DerivedTypes.h" #include "llvm/GlobalVariable.h" +#include "llvm/ParameterAttributes.h" #include "llvm/Analysis/ConstantFolding.h" #include "llvm/Target/TargetData.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" @@ -7848,6 +7849,143 @@ } } + if (BitCastInst *BC = dyn_cast(Callee)) { + IntrinsicInst *In = dyn_cast(BC->getOperand(0)); + if (In && In->getIntrinsicID() == Intrinsic::init_trampoline) { + Function *NestF = + cast(IntrinsicInst::StripPointerCasts(In->getOperand(2))); + const PointerType *NestFPTy = cast(NestF->getType()); + const FunctionType *NestFTy = + cast(NestFPTy->getElementType()); + + if (const ParamAttrsList *NestAttrs = NestFTy->getParamAttrs()) { + unsigned NestIdx = 1; + const Type *NestTy = 0; + uint16_t NestAttr; + + Instruction *Caller = CS.getInstruction(); + + // Look for a parameter marked with the 'nest' attribute. + for (FunctionType::param_iterator I = NestFTy->param_begin(), + E = NestFTy->param_end(); I != E; ++NestIdx, ++I) + if (NestAttrs->paramHasAttr(NestIdx, ParamAttr::Nest)) { + // Record the parameter type and any other attributes. + NestTy = *I; + NestAttr = NestAttrs->getParamAttrs(NestIdx); + break; + } + + if (NestTy) { + std::vector NewArgs; + NewArgs.reserve(unsigned(CS.arg_end()-CS.arg_begin())+1); + + // Insert the nest argument into the call argument list, which may + // mean appending it. + { + unsigned Idx = 1; + CallSite::arg_iterator I = CS.arg_begin(), E = CS.arg_end(); + do { + if (Idx == NestIdx) { + // Add the chain argument. + Value *NestVal = In->getOperand(3); + if (NestVal->getType() != NestTy) + NestVal = new BitCastInst(NestVal, NestTy, "nest", Caller); + NewArgs.push_back(NestVal); + } + + if (I == E) + break; + + // Add the original argument. + NewArgs.push_back(*I); + + ++Idx, ++I; + } while (1); + } + + // The trampoline may have been bitcast to a bogus type (FTy). + // Handle this by synthesizing a new function type, equal to FTy + // with the chain parameter inserted. Likewise for attributes. + + const ParamAttrsList *Attrs = FTy->getParamAttrs(); + std::vector NewTypes; + ParamAttrsVector NewAttrs; + NewTypes.reserve(FTy->getNumParams()+1); + + // Add any function result attributes. + uint16_t Attr = Attrs ? Attrs->getParamAttrs(0) : 0; + if (Attr) + NewAttrs.push_back (ParamAttrsWithIndex::get(0, Attr)); + + // Insert the chain's type into the list of parameter types, which may + // mean appending it. Likewise for the chain's attributes. + { + unsigned Idx = 1; + FunctionType::param_iterator I = FTy->param_begin(), + E = FTy->param_end(); + + do { + if (Idx == NestIdx) { + // Add the chain's type and attributes. + NewTypes.push_back(NestTy); + NewAttrs.push_back(ParamAttrsWithIndex::get(NestIdx, NestAttr)); + } + + if (I == E) + break; + + // Add the original type and attributes. + NewTypes.push_back(*I); + Attr = Attrs ? Attrs->getParamAttrs(Idx) : 0; + if (Attr) + NewAttrs.push_back + (ParamAttrsWithIndex::get(Idx + (Idx >= NestIdx), Attr)); + + ++Idx, ++I; + } while (1); + } + + // Replace the trampoline call with a direct call. Let the generic + // code sort out any function type mismatches. + FunctionType *NewFTy = + FunctionType::get(FTy->getReturnType(), NewTypes, FTy->isVarArg(), + ParamAttrsList::get(NewAttrs)); + Constant *NewCallee = NestF->getType() == PointerType::get(NewFTy) ? + NestF : ConstantExpr::getBitCast(NestF, PointerType::get(NewFTy)); + + Instruction *NewCaller; + if (InvokeInst *II = dyn_cast(Caller)) { + NewCaller = new InvokeInst(NewCallee, II->getNormalDest(), + II->getUnwindDest(), NewArgs.begin(), + NewArgs.end(), Caller->getName(), + Caller); + cast(NewCaller)->setCallingConv(II->getCallingConv()); + } else { + NewCaller = new CallInst(NewCallee, NewArgs.begin(), NewArgs.end(), + Caller->getName(), Caller); + if (cast(Caller)->isTailCall()) + cast(NewCaller)->setTailCall(); + cast(NewCaller)-> + setCallingConv(cast(Caller)->getCallingConv()); + } + if (Caller->getType() != Type::VoidTy && !Caller->use_empty()) + Caller->replaceAllUsesWith(NewCaller); + Caller->eraseFromParent(); + RemoveFromWorkList(Caller); + return 0; + } + } + + // Replace the trampoline call with a direct call. Since there is no + // 'nest' parameter, there is no need to adjust the argument list. Let + // the generic code sort out any function type mismatches. + Constant *NewCallee = NestF->getType() == PTy ? + NestF : ConstantExpr::getBitCast(NestF, PTy); + CS.setCalledFunction(NewCallee); + Changed = true; + } + } + return Changed ? CS.getInstruction() : 0; } From baldrick at free.fr Tue Sep 11 09:40:05 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 11 Sep 2007 14:40:05 -0000 Subject: [llvm-commits] [llvm] r41845 - /llvm/trunk/lib/VMCore/Function.cpp Message-ID: <200709111440.l8BEe5jp032706@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 11 09:40:04 2007 New Revision: 41845 URL: http://llvm.org/viewvc/llvm-project?rev=41845&view=rev Log: Two ParamAttrsVectors which differ by a permutation of their elements do not yield the same ParamAttrsList, though they should. On the other hand, everyone seems to pass such vectors with elements ordered by increasing index, so rather than sorting the elements simply assert that the elements are ordered in this way. Modified: llvm/trunk/lib/VMCore/Function.cpp Modified: llvm/trunk/lib/VMCore/Function.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=41845&r1=41844&r2=41845&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Function.cpp (original) +++ llvm/trunk/lib/VMCore/Function.cpp Tue Sep 11 09:40:04 2007 @@ -124,6 +124,10 @@ ParamAttrsList * ParamAttrsList::get(const ParamAttrsVector &attrVec) { assert(!attrVec.empty() && "Illegal to create empty ParamAttrsList"); +#ifndef NDEBUG + for (unsigned i = 1, e = attrVec.size(); i < e; ++i) + assert(attrVec[i-1].index < attrVec[i].index && "Misordered ParamAttrsList!"); +#endif ParamAttrsList key(attrVec); FoldingSetNodeID ID; key.Profile(ID); From baldrick at free.fr Tue Sep 11 10:07:50 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 11 Sep 2007 15:07:50 -0000 Subject: [llvm-commits] [llvm] r41846 - /llvm/trunk/test/Transforms/InstCombine/2007-09-11-Trampoline.ll Message-ID: <200709111507.l8BF7ooO001353@zion.cs.uiuc.edu> Author: baldrick Date: Tue Sep 11 10:07:50 2007 New Revision: 41846 URL: http://llvm.org/viewvc/llvm-project?rev=41846&view=rev Log: Test that a call to a trampoline is turned into a call to the underlying nested function. Added: llvm/trunk/test/Transforms/InstCombine/2007-09-11-Trampoline.ll Added: llvm/trunk/test/Transforms/InstCombine/2007-09-11-Trampoline.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-09-11-Trampoline.ll?rev=41846&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-09-11-Trampoline.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2007-09-11-Trampoline.ll Tue Sep 11 10:07:50 2007 @@ -0,0 +1,24 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {call i32 @f} + + %struct.FRAME.nest = type { i32, i32 (i32)* } + %struct.__builtin_trampoline = type { [10 x i8] } + +declare i8* @llvm.init.trampoline(i8*, i8*, i8*) + +declare i32 @f(%struct.FRAME.nest* nest , i32 ) + +define i32 @nest(i32 %n) { +entry: + %FRAME.0 = alloca %struct.FRAME.nest, align 8 ; <%struct.FRAME.nest*> [#uses=3] + %TRAMP.216 = alloca [10 x i8], align 16 ; <[10 x i8]*> [#uses=1] + %TRAMP.216.sub = getelementptr [10 x i8]* %TRAMP.216, i32 0, i32 0 ; [#uses=1] + %tmp3 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; [#uses=1] + store i32 %n, i32* %tmp3, align 8 + %FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8* ; [#uses=1] + %tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest* nest , i32)* @f to i8*), i8* %FRAME.06 ) ; [#uses=1] + %tmp7 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; [#uses=1] + %tmp89 = bitcast i8* %tramp to i32 (i32)* ; [#uses=2] + store i32 (i32)* %tmp89, i32 (i32)** %tmp7, align 8 + %tmp2.i = call i32 %tmp89( i32 1 ) ; [#uses=1] + ret i32 %tmp2.i +} From sabre at nondot.org Tue Sep 11 12:09:55 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 11 Sep 2007 17:09:55 -0000 Subject: [llvm-commits] [llvm] r41849 - /llvm/trunk/utils/profile.pl Message-ID: <200709111709.l8BH9tp0005406@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 11 12:09:54 2007 New Revision: 41849 URL: http://llvm.org/viewvc/llvm-project?rev=41849&view=rev Log: update this to use llvm-config, patch by Jose M. Moya Modified: llvm/trunk/utils/profile.pl Modified: llvm/trunk/utils/profile.pl URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/profile.pl?rev=41849&r1=41848&r2=41849&view=diff ============================================================================== --- llvm/trunk/utils/profile.pl (original) +++ llvm/trunk/utils/profile.pl Tue Sep 11 12:09:54 2007 @@ -62,11 +62,10 @@ shift @ARGV; -my $LLIPath = `which lli`; -$LLIPath = `dirname $LLIPath`; -chomp $LLIPath; +my $libdir = `llvm-config --libdir`; +chomp $libdir; -my $LibProfPath = $LLIPath . "/../../Debug/lib/profile_rt.so"; +my $LibProfPath = $libdir . "/profile_rt.so"; system "opt -q -f $ProfilePass $BytecodeFile -o $BytecodeFile.inst"; system "lli -fake-argv0 '$BytecodeFile' -load $LibProfPath " . From sabre at nondot.org Tue Sep 11 12:10:52 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 11 Sep 2007 17:10:52 -0000 Subject: [llvm-commits] [llvm] r41850 - /llvm/trunk/runtime/libdummy/ Message-ID: <200709111710.l8BHAqAI005453@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 11 12:10:52 2007 New Revision: 41850 URL: http://llvm.org/viewvc/llvm-project?rev=41850&view=rev Log: remove an obsolete library. Removed: llvm/trunk/runtime/libdummy/ From sabre at nondot.org Tue Sep 11 12:12:32 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 11 Sep 2007 17:12:32 -0000 Subject: [llvm-commits] [llvm] r41851 - /llvm/trunk/runtime/Makefile Message-ID: <200709111712.l8BHCW1t005495@zion.cs.uiuc.edu> Author: lattner Date: Tue Sep 11 12:12:32 2007 New Revision: 41851 URL: http://llvm.org/viewvc/llvm-project?rev=41851&view=rev Log: Reenable libgc and libprofile is explicitly requested. Modified: llvm/trunk/runtime/Makefile Modified: llvm/trunk/runtime/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/Makefile?rev=41851&r1=41850&r2=41851&view=diff ============================================================================== --- llvm/trunk/runtime/Makefile (original) +++ llvm/trunk/runtime/Makefile Tue Sep 11 12:12:32 2007 @@ -10,15 +10,8 @@ LEVEL = .. include $(LEVEL)/Makefile.config -ifeq ($(LLVMGCC_MAJVERS),4) -PARALLEL_DIRS := -install all:: - $(Echo) "Warning: These runtime libraries only need to be built with" - $(Echo) "Warning: llvm-gcc version 3. They are automatically included" - $(Echo) "Warning: with llvm-gcc version 4 and beyond" -else ifneq ($(wildcard $(LLVMGCC)),) -PARALLEL_DIRS := libdummy libprofile GC +PARALLEL_DIRS := libprofile GC else PARALLEL_DIRS := install all :: @@ -33,7 +26,6 @@ ifeq ($(ARCH), Sparc) PARALLEL_DIRS := $(filter-out libprofile, $(PARALLEL_DIRS)) endif -endif include $(LEVEL)/Makefile.common From isanbard at gmail.com Tue Sep 11 12:15:27 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Sep 2007 10:15:27 -0700 Subject: [llvm-commits] [llvm] r41838 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86ATTAsmPrinter.cpp lib/Target/X86/X86AsmPrinter.cpp lib/Target/X86/X86AsmPrinter.h lib/Ta Message-ID: <16e5fdf90709111015o7871785h2b675424767b5973@mail.gmail.com> On 9/11/07, Anton Korobeynikov wrote: > Bill, > > > The personality function on Darwin needs a global stub. We then refer to > > that global stub instead of doing the ".set" thingy we were doing before. > This breaks linux. The problem is indirect encoding of personality > symbol. It shouldn't be so for linux. It seems we need another knob for > it :( > Gar! :-( Okay. I can add a bool of some sort to indicate that one needs the indirect encoding. Sorry about the breakage! -bw From isanbard at gmail.com Tue Sep 11 12:20:55 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Sep 2007 17:20:55 -0000 Subject: [llvm-commits] [llvm] r41852 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp Message-ID: <200709111720.l8BHKuc1005786@zion.cs.uiuc.edu> Author: void Date: Tue Sep 11 12:20:55 2007 New Revision: 41852 URL: http://llvm.org/viewvc/llvm-project?rev=41852&view=rev Log: Add a bool to indicate if we should set the "indirect encoding" bit in the Dwarf information for EH. Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/CodeGen/DwarfWriter.cpp llvm/trunk/lib/Target/TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=41852&r1=41851&r2=41852&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Sep 11 12:20:55 2007 @@ -116,6 +116,11 @@ const char *PersonalityPrefix; // Defaults to "" const char *PersonalitySuffix; // Defaults to "" + /// NeedsIndirectEncoding - If set, we need to set the indirect encoding bit + /// for EH in Dwarf. + /// + bool NeedsIndirectEncoding; // Defaults to false + /// InlineAsmStart/End - If these are nonempty, they contain a directive to /// emit before and after an inline assembly statement. const char *InlineAsmStart; // Defaults to "#APP\n" Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=41852&r1=41851&r2=41852&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Tue Sep 11 12:20:55 2007 @@ -2789,7 +2789,12 @@ if (Personality) { Asm->EmitULEB128Bytes(7); Asm->EOL("Augmentation Size"); - Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect); + + if (TAI->getNeedsIndirectEncoding()) + Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4 | DW_EH_PE_indirect); + else + Asm->EmitInt8(DW_EH_PE_pcrel | DW_EH_PE_sdata4); + Asm->EOL("Personality (pcrel sdata4 indirect)"); PrintRelDirective(); Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=41852&r1=41851&r2=41852&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Tue Sep 11 12:20:55 2007 @@ -40,6 +40,7 @@ FunctionAddrSuffix(""), PersonalityPrefix(""), PersonalitySuffix(""), + NeedsIndirectEncoding(false), InlineAsmStart("#APP"), InlineAsmEnd("#NO_APP"), AssemblerDialect(0), Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=41852&r1=41851&r2=41852&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Tue Sep 11 12:20:55 2007 @@ -70,6 +70,7 @@ } PersonalityPrefix = "L"; PersonalitySuffix = "$non_lazy_ptr"; + NeedsIndirectEncoding = true; InlineAsmStart = "# InlineAsm Start"; InlineAsmEnd = "# InlineAsm End"; SetDirective = "\t.set"; From isanbard at gmail.com Tue Sep 11 12:21:36 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Sep 2007 10:21:36 -0700 Subject: [llvm-commits] [llvm] r41838 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86ATTAsmPrinter.cpp lib/Target/X86/X86AsmPrinter.cpp lib/Target/X86/X86AsmPrinter.h lib/Ta Message-ID: <16e5fdf90709111021x7b3cb033q9f3cd4a4aff0e22b@mail.gmail.com> On 9/11/07, Anton Korobeynikov wrote: > Bill, > > > The personality function on Darwin needs a global stub. We then refer to > > that global stub instead of doing the ".set" thingy we were doing before. > This breaks linux. The problem is indirect encoding of personality > symbol. It shouldn't be so for linux. It seems we need another knob for > it :( > Fixed: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070910/053411.html -bw From isanbard at gmail.com Tue Sep 11 12:24:38 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Sep 2007 17:24:38 -0000 Subject: [llvm-commits] [llvm] r41854 - /llvm/trunk/include/llvm/Target/TargetAsmInfo.h Message-ID: <200709111724.l8BHOcIa005932@zion.cs.uiuc.edu> Author: void Date: Tue Sep 11 12:24:38 2007 New Revision: 41854 URL: http://llvm.org/viewvc/llvm-project?rev=41854&view=rev Log: Add accessor method. Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=41854&r1=41853&r2=41854&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Sep 11 12:24:38 2007 @@ -445,6 +445,9 @@ const char *getPersonalitySuffix() const { return PersonalitySuffix; } + bool getNeedsIndirectEncoding() const { + return NeedsIndirectEncoding; + } const char *getInlineAsmStart() const { return InlineAsmStart; } From dberlin at dberlin.org Tue Sep 11 12:42:22 2007 From: dberlin at dberlin.org (Daniel Berlin) Date: Tue, 11 Sep 2007 17:42:22 -0000 Subject: [llvm-commits] [llvm] r41855 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h Message-ID: <200709111742.l8BHgMs4006467@zion.cs.uiuc.edu> Author: dannyb Date: Tue Sep 11 12:42:22 2007 New Revision: 41855 URL: http://llvm.org/viewvc/llvm-project?rev=41855&view=rev Log: Convert to use ilist and non-pointer lists for extra goodness Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=41855&r1=41854&r2=41855&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original) +++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Tue Sep 11 12:42:22 2007 @@ -17,12 +17,11 @@ #include #include -#include #include #include "llvm/Support/DataTypes.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Support/MathExtras.h" - +#include "llvm/ADT/ilist" namespace llvm { /// SparseBitVector is an implementation of a bitvector that is sparse by only @@ -48,11 +47,35 @@ BITWORDS_PER_ELEMENT = (ElementSize + BITWORD_SIZE - 1) / BITWORD_SIZE, BITS_PER_ELEMENT = ElementSize }; + + SparseBitVectorElement *getNext() const { + return Next; + } + SparseBitVectorElement *getPrev() const { + return Prev; + } + + void setNext(SparseBitVectorElement *RHS) { + Next = RHS; + } + void setPrev(SparseBitVectorElement *RHS) { + Prev = RHS; + } + private: + SparseBitVectorElement *Next; + SparseBitVectorElement *Prev; // Index of Element in terms of where first bit starts. unsigned ElementIndex; BitWord Bits[BITWORDS_PER_ELEMENT]; - SparseBitVectorElement(); + // Needed for sentinels + SparseBitVectorElement() { + ElementIndex = ~0UL; + memset(&Bits[0], 0, sizeof (BitWord) * BITWORDS_PER_ELEMENT); + } + + friend struct ilist_traits >; + public: explicit SparseBitVectorElement(unsigned Idx) { ElementIndex = Idx; @@ -262,12 +285,11 @@ } BecameZero = !allzero; } - }; template class SparseBitVector { - typedef std::list *> ElementList; + typedef ilist > ElementList; typedef typename ElementList::iterator ElementListIter; typedef typename ElementList::const_iterator ElementListConstIter; enum { @@ -294,15 +316,15 @@ // Search from our current iterator, either backwards or forwards, // depending on what element we are looking for. ElementListIter ElementIter = CurrElementIter; - if ((*CurrElementIter)->index() == ElementIndex) { + if (CurrElementIter->index() == ElementIndex) { return ElementIter; - } else if ((*CurrElementIter)->index() > ElementIndex) { + } else if (CurrElementIter->index() > ElementIndex) { while (ElementIter != Elements.begin() - && (*ElementIter)->index() > ElementIndex) + && ElementIter->index() > ElementIndex) --ElementIter; } else { while (ElementIter != Elements.end() && - (*ElementIter)->index() <= ElementIndex) + ElementIter->index() <= ElementIndex) ++ElementIter; --ElementIter; } @@ -339,11 +361,11 @@ return; } Iter = BitVector->Elements.begin(); - BitNumber = (*Iter)->index() * ElementSize; - unsigned BitPos = (*Iter)->find_first(); + BitNumber = Iter->index() * ElementSize; + unsigned BitPos = Iter->find_first(); BitNumber += BitPos; WordNumber = (BitNumber % ElementSize) / BITWORD_SIZE; - Bits = (*Iter)->word(WordNumber); + Bits = Iter->word(WordNumber); Bits >>= BitPos % BITWORD_SIZE; } @@ -359,7 +381,7 @@ // See if we ran out of Bits in this word. if (!Bits) { - int NextSetBitNumber = (*Iter)->find_next(BitNumber % ElementSize) ; + int NextSetBitNumber = Iter->find_next(BitNumber % ElementSize) ; // If we ran out of set bits in this element, move to next element. if (NextSetBitNumber == -1 || (BitNumber % ElementSize == 0)) { ++Iter; @@ -371,15 +393,15 @@ return; } // Set up for next non zero word in bitmap. - BitNumber = (*Iter)->index() * ElementSize; - NextSetBitNumber = (*Iter)->find_first(); + BitNumber = Iter->index() * ElementSize; + NextSetBitNumber = Iter->find_first(); BitNumber += NextSetBitNumber; WordNumber = (BitNumber % ElementSize) / BITWORD_SIZE; - Bits = (*Iter)->word(WordNumber); + Bits = Iter->word(WordNumber); Bits >>= NextSetBitNumber % BITWORD_SIZE; } else { WordNumber = (NextSetBitNumber % ElementSize) / BITWORD_SIZE; - Bits = (*Iter)->word(WordNumber); + Bits = Iter->word(WordNumber); Bits >>= NextSetBitNumber % BITWORD_SIZE; } } @@ -438,17 +460,14 @@ } ~SparseBitVector() { - for_each(Elements.begin(), Elements.end(), - deleter >); } // SparseBitVector copy ctor. SparseBitVector(const SparseBitVector &RHS) { ElementListConstIter ElementIter = RHS.Elements.begin(); while (ElementIter != RHS.Elements.end()) { - SparseBitVectorElement *ElementCopy; - ElementCopy = new SparseBitVectorElement(*(*ElementIter)); - Elements.push_back(ElementCopy); + Elements.push_back(SparseBitVectorElement(*ElementIter)); + ++ElementIter; } CurrElementIter = Elements.begin (); @@ -465,9 +484,9 @@ // If we can't find an element that is supposed to contain this bit, there // is nothing more to do. if (ElementIter == Elements.end() || - (*ElementIter)->index() != ElementIndex) + ElementIter->index() != ElementIndex) return false; - return (*ElementIter)->test(Idx % ElementSize); + return ElementIter->test(Idx % ElementSize); } void reset(unsigned Idx) { @@ -480,38 +499,36 @@ // If we can't find an element that is supposed to contain this bit, there // is nothing more to do. if (ElementIter == Elements.end() || - (*ElementIter)->index() != ElementIndex) + ElementIter->index() != ElementIndex) return; - (*ElementIter)->reset(Idx % ElementSize); + ElementIter->reset(Idx % ElementSize); // When the element is zeroed out, delete it. - if ((*ElementIter)->empty()) { - delete (*ElementIter); + if (ElementIter->empty()) { ++CurrElementIter; Elements.erase(ElementIter); } } void set(unsigned Idx) { - SparseBitVectorElement *Element; unsigned ElementIndex = Idx / ElementSize; - + SparseBitVectorElement *Element; + ElementListIter ElementIter; if (Elements.empty()) { Element = new SparseBitVectorElement(ElementIndex); - Elements.push_back(Element); + ElementIter = Elements.insert(Elements.end(), Element); + } else { - ElementListIter ElementIter = FindLowerBound(ElementIndex); + ElementIter = FindLowerBound(ElementIndex); - if (ElementIter != Elements.end() && - (*ElementIter)->index() == ElementIndex) - Element = *ElementIter; - else { + if (ElementIter == Elements.end() || + ElementIter->index() != ElementIndex) { Element = new SparseBitVectorElement(ElementIndex); // Insert does insert before, and lower bound gives the one before. - Elements.insert(++ElementIter, Element); + ElementIter = Elements.insert(++ElementIter, Element); } } - Element->set(Idx % ElementSize); + ElementIter->set(Idx % ElementSize); } bool test_and_set (unsigned Idx) { @@ -527,8 +544,8 @@ ElementListIter Iter1 = Elements.begin(); ElementListConstIter Iter2 = RHS.Elements.begin(); - // IE They may both be end - if (Iter1 == Iter2) + // Check if both bitmaps are empty + if (Elements.empty() && RHS.Elements.empty()) return false; // See if the first bitmap element is the same in both. This is only @@ -538,15 +555,13 @@ return false; while (Iter2 != RHS.Elements.end()) { - if (Iter1 == Elements.end() || (*Iter1)->index() > (*Iter2)->index()) { - SparseBitVectorElement *NewElem; - - NewElem = new SparseBitVectorElement(*(*Iter2)); - Elements.insert(Iter1, NewElem); + if (Iter1 == Elements.end() || Iter1->index() > Iter2->index()) { + Elements.insert(Iter1, + new SparseBitVectorElement(*Iter2)); ++Iter2; changed = true; - } else if ((*Iter1)->index() == (*Iter2)->index()) { - changed |= (*Iter1)->unionWith(*(*Iter2)); + } else if (Iter1->index() == Iter2->index()) { + changed |= Iter1->unionWith(*Iter2); ++Iter1; ++Iter2; } else { @@ -563,8 +578,8 @@ ElementListIter Iter1 = Elements.begin(); ElementListConstIter Iter2 = RHS.Elements.begin(); - // IE They may both be end. - if (Iter1 == Iter2) + // Check if both bitmaps are empty. + if (Elements.empty() && RHS.Elements.empty()) return false; // See if the first bitmap element is the same in both. This is only @@ -578,14 +593,13 @@ if (Iter1 == Elements.end()) return changed; - if ((*Iter1)->index() > (*Iter2)->index()) { + if (Iter1->index() > Iter2->index()) { ++Iter2; - } else if ((*Iter1)->index() == (*Iter2)->index()) { + } else if (Iter1->index() == Iter2->index()) { bool BecameZero; - changed |= (*Iter1)->intersectWith(*(*Iter2), BecameZero); + changed |= Iter1->intersectWith(*Iter2, BecameZero); if (BecameZero) { ElementListIter IterTmp = Iter1; - delete *IterTmp; Elements.erase(IterTmp); } ++Iter1; @@ -593,12 +607,9 @@ } else { ElementListIter IterTmp = Iter1; ++Iter1; - delete *IterTmp; Elements.erase(IterTmp); } } - for_each(Iter1, Elements.end(), - deleter >); Elements.erase(Iter1, Elements.end()); CurrElementIter = Elements.begin(); return changed; @@ -611,16 +622,14 @@ ElementListIter Iter1 = Elements.begin(); ElementListConstIter Iter2 = RHS.Elements.begin(); - // IE They may both be end. - if (Iter1 == Iter2) + // Check if they are both empty + if (Elements.empty() && RHS.Elements.empty()) return false; // See if the first bitmap element is the same in both. This is only // possible if they are the same bitmap. if (Iter1 != Elements.end() && Iter2 != RHS.Elements.end()) if (*Iter1 == *Iter2) { - for_each(Elements.begin(), Elements.end(), - deleter >); Elements.clear(); return true; } @@ -630,14 +639,13 @@ if (Iter1 == Elements.end()) return changed; - if ((*Iter1)->index() > (*Iter2)->index()) { + if (Iter1->index() > Iter2->index()) { ++Iter2; - } else if ((*Iter1)->index() == (*Iter2)->index()) { + } else if (Iter1->index() == Iter2->index()) { bool BecameZero; - changed |= (*Iter1)->intersectWithComplement(*(*Iter2), BecameZero); + changed |= Iter1->intersectWithComplement(*Iter2, BecameZero); if (BecameZero) { ElementListIter IterTmp = Iter1; - delete *IterTmp; Elements.erase(IterTmp); } ++Iter1; @@ -645,7 +653,6 @@ } else { ElementListIter IterTmp = Iter1; ++Iter1; - delete *IterTmp; Elements.erase(IterTmp); } } @@ -663,15 +670,12 @@ void intersectWithComplement(const SparseBitVector &RHS1, const SparseBitVector &RHS2) { - for_each(Elements.begin(), Elements.end(), - deleter >); Elements.clear(); - ElementListConstIter Iter1 = RHS1.Elements.begin(); ElementListConstIter Iter2 = RHS2.Elements.begin(); - // IE They may both be end. - if (Iter1 == Iter2) + // Check if they are both empty. + if (RHS1.empty() && RHS2.empty()) return; // See if the first bitmap element is the same in both. This is only @@ -686,19 +690,18 @@ if (Iter1 == RHS1.Elements.end()) return; - if ((*Iter1)->index() > (*Iter2)->index()) { + if (Iter1->index() > Iter2->index()) { ++Iter2; - } else if ((*Iter1)->index() == (*Iter2)->index()) { + } else if (Iter1->index() == Iter2->index()) { bool BecameZero = false; SparseBitVectorElement *NewElement = - new SparseBitVectorElement((*Iter1)->index()); - - NewElement->intersectWithComplement(*(*Iter1), *(*Iter2), BecameZero); - if (BecameZero) { - delete NewElement; - } else { + new SparseBitVectorElement(Iter1->index()); + NewElement->intersectWithComplement(*Iter1, *Iter2, BecameZero); + if (!BecameZero) { Elements.push_back(NewElement); } + else + delete NewElement; ++Iter1; ++Iter2; @@ -706,14 +709,15 @@ ++Iter1; } } + // copy the remaining elements - while (Iter1 != RHS1.Elements.end()) { SparseBitVectorElement *NewElement = - new SparseBitVectorElement(*(*Iter1)); + new SparseBitVectorElement(*Iter1); Elements.push_back(NewElement); + ++Iter1; } - + CurrElementIter = Elements.begin(); return; } @@ -732,8 +736,8 @@ ElementListConstIter Iter1 = Elements.begin(); ElementListConstIter Iter2 = RHS.Elements.begin(); - // IE They may both be end. - if (Iter1 == Iter2) + // Check if both bitmaps are empty. + if (Elements.empty() && RHS.Elements.empty()) return false; // See if the first bitmap element is the same in both. This is only @@ -748,10 +752,10 @@ if (Iter1 == Elements.end()) return false; - if ((*Iter1)->index() > (*Iter2)->index()) { + if (Iter1->index() > Iter2->index()) { ++Iter2; - } else if ((*Iter1)->index() == (*Iter2)->index()) { - if ((*Iter1)->intersects(*(*Iter2))) + } else if (Iter1->index() == Iter2->index()) { + if (Iter1->intersects(*Iter2)) return true; ++Iter1; ++Iter2; @@ -766,8 +770,8 @@ int find_first() const { if (Elements.empty()) return -1; - const SparseBitVectorElement *First = *(Elements.begin()); - return (First->index() * ElementSize) + First->find_first(); + const SparseBitVectorElement &First = *(Elements.begin()); + return (First.index() * ElementSize) + First.find_first(); } // Return true if the SparseBitVector is empty @@ -780,7 +784,7 @@ for (ElementListConstIter Iter = Elements.begin(); Iter != Elements.end(); ++Iter) - BitCount += (*Iter)->count(); + BitCount += Iter->count(); return BitCount; } @@ -791,6 +795,17 @@ iterator end() const { return iterator(this, ~0); } + + // Dump our bits to stderr + void dump(llvm::OStream &out) const { + out << "[ "; + for (iterator bi = begin(); + bi != end(); + ++bi) { + out << *bi << " "; + } + out << std::endl; + } }; // Convenience functions to allow Or and And without dereferencing in the user From isanbard at gmail.com Tue Sep 11 13:08:03 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Sep 2007 18:08:03 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41856 - /llvm-gcc-4.0/emptydir/ Message-ID: <200709111808.l8BI83BN007221@zion.cs.uiuc.edu> Author: void Date: Tue Sep 11 13:08:03 2007 New Revision: 41856 URL: http://llvm.org/viewvc/llvm-project?rev=41856&view=rev Log: Adding an empty directory "emptydir" so that we can switch libstdc++ to it and won't have to continually remove it. Added: llvm-gcc-4.0/emptydir/ From isanbard at gmail.com Tue Sep 11 13:11:37 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Sep 2007 18:11:37 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41857 - /llvm-gcc-4.2/emptydir/ Message-ID: <200709111811.l8BIBb35007323@zion.cs.uiuc.edu> Author: void Date: Tue Sep 11 13:11:37 2007 New Revision: 41857 URL: http://llvm.org/viewvc/llvm-project?rev=41857&view=rev Log: Create an empty directory "emptydir" so that we can switch libstdc++-v3 to it so we don't have to keep deleting it. Added: llvm-gcc-4.2/emptydir/ From dalej at apple.com Tue Sep 11 13:32:34 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 11 Sep 2007 18:32:34 -0000 Subject: [llvm-commits] [llvm] r41858 - in /llvm/trunk: include/llvm/ADT/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Support/ lib/Target/CBackend/ lib/Target/MSIL/ lib/Target/X86/ lib/VMCore/ tools/llvm2cpp/ Message-ID: <200709111832.l8BIWZkb007987@zion.cs.uiuc.edu> Author: johannes Date: Tue Sep 11 13:32:33 2007 New Revision: 41858 URL: http://llvm.org/viewvc/llvm-project?rev=41858&view=rev Log: Add APInt interfaces to APFloat (allows directly access to bits). Use them in place of float and double interfaces where appropriate. First bits of x86 long double constants handling (untested, probably does not work). Modified: llvm/trunk/include/llvm/ADT/APFloat.h llvm/trunk/lib/AsmParser/Lexer.l llvm/trunk/lib/AsmParser/llvmAsmParser.y llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/trunk/lib/CodeGen/AsmPrinter.cpp llvm/trunk/lib/CodeGen/MachOWriter.cpp llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Support/APFloat.cpp llvm/trunk/lib/Target/CBackend/CBackend.cpp llvm/trunk/lib/Target/MSIL/MSILWriter.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/tools/llvm2cpp/CppWriter.cpp Modified: llvm/trunk/include/llvm/ADT/APFloat.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APFloat.h (original) +++ llvm/trunk/include/llvm/ADT/APFloat.h Tue Sep 11 13:32:33 2007 @@ -170,6 +170,7 @@ APFloat(const fltSemantics &, fltCategory, bool negative); APFloat(double d); APFloat(float f); + APFloat(const APInt &); APFloat(const APFloat &); ~APFloat(); @@ -191,6 +192,7 @@ opStatus convertFromInteger(const integerPart *, unsigned int, bool, roundingMode); opStatus convertFromString(const char *, roundingMode); + APInt convertToAPInt() const; double convertToDouble() const; float convertToFloat() const; @@ -256,6 +258,13 @@ roundingMode); lostFraction combineLostFractions(lostFraction, lostFraction); opStatus convertFromHexadecimalString(const char *, roundingMode); + APInt convertFloatAPFloatToAPInt() const; + APInt convertDoubleAPFloatToAPInt() const; + APInt convertF80LongDoubleAPFloatToAPInt() const; + void initFromAPInt(const APInt& api); + void initFromFloatAPInt(const APInt& api); + void initFromDoubleAPInt(const APInt& api); + void initFromF80LongDoubleAPInt(const APInt& api); void assign(const APFloat &); void copySignificand(const APFloat &); Modified: llvm/trunk/lib/AsmParser/Lexer.l URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Lexer.l?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/Lexer.l (original) +++ llvm/trunk/lib/AsmParser/Lexer.l Tue Sep 11 13:32:33 2007 @@ -91,14 +91,40 @@ return Result; } - -// HexToFP - Convert the ascii string in hexidecimal format to the floating +// HexToFP - Convert the ascii string in hexadecimal format to the floating // point representation of it. // static double HexToFP(const char *Buffer) { return BitsToDouble(HexIntToVal(Buffer)); // Cast Hex constant to double } +static void HexToIntPair(const char *Buffer, uint64_t Pair[2]) { + Pair[0] = 0; + for (int i=0; i<16; i++, Buffer++) { + assert(*Buffer); + Pair[0] *= 16; + char C = *Buffer; + if (C >= '0' && C <= '9') + Pair[0] += C-'0'; + else if (C >= 'A' && C <= 'F') + Pair[0] += C-'A'+10; + else if (C >= 'a' && C <= 'f') + Pair[0] += C-'a'+10; + } + Pair[1] = 0; + for (int i=0; i<16 && *Buffer; i++, Buffer++) { + Pair[1] *= 16; + char C = *Buffer; + if (C >= '0' && C <= '9') + Pair[1] += C-'0'; + else if (C >= 'A' && C <= 'F') + Pair[1] += C-'A'+10; + else if (C >= 'a' && C <= 'f') + Pair[1] += C-'a'+10; + } + if (*Buffer) + GenerateError("constant bigger than 128 bits detected!"); +} // UnEscapeLexed - Run through the specified buffer and change \xx codes to the // appropriate character. @@ -163,15 +189,28 @@ PInteger [0-9]+ NInteger -[0-9]+ -/* FPConstant - A Floating point constant. +/* FPConstant - A Floating point constant. Float and double only. */ FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)? /* HexFPConstant - Floating point constant represented in IEEE format as a * hexadecimal number for when exponential notation is not precise enough. + * Float and double only. */ HexFPConstant 0x[0-9A-Fa-f]+ +/* F80HexFPConstant - x87 long double in hexadecimal format (10 bytes) + */ +HexFP80Constant 0xK[0-9A-Fa-f]+ + +/* F128HexFPConstant - IEEE 128-bit in hexadecimal format (16 bytes) + */ +HexFP128Constant 0xL[0-9A-Fa-f]+ + +/* PPC128HexFPConstant - PowerPC 128-bit in hexadecimal format (16 bytes) + */ +HexPPC128Constant 0xM[0-9A-Fa-f]+ + /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing * it to deal with 64 bit numbers. */ @@ -441,6 +480,21 @@ {HexFPConstant} { llvmAsmlval.FPVal = new APFloat(HexToFP(yytext)); return FPVAL; } +{HexFP80Constant} { uint64_t Pair[2]; + HexToIntPair(yytext, Pair); + llvmAsmlval.FPVal = new APFloat(APInt(80, 2, Pair)); + return FPVAL; + } +{HexFP128Constant} { uint64_t Pair[2]; + HexToIntPair(yytext, Pair); + llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); + return FPVAL; + } +{HexPPC128Constant} { uint64_t Pair[2]; + HexToIntPair(yytext, Pair); + llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); + return FPVAL; + } <> { /* Make sure to free the internal buffers for flex when we are Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Tue Sep 11 13:32:33 2007 @@ -416,9 +416,10 @@ GenerateError("FP constant invalid for type"); return 0; } - // Lexer has no type info, so builds all FP constants as double. - // Fix this here. - if (Ty==Type::FloatTy) + // Lexer has no type info, so builds all float and double FP constants + // as double. Fix this here. Long double does not need this. + if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble && + Ty==Type::FloatTy) D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); return ConstantFP::get(Ty, *D.ConstPoolFP); @@ -1868,9 +1869,9 @@ | FPType FPVAL { // Float & Double constants if (!ConstantFP::isValueValidForType($1, *$2)) GEN_ERROR("Floating point constant invalid for type"); - // Lexer has no type info, so builds all FP constants as double. - // Fix this here. - if ($1==Type::FloatTy) + // Lexer has no type info, so builds all float and double FP constants + // as double. Fix this here. Long double is done right. + if (&$2->getSemantics()==&APFloat::IEEEdouble && $1==Type::FloatTy) $2->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); $$ = ConstantFP::get($1, *$2); delete $2; Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Sep 11 13:32:33 2007 @@ -622,23 +622,24 @@ NumWords, &Words[0])); break; } - case bitc::CST_CODE_FLOAT: // FLOAT: [fpval] + case bitc::CST_CODE_FLOAT: { // FLOAT: [fpval] if (Record.empty()) return Error("Invalid FLOAT record"); if (CurTy == Type::FloatTy) - V = ConstantFP::get(CurTy, APFloat(BitsToFloat(Record[0]))); + V = ConstantFP::get(CurTy, APFloat(APInt(32, (uint32_t)Record[0]))); else if (CurTy == Type::DoubleTy) - V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0]))); + V = ConstantFP::get(CurTy, APFloat(APInt(64, Record[0]))); // FIXME: Make long double constants work. BitsToDouble does not make it. else if (CurTy == Type::X86_FP80Ty) - V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0]))); + V = ConstantFP::get(CurTy, APFloat(APInt(80, 2, &Record[0]))); else if (CurTy == Type::FP128Ty) - V = ConstantFP::get(CurTy, APFloat(BitsToDouble(Record[0]))); + V = ConstantFP::get(CurTy, APFloat(APInt(128, 2, &Record[0]))); else if (CurTy == Type::PPC_FP128Ty) assert(0 && "PowerPC long double constants not handled yet."); else V = UndefValue::get(CurTy); break; + } case bitc::CST_CODE_AGGREGATE: {// AGGREGATE: [n x value number] if (Record.empty()) Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Sep 11 13:32:33 2007 @@ -527,13 +527,20 @@ Code = bitc::CST_CODE_FLOAT; const Type *Ty = CFP->getType(); if (Ty == Type::FloatTy) - Record.push_back(FloatToBits(CFP->getValueAPF().convertToFloat())); + Record.push_back((uint32_t)*CFP->getValueAPF().convertToAPInt(). + getRawData()); else if (Ty == Type::DoubleTy) { - Record.push_back(DoubleToBits(CFP->getValueAPF().convertToDouble())); - // FIXME: make long double constants work. - } else if (Ty == Type::X86_FP80Ty || - Ty == Type::FP128Ty || Ty == Type::PPC_FP128Ty) { - assert (0 && "Long double constants not handled yet."); + Record.push_back(*CFP->getValueAPF().convertToAPInt().getRawData()); + } else if (Ty == Type::X86_FP80Ty) { + const uint64_t *p = CFP->getValueAPF().convertToAPInt().getRawData(); + Record.push_back(p[0]); + Record.push_back((uint16_t)p[1]); + } else if (Ty == Type::FP128Ty) { + const uint64_t *p = CFP->getValueAPF().convertToAPInt().getRawData(); + Record.push_back(p[0]); + Record.push_back(p[1]); + } else if (Ty == Type::PPC_FP128Ty) { + assert(0 && "PowerPC long double constants not handled yet."); } else { assert (0 && "Unknown FP type!"); } Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Tue Sep 11 13:32:33 2007 @@ -830,29 +830,31 @@ // FP Constants are printed as integer constants to avoid losing // precision... if (CFP->getType() == Type::DoubleTy) { - double Val = CFP->getValueAPF().convertToDouble(); + double Val = CFP->getValueAPF().convertToDouble(); // for comment only + uint64_t i = *CFP->getValueAPF().convertToAPInt().getRawData(); if (TAI->getData64bitsDirective()) - O << TAI->getData64bitsDirective() << DoubleToBits(Val) << "\t" + O << TAI->getData64bitsDirective() << i << "\t" << TAI->getCommentString() << " double value: " << Val << "\n"; else if (TD->isBigEndian()) { - O << TAI->getData32bitsDirective() << unsigned(DoubleToBits(Val) >> 32) + O << TAI->getData32bitsDirective() << unsigned(i >> 32) << "\t" << TAI->getCommentString() << " double most significant word " << Val << "\n"; - O << TAI->getData32bitsDirective() << unsigned(DoubleToBits(Val)) + O << TAI->getData32bitsDirective() << unsigned(i) << "\t" << TAI->getCommentString() << " double least significant word " << Val << "\n"; } else { - O << TAI->getData32bitsDirective() << unsigned(DoubleToBits(Val)) + O << TAI->getData32bitsDirective() << unsigned(i) << "\t" << TAI->getCommentString() << " double least significant word " << Val << "\n"; - O << TAI->getData32bitsDirective() << unsigned(DoubleToBits(Val) >> 32) + O << TAI->getData32bitsDirective() << unsigned(i >> 32) << "\t" << TAI->getCommentString() << " double most significant word " << Val << "\n"; } return; } else { - float Val = CFP->getValueAPF().convertToFloat(); - O << TAI->getData32bitsDirective() << FloatToBits(Val) + float Val = CFP->getValueAPF().convertToFloat(); // for comment only + O << TAI->getData32bitsDirective() + << (uint32_t)*CFP->getValueAPF().convertToAPInt().getRawData() << "\t" << TAI->getCommentString() << " float " << Val << "\n"; return; } Modified: llvm/trunk/lib/CodeGen/MachOWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachOWriter.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachOWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/MachOWriter.cpp Tue Sep 11 13:32:33 2007 @@ -861,8 +861,8 @@ break; } case Type::FloatTyID: { - uint64_t val = FloatToBits(cast(PC)-> - getValueAPF().convertToFloat()); + uint32_t val = (uint32_t)*cast(PC)-> + getValueAPF().convertToAPInt().getRawData(); if (TD->isBigEndian()) val = ByteSwap_32(val); ptr[0] = val; @@ -872,8 +872,8 @@ break; } case Type::DoubleTyID: { - uint64_t val = DoubleToBits(cast(PC)-> - getValueAPF().convertToDouble()); + uint64_t val = *cast(PC)->getValueAPF().convertToAPInt(). + getRawData(); if (TD->isBigEndian()) val = ByteSwap_64(val); ptr[0] = val; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 11 13:32:33 2007 @@ -3800,7 +3800,8 @@ default: assert(0 && "Unknown FP type"); case MVT::f32: if (!AfterLegalize || TLI.isTypeLegal(MVT::i32)) { - Tmp = DAG.getConstant(FloatToBits(CFP->getValueAPF().convertToFloat()), MVT::i32); + Tmp = DAG.getConstant((uint32_t)*CFP->getValueAPF(). + convertToAPInt().getRawData(), MVT::i32); return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), ST->getSrcValueOffset(), ST->isVolatile(), ST->getAlignment()); @@ -3808,7 +3809,8 @@ break; case MVT::f64: if (!AfterLegalize || TLI.isTypeLegal(MVT::i64)) { - Tmp = DAG.getConstant(DoubleToBits(CFP->getValueAPF().convertToDouble()), MVT::i64); + Tmp = DAG.getConstant(*CFP->getValueAPF().convertToAPInt(). + getRawData(), MVT::i64); return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), ST->getSrcValueOffset(), ST->isVolatile(), ST->getAlignment()); @@ -3816,7 +3818,7 @@ // 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->getValueAPF().convertToDouble()); + uint64_t Val = *CFP->getValueAPF().convertToAPInt().getRawData(); SDOperand Lo = DAG.getConstant(Val & 0xFFFFFFFF, MVT::i32); SDOperand Hi = DAG.getConstant(Val >> 32, MVT::i32); if (!TLI.isLittleEndian()) std::swap(Lo, Hi); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Sep 11 13:32:33 2007 @@ -491,8 +491,9 @@ if (!UseCP) { const APFloat& Val = LLVMC->getValueAPF(); return isDouble - ? DAG.getConstant(DoubleToBits(Val.convertToDouble()), MVT::i64) - : DAG.getConstant(FloatToBits(Val.convertToFloat()), MVT::i32); + ? DAG.getConstant(*Val.convertToAPInt().getRawData(), MVT::i64) + : DAG.getConstant((uint32_t )*Val.convertToAPInt().getRawData(), + MVT::i32); } if (isDouble && CFP->isValueValidForType(MVT::f32, CFP->getValueAPF()) && @@ -1980,12 +1981,13 @@ // together. if (ConstantFPSDNode *CFP = dyn_cast(ST->getValue())) { if (CFP->getValueType(0) == MVT::f32) { - Tmp3 = DAG.getConstant(FloatToBits(CFP->getValueAPF(). - convertToFloat()), MVT::i32); + Tmp3 = DAG.getConstant((uint32_t)*CFP->getValueAPF(). + convertToAPInt().getRawData(), + MVT::i32); } else { assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); - Tmp3 = DAG.getConstant(DoubleToBits(CFP->getValueAPF(). - convertToDouble()), MVT::i64); + Tmp3 = DAG.getConstant(*CFP->getValueAPF().convertToAPInt(). + getRawData(), MVT::i64); } Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), SVOffset, isVolatile, Alignment); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 11 13:32:33 2007 @@ -109,13 +109,12 @@ } else if (isa(NotZero)) { MVT::ValueType VT = NotZero.getValueType(); if (VT== MVT::f64) { - if (DoubleToBits(cast(NotZero)-> - getValueAPF().convertToDouble()) != - (uint64_t)-1) + if (*((cast(NotZero)->getValueAPF(). + convertToAPInt().getRawData())) != (uint64_t)-1) return false; } else { - if (FloatToBits(cast(NotZero)-> - getValueAPF().convertToFloat()) != + if ((uint32_t)*cast(NotZero)-> + getValueAPF().convertToAPInt().getRawData() != (uint32_t)-1) return false; } @@ -1698,9 +1697,9 @@ } case ISD::BIT_CONVERT: if (VT == MVT::i32 && C->getValueType(0) == MVT::f32) - return getConstant(FloatToBits(V.convertToFloat()), VT); + return getConstant((uint32_t)*V.convertToAPInt().getRawData(), VT); else if (VT == MVT::i64 && C->getValueType(0) == MVT::f64) - return getConstant(DoubleToBits(V.convertToDouble()), VT); + return getConstant(*V.convertToAPInt().getRawData(), VT); break; } } Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Tue Sep 11 13:32:33 2007 @@ -339,7 +339,8 @@ unsigned int APFloat::partCount() const { - return partCountForBits(semantics->precision + 1); + return partCountForBits(semantics->precision + + semantics->implicitIntegerBit ? 1 : 0); } unsigned int @@ -1593,8 +1594,41 @@ // Denormals have exponent minExponent in APFloat, but minExponent-1 in // the actual IEEE respresentation. We compensate for that here. -double -APFloat::convertToDouble() const { +APInt +APFloat::convertF80LongDoubleAPFloatToAPInt() const { + assert(semantics == (const llvm::fltSemantics* const)&x87DoubleExtended); + assert (partCount()==1); + + uint64_t myexponent, mysignificand; + + if (category==fcNormal) { + myexponent = exponent+16383; //bias + mysignificand = *significandParts(); + if (myexponent==1 && !(mysignificand & 0x8000000000000000ULL)) + myexponent = 0; // denormal + } else if (category==fcZero) { + myexponent = 0; + mysignificand = 0; + } else if (category==fcInfinity) { + myexponent = 0x7fff; + mysignificand = 0x8000000000000000ULL; + } else if (category==fcNaN) { + myexponent = 0x7fff; + mysignificand = *significandParts(); + } else + assert(0); + + uint64_t words[2]; + words[0] = (((uint64_t)sign & 1) << 63) | + ((myexponent & 0x7fff) << 48) | + ((mysignificand >>16) & 0xffffffffffffLL); + words[1] = mysignificand & 0xffff; + APInt api(80, 2, words); + return api; +} + +APInt +APFloat::convertDoubleAPFloatToAPInt() const { assert(semantics == (const llvm::fltSemantics* const)&IEEEdouble); assert (partCount()==1); @@ -1617,16 +1651,17 @@ } else assert(0); - return BitsToDouble((((uint64_t)sign & 1) << 63) | - ((myexponent & 0x7ff) << 52) | - (mysignificand & 0xfffffffffffffLL)); + APInt api(64, (((((uint64_t)sign & 1) << 63) | + ((myexponent & 0x7ff) << 52) | + (mysignificand & 0xfffffffffffffLL)))); + return api; } -float -APFloat::convertToFloat() const { +APInt +APFloat::convertFloatAPFloatToAPInt() const { assert(semantics == (const llvm::fltSemantics* const)&IEEEsingle); assert (partCount()==1); - + uint32_t myexponent, mysignificand; if (category==fcNormal) { @@ -1646,12 +1681,78 @@ } else assert(0); - return BitsToFloat(((sign&1) << 31) | ((myexponent&0xff) << 23) | - (mysignificand & 0x7fffff)); + APInt api(32, (((sign&1) << 31) | ((myexponent&0xff) << 23) | + (mysignificand & 0x7fffff))); + return api; } -APFloat::APFloat(double d) { - uint64_t i = DoubleToBits(d); +APInt +APFloat::convertToAPInt() const { + if (semantics == (const llvm::fltSemantics* const)&IEEEsingle) + return convertFloatAPFloatToAPInt(); + else if (semantics == (const llvm::fltSemantics* const)&IEEEdouble) + return convertDoubleAPFloatToAPInt(); + else if (semantics == (const llvm::fltSemantics* const)&x87DoubleExtended) + return convertF80LongDoubleAPFloatToAPInt(); + else + assert(0); +} + +float +APFloat::convertToFloat() const { + assert(semantics == (const llvm::fltSemantics* const)&IEEEsingle); + APInt api = convertToAPInt(); + return api.bitsToFloat(); +} + +double +APFloat::convertToDouble() const { + assert(semantics == (const llvm::fltSemantics* const)&IEEEdouble); + APInt api = convertToAPInt(); + return api.bitsToDouble(); +} + +/// Integer bit is explicit in this format. Current Intel book does not +/// define meaning of: +/// exponent = all 1's, integer bit not set. +/// exponent = 0, integer bit set. (formerly "psuedodenormals") +/// exponent!=0 nor all 1's, integer bit not set. (formerly "unnormals") +void +APFloat::initFromF80LongDoubleAPInt(const APInt &api) { + assert(api.getBitWidth()==80); + uint64_t i1 = api.getRawData()[0]; + uint64_t i2 = api.getRawData()[1]; + uint64_t myexponent = (i1 >> 48) & 0x7fff; + uint64_t mysignificand = ((i1 << 16) & 0xffffffffffff0000ULL) | + (i2 & 0xffff); + + initialize(&APFloat::x87DoubleExtended); + assert(partCount()==1); + + sign = i1>>63; + if (myexponent==0 && mysignificand==0) { + // exponent, significand meaningless + category = fcZero; + } else if (myexponent==0x7fff && mysignificand==0x8000000000000000ULL) { + // exponent, significand meaningless + category = fcInfinity; + } else if (myexponent==0x7fff && mysignificand!=0x8000000000000000ULL) { + // exponent meaningless + category = fcNaN; + *significandParts() = mysignificand; + } else { + category = fcNormal; + exponent = myexponent - 16383; + *significandParts() = mysignificand; + if (myexponent==0) // denormal + exponent = -16382; + } +} + +void +APFloat::initFromDoubleAPInt(const APInt &api) { + assert(api.getBitWidth()==64); + uint64_t i = *api.getRawData(); uint64_t myexponent = (i >> 52) & 0x7ff; uint64_t mysignificand = i & 0xfffffffffffffLL; @@ -1680,8 +1781,10 @@ } } -APFloat::APFloat(float f) { - uint32_t i = FloatToBits(f); +void +APFloat::initFromFloatAPInt(const APInt & api) { + assert(api.getBitWidth()==32); + uint32_t i = (uint32_t)*api.getRawData(); uint32_t myexponent = (i >> 23) & 0xff; uint32_t mysignificand = i & 0x7fffff; @@ -1709,3 +1812,34 @@ *significandParts() |= 0x800000; // integer bit } } + +/// Treat api as containing the bits of a floating point number. Currently +/// we infer the floating point type from the size of the APInt. FIXME: This +/// breaks when we get to PPC128 and IEEE128 (but both cannot exist in the +/// same compile...) +void +APFloat::initFromAPInt(const APInt& api) { + if (api.getBitWidth() == 32) + return initFromFloatAPInt(api); + else if (api.getBitWidth()==64) + return initFromDoubleAPInt(api); + else if (api.getBitWidth()==80) + return initFromF80LongDoubleAPInt(api); + else + assert(0); +} + +APFloat::APFloat(const APInt& api) { + initFromAPInt(api); +} + +APFloat::APFloat(float f) { + APInt api = APInt(32, 0); + initFromAPInt(api.floatToBits(f)); +} + +APFloat::APFloat(double d) { + APInt api = APInt(64, 0); + initFromAPInt(api.doubleToBits(d)); +} + Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Tue Sep 11 13:32:33 2007 @@ -1715,13 +1715,16 @@ if (FPC->getType() == Type::DoubleTy) { double Val = FPC->getValueAPF().convertToDouble(); + uint64_t i = *FPC->getValueAPF().convertToAPInt().getRawData(); Out << "static const ConstantDoubleTy FPConstant" << FPCounter++ - << " = 0x" << std::hex << DoubleToBits(Val) << std::dec + << " = 0x" << std::hex << i << std::dec << "ULL; /* " << Val << " */\n"; } else if (FPC->getType() == Type::FloatTy) { float Val = FPC->getValueAPF().convertToFloat(); + uint32_t i = (uint32_t)*FPC->getValueAPF().convertToAPInt(). + getRawData(); Out << "static const ConstantFloatTy FPConstant" << FPCounter++ - << " = 0x" << std::hex << FloatToBits(Val) << std::dec + << " = 0x" << std::hex << i << std::dec << "U; /* " << Val << " */\n"; } else assert(0 && "Unknown float type!"); Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original) +++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Tue Sep 11 13:32:33 2007 @@ -428,10 +428,10 @@ uint64_t X; unsigned Size; if (FP->getType()->getTypeID()==Type::FloatTyID) { - X = FloatToBits(FP->getValueAPF().convertToFloat()); + X = (uint32_t)*FP->getValueAPF().convertToAPInt().getRawData(); Size = 4; } else { - X = DoubleToBits(FP->getValueAPF().convertToDouble()); + X = *FP->getValueAPF().convertToAPInt().getRawData(); Size = 8; } Out << "\tldc.r" << Size << "\t( " << utohexstr(X) << ')'; @@ -1473,10 +1473,10 @@ const ConstantFP* FP = cast(C); if (Ty->getTypeID() == Type::FloatTyID) Out << "int32 (" << - FloatToBits(FP->getValueAPF().convertToFloat()) << ')'; + (uint32_t)*FP->getValueAPF().convertToAPInt().getRawData() << ')'; else Out << "int64 (" << - DoubleToBits(FP->getValueAPF().convertToDouble()) << ')'; + *FP->getValueAPF().convertToAPInt().getRawData() << ')'; break; } case Type::ArrayTyID: Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Sep 11 13:32:33 2007 @@ -3410,11 +3410,11 @@ const Type *OpNTy = MVT::getTypeForValueType(EltVT); std::vector CV; if (EltVT == MVT::f64) { - Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToDouble(~(1ULL << 63)))); + Constant *C = ConstantFP::get(OpNTy, APFloat(APInt(64, ~(1ULL << 63)))); CV.push_back(C); CV.push_back(C); } else { - Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToFloat(~(1U << 31)))); + Constant *C = ConstantFP::get(OpNTy, APFloat(APInt(32, ~(1U << 31)))); CV.push_back(C); CV.push_back(C); CV.push_back(C); @@ -3438,11 +3438,11 @@ const Type *OpNTy = MVT::getTypeForValueType(EltVT); std::vector CV; if (EltVT == MVT::f64) { - Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToDouble(1ULL << 63))); + Constant *C = ConstantFP::get(OpNTy, APFloat(APInt(64, 1ULL << 63))); CV.push_back(C); CV.push_back(C); } else { - Constant *C = ConstantFP::get(OpNTy, APFloat(BitsToFloat(1U << 31))); + Constant *C = ConstantFP::get(OpNTy, APFloat(APInt(32, 1U << 31))); CV.push_back(C); CV.push_back(C); CV.push_back(C); @@ -3479,13 +3479,13 @@ // First get the sign bit of second operand. std::vector CV; if (SrcVT == MVT::f64) { - CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToDouble(1ULL << 63)))); - CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(64, 1ULL << 63)))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(64, 0)))); } else { - CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToFloat(1U << 31)))); - CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); - CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); - CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(32, 1U << 31)))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(32, 0)))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(32, 0)))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(32, 0)))); } Constant *C = ConstantVector::get(CV); SDOperand CPIdx = DAG.getConstantPool(C, getPointerTy(), 4); @@ -3507,13 +3507,13 @@ // Clear first operand sign bit. CV.clear(); if (VT == MVT::f64) { - CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToDouble(~(1ULL << 63))))); - CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(64, ~(1ULL << 63))))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(64, 0)))); } else { - CV.push_back(ConstantFP::get(SrcTy, APFloat(BitsToFloat(~(1U << 31))))); - CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); - CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); - CV.push_back(ConstantFP::get(SrcTy, APFloat(0.0f))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(32, ~(1U << 31))))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(32, 0)))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(32, 0)))); + CV.push_back(ConstantFP::get(SrcTy, APFloat(APInt(32, 0)))); } C = ConstantVector::get(CV); CPIdx = DAG.getConstantPool(C, getPointerTy(), 4); Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Sep 11 13:32:33 2007 @@ -87,9 +87,8 @@ if (SrcEltTy->getTypeID() == Type::DoubleTyID) { for (unsigned i = 0; i != SrcNumElts; ++i) { - uint64_t V = - DoubleToBits(cast(CV->getOperand(i))-> - getValueAPF().convertToDouble()); + uint64_t V = *cast(CV->getOperand(i))-> + getValueAPF().convertToAPInt().getRawData(); Constant *C = ConstantInt::get(Type::Int64Ty, V); Result.push_back(ConstantExpr::getBitCast(C, DstEltTy )); } @@ -98,8 +97,8 @@ assert(SrcEltTy->getTypeID() == Type::FloatTyID); for (unsigned i = 0; i != SrcNumElts; ++i) { - uint32_t V = FloatToBits(cast(CV->getOperand(i))-> - getValueAPF().convertToFloat()); + uint32_t V = (uint32_t)*cast(CV->getOperand(i))-> + getValueAPF().convertToAPInt().getRawData(); Constant *C = ConstantInt::get(Type::Int32Ty, V); Result.push_back(ConstantExpr::getBitCast(C, DstEltTy)); } @@ -333,9 +332,9 @@ if (DestTy->isFloatingPoint()) { if (DestTy == Type::FloatTy) - return ConstantFP::get(DestTy, APFloat(CI->getValue().bitsToFloat())); + return ConstantFP::get(DestTy, APFloat(CI->getValue())); assert(DestTy == Type::DoubleTy && "Unknown FP type!"); - return ConstantFP::get(DestTy, APFloat(CI->getValue().bitsToDouble())); + return ConstantFP::get(DestTy, APFloat(CI->getValue())); } // Otherwise, can't fold this (vector?) return 0; @@ -345,14 +344,10 @@ if (const ConstantFP *FP = dyn_cast(V)) { // FP -> Integral. if (DestTy == Type::Int32Ty) { - APInt Val(32, 0); - return ConstantInt::get(Val.floatToBits(FP-> - getValueAPF().convertToFloat())); + return ConstantInt::get(FP->getValueAPF().convertToAPInt()); } else { assert(DestTy == Type::Int64Ty && "only support f32/f64 for now!"); - APInt Val(64, 0); - return ConstantInt::get(Val.doubleToBits(FP-> - getValueAPF().convertToDouble())); + return ConstantInt::get(FP->getValueAPF().convertToAPInt()); } } return 0; Modified: llvm/trunk/tools/llvm2cpp/CppWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm2cpp/CppWriter.cpp?rev=41858&r1=41857&r2=41858&view=diff ============================================================================== --- llvm/trunk/tools/llvm2cpp/CppWriter.cpp (original) +++ llvm/trunk/tools/llvm2cpp/CppWriter.cpp Tue Sep 11 13:32:33 2007 @@ -250,11 +250,11 @@ } else if (CFP->getType() == Type::DoubleTy) Out << "BitsToDouble(0x" << std::hex - << DoubleToBits(CFP->getValueAPF().convertToDouble()) + << *CFP->getValueAPF().convertToAPInt().getRawData() << std::dec << "ULL) /* " << StrVal << " */"; else Out << "BitsToFloat(0x" << std::hex - << FloatToBits(CFP->getValueAPF().convertToFloat()) + << (uint32_t)*CFP->getValueAPF().convertToAPInt().getRawData() << std::dec << "U) /* " << StrVal << " */"; Out << ")"; #if HAVE_PRINTF_A From dalej at apple.com Tue Sep 11 13:33:40 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 11 Sep 2007 18:33:40 -0000 Subject: [llvm-commits] [llvm] r41859 - in /llvm/trunk/lib/AsmParser: Lexer.cpp.cvs Lexer.l.cvs llvmAsmParser.cpp.cvs llvmAsmParser.y.cvs Message-ID: <200709111833.l8BIXeJc008029@zion.cs.uiuc.edu> Author: johannes Date: Tue Sep 11 13:33:39 2007 New Revision: 41859 URL: http://llvm.org/viewvc/llvm-project?rev=41859&view=rev Log: Generated files for previous patch. Modified: llvm/trunk/lib/AsmParser/Lexer.cpp.cvs llvm/trunk/lib/AsmParser/Lexer.l.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Modified: llvm/trunk/lib/AsmParser/Lexer.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Lexer.cpp.cvs?rev=41859&r1=41858&r2=41859&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/Lexer.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/Lexer.cpp.cvs Tue Sep 11 13:33:39 2007 @@ -308,38 +308,39 @@ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 149 -#define YY_END_OF_BUFFER 150 -static yyconst short int yy_acclist[230] = +#define YY_NUM_RULES 152 +#define YY_END_OF_BUFFER 153 +static yyconst short int yy_acclist[233] = { 0, - 150, 148, 149, 147, 148, 149, 147, 149, 148, 149, - 148, 149, 148, 149, 148, 149, 148, 149, 148, 149, - 140, 148, 149, 140, 148, 149, 1, 148, 149, 148, - 149, 148, 149, 148, 149, 148, 149, 148, 149, 148, - 149, 148, 149, 148, 149, 148, 149, 148, 149, 148, - 149, 148, 149, 148, 149, 148, 149, 148, 149, 148, - 149, 148, 149, 148, 149, 148, 149, 148, 149, 148, - 149, 148, 149, 148, 149, 137, 135, 133, 143, 141, + 153, 151, 152, 150, 151, 152, 150, 152, 151, 152, + 151, 152, 151, 152, 151, 152, 151, 152, 151, 152, + 140, 151, 152, 140, 151, 152, 1, 151, 152, 151, + 152, 151, 152, 151, 152, 151, 152, 151, 152, 151, + 152, 151, 152, 151, 152, 151, 152, 151, 152, 151, + 152, 151, 152, 151, 152, 151, 152, 151, 152, 151, + 152, 151, 152, 151, 152, 151, 152, 151, 152, 151, + 152, 151, 152, 151, 152, 137, 135, 133, 143, 141, 145, 140, 1, 134, 144, 119, 38, 82, 64, 83, 78, 25, 137, 139, 133, 145, 22, 145, 146, 138, 134, 65, 77, 36, 39, 3, 67, 92, 97, 95, 96, 94, 93, 98, 102, 118, 87, 85, 74, 86, 84, 66, 100, 91, 89, 90, 88, 101, 99, 79, - 136, 145, 145, 76, 103, 81, 70, 126, 73, 80, - 127, 75, 52, 24, 142, 69, 106, 72, 47, 26, - 4, 62, 68, 71, 55, 12, 105, 145, 34, 32, - 2, 51, 5, 56, 59, 108, 46, 61, 53, 128, - 104, 23, 54, 125, 41, 7, 57, 40, 112, 111, - 8, 16, 121, 124, 35, 63, 116, 110, 120, 27, - 28, 109, 122, 117, 115, 6, 29, 107, 50, 33, - - 44, 45, 9, 19, 10, 113, 11, 49, 48, 114, - 31, 58, 13, 15, 14, 60, 17, 30, 37, 18, - 123, 20, 129, 131, 132, 42, 130, 43, 21 + 136, 145, 145, 147, 148, 149, 76, 103, 81, 70, + 126, 73, 80, 127, 75, 52, 24, 142, 69, 106, + 72, 47, 26, 4, 62, 68, 71, 55, 12, 105, + 145, 34, 32, 2, 51, 5, 56, 59, 108, 46, + 61, 53, 128, 104, 23, 54, 125, 41, 7, 57, + 40, 112, 111, 8, 16, 121, 124, 35, 63, 116, + 110, 120, 27, 28, 109, 122, 117, 115, 6, 29, + + 107, 50, 33, 44, 45, 9, 19, 10, 113, 11, + 49, 48, 114, 31, 58, 13, 15, 14, 60, 17, + 30, 37, 18, 123, 20, 129, 131, 132, 42, 130, + 43, 21 } ; -static yyconst short int yy_accept[601] = +static yyconst short int yy_accept[607] = { 0, 1, 1, 1, 2, 4, 7, 9, 11, 13, 15, 17, 19, 21, 24, 27, 30, 32, 34, 36, 38, @@ -356,57 +357,58 @@ 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 95, - 96, 97, 98, 99, 99, 100, 100, 101, 102, 103, - 103, 103, 104, 104, 104, 105, 105, 105, 105, 105, - 106, 106, 106, 106, 106, 106, 106, 106, 106, 107, + 96, 97, 98, 99, 99, 100, 100, 100, 100, 100, + 101, 102, 103, 103, 103, 104, 104, 104, 105, 105, + 105, 105, 105, 106, 106, 106, 106, 106, 106, 106, + 106, 106, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 107, 107, 107, 107, 108, 108, 108, 108, 108, 108, + 107, 107, 107, 107, 107, 107, 107, 108, 108, 108, - 109, 110, 111, 112, 113, 114, 114, 115, 116, 116, - 116, 116, 117, 117, 117, 117, 117, 117, 118, 119, - 120, 120, 120, 120, 120, 121, 122, 122, 122, 123, - 123, 123, 123, 123, 123, 123, 123, 123, 124, 125, - 126, 126, 127, 128, 128, 129, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 131, 131, 131, 132, 133, - 133, 133, 133, 134, 134, 134, 134, 134, 135, 135, - 135, 135, 136, 136, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 137, 138, 138, 138, - 138, 138, 138, 139, 140, 140, 140, 140, 141, 141, - - 141, 141, 141, 141, 141, 141, 142, 143, 143, 143, - 144, 144, 144, 144, 145, 145, 145, 145, 145, 146, - 147, 147, 147, 148, 148, 148, 148, 148, 149, 150, - 150, 150, 151, 151, 151, 151, 152, 152, 153, 154, - 154, 154, 154, 154, 155, 155, 156, 156, 157, 157, - 157, 158, 159, 160, 161, 161, 161, 162, 162, 163, - 163, 163, 163, 163, 163, 163, 163, 163, 163, 163, - 163, 164, 164, 165, 166, 167, 167, 167, 167, 167, - 167, 167, 168, 168, 168, 168, 168, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - - 169, 170, 170, 170, 170, 170, 171, 171, 171, 171, - 171, 172, 172, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 173, 174, 175, 175, 175, 176, 176, 176, - 176, 177, 177, 177, 177, 178, 178, 178, 179, 180, - 181, 181, 181, 182, 183, 183, 183, 183, 184, 184, - 185, 186, 186, 186, 186, 187, 187, 187, 187, 187, - 188, 188, 188, 188, 189, 190, 191, 191, 192, 193, - 193, 194, 195, 195, 195, 195, 195, 195, 195, 195, - 196, 196, 196, 197, 198, 198, 198, 198, 198, 198, - 199, 199, 199, 199, 199, 199, 200, 200, 200, 200, - - 200, 200, 201, 201, 201, 202, 202, 202, 202, 202, - 202, 202, 203, 203, 203, 204, 204, 204, 204, 204, - 205, 205, 205, 205, 206, 207, 208, 209, 210, 210, - 210, 211, 211, 211, 211, 211, 212, 212, 213, 213, - 213, 214, 214, 215, 216, 216, 216, 216, 216, 217, - 218, 218, 218, 218, 218, 218, 218, 218, 219, 219, - 219, 219, 219, 219, 220, 220, 220, 220, 220, 220, - 221, 221, 221, 221, 221, 221, 222, 222, 222, 222, - 222, 222, 222, 222, 223, 223, 223, 223, 223, 224, - 225, 226, 226, 227, 227, 228, 229, 229, 230, 230 + 108, 108, 108, 109, 110, 111, 112, 113, 114, 114, + 115, 116, 116, 116, 116, 117, 117, 117, 117, 117, + 117, 118, 119, 120, 120, 120, 120, 120, 121, 122, + 122, 122, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 124, 125, 126, 126, 127, 128, 128, 129, 130, + 130, 130, 130, 130, 130, 130, 130, 130, 131, 131, + 131, 132, 133, 133, 133, 133, 134, 135, 136, 137, + 137, 137, 137, 137, 138, 138, 138, 138, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 140, 141, 141, 141, 141, 141, 141, 142, + + 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, + 144, 144, 145, 146, 146, 146, 147, 147, 147, 147, + 148, 148, 148, 148, 148, 149, 150, 150, 150, 151, + 151, 151, 151, 151, 152, 153, 153, 153, 154, 154, + 154, 154, 155, 155, 156, 157, 157, 157, 157, 157, + 158, 158, 159, 159, 160, 160, 160, 161, 162, 163, + 164, 164, 164, 165, 165, 166, 166, 166, 166, 166, + 166, 166, 166, 166, 166, 166, 166, 167, 167, 168, + 169, 170, 170, 170, 170, 170, 170, 170, 171, 171, + 171, 171, 171, 172, 172, 172, 172, 172, 172, 172, + + 172, 172, 172, 172, 172, 172, 172, 173, 173, 173, + 173, 173, 174, 174, 174, 174, 174, 175, 175, 176, + 176, 176, 176, 176, 176, 176, 176, 176, 176, 177, + 178, 178, 178, 179, 179, 179, 179, 180, 180, 180, + 180, 181, 181, 181, 182, 183, 184, 184, 184, 185, + 186, 186, 186, 186, 187, 187, 188, 189, 189, 189, + 189, 190, 190, 190, 190, 190, 191, 191, 191, 191, + 192, 193, 194, 194, 195, 196, 196, 197, 198, 198, + 198, 198, 198, 198, 198, 198, 199, 199, 199, 200, + 201, 201, 201, 201, 201, 201, 202, 202, 202, 202, + + 202, 202, 203, 203, 203, 203, 203, 203, 204, 204, + 204, 205, 205, 205, 205, 205, 205, 205, 206, 206, + 206, 207, 207, 207, 207, 207, 208, 208, 208, 208, + 209, 210, 211, 212, 213, 213, 213, 214, 214, 214, + 214, 214, 215, 215, 216, 216, 216, 217, 217, 218, + 219, 219, 219, 219, 219, 220, 221, 221, 221, 221, + 221, 221, 221, 221, 222, 222, 222, 222, 222, 222, + 223, 223, 223, 223, 223, 223, 224, 224, 224, 224, + 224, 224, 225, 225, 225, 225, 225, 225, 225, 225, + 226, 226, 226, 226, 226, 227, 228, 229, 229, 230, + 230, 231, 232, 232, 233, 233 } ; static yyconst int yy_ec[256] = @@ -418,13 +420,13 @@ 1, 1, 7, 1, 8, 9, 1, 10, 11, 12, 13, 13, 13, 14, 13, 15, 13, 16, 17, 1, 1, 1, 1, 18, 19, 19, 19, 19, 20, 19, + 5, 5, 5, 5, 21, 22, 23, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 1, 1, 1, 1, 21, 1, 22, 23, 24, 25, + 1, 1, 1, 1, 24, 1, 25, 26, 27, 28, - 26, 27, 28, 29, 30, 5, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 1, 1, 1, 1, 1, 1, 1, 1, + 29, 30, 31, 32, 33, 5, 34, 35, 36, 37, + 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -441,469 +443,481 @@ 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[47] = +static yyconst int yy_meta[50] = { 0, - 1, 1, 2, 3, 4, 1, 5, 6, 7, 8, - 8, 8, 8, 8, 8, 9, 1, 1, 4, 10, - 4, 4, 4, 4, 4, 10, 4, 4, 4, 4, + 1, 1, 2, 3, 4, 1, 5, 6, 4, 7, + 7, 7, 7, 7, 7, 8, 1, 1, 4, 9, + 4, 4, 4, 4, 4, 4, 4, 4, 9, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4 + 4, 4, 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst short int yy_base[612] = +static yyconst short int yy_base[617] = { 0, - 0, 0, 1335, 1336, 1336, 1336, 1330, 1317, 43, 49, - 55, 63, 71, 1288, 0, 112, 72, 75, 74, 112, - 58, 132, 103, 59, 161, 120, 77, 105, 180, 101, - 84, 209, 162, 243, 127, 135, 117, 137, 1327, 1336, - 1314, 1336, 1325, 0, 216, 1319, 272, 98, 307, 1283, - 324, 0, 1322, 0, 250, 78, 149, 142, 144, 153, - 171, 33, 1309, 34, 172, 174, 177, 173, 230, 178, - 36, 167, 1308, 204, 185, 189, 226, 186, 232, 207, - 239, 216, 220, 246, 258, 260, 272, 262, 281, 276, - 274, 285, 277, 273, 291, 292, 129, 288, 314, 299, - - 336, 337, 315, 339, 325, 326, 340, 341, 343, 345, - 350, 351, 354, 355, 349, 352, 368, 356, 358, 362, - 1307, 377, 381, 382, 383, 385, 386, 387, 398, 389, - 388, 400, 406, 392, 405, 413, 1306, 1317, 1336, 0, - 411, 1304, 0, 451, 0, 1315, 1336, 0, 1302, 418, - 403, 1301, 419, 431, 1300, 423, 426, 432, 428, 1299, - 452, 433, 454, 439, 457, 458, 459, 463, 1298, 462, - 464, 465, 466, 467, 475, 440, 468, 476, 480, 478, - 485, 482, 479, 494, 500, 501, 483, 503, 295, 505, - 506, 507, 199, 1297, 508, 515, 509, 512, 517, 1296, - - 1295, 1294, 1293, 1292, 1291, 516, 1290, 1289, 521, 518, - 520, 1288, 551, 527, 539, 524, 540, 1287, 1286, 1285, - 541, 556, 551, 565, 1284, 1283, 568, 567, 1282, 570, - 522, 571, 572, 573, 577, 576, 574, 1281, 1280, 1279, - 578, 1278, 1277, 580, 1276, 1275, 581, 529, 579, 598, - 599, 601, 588, 605, 1274, 602, 606, 1336, 605, 544, - 628, 620, 622, 616, 617, 620, 618, 1273, 619, 632, - 629, 1272, 633, 631, 634, 640, 642, 643, 644, 647, - 649, 648, 652, 651, 654, 1271, 1270, 653, 667, 656, - 659, 663, 1269, 1268, 669, 668, 671, 1267, 675, 673, - - 676, 678, 679, 683, 686, 1266, 1265, 689, 690, 1264, - 693, 691, 35, 1263, 692, 700, 702, 701, 0, 1262, - 696, 713, 732, 703, 716, 723, 724, 1261, 1260, 727, - 722, 1259, 728, 725, 729, 1258, 734, 1257, 1256, 736, - 739, 740, 741, 1255, 743, 1254, 744, 1253, 749, 748, - 766, 779, 1252, 1251, 751, 754, 1250, 756, 1249, 761, - 764, 780, 767, 771, 783, 782, 784, 785, 787, 788, - 1248, 791, 1247, 1246, 1245, 792, 793, 794, 798, 797, - 800, 1244, 801, 803, 809, 810, 1243, 814, 811, 816, - 817, 815, 822, 824, 827, 830, 828, 831, 833, 857, - - 1336, 835, 837, 839, 841, 1242, 845, 846, 853, 849, - 1241, 852, 1240, 855, 856, 854, 860, 869, 864, 868, - 873, 890, 1336, 1239, 871, 878, 1238, 879, 880, 882, - 1237, 881, 884, 886, 1236, 893, 883, 1235, 1234, 1233, - 887, 894, 1232, 1231, 890, 906, 901, 1230, 908, 1229, - 1228, 910, 913, 914, 1227, 709, 915, 918, 919, 1226, - 917, 920, 921, 1225, 1224, 1223, 923, 1222, 1221, 929, - 1220, 1219, 922, 924, 941, 934, 926, 930, 946, 1218, - 948, 949, 1216, 1212, 951, 952, 251, 953, 955, 1209, - 956, 954, 959, 957, 961, 1205, 958, 977, 967, 978, - - 960, 1190, 980, 981, 1186, 982, 983, 985, 987, 996, - 992, 1173, 993, 997, 1169, 994, 999, 1001, 1002, 1158, - 1004, 1003, 1005, 1155, 1151, 1143, 1130, 1129, 1008, 1013, - 1127, 1014, 1010, 1016, 1026, 1126, 1028, 1125, 1031, 1027, - 1124, 1029, 1122, 1121, 1032, 1030, 1034, 1039, 1120, 1119, - 1042, 1043, 1044, 1045, 1048, 1046, 1049, 1118, 1051, 1047, - 1057, 1059, 1060, 1117, 1065, 1063, 1070, 1072, 1074, 1112, - 1068, 1075, 1076, 1079, 1080, 1111, 1081, 1083, 1087, 1082, - 1085, 1089, 1092, 1106, 1095, 1102, 1093, 1104, 962, 755, - 575, 1108, 477, 1105, 394, 187, 1109, 32, 1336, 1147, + 0, 0, 1381, 1382, 1382, 1382, 1376, 1363, 46, 52, + 58, 66, 74, 1331, 0, 87, 76, 79, 78, 94, + 77, 106, 109, 63, 138, 130, 141, 140, 151, 155, + 110, 189, 175, 226, 145, 114, 38, 144, 1373, 1382, + 1360, 1382, 1371, 0, 233, 259, 265, 119, 303, 1327, + 323, 0, 1369, 0, 271, 146, 160, 161, 39, 165, + 188, 64, 1356, 36, 124, 187, 190, 93, 199, 193, + 195, 221, 1355, 121, 218, 215, 225, 224, 277, 236, + 248, 271, 273, 175, 274, 283, 240, 284, 278, 126, + 276, 279, 292, 35, 314, 306, 289, 331, 338, 340, + + 315, 343, 345, 341, 346, 347, 348, 349, 350, 359, + 356, 354, 364, 361, 371, 363, 377, 381, 386, 389, + 1354, 392, 393, 395, 394, 397, 396, 400, 417, 402, + 280, 419, 357, 194, 401, 406, 1353, 1364, 1382, 0, + 395, 1351, 0, 457, 427, 464, 485, 506, 1362, 1382, + 0, 1349, 435, 421, 1348, 428, 440, 1347, 405, 511, + 512, 445, 1346, 513, 446, 514, 466, 469, 471, 524, + 526, 1345, 527, 506, 507, 470, 528, 529, 286, 508, + 531, 530, 533, 535, 542, 544, 547, 548, 549, 551, + 555, 407, 558, 559, 563, 564, 1344, 566, 569, 565, + + 574, 571, 1343, 1342, 1341, 1340, 1339, 1338, 572, 1337, + 1336, 575, 577, 579, 1335, 613, 585, 586, 581, 591, + 1334, 1333, 1332, 587, 589, 598, 599, 1331, 1330, 615, + 580, 1329, 603, 620, 628, 631, 629, 632, 633, 634, + 1328, 1327, 1326, 636, 1325, 1324, 637, 1323, 1322, 638, + 640, 641, 647, 648, 655, 649, 654, 1321, 659, 665, + 1382, 662, 500, 674, 685, 687, 0, 0, 0, 674, + 680, 682, 683, 1320, 684, 685, 687, 1319, 686, 688, + 689, 690, 691, 696, 695, 698, 702, 703, 707, 709, + 714, 1318, 1317, 710, 720, 711, 717, 723, 1316, 1315, + + 727, 724, 729, 1314, 732, 730, 731, 735, 734, 739, + 740, 1313, 1312, 741, 748, 1311, 736, 744, 749, 1310, + 750, 754, 759, 760, 0, 1309, 764, 765, 783, 761, + 773, 774, 766, 1308, 1307, 777, 784, 1306, 785, 788, + 789, 1305, 791, 1304, 1303, 792, 793, 794, 796, 1302, + 799, 1301, 800, 1300, 804, 809, 825, 837, 1299, 1298, + 801, 816, 1297, 813, 1296, 829, 805, 837, 819, 838, + 842, 820, 841, 845, 847, 848, 1295, 849, 1294, 1293, + 1292, 850, 853, 854, 856, 855, 857, 1291, 861, 862, + 863, 866, 1290, 871, 865, 872, 873, 877, 880, 881, + + 884, 887, 889, 890, 891, 909, 1382, 900, 899, 893, + 902, 1289, 901, 903, 904, 908, 1288, 909, 1287, 911, + 914, 920, 910, 928, 915, 923, 929, 947, 1382, 1286, + 931, 936, 1285, 938, 939, 940, 1284, 941, 943, 944, + 1283, 947, 945, 1282, 1281, 1280, 946, 949, 1279, 1278, + 960, 952, 958, 1277, 964, 1276, 1275, 962, 968, 970, + 1274, 979, 976, 977, 978, 1273, 981, 982, 980, 1272, + 1271, 1270, 815, 1269, 1268, 984, 1263, 1260, 983, 986, + 990, 992, 987, 1001, 995, 1257, 997, 1005, 1245, 1242, + 1006, 1008, 1009, 1010, 1013, 1230, 1015, 1011, 1017, 1019, + + 1021, 1227, 1020, 1023, 1042, 1032, 1022, 1217, 1025, 1037, + 1214, 1040, 1043, 1047, 1046, 1057, 1053, 1211, 1048, 1055, + 1204, 1056, 1058, 1061, 1063, 1192, 1062, 1065, 1066, 1191, + 1190, 1189, 1188, 1187, 1068, 1071, 1186, 1069, 1078, 1072, + 1077, 1184, 1080, 1182, 1090, 1092, 1181, 1074, 1180, 1179, + 1093, 1095, 1096, 1097, 1177, 1174, 1100, 1098, 1103, 1105, + 1104, 1107, 1106, 1173, 1110, 1112, 1116, 1118, 1119, 1170, + 1120, 1121, 1122, 1130, 1133, 1169, 1127, 1135, 1136, 1137, + 1142, 821, 1144, 1143, 1138, 1145, 1147, 1148, 1151, 600, + 1153, 1156, 1150, 1158, 597, 487, 404, 1160, 360, 1165, - 1154, 1162, 1172, 1180, 1190, 1197, 1201, 1209, 1216, 1219, - 1225 + 281, 234, 1168, 90, 1382, 1209, 1215, 1222, 1231, 1238, + 1247, 1253, 1262, 1268, 1271, 1276 } ; -static yyconst short int yy_def[612] = +static yyconst short int yy_def[617] = { 0, - 599, 1, 599, 599, 599, 599, 600, 601, 602, 599, - 601, 601, 601, 13, 603, 604, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 600, 599, - 601, 599, 605, 606, 599, 607, 13, 601, 601, 13, - 49, 603, 608, 609, 599, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 25, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 599, 605, 599, 606, - 610, 601, 49, 601, 51, 608, 599, 609, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 51, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 599, 610, 611, - 599, 144, 144, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 213, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 599, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 599, - - 599, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 599, 599, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 601, 601, - 601, 601, 601, 601, 601, 601, 601, 601, 0, 599, + 605, 1, 605, 605, 605, 605, 606, 607, 608, 605, + 607, 607, 607, 13, 609, 610, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 606, 605, + 607, 605, 611, 612, 605, 605, 13, 607, 607, 13, + 49, 609, 613, 614, 605, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 25, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 605, 611, 605, 612, + 615, 607, 49, 607, 51, 49, 49, 49, 613, 605, + 614, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 49, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 605, 615, 616, 605, 144, 144, 146, 147, 148, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 216, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 605, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + + 607, 607, 607, 607, 607, 605, 605, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 605, 605, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, + 607, 607, 607, 607, 607, 607, 607, 607, 607, 607, - 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, - 599 + 607, 607, 607, 607, 0, 605, 605, 605, 605, 605, + 605, 605, 605, 605, 605, 605 } ; -static yyconst short int yy_nxt[1383] = +static yyconst short int yy_nxt[1432] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 14, 14, 14, 4, 15, 16, 8, 8, - 8, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 8, 26, 27, 28, 29, 30, 8, 31, 32, 33, - 34, 35, 36, 37, 8, 38, 43, 42, 42, 42, - 42, 42, 45, 45, 45, 45, 45, 45, 46, 46, + 8, 8, 8, 8, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 8, 26, 27, 28, 29, 30, 8, + 31, 32, 33, 34, 35, 36, 37, 8, 38, 43, + 42, 42, 134, 42, 42, 45, 45, 45, 45, 45, + 45, 46, 46, 46, 46, 46, 46, 47, 47, 47, + 47, 47, 47, 42, 48, 135, 198, 156, 42, 42, + 161, 42, 49, 50, 50, 50, 50, 50, 50, 42, + 53, 42, 42, 42, 42, 83, 55, 55, 55, 55, + + 55, 55, 65, 56, 66, 42, 160, 61, 42, 42, + 57, 62, 58, 72, 59, 67, 73, 60, 68, 63, + 51, 42, 69, 74, 42, 42, 64, 142, 70, 42, + 75, 71, 76, 77, 42, 166, 42, 81, 107, 42, + 78, 42, 133, 82, 79, 42, 80, 84, 84, 84, + 84, 84, 84, 42, 87, 42, 42, 194, 162, 42, + 42, 42, 88, 173, 85, 91, 42, 89, 94, 131, + 42, 90, 136, 152, 86, 42, 42, 95, 92, 97, + 42, 98, 132, 96, 93, 99, 103, 100, 155, 101, + 42, 102, 153, 104, 154, 105, 157, 106, 108, 119, + + 158, 41, 42, 42, 42, 42, 120, 257, 42, 42, + 42, 41, 121, 163, 42, 122, 109, 110, 159, 111, + 112, 113, 123, 114, 164, 167, 165, 170, 168, 115, + 42, 116, 117, 42, 118, 108, 42, 169, 171, 42, + 42, 42, 45, 45, 45, 45, 45, 45, 172, 42, + 176, 42, 174, 124, 125, 42, 126, 177, 127, 175, + 128, 178, 129, 42, 182, 191, 130, 141, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, - 42, 48, 157, 42, 42, 158, 168, 393, 42, 49, - 50, 50, 50, 50, 50, 50, 42, 42, 83, 42, - 42, 72, 42, 42, 73, 65, 56, 66, 91, 42, - - 61, 74, 149, 57, 62, 58, 142, 59, 67, 107, - 60, 92, 63, 42, 51, 53, 42, 93, 42, 64, - 42, 55, 55, 55, 55, 55, 55, 42, 81, 103, - 94, 134, 42, 68, 82, 42, 104, 69, 105, 95, - 106, 87, 42, 70, 42, 96, 71, 42, 131, 88, - 42, 135, 42, 75, 89, 76, 77, 42, 90, 42, - 133, 132, 136, 78, 42, 200, 152, 79, 42, 80, - 84, 84, 84, 84, 84, 84, 42, 42, 150, 153, - 151, 154, 42, 119, 85, 155, 42, 42, 42, 42, - 120, 169, 42, 42, 86, 42, 121, 160, 156, 122, - - 42, 42, 42, 159, 42, 97, 123, 98, 161, 167, - 162, 99, 163, 100, 42, 101, 171, 102, 108, 42, - 175, 173, 42, 172, 42, 45, 45, 45, 45, 45, - 45, 42, 179, 109, 110, 42, 111, 112, 113, 309, - 114, 42, 176, 170, 182, 42, 115, 42, 116, 117, - 181, 118, 108, 164, 42, 174, 165, 177, 42, 55, - 55, 55, 55, 55, 55, 166, 42, 124, 125, 41, - 126, 178, 127, 42, 128, 42, 129, 42, 180, 41, - 130, 47, 47, 47, 47, 47, 47, 42, 42, 42, - 183, 42, 42, 519, 188, 189, 42, 184, 185, 186, - - 42, 187, 190, 42, 191, 192, 42, 42, 194, 193, - 42, 195, 196, 201, 42, 41, 143, 143, 143, 143, - 143, 143, 42, 199, 205, 305, 144, 202, 197, 42, - 42, 198, 144, 145, 145, 145, 145, 145, 145, 203, - 42, 42, 145, 145, 208, 145, 145, 145, 145, 145, - 145, 42, 42, 204, 42, 42, 42, 206, 42, 210, - 42, 207, 209, 211, 42, 42, 42, 42, 215, 42, - 42, 42, 214, 42, 227, 218, 216, 42, 222, 212, - 225, 223, 220, 42, 213, 230, 228, 231, 217, 219, - 229, 221, 42, 224, 226, 232, 42, 42, 42, 233, - - 42, 42, 42, 42, 42, 254, 234, 42, 250, 42, - 239, 237, 242, 42, 249, 42, 236, 235, 42, 238, - 42, 42, 244, 245, 240, 241, 243, 253, 42, 251, - 260, 252, 246, 42, 42, 247, 260, 266, 42, 264, - 248, 42, 255, 42, 267, 265, 42, 42, 42, 270, - 256, 289, 269, 271, 42, 42, 257, 261, 262, 272, - 263, 263, 263, 263, 263, 263, 42, 42, 268, 42, - 276, 274, 42, 42, 42, 275, 273, 42, 42, 42, - 42, 42, 42, 42, 279, 281, 277, 282, 280, 278, - 42, 42, 42, 42, 42, 42, 288, 42, 42, 283, - - 42, 286, 284, 295, 285, 293, 297, 296, 287, 42, - 291, 290, 294, 292, 298, 42, 42, 303, 42, 299, - 42, 42, 42, 42, 42, 300, 301, 42, 304, 306, - 42, 42, 42, 42, 312, 42, 42, 42, 308, 42, - 302, 316, 42, 307, 42, 313, 311, 310, 314, 322, - 261, 261, 315, 332, 42, 42, 42, 317, 343, 318, - 319, 319, 319, 319, 319, 319, 42, 324, 320, 319, - 319, 42, 319, 319, 319, 319, 319, 319, 321, 323, - 42, 325, 42, 42, 326, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 334, 333, 327, - - 328, 338, 336, 42, 330, 341, 342, 329, 335, 331, - 337, 344, 340, 42, 42, 339, 42, 42, 348, 345, - 42, 42, 347, 346, 260, 349, 599, 41, 599, 41, - 260, 42, 42, 42, 42, 42, 350, 352, 352, 352, - 352, 352, 352, 355, 42, 351, 42, 42, 42, 42, - 354, 356, 357, 358, 353, 42, 360, 42, 42, 42, - 359, 363, 42, 42, 42, 362, 42, 42, 42, 42, - 361, 42, 365, 370, 42, 364, 371, 372, 42, 367, - 368, 374, 42, 42, 42, 369, 42, 366, 42, 380, - 42, 42, 373, 42, 42, 375, 381, 376, 42, 377, - - 379, 42, 382, 378, 42, 42, 42, 42, 42, 386, - 383, 42, 385, 384, 387, 42, 42, 42, 42, 499, - 388, 390, 391, 389, 42, 398, 395, 396, 42, 402, - 392, 42, 394, 400, 401, 397, 399, 42, 42, 42, - 42, 403, 42, 42, 42, 407, 409, 42, 404, 42, - 405, 42, 406, 408, 42, 42, 42, 411, 42, 42, - 410, 414, 412, 42, 42, 413, 42, 422, 423, 42, - 42, 42, 424, 420, 415, 418, 42, 421, 425, 42, - 416, 42, 42, 417, 427, 428, 42, 419, 352, 352, - 352, 352, 352, 352, 426, 42, 431, 42, 42, 42, - - 42, 429, 42, 42, 430, 432, 42, 42, 42, 42, - 435, 437, 42, 42, 438, 42, 42, 433, 42, 434, - 436, 439, 440, 442, 42, 42, 42, 441, 443, 42, - 42, 42, 42, 444, 450, 448, 446, 42, 452, 42, - 445, 451, 42, 42, 447, 42, 42, 449, 42, 455, - 42, 454, 42, 457, 42, 453, 42, 458, 400, 401, - 42, 42, 456, 462, 42, 459, 461, 42, 42, 42, - 42, 42, 460, 465, 468, 42, 464, 467, 470, 42, - 471, 472, 463, 42, 42, 466, 42, 469, 42, 473, - 474, 422, 423, 42, 42, 42, 42, 42, 42, 42, - - 479, 42, 42, 476, 475, 42, 478, 483, 42, 42, - 490, 477, 481, 487, 488, 492, 42, 480, 485, 484, - 486, 42, 489, 42, 482, 42, 491, 493, 42, 42, - 42, 495, 42, 42, 42, 42, 42, 42, 42, 42, - 494, 42, 503, 506, 42, 42, 504, 498, 496, 42, - 497, 501, 502, 508, 500, 510, 42, 507, 511, 513, - 505, 42, 509, 42, 42, 512, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 529, 514, - 521, 522, 42, 516, 520, 523, 526, 515, 517, 518, - 524, 527, 42, 42, 525, 42, 42, 42, 42, 531, - - 42, 528, 42, 530, 535, 538, 533, 42, 42, 42, - 536, 42, 42, 534, 42, 539, 42, 42, 42, 42, - 42, 532, 549, 42, 541, 42, 537, 545, 42, 42, - 548, 42, 540, 552, 542, 546, 547, 550, 543, 551, - 544, 42, 42, 42, 42, 42, 42, 42, 554, 42, - 553, 555, 556, 559, 42, 560, 557, 42, 42, 42, - 42, 42, 42, 42, 42, 563, 42, 565, 558, 567, - 569, 562, 42, 561, 42, 42, 566, 568, 42, 571, - 42, 570, 564, 42, 573, 42, 575, 42, 576, 42, - 42, 42, 572, 580, 42, 42, 42, 42, 42, 574, - - 42, 577, 42, 578, 42, 579, 586, 42, 42, 582, - 42, 584, 585, 583, 581, 588, 587, 42, 592, 42, - 42, 42, 589, 42, 42, 593, 42, 42, 590, 591, - 597, 596, 42, 42, 42, 42, 42, 42, 594, 42, - 42, 42, 42, 595, 42, 42, 598, 39, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 41, 42, 41, - 41, 41, 41, 41, 44, 44, 42, 44, 44, 44, - 42, 44, 52, 42, 52, 52, 52, 52, 52, 52, - 52, 52, 54, 54, 42, 54, 54, 54, 42, 54, - 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, - - 140, 42, 140, 140, 140, 42, 140, 46, 46, 146, - 146, 146, 146, 146, 146, 146, 146, 146, 146, 148, - 42, 148, 148, 148, 42, 148, 259, 42, 259, 352, - 352, 42, 352, 42, 42, 42, 42, 42, 42, 42, + 55, 55, 55, 55, 55, 55, 42, 179, 42, 42, + 183, 42, 42, 42, 42, 42, 42, 295, 42, 42, + + 185, 42, 193, 253, 42, 180, 196, 42, 184, 186, + 195, 41, 143, 143, 143, 143, 143, 143, 42, 181, + 192, 42, 144, 187, 188, 189, 197, 190, 203, 42, + 42, 144, 145, 145, 145, 145, 145, 145, 199, 209, + 202, 145, 145, 146, 147, 148, 42, 145, 145, 145, + 145, 145, 145, 42, 200, 42, 42, 201, 42, 204, + 42, 42, 42, 42, 42, 42, 206, 212, 208, 42, + 210, 42, 42, 205, 42, 42, 42, 211, 42, 42, + 207, 256, 217, 213, 221, 218, 42, 214, 223, 228, + 215, 225, 42, 219, 226, 216, 42, 224, 222, 230, + + 231, 42, 232, 229, 42, 220, 227, 42, 42, 42, + 42, 42, 42, 233, 263, 42, 42, 42, 234, 42, + 42, 42, 42, 263, 237, 242, 235, 240, 245, 236, + 252, 239, 42, 241, 42, 238, 42, 275, 244, 243, + 311, 258, 246, 42, 247, 248, 259, 41, 41, 41, + 42, 254, 260, 255, 249, 42, 273, 250, 272, 270, + 42, 42, 251, 264, 265, 271, 266, 266, 266, 266, + 266, 266, 42, 267, 267, 267, 267, 267, 267, 278, + 274, 42, 267, 267, 42, 42, 42, 280, 267, 267, + 267, 267, 267, 267, 268, 268, 268, 268, 268, 268, + + 282, 283, 42, 268, 268, 284, 264, 264, 292, 268, + 268, 268, 268, 268, 268, 269, 269, 269, 269, 269, + 269, 42, 42, 42, 269, 269, 42, 42, 42, 42, + 269, 269, 269, 269, 269, 269, 277, 276, 281, 42, + 279, 42, 42, 42, 42, 42, 42, 290, 42, 291, + 42, 287, 285, 294, 296, 288, 286, 42, 299, 42, + 302, 301, 42, 42, 42, 300, 42, 289, 297, 303, + 42, 298, 293, 42, 42, 305, 306, 307, 42, 42, + 42, 42, 304, 310, 42, 312, 42, 42, 309, 42, + 42, 308, 42, 318, 42, 42, 42, 314, 322, 313, + + 42, 42, 42, 317, 42, 320, 42, 315, 316, 328, + 319, 321, 42, 42, 42, 42, 330, 331, 42, 323, + 336, 324, 325, 325, 325, 325, 325, 325, 327, 326, + 42, 325, 325, 329, 332, 42, 333, 325, 325, 325, + 325, 325, 325, 42, 42, 337, 42, 42, 42, 42, + 334, 42, 42, 42, 338, 42, 42, 335, 339, 340, + 342, 344, 42, 42, 42, 347, 348, 341, 343, 42, + 42, 351, 349, 346, 42, 352, 350, 355, 345, 353, + 42, 263, 354, 358, 358, 358, 358, 358, 358, 42, + 263, 605, 41, 605, 41, 42, 356, 42, 42, 42, + + 42, 42, 42, 42, 42, 42, 42, 357, 361, 364, + 42, 42, 366, 42, 369, 359, 360, 42, 42, 362, + 363, 365, 42, 368, 42, 42, 42, 370, 371, 42, + 367, 376, 42, 373, 380, 42, 374, 377, 42, 42, + 378, 372, 42, 375, 42, 42, 42, 42, 386, 42, + 42, 42, 379, 381, 42, 42, 42, 387, 382, 42, + 383, 385, 388, 42, 42, 42, 384, 392, 397, 42, + 389, 390, 391, 393, 42, 42, 42, 394, 395, 42, + 42, 42, 396, 401, 406, 407, 398, 402, 42, 42, + 408, 405, 42, 400, 399, 411, 404, 403, 42, 42, + + 42, 409, 410, 42, 42, 412, 42, 42, 42, 42, + 413, 42, 415, 414, 42, 42, 42, 417, 420, 42, + 42, 418, 419, 416, 42, 430, 428, 429, 42, 434, + 42, 42, 421, 424, 42, 42, 42, 426, 512, 422, + 42, 427, 423, 431, 42, 425, 358, 358, 358, 358, + 358, 358, 42, 42, 432, 433, 42, 42, 439, 436, + 42, 435, 42, 42, 42, 42, 437, 438, 42, 42, + 42, 42, 42, 441, 443, 444, 42, 42, 42, 440, + 42, 42, 445, 442, 448, 446, 42, 42, 42, 449, + 447, 456, 42, 450, 454, 42, 42, 458, 452, 42, + + 457, 453, 42, 451, 42, 42, 42, 455, 42, 461, + 406, 407, 460, 463, 42, 42, 42, 42, 42, 42, + 459, 464, 462, 42, 42, 42, 42, 465, 468, 42, + 42, 473, 471, 466, 467, 42, 474, 476, 42, 469, + 470, 477, 479, 42, 42, 472, 42, 475, 428, 429, + 478, 42, 480, 42, 42, 42, 42, 482, 42, 42, + 42, 42, 42, 485, 42, 484, 481, 42, 489, 483, + 493, 494, 496, 42, 487, 42, 499, 42, 486, 42, + 491, 492, 490, 42, 497, 42, 488, 495, 498, 505, + 501, 42, 42, 42, 42, 42, 42, 42, 42, 42, + + 500, 42, 42, 502, 516, 42, 504, 42, 503, 509, + 42, 510, 42, 507, 508, 513, 42, 514, 506, 517, + 42, 42, 511, 42, 42, 42, 42, 515, 42, 518, + 42, 520, 42, 519, 42, 42, 42, 42, 42, 521, + 42, 527, 522, 528, 526, 529, 523, 42, 524, 532, + 534, 530, 42, 535, 525, 42, 533, 42, 42, 531, + 536, 42, 42, 42, 537, 539, 544, 541, 42, 538, + 42, 42, 42, 42, 540, 542, 42, 42, 42, 545, + 42, 42, 555, 42, 42, 547, 42, 42, 543, 42, + 546, 551, 42, 42, 554, 42, 552, 557, 556, 548, + + 549, 553, 560, 550, 558, 42, 561, 42, 42, 559, + 42, 42, 42, 42, 562, 42, 564, 565, 42, 42, + 42, 42, 42, 566, 563, 42, 569, 42, 573, 571, + 575, 42, 568, 42, 42, 42, 42, 42, 567, 572, + 570, 574, 42, 576, 581, 42, 579, 577, 42, 582, + 42, 42, 42, 42, 578, 586, 583, 42, 42, 42, + 42, 580, 42, 42, 584, 42, 42, 585, 42, 592, + 593, 42, 588, 42, 589, 42, 590, 587, 591, 598, + 42, 594, 599, 42, 42, 42, 602, 595, 42, 42, + 596, 597, 42, 603, 42, 42, 42, 42, 600, 42, + + 601, 42, 42, 42, 42, 42, 42, 42, 604, 39, + 39, 39, 39, 39, 39, 39, 39, 39, 41, 42, + 41, 41, 41, 41, 44, 44, 42, 44, 44, 42, + 44, 52, 42, 52, 52, 52, 52, 52, 52, 52, + 54, 54, 42, 54, 54, 42, 54, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 140, 42, 140, 140, + 42, 140, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 151, 42, 151, 151, 42, 151, 262, 42, 262, + 358, 358, 358, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 150, 42, 139, 261, 42, + 42, 42, 150, 41, 139, 42, 137, 41, 42, 40, + 605, 3, 605, 605, 605, 605, 605, 605, 605, 605, + 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 42, 147, 42, - 139, 258, 42, 42, 42, 147, 41, 141, 139, 42, - 137, 41, 42, 40, 599, 3, 599, 599, 599, 599, - 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, - 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, - 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, - 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, - 599, 599 + 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, + 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, + 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, + 605 } ; -static yyconst short int yy_chk[1383] = +static yyconst short int yy_chk[1432] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 9, 598, 62, 64, - 313, 71, 9, 9, 9, 9, 9, 9, 10, 10, - 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, - 11, 12, 62, 21, 24, 64, 71, 313, 12, 13, - 13, 13, 13, 13, 13, 13, 13, 17, 24, 19, - 18, 21, 27, 56, 21, 19, 17, 19, 27, 31, - - 18, 21, 56, 17, 18, 17, 48, 17, 19, 31, - 17, 27, 18, 48, 13, 16, 30, 27, 23, 18, - 28, 16, 16, 16, 16, 16, 16, 20, 23, 30, - 28, 37, 37, 20, 23, 26, 30, 20, 30, 28, - 30, 26, 35, 20, 97, 28, 20, 22, 35, 26, - 36, 37, 38, 22, 26, 22, 22, 58, 26, 59, - 36, 35, 38, 22, 57, 97, 58, 22, 60, 22, - 25, 25, 25, 25, 25, 25, 25, 33, 57, 59, - 57, 60, 72, 33, 25, 60, 61, 65, 68, 66, - 33, 72, 67, 70, 25, 29, 33, 66, 61, 33, - - 75, 78, 596, 65, 76, 29, 33, 29, 67, 70, - 67, 29, 68, 29, 193, 29, 75, 29, 32, 74, - 78, 76, 80, 75, 32, 45, 45, 45, 45, 45, - 45, 82, 80, 32, 32, 83, 32, 32, 32, 193, - 32, 77, 79, 74, 83, 69, 32, 79, 32, 32, - 82, 32, 34, 69, 81, 77, 69, 79, 34, 55, - 55, 55, 55, 55, 55, 69, 487, 34, 34, 84, - 34, 79, 34, 85, 34, 86, 34, 88, 81, 84, - 34, 47, 47, 47, 47, 47, 47, 87, 94, 91, - 85, 90, 93, 487, 87, 88, 89, 86, 86, 86, - - 92, 86, 89, 98, 90, 91, 95, 96, 93, 92, - 189, 94, 95, 98, 100, 47, 49, 49, 49, 49, - 49, 49, 49, 96, 100, 189, 49, 98, 95, 99, - 103, 95, 49, 51, 51, 51, 51, 51, 51, 99, - 105, 106, 51, 51, 103, 51, 51, 51, 51, 51, - 51, 101, 102, 99, 104, 107, 108, 101, 109, 105, - 110, 102, 104, 106, 115, 111, 112, 116, 110, 113, - 114, 118, 109, 119, 115, 111, 110, 120, 113, 107, - 114, 113, 112, 117, 108, 118, 116, 119, 110, 111, - 117, 112, 122, 113, 114, 119, 123, 124, 125, 120, - - 126, 127, 128, 131, 130, 134, 122, 134, 131, 595, - 126, 124, 128, 129, 130, 132, 123, 122, 151, 125, - 135, 133, 129, 129, 126, 127, 128, 133, 136, 132, - 141, 132, 129, 150, 153, 129, 141, 151, 156, 150, - 129, 157, 135, 159, 153, 150, 154, 158, 162, 157, - 136, 176, 156, 158, 164, 176, 136, 144, 144, 159, - 144, 144, 144, 144, 144, 144, 144, 161, 154, 163, - 164, 162, 165, 166, 167, 163, 161, 170, 168, 171, - 172, 173, 174, 177, 167, 168, 165, 170, 167, 166, - 175, 178, 593, 180, 183, 179, 175, 182, 187, 170, - - 181, 173, 171, 180, 172, 179, 182, 181, 174, 184, - 178, 177, 179, 178, 183, 185, 186, 187, 188, 184, - 190, 191, 192, 195, 197, 185, 186, 198, 188, 190, - 196, 206, 199, 210, 197, 211, 209, 231, 192, 216, - 186, 209, 214, 191, 248, 198, 196, 195, 199, 216, - 260, 260, 206, 231, 215, 217, 221, 210, 248, 211, - 213, 213, 213, 213, 213, 213, 223, 221, 214, 213, - 213, 222, 213, 213, 213, 213, 213, 213, 215, 217, - 224, 222, 228, 227, 223, 230, 232, 233, 234, 237, - 591, 236, 235, 241, 249, 244, 247, 233, 232, 224, - - 227, 236, 235, 253, 228, 244, 247, 227, 234, 230, - 235, 249, 241, 250, 251, 237, 252, 256, 253, 250, - 254, 257, 252, 251, 259, 254, 262, 262, 263, 263, - 259, 264, 265, 267, 269, 266, 256, 261, 261, 261, - 261, 261, 261, 266, 271, 257, 274, 270, 273, 275, - 265, 267, 269, 270, 264, 276, 273, 277, 278, 279, - 271, 276, 280, 282, 281, 275, 284, 283, 288, 285, - 274, 290, 278, 283, 291, 277, 284, 285, 292, 280, - 281, 289, 289, 296, 295, 282, 297, 279, 300, 296, - 299, 301, 288, 302, 303, 290, 297, 291, 304, 291, - - 295, 305, 299, 292, 308, 309, 312, 315, 311, 303, - 300, 321, 302, 301, 304, 316, 318, 317, 324, 456, - 305, 309, 311, 308, 456, 321, 316, 317, 322, 324, - 312, 325, 315, 323, 323, 318, 322, 331, 326, 327, - 334, 325, 330, 333, 335, 331, 334, 323, 326, 337, - 327, 340, 330, 333, 341, 342, 343, 337, 345, 347, - 335, 342, 340, 350, 349, 341, 355, 351, 351, 356, - 590, 358, 355, 350, 343, 349, 360, 350, 356, 361, - 345, 351, 363, 347, 360, 361, 364, 349, 352, 352, - 352, 352, 352, 352, 358, 362, 364, 366, 365, 367, - - 368, 362, 369, 370, 363, 365, 372, 376, 377, 378, - 368, 370, 380, 379, 372, 381, 383, 366, 384, 367, - 369, 376, 377, 379, 385, 386, 389, 378, 380, 388, - 392, 390, 391, 381, 389, 386, 384, 393, 391, 394, - 383, 390, 395, 397, 385, 396, 398, 388, 399, 394, - 402, 393, 403, 396, 404, 392, 405, 397, 400, 400, - 407, 408, 395, 403, 410, 398, 402, 412, 409, 416, - 414, 415, 399, 407, 410, 417, 405, 409, 414, 419, - 415, 416, 404, 420, 418, 408, 425, 412, 421, 417, - 418, 422, 422, 426, 428, 429, 432, 430, 437, 433, - - 425, 434, 441, 419, 418, 445, 421, 430, 436, 442, - 441, 420, 428, 436, 436, 445, 447, 426, 433, 432, - 434, 446, 437, 449, 429, 452, 442, 446, 453, 454, - 457, 449, 461, 458, 459, 462, 463, 473, 467, 474, - 447, 477, 461, 467, 470, 478, 462, 454, 452, 476, - 453, 458, 459, 473, 457, 475, 475, 470, 476, 478, - 463, 479, 474, 481, 482, 477, 485, 486, 488, 492, - 489, 491, 494, 497, 493, 501, 495, 589, 499, 479, - 489, 491, 499, 482, 488, 492, 495, 481, 485, 486, - 493, 497, 498, 500, 494, 503, 504, 506, 507, 501, - - 508, 498, 509, 500, 507, 510, 504, 511, 513, 516, - 508, 510, 514, 506, 517, 511, 518, 519, 522, 521, - 523, 503, 529, 529, 514, 533, 509, 519, 530, 532, - 523, 534, 513, 533, 516, 521, 522, 530, 517, 532, - 518, 535, 540, 537, 542, 546, 539, 545, 535, 547, - 534, 537, 539, 545, 548, 546, 540, 551, 552, 553, - 554, 556, 560, 555, 557, 551, 559, 553, 542, 555, - 557, 548, 561, 547, 562, 563, 554, 556, 566, 560, - 565, 559, 552, 571, 562, 567, 565, 568, 566, 569, - 572, 573, 561, 571, 574, 575, 577, 580, 578, 563, - - 581, 567, 579, 568, 582, 569, 578, 583, 587, 573, - 585, 575, 577, 574, 572, 580, 579, 586, 585, 588, - 594, 584, 581, 592, 597, 586, 576, 570, 582, 583, - 594, 592, 564, 558, 550, 549, 544, 543, 587, 541, - 538, 536, 531, 588, 528, 527, 597, 600, 600, 600, - 600, 600, 600, 600, 600, 600, 600, 601, 526, 601, - 601, 601, 601, 601, 602, 602, 525, 602, 602, 602, - 524, 602, 603, 520, 603, 603, 603, 603, 603, 603, - 603, 603, 604, 604, 515, 604, 604, 604, 512, 604, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, + 94, 64, 37, 37, 59, 9, 9, 9, 9, 9, + 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, + 11, 11, 11, 11, 12, 37, 94, 59, 24, 62, + 64, 12, 13, 13, 13, 13, 13, 13, 13, 13, + 16, 17, 21, 19, 18, 24, 16, 16, 16, 16, + + 16, 16, 19, 17, 19, 604, 62, 18, 68, 20, + 17, 18, 17, 21, 17, 19, 21, 17, 20, 18, + 13, 22, 20, 21, 23, 31, 18, 48, 20, 36, + 22, 20, 22, 22, 48, 68, 74, 23, 31, 65, + 22, 90, 36, 23, 22, 26, 22, 25, 25, 25, + 25, 25, 25, 25, 26, 28, 27, 90, 65, 38, + 35, 56, 26, 74, 25, 27, 29, 26, 28, 35, + 30, 26, 38, 56, 25, 57, 58, 28, 27, 29, + 60, 29, 35, 28, 27, 29, 30, 29, 58, 29, + 33, 29, 57, 30, 57, 30, 60, 30, 32, 33, + + 60, 84, 66, 61, 32, 67, 33, 134, 70, 134, + 71, 84, 33, 66, 69, 33, 32, 32, 61, 32, + 32, 32, 33, 32, 67, 69, 67, 70, 69, 32, + 76, 32, 32, 75, 32, 34, 72, 69, 71, 78, + 77, 34, 45, 45, 45, 45, 45, 45, 72, 602, + 76, 80, 75, 34, 34, 87, 34, 77, 34, 75, + 34, 78, 34, 81, 80, 87, 34, 46, 46, 46, + 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, + 55, 55, 55, 55, 55, 55, 82, 79, 83, 85, + 81, 91, 79, 89, 92, 131, 601, 179, 86, 88, + + 83, 179, 89, 131, 97, 79, 92, 93, 82, 85, + 91, 47, 49, 49, 49, 49, 49, 49, 49, 79, + 88, 96, 49, 86, 86, 86, 93, 86, 97, 95, + 101, 49, 51, 51, 51, 51, 51, 51, 95, 101, + 96, 51, 51, 51, 51, 51, 98, 51, 51, 51, + 51, 51, 51, 99, 95, 100, 104, 95, 102, 98, + 103, 105, 106, 107, 108, 109, 99, 104, 100, 112, + 102, 111, 133, 98, 110, 599, 114, 103, 116, 113, + 99, 133, 109, 105, 111, 110, 115, 106, 112, 114, + 107, 113, 117, 110, 113, 108, 118, 112, 111, 115, + + 116, 119, 117, 114, 120, 110, 113, 122, 123, 125, + 124, 127, 126, 118, 141, 128, 135, 130, 119, 597, + 159, 136, 192, 141, 122, 126, 119, 124, 128, 120, + 130, 123, 129, 125, 132, 122, 154, 159, 127, 126, + 192, 135, 128, 156, 129, 129, 136, 145, 145, 145, + 153, 132, 136, 132, 129, 157, 156, 129, 154, 153, + 162, 165, 129, 144, 144, 153, 144, 144, 144, 144, + 144, 144, 144, 146, 146, 146, 146, 146, 146, 162, + 157, 167, 146, 146, 168, 176, 169, 165, 146, 146, + 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, + + 167, 168, 596, 147, 147, 169, 263, 263, 176, 147, + 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, + 148, 174, 175, 180, 148, 148, 160, 161, 164, 166, + 148, 148, 148, 148, 148, 148, 161, 160, 166, 170, + 164, 171, 173, 177, 178, 182, 181, 174, 183, 175, + 184, 171, 170, 178, 180, 173, 170, 185, 182, 186, + 184, 183, 187, 188, 189, 182, 190, 173, 181, 185, + 191, 181, 177, 193, 194, 187, 188, 189, 195, 196, + 200, 198, 186, 191, 199, 193, 202, 209, 190, 201, + 212, 189, 213, 200, 214, 231, 219, 195, 212, 194, + + 217, 218, 224, 199, 225, 202, 220, 196, 198, 219, + 201, 209, 595, 226, 227, 590, 224, 225, 233, 213, + 231, 214, 216, 216, 216, 216, 216, 216, 218, 217, + 230, 216, 216, 220, 226, 234, 227, 216, 216, 216, + 216, 216, 216, 235, 237, 233, 236, 238, 239, 240, + 230, 244, 247, 250, 234, 251, 252, 230, 235, 236, + 238, 239, 253, 254, 256, 247, 250, 237, 238, 257, + 255, 253, 251, 244, 259, 254, 252, 257, 240, 255, + 260, 262, 256, 264, 264, 264, 264, 264, 264, 270, + 262, 265, 265, 266, 266, 271, 259, 272, 273, 275, + + 276, 279, 277, 280, 281, 282, 283, 260, 272, 276, + 285, 284, 279, 286, 282, 270, 271, 287, 288, 273, + 275, 277, 289, 281, 290, 294, 296, 283, 284, 291, + 280, 289, 297, 286, 295, 295, 287, 290, 298, 302, + 291, 285, 301, 288, 303, 306, 307, 305, 302, 309, + 308, 317, 294, 296, 310, 311, 314, 303, 297, 318, + 297, 301, 305, 315, 319, 321, 298, 309, 317, 322, + 306, 307, 308, 310, 323, 324, 330, 311, 314, 327, + 328, 333, 315, 322, 329, 329, 318, 323, 331, 332, + 330, 328, 336, 321, 319, 333, 327, 324, 329, 337, + + 339, 331, 332, 340, 341, 336, 343, 346, 347, 348, + 337, 349, 340, 339, 351, 353, 361, 343, 348, 355, + 367, 346, 347, 341, 356, 361, 357, 357, 364, 367, + 473, 362, 349, 355, 369, 372, 582, 356, 473, 351, + 357, 356, 353, 362, 366, 355, 358, 358, 358, 358, + 358, 358, 368, 370, 364, 366, 373, 371, 372, 369, + 374, 368, 375, 376, 378, 382, 370, 371, 383, 384, + 386, 385, 387, 374, 376, 378, 389, 390, 391, 373, + 395, 392, 382, 375, 385, 383, 394, 396, 397, 386, + 384, 395, 398, 387, 392, 399, 400, 397, 390, 401, + + 396, 391, 402, 389, 403, 404, 405, 394, 410, 400, + 406, 406, 399, 402, 409, 408, 413, 411, 414, 415, + 398, 403, 401, 416, 418, 423, 420, 404, 409, 421, + 425, 415, 413, 405, 408, 422, 416, 420, 426, 410, + 411, 421, 423, 424, 427, 414, 431, 418, 428, 428, + 422, 432, 424, 434, 435, 436, 438, 425, 439, 440, + 443, 447, 442, 431, 448, 427, 424, 452, 436, 426, + 442, 442, 447, 453, 434, 451, 452, 458, 432, 455, + 439, 440, 438, 459, 448, 460, 435, 443, 451, 462, + 455, 463, 464, 465, 462, 469, 467, 468, 479, 476, + + 453, 480, 483, 458, 481, 481, 460, 482, 459, 467, + 485, 468, 487, 464, 465, 476, 484, 479, 463, 482, + 488, 491, 469, 492, 493, 494, 498, 480, 495, 483, + 497, 485, 499, 484, 500, 503, 501, 507, 504, 487, + 509, 495, 488, 497, 494, 498, 491, 506, 492, 501, + 504, 499, 510, 505, 493, 512, 503, 505, 513, 500, + 506, 515, 514, 519, 507, 510, 516, 513, 517, 509, + 520, 522, 516, 523, 512, 514, 524, 527, 525, 517, + 528, 529, 535, 535, 538, 520, 536, 540, 515, 548, + 519, 525, 541, 539, 529, 543, 527, 538, 536, 522, + + 523, 528, 541, 524, 539, 545, 543, 546, 551, 540, + 552, 553, 554, 558, 545, 557, 548, 551, 559, 561, + 560, 563, 562, 552, 546, 565, 557, 566, 561, 559, + 563, 567, 554, 568, 569, 571, 572, 573, 553, 560, + 558, 562, 577, 565, 571, 574, 568, 566, 575, 572, + 578, 579, 580, 585, 567, 577, 573, 581, 584, 583, + 586, 569, 587, 588, 574, 593, 589, 575, 591, 584, + 585, 592, 579, 594, 580, 598, 581, 578, 583, 591, + 600, 586, 592, 603, 576, 570, 598, 587, 564, 556, + 588, 589, 555, 600, 550, 549, 547, 544, 593, 542, + + 594, 537, 534, 533, 532, 531, 530, 526, 603, 606, + 606, 606, 606, 606, 606, 606, 606, 606, 607, 521, + 607, 607, 607, 607, 608, 608, 518, 608, 608, 511, + 608, 609, 508, 609, 609, 609, 609, 609, 609, 609, + 610, 610, 502, 610, 610, 496, 610, 611, 611, 611, + 611, 611, 611, 611, 611, 611, 612, 490, 612, 612, + 489, 612, 613, 613, 613, 613, 613, 613, 613, 613, + 613, 614, 486, 614, 614, 478, 614, 615, 477, 615, + 616, 616, 616, 475, 474, 472, 471, 470, 466, 461, + 457, 456, 454, 450, 449, 446, 445, 444, 441, 437, + + 433, 430, 419, 417, 412, 393, 388, 381, 380, 379, + 377, 365, 363, 360, 359, 354, 352, 350, 345, 344, + 342, 338, 335, 334, 326, 320, 316, 313, 312, 304, + 300, 299, 293, 292, 278, 274, 258, 249, 248, 246, + 245, 243, 242, 241, 232, 229, 228, 223, 222, 221, + 215, 211, 210, 208, 207, 206, 205, 204, 203, 197, + 172, 163, 158, 155, 152, 149, 142, 138, 137, 121, + 73, 63, 53, 50, 43, 41, 39, 14, 8, 7, + 3, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, - 606, 505, 606, 606, 606, 502, 606, 607, 607, 608, - 608, 608, 608, 608, 608, 608, 608, 608, 608, 609, - 496, 609, 609, 609, 490, 609, 610, 484, 610, 611, - 611, 483, 611, 480, 472, 471, 469, 468, 466, 465, - 464, 460, 455, 451, 450, 448, 444, 443, 440, 439, - 438, 435, 431, 427, 424, 413, 411, 406, 387, 382, - 375, 374, 373, 371, 359, 357, 354, 353, 348, 346, - 344, 339, 338, 336, 332, 329, 328, 320, 314, 310, - 307, 306, 298, 294, 293, 287, 286, 272, 268, 255, - 246, 245, 243, 242, 240, 239, 238, 229, 226, 225, - - 220, 219, 218, 212, 208, 207, 205, 204, 203, 202, - 201, 200, 194, 169, 160, 155, 152, 149, 146, 142, - 138, 137, 121, 73, 63, 53, 50, 46, 43, 41, - 39, 14, 8, 7, 3, 599, 599, 599, 599, 599, - 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, - 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, - 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, - 599, 599, 599, 599, 599, 599, 599, 599, 599, 599, - 599, 599 + 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, + 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, + 605, 605, 605, 605, 605, 605, 605, 605, 605, 605, + 605 } ; static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; @@ -1002,14 +1016,40 @@ return Result; } - -// HexToFP - Convert the ascii string in hexidecimal format to the floating +// HexToFP - Convert the ascii string in hexadecimal format to the floating // point representation of it. // static double HexToFP(const char *Buffer) { return BitsToDouble(HexIntToVal(Buffer)); // Cast Hex constant to double } +static void HexToIntPair(const char *Buffer, uint64_t Pair[2]) { + Pair[0] = 0; + for (int i=0; i<16; i++, Buffer++) { + assert(*Buffer); + Pair[0] *= 16; + char C = *Buffer; + if (C >= '0' && C <= '9') + Pair[0] += C-'0'; + else if (C >= 'A' && C <= 'F') + Pair[0] += C-'A'+10; + else if (C >= 'a' && C <= 'f') + Pair[0] += C-'a'+10; + } + Pair[1] = 0; + for (int i=0; i<16 && *Buffer; i++, Buffer++) { + Pair[1] *= 16; + char C = *Buffer; + if (C >= '0' && C <= '9') + Pair[1] += C-'0'; + else if (C >= 'A' && C <= 'F') + Pair[1] += C-'A'+10; + else if (C >= 'a' && C <= 'f') + Pair[1] += C-'a'+10; + } + if (*Buffer) + GenerateError("constant bigger than 128 bits detected!"); +} // UnEscapeLexed - Run through the specified buffer and change \xx codes to the // appropriate character. @@ -1049,16 +1089,23 @@ /* LocalVarID/GlobalVarID: match an unnamed local variable slot ID. */ /* Integer types are specified with i and a bitwidth */ /* E[PN]Integer: match positive and negative literal integer values. */ -/* FPConstant - A Floating point constant. +/* FPConstant - A Floating point constant. Float and double only. */ /* HexFPConstant - Floating point constant represented in IEEE format as a * hexadecimal number for when exponential notation is not precise enough. + * Float and double only. + */ +/* F80HexFPConstant - x87 long double in hexadecimal format (10 bytes) + */ +/* F128HexFPConstant - IEEE 128-bit in hexadecimal format (16 bytes) + */ +/* PPC128HexFPConstant - PowerPC 128-bit in hexadecimal format (16 bytes) */ /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing * it to deal with 64 bit numbers. */ /* WSNL - shorthand for whitespace followed by newline */ -#line 1062 "Lexer.cpp" +#line 1109 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1209,10 +1256,10 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 182 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 221 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" -#line 1216 "Lexer.cpp" +#line 1263 "Lexer.cpp" if ( yy_init ) { @@ -1260,14 +1307,14 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 600 ) + if ( yy_current_state >= 606 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; *yy_state_ptr++ = yy_current_state; ++yy_cp; } - while ( yy_current_state != 599 ); + while ( yy_current_state != 605 ); yy_find_action: yy_current_state = *--yy_state_ptr; @@ -1305,262 +1352,262 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 184 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 223 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { /* Ignore comments for now */ } YY_BREAK case 2: YY_RULE_SETUP -#line 186 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 225 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return BEGINTOK; } YY_BREAK case 3: YY_RULE_SETUP -#line 187 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return ENDTOK; } YY_BREAK case 4: YY_RULE_SETUP -#line 188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 227 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return TRUETOK; } YY_BREAK case 5: YY_RULE_SETUP -#line 189 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 228 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return FALSETOK; } YY_BREAK case 6: YY_RULE_SETUP -#line 190 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return DECLARE; } YY_BREAK case 7: YY_RULE_SETUP -#line 191 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return DEFINE; } YY_BREAK case 8: YY_RULE_SETUP -#line 192 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return GLOBAL; } YY_BREAK case 9: YY_RULE_SETUP -#line 193 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return CONSTANT; } YY_BREAK case 10: YY_RULE_SETUP -#line 194 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 233 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return INTERNAL; } YY_BREAK case 11: YY_RULE_SETUP -#line 195 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 234 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return LINKONCE; } YY_BREAK case 12: YY_RULE_SETUP -#line 196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 235 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return WEAK; } YY_BREAK case 13: YY_RULE_SETUP -#line 197 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 236 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return APPENDING; } YY_BREAK case 14: YY_RULE_SETUP -#line 198 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return DLLIMPORT; } YY_BREAK case 15: YY_RULE_SETUP -#line 199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return DLLEXPORT; } YY_BREAK case 16: YY_RULE_SETUP -#line 200 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return HIDDEN; } YY_BREAK case 17: YY_RULE_SETUP -#line 201 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 240 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return PROTECTED; } YY_BREAK case 18: YY_RULE_SETUP -#line 202 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 241 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return EXTERN_WEAK; } YY_BREAK case 19: YY_RULE_SETUP -#line 203 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return EXTERNAL; } YY_BREAK case 20: YY_RULE_SETUP -#line 204 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 243 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return THREAD_LOCAL; } YY_BREAK case 21: YY_RULE_SETUP -#line 205 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 244 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return ZEROINITIALIZER; } YY_BREAK case 22: YY_RULE_SETUP -#line 206 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 245 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return DOTDOTDOT; } YY_BREAK case 23: YY_RULE_SETUP -#line 207 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return UNDEF; } YY_BREAK case 24: YY_RULE_SETUP -#line 208 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 247 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return NULL_TOK; } YY_BREAK case 25: YY_RULE_SETUP -#line 209 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return TO; } YY_BREAK case 26: YY_RULE_SETUP -#line 210 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return TAIL; } YY_BREAK case 27: YY_RULE_SETUP -#line 211 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return TARGET; } YY_BREAK case 28: YY_RULE_SETUP -#line 212 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return TRIPLE; } YY_BREAK case 29: YY_RULE_SETUP -#line 213 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 252 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return DEPLIBS; } YY_BREAK case 30: YY_RULE_SETUP -#line 214 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return DATALAYOUT; } YY_BREAK case 31: YY_RULE_SETUP -#line 215 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 254 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return VOLATILE; } YY_BREAK case 32: YY_RULE_SETUP -#line 216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 255 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return ALIGN; } YY_BREAK case 33: YY_RULE_SETUP -#line 217 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 256 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return SECTION; } YY_BREAK case 34: YY_RULE_SETUP -#line 218 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 257 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return ALIAS; } YY_BREAK case 35: YY_RULE_SETUP -#line 219 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 258 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return MODULE; } YY_BREAK case 36: YY_RULE_SETUP -#line 220 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 259 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return ASM_TOK; } YY_BREAK case 37: YY_RULE_SETUP -#line 221 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 260 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return SIDEEFFECT; } YY_BREAK case 38: YY_RULE_SETUP -#line 223 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 262 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return CC_TOK; } YY_BREAK case 39: YY_RULE_SETUP -#line 224 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 263 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return CCC_TOK; } YY_BREAK case 40: YY_RULE_SETUP -#line 225 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 264 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return FASTCC_TOK; } YY_BREAK case 41: YY_RULE_SETUP -#line 226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 265 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return COLDCC_TOK; } YY_BREAK case 42: YY_RULE_SETUP -#line 227 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 266 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return X86_STDCALLCC_TOK; } YY_BREAK case 43: YY_RULE_SETUP -#line 228 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 267 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return X86_FASTCALLCC_TOK; } YY_BREAK case 44: YY_RULE_SETUP -#line 230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return SIGNEXT; } YY_BREAK case 45: YY_RULE_SETUP -#line 231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return ZEROEXT; } YY_BREAK case 46: YY_RULE_SETUP -#line 232 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 271 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return INREG; } YY_BREAK case 47: YY_RULE_SETUP -#line 233 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 272 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return SRET; } YY_BREAK case 48: YY_RULE_SETUP -#line 234 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 273 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return NOUNWIND; } YY_BREAK case 49: YY_RULE_SETUP -#line 235 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 274 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return NORETURN; } YY_BREAK case 50: YY_RULE_SETUP -#line 236 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 275 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return NOALIAS; } YY_BREAK case 51: YY_RULE_SETUP -#line 237 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 276 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return BYVAL; } YY_BREAK case 52: YY_RULE_SETUP -#line 238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return NEST; } YY_BREAK case 53: @@ -1568,7 +1615,7 @@ yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 278 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { // For auto-upgrade only, drop in LLVM 3.0 return SIGNEXT; } YY_BREAK @@ -1577,58 +1624,58 @@ yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 241 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 280 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { // For auto-upgrade only, drop in LLVM 3.0 return ZEROEXT; } YY_BREAK case 55: YY_RULE_SETUP -#line 244 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 283 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TY(Type::VoidTy, VOID); } YY_BREAK case 56: YY_RULE_SETUP -#line 245 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 284 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TY(Type::FloatTy, FLOAT); } YY_BREAK case 57: YY_RULE_SETUP -#line 246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 285 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TY(Type::DoubleTy,DOUBLE);} YY_BREAK case 58: YY_RULE_SETUP -#line 247 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 286 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TY(Type::X86_FP80Ty, X86_FP80);} YY_BREAK case 59: YY_RULE_SETUP -#line 248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 287 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TY(Type::FP128Ty, FP128);} YY_BREAK case 60: YY_RULE_SETUP -#line 249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 288 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TY(Type::PPC_FP128Ty, PPC_FP128);} YY_BREAK case 61: YY_RULE_SETUP -#line 250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 289 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TY(Type::LabelTy, LABEL); } YY_BREAK case 62: YY_RULE_SETUP -#line 251 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 290 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return TYPE; } YY_BREAK case 63: YY_RULE_SETUP -#line 252 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 291 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return OPAQUE; } YY_BREAK case 64: YY_RULE_SETUP -#line 253 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 292 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { uint64_t NumBits = atoull(yytext+1); if (NumBits < IntegerType::MIN_INT_BITS || NumBits > IntegerType::MAX_INT_BITS) @@ -1639,347 +1686,347 @@ YY_BREAK case 65: YY_RULE_SETUP -#line 261 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 300 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Add, ADD); } YY_BREAK case 66: YY_RULE_SETUP -#line 262 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 301 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Sub, SUB); } YY_BREAK case 67: YY_RULE_SETUP -#line 263 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 302 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Mul, MUL); } YY_BREAK case 68: YY_RULE_SETUP -#line 264 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 303 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, UDiv, UDIV); } YY_BREAK case 69: YY_RULE_SETUP -#line 265 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 304 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SDiv, SDIV); } YY_BREAK case 70: YY_RULE_SETUP -#line 266 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 305 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, FDiv, FDIV); } YY_BREAK case 71: YY_RULE_SETUP -#line 267 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 306 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, URem, UREM); } YY_BREAK case 72: YY_RULE_SETUP -#line 268 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 307 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SRem, SREM); } YY_BREAK case 73: YY_RULE_SETUP -#line 269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 308 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, FRem, FREM); } YY_BREAK case 74: YY_RULE_SETUP -#line 270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 309 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Shl, SHL); } YY_BREAK case 75: YY_RULE_SETUP -#line 271 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 310 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, LShr, LSHR); } YY_BREAK case 76: YY_RULE_SETUP -#line 272 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 311 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, AShr, ASHR); } YY_BREAK case 77: YY_RULE_SETUP -#line 273 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 312 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, And, AND); } YY_BREAK case 78: YY_RULE_SETUP -#line 274 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 313 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Or , OR ); } YY_BREAK case 79: YY_RULE_SETUP -#line 275 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 314 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Xor, XOR); } YY_BREAK case 80: YY_RULE_SETUP -#line 276 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 315 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ICmp, ICMP); } YY_BREAK case 81: YY_RULE_SETUP -#line 277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 316 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, FCmp, FCMP); } YY_BREAK case 82: YY_RULE_SETUP -#line 279 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 318 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return EQ; } YY_BREAK case 83: YY_RULE_SETUP -#line 280 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 319 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return NE; } YY_BREAK case 84: YY_RULE_SETUP -#line 281 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 320 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return SLT; } YY_BREAK case 85: YY_RULE_SETUP -#line 282 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 321 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return SGT; } YY_BREAK case 86: YY_RULE_SETUP -#line 283 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 322 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return SLE; } YY_BREAK case 87: YY_RULE_SETUP -#line 284 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 323 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return SGE; } YY_BREAK case 88: YY_RULE_SETUP -#line 285 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 324 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return ULT; } YY_BREAK case 89: YY_RULE_SETUP -#line 286 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 325 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return UGT; } YY_BREAK case 90: YY_RULE_SETUP -#line 287 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 326 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return ULE; } YY_BREAK case 91: YY_RULE_SETUP -#line 288 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 327 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return UGE; } YY_BREAK case 92: YY_RULE_SETUP -#line 289 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 328 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return OEQ; } YY_BREAK case 93: YY_RULE_SETUP -#line 290 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 329 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return ONE; } YY_BREAK case 94: YY_RULE_SETUP -#line 291 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 330 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return OLT; } YY_BREAK case 95: YY_RULE_SETUP -#line 292 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 331 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return OGT; } YY_BREAK case 96: YY_RULE_SETUP -#line 293 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 332 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return OLE; } YY_BREAK case 97: YY_RULE_SETUP -#line 294 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 333 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return OGE; } YY_BREAK case 98: YY_RULE_SETUP -#line 295 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 334 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return ORD; } YY_BREAK case 99: YY_RULE_SETUP -#line 296 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 335 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return UNO; } YY_BREAK case 100: YY_RULE_SETUP -#line 297 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 336 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return UEQ; } YY_BREAK case 101: YY_RULE_SETUP -#line 298 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 337 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return UNE; } YY_BREAK case 102: YY_RULE_SETUP -#line 300 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 339 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, PHI, PHI_TOK); } YY_BREAK case 103: YY_RULE_SETUP -#line 301 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 340 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Call, CALL); } YY_BREAK case 104: YY_RULE_SETUP -#line 302 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 341 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, Trunc, TRUNC); } YY_BREAK case 105: YY_RULE_SETUP -#line 303 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 342 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, ZExt, ZEXT); } YY_BREAK case 106: YY_RULE_SETUP -#line 304 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 343 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, SExt, SEXT); } YY_BREAK case 107: YY_RULE_SETUP -#line 305 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 344 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPTrunc, FPTRUNC); } YY_BREAK case 108: YY_RULE_SETUP -#line 306 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 345 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPExt, FPEXT); } YY_BREAK case 109: YY_RULE_SETUP -#line 307 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 346 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, UIToFP, UITOFP); } YY_BREAK case 110: YY_RULE_SETUP -#line 308 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 347 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, SIToFP, SITOFP); } YY_BREAK case 111: YY_RULE_SETUP -#line 309 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 348 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPToUI, FPTOUI); } YY_BREAK case 112: YY_RULE_SETUP -#line 310 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 349 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, FPToSI, FPTOSI); } YY_BREAK case 113: YY_RULE_SETUP -#line 311 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 350 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, IntToPtr, INTTOPTR); } YY_BREAK case 114: YY_RULE_SETUP -#line 312 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 351 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, PtrToInt, PTRTOINT); } YY_BREAK case 115: YY_RULE_SETUP -#line 313 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 352 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(CastOpVal, BitCast, BITCAST); } YY_BREAK case 116: YY_RULE_SETUP -#line 314 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 353 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Select, SELECT); } YY_BREAK case 117: YY_RULE_SETUP -#line 315 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 354 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, VAArg , VAARG); } YY_BREAK case 118: YY_RULE_SETUP -#line 316 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 355 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Ret, RET); } YY_BREAK case 119: YY_RULE_SETUP -#line 317 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 356 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Br, BR); } YY_BREAK case 120: YY_RULE_SETUP -#line 318 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 357 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Switch, SWITCH); } YY_BREAK case 121: YY_RULE_SETUP -#line 319 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 358 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Invoke, INVOKE); } YY_BREAK case 122: YY_RULE_SETUP -#line 320 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 359 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unwind, UNWIND); } YY_BREAK case 123: YY_RULE_SETUP -#line 321 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 360 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unreachable, UNREACHABLE); } YY_BREAK case 124: YY_RULE_SETUP -#line 323 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 362 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Malloc, MALLOC); } YY_BREAK case 125: YY_RULE_SETUP -#line 324 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 363 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Alloca, ALLOCA); } YY_BREAK case 126: YY_RULE_SETUP -#line 325 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 364 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Free, FREE); } YY_BREAK case 127: YY_RULE_SETUP -#line 326 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 365 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Load, LOAD); } YY_BREAK case 128: YY_RULE_SETUP -#line 327 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 366 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Store, STORE); } YY_BREAK case 129: YY_RULE_SETUP -#line 328 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 367 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } YY_BREAK case 130: YY_RULE_SETUP -#line 330 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 369 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); } YY_BREAK case 131: YY_RULE_SETUP -#line 331 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 370 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); } YY_BREAK case 132: YY_RULE_SETUP -#line 332 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 371 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); } YY_BREAK case 133: YY_RULE_SETUP -#line 335 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 374 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.StrVal = new std::string(yytext+1); // Skip % return LOCALVAR; @@ -1987,7 +2034,7 @@ YY_BREAK case 134: YY_RULE_SETUP -#line 339 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 378 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.StrVal = new std::string(yytext+1); // Skip @ return GLOBALVAR; @@ -1995,7 +2042,7 @@ YY_BREAK case 135: YY_RULE_SETUP -#line 343 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 382 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { yytext[yyleng-1] = 0; // nuke colon llvmAsmlval.StrVal = new std::string(yytext); @@ -2004,7 +2051,7 @@ YY_BREAK case 136: YY_RULE_SETUP -#line 348 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 387 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { yytext[yyleng-2] = 0; // nuke colon, end quote const char* EndChar = UnEscapeLexed(yytext+1, yytext+yyleng); @@ -2015,7 +2062,7 @@ YY_BREAK case 137: YY_RULE_SETUP -#line 356 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 395 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { yytext[yyleng-1] = 0; // nuke end quote const char* EndChar = UnEscapeLexed(yytext+1, yytext+yyleng); llvmAsmlval.StrVal = @@ -2025,7 +2072,7 @@ YY_BREAK case 138: YY_RULE_SETUP -#line 362 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 401 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { yytext[yyleng-1] = 0; // nuke end quote const char* EndChar = @@ -2037,7 +2084,7 @@ YY_BREAK case 139: YY_RULE_SETUP -#line 370 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 409 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { yytext[yyleng-1] = 0; // nuke end quote const char* EndChar = @@ -2049,7 +2096,7 @@ YY_BREAK case 140: YY_RULE_SETUP -#line 378 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 417 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { uint32_t numBits = ((yyleng * 64) / 19) + 1; APInt Tmp(numBits, yytext, yyleng, 10); @@ -2067,7 +2114,7 @@ YY_BREAK case 141: YY_RULE_SETUP -#line 392 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 431 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { uint32_t numBits = (((yyleng-1) * 64) / 19) + 2; APInt Tmp(numBits, yytext, yyleng, 10); @@ -2085,7 +2132,7 @@ YY_BREAK case 142: YY_RULE_SETUP -#line 407 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 446 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { int len = yyleng - 3; uint32_t bits = len * 4; APInt Tmp(bits, yytext+3, len, 16); @@ -2106,7 +2153,7 @@ YY_BREAK case 143: YY_RULE_SETUP -#line 425 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 464 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); if ((unsigned)Val != Val) @@ -2117,7 +2164,7 @@ YY_BREAK case 144: YY_RULE_SETUP -#line 432 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 471 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); if ((unsigned)Val != Val) @@ -2128,18 +2175,45 @@ YY_BREAK case 145: YY_RULE_SETUP -#line 440 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 479 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = new APFloat(atof(yytext)); return FPVAL; } YY_BREAK case 146: YY_RULE_SETUP -#line 441 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 480 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = new APFloat(HexToFP(yytext)); return FPVAL; } YY_BREAK +case 147: +YY_RULE_SETUP +#line 483 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +{ uint64_t Pair[2]; + HexToIntPair(yytext, Pair); + llvmAsmlval.FPVal = new APFloat(APInt(80, 2, Pair)); + return FPVAL; + } + YY_BREAK +case 148: +YY_RULE_SETUP +#line 488 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +{ uint64_t Pair[2]; + HexToIntPair(yytext, Pair); + llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); + return FPVAL; + } + YY_BREAK +case 149: +YY_RULE_SETUP +#line 493 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +{ uint64_t Pair[2]; + HexToIntPair(yytext, Pair); + llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); + return FPVAL; + } + YY_BREAK case YY_STATE_EOF(INITIAL): -#line 445 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 499 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { /* Make sure to free the internal buffers for flex when we are * done reading our input! @@ -2148,22 +2222,22 @@ return EOF; } YY_BREAK -case 147: +case 150: YY_RULE_SETUP -#line 453 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 507 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { /* Ignore whitespace */ } YY_BREAK -case 148: +case 151: YY_RULE_SETUP -#line 454 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 508 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { return yytext[0]; } YY_BREAK -case 149: +case 152: YY_RULE_SETUP -#line 456 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 510 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 2167 "Lexer.cpp" +#line 2241 "Lexer.cpp" case YY_END_OF_BUFFER: { @@ -2450,7 +2524,7 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 600 ) + if ( yy_current_state >= 606 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2480,11 +2554,11 @@ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 600 ) + if ( yy_current_state >= 606 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 599); + yy_is_jam = (yy_current_state == 605); if ( ! yy_is_jam ) *yy_state_ptr++ = yy_current_state; @@ -3045,5 +3119,5 @@ return 0; } #endif -#line 456 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" +#line 510 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" Modified: llvm/trunk/lib/AsmParser/Lexer.l.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Lexer.l.cvs?rev=41859&r1=41858&r2=41859&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/Lexer.l.cvs (original) +++ llvm/trunk/lib/AsmParser/Lexer.l.cvs Tue Sep 11 13:33:39 2007 @@ -91,14 +91,40 @@ return Result; } - -// HexToFP - Convert the ascii string in hexidecimal format to the floating +// HexToFP - Convert the ascii string in hexadecimal format to the floating // point representation of it. // static double HexToFP(const char *Buffer) { return BitsToDouble(HexIntToVal(Buffer)); // Cast Hex constant to double } +static void HexToIntPair(const char *Buffer, uint64_t Pair[2]) { + Pair[0] = 0; + for (int i=0; i<16; i++, Buffer++) { + assert(*Buffer); + Pair[0] *= 16; + char C = *Buffer; + if (C >= '0' && C <= '9') + Pair[0] += C-'0'; + else if (C >= 'A' && C <= 'F') + Pair[0] += C-'A'+10; + else if (C >= 'a' && C <= 'f') + Pair[0] += C-'a'+10; + } + Pair[1] = 0; + for (int i=0; i<16 && *Buffer; i++, Buffer++) { + Pair[1] *= 16; + char C = *Buffer; + if (C >= '0' && C <= '9') + Pair[1] += C-'0'; + else if (C >= 'A' && C <= 'F') + Pair[1] += C-'A'+10; + else if (C >= 'a' && C <= 'f') + Pair[1] += C-'a'+10; + } + if (*Buffer) + GenerateError("constant bigger than 128 bits detected!"); +} // UnEscapeLexed - Run through the specified buffer and change \xx codes to the // appropriate character. @@ -163,15 +189,28 @@ PInteger [0-9]+ NInteger -[0-9]+ -/* FPConstant - A Floating point constant. +/* FPConstant - A Floating point constant. Float and double only. */ FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)? /* HexFPConstant - Floating point constant represented in IEEE format as a * hexadecimal number for when exponential notation is not precise enough. + * Float and double only. */ HexFPConstant 0x[0-9A-Fa-f]+ +/* F80HexFPConstant - x87 long double in hexadecimal format (10 bytes) + */ +HexFP80Constant 0xK[0-9A-Fa-f]+ + +/* F128HexFPConstant - IEEE 128-bit in hexadecimal format (16 bytes) + */ +HexFP128Constant 0xL[0-9A-Fa-f]+ + +/* PPC128HexFPConstant - PowerPC 128-bit in hexadecimal format (16 bytes) + */ +HexPPC128Constant 0xM[0-9A-Fa-f]+ + /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing * it to deal with 64 bit numbers. */ @@ -441,6 +480,21 @@ {HexFPConstant} { llvmAsmlval.FPVal = new APFloat(HexToFP(yytext)); return FPVAL; } +{HexFP80Constant} { uint64_t Pair[2]; + HexToIntPair(yytext, Pair); + llvmAsmlval.FPVal = new APFloat(APInt(80, 2, Pair)); + return FPVAL; + } +{HexFP128Constant} { uint64_t Pair[2]; + HexToIntPair(yytext, Pair); + llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); + return FPVAL; + } +{HexPPC128Constant} { uint64_t Pair[2]; + HexToIntPair(yytext, Pair); + llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); + return FPVAL; + } <> { /* Make sure to free the internal buffers for flex when we are Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=41859&r1=41858&r2=41859&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Tue Sep 11 13:33:39 2007 @@ -1,5 +1,5 @@ -/* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y +/* A Bison parser, made from /Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y by GNU Bison version 1.28 */ #define YYBISON 1 /* Identify Bison output. */ @@ -155,7 +155,7 @@ #define HIDDEN 398 #define PROTECTED 399 -#line 14 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 14 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -561,9 +561,10 @@ GenerateError("FP constant invalid for type"); return 0; } - // Lexer has no type info, so builds all FP constants as double. - // Fix this here. - if (Ty==Type::FloatTy) + // Lexer has no type info, so builds all float and double FP constants + // as double. Fix this here. Long double does not need this. + if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble && + Ty==Type::FloatTy) D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); return ConstantFP::get(Ty, *D.ConstPoolFP); @@ -1108,7 +1109,7 @@ } -#line 967 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 968 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" typedef union { llvm::Module *ModuleVal; llvm::Function *FunctionVal; @@ -1353,37 +1354,37 @@ #if YYDEBUG != 0 static const short yyrline[] = { 0, - 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1126, 1127, - 1127, 1127, 1127, 1127, 1127, 1128, 1128, 1128, 1128, 1128, - 1128, 1128, 1129, 1129, 1129, 1129, 1129, 1132, 1132, 1133, - 1133, 1134, 1134, 1135, 1135, 1136, 1136, 1140, 1140, 1141, - 1141, 1142, 1142, 1143, 1143, 1144, 1144, 1145, 1145, 1146, - 1146, 1147, 1148, 1153, 1154, 1154, 1154, 1154, 1154, 1156, - 1156, 1156, 1157, 1157, 1161, 1165, 1170, 1170, 1172, 1173, - 1178, 1184, 1185, 1186, 1187, 1188, 1192, 1193, 1194, 1198, - 1199, 1200, 1201, 1205, 1206, 1207, 1211, 1212, 1213, 1214, - 1215, 1219, 1220, 1221, 1224, 1224, 1225, 1226, 1227, 1228, - 1229, 1237, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, - 1248, 1249, 1254, 1255, 1256, 1257, 1260, 1261, 1268, 1268, - 1275, 1275, 1284, 1292, 1292, 1298, 1298, 1300, 1305, 1318, - 1318, 1318, 1318, 1318, 1318, 1318, 1321, 1325, 1329, 1336, - 1341, 1349, 1379, 1410, 1415, 1427, 1437, 1441, 1451, 1458, - 1465, 1472, 1477, 1482, 1489, 1490, 1497, 1504, 1512, 1518, - 1530, 1558, 1574, 1601, 1629, 1655, 1675, 1701, 1721, 1733, - 1740, 1806, 1816, 1826, 1832, 1842, 1848, 1858, 1863, 1868, - 1881, 1893, 1915, 1923, 1929, 1940, 1945, 1950, 1956, 1962, - 1971, 1975, 1983, 1983, 1986, 1986, 1989, 2001, 2022, 2027, - 2035, 2036, 2040, 2040, 2044, 2044, 2047, 2050, 2074, 2085, - 2092, 2095, 2101, 2104, 2111, 2115, 2155, 2158, 2164, 2174, - 2178, 2183, 2185, 2190, 2195, 2204, 2214, 2225, 2229, 2238, - 2247, 2252, 2373, 2373, 2375, 2384, 2384, 2386, 2391, 2403, - 2407, 2412, 2416, 2420, 2424, 2428, 2432, 2436, 2440, 2444, - 2469, 2473, 2483, 2487, 2491, 2496, 2503, 2503, 2509, 2518, - 2522, 2531, 2540, 2549, 2553, 2560, 2564, 2568, 2573, 2583, - 2602, 2611, 2691, 2695, 2702, 2713, 2726, 2736, 2747, 2757, - 2766, 2775, 2778, 2779, 2786, 2790, 2795, 2816, 2833, 2847, - 2861, 2873, 2881, 2888, 2894, 2900, 2906, 2921, 3006, 3011, - 3015, 3022, 3029, 3037, 3044, 3052, 3060, 3074, 3091 + 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1127, 1128, + 1128, 1128, 1128, 1128, 1128, 1129, 1129, 1129, 1129, 1129, + 1129, 1129, 1130, 1130, 1130, 1130, 1130, 1133, 1133, 1134, + 1134, 1135, 1135, 1136, 1136, 1137, 1137, 1141, 1141, 1142, + 1142, 1143, 1143, 1144, 1144, 1145, 1145, 1146, 1146, 1147, + 1147, 1148, 1149, 1154, 1155, 1155, 1155, 1155, 1155, 1157, + 1157, 1157, 1158, 1158, 1162, 1166, 1171, 1171, 1173, 1174, + 1179, 1185, 1186, 1187, 1188, 1189, 1193, 1194, 1195, 1199, + 1200, 1201, 1202, 1206, 1207, 1208, 1212, 1213, 1214, 1215, + 1216, 1220, 1221, 1222, 1225, 1225, 1226, 1227, 1228, 1229, + 1230, 1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, + 1249, 1250, 1255, 1256, 1257, 1258, 1261, 1262, 1269, 1269, + 1276, 1276, 1285, 1293, 1293, 1299, 1299, 1301, 1306, 1319, + 1319, 1319, 1319, 1319, 1319, 1319, 1322, 1326, 1330, 1337, + 1342, 1350, 1380, 1411, 1416, 1428, 1438, 1442, 1452, 1459, + 1466, 1473, 1478, 1483, 1490, 1491, 1498, 1505, 1513, 1519, + 1531, 1559, 1575, 1602, 1630, 1656, 1676, 1702, 1722, 1734, + 1741, 1807, 1817, 1827, 1833, 1843, 1849, 1859, 1864, 1869, + 1882, 1894, 1916, 1924, 1930, 1941, 1946, 1951, 1957, 1963, + 1972, 1976, 1984, 1984, 1987, 1987, 1990, 2002, 2023, 2028, + 2036, 2037, 2041, 2041, 2045, 2045, 2048, 2051, 2075, 2086, + 2093, 2096, 2102, 2105, 2112, 2116, 2156, 2159, 2165, 2175, + 2179, 2184, 2186, 2191, 2196, 2205, 2215, 2226, 2230, 2239, + 2248, 2253, 2374, 2374, 2376, 2385, 2385, 2387, 2392, 2404, + 2408, 2413, 2417, 2421, 2425, 2429, 2433, 2437, 2441, 2445, + 2470, 2474, 2484, 2488, 2492, 2497, 2504, 2504, 2510, 2519, + 2523, 2532, 2541, 2550, 2554, 2561, 2565, 2569, 2574, 2584, + 2603, 2612, 2692, 2696, 2703, 2714, 2727, 2737, 2748, 2758, + 2767, 2776, 2779, 2780, 2787, 2791, 2796, 2817, 2834, 2848, + 2862, 2874, 2882, 2889, 2895, 2901, 2907, 2922, 3007, 3012, + 3016, 3023, 3030, 3038, 3045, 3053, 3061, 3075, 3092 }; #endif @@ -2536,259 +2537,259 @@ switch (yyn) { case 28: -#line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_EQ; ; break;} case 29: -#line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1133 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_NE; ; break;} case 30: -#line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_SLT; ; break;} case 31: -#line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1134 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_SGT; ; break;} case 32: -#line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1135 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_SLE; ; break;} case 33: -#line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1135 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_SGE; ; break;} case 34: -#line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_ULT; ; break;} case 35: -#line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1136 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_UGT; ; break;} case 36: -#line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1137 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_ULE; ; break;} case 37: -#line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1137 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.IPredicate = ICmpInst::ICMP_UGE; ; break;} case 38: -#line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_OEQ; ; break;} case 39: -#line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1141 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_ONE; ; break;} case 40: -#line 1141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_OLT; ; break;} case 41: -#line 1141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1142 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_OGT; ; break;} case 42: -#line 1142 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_OLE; ; break;} case 43: -#line 1142 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_OGE; ; break;} case 44: -#line 1143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_ORD; ; break;} case 45: -#line 1143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_UNO; ; break;} case 46: -#line 1144 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1145 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_UEQ; ; break;} case 47: -#line 1144 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1145 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_UNE; ; break;} case 48: -#line 1145 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_ULT; ; break;} case 49: -#line 1145 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_UGT; ; break;} case 50: -#line 1146 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_ULE; ; break;} case 51: -#line 1146 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1147 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_UGE; ; break;} case 52: -#line 1147 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1148 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_TRUE; ; break;} case 53: -#line 1148 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1149 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FPredicate = FCmpInst::FCMP_FALSE; ; break;} case 64: -#line 1157 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1158 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; ; break;} case 65: -#line 1161 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1162 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = yyvsp[-1].StrVal; CHECK_FOR_ERROR ; break;} case 66: -#line 1165 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1166 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; CHECK_FOR_ERROR ; break;} case 70: -#line 1173 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1174 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; CHECK_FOR_ERROR ; break;} case 71: -#line 1178 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1179 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = yyvsp[-1].StrVal; CHECK_FOR_ERROR ; break;} case 72: -#line 1184 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1185 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::InternalLinkage; ; break;} case 73: -#line 1185 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1186 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::WeakLinkage; ; break;} case 74: -#line 1186 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1187 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::LinkOnceLinkage; ; break;} case 75: -#line 1187 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1188 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::AppendingLinkage; ; break;} case 76: -#line 1188 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1189 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLExportLinkage; ; break;} case 77: -#line 1192 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1193 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLImportLinkage; ; break;} case 78: -#line 1193 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1194 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; break;} case 79: -#line 1194 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1195 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} case 80: -#line 1198 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1199 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::DefaultVisibility; ; break;} case 81: -#line 1199 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1200 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::DefaultVisibility; ; break;} case 82: -#line 1200 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1201 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::HiddenVisibility; ; break;} case 83: -#line 1201 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1202 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::ProtectedVisibility; ; break;} case 84: -#line 1205 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1206 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} case 85: -#line 1206 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1207 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLImportLinkage; ; break;} case 86: -#line 1207 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1208 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; break;} case 87: -#line 1211 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1212 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} case 88: -#line 1212 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1213 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::InternalLinkage; ; break;} case 89: -#line 1213 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1214 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::LinkOnceLinkage; ; break;} case 90: -#line 1214 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1215 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::WeakLinkage; ; break;} case 91: -#line 1215 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1216 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLExportLinkage; ; break;} case 92: -#line 1219 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1220 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} case 93: -#line 1220 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1221 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::WeakLinkage; ; break;} case 94: -#line 1221 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1222 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::InternalLinkage; ; break;} case 95: -#line 1224 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1225 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::C; ; break;} case 96: -#line 1225 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::C; ; break;} case 97: -#line 1226 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1227 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::Fast; ; break;} case 98: -#line 1227 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1228 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::Cold; ; break;} case 99: -#line 1228 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1229 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::X86_StdCall; ; break;} case 100: -#line 1229 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::X86_FastCall; ; break;} case 101: -#line 1230 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1231 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) GEN_ERROR("Calling conv too large"); @@ -2797,83 +2798,83 @@ ; break;} case 102: -#line 1237 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1238 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ZExt; ; break;} case 103: -#line 1238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ZExt; ; break;} case 104: -#line 1239 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1240 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::SExt; ; break;} case 105: -#line 1240 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1241 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::SExt; ; break;} case 106: -#line 1241 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1242 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::InReg; ; break;} case 107: -#line 1242 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1243 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::StructRet; ; break;} case 108: -#line 1243 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1244 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::NoAlias; ; break;} case 109: -#line 1244 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1245 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ByVal; ; break;} case 110: -#line 1245 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1246 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::Nest; ; break;} case 111: -#line 1248 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1249 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::None; ; break;} case 112: -#line 1249 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1250 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs; ; break;} case 113: -#line 1254 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1255 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::NoReturn; ; break;} case 114: -#line 1255 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1256 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::NoUnwind; ; break;} case 115: -#line 1256 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1257 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ZExt; ; break;} case 116: -#line 1257 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1258 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::SExt; ; break;} case 117: -#line 1260 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1261 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::None; ; break;} case 118: -#line 1261 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1262 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs; ; break;} case 119: -#line 1268 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1269 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = 0; ; break;} case 120: -#line 1269 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1270 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = yyvsp[0].UInt64Val; if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) @@ -2882,11 +2883,11 @@ ; break;} case 121: -#line 1275 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1276 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = 0; ; break;} case 122: -#line 1276 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1277 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = yyvsp[0].UInt64Val; if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) @@ -2895,7 +2896,7 @@ ; break;} case 123: -#line 1284 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1285 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i) if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\') @@ -2905,23 +2906,23 @@ ; break;} case 124: -#line 1292 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1293 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; ; break;} case 125: -#line 1293 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1294 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = yyvsp[0].StrVal; ; break;} case 126: -#line 1298 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1299 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" {; break;} case 127: -#line 1299 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1300 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" {; break;} case 128: -#line 1300 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1301 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; @@ -2929,7 +2930,7 @@ ; break;} case 129: -#line 1305 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1306 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) GEN_ERROR("Alignment must be a power of two"); @@ -2938,21 +2939,21 @@ ; break;} case 137: -#line 1321 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1322 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeVal = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR ; break;} case 138: -#line 1325 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1326 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); CHECK_FOR_ERROR ; break;} case 139: -#line 1329 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1330 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? if (*yyvsp[-1].TypeVal == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); @@ -2962,7 +2963,7 @@ ; break;} case 140: -#line 1336 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1337 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal(yyvsp[0].ValIDVal); CHECK_FOR_ERROR @@ -2970,7 +2971,7 @@ ; break;} case 141: -#line 1341 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1342 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -2981,7 +2982,7 @@ ; break;} case 142: -#line 1349 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1350 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Params; ParamAttrsVector Attrs; @@ -3014,7 +3015,7 @@ ; break;} case 143: -#line 1379 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1380 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Params; ParamAttrsVector Attrs; @@ -3047,7 +3048,7 @@ ; break;} case 144: -#line 1410 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1411 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); delete yyvsp[-1].TypeVal; @@ -3055,7 +3056,7 @@ ; break;} case 145: -#line 1415 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1416 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Vector type? const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) @@ -3070,7 +3071,7 @@ ; break;} case 146: -#line 1427 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1428 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = yyvsp[-1].TypeList->begin(), @@ -3083,14 +3084,14 @@ ; break;} case 147: -#line 1437 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1438 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? yyval.TypeVal = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR ; break;} case 148: -#line 1441 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1442 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; for (std::list::iterator I = yyvsp[-2].TypeList->begin(), @@ -3103,21 +3104,21 @@ ; break;} case 149: -#line 1451 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1452 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? yyval.TypeVal = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR ; break;} case 150: -#line 1458 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1459 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal; yyval.TypeWithAttrs.Attrs = yyvsp[0].ParamAttrs; ; break;} case 151: -#line 1465 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1466 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -3127,13 +3128,13 @@ ; break;} case 152: -#line 1472 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1473 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeVal = new PATypeHolder(Type::VoidTy); ; break;} case 153: -#line 1477 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1478 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList = new TypeWithAttrsList(); yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs); @@ -3141,14 +3142,14 @@ ; break;} case 154: -#line 1482 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1483 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs); CHECK_FOR_ERROR ; break;} case 156: -#line 1490 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1491 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -3158,7 +3159,7 @@ ; break;} case 157: -#line 1497 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1498 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -3168,14 +3169,14 @@ ; break;} case 158: -#line 1504 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1505 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList = new TypeWithAttrsList(); CHECK_FOR_ERROR ; break;} case 159: -#line 1512 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1513 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeList = new std::list(); yyval.TypeList->push_back(*yyvsp[0].TypeVal); @@ -3184,7 +3185,7 @@ ; break;} case 160: -#line 1518 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1519 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; @@ -3192,7 +3193,7 @@ ; break;} case 161: -#line 1530 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1531 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -3223,7 +3224,7 @@ ; break;} case 162: -#line 1558 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1559 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -3242,7 +3243,7 @@ ; break;} case 163: -#line 1574 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1575 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -3272,7 +3273,7 @@ ; break;} case 164: -#line 1601 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1602 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -3303,7 +3304,7 @@ ; break;} case 165: -#line 1629 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1630 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast(yyvsp[-3].TypeVal->get()); if (STy == 0) @@ -3332,7 +3333,7 @@ ; break;} case 166: -#line 1655 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1656 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -3355,7 +3356,7 @@ ; break;} case 167: -#line 1675 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1676 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast(yyvsp[-5].TypeVal->get()); if (STy == 0) @@ -3384,7 +3385,7 @@ ; break;} case 168: -#line 1701 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1702 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); @@ -3407,7 +3408,7 @@ ; break;} case 169: -#line 1721 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1722 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3422,7 +3423,7 @@ ; break;} case 170: -#line 1733 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1734 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3432,7 +3433,7 @@ ; break;} case 171: -#line 1740 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1741 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3501,7 +3502,7 @@ ; break;} case 172: -#line 1806 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1807 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3514,7 +3515,7 @@ ; break;} case 173: -#line 1816 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1817 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3527,7 +3528,7 @@ ; break;} case 174: -#line 1826 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1827 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) GEN_ERROR("Constant value doesn't fit in type"); @@ -3536,7 +3537,7 @@ ; break;} case 175: -#line 1832 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1833 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast(yyvsp[-1].PrimType)->getBitWidth(); if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) { @@ -3549,7 +3550,7 @@ ; break;} case 176: -#line 1842 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1843 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) GEN_ERROR("Constant value doesn't fit in type"); @@ -3558,7 +3559,7 @@ ; break;} case 177: -#line 1848 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1849 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast(yyvsp[-1].PrimType)->getBitWidth(); if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) { @@ -3571,7 +3572,7 @@ ; break;} case 178: -#line 1858 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1859 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); yyval.ConstVal = ConstantInt::getTrue(); @@ -3579,7 +3580,7 @@ ; break;} case 179: -#line 1863 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1864 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); yyval.ConstVal = ConstantInt::getFalse(); @@ -3587,13 +3588,13 @@ ; break;} case 180: -#line 1868 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1869 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Float & Double constants if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal)) GEN_ERROR("Floating point constant invalid for type"); - // Lexer has no type info, so builds all FP constants as double. - // Fix this here. - if (yyvsp[-1].PrimType==Type::FloatTy) + // Lexer has no type info, so builds all float and double FP constants + // as double. Fix this here. Long double is done right. + if (&yyvsp[0].FPVal->getSemantics()==&APFloat::IEEEdouble && yyvsp[-1].PrimType==Type::FloatTy) yyvsp[0].FPVal->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, *yyvsp[0].FPVal); delete yyvsp[0].FPVal; @@ -3601,7 +3602,7 @@ ; break;} case 181: -#line 1881 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1882 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3616,7 +3617,7 @@ ; break;} case 182: -#line 1893 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1894 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa(yyvsp[-2].ConstVal->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -3641,7 +3642,7 @@ ; break;} case 183: -#line 1915 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1916 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -3652,7 +3653,7 @@ ; break;} case 184: -#line 1923 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1924 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("Binary operator types must match"); @@ -3661,7 +3662,7 @@ ; break;} case 185: -#line 1929 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1930 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("Logical operator types must match"); @@ -3675,7 +3676,7 @@ ; break;} case 186: -#line 1940 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1941 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("icmp operand types must match"); @@ -3683,7 +3684,7 @@ ; break;} case 187: -#line 1945 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1946 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("fcmp operand types must match"); @@ -3691,7 +3692,7 @@ ; break;} case 188: -#line 1950 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1951 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid extractelement operands"); @@ -3700,7 +3701,7 @@ ; break;} case 189: -#line 1956 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1957 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid insertelement operands"); @@ -3709,7 +3710,7 @@ ; break;} case 190: -#line 1962 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1963 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid shufflevector operands"); @@ -3718,14 +3719,14 @@ ; break;} case 191: -#line 1971 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1972 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); CHECK_FOR_ERROR ; break;} case 192: -#line 1975 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1976 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ConstVector = new std::vector(); yyval.ConstVector->push_back(yyvsp[0].ConstVal); @@ -3733,23 +3734,23 @@ ; break;} case 193: -#line 1983 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1984 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; ; break;} case 194: -#line 1983 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1984 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; ; break;} case 195: -#line 1986 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1987 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; ; break;} case 196: -#line 1986 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1987 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; ; break;} case 197: -#line 1989 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1990 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const Type* VTy = yyvsp[-1].TypeVal->get(); Value *V = getVal(VTy, yyvsp[0].ValIDVal); @@ -3764,7 +3765,7 @@ ; break;} case 198: -#line 2001 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2002 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { Constant *Val = yyvsp[-3].ConstVal; const Type *DestTy = yyvsp[-1].TypeVal->get(); @@ -3779,7 +3780,7 @@ ; break;} case 199: -#line 2022 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2023 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ModuleVal = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -3787,7 +3788,7 @@ ; break;} case 200: -#line 2027 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2028 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ModuleVal = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); @@ -3795,34 +3796,34 @@ ; break;} case 203: -#line 2040 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2041 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ; break;} case 204: -#line 2040 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2041 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR ; break;} case 205: -#line 2044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2045 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ; break;} case 206: -#line 2044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2045 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} case 207: -#line 2047 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2048 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} case 208: -#line 2050 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2051 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -3849,7 +3850,7 @@ ; break;} case 209: -#line 2074 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2075 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType); @@ -3863,7 +3864,7 @@ ; break;} case 210: -#line 2085 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2086 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ if (yyvsp[0].ConstVal == 0) @@ -3874,13 +3875,13 @@ ; break;} case 211: -#line 2092 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2093 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ; break;} case 212: -#line 2096 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2097 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[0].ConstVal == 0) GEN_ERROR("Global value initializer is not a constant"); @@ -3889,13 +3890,13 @@ ; break;} case 213: -#line 2101 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2102 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ; break;} case 214: -#line 2105 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2106 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -3905,14 +3906,14 @@ ; break;} case 215: -#line 2111 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2112 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ; break;} case 216: -#line 2115 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2116 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { std::string Name; if (yyvsp[-4].StrVal) { @@ -3955,19 +3956,19 @@ ; break;} case 217: -#line 2155 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2156 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} case 218: -#line 2158 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2159 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} case 219: -#line 2164 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2165 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) @@ -3979,21 +3980,21 @@ ; break;} case 220: -#line 2174 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2175 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; ; break;} case 221: -#line 2178 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2179 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; ; break;} case 223: -#line 2185 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2186 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; @@ -4001,7 +4002,7 @@ ; break;} case 224: -#line 2190 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2191 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; @@ -4009,13 +4010,13 @@ ; break;} case 225: -#line 2195 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2196 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} case 226: -#line 2204 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2205 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -4028,7 +4029,7 @@ ; break;} case 227: -#line 2214 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2215 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -4041,14 +4042,14 @@ ; break;} case 228: -#line 2225 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2226 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = yyvsp[0].ArgList; CHECK_FOR_ERROR ; break;} case 229: -#line 2229 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2230 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = yyvsp[-2].ArgList; struct ArgListEntry E; @@ -4060,7 +4061,7 @@ ; break;} case 230: -#line 2238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2239 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = new ArgListType; struct ArgListEntry E; @@ -4072,14 +4073,14 @@ ; break;} case 231: -#line 2247 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2248 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = 0; CHECK_FOR_ERROR ; break;} case 232: -#line 2253 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2254 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { std::string FunctionName(*yyvsp[-6].StrVal); delete yyvsp[-6].StrVal; // Free strdup'd memory! @@ -4201,7 +4202,7 @@ ; break;} case 235: -#line 2375 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2376 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FunctionVal = CurFun.CurrentFunction; @@ -4212,14 +4213,14 @@ ; break;} case 238: -#line 2386 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2387 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR ; break;} case 239: -#line 2391 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2392 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage); CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility); @@ -4229,77 +4230,77 @@ ; break;} case 240: -#line 2403 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2404 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; CHECK_FOR_ERROR ; break;} case 241: -#line 2407 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2408 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; CHECK_FOR_ERROR ; break;} case 242: -#line 2412 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2413 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); CHECK_FOR_ERROR ; break;} case 243: -#line 2416 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2417 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); CHECK_FOR_ERROR ; break;} case 244: -#line 2420 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2421 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); CHECK_FOR_ERROR ; break;} case 245: -#line 2424 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2425 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR ; break;} case 246: -#line 2428 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2429 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR ; break;} case 247: -#line 2432 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2433 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createNull(); CHECK_FOR_ERROR ; break;} case 248: -#line 2436 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2437 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createUndef(); CHECK_FOR_ERROR ; break;} case 249: -#line 2440 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2441 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. yyval.ValIDVal = ValID::createZeroInit(); CHECK_FOR_ERROR ; break;} case 250: -#line 2444 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2445 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); int NumElements = yyvsp[-1].ConstVector->size(); @@ -4327,14 +4328,14 @@ ; break;} case 251: -#line 2469 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2470 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); CHECK_FOR_ERROR ; break;} case 252: -#line 2473 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2474 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal); delete yyvsp[-2].StrVal; @@ -4343,21 +4344,21 @@ ; break;} case 253: -#line 2483 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2484 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal); CHECK_FOR_ERROR ; break;} case 254: -#line 2487 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2488 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal); CHECK_FOR_ERROR ; break;} case 255: -#line 2491 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2492 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; @@ -4365,7 +4366,7 @@ ; break;} case 256: -#line 2496 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2497 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; @@ -4373,7 +4374,7 @@ ; break;} case 259: -#line 2509 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2510 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -4383,21 +4384,21 @@ ; break;} case 260: -#line 2518 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2519 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR ; break;} case 261: -#line 2522 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2523 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR ; break;} case 262: -#line 2531 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2532 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); CHECK_FOR_ERROR @@ -4408,7 +4409,7 @@ ; break;} case 263: -#line 2540 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2541 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast(yyvsp[0].InstVal)) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -4420,14 +4421,14 @@ ; break;} case 264: -#line 2549 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2550 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR ; break;} case 265: -#line 2553 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2554 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal)); delete yyvsp[0].StrVal; @@ -4436,21 +4437,21 @@ ; break;} case 266: -#line 2560 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2561 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); CHECK_FOR_ERROR ; break;} case 267: -#line 2564 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2565 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... yyval.TermInstVal = new ReturnInst(); CHECK_FOR_ERROR ; break;} case 268: -#line 2568 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2569 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); CHECK_FOR_ERROR @@ -4458,7 +4459,7 @@ ; break;} case 269: -#line 2573 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2574 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { assert(cast(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?"); BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal); @@ -4471,7 +4472,7 @@ ; break;} case 270: -#line 2583 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2584 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal); CHECK_FOR_ERROR @@ -4493,7 +4494,7 @@ ; break;} case 271: -#line 2602 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2603 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal); CHECK_FOR_ERROR @@ -4505,7 +4506,7 @@ ; break;} case 272: -#line 2612 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2613 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -4587,21 +4588,21 @@ ; break;} case 273: -#line 2691 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2692 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TermInstVal = new UnwindInst(); CHECK_FOR_ERROR ; break;} case 274: -#line 2695 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2696 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TermInstVal = new UnreachableInst(); CHECK_FOR_ERROR ; break;} case 275: -#line 2702 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2703 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.JumpTable = yyvsp[-5].JumpTable; Constant *V = cast(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); @@ -4615,7 +4616,7 @@ ; break;} case 276: -#line 2713 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2714 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.JumpTable = new std::vector >(); Constant *V = cast(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); @@ -4630,7 +4631,7 @@ ; break;} case 277: -#line 2726 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2727 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal); @@ -4641,7 +4642,7 @@ ; break;} case 278: -#line 2736 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2737 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription()); @@ -4655,7 +4656,7 @@ ; break;} case 279: -#line 2747 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2748 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.PHIList = yyvsp[-6].PHIList; Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal); @@ -4666,7 +4667,7 @@ ; break;} case 280: -#line 2757 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2758 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -4678,7 +4679,7 @@ ; break;} case 281: -#line 2766 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2767 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -4690,15 +4691,15 @@ ; break;} case 282: -#line 2775 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2776 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValueRefList = new ValueRefList(); ; break;} case 283: -#line 2778 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2779 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValueList = new std::vector(); ; break;} case 284: -#line 2779 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2780 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValueList = yyvsp[-2].ValueList; yyval.ValueList->push_back(yyvsp[0].ValueVal); @@ -4706,21 +4707,21 @@ ; break;} case 285: -#line 2786 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2787 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; CHECK_FOR_ERROR ; break;} case 286: -#line 2790 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2791 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; CHECK_FOR_ERROR ; break;} case 287: -#line 2795 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2796 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4744,7 +4745,7 @@ ; break;} case 288: -#line 2816 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2817 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4764,7 +4765,7 @@ ; break;} case 289: -#line 2833 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2834 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4781,7 +4782,7 @@ ; break;} case 290: -#line 2847 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2848 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4798,7 +4799,7 @@ ; break;} case 291: -#line 2861 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2862 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -4813,7 +4814,7 @@ ; break;} case 292: -#line 2873 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2874 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty) GEN_ERROR("select condition must be boolean"); @@ -4824,7 +4825,7 @@ ; break;} case 293: -#line 2881 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2882 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -4834,7 +4835,7 @@ ; break;} case 294: -#line 2888 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2889 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid extractelement operands"); @@ -4843,7 +4844,7 @@ ; break;} case 295: -#line 2894 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2895 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid insertelement operands"); @@ -4852,7 +4853,7 @@ ; break;} case 296: -#line 2900 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2901 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid shufflevector operands"); @@ -4861,7 +4862,7 @@ ; break;} case 297: -#line 2906 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2907 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = yyvsp[0].PHIList->front().first->getType(); if (!Ty->isFirstClassType()) @@ -4879,7 +4880,7 @@ ; break;} case 298: -#line 2922 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2923 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -4966,28 +4967,28 @@ ; break;} case 299: -#line 3006 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3007 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.InstVal = yyvsp[0].InstVal; CHECK_FOR_ERROR ; break;} case 300: -#line 3011 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3012 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; CHECK_FOR_ERROR ; break;} case 301: -#line 3015 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3016 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; CHECK_FOR_ERROR ; break;} case 302: -#line 3022 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3023 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -4997,7 +4998,7 @@ ; break;} case 303: -#line 3029 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3030 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); @@ -5008,7 +5009,7 @@ ; break;} case 304: -#line 3037 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3038 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -5018,7 +5019,7 @@ ; break;} case 305: -#line 3044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3045 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); @@ -5029,7 +5030,7 @@ ; break;} case 306: -#line 3052 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3053 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa(yyvsp[0].ValueVal->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -5039,7 +5040,7 @@ ; break;} case 307: -#line 3060 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3061 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -5056,7 +5057,7 @@ ; break;} case 308: -#line 3074 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3075 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -5076,7 +5077,7 @@ ; break;} case 309: -#line 3091 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3092 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -5315,7 +5316,7 @@ } return 1; } -#line 3108 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3109 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=41859&r1=41858&r2=41859&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Tue Sep 11 13:33:39 2007 @@ -416,9 +416,10 @@ GenerateError("FP constant invalid for type"); return 0; } - // Lexer has no type info, so builds all FP constants as double. - // Fix this here. - if (Ty==Type::FloatTy) + // Lexer has no type info, so builds all float and double FP constants + // as double. Fix this here. Long double does not need this. + if (&D.ConstPoolFP->getSemantics() == &APFloat::IEEEdouble && + Ty==Type::FloatTy) D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); return ConstantFP::get(Ty, *D.ConstPoolFP); @@ -1868,9 +1869,9 @@ | FPType FPVAL { // Float & Double constants if (!ConstantFP::isValueValidForType($1, *$2)) GEN_ERROR("Floating point constant invalid for type"); - // Lexer has no type info, so builds all FP constants as double. - // Fix this here. - if ($1==Type::FloatTy) + // Lexer has no type info, so builds all float and double FP constants + // as double. Fix this here. Long double is done right. + if (&$2->getSemantics()==&APFloat::IEEEdouble && $1==Type::FloatTy) $2->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); $$ = ConstantFP::get($1, *$2); delete $2; From evan.cheng at apple.com Tue Sep 11 14:52:19 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 11 Sep 2007 19:52:19 -0000 Subject: [llvm-commits] [llvm] r41861 - /llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200709111952.l8BJqJlr010597@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 11 14:52:18 2007 New Revision: 41861 URL: http://llvm.org/viewvc/llvm-project?rev=41861&view=rev Log: Allow set operators with multiple destinations, i.e. (set x, y, (op a, b)). Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=41861&r1=41860&r2=41861&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Tue Sep 11 14:52:18 2007 @@ -676,14 +676,20 @@ // special handling for set, which isn't really an SDNode. if (getOperator()->getName() == "set") { - assert (getNumChildren() == 2 && "Only handle 2 operand set's for now!"); - bool MadeChange = getChild(0)->ApplyTypeConstraints(TP, NotRegisters); - MadeChange |= getChild(1)->ApplyTypeConstraints(TP, NotRegisters); - - // Types of operands must match. - MadeChange |= getChild(0)->UpdateNodeType(getChild(1)->getExtTypes(), TP); - MadeChange |= getChild(1)->UpdateNodeType(getChild(0)->getExtTypes(), TP); - MadeChange |= UpdateNodeType(MVT::isVoid, TP); + assert (getNumChildren() >= 2 && "Missing RHS of a set?"); + unsigned NC = getNumChildren(); + bool MadeChange = false; + for (unsigned i = 0; i < NC-1; ++i) { + MadeChange = getChild(i)->ApplyTypeConstraints(TP, NotRegisters); + MadeChange |= getChild(NC-1)->ApplyTypeConstraints(TP, NotRegisters); + + // Types of operands must match. + MadeChange |= getChild(i)->UpdateNodeType(getChild(NC-1)->getExtTypes(), + TP); + MadeChange |= getChild(NC-1)->UpdateNodeType(getChild(i)->getExtTypes(), + TP); + MadeChange |= UpdateNodeType(MVT::isVoid, TP); + } return MadeChange; } else if (getOperator() == ISE.get_intrinsic_void_sdnode() || getOperator() == ISE.get_intrinsic_w_chain_sdnode() || @@ -1316,6 +1322,7 @@ I->error("Input " + DI->getDef()->getName() + " must be named!"); else if (DI && DI->getDef()->isSubClassOf("Register")) InstImpInputs.push_back(DI->getDef()); + ; } return false; } @@ -1393,15 +1400,13 @@ // Otherwise, this is a set, validate and collect instruction results. if (Pat->getNumChildren() == 0) I->error("set requires operands!"); - else if (Pat->getNumChildren() & 1) - I->error("set requires an even number of operands"); if (Pat->getTransformFn()) I->error("Cannot specify a transform function on a set node!"); // Check the set destinations. - unsigned NumValues = Pat->getNumChildren()/2; - for (unsigned i = 0; i != NumValues; ++i) { + unsigned NumDests = Pat->getNumChildren()-1; + for (unsigned i = 0; i != NumDests; ++i) { TreePatternNode *Dest = Pat->getChild(i); if (!Dest->isLeaf()) I->error("set destination should be a register!"); @@ -1419,15 +1424,16 @@ InstResults[Dest->getName()] = Dest; } else if (Val->getDef()->isSubClassOf("Register")) { InstImpResults.push_back(Val->getDef()); + ; } else { I->error("set destination should be a register!"); } - - // Verify and collect info from the computation. - FindPatternInputsAndOutputs(I, Pat->getChild(i+NumValues), - InstInputs, InstResults, - InstImpInputs, InstImpResults); } + + // Verify and collect info from the computation. + FindPatternInputsAndOutputs(I, Pat->getChild(NumDests), + InstInputs, InstResults, + InstImpInputs, InstImpResults); } /// ParseInstructions - Parse all of the instructions, inlining and resolving @@ -1644,10 +1650,7 @@ TreePatternNode *Pattern = I->getTree(0); TreePatternNode *SrcPattern; if (Pattern->getOperator()->getName() == "set") { - if (Pattern->getNumChildren() != 2) - continue; // Not a set of a single value (not handled so far) - - SrcPattern = Pattern->getChild(1)->clone(); + SrcPattern = Pattern->getChild(Pattern->getNumChildren()-1)->clone(); } else{ // Not a set (store or something?) SrcPattern = Pattern; @@ -2759,7 +2762,7 @@ isRoot ? (InstPat ? InstPat->getOnlyTree() : Pattern) : (InstPat ? InstPat->getOnlyTree() : NULL); if (InstPatNode && InstPatNode->getOperator()->getName() == "set") { - InstPatNode = InstPatNode->getChild(1); + InstPatNode = InstPatNode->getChild(InstPatNode->getNumChildren()-1); } bool HasVarOps = isRoot && II.hasVariableNumberOfOperands; bool HasImpInputs = isRoot && Inst.getNumImpOperands() > 0; From evan.cheng at apple.com Tue Sep 11 14:53:28 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 11 Sep 2007 19:53:28 -0000 Subject: [llvm-commits] [llvm] r41862 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.td Message-ID: <200709111953.l8BJrSOH010637@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 11 14:53:28 2007 New Revision: 41862 URL: http://llvm.org/viewvc/llvm-project?rev=41862&view=rev Log: Added status flags register: EFLAGS. Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.td?rev=41862&r1=41861&r2=41862&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Tue Sep 11 14:53:28 2007 @@ -161,6 +161,9 @@ def ST5 : Register<"ST(5)">, DwarfRegNum<16>; def ST6 : Register<"ST(6)">, DwarfRegNum<17>; def ST7 : Register<"ST(7)">, DwarfRegNum<18>; + + // Status flags register + def EFLAGS : Register<"EFLAGS">; } @@ -516,3 +519,6 @@ } }]; } + +// Status flags registers. +def CCR : RegisterClass<"X86", [i32], 32, [EFLAGS]>; From evan.cheng at apple.com Tue Sep 11 14:55:27 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 11 Sep 2007 19:55:27 -0000 Subject: [llvm-commits] [llvm] r41863 - in /llvm/trunk/lib/Target: ARM/ARMInstrInfo.td ARM/ARMInstrThumb.td ARM/ARMInstrVFP.td Alpha/AlphaInstrInfo.td Mips/MipsInstrInfo.td PowerPC/PPCInstr64Bit.td PowerPC/PPCInstrInfo.td Sparc/SparcInstrInfo.td Target.td X86/X86InstrFPStack.td X86/X86InstrInfo.td X86/X86InstrMMX.td X86/X86InstrSSE.td X86/X86InstrX86-64.td Message-ID: <200709111955.l8BJtS8o010774@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 11 14:55:27 2007 New Revision: 41863 URL: http://llvm.org/viewvc/llvm-project?rev=41863&view=rev Log: Remove (somewhat confusing) Imp<> helper, use let Defs = [], Uses = [] instead. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrThumb.td llvm/trunk/lib/Target/ARM/ARMInstrVFP.td llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td llvm/trunk/lib/Target/Mips/MipsInstrInfo.td llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td llvm/trunk/lib/Target/Target.td llvm/trunk/lib/Target/X86/X86InstrFPStack.td llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86InstrMMX.td llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/lib/Target/X86/X86InstrX86-64.td Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Tue Sep 11 14:55:27 2007 @@ -517,31 +517,35 @@ /// ASI1_bin_s_irs - Similar to AsI1_bin_irs except it sets the 's' bit so the /// instruction modifies the CSPR register. +let Defs = [CPSR] in { multiclass ASI1_bin_s_irs opcod, string opc, PatFrag opnode> { def ri : AI1, Imp<[], [CPSR]>; + [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>; def rr : AI1, Imp<[], [CPSR]>; + [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>; def rs : AI1, Imp<[], [CPSR]>; + [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>; +} } /// AI1_cmp_irs - Defines a set of (op r, {so_imm|r|so_reg}) cmp / test /// patterns. Similar to AsI1_bin_irs except the instruction does not produce /// a explicit result, only implicitly set CPSR. +let Defs = [CPSR] in { multiclass AI1_cmp_irs opcod, string opc, PatFrag opnode> { def ri : AI1, Imp<[], [CPSR]>; + [(opnode GPR:$a, so_imm:$b)]>; def rr : AI1, Imp<[], [CPSR]>; + [(opnode GPR:$a, GPR:$b)]>; def rs : AI1, Imp<[], [CPSR]>; + [(opnode GPR:$a, so_reg:$b)]>; +} } /// AI_unary_rrot - A unary operation with two forms: one whose operand is a @@ -620,16 +624,18 @@ /// AsXI1_bin_c_irs - Same as AsI1_bin_irs but without the predicate operand and /// setting carry bit. But it can optionally set CPSR. +let Uses = [CPSR] in { multiclass AsXI1_bin_c_irs opcod, string opc, PatFrag opnode> { def ri : AXI1, Imp<[CPSR], []>; + [(set GPR:$dst, (opnode GPR:$a, so_imm:$b))]>; def rr : AXI1, Imp<[CPSR], []>; + [(set GPR:$dst, (opnode GPR:$a, GPR:$b))]>; def rs : AXI1, Imp<[CPSR], []>; + [(set GPR:$dst, (opnode GPR:$a, so_reg:$b))]>; +} } //===----------------------------------------------------------------------===// @@ -655,15 +661,17 @@ i32imm:$size), "${instid:label} ${cpidx:cpentry}", []>; +let Defs = [SP], Uses = [SP] in { def ADJCALLSTACKUP : PseudoInst<(outs), (ins i32imm:$amt, pred:$p), "@ ADJCALLSTACKUP $amt", - [(ARMcallseq_end imm:$amt)]>, Imp<[SP],[SP]>; + [(ARMcallseq_end imm:$amt)]>; def ADJCALLSTACKDOWN : PseudoInst<(outs), (ins i32imm:$amt, pred:$p), "@ ADJCALLSTACKDOWN $amt", - [(ARMcallseq_start imm:$amt)]>, Imp<[SP],[SP]>; + [(ARMcallseq_start imm:$amt)]>; +} def DWARF_LOC : PseudoInst<(outs), (ins i32imm:$line, i32imm:$col, i32imm:$file), @@ -963,12 +971,14 @@ // These aren't really mov instructions, but we have to define them this way // due to flag operands. +let Defs = [CPSR] in { def MOVsrl_flag : AI1<0xD, (outs GPR:$dst), (ins GPR:$src), DPRdMisc, "mov", "s $dst, $src, lsr #1", - [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>, Imp<[], [CPSR]>; + [(set GPR:$dst, (ARMsrl_flag GPR:$src))]>; def MOVsra_flag : AI1<0xD, (outs GPR:$dst), (ins GPR:$src), DPRdMisc, "mov", "s $dst, $src, asr #1", - [(set GPR:$dst, (ARMsra_flag GPR:$src))]>, Imp<[], [CPSR]>; + [(set GPR:$dst, (ARMsra_flag GPR:$src))]>; +} //===----------------------------------------------------------------------===// // Extend Instructions. @@ -1034,20 +1044,24 @@ [(set GPR:$dst, (sub so_reg:$b, GPR:$a))]>; // RSB with 's' bit set. +let Defs = [CPSR] in { def RSBSri : AI1<0x3, (outs GPR:$dst), (ins GPR:$a, so_imm:$b), DPRIm, "rsb", "s $dst, $a, $b", - [(set GPR:$dst, (subc so_imm:$b, GPR:$a))]>, Imp<[], [CPSR]>; + [(set GPR:$dst, (subc so_imm:$b, GPR:$a))]>; def RSBSrs : AI1<0x3, (outs GPR:$dst), (ins GPR:$a, so_reg:$b), DPRSoReg, "rsb", "s $dst, $a, $b", - [(set GPR:$dst, (subc so_reg:$b, GPR:$a))]>, Imp<[], [CPSR]>; + [(set GPR:$dst, (subc so_reg:$b, GPR:$a))]>; +} // FIXME: Do not allow RSC to be predicated for now. But they can set CPSR. +let Uses = [CPSR] in { def RSCri : AXI1<0x7, (outs GPR:$dst), (ins GPR:$a, so_imm:$b, cc_out:$s), DPRIm, "rsc${s} $dst, $a, $b", - [(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>, Imp<[CPSR], []>; + [(set GPR:$dst, (sube so_imm:$b, GPR:$a))]>; def RSCrs : AXI1<0x7, (outs GPR:$dst), (ins GPR:$a, so_reg:$b, cc_out:$s), DPRSoReg, "rsc${s} $dst, $a, $b", - [(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>, Imp<[CPSR], []>; + [(set GPR:$dst, (sube so_reg:$b, GPR:$a))]>; +} // (sub X, imm) gets canonicalized to (add X, -imm). Match this form. def : ARMPat<(add GPR:$src, so_imm_neg:$imm), Modified: llvm/trunk/lib/Target/ARM/ARMInstrThumb.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrThumb.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrThumb.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrThumb.td Tue Sep 11 14:55:27 2007 @@ -160,15 +160,17 @@ // Miscellaneous Instructions. // +let Defs = [SP], Uses = [SP] in { def tADJCALLSTACKUP : PseudoInst<(outs), (ins i32imm:$amt), "@ tADJCALLSTACKUP $amt", - [(ARMcallseq_end imm:$amt)]>, Imp<[SP],[SP]>, Requires<[IsThumb]>; + [(ARMcallseq_end imm:$amt)]>, Requires<[IsThumb]>; def tADJCALLSTACKDOWN : PseudoInst<(outs), (ins i32imm:$amt), "@ tADJCALLSTACKDOWN $amt", - [(ARMcallseq_start imm:$amt)]>, Imp<[SP],[SP]>, Requires<[IsThumb]>; + [(ARMcallseq_start imm:$amt)]>, Requires<[IsThumb]>; +} let isNotDuplicable = 1 in def tPICADD : TIt<(outs GPR:$dst), (ins GPR:$lhs, pclabel:$cp), Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Tue Sep 11 14:55:27 2007 @@ -285,7 +285,8 @@ // FMSRR: GPR -> SPR -def FMSTAT : ASI<(outs), (ins), "fmstat", "", [(arm_fmstat)]>, Imp<[], [CPSR]>; +let Defs = [CPSR] in +def FMSTAT : ASI<(outs), (ins), "fmstat", "", [(arm_fmstat)]>; // FMXR: GPR -> VFP Sstem reg Modified: llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td (original) +++ llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td Tue Sep 11 14:55:27 2007 @@ -147,11 +147,11 @@ def WTF : PseudoInstAlpha<(outs), (ins variable_ops), "#wtf", [], s_pseudo>; -let isLoad = 1, hasCtrlDep = 1 in { +let isLoad = 1, hasCtrlDep = 1, Defs = [R30], Uses = [R30] in { def ADJUSTSTACKUP : PseudoInstAlpha<(outs), (ins s64imm:$amt), "; ADJUP $amt", - [(callseq_start imm:$amt)], s_pseudo>, Imp<[R30],[R30]>; + [(callseq_start imm:$amt)], s_pseudo>; def ADJUSTSTACKDOWN : PseudoInstAlpha<(outs), (ins s64imm:$amt), "; ADJDOWN $amt", - [(callseq_end imm:$amt)], s_pseudo>, Imp<[R30],[R30]>; + [(callseq_end imm:$amt)], s_pseudo>; } def ALTENT : PseudoInstAlpha<(outs), (ins s64imm:$TARGET), "$$$TARGET..ng:\n", [], s_pseudo>; def PCLABEL : PseudoInstAlpha<(outs), (ins s64imm:$num), "PCMARKER_$num:\n",[], s_pseudo>; Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Tue Sep 11 14:55:27 2007 @@ -341,12 +341,14 @@ MipsInst; // As stack alignment is always done with addiu, we need a 16-bit immediate +let Defs = [SP], Uses = [SP] in { def ADJCALLSTACKDOWN : Pseudo<(outs), (ins uimm16:$amt), "!ADJCALLSTACKDOWN $amt", - [(callseq_start imm:$amt)]>, Imp<[SP],[SP]>; + [(callseq_start imm:$amt)]>; def ADJCALLSTACKUP : Pseudo<(outs), (ins uimm16:$amt), "!ADJCALLSTACKUP $amt", - [(callseq_end imm:$amt)]>, Imp<[SP],[SP]>; + [(callseq_end imm:$amt)]>; +} def IMPLICIT_DEF_CPURegs : Pseudo<(outs CPURegs:$dst), (ins), "!IMPLICIT_DEF $dst", Modified: llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstr64Bit.td Tue Sep 11 14:55:27 2007 @@ -130,11 +130,11 @@ PPC970_DGroup_First, PPC970_Unit_FXU; } +let Defs = [X1], Uses = [X1] in def DYNALLOC8 : Pseudo<(outs G8RC:$result), (ins G8RC:$negsize, memri:$fpsi), "${:comment} DYNALLOC8 $result, $negsize, $fpsi", [(set G8RC:$result, - (PPCdynalloc G8RC:$negsize, iaddr:$fpsi))]>, - Imp<[X1],[X1]>; + (PPCdynalloc G8RC:$negsize, iaddr:$fpsi))]>; def MTLR8 : XFXForm_7_ext<31, 467, 8, (outs), (ins G8RC:$rS), "mtlr $rS", SprMTSPR>, Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Tue Sep 11 14:55:27 2007 @@ -297,22 +297,24 @@ // Pseudo-instructions: let hasCtrlDep = 1 in { +let Defs = [R1], Uses = [R1] in { def ADJCALLSTACKDOWN : Pseudo<(outs), (ins u16imm:$amt), "${:comment} ADJCALLSTACKDOWN", - [(callseq_start imm:$amt)]>, Imp<[R1],[R1]>; + [(callseq_start imm:$amt)]>; def ADJCALLSTACKUP : Pseudo<(outs), (ins u16imm:$amt), "${:comment} ADJCALLSTACKUP", - [(callseq_end imm:$amt)]>, Imp<[R1],[R1]>; + [(callseq_end imm:$amt)]>; +} def UPDATE_VRSAVE : Pseudo<(outs GPRC:$rD), (ins GPRC:$rS), "UPDATE_VRSAVE $rD, $rS", []>; } +let Defs = [R1], Uses = [R1] in def DYNALLOC : Pseudo<(outs GPRC:$result), (ins GPRC:$negsize, memri:$fpsi), "${:comment} DYNALLOC $result, $negsize, $fpsi", [(set GPRC:$result, - (PPCdynalloc GPRC:$negsize, iaddr:$fpsi))]>, - Imp<[R1],[R1]>; + (PPCdynalloc GPRC:$negsize, iaddr:$fpsi))]>; def IMPLICIT_DEF_GPRC: Pseudo<(outs GPRC:$rD), (ins), "${:comment}IMPLICIT_DEF_GPRC $rD", Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td (original) +++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td Tue Sep 11 14:55:27 2007 @@ -201,12 +201,14 @@ class Pseudo pattern> : InstSP; +let Defs = [O6], Uses = [O6] in { def ADJCALLSTACKDOWN : Pseudo<(outs), (ins i32imm:$amt), "!ADJCALLSTACKDOWN $amt", - [(callseq_start imm:$amt)]>, Imp<[O6],[O6]>; + [(callseq_start imm:$amt)]>; def ADJCALLSTACKUP : Pseudo<(outs), (ins i32imm:$amt), "!ADJCALLSTACKUP $amt", - [(callseq_end imm:$amt)]>, Imp<[O6],[O6]>; + [(callseq_end imm:$amt)]>; +} def IMPLICIT_DEF_Int : Pseudo<(outs IntRegs:$dst), (ins), "!IMPLICIT_DEF $dst", [(set IntRegs:$dst, (undef))]>; Modified: llvm/trunk/lib/Target/Target.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Target.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/Target.td (original) +++ llvm/trunk/lib/Target/Target.td Tue Sep 11 14:55:27 2007 @@ -203,13 +203,6 @@ string DisableEncoding = ""; } -/// Imp - Helper class for specifying the implicit uses/defs set for an -/// instruction. -class Imp uses, list defs> { - list Uses = uses; - list Defs = defs; -} - /// Predicates - These are extra conditionals which are turned into instruction /// selector matching code. Currently each predicate is just a string. class Predicate { Modified: llvm/trunk/lib/Target/X86/X86InstrFPStack.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFPStack.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFPStack.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFPStack.td Tue Sep 11 14:55:27 2007 @@ -141,14 +141,16 @@ def FpGETRESULT80 : FpI_<(outs RFP80:$dst), (ins), SpecialFP, [(set RFP80:$dst, X86fpget)]>; // FPR = ST(0) +let Defs = [ST0] in { def FpSETRESULT32 : FpI_<(outs), (ins RFP32:$src), SpecialFP, - [(X86fpset RFP32:$src)]>, Imp<[], [ST0]>;// ST(0) = FPR + [(X86fpset RFP32:$src)]>;// ST(0) = FPR def FpSETRESULT64 : FpI_<(outs), (ins RFP64:$src), SpecialFP, - [(X86fpset RFP64:$src)]>, Imp<[], [ST0]>;// ST(0) = FPR + [(X86fpset RFP64:$src)]>;// ST(0) = FPR def FpSETRESULT80 : FpI_<(outs), (ins RFP80:$src), SpecialFP, - [(X86fpset RFP80:$src)]>, Imp<[], [ST0]>;// ST(0) = FPR + [(X86fpset RFP80:$src)]>;// ST(0) = FPR +} // FpI - Floating Point Psuedo Instruction template. Predicated on FPStack. // Note that f80-only instructions are used even in SSE mode and use FpI_ @@ -486,26 +488,29 @@ def UCOM_FpIr80: FpI_<(outs), (ins RFP80:$lhs, RFP80:$rhs), CompareFP, [(X86cmp RFP80:$lhs, RFP80:$rhs)]>; // CC = ST(0) cmp ST(i) +let Uses = [ST0] in { def UCOM_Fr : FPI<0xE0, AddRegFrm, // FPSW = cmp ST(0) with ST(i) (outs), (ins RST:$reg), - "fucom\t$reg">, DD, Imp<[ST0],[]>; + "fucom\t$reg">, DD; def UCOM_FPr : FPI<0xE8, AddRegFrm, // FPSW = cmp ST(0) with ST(i), pop (outs), (ins RST:$reg), - "fucomp\t$reg">, DD, Imp<[ST0],[]>; + "fucomp\t$reg">, DD; def UCOM_FPPr : FPI<0xE9, RawFrm, // cmp ST(0) with ST(1), pop, pop (outs), (ins), - "fucompp">, DA, Imp<[ST0],[]>; + "fucompp">, DA; def UCOM_FIr : FPI<0xE8, AddRegFrm, // CC = cmp ST(0) with ST(i) (outs), (ins RST:$reg), - "fucomi\t{$reg, %st(0)|%ST(0), $reg}">, DB, Imp<[ST0],[]>; + "fucomi\t{$reg, %st(0)|%ST(0), $reg}">, DB; def UCOM_FIPr : FPI<0xE8, AddRegFrm, // CC = cmp ST(0) with ST(i), pop (outs), (ins RST:$reg), - "fucomip\t{$reg, %st(0)|%ST(0), $reg}">, DF, Imp<[ST0],[]>; + "fucomip\t{$reg, %st(0)|%ST(0), $reg}">, DF; +} // Floating point flag ops. +let Defs = [AX] in def FNSTSW8r : I<0xE0, RawFrm, // AX = fp flags - (outs), (ins), "fnstsw", []>, DF, Imp<[],[AX]>; + (outs), (ins), "fnstsw", []>, DF; def FNSTCW16m : I<0xD9, MRM7m, // [mem16] = X87 control world (outs), (ins i16mem:$dst), "fnstcw\t$dst", []>; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Tue Sep 11 14:55:27 2007 @@ -246,12 +246,13 @@ // ADJCALLSTACKDOWN/UP implicitly use/def ESP because they may be expanded into // a stack adjustment and the codegen must know that they may modify the stack // pointer before prolog-epilog rewriting occurs. +let Defs = [ESP], Uses = [ESP] in { def ADJCALLSTACKDOWN : I<0, Pseudo, (outs), (ins i32imm:$amt), "#ADJCALLSTACKDOWN", - [(X86callseq_start imm:$amt)]>, Imp<[ESP],[ESP]>; + [(X86callseq_start imm:$amt)]>; def ADJCALLSTACKUP : I<0, Pseudo, (outs), (ins i32imm:$amt1, i32imm:$amt2), "#ADJCALLSTACKUP", - [(X86callseq_end imm:$amt1, imm:$amt2)]>, - Imp<[ESP],[ESP]>; + [(X86callseq_end imm:$amt1, imm:$amt2)]>; +} def IMPLICIT_USE : I<0, Pseudo, (outs), (ins variable_ops), "#IMPLICIT_USE", []>; def IMPLICIT_DEF : I<0, Pseudo, (outs variable_ops), (ins), @@ -364,13 +365,17 @@ //===----------------------------------------------------------------------===// // Miscellaneous Instructions... // +let Defs = [EBP, ESP], Uses = [EBP, ESP] in def LEAVE : I<0xC9, RawFrm, - (outs), (ins), "leave", []>, Imp<[EBP,ESP],[EBP,ESP]>; + (outs), (ins), "leave", []>; + +let Defs = [ESP], Uses = [ESP] in { def POP32r : I<0x58, AddRegFrm, - (outs GR32:$reg), (ins), "pop{l}\t$reg", []>, Imp<[ESP],[ESP]>; + (outs GR32:$reg), (ins), "pop{l}\t$reg", []>; def PUSH32r : I<0x50, AddRegFrm, - (outs), (ins GR32:$reg), "push{l}\t$reg", []>, Imp<[ESP],[ESP]>; + (outs), (ins GR32:$reg), "push{l}\t$reg", []>; +} def MovePCtoStack : I<0, Pseudo, (outs), (ins piclabel:$label), "call\t$label", []>; @@ -419,77 +424,71 @@ "lea{l}\t{$src|$dst}, {$dst|$src}", [(set GR32:$dst, lea32addr:$src)]>, Requires<[In32BitMode]>; +let Defs = [ECX,EDI,ESI], Uses = [ECX,EDI,ESI] in { def REP_MOVSB : I<0xA4, RawFrm, (outs), (ins), "{rep;movsb|rep movsb}", - [(X86rep_movs i8)]>, - Imp<[ECX,EDI,ESI], [ECX,EDI,ESI]>, REP; + [(X86rep_movs i8)]>, REP; def REP_MOVSW : I<0xA5, RawFrm, (outs), (ins), "{rep;movsw|rep movsw}", - [(X86rep_movs i16)]>, - Imp<[ECX,EDI,ESI], [ECX,EDI,ESI]>, REP, OpSize; + [(X86rep_movs i16)]>, REP, OpSize; def REP_MOVSD : I<0xA5, RawFrm, (outs), (ins), "{rep;movsl|rep movsd}", - [(X86rep_movs i32)]>, - Imp<[ECX,EDI,ESI], [ECX,EDI,ESI]>, REP; + [(X86rep_movs i32)]>, REP; +} +let Defs = [ECX,EDI], Uses = [AL,ECX,EDI] in def REP_STOSB : I<0xAA, RawFrm, (outs), (ins), "{rep;stosb|rep stosb}", - [(X86rep_stos i8)]>, - Imp<[AL,ECX,EDI], [ECX,EDI]>, REP; + [(X86rep_stos i8)]>, REP; +let Defs = [ECX,EDI], Uses = [AX,ECX,EDI] in def REP_STOSW : I<0xAB, RawFrm, (outs), (ins), "{rep;stosw|rep stosw}", - [(X86rep_stos i16)]>, - Imp<[AX,ECX,EDI], [ECX,EDI]>, REP, OpSize; + [(X86rep_stos i16)]>, REP, OpSize; +let Defs = [ECX,EDI], Uses = [EAX,ECX,EDI] in def REP_STOSD : I<0xAB, RawFrm, (outs), (ins), "{rep;stosl|rep stosd}", - [(X86rep_stos i32)]>, - Imp<[EAX,ECX,EDI], [ECX,EDI]>, REP; + [(X86rep_stos i32)]>, REP; +let Defs = [RAX, RDX] in def RDTSC : I<0x31, RawFrm, (outs), (ins), "rdtsc", [(X86rdtsc)]>, - TB, Imp<[],[RAX,RDX]>; + TB; //===----------------------------------------------------------------------===// // Input/Output Instructions... // +let Defs = [AL], Uses = [DX] in def IN8rr : I<0xEC, RawFrm, (outs), (ins), - "in{b}\t{%dx, %al|%AL, %DX}", - []>, Imp<[DX], [AL]>; + "in{b}\t{%dx, %al|%AL, %DX}", []>; +let Defs = [AX], Uses = [DX] in def IN16rr : I<0xED, RawFrm, (outs), (ins), - "in{w}\t{%dx, %ax|%AX, %DX}", - []>, Imp<[DX], [AX]>, OpSize; + "in{w}\t{%dx, %ax|%AX, %DX}", []>, OpSize; +let Defs = [EAX], Uses = [DX] in def IN32rr : I<0xED, RawFrm, (outs), (ins), - "in{l}\t{%dx, %eax|%EAX, %DX}", - []>, Imp<[DX],[EAX]>; + "in{l}\t{%dx, %eax|%EAX, %DX}", []>; +let Defs = [AL] in def IN8ri : Ii8<0xE4, RawFrm, (outs), (ins i16i8imm:$port), - "in{b}\t{$port, %al|%AL, $port}", - []>, - Imp<[], [AL]>; + "in{b}\t{$port, %al|%AL, $port}", []>; +let Defs = [AX] in def IN16ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port), - "in{w}\t{$port, %ax|%AX, $port}", - []>, - Imp<[], [AX]>, OpSize; + "in{w}\t{$port, %ax|%AX, $port}", []>, OpSize; +let Defs = [EAX] in def IN32ri : Ii8<0xE5, RawFrm, (outs), (ins i16i8imm:$port), - "in{l}\t{$port, %eax|%EAX, $port}", - []>, - Imp<[],[EAX]>; + "in{l}\t{$port, %eax|%EAX, $port}", []>; +let Uses = [DX, AL] in def OUT8rr : I<0xEE, RawFrm, (outs), (ins), - "out{b}\t{%al, %dx|%DX, %AL}", - []>, Imp<[DX, AL], []>; + "out{b}\t{%al, %dx|%DX, %AL}", []>; +let Uses = [DX, AX] in def OUT16rr : I<0xEF, RawFrm, (outs), (ins), - "out{w}\t{%ax, %dx|%DX, %AX}", - []>, Imp<[DX, AX], []>, OpSize; + "out{w}\t{%ax, %dx|%DX, %AX}", []>, OpSize; +let Uses = [DX, EAX] in def OUT32rr : I<0xEF, RawFrm, (outs), (ins), - "out{l}\t{%eax, %dx|%DX, %EAX}", - []>, Imp<[DX, EAX], []>; + "out{l}\t{%eax, %dx|%DX, %EAX}", []>; +let Uses = [AL] in def OUT8ir : Ii8<0xE6, RawFrm, (outs), (ins i16i8imm:$port), - "out{b}\t{%al, $port|$port, %AL}", - []>, - Imp<[AL], []>; + "out{b}\t{%al, $port|$port, %AL}", []>; +let Uses = [AX] in def OUT16ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port), - "out{w}\t{%ax, $port|$port, %AX}", - []>, - Imp<[AX], []>, OpSize; + "out{w}\t{%ax, $port|$port, %AX}", []>, OpSize; +let Uses = [EAX] in def OUT32ir : Ii8<0xE7, RawFrm, (outs), (ins i16i8imm:$port), - "out{l}\t{%eax, $port|$port, %EAX}", - []>, - Imp<[EAX], []>; + "out{l}\t{%eax, $port|$port, %EAX}", []>; //===----------------------------------------------------------------------===// // Move Instructions... @@ -548,71 +547,90 @@ // // Extra precision multiplication +let Defs = [AL,AH], Uses = [AL] in def MUL8r : I<0xF6, MRM4r, (outs), (ins GR8:$src), "mul{b}\t$src", // FIXME: Used for 8-bit mul, ignore result upper 8 bits. // This probably ought to be moved to a def : Pat<> if the // syntax can be accepted. - [(set AL, (mul AL, GR8:$src))]>, - Imp<[AL],[AL,AH]>; // AL,AH = AL*GR8 + [(set AL, (mul AL, GR8:$src))]>; // AL,AH = AL*GR8 +let Defs = [AX,DX], Uses = [AX] in def MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src), "mul{w}\t$src", []>, - Imp<[AX],[AX,DX]>, OpSize; // AX,DX = AX*GR16 -def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src), "mul{l}\t$src", []>, - Imp<[EAX],[EAX,EDX]>; // EAX,EDX = EAX*GR32 + OpSize; // AX,DX = AX*GR16 +let Defs = [EAX,EDX], Uses = [EAX] in +def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src), "mul{l}\t$src", []>; + // EAX,EDX = EAX*GR32 +let Defs = [AL,AH], Uses = [AL] in def MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src), "mul{b}\t$src", // FIXME: Used for 8-bit mul, ignore result upper 8 bits. // This probably ought to be moved to a def : Pat<> if the // syntax can be accepted. - [(set AL, (mul AL, (loadi8 addr:$src)))]>, - Imp<[AL],[AL,AH]>; // AL,AH = AL*[mem8] + [(set AL, (mul AL, (loadi8 addr:$src)))]>; // AL,AH = AL*[mem8] +let Defs = [AX,DX], Uses = [AX] in def MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src), - "mul{w}\t$src", []>, Imp<[AX],[AX,DX]>, - OpSize; // AX,DX = AX*[mem16] + "mul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16] +let Defs = [EAX,EDX], Uses = [EAX] in def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src), - "mul{l}\t$src", []>, Imp<[EAX],[EAX,EDX]>;// EAX,EDX = EAX*[mem32] + "mul{l}\t$src", []>; // EAX,EDX = EAX*[mem32] -def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>, - Imp<[AL],[AL,AH]>; // AL,AH = AL*GR8 +let Defs = [AL,AH], Uses = [AL] in +def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>; + // AL,AH = AL*GR8 +let Defs = [AX,DX], Uses = [AX] in def IMUL16r : I<0xF7, MRM5r, (outs), (ins GR16:$src), "imul{w}\t$src", []>, - Imp<[AX],[AX,DX]>, OpSize; // AX,DX = AX*GR16 -def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>, - Imp<[EAX],[EAX,EDX]>; // EAX,EDX = EAX*GR32 + OpSize; // AX,DX = AX*GR16 +let Defs = [EAX,EDX], Uses = [EAX] in +def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>; + // EAX,EDX = EAX*GR32 +let Defs = [AL,AH], Uses = [AL] in def IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src), - "imul{b}\t$src", []>, Imp<[AL],[AL,AH]>; // AL,AH = AL*[mem8] + "imul{b}\t$src", []>; // AL,AH = AL*[mem8] +let Defs = [AX,DX], Uses = [AX] in def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src), - "imul{w}\t$src", []>, Imp<[AX],[AX,DX]>, - OpSize; // AX,DX = AX*[mem16] + "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16] +let Defs = [EAX,EDX], Uses = [EAX] in def IMUL32m : I<0xF7, MRM5m, (outs), (ins i32mem:$src), - "imul{l}\t$src", []>, - Imp<[EAX],[EAX,EDX]>; // EAX,EDX = EAX*[mem32] + "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32] // unsigned division/remainder +let Defs = [AX], Uses = [AL,AH] in def DIV8r : I<0xF6, MRM6r, (outs), (ins GR8:$src), // AX/r8 = AL,AH - "div{b}\t$src", []>, Imp<[AX],[AX]>; + "div{b}\t$src", []>; +let Defs = [AX,DX], Uses = [AX,DX] in def DIV16r : I<0xF7, MRM6r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX - "div{w}\t$src", []>, Imp<[AX,DX],[AX,DX]>, OpSize; + "div{w}\t$src", []>, OpSize; +let Defs = [EAX,EDX], Uses = [EAX,EDX] in def DIV32r : I<0xF7, MRM6r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX - "div{l}\t$src", []>, Imp<[EAX,EDX],[EAX,EDX]>; + "div{l}\t$src", []>; +let Defs = [AX], Uses = [AL,AH] in def DIV8m : I<0xF6, MRM6m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH - "div{b}\t$src", []>, Imp<[AX],[AX]>; + "div{b}\t$src", []>; +let Defs = [AX,DX], Uses = [AX,DX] in def DIV16m : I<0xF7, MRM6m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX - "div{w}\t$src", []>, Imp<[AX,DX],[AX,DX]>, OpSize; + "div{w}\t$src", []>, OpSize; +let Defs = [EAX,EDX], Uses = [EAX,EDX] in def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX - "div{l}\t$src", []>, Imp<[EAX,EDX],[EAX,EDX]>; + "div{l}\t$src", []>; // Signed division/remainder. +let Defs = [AX], Uses = [AL,AH] in def IDIV8r : I<0xF6, MRM7r, (outs), (ins GR8:$src), // AX/r8 = AL,AH - "idiv{b}\t$src", []>, Imp<[AX],[AX]>; + "idiv{b}\t$src", []>; +let Defs = [AX,DX], Uses = [AX,DX] in def IDIV16r: I<0xF7, MRM7r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX - "idiv{w}\t$src", []>, Imp<[AX,DX],[AX,DX]>, OpSize; + "idiv{w}\t$src", []>, OpSize; +let Defs = [EAX,EDX], Uses = [EAX,EDX] in def IDIV32r: I<0xF7, MRM7r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX - "idiv{l}\t$src", []>, Imp<[EAX,EDX],[EAX,EDX]>; + "idiv{l}\t$src", []>; +let Defs = [AX], Uses = [AL,AH] in def IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH - "idiv{b}\t$src", []>, Imp<[AX],[AX]>; + "idiv{b}\t$src", []>; +let Defs = [AX,DX], Uses = [AX,DX] in def IDIV16m: I<0xF7, MRM7m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX - "idiv{w}\t$src", []>, Imp<[AX,DX],[AX,DX]>, OpSize; + "idiv{w}\t$src", []>, OpSize; +let Defs = [EAX,EDX], Uses = [EAX,EDX] in def IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX - "idiv{l}\t$src", []>, Imp<[EAX,EDX],[EAX,EDX]>; + "idiv{l}\t$src", []>; //===----------------------------------------------------------------------===// @@ -1291,15 +1309,17 @@ } // Shift instructions +let Uses = [CL] in { def SHL8rCL : I<0xD2, MRM4r, (outs GR8 :$dst), (ins GR8 :$src), "shl{b}\t{%cl, $dst|$dst, %CL}", - [(set GR8:$dst, (shl GR8:$src, CL))]>, Imp<[CL],[]>; + [(set GR8:$dst, (shl GR8:$src, CL))]>; def SHL16rCL : I<0xD3, MRM4r, (outs GR16:$dst), (ins GR16:$src), "shl{w}\t{%cl, $dst|$dst, %CL}", - [(set GR16:$dst, (shl GR16:$src, CL))]>, Imp<[CL],[]>, OpSize; + [(set GR16:$dst, (shl GR16:$src, CL))]>, OpSize; def SHL32rCL : I<0xD3, MRM4r, (outs GR32:$dst), (ins GR32:$src), "shl{l}\t{%cl, $dst|$dst, %CL}", - [(set GR32:$dst, (shl GR32:$src, CL))]>, Imp<[CL],[]>; + [(set GR32:$dst, (shl GR32:$src, CL))]>; +} def SHL8ri : Ii8<0xC0, MRM4r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2), "shl{b}\t{$src2, $dst|$dst, $src2}", @@ -1322,18 +1342,17 @@ "shl{l}\t$dst", []>; let isTwoAddress = 0 in { + let Uses = [CL] in { def SHL8mCL : I<0xD2, MRM4m, (outs), (ins i8mem :$dst), "shl{b}\t{%cl, $dst|$dst, %CL}", - [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (shl (loadi8 addr:$dst), CL), addr:$dst)]>; def SHL16mCL : I<0xD3, MRM4m, (outs), (ins i16mem:$dst), "shl{w}\t{%cl, $dst|$dst, %CL}", - [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>, OpSize; + [(store (shl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; def SHL32mCL : I<0xD3, MRM4m, (outs), (ins i32mem:$dst), "shl{l}\t{%cl, $dst|$dst, %CL}", - [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (shl (loadi32 addr:$dst), CL), addr:$dst)]>; + } def SHL8mi : Ii8<0xC0, MRM4m, (outs), (ins i8mem :$dst, i8imm:$src), "shl{b}\t{$src, $dst|$dst, $src}", [(store (shl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; @@ -1358,15 +1377,17 @@ [(store (shl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; } +let Uses = [CL] in { def SHR8rCL : I<0xD2, MRM5r, (outs GR8 :$dst), (ins GR8 :$src), "shr{b}\t{%cl, $dst|$dst, %CL}", - [(set GR8:$dst, (srl GR8:$src, CL))]>, Imp<[CL],[]>; + [(set GR8:$dst, (srl GR8:$src, CL))]>; def SHR16rCL : I<0xD3, MRM5r, (outs GR16:$dst), (ins GR16:$src), "shr{w}\t{%cl, $dst|$dst, %CL}", - [(set GR16:$dst, (srl GR16:$src, CL))]>, Imp<[CL],[]>, OpSize; + [(set GR16:$dst, (srl GR16:$src, CL))]>, OpSize; def SHR32rCL : I<0xD3, MRM5r, (outs GR32:$dst), (ins GR32:$src), "shr{l}\t{%cl, $dst|$dst, %CL}", - [(set GR32:$dst, (srl GR32:$src, CL))]>, Imp<[CL],[]>; + [(set GR32:$dst, (srl GR32:$src, CL))]>; +} def SHR8ri : Ii8<0xC0, MRM5r, (outs GR8:$dst), (ins GR8:$src1, i8imm:$src2), "shr{b}\t{$src2, $dst|$dst, $src2}", @@ -1390,18 +1411,18 @@ [(set GR32:$dst, (srl GR32:$src1, (i8 1)))]>; let isTwoAddress = 0 in { + let Uses = [CL] in { def SHR8mCL : I<0xD2, MRM5m, (outs), (ins i8mem :$dst), "shr{b}\t{%cl, $dst|$dst, %CL}", - [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (srl (loadi8 addr:$dst), CL), addr:$dst)]>; def SHR16mCL : I<0xD3, MRM5m, (outs), (ins i16mem:$dst), "shr{w}\t{%cl, $dst|$dst, %CL}", [(store (srl (loadi16 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>, OpSize; + OpSize; def SHR32mCL : I<0xD3, MRM5m, (outs), (ins i32mem:$dst), "shr{l}\t{%cl, $dst|$dst, %CL}", - [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (srl (loadi32 addr:$dst), CL), addr:$dst)]>; + } def SHR8mi : Ii8<0xC0, MRM5m, (outs), (ins i8mem :$dst, i8imm:$src), "shr{b}\t{$src, $dst|$dst, $src}", [(store (srl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; @@ -1425,15 +1446,17 @@ [(store (srl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; } +let Uses = [CL] in { def SAR8rCL : I<0xD2, MRM7r, (outs GR8 :$dst), (ins GR8 :$src), "sar{b}\t{%cl, $dst|$dst, %CL}", - [(set GR8:$dst, (sra GR8:$src, CL))]>, Imp<[CL],[]>; + [(set GR8:$dst, (sra GR8:$src, CL))]>; def SAR16rCL : I<0xD3, MRM7r, (outs GR16:$dst), (ins GR16:$src), "sar{w}\t{%cl, $dst|$dst, %CL}", - [(set GR16:$dst, (sra GR16:$src, CL))]>, Imp<[CL],[]>, OpSize; + [(set GR16:$dst, (sra GR16:$src, CL))]>, OpSize; def SAR32rCL : I<0xD3, MRM7r, (outs GR32:$dst), (ins GR32:$src), "sar{l}\t{%cl, $dst|$dst, %CL}", - [(set GR32:$dst, (sra GR32:$src, CL))]>, Imp<[CL],[]>; + [(set GR32:$dst, (sra GR32:$src, CL))]>; +} def SAR8ri : Ii8<0xC0, MRM7r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2), "sar{b}\t{$src2, $dst|$dst, $src2}", @@ -1458,18 +1481,17 @@ [(set GR32:$dst, (sra GR32:$src1, (i8 1)))]>; let isTwoAddress = 0 in { + let Uses = [CL] in { def SAR8mCL : I<0xD2, MRM7m, (outs), (ins i8mem :$dst), "sar{b}\t{%cl, $dst|$dst, %CL}", - [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (sra (loadi8 addr:$dst), CL), addr:$dst)]>; def SAR16mCL : I<0xD3, MRM7m, (outs), (ins i16mem:$dst), "sar{w}\t{%cl, $dst|$dst, %CL}", - [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>, OpSize; + [(store (sra (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; def SAR32mCL : I<0xD3, MRM7m, (outs), (ins i32mem:$dst), "sar{l}\t{%cl, $dst|$dst, %CL}", - [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (sra (loadi32 addr:$dst), CL), addr:$dst)]>; + } def SAR8mi : Ii8<0xC0, MRM7m, (outs), (ins i8mem :$dst, i8imm:$src), "sar{b}\t{$src, $dst|$dst, $src}", [(store (sra (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; @@ -1496,15 +1518,17 @@ // Rotate instructions // FIXME: provide shorter instructions when imm8 == 1 +let Uses = [CL] in { def ROL8rCL : I<0xD2, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), "rol{b}\t{%cl, $dst|$dst, %CL}", - [(set GR8:$dst, (rotl GR8:$src, CL))]>, Imp<[CL],[]>; + [(set GR8:$dst, (rotl GR8:$src, CL))]>; def ROL16rCL : I<0xD3, MRM0r, (outs GR16:$dst), (ins GR16:$src), "rol{w}\t{%cl, $dst|$dst, %CL}", - [(set GR16:$dst, (rotl GR16:$src, CL))]>, Imp<[CL],[]>, OpSize; + [(set GR16:$dst, (rotl GR16:$src, CL))]>, OpSize; def ROL32rCL : I<0xD3, MRM0r, (outs GR32:$dst), (ins GR32:$src), "rol{l}\t{%cl, $dst|$dst, %CL}", - [(set GR32:$dst, (rotl GR32:$src, CL))]>, Imp<[CL],[]>; + [(set GR32:$dst, (rotl GR32:$src, CL))]>; +} def ROL8ri : Ii8<0xC0, MRM0r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2), "rol{b}\t{$src2, $dst|$dst, $src2}", @@ -1528,18 +1552,17 @@ [(set GR32:$dst, (rotl GR32:$src1, (i8 1)))]>; let isTwoAddress = 0 in { + let Uses = [CL] in { def ROL8mCL : I<0xD2, MRM0m, (outs), (ins i8mem :$dst), "rol{b}\t{%cl, $dst|$dst, %CL}", - [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (rotl (loadi8 addr:$dst), CL), addr:$dst)]>; def ROL16mCL : I<0xD3, MRM0m, (outs), (ins i16mem:$dst), "rol{w}\t{%cl, $dst|$dst, %CL}", - [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>, OpSize; + [(store (rotl (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; def ROL32mCL : I<0xD3, MRM0m, (outs), (ins i32mem:$dst), "rol{l}\t{%cl, $dst|$dst, %CL}", - [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (rotl (loadi32 addr:$dst), CL), addr:$dst)]>; + } def ROL8mi : Ii8<0xC0, MRM0m, (outs), (ins i8mem :$dst, i8imm:$src), "rol{b}\t{$src, $dst|$dst, $src}", [(store (rotl (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; @@ -1564,15 +1587,17 @@ [(store (rotl (loadi32 addr:$dst), (i8 1)), addr:$dst)]>; } +let Uses = [CL] in { def ROR8rCL : I<0xD2, MRM1r, (outs GR8 :$dst), (ins GR8 :$src), "ror{b}\t{%cl, $dst|$dst, %CL}", - [(set GR8:$dst, (rotr GR8:$src, CL))]>, Imp<[CL],[]>; + [(set GR8:$dst, (rotr GR8:$src, CL))]>; def ROR16rCL : I<0xD3, MRM1r, (outs GR16:$dst), (ins GR16:$src), "ror{w}\t{%cl, $dst|$dst, %CL}", - [(set GR16:$dst, (rotr GR16:$src, CL))]>, Imp<[CL],[]>, OpSize; + [(set GR16:$dst, (rotr GR16:$src, CL))]>, OpSize; def ROR32rCL : I<0xD3, MRM1r, (outs GR32:$dst), (ins GR32:$src), "ror{l}\t{%cl, $dst|$dst, %CL}", - [(set GR32:$dst, (rotr GR32:$src, CL))]>, Imp<[CL],[]>; + [(set GR32:$dst, (rotr GR32:$src, CL))]>; +} def ROR8ri : Ii8<0xC0, MRM1r, (outs GR8 :$dst), (ins GR8 :$src1, i8imm:$src2), "ror{b}\t{$src2, $dst|$dst, $src2}", @@ -1596,18 +1621,17 @@ [(set GR32:$dst, (rotr GR32:$src1, (i8 1)))]>; let isTwoAddress = 0 in { + let Uses = [CL] in { def ROR8mCL : I<0xD2, MRM1m, (outs), (ins i8mem :$dst), "ror{b}\t{%cl, $dst|$dst, %CL}", - [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (rotr (loadi8 addr:$dst), CL), addr:$dst)]>; def ROR16mCL : I<0xD3, MRM1m, (outs), (ins i16mem:$dst), "ror{w}\t{%cl, $dst|$dst, %CL}", - [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>, OpSize; + [(store (rotr (loadi16 addr:$dst), CL), addr:$dst)]>, OpSize; def ROR32mCL : I<0xD3, MRM1m, (outs), (ins i32mem:$dst), "ror{l}\t{%cl, $dst|$dst, %CL}", - [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (rotr (loadi32 addr:$dst), CL), addr:$dst)]>; + } def ROR8mi : Ii8<0xC0, MRM1m, (outs), (ins i8mem :$dst, i8imm:$src), "ror{b}\t{$src, $dst|$dst, $src}", [(store (rotr (loadi8 addr:$dst), (i8 imm:$src)), addr:$dst)]>; @@ -1635,22 +1659,22 @@ // Double shift instructions (generalizations of rotate) +let Uses = [CL] in { def SHLD32rrCL : I<0xA5, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}", - [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>, - Imp<[CL],[]>, TB; + [(set GR32:$dst, (X86shld GR32:$src1, GR32:$src2, CL))]>, TB; def SHRD32rrCL : I<0xAD, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}", - [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>, - Imp<[CL],[]>, TB; + [(set GR32:$dst, (X86shrd GR32:$src1, GR32:$src2, CL))]>, TB; def SHLD16rrCL : I<0xA5, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}", [(set GR16:$dst, (X86shld GR16:$src1, GR16:$src2, CL))]>, - Imp<[CL],[]>, TB, OpSize; + TB, OpSize; def SHRD16rrCL : I<0xAD, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}", [(set GR16:$dst, (X86shrd GR16:$src1, GR16:$src2, CL))]>, - Imp<[CL],[]>, TB, OpSize; + TB, OpSize; +} let isCommutable = 1 in { // These instructions commute to each other. def SHLD32rri8 : Ii8<0xA4, MRMDestReg, @@ -1680,16 +1704,16 @@ } let isTwoAddress = 0 in { + let Uses = [CL] in { def SHLD32mrCL : I<0xA5, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), "shld{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}", [(store (X86shld (loadi32 addr:$dst), GR32:$src2, CL), - addr:$dst)]>, - Imp<[CL],[]>, TB; + addr:$dst)]>, TB; def SHRD32mrCL : I<0xAD, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), "shrd{l}\t{%cl, $src2, $dst|$dst, $src2, %CL}", [(store (X86shrd (loadi32 addr:$dst), GR32:$src2, CL), - addr:$dst)]>, - Imp<[CL],[]>, TB; + addr:$dst)]>, TB; + } def SHLD32mri8 : Ii8<0xA4, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2, i8imm:$src3), "shld{l}\t{$src3, $src2, $dst|$dst, $src2, $src3}", @@ -1703,16 +1727,16 @@ (i8 imm:$src3)), addr:$dst)]>, TB; + let Uses = [CL] in { def SHLD16mrCL : I<0xA5, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), "shld{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}", [(store (X86shld (loadi16 addr:$dst), GR16:$src2, CL), - addr:$dst)]>, - Imp<[CL],[]>, TB, OpSize; + addr:$dst)]>, TB, OpSize; def SHRD16mrCL : I<0xAD, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), "shrd{w}\t{%cl, $src2, $dst|$dst, $src2, %CL}", [(store (X86shrd (loadi16 addr:$dst), GR16:$src2, CL), - addr:$dst)]>, - Imp<[CL],[]>, TB, OpSize; + addr:$dst)]>, TB, OpSize; + } def SHLD16mri8 : Ii8<0xA4, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2, i8imm:$src3), "shld{w}\t{$src3, $src2, $dst|$dst, $src2, $src3}", @@ -1730,25 +1754,31 @@ // Arithmetic. let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y -def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), +def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst), + (ins GR8 :$src1, GR8 :$src2), "add{b}\t{$src2, $dst|$dst, $src2}", [(set GR8:$dst, (add GR8:$src1, GR8:$src2))]>; let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. -def ADD16rr : I<0x01, MRMDestReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), +def ADD16rr : I<0x01, MRMDestReg, (outs GR16:$dst), + (ins GR16:$src1, GR16:$src2), "add{w}\t{$src2, $dst|$dst, $src2}", [(set GR16:$dst, (add GR16:$src1, GR16:$src2))]>, OpSize; -def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), +def ADD32rr : I<0x01, MRMDestReg, (outs GR32:$dst), + (ins GR32:$src1, GR32:$src2), "add{l}\t{$src2, $dst|$dst, $src2}", [(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>; } // end isConvertibleToThreeAddress } // end isCommutable -def ADD8rm : I<0x02, MRMSrcMem, (outs GR8 :$dst), (ins GR8 :$src1, i8mem :$src2), +def ADD8rm : I<0x02, MRMSrcMem, (outs GR8 :$dst), + (ins GR8 :$src1, i8mem :$src2), "add{b}\t{$src2, $dst|$dst, $src2}", [(set GR8:$dst, (add GR8:$src1, (load addr:$src2)))]>; -def ADD16rm : I<0x03, MRMSrcMem, (outs GR16:$dst), (ins GR16:$src1, i16mem:$src2), +def ADD16rm : I<0x03, MRMSrcMem, (outs GR16:$dst), + (ins GR16:$src1, i16mem:$src2), "add{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (add GR16:$src1, (load addr:$src2)))]>, OpSize; -def ADD32rm : I<0x03, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), + [(set GR16:$dst, (add GR16:$src1, (load addr:$src2)))]>,OpSize; +def ADD32rm : I<0x03, MRMSrcMem, (outs GR32:$dst), + (ins GR32:$src1, i32mem:$src2), "add{l}\t{$src2, $dst|$dst, $src2}", [(set GR32:$dst, (add GR32:$src1, (load addr:$src2)))]>; @@ -1757,19 +1787,22 @@ [(set GR8:$dst, (add GR8:$src1, imm:$src2))]>; let isConvertibleToThreeAddress = 1 in { // Can transform into LEA. -def ADD16ri : Ii16<0x81, MRM0r, (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), +def ADD16ri : Ii16<0x81, MRM0r, (outs GR16:$dst), + (ins GR16:$src1, i16imm:$src2), "add{w}\t{$src2, $dst|$dst, $src2}", [(set GR16:$dst, (add GR16:$src1, imm:$src2))]>, OpSize; -def ADD32ri : Ii32<0x81, MRM0r, (outs GR32:$dst), (ins GR32:$src1, i32imm:$src2), +def ADD32ri : Ii32<0x81, MRM0r, (outs GR32:$dst), + (ins GR32:$src1, i32imm:$src2), "add{l}\t{$src2, $dst|$dst, $src2}", [(set GR32:$dst, (add GR32:$src1, imm:$src2))]>; -def ADD16ri8 : Ii8<0x83, MRM0r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), +def ADD16ri8 : Ii8<0x83, MRM0r, (outs GR16:$dst), + (ins GR16:$src1, i16i8imm:$src2), "add{w}\t{$src2, $dst|$dst, $src2}", - [(set GR16:$dst, (add GR16:$src1, i16immSExt8:$src2))]>, - OpSize; -def ADD32ri8 : Ii8<0x83, MRM0r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), + [(set GR16:$dst, (add GR16:$src1, i16immSExt8:$src2))]>, OpSize; +def ADD32ri8 : Ii8<0x83, MRM0r, (outs GR32:$dst), + (ins GR32:$src1, i32i8imm:$src2), "add{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (add GR32:$src1, i32immSExt8:$src2))]>; + [(set GR32:$dst, (add GR32:$src1, i32immSExt8:$src2))]>; } let isTwoAddress = 0 in { @@ -2033,8 +2066,10 @@ // Condition code ops, incl. set if equal/not equal/... -def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>, Imp<[AH],[]>; // flags = AH -def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>, Imp<[],[AH]>; // AH = flags +let Uses = [AH] in +def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>; // flags = AH +let Defs = [AH] in +def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>; // AH = flags def SETEr : I<0x94, MRM0r, (outs GR8 :$dst), (ins), @@ -2296,15 +2331,19 @@ "movz{wl|x}\t{$src, $dst|$dst, $src}", [(set GR32:$dst, (zextloadi32i16 addr:$src))]>, TB; +let Defs = [AX], Uses = [AL] in def CBW : I<0x98, RawFrm, (outs), (ins), - "{cbtw|cbw}", []>, Imp<[AL],[AX]>, OpSize; // AX = signext(AL) + "{cbtw|cbw}", []>, OpSize; // AX = signext(AL) +let Defs = [EAX], Uses = [AX] in def CWDE : I<0x98, RawFrm, (outs), (ins), - "{cwtl|cwde}", []>, Imp<[AX],[EAX]>; // EAX = signext(AX) + "{cwtl|cwde}", []>; // EAX = signext(AX) +let Defs = [AX,DX], Uses = [AX] in def CWD : I<0x99, RawFrm, (outs), (ins), - "{cwtd|cwd}", []>, Imp<[AX],[AX,DX]>, OpSize; // DX:AX = signext(AX) + "{cwtd|cwd}", []>, OpSize; // DX:AX = signext(AX) +let Defs = [EAX,EDX], Uses = [EAX] in def CDQ : I<0x99, RawFrm, (outs), (ins), - "{cltd|cdq}", []>, Imp<[EAX],[EAX,EDX]>; // EDX:EAX = signext(EAX) + "{cltd|cdq}", []>; // EDX:EAX = signext(EAX) //===----------------------------------------------------------------------===// @@ -2351,10 +2390,10 @@ // Thread Local Storage Instructions // +let Uses = [EBX] in def TLS_addr : I<0, Pseudo, (outs GR32:$dst), (ins i32imm:$sym), "leal\t${sym:mem}(,%ebx,1), $dst", - [(set GR32:$dst, (X86tlsaddr tglobaltlsaddr:$sym))]>, - Imp<[EBX],[]>; + [(set GR32:$dst, (X86tlsaddr tglobaltlsaddr:$sym))]>; let AddedComplexity = 10 in def TLS_gs_rr : I<0, Pseudo, (outs GR32:$dst), (ins GR32:$src), Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrMMX.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrMMX.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrMMX.td Tue Sep 11 14:55:27 2007 @@ -476,10 +476,10 @@ [(set GR32:$dst, (int_x86_mmx_pmovmskb VR64:$src))]>; // Misc. +let Uses = [EDI] in def MMX_MASKMOVQ : MMXI<0xF7, MRMDestMem, (outs), (ins VR64:$src, VR64:$mask), "maskmovq\t{$mask, $src|$src, $mask}", - [(int_x86_mmx_maskmovq VR64:$src, VR64:$mask, EDI)]>, - Imp<[EDI],[]>; + [(int_x86_mmx_maskmovq VR64:$src, VR64:$mask, EDI)]>; //===----------------------------------------------------------------------===// // Alias Instructions Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Tue Sep 11 14:55:27 2007 @@ -2012,10 +2012,10 @@ [(set GR32:$dst, (int_x86_sse2_pmovmskb_128 VR128:$src))]>; // Conditional store +let Uses = [EDI] in def MASKMOVDQU : PDI<0xF7, MRMSrcReg, (outs), (ins VR128:$src, VR128:$mask), "maskmovdqu\t{$mask, $src|$src, $mask}", - [(int_x86_sse2_maskmov_dqu VR128:$src, VR128:$mask, EDI)]>, - Imp<[EDI],[]>; + [(int_x86_sse2_maskmov_dqu VR128:$src, VR128:$mask, EDI)]>; // Non-temporal stores def MOVNTPDmr : PDI<0x2B, MRMDestMem, (outs), (ins i128mem:$dst, VR128:$src), Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=41863&r1=41862&r2=41863&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Tue Sep 11 14:55:27 2007 @@ -113,12 +113,15 @@ //===----------------------------------------------------------------------===// // Miscellaneous Instructions... // +let Defs = [RBP,RSP], Uses = [RBP,RSP] in def LEAVE64 : I<0xC9, RawFrm, - (outs), (ins), "leave", []>, Imp<[RBP,RSP],[RBP,RSP]>; + (outs), (ins), "leave", []>; +let Defs = [RSP], Uses = [RSP] in { def POP64r : I<0x58, AddRegFrm, - (outs GR64:$reg), (ins), "pop{q}\t$reg", []>, Imp<[RSP],[RSP]>; + (outs GR64:$reg), (ins), "pop{q}\t$reg", []>; def PUSH64r : I<0x50, AddRegFrm, - (outs), (ins GR64:$reg), "push{q}\t$reg", []>, Imp<[RSP],[RSP]>; + (outs), (ins GR64:$reg), "push{q}\t$reg", []>; +} def LEA64_32r : I<0x8D, MRMSrcMem, (outs GR32:$dst), (ins lea64_32mem:$src), @@ -142,12 +145,12 @@ "xchg{q}\t{$src2|$src1}, {$src1|$src2}", []>; // Repeat string ops +let Defs = [RCX,RDI,RSI], Uses = [RCX,RDI,RSI] in def REP_MOVSQ : RI<0xA5, RawFrm, (outs), (ins), "{rep;movsq|rep movsq}", - [(X86rep_movs i64)]>, - Imp<[RCX,RDI,RSI], [RCX,RDI,RSI]>, REP; + [(X86rep_movs i64)]>, REP; +let Defs = [RCX,RDI], Uses = [RAX,RCX,RDI] in def REP_STOSQ : RI<0xAB, RawFrm, (outs), (ins), "{rep;stosq|rep stosq}", - [(X86rep_stos i64)]>, - Imp<[RAX,RCX,RDI], [RCX,RDI]>, REP; + [(X86rep_stos i64)]>, REP; //===----------------------------------------------------------------------===// // Move Instructions... @@ -211,11 +214,13 @@ "movz{wq|x}\t{$src, $dst|$dst, $src}", [(set GR64:$dst, (zextloadi64i16 addr:$src))]>, TB; +let Defs = [RAX], Uses = [EAX] in def CDQE : RI<0x98, RawFrm, (outs), (ins), - "{cltq|cdqe}", []>, Imp<[EAX],[RAX]>; // RAX = signext(EAX) + "{cltq|cdqe}", []>; // RAX = signext(EAX) +let Defs = [RAX,RDX], Uses = [RAX] in def CQO : RI<0x99, RawFrm, (outs), (ins), - "{cqto|cqo}", []>, Imp<[RAX],[RAX,RDX]>; // RDX:RAX = signext(RAX) + "{cqto|cqo}", []>; // RDX:RAX = signext(RAX) //===----------------------------------------------------------------------===// // Arithmetic Instructions... @@ -334,20 +339,18 @@ [(store (sube (load addr:$dst), i64immSExt8:$src2), addr:$dst)]>; // Unsigned multiplication +let Defs = [RAX,RDX], Uses = [RAX] in { def MUL64r : RI<0xF7, MRM4r, (outs), (ins GR64:$src), - "mul{q}\t$src", []>, - Imp<[RAX],[RAX,RDX]>; // RAX,RDX = RAX*GR64 + "mul{q}\t$src", []>; // RAX,RDX = RAX*GR64 def MUL64m : RI<0xF7, MRM4m, (outs), (ins i64mem:$src), - "mul{q}\t$src", []>, - Imp<[RAX],[RAX,RDX]>; // RAX,RDX = RAX*[mem64] + "mul{q}\t$src", []>; // RAX,RDX = RAX*[mem64] // Signed multiplication def IMUL64r : RI<0xF7, MRM5r, (outs), (ins GR64:$src), - "imul{q}\t$src", []>, - Imp<[RAX],[RAX,RDX]>; // RAX,RDX = RAX*GR64 + "imul{q}\t$src", []>; // RAX,RDX = RAX*GR64 def IMUL64m : RI<0xF7, MRM5m, (outs), (ins i64mem:$src), - "imul{q}\t$src", []>, - Imp<[RAX],[RAX,RDX]>; // RAX,RDX = RAX*[mem64] + "imul{q}\t$src", []>; // RAX,RDX = RAX*[mem64] +} let isTwoAddress = 1 in { let isCommutable = 1 in @@ -379,16 +382,18 @@ [(set GR64:$dst, (mul (load addr:$src1), i64immSExt8:$src2))]>; // Unsigned division / remainder +let Defs = [RAX,RDX], Uses = [RAX,RDX] in { def DIV64r : RI<0xF7, MRM6r, (outs), (ins GR64:$src), // RDX:RAX/r64 = RAX,RDX - "div{q}\t$src", []>, Imp<[RAX,RDX],[RAX,RDX]>; + "div{q}\t$src", []>; def DIV64m : RI<0xF7, MRM6m, (outs), (ins i64mem:$src), // RDX:RAX/[mem64] = RAX,RDX - "div{q}\t$src", []>, Imp<[RAX,RDX],[RAX,RDX]>; + "div{q}\t$src", []>; // Signed division / remainder def IDIV64r: RI<0xF7, MRM7r, (outs), (ins GR64:$src), // RDX:RAX/r64 = RAX,RDX - "idiv{q}\t$src", []>, Imp<[RAX,RDX],[RAX,RDX]>; + "idiv{q}\t$src", []>; def IDIV64m: RI<0xF7, MRM7m, (outs), (ins i64mem:$src), // RDX:RAX/[mem64] = RAX,RDX - "idiv{q}\t$src", []>, Imp<[RAX,RDX],[RAX,RDX]>; + "idiv{q}\t$src", []>; +} // Unary instructions let CodeSize = 2 in { @@ -431,10 +436,10 @@ // Shift instructions let isTwoAddress = 1 in { +let Uses = [CL] in def SHL64rCL : RI<0xD3, MRM4r, (outs GR64:$dst), (ins GR64:$src), "shl{q}\t{%cl, $dst|$dst, %CL}", - [(set GR64:$dst, (shl GR64:$src, CL))]>, - Imp<[CL],[]>; + [(set GR64:$dst, (shl GR64:$src, CL))]>; def SHL64ri : RIi8<0xC1, MRM4r, (outs GR64:$dst), (ins GR64:$src1, i8imm:$src2), "shl{q}\t{$src2, $dst|$dst, $src2}", [(set GR64:$dst, (shl GR64:$src1, (i8 imm:$src2)))]>; @@ -442,10 +447,10 @@ "shl{q}\t$dst", []>; } // isTwoAddress +let Uses = [CL] in def SHL64mCL : RI<0xD3, MRM4m, (outs), (ins i64mem:$dst), "shl{q}\t{%cl, $dst|$dst, %CL}", - [(store (shl (loadi64 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (shl (loadi64 addr:$dst), CL), addr:$dst)]>; def SHL64mi : RIi8<0xC1, MRM4m, (outs), (ins i64mem:$dst, i8imm:$src), "shl{q}\t{$src, $dst|$dst, $src}", [(store (shl (loadi64 addr:$dst), (i8 imm:$src)), addr:$dst)]>; @@ -454,10 +459,10 @@ [(store (shl (loadi64 addr:$dst), (i8 1)), addr:$dst)]>; let isTwoAddress = 1 in { +let Uses = [CL] in def SHR64rCL : RI<0xD3, MRM5r, (outs GR64:$dst), (ins GR64:$src), "shr{q}\t{%cl, $dst|$dst, %CL}", - [(set GR64:$dst, (srl GR64:$src, CL))]>, - Imp<[CL],[]>; + [(set GR64:$dst, (srl GR64:$src, CL))]>; def SHR64ri : RIi8<0xC1, MRM5r, (outs GR64:$dst), (ins GR64:$src1, i8imm:$src2), "shr{q}\t{$src2, $dst|$dst, $src2}", [(set GR64:$dst, (srl GR64:$src1, (i8 imm:$src2)))]>; @@ -466,10 +471,10 @@ [(set GR64:$dst, (srl GR64:$src1, (i8 1)))]>; } // isTwoAddress +let Uses = [CL] in def SHR64mCL : RI<0xD3, MRM5m, (outs), (ins i64mem:$dst), "shr{q}\t{%cl, $dst|$dst, %CL}", - [(store (srl (loadi64 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (srl (loadi64 addr:$dst), CL), addr:$dst)]>; def SHR64mi : RIi8<0xC1, MRM5m, (outs), (ins i64mem:$dst, i8imm:$src), "shr{q}\t{$src, $dst|$dst, $src}", [(store (srl (loadi64 addr:$dst), (i8 imm:$src)), addr:$dst)]>; @@ -478,9 +483,10 @@ [(store (srl (loadi64 addr:$dst), (i8 1)), addr:$dst)]>; let isTwoAddress = 1 in { +let Uses = [CL] in def SAR64rCL : RI<0xD3, MRM7r, (outs GR64:$dst), (ins GR64:$src), "sar{q}\t{%cl, $dst|$dst, %CL}", - [(set GR64:$dst, (sra GR64:$src, CL))]>, Imp<[CL],[]>; + [(set GR64:$dst, (sra GR64:$src, CL))]>; def SAR64ri : RIi8<0xC1, MRM7r, (outs GR64:$dst), (ins GR64:$src1, i8imm:$src2), "sar{q}\t{$src2, $dst|$dst, $src2}", [(set GR64:$dst, (sra GR64:$src1, (i8 imm:$src2)))]>; @@ -489,10 +495,10 @@ [(set GR64:$dst, (sra GR64:$src1, (i8 1)))]>; } // isTwoAddress +let Uses = [CL] in def SAR64mCL : RI<0xD3, MRM7m, (outs), (ins i64mem:$dst), "sar{q}\t{%cl, $dst|$dst, %CL}", - [(store (sra (loadi64 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (sra (loadi64 addr:$dst), CL), addr:$dst)]>; def SAR64mi : RIi8<0xC1, MRM7m, (outs), (ins i64mem:$dst, i8imm:$src), "sar{q}\t{$src, $dst|$dst, $src}", [(store (sra (loadi64 addr:$dst), (i8 imm:$src)), addr:$dst)]>; @@ -502,9 +508,10 @@ // Rotate instructions let isTwoAddress = 1 in { +let Uses = [CL] in def ROL64rCL : RI<0xD3, MRM0r, (outs GR64:$dst), (ins GR64:$src), "rol{q}\t{%cl, $dst|$dst, %CL}", - [(set GR64:$dst, (rotl GR64:$src, CL))]>, Imp<[CL],[]>; + [(set GR64:$dst, (rotl GR64:$src, CL))]>; def ROL64ri : RIi8<0xC1, MRM0r, (outs GR64:$dst), (ins GR64:$src1, i8imm:$src2), "rol{q}\t{$src2, $dst|$dst, $src2}", [(set GR64:$dst, (rotl GR64:$src1, (i8 imm:$src2)))]>; @@ -513,10 +520,10 @@ [(set GR64:$dst, (rotl GR64:$src1, (i8 1)))]>; } // isTwoAddress +let Uses = [CL] in def ROL64mCL : I<0xD3, MRM0m, (outs), (ins i64mem:$dst), "rol{q}\t{%cl, $dst|$dst, %CL}", - [(store (rotl (loadi64 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (rotl (loadi64 addr:$dst), CL), addr:$dst)]>; def ROL64mi : RIi8<0xC1, MRM0m, (outs), (ins i64mem:$dst, i8imm:$src), "rol{q}\t{$src, $dst|$dst, $src}", [(store (rotl (loadi64 addr:$dst), (i8 imm:$src)), addr:$dst)]>; @@ -525,9 +532,10 @@ [(store (rotl (loadi64 addr:$dst), (i8 1)), addr:$dst)]>; let isTwoAddress = 1 in { +let Uses = [CL] in def ROR64rCL : RI<0xD3, MRM1r, (outs GR64:$dst), (ins GR64:$src), "ror{q}\t{%cl, $dst|$dst, %CL}", - [(set GR64:$dst, (rotr GR64:$src, CL))]>, Imp<[CL],[]>; + [(set GR64:$dst, (rotr GR64:$src, CL))]>; def ROR64ri : RIi8<0xC1, MRM1r, (outs GR64:$dst), (ins GR64:$src1, i8imm:$src2), "ror{q}\t{$src2, $dst|$dst, $src2}", [(set GR64:$dst, (rotr GR64:$src1, (i8 imm:$src2)))]>; @@ -536,10 +544,10 @@ [(set GR64:$dst, (rotr GR64:$src1, (i8 1)))]>; } // isTwoAddress +let Uses = [CL] in def ROR64mCL : RI<0xD3, MRM1m, (outs), (ins i64mem:$dst), "ror{q}\t{%cl, $dst|$dst, %CL}", - [(store (rotr (loadi64 addr:$dst), CL), addr:$dst)]>, - Imp<[CL],[]>; + [(store (rotr (loadi64 addr:$dst), CL), addr:$dst)]>; def ROR64mi : RIi8<0xC1, MRM1m, (outs), (ins i64mem:$dst, i8imm:$src), "ror{q}\t{$src, $dst|$dst, $src}", [(store (rotr (loadi64 addr:$dst), (i8 imm:$src)), addr:$dst)]>; @@ -549,12 +557,12 @@ // Double shift instructions (generalizations of rotate) let isTwoAddress = 1 in { +let Uses = [CL] in { def SHLD64rrCL : RI<0xA5, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2), - "shld{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, - Imp<[CL],[]>, TB; + "shld{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, TB; def SHRD64rrCL : RI<0xAD, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2), - "shrd{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, - Imp<[CL],[]>, TB; + "shrd{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, TB; +} let isCommutable = 1 in { // FIXME: Update X86InstrInfo::commuteInstruction def SHLD64rri8 : RIi8<0xA4, MRMDestReg, @@ -570,12 +578,12 @@ // Temporary hack: there is no patterns associated with these instructions // so we have to tell tblgen that these do not produce results. +let Uses = [CL] in { def SHLD64mrCL : RI<0xA5, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src2), - "shld{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, - Imp<[CL],[]>, TB; + "shld{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, TB; def SHRD64mrCL : RI<0xAD, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src2), - "shrd{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, - Imp<[CL],[]>, TB; + "shrd{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, TB; +} def SHLD64mri8 : RIi8<0xA4, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src2, i8imm:$src3), "shld{q}\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>, From clattner at apple.com Tue Sep 11 16:01:47 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 11 Sep 2007 14:01:47 -0700 Subject: [llvm-commits] [llvm] r41855 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h In-Reply-To: <200709111742.l8BHgMs4006467@zion.cs.uiuc.edu> References: <200709111742.l8BHgMs4006467@zion.cs.uiuc.edu> Message-ID: <9B797C7A-97BA-4A20-9843-3774081C3A72@apple.com> > URL: http://llvm.org/viewvc/llvm-project?rev=41855&view=rev > Log: > Convert to use ilist and non-pointer lists for extra goodness Yay! > + // Dump our bits to stderr > + void dump(llvm::OStream &out) const { > + out << "[ "; > + for (iterator bi = begin(); > + bi != end(); > + ++bi) { > + out << *bi << " "; > + } > + out << std::endl; > + } Please don't use std::endl, use '\n' instead. Could this be moved out of line? -Chris From clattner at apple.com Tue Sep 11 16:02:37 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 11 Sep 2007 14:02:37 -0700 Subject: [llvm-commits] [llvm] r41838 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86ATTAsmPrinter.cpp lib/Target/X86/X86AsmPrinter.cpp lib/Target/X86/X86AsmPrinter.h lib/Ta In-Reply-To: <16e5fdf90709111021x7b3cb033q9f3cd4a4aff0e22b@mail.gmail.com> References: <16e5fdf90709111021x7b3cb033q9f3cd4a4aff0e22b@mail.gmail.com> Message-ID: <487127BC-311B-4B3F-B9C7-056DC7D780FA@apple.com> On Sep 11, 2007, at 10:21 AM, Bill Wendling wrote: > On 9/11/07, Anton Korobeynikov wrote: >> Bill, >> >>> The personality function on Darwin needs a global stub. We then >>> refer to >>> that global stub instead of doing the ".set" thingy we were doing >>> before. >> This breaks linux. The problem is indirect encoding of personality >> symbol. It shouldn't be so for linux. It seems we need another >> knob for >> it :( >> > Fixed: > > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- > Mon-20070910/053411.html Shouldn't this bit also be set on darwin/ppc and darwin/arm? -Chris From asl at math.spbu.ru Tue Sep 11 16:21:29 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 11 Sep 2007 21:21:29 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41865 - in /llvm-gcc-4.2/trunk/gcc: c-pragma.c config/darwin.h Message-ID: <200709112121.l8BLLTZY013469@zion.cs.uiuc.edu> Author: asl Date: Tue Sep 11 16:21:28 2007 New Revision: 41865 URL: http://llvm.org/viewvc/llvm-project?rev=41865&view=rev Log: Unbreak #pragma pack on non-darwin. 4.0 will follow. Modified: llvm-gcc-4.2/trunk/gcc/c-pragma.c llvm-gcc-4.2/trunk/gcc/config/darwin.h Modified: llvm-gcc-4.2/trunk/gcc/c-pragma.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-pragma.c?rev=41865&r1=41864&r2=41865&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-pragma.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-pragma.c Tue Sep 11 16:21:28 2007 @@ -53,8 +53,10 @@ static GTY(()) struct align_stack * alignment_stack; -/* APPLE LOCAL Macintosh alignment */ -#if 0 +/* LLVM LOCAL begin */ +#ifndef TARGET_OVERRIDE_PRAGMA_PACK_HANDLER +/* LLVM LOCAL end */ + #ifdef HANDLE_PRAGMA_PACK static void handle_pragma_pack (cpp_reader *); @@ -246,8 +248,10 @@ } } #endif /* HANDLE_PRAGMA_PACK */ -/* APPLE LOCAL Macintosh alignment */ -#endif + +/* LLVM LOCAL begin */ +#endif /* TARGET_OVERRIDE_PRAGMA_PACK_HANDLER */ +/* LLVM LOCAL end */ static GTY(()) tree pending_weaks; @@ -816,11 +820,9 @@ cpp_register_deferred_pragma (parse_in, "GCC", "pch_preprocess", PRAGMA_GCC_PCH_PREPROCESS, false, false); -/* APPLE LOCAL begin Macintosh alignment 2002-1-22 --ff */ - /* Remove the handling of pragma pack here because it is handled - in config/darwin-c.c. */ -#if 0 -/* APPLE LOCAL end Macintosh alignment 2002-1-22 --ff */ +/* LLVM LOCAL begin */ +#ifndef TARGET_OVERRIDE_PRAGMA_PACK_HANDLER +/* LLVM LOCAL end */ #ifdef HANDLE_PRAGMA_PACK #ifdef HANDLE_PRAGMA_PACK_WITH_EXPANSION c_register_pragma_with_expansion (0, "pack", handle_pragma_pack); @@ -828,8 +830,9 @@ c_register_pragma (0, "pack", handle_pragma_pack); #endif #endif -/* APPLE LOCAL Macintosh alignment 2002-1-22 --ff */ +/* LLVM LOCAL begin */ #endif +/* LLVM LOCAL end */ #ifdef HANDLE_PRAGMA_WEAK c_register_pragma (0, "weak", handle_pragma_weak); #endif Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=41865&r1=41864&r2=41865&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Tue Sep 11 16:21:28 2007 @@ -1115,6 +1115,11 @@ #define HANDLE_PRAGMA_PACK_PUSH_POP 1 +/* LLVM LOCAL begin */ +/* Handle pragma pack separately */ +#define TARGET_OVERRIDE_PRAGMA_PACK_HANDLER 1 +/* LLVM LOCAL end */ + #define DARWIN_REGISTER_TARGET_PRAGMAS() \ do { \ c_register_pragma (0, "mark", darwin_pragma_ignore); \ From clattner at apple.com Tue Sep 11 16:36:24 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 11 Sep 2007 14:36:24 -0700 Subject: [llvm-commits] [llvm] r41858 - in /llvm/trunk: include/llvm/ADT/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Support/ lib/Target/CBackend/ lib/Target/MSIL/ lib/Target/X86/ lib/VMCore/ tools/llvm2cpp/ In-Reply-To: <200709111832.l8BIWZkb007987@zion.cs.uiuc.edu> References: <200709111832.l8BIWZkb007987@zion.cs.uiuc.edu> Message-ID: <12A3A31E-D99E-4B07-9AE3-41CD8A5CD325@apple.com> > Add APInt interfaces to APFloat (allows directly > access to bits). Use them in place of float and > double interfaces where appropriate. > First bits of x86 long double constants handling > (untested, probably does not work). Nice! > ====================================================================== > ======== > --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) > +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Sep 11 > 13:32:33 2007 > @@ -527,13 +527,20 @@ > Code = bitc::CST_CODE_FLOAT; > const Type *Ty = CFP->getType(); > if (Ty == Type::FloatTy) > - Record.push_back(FloatToBits(CFP->getValueAPF > ().convertToFloat())); > + Record.push_back((uint32_t)*CFP->getValueAPF > ().convertToAPInt(). > + getRawData()); > else if (Ty == Type::DoubleTy) { > + Record.push_back(*CFP->getValueAPF().convertToAPInt > ().getRawData()); In cases where you know you're dealing with a float or a double, it would be better to use: CFP->getValueAPF().convertToAPInt().getZExtValue(); instead of getRawData(). In general, it is best to minimize use of getRawData(), because if APInt ever changes, we will have to touch each of them. In this specific case, it also allows you to merge the float/double cases together. There are a bunch of examples of this in the patch. I know it's a pain, but can you please switch them? > +/// Treat api as containing the bits of a floating point number. > Currently > +/// we infer the floating point type from the size of the APInt. > FIXME: This > +/// breaks when we get to PPC128 and IEEE128 (but both cannot > exist in the > +/// same compile...) They can't both exist in the same module, but this method won't know which it is getting without some context passed in. -Chris From dberlin at dberlin.org Tue Sep 11 16:40:55 2007 From: dberlin at dberlin.org (Daniel Berlin) Date: Tue, 11 Sep 2007 17:40:55 -0400 Subject: [llvm-commits] [llvm] r41855 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h In-Reply-To: <9B797C7A-97BA-4A20-9843-3774081C3A72@apple.com> References: <200709111742.l8BHgMs4006467@zion.cs.uiuc.edu> <9B797C7A-97BA-4A20-9843-3774081C3A72@apple.com> Message-ID: <4aca3dc20709111440w7188b8b8s4b8868e5a7263ed4@mail.gmail.com> On 9/11/07, Chris Lattner wrote: > > URL: http://llvm.org/viewvc/llvm-project?rev=41855&view=rev > > Log: > > Convert to use ilist and non-pointer lists for extra goodness > > Yay! > > > + // Dump our bits to stderr > > + void dump(llvm::OStream &out) const { > > + out << "[ "; > > + for (iterator bi = begin(); > > + bi != end(); > > + ++bi) { > > + out << *bi << " "; > > + } > > + out << std::endl; > > + } > > Please don't use std::endl, use '\n' instead. Could this be moved > out of line? Done and done (I'll commit when i get home) From clattner at apple.com Tue Sep 11 16:44:22 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 11 Sep 2007 14:44:22 -0700 Subject: [llvm-commits] [llvm] r41855 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h In-Reply-To: <4aca3dc20709111440w7188b8b8s4b8868e5a7263ed4@mail.gmail.com> References: <200709111742.l8BHgMs4006467@zion.cs.uiuc.edu> <9B797C7A-97BA-4A20-9843-3774081C3A72@apple.com> <4aca3dc20709111440w7188b8b8s4b8868e5a7263ed4@mail.gmail.com> Message-ID: <9CED00BD-A564-4EF4-A4F7-EF5DBF49AF94@apple.com> On Sep 11, 2007, at 2:40 PM, Daniel Berlin wrote: > On 9/11/07, Chris Lattner wrote: >>> URL: http://llvm.org/viewvc/llvm-project?rev=41855&view=rev >>> Log: >>> Convert to use ilist and non-pointer lists for extra goodness >> >> Yay! >> >>> + // Dump our bits to stderr >>> + void dump(llvm::OStream &out) const { >>> + out << "[ "; >>> + for (iterator bi = begin(); >>> + bi != end(); >>> + ++bi) { >>> + out << *bi << " "; >>> + } >>> + out << std::endl; >>> + } >> >> Please don't use std::endl, use '\n' instead. Could this be moved >> out of line? > > Done and done (I'll commit when i get home) Thanks! -Chris From clattner at apple.com Tue Sep 11 16:48:53 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 11 Sep 2007 14:48:53 -0700 Subject: [llvm-commits] [llvm] r41844 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: <200709111435.l8BEZj3w032506@zion.cs.uiuc.edu> References: <200709111435.l8BEZj3w032506@zion.cs.uiuc.edu> Message-ID: On Sep 11, 2007, at 7:35 AM, Duncan Sands wrote: > Author: baldrick > Date: Tue Sep 11 09:35:41 2007 > New Revision: 41844 > > URL: http://llvm.org/viewvc/llvm-project?rev=41844&view=rev > Log: > Turn calls to trampolines into calls to the underlying > nested function. Nice! Can you please add a testcase? Also, can you please move the body of the transformation out of visitCallSite, so that you end up with something like this: if (BitCastInst *BC = dyn_cast(Callee)) { if (IntrinsicInst *In = dyn_cast(BC->getOperand(0))) if (In->getIntrinsicID() == Intrinsic::init_trampoline) if (Instruction *I = HandleCallThroughInitTrampoline(...)) return I; in visitCallSite? Thanks work, I think the single intrinsic approach is much cleaner! :) -Chris > Modified: > llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ > Scalar/InstructionCombining.cpp?rev=41844&r1=41843&r2=41844&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > (original) > +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue > Sep 11 09:35:41 2007 > @@ -39,6 +39,7 @@ > #include "llvm/Pass.h" > #include "llvm/DerivedTypes.h" > #include "llvm/GlobalVariable.h" > +#include "llvm/ParameterAttributes.h" > #include "llvm/Analysis/ConstantFolding.h" > #include "llvm/Target/TargetData.h" > #include "llvm/Transforms/Utils/BasicBlockUtils.h" > @@ -7848,6 +7849,143 @@ > } > } > > + if (BitCastInst *BC = dyn_cast(Callee)) { > + IntrinsicInst *In = dyn_cast(BC->getOperand(0)); > + if (In && In->getIntrinsicID() == Intrinsic::init_trampoline) { > + Function *NestF = > + cast(IntrinsicInst::StripPointerCasts(In- > >getOperand(2))); > + const PointerType *NestFPTy = cast(NestF- > >getType()); > + const FunctionType *NestFTy = > + cast(NestFPTy->getElementType()); > + > + if (const ParamAttrsList *NestAttrs = NestFTy->getParamAttrs > ()) { > + unsigned NestIdx = 1; > + const Type *NestTy = 0; > + uint16_t NestAttr; > + > + Instruction *Caller = CS.getInstruction(); > + > + // Look for a parameter marked with the 'nest' attribute. > + for (FunctionType::param_iterator I = NestFTy->param_begin(), > + E = NestFTy->param_end(); I != E; ++NestIdx, ++I) > + if (NestAttrs->paramHasAttr(NestIdx, ParamAttr::Nest)) { > + // Record the parameter type and any other attributes. > + NestTy = *I; > + NestAttr = NestAttrs->getParamAttrs(NestIdx); > + break; > + } > + > + if (NestTy) { > + std::vector NewArgs; > + NewArgs.reserve(unsigned(CS.arg_end()-CS.arg_begin())+1); > + > + // Insert the nest argument into the call argument list, > which may > + // mean appending it. > + { > + unsigned Idx = 1; > + CallSite::arg_iterator I = CS.arg_begin(), E = > CS.arg_end(); > + do { > + if (Idx == NestIdx) { > + // Add the chain argument. > + Value *NestVal = In->getOperand(3); > + if (NestVal->getType() != NestTy) > + NestVal = new BitCastInst(NestVal, NestTy, > "nest", Caller); > + NewArgs.push_back(NestVal); > + } > + > + if (I == E) > + break; > + > + // Add the original argument. > + NewArgs.push_back(*I); > + > + ++Idx, ++I; > + } while (1); > + } > + > + // The trampoline may have been bitcast to a bogus type > (FTy). > + // Handle this by synthesizing a new function type, > equal to FTy > + // with the chain parameter inserted. Likewise for > attributes. > + > + const ParamAttrsList *Attrs = FTy->getParamAttrs(); > + std::vector NewTypes; > + ParamAttrsVector NewAttrs; > + NewTypes.reserve(FTy->getNumParams()+1); > + > + // Add any function result attributes. > + uint16_t Attr = Attrs ? Attrs->getParamAttrs(0) : 0; > + if (Attr) > + NewAttrs.push_back (ParamAttrsWithIndex::get(0, Attr)); > + > + // Insert the chain's type into the list of parameter > types, which may > + // mean appending it. Likewise for the chain's attributes. > + { > + unsigned Idx = 1; > + FunctionType::param_iterator I = FTy->param_begin(), > + E = FTy->param_end(); > + > + do { > + if (Idx == NestIdx) { > + // Add the chain's type and attributes. > + NewTypes.push_back(NestTy); > + NewAttrs.push_back(ParamAttrsWithIndex::get > (NestIdx, NestAttr)); > + } > + > + if (I == E) > + break; > + > + // Add the original type and attributes. > + NewTypes.push_back(*I); > + Attr = Attrs ? Attrs->getParamAttrs(Idx) : 0; > + if (Attr) > + NewAttrs.push_back > + (ParamAttrsWithIndex::get(Idx + (Idx >= > NestIdx), Attr)); > + > + ++Idx, ++I; > + } while (1); > + } > + > + // Replace the trampoline call with a direct call. Let > the generic > + // code sort out any function type mismatches. > + FunctionType *NewFTy = > + FunctionType::get(FTy->getReturnType(), NewTypes, FTy- > >isVarArg(), > + ParamAttrsList::get(NewAttrs)); > + Constant *NewCallee = NestF->getType() == > PointerType::get(NewFTy) ? > + NestF : ConstantExpr::getBitCast(NestF, > PointerType::get(NewFTy)); > + > + Instruction *NewCaller; > + if (InvokeInst *II = dyn_cast(Caller)) { > + NewCaller = new InvokeInst(NewCallee, II->getNormalDest > (), > + II->getUnwindDest(), > NewArgs.begin(), > + NewArgs.end(), Caller- > >getName(), > + Caller); > + cast(NewCaller)->setCallingConv(II- > >getCallingConv()); > + } else { > + NewCaller = new CallInst(NewCallee, NewArgs.begin(), > NewArgs.end(), > + Caller->getName(), Caller); > + if (cast(Caller)->isTailCall()) > + cast(NewCaller)->setTailCall(); > + cast(NewCaller)-> > + setCallingConv(cast(Caller)->getCallingConv > ()); > + } > + if (Caller->getType() != Type::VoidTy && !Caller- > >use_empty()) > + Caller->replaceAllUsesWith(NewCaller); > + Caller->eraseFromParent(); > + RemoveFromWorkList(Caller); > + return 0; > + } > + } > + > + // Replace the trampoline call with a direct call. Since > there is no > + // 'nest' parameter, there is no need to adjust the argument > list. Let > + // the generic code sort out any function type mismatches. > + Constant *NewCallee = NestF->getType() == PTy ? > + NestF : ConstantExpr::getBitCast(NestF, PTy); > + CS.setCalledFunction(NewCallee); > + Changed = true; > + } > + } > + > return Changed ? CS.getInstruction() : 0; > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Tue Sep 11 16:52:10 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 11 Sep 2007 14:52:10 -0700 Subject: [llvm-commits] Trampoline changes In-Reply-To: <200709091046.23869.baldrick@free.fr> References: <200709090003.59557.baldrick@free.fr> <46E3293C.6080003@mxc.ca> <200709091046.23869.baldrick@free.fr> Message-ID: On Sep 9, 2007, at 1:46 AM, Duncan Sands wrote: > Hi Nick, > >>> It is easy to construct testcases for which this works, but sadly >>> I was unable to get >>> the optimization to occur even once in a trampoline heavy real- >>> world program without >>> jacking-up the inlining limit hugely (to 100000; 10000 wasn't >>> enough). Still, I'm >>> hoping that it may sometimes be useful. >> >> Why does changing the inliner threshold help? Are you talking about >> inlining the trampoline itself or the llvm.init.trampoline intrinsic? >> Could we adjust the weights in the inliner so that it does it more >> often, seeing as a trampoline call is much more expensive than a >> regular >> call? >> >> Would you mind sending a small before and after example for the >> transformation implemented by your instcombine patch? > > My hope was that some of these trampoline calls could be eliminated > using this optimization. But for > that to happen, the routines in the container library have to be > small enough to be inlined. They are > not. In fact they're rather small in terms of lines of code, but > exception handling etc really bulks > up the LLVM bitcode making the inliner pass them over. It would be pretty straight-forward to implement an IPO pass that turns trampoline pointers into fat pointers in cases like this. It sounds like it could be a big win for the container library, because the container (if the routines get marked internal) would automatically be converted to take fat pointers, even if there are multiple different trampolines being passed in. -Chris From clattner at apple.com Tue Sep 11 17:03:13 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 11 Sep 2007 15:03:13 -0700 Subject: [llvm-commits] BrainF compiler In-Reply-To: <46E032E3.2030401@ir.iit.edu> References: <46E032E3.2030401@ir.iit.edu> Message-ID: <4D473BAF-D716-4DAA-B60A-76121345D347@apple.com> On Sep 6, 2007, at 10:03 AM, S3 wrote: > > This is a new BrainF compiler to replace the old one. > It uses the C++ API so it will generate code in the > proper format. It consolidates similar commands > (blocks of ('+' and '-') and ('<' and '>')). > It has an option for array bounds checking. Nice! > +#include "llvm/ADT/STLExtras.h" > +#include "llvm/Analysis/Verifier.h" > +#include "llvm/Bitcode/ReaderWriter.h" > +#include "llvm/CallingConv.h" > +#include "llvm/Constants.h" > +#include "llvm/DerivedTypes.h" > +#include "llvm/ExecutionEngine/GenericValue.h" > +#include "llvm/ExecutionEngine/Interpreter.h" > +#include "llvm/ExecutionEngine/JIT.h" > +#include "llvm/Instructions.h" > +#include "llvm/Module.h" > +#include "llvm/ModuleProvider.h" > +#include "llvm/Support/CommandLine.h" > +#include "llvm/Support/ManagedStatic.h" > +#include > +#include > +#include Please prune out include files you don't need. There are at least a couple redundant or unreferenced ones. > +cl::opt > +CompileMode("mode", > + cl::desc("Choose what to compile it to:"), > + cl::init(mode_LLAsm), > + cl::values( > + clEnumValN(mode_LLAsm, "ll", > + " Emit an LLVM assembly ('.ll') file"), > + clEnumValN(mode_BitCode, "bc", > + " Emit a bit code ('.bc') file"), > + clEnumValN(mode_JIT, "jit", > + " Run program with JIT compiling"), > + clEnumValEnd)); This is cute, but I'd suggest just having two modes to reduce link time. For example, have JIT mode and .bc writer mode, but no .ll writer mode (or .ll but not .bc). What do you think? > +void BrainF::header() { > + module = new Module("BrainF"); > + > + //Function prototypes > + > + //declare void @llvm.memset.i32(i8 *, i8, i32, i32) > + Function *memset_func; > + { > + const Type *memset_args[] = { > + PointerType::get(IntegerType::Int8Ty), > + IntegerType::Int8Ty, > + IntegerType::Int32Ty, > + IntegerType::Int32Ty > + }; > + FunctionType *memset_type = FunctionType:: > + get(Type::VoidTy, > + std::vector(memset_args, array_endof > (memset_args)), > + false, 0); > + memset_func = new Function(memset_type, > GlobalValue::ExternalLinkage, > + "llvm.memset.i32", module); > + memset_func->setCallingConv(CallingConv::C); > + } As a shortcut, you might consider calling module->getOrInsertFunction (PointerType::get(IntegerType::Int8Ty), IntegerType::Int8Ty, IntegerType::Int32Ty, IntegerType::Int32Ty, NULL); There is no need to set the callingconv to C, it defaults to that. > + curbb = new BasicBlock(label, brainf_func); > + > + //%arr = malloc i8, i32 %d > + ConstantInt *val_mem = ConstantInt::get(APInt(32, memtotal)); > + ptr_arr = new MallocInst(IntegerType::Int8Ty, val_mem, "arr", > curbb); > + > + //call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1) > + { > + Value *memset_params[] = { > + ptr_arr, > + ConstantInt::get(APInt(8, 0)), > + val_mem, > + ConstantInt::get(APInt(32, 1)) > + }; > + CallInst *memset_call = new CallInst(memset_func, memset_params, > + array_endof(memset_params), > + "", curbb); > + memset_call->setCallingConv(CallingConv::C); > + memset_call->setTailCall(false); > + } I'd strongly suggest using the LLVMBuilder (from "llvm/Support/ LLVMBuilder.h") interface to create code. It makes the code much more terse to construct instructions. Please ask if you have questions about how to use it. > + //Error block for array out of bounds > + if (comflag & flag_arraybounds) > + { > + //@aberrormsg = internal constant [%d x i8] c"\00" > + GlobalVariable *aberrormsg; > + { > + aberrormsg = new GlobalVariable( > + ArrayType::get(IntegerType::Int8Ty, 35), > + true, > + GlobalValue::InternalLinkage, > + 0, > + "aberrormsg", > + module); > + > + Constant *msg_0 = ConstantArray:: > + get("Error: The head has left the tape.", true); > + > + aberrormsg->setInitializer(msg_0); This can be a little more self describing if you reorganize it like this: > + Constant *msg_0 = ConstantArray:: > + get("Error: The head has left the tape.", true); > + aberrormsg = new GlobalVariable(msg_0->getType(), > + true, > + GlobalValue::InternalLinkage, > + msg_0, > + "aberrormsg", > + module); Which then allows you to change the indentation. > > + } } > > + } } } } Please don't pile up }'s like this, put them on their own line. In cases where you have a lot of nesting like this, consider factoring the inner body out into a function call. This can greatly reduce nesting and make the code much easier to follow. This file contains two logically distinct pieces: 1. The code to parse the file and build the module. 2. The driver code that handles command line arguments, runs the jit, etc. Please split this into two .cpp files. > > Index: examples/BrainF/Makefile > =================================================================== > --- examples/BrainF/Makefile (revision 0) > +++ examples/BrainF/Makefile (revision 0) > @@ -0,0 +1,15 @@ > +##===- examples/HowToUseJIT/Makefile -----------------------*- > Makefile -*-===## Please update this first line. -Chris From asl at math.spbu.ru Tue Sep 11 17:03:28 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 11 Sep 2007 22:03:28 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41867 - in /llvm-gcc-4.0/trunk/gcc: c-pragma.c config/darwin.h Message-ID: <200709112203.l8BM3S7R014735@zion.cs.uiuc.edu> Author: asl Date: Tue Sep 11 17:03:27 2007 New Revision: 41867 URL: http://llvm.org/viewvc/llvm-project?rev=41867&view=rev Log: Unbreak #pragma pack on non-darwin Modified: llvm-gcc-4.0/trunk/gcc/c-pragma.c llvm-gcc-4.0/trunk/gcc/config/darwin.h Modified: llvm-gcc-4.0/trunk/gcc/c-pragma.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/c-pragma.c?rev=41867&r1=41866&r2=41867&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/c-pragma.c (original) +++ llvm-gcc-4.0/trunk/gcc/c-pragma.c Tue Sep 11 17:03:27 2007 @@ -49,8 +49,197 @@ static GTY(()) struct align_stack * alignment_stack; -/* APPLE LOCAL Macintosh alignment */ -/* Lots of stuff deleted here. */ +/* LLVM LOCAL begin */ +#ifndef TARGET_OVERRIDE_PRAGMA_PACK_HANDLER +#ifdef HANDLE_PRAGMA_PACK +static void handle_pragma_pack (cpp_reader *); + +#ifdef HANDLE_PRAGMA_PACK_PUSH_POP +/* If we have a "global" #pragma pack() in effect when the first + #pragma pack(push,) is encountered, this stores the value of + maximum_field_alignment in effect. When the final pop_alignment() + happens, we restore the value to this, not to a value of 0 for + maximum_field_alignment. Value is in bits. */ +static int default_alignment; +#define SET_GLOBAL_ALIGNMENT(ALIGN) (maximum_field_alignment = *(alignment_stack == NULL \ + ? &default_alignment \ + : &alignment_stack->alignment) = (ALIGN)) + +static void push_alignment (int, tree); +static void pop_alignment (tree); + +/* Push an alignment value onto the stack. */ +static void +push_alignment (int alignment, tree id) +{ + align_stack * entry; + + entry = ggc_alloc (sizeof (* entry)); + + entry->alignment = alignment; + entry->id = id; + entry->prev = alignment_stack; + + /* The current value of maximum_field_alignment is not necessarily + 0 since there may be a #pragma pack() in effect; remember it + so that we can restore it after the final #pragma pop(). */ + if (alignment_stack == NULL) + default_alignment = maximum_field_alignment; + + alignment_stack = entry; + + maximum_field_alignment = alignment; +} + +/* Undo a push of an alignment onto the stack. */ +static void +pop_alignment (tree id) +{ + align_stack * entry; + + if (alignment_stack == NULL) + GCC_BAD ("#pragma pack (pop) encountered without matching #pragma pack (push)"); + + /* If we got an identifier, strip away everything above the target + entry so that the next step will restore the state just below it. */ + if (id) + { + for (entry = alignment_stack; entry; entry = entry->prev) + if (entry->id == id) + { + alignment_stack = entry; + break; + } + if (entry == NULL) + warning ("\ +#pragma pack(pop, %s) encountered without matching #pragma pack(push, %s)" + , IDENTIFIER_POINTER (id), IDENTIFIER_POINTER (id)); + } + + entry = alignment_stack->prev; + + maximum_field_alignment = entry ? entry->alignment : default_alignment; + + alignment_stack = entry; +} +#else /* not HANDLE_PRAGMA_PACK_PUSH_POP */ +#define SET_GLOBAL_ALIGNMENT(ALIGN) (maximum_field_alignment = (ALIGN)) +#define push_alignment(ID, N) \ + GCC_BAD ("#pragma pack(push[, id], ) is not supported on this target") +#define pop_alignment(ID) \ + GCC_BAD ("#pragma pack(pop[, id], ) is not supported on this target") +#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */ + +/* #pragma pack () + #pragma pack (N) + + #pragma pack (push) + #pragma pack (push, N) + #pragma pack (push, ID) + #pragma pack (push, ID, N) + #pragma pack (pop) + #pragma pack (pop, ID) */ +static void +handle_pragma_pack (cpp_reader * ARG_UNUSED (dummy)) +{ + tree x, id = 0; + int align = -1; + enum cpp_ttype token; + enum { set, push, pop } action; + + if (c_lex (&x) != CPP_OPEN_PAREN) + GCC_BAD ("missing %<(%> after %<#pragma pack%> - ignored"); + + token = c_lex (&x); + if (token == CPP_CLOSE_PAREN) + { + action = set; + align = initial_max_fld_align; + } + else if (token == CPP_NUMBER) + { + align = TREE_INT_CST_LOW (x); + action = set; + if (c_lex (&x) != CPP_CLOSE_PAREN) + GCC_BAD ("malformed %<#pragma pack%> - ignored"); + } + else if (token == CPP_NAME) + { +#define GCC_BAD_ACTION do { if (action != pop) \ + GCC_BAD ("malformed %<#pragma pack(push[, id][, ])%> - ignored"); \ + else \ + GCC_BAD ("malformed %<#pragma pack(pop[, id])%> - ignored"); \ + } while (0) + + const char *op = IDENTIFIER_POINTER (x); + if (!strcmp (op, "push")) + action = push; + else if (!strcmp (op, "pop")) + action = pop; + else + GCC_BAD2 ("unknown action %qs for %<#pragma pack%> - ignored", op); + + while ((token = c_lex (&x)) == CPP_COMMA) + { + token = c_lex (&x); + if (token == CPP_NAME && id == 0) + { + id = x; + } + else if (token == CPP_NUMBER && action == push && align == -1) + { + align = TREE_INT_CST_LOW (x); + if (align == -1) + action = set; + } + else + GCC_BAD_ACTION; + } + + if (token != CPP_CLOSE_PAREN) + GCC_BAD_ACTION; +#undef GCC_BAD_ACTION + } + else + GCC_BAD ("malformed %<#pragma pack%> - ignored"); + + if (c_lex (&x) != CPP_EOF) + warning ("junk at end of %<#pragma pack%>"); + + if (flag_pack_struct) + GCC_BAD ("#pragma pack has no effect with -fpack-struct - ignored"); + + if (action != pop) + switch (align) + { + case 0: + case 1: + case 2: + case 4: + case 8: + case 16: + align *= BITS_PER_UNIT; + break; + case -1: + if (action == push) + { + align = maximum_field_alignment; + break; + } + default: + GCC_BAD2 ("alignment must be a small power of two, not %d", align); + } + + switch (action) + { + case set: SET_GLOBAL_ALIGNMENT (align); break; + case push: push_alignment (align, id); break; + case pop: pop_alignment (id); break; + } +} +#endif /* HANDLE_PRAGMA_PACK */ +#endif /* TARGET_OVERRIDE_PRAGMA_PACK_HANDLER */ +/* LLVM LOCAL end */ static GTY(()) tree pending_weaks; @@ -495,10 +684,17 @@ void init_pragma (void) { -/* APPLE LOCAL begin Macintosh alignment 2002-1-22 --ff - Remove the handling of pragma pack here because it is handled - in config/darwin-c.c. - APPLE LOCAL end Macintosh alignment 2002-1-22 --ff */ +/* LLVM LOCAL begin */ +#ifndef TARGET_OVERRIDE_PRAGMA_PACK_HANDLER +#ifdef HANDLE_PRAGMA_PACK +#ifdef HANDLE_PRAGMA_PACK_WITH_EXPANSION + c_register_pragma_with_expansion (0, "pack", handle_pragma_pack); +#else + c_register_pragma (0, "pack", handle_pragma_pack); +#endif +#endif +#endif +/* LLVM LOCAL end */ #ifdef HANDLE_PRAGMA_WEAK c_register_pragma (0, "weak", handle_pragma_weak); #endif Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/darwin.h?rev=41867&r1=41866&r2=41867&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.0/trunk/gcc/config/darwin.h Tue Sep 11 17:03:27 2007 @@ -1563,6 +1563,11 @@ } while (0) /* APPLE LOCAL end OS pragma hook */ +/* LLVM LOCAL begin */ +/* Handle pragma pack separately */ +#define TARGET_OVERRIDE_PRAGMA_PACK_HANDLER 1 +/* LLVM LOCAL end */ + #define TARGET_TERMINATE_DW2_EH_FRAME_INFO false #undef TARGET_ASM_NAMED_SECTION From asl at math.spbu.ru Tue Sep 11 17:12:26 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 11 Sep 2007 22:12:26 -0000 Subject: [llvm-commits] [llvm] r41869 - /llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c Message-ID: <200709112212.l8BMCQBo015049@zion.cs.uiuc.edu> Author: asl Date: Tue Sep 11 17:12:26 2007 New Revision: 41869 URL: http://llvm.org/viewvc/llvm-project?rev=41869&view=rev Log: Testcase for recent pragma pack stuff Added: llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c Added: llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c?rev=41869&view=auto ============================================================================== --- llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c (added) +++ llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c Tue Sep 11 17:12:26 2007 @@ -0,0 +1,32 @@ +// RUN: %llvmgcc -O3 -S -o - %s | grep {26} + +#include + +#pragma pack(push, 1) +typedef struct +{ + uint32_t a; + uint8_t * b; +} foo; + +typedef struct { + uint8_t major; + uint8_t minor; + uint16_t build; +} VERSION; + +typedef struct { + uint8_t a[5]; + VERSION version; + uint8_t b; + char * c; + foo d; + uint32_t guard; +} bar; +#pragma pack(pop) + + +unsigned barsize(void) { + return sizeof(bar); +} + From asl at math.spbu.ru Tue Sep 11 17:20:27 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 11 Sep 2007 22:20:27 -0000 Subject: [llvm-commits] [llvm] r41870 - in /llvm/trunk/test/CFrontend: 2007-09-12-PragmaPack.c 2007-09-19-PragmaPack.c Message-ID: <200709112220.l8BMKSpB015442@zion.cs.uiuc.edu> Author: asl Date: Tue Sep 11 17:20:27 2007 New Revision: 41870 URL: http://llvm.org/viewvc/llvm-project?rev=41870&view=rev Log: Fix date :) Added: llvm/trunk/test/CFrontend/2007-09-12-PragmaPack.c - copied unchanged from r41869, llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c Removed: llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c Removed: llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c?rev=41869&view=auto ============================================================================== --- llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c (original) +++ llvm/trunk/test/CFrontend/2007-09-19-PragmaPack.c (removed) @@ -1,32 +0,0 @@ -// RUN: %llvmgcc -O3 -S -o - %s | grep {26} - -#include - -#pragma pack(push, 1) -typedef struct -{ - uint32_t a; - uint8_t * b; -} foo; - -typedef struct { - uint8_t major; - uint8_t minor; - uint16_t build; -} VERSION; - -typedef struct { - uint8_t a[5]; - VERSION version; - uint8_t b; - char * c; - foo d; - uint32_t guard; -} bar; -#pragma pack(pop) - - -unsigned barsize(void) { - return sizeof(bar); -} - From evan.cheng at apple.com Tue Sep 11 17:34:51 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 11 Sep 2007 22:34:51 -0000 Subject: [llvm-commits] [llvm] r41871 - in /llvm/trunk: lib/CodeGen/LiveVariables.cpp test/CodeGen/PowerPC/2007-09-11-RegCoalescerAssert.ll Message-ID: <200709112234.l8BMYrfx015783@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 11 17:34:47 2007 New Revision: 41871 URL: http://llvm.org/viewvc/llvm-project?rev=41871&view=rev Log: Sometimes a MI can define a register as well as defining a super-register at the same time. Do not mark the "smaller" def as dead. Added: llvm/trunk/test/CodeGen/PowerPC/2007-09-11-RegCoalescerAssert.ll Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=41871&r1=41870&r2=41871&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Tue Sep 11 17:34:47 2007 @@ -249,9 +249,6 @@ } void LiveVariables::HandlePhysRegUse(unsigned Reg, MachineInstr *MI) { - // There is a now a proper use, forget about the last partial use. - PhysRegPartUse[Reg] = NULL; - // Turn previous partial def's into read/mod/write. for (unsigned i = 0, e = PhysRegPartDef[Reg].size(); i != e; ++i) { MachineInstr *Def = PhysRegPartDef[Reg][i]; @@ -266,12 +263,15 @@ // A: EAX = ... // B: = AX // Add implicit def to A. - if (PhysRegInfo[Reg] && !PhysRegUsed[Reg]) { + if (PhysRegInfo[Reg] && PhysRegInfo[Reg] != PhysRegPartUse[Reg] && + !PhysRegUsed[Reg]) { MachineInstr *Def = PhysRegInfo[Reg]; if (!Def->findRegisterDefOperand(Reg)) Def->addRegOperand(Reg, true/*IsDef*/,true/*IsImp*/); } + // There is a now a proper use, forget about the last partial use. + PhysRegPartUse[Reg] = NULL; PhysRegInfo[Reg] = MI; PhysRegUsed[Reg] = true; @@ -373,7 +373,8 @@ } else if (PhysRegPartUse[SubReg]) // Add implicit use / kill to last use of a sub-register. addRegisterKilled(SubReg, PhysRegPartUse[SubReg], true); - else + else if (LastRef != MI) + // This must be a def of the subreg on the same MI. addRegisterDead(SubReg, LastRef); } } @@ -381,7 +382,7 @@ if (MI) { for (const unsigned *SuperRegs = RegInfo->getSuperRegisters(Reg); unsigned SuperReg = *SuperRegs; ++SuperRegs) { - if (PhysRegInfo[SuperReg]) { + if (PhysRegInfo[SuperReg] && PhysRegInfo[SuperReg] != MI) { // The larger register is previously defined. Now a smaller part is // being re-defined. Treat it as read/mod/write. // EAX = Added: llvm/trunk/test/CodeGen/PowerPC/2007-09-11-RegCoalescerAssert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2007-09-11-RegCoalescerAssert.ll?rev=41871&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2007-09-11-RegCoalescerAssert.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/2007-09-11-RegCoalescerAssert.ll Tue Sep 11 17:34:47 2007 @@ -0,0 +1,9 @@ +; RUN: llvm-as < %s | llc -march=ppc64 + + %struct.TCMalloc_SpinLock = type { i32 } + +define void @_ZN17TCMalloc_SpinLock4LockEv(%struct.TCMalloc_SpinLock* %this) { +entry: + %tmp3 = call i32 asm sideeffect "1: lwarx $0, 0, $1\0A\09stwcx. $2, 0, $1\0A\09bne- 1b\0A\09isync", "=&r,=*r,r,1,~{dirflag},~{fpsr},~{flags},~{memory}"( i32** null, i32 1, i32* null ) ; [#uses=0] + unreachable +} From dberlin at dberlin.org Tue Sep 11 17:58:30 2007 From: dberlin at dberlin.org (Daniel Berlin) Date: Tue, 11 Sep 2007 22:58:30 -0000 Subject: [llvm-commits] [llvm] r41872 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h Message-ID: <200709112258.l8BMwVSS016646@zion.cs.uiuc.edu> Author: dannyb Date: Tue Sep 11 17:58:27 2007 New Revision: 41872 URL: http://llvm.org/viewvc/llvm-project?rev=41872&view=rev Log: Move dump out of class, use "\n" instead of endl Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=41872&r1=41871&r2=41872&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original) +++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Tue Sep 11 17:58:27 2007 @@ -796,16 +796,6 @@ return iterator(this, ~0); } - // Dump our bits to stderr - void dump(llvm::OStream &out) const { - out << "[ "; - for (iterator bi = begin(); - bi != end(); - ++bi) { - out << *bi << " "; - } - out << std::endl; - } }; // Convenience functions to allow Or and And without dereferencing in the user @@ -834,6 +824,19 @@ const SparseBitVector *RHS) { return LHS &= (*RHS); } + + +// Dump a SparseBitVector to a stream +template +void dump(const SparseBitVector &LHS, llvm::OStream &out) { + out << "[ "; + + typename SparseBitVector::iterator bi; + for (bi = LHS.begin(); bi != LHS.end(); ++bi) { + out << *bi << " "; + } + out << "\n"; +} } From dalej at apple.com Tue Sep 11 18:41:36 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 11 Sep 2007 16:41:36 -0700 Subject: [llvm-commits] [llvm] r41858 - in /llvm/trunk: include/llvm/ADT/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Support/ lib/Target/CBackend/ lib/Target/MSIL/ lib/Target/X86/ lib/VMCore/ tools/llvm2cpp/ In-Reply-To: <12A3A31E-D99E-4B07-9AE3-41CD8A5CD325@apple.com> References: <200709111832.l8BIWZkb007987@zion.cs.uiuc.edu> <12A3A31E-D99E-4B07-9AE3-41CD8A5CD325@apple.com> Message-ID: <4072AA2A-1CC3-4854-8EEA-3404E761AADB@apple.com> On Sep 11, 2007, at 2:36 PM, Chris Lattner wrote: >> ===================================================================== >> = >> ======== >> --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) >> +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Sep 11 >> 13:32:33 2007 >> @@ -527,13 +527,20 @@ >> Code = bitc::CST_CODE_FLOAT; >> const Type *Ty = CFP->getType(); >> if (Ty == Type::FloatTy) >> - Record.push_back(FloatToBits(CFP->getValueAPF >> ().convertToFloat())); >> + Record.push_back((uint32_t)*CFP->getValueAPF >> ().convertToAPInt(). >> + getRawData()); >> else if (Ty == Type::DoubleTy) { >> + Record.push_back(*CFP->getValueAPF().convertToAPInt >> ().getRawData()); > > In cases where you know you're dealing with a float or a double, it > would be better to use: > CFP->getValueAPF().convertToAPInt().getZExtValue(); > > instead of getRawData(). In general, it is best to minimize use of > getRawData(), because if APInt ever changes, we will have to touch > each of them. In this specific case, it also allows you to merge the > float/double cases together. > > There are a bunch of examples of this in the patch. I know it's a > pain, but can you please switch them? OK. I consider using the same interface everywhere to be a good idea, but not as good an idea as sharing the float & double cases. >> +/// Treat api as containing the bits of a floating point number. >> Currently >> +/// we infer the floating point type from the size of the APInt. >> FIXME: This >> +/// breaks when we get to PPC128 and IEEE128 (but both cannot >> exist in the >> +/// same compile...) > > They can't both exist in the same module, but this method won't know > which it is getting without some context passed in. Or globally visible, or calling a target hook. Yeah, I know. I considered having the APInt's be 128 bits always and passing the type in parallel, but that leads to much uglier (& less efficient) code....I suppose we could allocate an extra bit for one of them. Ugh. From isanbard at gmail.com Tue Sep 11 18:55:41 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Sep 2007 23:55:41 -0000 Subject: [llvm-commits] [llvm] r41873 - in /llvm/trunk/lib/Target: ARM/ARMTargetAsmInfo.cpp PowerPC/PPCTargetAsmInfo.cpp Message-ID: <200709112355.l8BNtgZP018378@zion.cs.uiuc.edu> Author: void Date: Tue Sep 11 18:55:40 2007 New Revision: 41873 URL: http://llvm.org/viewvc/llvm-project?rev=41873&view=rev Log: Enable indirect encoding for the personality function Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Modified: llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp?rev=41873&r1=41872&r2=41873&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetAsmInfo.cpp Tue Sep 11 18:55:40 2007 @@ -60,6 +60,7 @@ EightByteConstantSection = "\t.literal8\n"; ReadOnlySection = "\t.const\n"; HasDotTypeDotSizeDirective = false; + NeedsIndirectEncoding = true; if (TM.getRelocationModel() == Reloc::Static) { StaticCtorsSection = ".constructor"; StaticDtorsSection = ".destructor"; Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=41873&r1=41872&r2=41873&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Tue Sep 11 18:55:40 2007 @@ -60,6 +60,7 @@ WeakRefDirective = "\t.weak_reference\t"; HiddenDirective = "\t.private_extern\t"; SupportsExceptionHandling = false; + NeedsIndirectEncoding = true; DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug"; From isanbard at gmail.com Tue Sep 11 18:57:07 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Sep 2007 16:57:07 -0700 Subject: [llvm-commits] [llvm] r41838 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86ATTAsmPrinter.cpp lib/Target/X86/X86AsmPrinter.cpp lib/Target/X86/X86AsmPrinter.h lib/Ta In-Reply-To: <487127BC-311B-4B3F-B9C7-056DC7D780FA@apple.com> References: <16e5fdf90709111021x7b3cb033q9f3cd4a4aff0e22b@mail.gmail.com> <487127BC-311B-4B3F-B9C7-056DC7D780FA@apple.com> Message-ID: <16e5fdf90709111657y377c1392xa0a50b213bc4e276@mail.gmail.com> On 9/11/07, Chris Lattner wrote: > > On Sep 11, 2007, at 10:21 AM, Bill Wendling wrote: > > > On 9/11/07, Anton Korobeynikov wrote: > >> Bill, > >> > >>> The personality function on Darwin needs a global stub. We then > >>> refer to > >>> that global stub instead of doing the ".set" thingy we were doing > >>> before. > >> This breaks linux. The problem is indirect encoding of personality > >> symbol. It shouldn't be so for linux. It seems we need another > >> knob for > >> it :( > >> > > Fixed: > > > > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- > > Mon-20070910/053411.html > > Shouldn't this bit also be set on darwin/ppc and darwin/arm? > More than likely. ;-) Done! -bw From dalej at apple.com Tue Sep 11 20:22:08 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 12 Sep 2007 01:22:08 -0000 Subject: [llvm-commits] [llvm] r41874 - /llvm/trunk/lib/Support/APFloat.cpp Message-ID: <200709120122.l8C1M8Ze021152@zion.cs.uiuc.edu> Author: johannes Date: Tue Sep 11 20:22:05 2007 New Revision: 41874 URL: http://llvm.org/viewvc/llvm-project?rev=41874&view=rev Log: Compensate for partCount change in Bogus definition (could break hash table in ConstantFP) Modified: llvm/trunk/lib/Support/APFloat.cpp Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=41874&r1=41873&r2=41874&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Tue Sep 11 20:22:05 2007 @@ -47,7 +47,7 @@ const fltSemantics APFloat::IEEEdouble = { 1023, -1022, 53, true }; const fltSemantics APFloat::IEEEquad = { 16383, -16382, 113, true }; const fltSemantics APFloat::x87DoubleExtended = { 16383, -16382, 64, false }; - const fltSemantics APFloat::Bogus = { 0, 0, 0, false }; + const fltSemantics APFloat::Bogus = { 0, 0, 0, true }; } /* Put a bunch of private, handy routines in an anonymous namespace. */ From stein at duvel.ir.iit.edu Tue Sep 11 21:58:10 2007 From: stein at duvel.ir.iit.edu (S3) Date: Tue, 11 Sep 2007 21:58:10 -0500 Subject: [llvm-commits] BrainF compiler In-Reply-To: <4D473BAF-D716-4DAA-B60A-76121345D347@apple.com> References: <46E032E3.2030401@ir.iit.edu> <4D473BAF-D716-4DAA-B60A-76121345D347@apple.com> Message-ID: <46E755C2.50502@ir.iit.edu> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I have made the requested changes. It is now split into separate files. The code should be clean now. > This is a new BrainF compiler to replace the old one. > It uses the C++ API so it will generate code in the > proper format. It consolidates similar commands > (blocks of ('+' and '-') and ('<' and '>')). > It has an option for array bounds checking. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7-ecc0.1.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFG51XCxzVgPqtIcfsRAsQaAJ0bVU9kzrYVQ78uvwqQmxe3J8EI0wCfccZM k421TIL4CLeAGsiWJDfnIgI= =vw7N -----END PGP SIGNATURE----- -------------- next part -------------- A non-text attachment was scrubbed... Name: brainf.patch Type: text/x-patch Size: 22327 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070911/0413e61a/attachment.bin From dalej at apple.com Tue Sep 11 22:30:34 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 12 Sep 2007 03:30:34 -0000 Subject: [llvm-commits] [llvm] r41875 - in /llvm/trunk: lib/AsmParser/Lexer.l lib/AsmParser/llvmAsmParser.y lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/CodeGen/AsmPrinter.cpp lib/CodeGen/MachOWriter.cpp lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/CBackend/CBackend.cpp lib/Target/MSIL/MSILWriter.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/ConstantFold.cpp lib/VMCore/Constants.cpp tools/llvm2cpp/CppWriter.cpp Message-ID: <200709120330.l8C3UZtk025296@zion.cs.uiuc.edu> Author: johannes Date: Tue Sep 11 22:30:33 2007 New Revision: 41875 URL: http://llvm.org/viewvc/llvm-project?rev=41875&view=rev Log: Revise previous patch per review comments. Next round of x87 long double stuff. Getting close now, basically works. Modified: llvm/trunk/lib/AsmParser/Lexer.l llvm/trunk/lib/AsmParser/llvmAsmParser.y llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/trunk/lib/CodeGen/AsmPrinter.cpp llvm/trunk/lib/CodeGen/MachOWriter.cpp llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/CBackend/CBackend.cpp llvm/trunk/lib/Target/MSIL/MSILWriter.cpp llvm/trunk/lib/VMCore/AsmWriter.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/tools/llvm2cpp/CppWriter.cpp Modified: llvm/trunk/lib/AsmParser/Lexer.l URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Lexer.l?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/Lexer.l (original) +++ llvm/trunk/lib/AsmParser/Lexer.l Tue Sep 11 22:30:33 2007 @@ -284,8 +284,8 @@ float { RET_TY(Type::FloatTy, FLOAT); } double { RET_TY(Type::DoubleTy,DOUBLE);} x86_fp80 { RET_TY(Type::X86_FP80Ty, X86_FP80);} -fp128 { RET_TY(Type::FP128Ty, FP128);} -ppc_fp128 { RET_TY(Type::PPC_FP128Ty, PPC_FP128);} +fp128 { RET_TY(Type::FP128Ty, FP128);} +ppc_fp128 { RET_TY(Type::PPC_FP128Ty, PPC_FP128);} label { RET_TY(Type::LabelTy, LABEL); } type { return TYPE; } opaque { return OPAQUE; } @@ -477,21 +477,21 @@ } {FPConstant} { llvmAsmlval.FPVal = new APFloat(atof(yytext)); return FPVAL; } -{HexFPConstant} { llvmAsmlval.FPVal = new APFloat(HexToFP(yytext)); +{HexFPConstant} { llvmAsmlval.FPVal = new APFloat(HexToFP(yytext+2)); return FPVAL; } {HexFP80Constant} { uint64_t Pair[2]; - HexToIntPair(yytext, Pair); + HexToIntPair(yytext+3, Pair); llvmAsmlval.FPVal = new APFloat(APInt(80, 2, Pair)); return FPVAL; } {HexFP128Constant} { uint64_t Pair[2]; - HexToIntPair(yytext, Pair); + HexToIntPair(yytext+3, Pair); llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); return FPVAL; } {HexPPC128Constant} { uint64_t Pair[2]; - HexToIntPair(yytext, Pair); + HexToIntPair(yytext+3, Pair); llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); return FPVAL; } Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Tue Sep 11 22:30:33 2007 @@ -1866,7 +1866,7 @@ $$ = ConstantInt::getFalse(); CHECK_FOR_ERROR } - | FPType FPVAL { // Float & Double constants + | FPType FPVAL { // Floating point constants if (!ConstantFP::isValueValidForType($1, *$2)) GEN_ERROR("Floating point constant invalid for type"); // Lexer has no type info, so builds all float and double FP constants Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Sep 11 22:30:33 2007 @@ -629,7 +629,6 @@ V = ConstantFP::get(CurTy, APFloat(APInt(32, (uint32_t)Record[0]))); else if (CurTy == Type::DoubleTy) V = ConstantFP::get(CurTy, APFloat(APInt(64, Record[0]))); - // FIXME: Make long double constants work. BitsToDouble does not make it. else if (CurTy == Type::X86_FP80Ty) V = ConstantFP::get(CurTy, APFloat(APInt(80, 2, &Record[0]))); else if (CurTy == Type::FP128Ty) Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Sep 11 22:30:33 2007 @@ -526,11 +526,8 @@ } else if (const ConstantFP *CFP = dyn_cast(C)) { Code = bitc::CST_CODE_FLOAT; const Type *Ty = CFP->getType(); - if (Ty == Type::FloatTy) - Record.push_back((uint32_t)*CFP->getValueAPF().convertToAPInt(). - getRawData()); - else if (Ty == Type::DoubleTy) { - Record.push_back(*CFP->getValueAPF().convertToAPInt().getRawData()); + if (Ty == Type::FloatTy || Ty == Type::DoubleTy) { + Record.push_back(CFP->getValueAPF().convertToAPInt().getZExtValue()); } else if (Ty == Type::X86_FP80Ty) { const uint64_t *p = CFP->getValueAPF().convertToAPInt().getRawData(); Record.push_back(p[0]); Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Tue Sep 11 22:30:33 2007 @@ -831,7 +831,7 @@ // precision... if (CFP->getType() == Type::DoubleTy) { double Val = CFP->getValueAPF().convertToDouble(); // for comment only - uint64_t i = *CFP->getValueAPF().convertToAPInt().getRawData(); + uint64_t i = CFP->getValueAPF().convertToAPInt().getZExtValue(); if (TAI->getData64bitsDirective()) O << TAI->getData64bitsDirective() << i << "\t" << TAI->getCommentString() << " double value: " << Val << "\n"; @@ -851,13 +851,50 @@ << " double most significant word " << Val << "\n"; } return; - } else { + } else if (CFP->getType() == Type::FloatTy) { float Val = CFP->getValueAPF().convertToFloat(); // for comment only O << TAI->getData32bitsDirective() - << (uint32_t)*CFP->getValueAPF().convertToAPInt().getRawData() + << CFP->getValueAPF().convertToAPInt().getZExtValue() << "\t" << TAI->getCommentString() << " float " << Val << "\n"; return; - } + } else if (CFP->getType() == Type::X86_FP80Ty) { + // all long double variants are printed as hex + const uint64_t *p = CFP->getValueAPF().convertToAPInt().getRawData(); + if (TD->isBigEndian()) { + O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 48) + << "\t" << TAI->getCommentString() + << " long double most significant halfword\n"; + O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 32) + << "\t" << TAI->getCommentString() + << " long double next halfword\n"; + O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 16) + << "\t" << TAI->getCommentString() + << " long double next halfword\n"; + O << TAI->getData16bitsDirective() << uint16_t(p[0]) + << "\t" << TAI->getCommentString() + << " long double next halfword\n"; + O << TAI->getData16bitsDirective() << uint16_t(p[1]) + << "\t" << TAI->getCommentString() + << " long double least significant halfword\n"; + } else { + O << TAI->getData16bitsDirective() << uint16_t(p[1]) + << "\t" << TAI->getCommentString() + << " long double least significant halfword\n"; + O << TAI->getData16bitsDirective() << uint16_t(p[0]) + << "\t" << TAI->getCommentString() + << " long double next halfword\n"; + O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 16) + << "\t" << TAI->getCommentString() + << " long double next halfword\n"; + O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 32) + << "\t" << TAI->getCommentString() + << " long double next halfword\n"; + O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 48) + << "\t" << TAI->getCommentString() + << " long double most significant halfword\n"; + } + return; + } else assert(0 && "Floating point constant type not handled"); } else if (CV->getType() == Type::Int64Ty) { if (const ConstantInt *CI = dyn_cast(CV)) { uint64_t Val = CI->getZExtValue(); Modified: llvm/trunk/lib/CodeGen/MachOWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachOWriter.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachOWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/MachOWriter.cpp Tue Sep 11 22:30:33 2007 @@ -861,8 +861,8 @@ break; } case Type::FloatTyID: { - uint32_t val = (uint32_t)*cast(PC)-> - getValueAPF().convertToAPInt().getRawData(); + uint32_t val = cast(PC)->getValueAPF().convertToAPInt(). + getZExtValue(); if (TD->isBigEndian()) val = ByteSwap_32(val); ptr[0] = val; @@ -872,8 +872,8 @@ break; } case Type::DoubleTyID: { - uint64_t val = *cast(PC)->getValueAPF().convertToAPInt(). - getRawData(); + uint64_t val = cast(PC)->getValueAPF().convertToAPInt(). + getZExtValue(); if (TD->isBigEndian()) val = ByteSwap_64(val); ptr[0] = val; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 11 22:30:33 2007 @@ -3800,8 +3800,8 @@ default: assert(0 && "Unknown FP type"); case MVT::f32: if (!AfterLegalize || TLI.isTypeLegal(MVT::i32)) { - Tmp = DAG.getConstant((uint32_t)*CFP->getValueAPF(). - convertToAPInt().getRawData(), MVT::i32); + Tmp = DAG.getConstant((uint32_t)CFP->getValueAPF(). + convertToAPInt().getZExtValue(), MVT::i32); return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), ST->getSrcValueOffset(), ST->isVolatile(), ST->getAlignment()); @@ -3809,8 +3809,8 @@ break; case MVT::f64: if (!AfterLegalize || TLI.isTypeLegal(MVT::i64)) { - Tmp = DAG.getConstant(*CFP->getValueAPF().convertToAPInt(). - getRawData(), MVT::i64); + Tmp = DAG.getConstant(CFP->getValueAPF().convertToAPInt(). + getZExtValue(), MVT::i64); return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(), ST->getSrcValueOffset(), ST->isVolatile(), ST->getAlignment()); @@ -3818,7 +3818,7 @@ // 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 = *CFP->getValueAPF().convertToAPInt().getRawData(); + uint64_t Val = CFP->getValueAPF().convertToAPInt().getZExtValue(); SDOperand Lo = DAG.getConstant(Val & 0xFFFFFFFF, MVT::i32); SDOperand Hi = DAG.getConstant(Val >> 32, MVT::i32); if (!TLI.isLittleEndian()) std::swap(Lo, Hi); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Sep 11 22:30:33 2007 @@ -489,11 +489,8 @@ ConstantFP *LLVMC = ConstantFP::get(isDouble ? Type::DoubleTy : Type::FloatTy, CFP->getValueAPF()); if (!UseCP) { - const APFloat& Val = LLVMC->getValueAPF(); - return isDouble - ? DAG.getConstant(*Val.convertToAPInt().getRawData(), MVT::i64) - : DAG.getConstant((uint32_t )*Val.convertToAPInt().getRawData(), - MVT::i32); + return DAG.getConstant(LLVMC->getValueAPF().convertToAPInt().getZExtValue(), + isDouble ? MVT::i64 : MVT::i32); } if (isDouble && CFP->isValueValidForType(MVT::f32, CFP->getValueAPF()) && @@ -1981,13 +1978,13 @@ // together. if (ConstantFPSDNode *CFP = dyn_cast(ST->getValue())) { if (CFP->getValueType(0) == MVT::f32) { - Tmp3 = DAG.getConstant((uint32_t)*CFP->getValueAPF(). - convertToAPInt().getRawData(), + Tmp3 = DAG.getConstant((uint32_t)CFP->getValueAPF(). + convertToAPInt().getZExtValue(), MVT::i32); } else { assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); - Tmp3 = DAG.getConstant(*CFP->getValueAPF().convertToAPInt(). - getRawData(), MVT::i64); + Tmp3 = DAG.getConstant(CFP->getValueAPF().convertToAPInt(). + getZExtValue(), MVT::i64); } Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), SVOffset, isVolatile, Alignment); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 11 22:30:33 2007 @@ -109,12 +109,12 @@ } else if (isa(NotZero)) { MVT::ValueType VT = NotZero.getValueType(); if (VT== MVT::f64) { - if (*((cast(NotZero)->getValueAPF(). - convertToAPInt().getRawData())) != (uint64_t)-1) + if (((cast(NotZero)->getValueAPF(). + convertToAPInt().getZExtValue())) != (uint64_t)-1) return false; } else { - if ((uint32_t)*cast(NotZero)-> - getValueAPF().convertToAPInt().getRawData() != + if ((uint32_t)cast(NotZero)-> + getValueAPF().convertToAPInt().getZExtValue() != (uint32_t)-1) return false; } @@ -1697,9 +1697,9 @@ } case ISD::BIT_CONVERT: if (VT == MVT::i32 && C->getValueType(0) == MVT::f32) - return getConstant((uint32_t)*V.convertToAPInt().getRawData(), VT); + return getConstant((uint32_t)V.convertToAPInt().getZExtValue(), VT); else if (VT == MVT::i64 && C->getValueType(0) == MVT::f64) - return getConstant(*V.convertToAPInt().getRawData(), VT); + return getConstant(V.convertToAPInt().getZExtValue(), VT); break; } } Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Tue Sep 11 22:30:33 2007 @@ -1715,14 +1715,14 @@ if (FPC->getType() == Type::DoubleTy) { double Val = FPC->getValueAPF().convertToDouble(); - uint64_t i = *FPC->getValueAPF().convertToAPInt().getRawData(); + uint64_t i = FPC->getValueAPF().convertToAPInt().getZExtValue(); Out << "static const ConstantDoubleTy FPConstant" << FPCounter++ << " = 0x" << std::hex << i << std::dec << "ULL; /* " << Val << " */\n"; } else if (FPC->getType() == Type::FloatTy) { float Val = FPC->getValueAPF().convertToFloat(); - uint32_t i = (uint32_t)*FPC->getValueAPF().convertToAPInt(). - getRawData(); + uint32_t i = (uint32_t)FPC->getValueAPF().convertToAPInt(). + getZExtValue(); Out << "static const ConstantFloatTy FPConstant" << FPCounter++ << " = 0x" << std::hex << i << std::dec << "U; /* " << Val << " */\n"; Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original) +++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Tue Sep 11 22:30:33 2007 @@ -428,10 +428,10 @@ uint64_t X; unsigned Size; if (FP->getType()->getTypeID()==Type::FloatTyID) { - X = (uint32_t)*FP->getValueAPF().convertToAPInt().getRawData(); + X = (uint32_t)FP->getValueAPF().convertToAPInt().getZExtValue(); Size = 4; } else { - X = *FP->getValueAPF().convertToAPInt().getRawData(); + X = FP->getValueAPF().convertToAPInt().getZExtValue(); Size = 8; } Out << "\tldc.r" << Size << "\t( " << utohexstr(X) << ')'; @@ -1473,10 +1473,10 @@ const ConstantFP* FP = cast(C); if (Ty->getTypeID() == Type::FloatTyID) Out << "int32 (" << - (uint32_t)*FP->getValueAPF().convertToAPInt().getRawData() << ')'; + (uint32_t)FP->getValueAPF().convertToAPInt().getZExtValue() << ')'; else Out << "int64 (" << - *FP->getValueAPF().convertToAPInt().getRawData() << ')'; + FP->getValueAPF().convertToAPInt().getZExtValue() << ')'; break; } case Type::ArrayTyID: Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original) +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Sep 11 22:30:33 2007 @@ -481,35 +481,64 @@ else Out << CI->getValue().toStringSigned(10); } else if (const ConstantFP *CFP = dyn_cast(CV)) { - // We would like to output the FP constant value in exponential notation, - // but we cannot do this if doing so will lose precision. Check here to - // make sure that we only output it in exponential format if we can parse - // the value back and get the same value. - // - bool isDouble = &CFP->getValueAPF().getSemantics() == &APFloat::IEEEdouble; - double Val = (isDouble) ? CFP->getValueAPF().convertToDouble() : - CFP->getValueAPF().convertToFloat(); - std::string StrVal = ftostr(CFP->getValueAPF()); - - // Check to make sure that the stringized number is not some string like - // "Inf" or NaN, that atof will accept, but the lexer will not. Check that - // the string matches the "[-+]?[0-9]" regex. - // - if ((StrVal[0] >= '0' && StrVal[0] <= '9') || - ((StrVal[0] == '-' || StrVal[0] == '+') && - (StrVal[1] >= '0' && StrVal[1] <= '9'))) - // Reparse stringized version! - if (atof(StrVal.c_str()) == Val) { - Out << StrVal; - return; + if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEdouble || + &CFP->getValueAPF().getSemantics() == &APFloat::IEEEsingle) { + // We would like to output the FP constant value in exponential notation, + // but we cannot do this if doing so will lose precision. Check here to + // make sure that we only output it in exponential format if we can parse + // the value back and get the same value. + // + bool isDouble = &CFP->getValueAPF().getSemantics()==&APFloat::IEEEdouble; + double Val = (isDouble) ? CFP->getValueAPF().convertToDouble() : + CFP->getValueAPF().convertToFloat(); + std::string StrVal = ftostr(CFP->getValueAPF()); + + // Check to make sure that the stringized number is not some string like + // "Inf" or NaN, that atof will accept, but the lexer will not. Check + // that the string matches the "[-+]?[0-9]" regex. + // + if ((StrVal[0] >= '0' && StrVal[0] <= '9') || + ((StrVal[0] == '-' || StrVal[0] == '+') && + (StrVal[1] >= '0' && StrVal[1] <= '9'))) { + // Reparse stringized version! + if (atof(StrVal.c_str()) == Val) { + Out << StrVal; + return; + } } - - // Otherwise we could not reparse it to exactly the same value, so we must - // output the string in hexadecimal format! - assert(sizeof(double) == sizeof(uint64_t) && - "assuming that double is 64 bits!"); - Out << "0x" << utohexstr(DoubleToBits(Val)); - + // Otherwise we could not reparse it to exactly the same value, so we must + // output the string in hexadecimal format! + assert(sizeof(double) == sizeof(uint64_t) && + "assuming that double is 64 bits!"); + Out << "0x" << utohexstr(DoubleToBits(Val)); + } else { + // Some form of long double. These appear as a magic letter identifying + // the type, then a fixed number of hex digits. + Out << "0x"; + if (&CFP->getValueAPF().getSemantics() == &APFloat::x87DoubleExtended) + Out << 'K'; + else if (&CFP->getValueAPF().getSemantics() == &APFloat::IEEEquad) + Out << 'L'; + else + assert(0 && "Unsupported floating point type"); + const uint64_t* p = CFP->getValueAPF().convertToAPInt().getRawData(); + uint64_t word = *p; + int shiftcount=60; + int width = CFP->getValueAPF().convertToAPInt().getBitWidth(); + for (int j=0; j>shiftcount) & 15; + if (nibble < 10) + Out << (unsigned char)(nibble + '0'); + else + Out << (unsigned char)(nibble - 10 + 'A'); + if (shiftcount == 0) { + word = *(++p); + shiftcount = 60; + if (width-j-4 < 64) + shiftcount = width-j-4; + } + } + } } else if (isa(CV)) { Out << "zeroinitializer"; } else if (const ConstantArray *CA = dyn_cast(CV)) { Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Sep 11 22:30:33 2007 @@ -87,8 +87,8 @@ if (SrcEltTy->getTypeID() == Type::DoubleTyID) { for (unsigned i = 0; i != SrcNumElts; ++i) { - uint64_t V = *cast(CV->getOperand(i))-> - getValueAPF().convertToAPInt().getRawData(); + uint64_t V = cast(CV->getOperand(i))-> + getValueAPF().convertToAPInt().getZExtValue(); Constant *C = ConstantInt::get(Type::Int64Ty, V); Result.push_back(ConstantExpr::getBitCast(C, DstEltTy )); } @@ -97,8 +97,8 @@ assert(SrcEltTy->getTypeID() == Type::FloatTyID); for (unsigned i = 0; i != SrcNumElts; ++i) { - uint32_t V = (uint32_t)*cast(CV->getOperand(i))-> - getValueAPF().convertToAPInt().getRawData(); + uint32_t V = (uint32_t)cast(CV->getOperand(i))-> + getValueAPF().convertToAPInt().getZExtValue(); Constant *C = ConstantInt::get(Type::Int32Ty, V); Result.push_back(ConstantExpr::getBitCast(C, DstEltTy)); } @@ -331,9 +331,8 @@ return const_cast(V); if (DestTy->isFloatingPoint()) { - if (DestTy == Type::FloatTy) - return ConstantFP::get(DestTy, APFloat(CI->getValue())); - assert(DestTy == Type::DoubleTy && "Unknown FP type!"); + assert((DestTy == Type::DoubleTy || DestTy == Type::FloatTy) && + "Unknown FP type!"); return ConstantFP::get(DestTy, APFloat(CI->getValue())); } // Otherwise, can't fold this (vector?) Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Sep 11 22:30:33 2007 @@ -245,8 +245,14 @@ // temporary if (Ty==Type::FloatTy) assert(&V.getSemantics()==&APFloat::IEEEsingle); - else + else if (Ty==Type::DoubleTy) assert(&V.getSemantics()==&APFloat::IEEEdouble); + else if (Ty==Type::X86_FP80Ty) + assert(&V.getSemantics()==&APFloat::x87DoubleExtended); + else if (Ty==Type::FP128Ty) + assert(&V.getSemantics()==&APFloat::IEEEquad); + else + assert(0); } bool ConstantFP::isNullValue() const { @@ -294,8 +300,14 @@ // temporary if (Ty==Type::FloatTy) assert(&V.getSemantics()==&APFloat::IEEEsingle); - else + else if (Ty==Type::DoubleTy) assert(&V.getSemantics()==&APFloat::IEEEdouble); + else if (Ty==Type::X86_FP80Ty) + assert(&V.getSemantics()==&APFloat::x87DoubleExtended); + else if (Ty==Type::FP128Ty) + assert(&V.getSemantics()==&APFloat::IEEEquad); + else + assert(0); DenseMapAPFloatKeyInfo::KeyTy Key(V); ConstantFP *&Slot = (*FPConstants)[Key]; @@ -713,11 +725,14 @@ &Val2.getSemantics() == &APFloat::IEEEdouble || Val2.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven) == APFloat::opOK; - // TODO: Figure out how to test if we can use a shorter type instead! case Type::X86_FP80TyID: - case Type::PPC_FP128TyID: + return &Val2.getSemantics() == &APFloat::IEEEsingle || + &Val2.getSemantics() == &APFloat::IEEEdouble || + &Val2.getSemantics() == &APFloat::x87DoubleExtended; case Type::FP128TyID: - return true; + return &Val2.getSemantics() == &APFloat::IEEEsingle || + &Val2.getSemantics() == &APFloat::IEEEdouble || + &Val2.getSemantics() == &APFloat::IEEEquad; } } Modified: llvm/trunk/tools/llvm2cpp/CppWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm2cpp/CppWriter.cpp?rev=41875&r1=41874&r2=41875&view=diff ============================================================================== --- llvm/trunk/tools/llvm2cpp/CppWriter.cpp (original) +++ llvm/trunk/tools/llvm2cpp/CppWriter.cpp Tue Sep 11 22:30:33 2007 @@ -250,11 +250,11 @@ } else if (CFP->getType() == Type::DoubleTy) Out << "BitsToDouble(0x" << std::hex - << *CFP->getValueAPF().convertToAPInt().getRawData() + << CFP->getValueAPF().convertToAPInt().getZExtValue() << std::dec << "ULL) /* " << StrVal << " */"; else Out << "BitsToFloat(0x" << std::hex - << (uint32_t)*CFP->getValueAPF().convertToAPInt().getRawData() + << (uint32_t)CFP->getValueAPF().convertToAPInt().getZExtValue() << std::dec << "U) /* " << StrVal << " */"; Out << ")"; #if HAVE_PRINTF_A From dalej at apple.com Tue Sep 11 22:31:29 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 12 Sep 2007 03:31:29 -0000 Subject: [llvm-commits] [llvm] r41876 - in /llvm/trunk/lib/AsmParser: Lexer.cpp.cvs Lexer.l.cvs llvmAsmParser.cpp.cvs llvmAsmParser.y.cvs Message-ID: <200709120331.l8C3VT1b025343@zion.cs.uiuc.edu> Author: johannes Date: Tue Sep 11 22:31:28 2007 New Revision: 41876 URL: http://llvm.org/viewvc/llvm-project?rev=41876&view=rev Log: Generated files for previous patch. Modified: llvm/trunk/lib/AsmParser/Lexer.cpp.cvs llvm/trunk/lib/AsmParser/Lexer.l.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Modified: llvm/trunk/lib/AsmParser/Lexer.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Lexer.cpp.cvs?rev=41876&r1=41875&r2=41876&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/Lexer.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/Lexer.cpp.cvs Tue Sep 11 22:31:28 2007 @@ -2181,7 +2181,7 @@ case 146: YY_RULE_SETUP #line 480 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" -{ llvmAsmlval.FPVal = new APFloat(HexToFP(yytext)); +{ llvmAsmlval.FPVal = new APFloat(HexToFP(yytext+2)); return FPVAL; } YY_BREAK @@ -2189,7 +2189,7 @@ YY_RULE_SETUP #line 483 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { uint64_t Pair[2]; - HexToIntPair(yytext, Pair); + HexToIntPair(yytext+3, Pair); llvmAsmlval.FPVal = new APFloat(APInt(80, 2, Pair)); return FPVAL; } @@ -2198,7 +2198,7 @@ YY_RULE_SETUP #line 488 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { uint64_t Pair[2]; - HexToIntPair(yytext, Pair); + HexToIntPair(yytext+3, Pair); llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); return FPVAL; } @@ -2207,7 +2207,7 @@ YY_RULE_SETUP #line 493 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/Lexer.l" { uint64_t Pair[2]; - HexToIntPair(yytext, Pair); + HexToIntPair(yytext+3, Pair); llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); return FPVAL; } Modified: llvm/trunk/lib/AsmParser/Lexer.l.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/Lexer.l.cvs?rev=41876&r1=41875&r2=41876&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/Lexer.l.cvs (original) +++ llvm/trunk/lib/AsmParser/Lexer.l.cvs Tue Sep 11 22:31:28 2007 @@ -284,8 +284,8 @@ float { RET_TY(Type::FloatTy, FLOAT); } double { RET_TY(Type::DoubleTy,DOUBLE);} x86_fp80 { RET_TY(Type::X86_FP80Ty, X86_FP80);} -fp128 { RET_TY(Type::FP128Ty, FP128);} -ppc_fp128 { RET_TY(Type::PPC_FP128Ty, PPC_FP128);} +fp128 { RET_TY(Type::FP128Ty, FP128);} +ppc_fp128 { RET_TY(Type::PPC_FP128Ty, PPC_FP128);} label { RET_TY(Type::LabelTy, LABEL); } type { return TYPE; } opaque { return OPAQUE; } @@ -477,21 +477,21 @@ } {FPConstant} { llvmAsmlval.FPVal = new APFloat(atof(yytext)); return FPVAL; } -{HexFPConstant} { llvmAsmlval.FPVal = new APFloat(HexToFP(yytext)); +{HexFPConstant} { llvmAsmlval.FPVal = new APFloat(HexToFP(yytext+2)); return FPVAL; } {HexFP80Constant} { uint64_t Pair[2]; - HexToIntPair(yytext, Pair); + HexToIntPair(yytext+3, Pair); llvmAsmlval.FPVal = new APFloat(APInt(80, 2, Pair)); return FPVAL; } {HexFP128Constant} { uint64_t Pair[2]; - HexToIntPair(yytext, Pair); + HexToIntPair(yytext+3, Pair); llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); return FPVAL; } {HexPPC128Constant} { uint64_t Pair[2]; - HexToIntPair(yytext, Pair); + HexToIntPair(yytext+3, Pair); llvmAsmlval.FPVal = new APFloat(APInt(128, 2, Pair)); return FPVAL; } Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=41876&r1=41875&r2=41876&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Tue Sep 11 22:31:28 2007 @@ -3589,7 +3589,7 @@ break;} case 180: #line 1869 "/Volumes/MacOS9/gcc/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Float & Double constants +{ // Floating point constants if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal)) GEN_ERROR("Floating point constant invalid for type"); // Lexer has no type info, so builds all float and double FP constants Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=41876&r1=41875&r2=41876&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Tue Sep 11 22:31:28 2007 @@ -1866,7 +1866,7 @@ $$ = ConstantInt::getFalse(); CHECK_FOR_ERROR } - | FPType FPVAL { // Float & Double constants + | FPType FPVAL { // Floating point constants if (!ConstantFP::isValueValidForType($1, *$2)) GEN_ERROR("Floating point constant invalid for type"); // Lexer has no type info, so builds all float and double FP constants From clattner at apple.com Wed Sep 12 01:08:30 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 11 Sep 2007 23:08:30 -0700 Subject: [llvm-commits] [llvm] r41858 - in /llvm/trunk: include/llvm/ADT/ lib/AsmParser/ lib/Bitcode/Reader/ lib/Bitcode/Writer/ lib/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Support/ lib/Target/CBackend/ lib/Target/MSIL/ lib/Target/X86/ lib/VMCore/ tools/llvm2cpp/ In-Reply-To: <4072AA2A-1CC3-4854-8EEA-3404E761AADB@apple.com> References: <200709111832.l8BIWZkb007987@zion.cs.uiuc.edu> <12A3A31E-D99E-4B07-9AE3-41CD8A5CD325@apple.com> <4072AA2A-1CC3-4854-8EEA-3404E761AADB@apple.com> Message-ID: <5D53F104-3AC9-4817-B323-102D188E6F32@apple.com> On Sep 11, 2007, at 4:41 PM, Dale Johannesen wrote: > >>> +/// Treat api as containing the bits of a floating point number. >>> Currently >>> +/// we infer the floating point type from the size of the APInt. >>> FIXME: This >>> +/// breaks when we get to PPC128 and IEEE128 (but both cannot >>> exist in the >>> +/// same compile...) >> >> They can't both exist in the same module, but this method won't know >> which it is getting without some context passed in. > > Or globally visible, or calling a target hook. Yeah, I know. I > considered > having the APInt's be 128 bits always and passing the type in > parallel, > but that leads to much uglier (& less efficient) code....I suppose we > could > allocate an extra bit for one of them. Ugh. It think it would be better to add an extra argument to the function, indicating what format it is in. -Chris From clattner at apple.com Wed Sep 12 01:12:22 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 11 Sep 2007 23:12:22 -0700 Subject: [llvm-commits] [llvm] r41875 - in /llvm/trunk: lib/AsmParser/Lexer.l lib/AsmParser/llvmAsmParser.y lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/CodeGen/AsmPrinter.cpp lib/CodeGen/MachOWriter.cpp lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/CBackend/CBackend.cpp lib/Target/MSIL/MSILWriter.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/ConstantFold.cpp lib/VMCore/Constants.cpp tools/llvm2cpp/CppWriter.cpp In-Reply-To: <200709120330.l8C3UZtk025296@zion.cs.uiuc.edu> References: <200709120330.l8C3UZtk025296@zion.cs.uiuc.edu> Message-ID: On Sep 11, 2007, at 8:30 PM, Dale Johannesen wrote: > Revise previous patch per review comments. > Next round of x87 long double stuff. > Getting close now, basically works. > Nice, thanks Dale! -Chris From sabre at nondot.org Wed Sep 12 12:53:12 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 12 Sep 2007 17:53:12 -0000 Subject: [llvm-commits] [llvm] r41879 - in /llvm/trunk: docs/GarbageCollection.html lib/Transforms/Scalar/LowerGC.cpp Message-ID: <200709121753.l8CHrD19030366@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 12 12:53:10 2007 New Revision: 41879 URL: http://llvm.org/viewvc/llvm-project?rev=41879&view=rev Log: Change llvm.gcroot to not init the root to null at runtime, this prevents using it for live-in values etc. Modified: llvm/trunk/docs/GarbageCollection.html llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp Modified: llvm/trunk/docs/GarbageCollection.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GarbageCollection.html?rev=41879&r1=41878&r2=41879&view=diff ============================================================================== --- llvm/trunk/docs/GarbageCollection.html (original) +++ llvm/trunk/docs/GarbageCollection.html Wed Sep 12 12:53:10 2007 @@ -166,9 +166,7 @@ The llvm.gcroot intrinsic is used to inform LLVM of a pointer variable on the stack. The first argument contains the address of the variable on the stack, and the second contains a pointer to metadata that should be associated -with the pointer (which must be a constant or global value address). At -runtime, the llvm.gcroot intrinsic stores a null pointer into the -specified location to initialize the pointer.

    +with the pointer (which must be a constant or global value address).

    Consider the following fragment of Java code: @@ -193,6 +191,9 @@ %X = alloca %Object* ... + ;; Java null-initializes pointers. + store %Object* null, %Object** %X + ;; "CodeBlock" is the block corresponding to the start ;; of the scope above. CodeBlock: Modified: llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp?rev=41879&r1=41878&r2=41879&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp Wed Sep 12 12:53:10 2007 @@ -284,10 +284,7 @@ new StoreInst(Null, RootPtrPtr, IP); // Each occurrance of the llvm.gcroot intrinsic now turns into an - // initialization of the slot with the address and a zeroing out of the - // address specified. - new StoreInst(Constant::getNullValue(PtrLocTy->getElementType()), - GCRoots[i]->getOperand(1), GCRoots[i]); + // initialization of the slot with the address. new StoreInst(GCRoots[i]->getOperand(1), RootPtrPtr, GCRoots[i]); } From ghenriksen at carbonite.com Wed Sep 12 13:14:51 2007 From: ghenriksen at carbonite.com (Gordon Henriksen) Date: Wed, 12 Sep 2007 14:14:51 -0400 Subject: [llvm-commits] [llvm] r41879 - in /llvm/trunk: docs/GarbageCollection.html lib/Transforms/Scalar/LowerGC.cpp In-Reply-To: <200709121753.l8CHrD19030366@zion.cs.uiuc.edu> References: <200709121753.l8CHrD19030366@zion.cs.uiuc.edu> Message-ID: Hm. Are you sure this is wise? I realize my patch didn't provide root initialization, but I have that fixed locally. Without liveness analysis, leaving stack roots uninitialized seems unwise, since gc points are not entirely predictable from the IR. On 2007-09-12, at 13:53, Chris Lattner wrote: > Author: lattner > Date: Wed Sep 12 12:53:10 2007 > New Revision: 41879 > > URL: http://llvm.org/viewvc/llvm-project?rev=41879&view=rev > Log: > Change llvm.gcroot to not init the root to null at runtime, this > prevents > using it for live-in values etc. > > Modified: > llvm/trunk/docs/GarbageCollection.html > llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp > > Modified: llvm/trunk/docs/GarbageCollection.html > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ > GarbageCollection.html?rev=41879&r1=41878&r2=41879&view=diff > > ====================================================================== > ======== > --- llvm/trunk/docs/GarbageCollection.html (original) > +++ llvm/trunk/docs/GarbageCollection.html Wed Sep 12 12:53:10 2007 > @@ -166,9 +166,7 @@ > The llvm.gcroot intrinsic is used to inform LLVM of a > pointer variable > on the stack. The first argument contains the address of the > variable on the > stack, and the second contains a pointer to metadata that should > be associated > -with the pointer (which must be a constant or global value > address). At > -runtime, the llvm.gcroot intrinsic stores a null pointer > into the > -specified location to initialize the pointer.

    > +with the pointer (which must be a constant or global value > address).

    > >

    > Consider the following fragment of Java code: > @@ -193,6 +191,9 @@ > %X = alloca %Object* > ... > > + ;; Java null-initializes pointers. > + store %Object* null, %Object** %X > + > ;; "CodeBlock" is the block corresponding to the start > ;; of the scope above. > CodeBlock: > > Modified: llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ > Scalar/LowerGC.cpp?rev=41879&r1=41878&r2=41879&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp Wed Sep 12 > 12:53:10 2007 > @@ -284,10 +284,7 @@ > new StoreInst(Null, RootPtrPtr, IP); > > // Each occurrance of the llvm.gcroot intrinsic now turns into an > - // initialization of the slot with the address and a zeroing > out of the > - // address specified. > - new StoreInst(Constant::getNullValue(PtrLocTy->getElementType()), > - GCRoots[i]->getOperand(1), GCRoots[i]); > + // initialization of the slot with the address. > new StoreInst(GCRoots[i]->getOperand(1), RootPtrPtr, GCRoots[i]); > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070912/9f105f69/attachment.html From sabre at nondot.org Wed Sep 12 13:24:00 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 12 Sep 2007 18:24:00 -0000 Subject: [llvm-commits] [llvm] r41881 - in /llvm/trunk/examples: BrainF/ BrainF/BrainF.cpp BrainF/BrainF.h BrainF/BrainFDriver.cpp BrainF/Makefile Makefile Message-ID: <200709121824.l8CIO1uH031823@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 12 13:24:00 2007 New Revision: 41881 URL: http://llvm.org/viewvc/llvm-project?rev=41881&view=rev Log: add a new BF->LLVM translator, contributed by Sterling Stein. Added: llvm/trunk/examples/BrainF/ llvm/trunk/examples/BrainF/BrainF.cpp llvm/trunk/examples/BrainF/BrainF.h llvm/trunk/examples/BrainF/BrainFDriver.cpp llvm/trunk/examples/BrainF/Makefile Modified: llvm/trunk/examples/Makefile Added: llvm/trunk/examples/BrainF/BrainF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=41881&view=auto ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.cpp (added) +++ llvm/trunk/examples/BrainF/BrainF.cpp Wed Sep 12 13:24:00 2007 @@ -0,0 +1,458 @@ +//===-- BrainF.cpp - BrainF compiler example ----------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Sterling Stein and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===--------------------------------------------------------------------===// +// +// This class compiles the BrainF language into LLVM assembly. +// +// The BrainF language has 8 commands: +// Command Equivalent C Action +// ------- ------------ ------ +// , *h=getchar(); Read a character from stdin, 255 on EOF +// . putchar(*h); Write a character to stdout +// - --*h; Decrement tape +// + ++*h; Increment tape +// < --h; Move head left +// > ++h; Move head right +// [ while(*h) { Start loop +// ] } End loop +// +//===--------------------------------------------------------------------===// + +#include "BrainF.h" +#include "llvm/Constants.h" +#include "llvm/ADT/STLExtras.h" + +using namespace llvm; + +//Set the constants for naming +const char *BrainF::tapereg = "tape"; +const char *BrainF::headreg = "head"; +const char *BrainF::label = "brainf"; +const char *BrainF::testreg = "test"; + +Module *BrainF::parse(std::istream *in1, int mem, CompileFlags cf) { + in = in1; + memtotal = mem; + comflag = cf; + + header(); + readloop(0, 0, 0); + delete builder; + return module; +} + +void BrainF::header() { + module = new Module("BrainF"); + + //Function prototypes + + //declare void @llvm.memset.i32(i8 *, i8, i32, i32) + Function *memset_func = cast(module-> + getOrInsertFunction("llvm.memset.i32", Type::VoidTy, + PointerType::get(IntegerType::Int8Ty), + IntegerType::Int8Ty, IntegerType::Int32Ty, + IntegerType::Int32Ty, NULL)); + + //declare i32 @getchar() + getchar_func = cast(module-> + getOrInsertFunction("getchar", IntegerType::Int32Ty, NULL)); + + //declare i32 @putchar(i32) + putchar_func = cast(module-> + getOrInsertFunction("putchar", IntegerType::Int32Ty, + IntegerType::Int32Ty, NULL)); + + + //Function header + + //define void @brainf() + brainf_func = cast(module-> + getOrInsertFunction("brainf", Type::VoidTy, NULL)); + + builder = new LLVMBuilder(new BasicBlock(label, brainf_func)); + + //%arr = malloc i8, i32 %d + ConstantInt *val_mem = ConstantInt::get(APInt(32, memtotal)); + ptr_arr = builder->CreateMalloc(IntegerType::Int8Ty, val_mem, "arr"); + + //call void @llvm.memset.i32(i8 *%arr, i8 0, i32 %d, i32 1) + { + Value *memset_params[] = { + ptr_arr, + ConstantInt::get(APInt(8, 0)), + val_mem, + ConstantInt::get(APInt(32, 1)) + }; + + CallInst *memset_call = builder-> + CreateCall(memset_func, memset_params, array_endof(memset_params)); + memset_call->setTailCall(false); + } + + //%arrmax = getelementptr i8 *%arr, i32 %d + if (comflag & flag_arraybounds) { + ptr_arrmax = builder-> + CreateGEP(ptr_arr, ConstantInt::get(APInt(32, memtotal)), "arrmax"); + } + + //%head.%d = getelementptr i8 *%arr, i32 %d + curhead = builder->CreateGEP(ptr_arr, + ConstantInt::get(APInt(32, memtotal/2)), + headreg); + + + + //Function footer + + //brainf.end: + endbb = new BasicBlock(label, brainf_func); + + //free i8 *%arr + new FreeInst(ptr_arr, endbb); + + //ret void + new ReturnInst(endbb); + + + + //Error block for array out of bounds + if (comflag & flag_arraybounds) + { + //@aberrormsg = internal constant [%d x i8] c"\00" + Constant *msg_0 = ConstantArray:: + get("Error: The head has left the tape.", true); + + GlobalVariable *aberrormsg = new GlobalVariable( + msg_0->getType(), + true, + GlobalValue::InternalLinkage, + msg_0, + "aberrormsg", + module); + + //declare i32 @puts(i8 *) + Function *puts_func = cast(module-> + getOrInsertFunction("puts", IntegerType::Int32Ty, + PointerType::get(IntegerType::Int8Ty), NULL)); + + //brainf.aberror: + aberrorbb = new BasicBlock(label, brainf_func); + + //call i32 @puts(i8 *getelementptr([%d x i8] *@aberrormsg, i32 0, i32 0)) + { + Constant *zero_32 = Constant::getNullValue(IntegerType::Int32Ty); + + Constant *gep_params[] = { + zero_32, + zero_32 + }; + + Constant *msgptr = ConstantExpr:: + getGetElementPtr(aberrormsg, gep_params, + array_lengthof(gep_params)); + + Value *puts_params[] = { + msgptr + }; + + CallInst *puts_call = + new CallInst(puts_func, + puts_params, array_endof(puts_params), + "", aberrorbb); + puts_call->setTailCall(false); + } + + //br label %brainf.end + new BranchInst(endbb, aberrorbb); + } +} + +void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb) { + Symbol cursym = SYM_NONE; + int curvalue = 0; + Symbol nextsym = SYM_NONE; + int nextvalue = 0; + char c; + int loop; + int direction; + + while(cursym != SYM_EOF && cursym != SYM_ENDLOOP) { + // Write out commands + switch(cursym) { + case SYM_NONE: + // Do nothing + break; + + case SYM_READ: + { + //%tape.%d = call i32 @getchar() + CallInst *getchar_call = builder->CreateCall(getchar_func, tapereg); + getchar_call->setTailCall(false); + Value *tape_0 = getchar_call; + + //%tape.%d = trunc i32 %tape.%d to i8 + TruncInst *tape_1 = builder-> + CreateTrunc(tape_0, IntegerType::Int8Ty, tapereg); + + //store i8 %tape.%d, i8 *%head.%d + builder->CreateStore(tape_1, curhead); + } + break; + + case SYM_WRITE: + { + //%tape.%d = load i8 *%head.%d + LoadInst *tape_0 = builder->CreateLoad(curhead, tapereg); + + //%tape.%d = sext i8 %tape.%d to i32 + SExtInst *tape_1 = builder-> + CreateSExt(tape_0, IntegerType::Int32Ty, tapereg); + + //call i32 @putchar(i32 %tape.%d) + Value *putchar_params[] = { + tape_1 + }; + CallInst *putchar_call = builder-> + CreateCall(putchar_func, + putchar_params, array_endof(putchar_params)); + putchar_call->setTailCall(false); + } + break; + + case SYM_MOVE: + { + //%head.%d = getelementptr i8 *%head.%d, i32 %d + curhead = builder-> + CreateGEP(curhead, ConstantInt::get(APInt(32, curvalue)), + headreg); + + //Error block for array out of bounds + if (comflag & flag_arraybounds) + { + //%test.%d = icmp uge i8 *%head.%d, %arrmax + ICmpInst *test_0 = builder-> + CreateICmpUGE(curhead, ptr_arrmax, testreg); + + //%test.%d = icmp ult i8 *%head.%d, %arr + ICmpInst *test_1 = builder-> + CreateICmpULT(curhead, ptr_arr, testreg); + + //%test.%d = or i1 %test.%d, %test.%d + BinaryOperator *test_2 = builder-> + CreateOr(test_0, test_1, testreg); + + //br i1 %test.%d, label %main.%d, label %main.%d + BasicBlock *nextbb = new BasicBlock(label, brainf_func); + builder->CreateCondBr(test_2, aberrorbb, nextbb); + + //main.%d: + builder->SetInsertPoint(nextbb); + } + } + break; + + case SYM_CHANGE: + { + //%tape.%d = load i8 *%head.%d + LoadInst *tape_0 = builder->CreateLoad(curhead, tapereg); + + //%tape.%d = add i8 %tape.%d, %d + BinaryOperator *tape_1 = builder-> + CreateAdd(tape_0, ConstantInt::get(APInt(8, curvalue)), tapereg); + + //store i8 %tape.%d, i8 *%head.%d\n" + builder->CreateStore(tape_1, curhead); + } + break; + + case SYM_LOOP: + { + //br label %main.%d + BasicBlock *testbb = new BasicBlock(label, brainf_func); + builder->CreateBr(testbb); + + //main.%d: + BasicBlock *bb_0 = builder->GetInsertBlock(); + BasicBlock *bb_1 = new BasicBlock(label, brainf_func); + builder->SetInsertPoint(bb_1); + + //Make part of PHI instruction now, wait until end of loop to finish + PHINode *phi_0 = new PHINode(PointerType::get(IntegerType::Int8Ty), + headreg, testbb); + phi_0->reserveOperandSpace(2); + phi_0->addIncoming(curhead, bb_0); + curhead = phi_0; + + readloop(phi_0, bb_1, testbb); + } + break; + + default: + cerr<<"Error: Unknown symbol.\n"; + abort(); + break; + } + + cursym = nextsym; + curvalue = nextvalue; + nextsym = SYM_NONE; + + // Reading stdin loop + loop = (cursym == SYM_NONE) + || (cursym == SYM_MOVE) + || (cursym == SYM_CHANGE); + while(loop) { + *in>>c; + if (in->eof()) { + if (cursym == SYM_NONE) { + cursym = SYM_EOF; + } else { + nextsym = SYM_EOF; + } + loop = 0; + } else { + direction = 1; + switch(c) { + case '-': + direction = -1; + // Fall through + + case '+': + if (cursym == SYM_CHANGE) { + curvalue += direction; + // loop = 1 + } else { + if (cursym == SYM_NONE) { + cursym = SYM_CHANGE; + curvalue = direction; + // loop = 1 + } else { + nextsym = SYM_CHANGE; + nextvalue = direction; + loop = 0; + } + } + break; + + case '<': + direction = -1; + // Fall through + + case '>': + if (cursym == SYM_MOVE) { + curvalue += direction; + // loop = 1 + } else { + if (cursym == SYM_NONE) { + cursym = SYM_MOVE; + curvalue = direction; + // loop = 1 + } else { + nextsym = SYM_MOVE; + nextvalue = direction; + loop = 0; + } + } + break; + + case ',': + if (cursym == SYM_NONE) { + cursym = SYM_READ; + } else { + nextsym = SYM_READ; + } + loop = 0; + break; + + case '.': + if (cursym == SYM_NONE) { + cursym = SYM_WRITE; + } else { + nextsym = SYM_WRITE; + } + loop = 0; + break; + + case '[': + if (cursym == SYM_NONE) { + cursym = SYM_LOOP; + } else { + nextsym = SYM_LOOP; + } + loop = 0; + break; + + case ']': + if (cursym == SYM_NONE) { + cursym = SYM_ENDLOOP; + } else { + nextsym = SYM_ENDLOOP; + } + loop = 0; + break; + + // Ignore other characters + default: + break; + } + } + } + } + + if (cursym == SYM_ENDLOOP) { + if (!phi) { + cerr<<"Error: Extra ']'\n"; + abort(); + } + + // Write loop test + { + //br label %main.%d + builder->CreateBr(testbb); + + //main.%d: + + //%head.%d = phi i8 *[%head.%d, %main.%d], [%head.%d, %main.%d] + //Finish phi made at beginning of loop + phi->addIncoming(curhead, builder->GetInsertBlock()); + Value *head_0 = phi; + + //%tape.%d = load i8 *%head.%d + LoadInst *tape_0 = new LoadInst(head_0, tapereg, testbb); + + //%test.%d = icmp eq i8 %tape.%d, 0 + ICmpInst *test_0 = new ICmpInst(ICmpInst::ICMP_EQ, tape_0, + ConstantInt::get(APInt(8, 0)), testreg, + testbb); + + //br i1 %test.%d, label %main.%d, label %main.%d + BasicBlock *bb_0 = new BasicBlock(label, brainf_func); + new BranchInst(bb_0, oldbb, test_0, testbb); + + //main.%d: + builder->SetInsertPoint(bb_0); + + //%head.%d = phi i8 *[%head.%d, %main.%d] + PHINode *phi_1 = builder-> + CreatePHI(PointerType::get(IntegerType::Int8Ty), headreg); + phi_1->reserveOperandSpace(1); + phi_1->addIncoming(head_0, testbb); + curhead = phi_1; + } + + return; + } + + //End of the program, so go to return block + builder->CreateBr(endbb); + + if (phi) { + cerr<<"Error: Missing ']'\n"; + abort(); + } +} Added: llvm/trunk/examples/BrainF/BrainF.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.h?rev=41881&view=auto ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.h (added) +++ llvm/trunk/examples/BrainF/BrainF.h Wed Sep 12 13:24:00 2007 @@ -0,0 +1,91 @@ +//===-- BrainF.h - BrainF compiler class ----------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Sterling Stein and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===--------------------------------------------------------------------===// +// +// This class stores the data for the BrainF compiler so it doesn't have +// to pass all of it around. The main method is parse. +// +//===--------------------------------------------------------------------===// + +#ifndef BRAINF_H +#define BRAINF_H + +#include "llvm/Module.h" +#include "llvm/Support/LLVMBuilder.h" + +using namespace llvm; + +/// This class provides a parser for the BrainF language. +/// The class itself is made to store values during +/// parsing so they don't have to be passed around +/// as much. +class BrainF { + public: + /// Options for how BrainF should compile + enum CompileFlags { + flag_off = 0, + flag_arraybounds = 1 + }; + + /// This is the main method. It parses BrainF from in1 + /// and returns the module with a function + /// void brainf() + /// containing the resulting code. + /// On error, it calls abort. + /// The caller must delete the returned module. + Module *parse(std::istream *in1, int mem, CompileFlags cf); + + protected: + /// The different symbols in the BrainF language + enum Symbol { + SYM_NONE, + SYM_READ, + SYM_WRITE, + SYM_MOVE, + SYM_CHANGE, + SYM_LOOP, + SYM_ENDLOOP, + SYM_EOF + }; + + /// Names of the different parts of the language. + /// Tape is used for reading and writing the tape. + /// headreg is used for the position of the head. + /// label is used for the labels for the BasicBlocks. + /// testreg is used for testing the loop exit condition. + static const char *tapereg; + static const char *headreg; + static const char *label; + static const char *testreg; + + /// Put the brainf function preamble and other fixed pieces of code + void header(); + + /// The main loop for parsing. It calls itself recursively + /// to handle the depth of nesting of "[]". + void readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb); + + /// Constants during parsing + int memtotal; + CompileFlags comflag; + std::istream *in; + Module *module; + Function *brainf_func; + Function *getchar_func; + Function *putchar_func; + Value *ptr_arr; + Value *ptr_arrmax; + BasicBlock *endbb; + BasicBlock *aberrorbb; + + /// Variables + LLVMBuilder *builder; + Value *curhead; +}; + +#endif Added: llvm/trunk/examples/BrainF/BrainFDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainFDriver.cpp?rev=41881&view=auto ============================================================================== --- llvm/trunk/examples/BrainF/BrainFDriver.cpp (added) +++ llvm/trunk/examples/BrainF/BrainFDriver.cpp Wed Sep 12 13:24:00 2007 @@ -0,0 +1,156 @@ +//===-- BrainFDriver.cpp - BrainF compiler driver -----------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Sterling Stein and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===--------------------------------------------------------------------===// +// +// This program converts the BrainF language into LLVM assembly, +// which it can then run using the JIT or output as BitCode. +// +// This implementation has a tape of 65536 bytes, +// with the head starting in the middle. +// Range checking is off by default, so be careful. +// It can be enabled with -abc. +// +// Use: +// ./BrainF -jit prog.bf #Run program now +// ./BrainF -jit -abc prog.bf #Run program now safely +// ./BrainF prog.bf #Write as BitCode +// +// lli prog.bf.bc #Run generated BitCode +// llvm-ld -native -o=prog prog.bf.bc #Compile BitCode into native executable +// +//===--------------------------------------------------------------------===// + +#include "BrainF.h" +#include "llvm/Constants.h" +#include "llvm/ModuleProvider.h" +#include "llvm/Analysis/Verifier.h" +#include "llvm/Bitcode/ReaderWriter.h" +#include "llvm/ExecutionEngine/GenericValue.h" +#include "llvm/ExecutionEngine/JIT.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/ManagedStatic.h" +#include +#include + +using namespace llvm; + +//Command line options + +static cl::opt +InputFilename(cl::Positional, cl::desc("")); + +static cl::opt +OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename")); + +static cl::opt +ArrayBoundsChecking("abc", cl::desc("Enable array bounds checking")); + +static cl::opt +JIT("jit", cl::desc("Run program Just-In-Time")); + + +//Add main function so can be fully compiled +void addMainFunction(Module *mod) { + //define i32 @main(i32 %argc, i8 **%argv) + Function *main_func = cast(mod-> + getOrInsertFunction("main", IntegerType::Int32Ty, IntegerType::Int32Ty, + PointerType::get(PointerType::get( + IntegerType::Int8Ty)), NULL)); + { + Function::arg_iterator args = main_func->arg_begin(); + Value *arg_0 = args++; + arg_0->setName("argc"); + Value *arg_1 = args++; + arg_1->setName("argv"); + } + + //main.0: + BasicBlock *bb = new BasicBlock("main.0", main_func); + + //call void @brainf() + { + CallInst *brainf_call = new CallInst(mod->getFunction("brainf"), + "", bb); + brainf_call->setTailCall(false); + } + + //ret i32 0 + new ReturnInst(ConstantInt::get(APInt(32, 0)), bb); +} + +int main(int argc, char **argv) { + cl::ParseCommandLineOptions(argc, argv, " BrainF compiler\n"); + + if (InputFilename == "") { + cerr<<"Error: You must specify the filename of the program to " + "be compiled. Use --help to see the options.\n"; + abort(); + } + + //Get the output stream + std::ostream *out = &std::cout; + if (!JIT) { + if (OutputFilename == "") { + std::string base = InputFilename; + if (InputFilename == "-") {base = "a";} + + //Use default filename + const char *suffix = ".bc"; + OutputFilename = base+suffix; + } + if (OutputFilename != "-") { + out = new std:: + ofstream(OutputFilename.c_str(), + std::ios::out | std::ios::trunc | std::ios::binary); + } + } + + //Get the input stream + std::istream *in = &std::cin; + if (InputFilename != "-") { + in = new std::ifstream(InputFilename.c_str()); + } + + //Gather the compile flags + BrainF::CompileFlags cf = BrainF::flag_off; + if (ArrayBoundsChecking) { + cf = BrainF::CompileFlags(cf | BrainF::flag_arraybounds); + } + + //Read the BrainF program + BrainF bf; + Module *mod = bf.parse(in, 65536, cf); //64 KiB + if (in != &std::cin) {delete in;} + addMainFunction(mod); + + //Verify generated code + if (verifyModule(*mod)) { + cerr<<"Error: module failed verification. This shouldn't happen.\n"; + abort(); + } + + //Write it out + if (JIT) { + cout<<"------- Running JIT -------\n"; + ExistingModuleProvider *mp = new ExistingModuleProvider(mod); + ExecutionEngine *ee = ExecutionEngine::create(mp, false); + std::vector args; + Function *brainf_func = mod->getFunction("brainf"); + GenericValue gv = ee->runFunction(brainf_func, args); + } else { + WriteBitcodeToFile(mod, *out); + } + + //Clean up + if (out != &std::cout) {delete out;} + delete mod; + + llvm_shutdown(); + + return 0; +} Added: llvm/trunk/examples/BrainF/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/Makefile?rev=41881&view=auto ============================================================================== --- llvm/trunk/examples/BrainF/Makefile (added) +++ llvm/trunk/examples/BrainF/Makefile Wed Sep 12 13:24:00 2007 @@ -0,0 +1,15 @@ +##===- examples/BrainF/Makefile ----------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file was developed by Sterling Stein and is distributed under +# the University of Illinois Open Source License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +LEVEL = ../.. +TOOLNAME = BrainF +EXAMPLE_TOOL = 1 + +LINK_COMPONENTS := jit bitwriter native interpreter + +include $(LEVEL)/Makefile.common Modified: llvm/trunk/examples/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/Makefile?rev=41881&r1=41880&r2=41881&view=diff ============================================================================== --- llvm/trunk/examples/Makefile (original) +++ llvm/trunk/examples/Makefile Wed Sep 12 13:24:00 2007 @@ -10,7 +10,7 @@ include $(LEVEL)/Makefile.config -PARALLEL_DIRS:= Fibonacci HowToUseJIT ModuleMaker +PARALLEL_DIRS:= BrainF Fibonacci HowToUseJIT ModuleMaker ifeq ($(HAVE_PTHREAD),1) PARALLEL_DIRS += ParallelJIT From clattner at apple.com Wed Sep 12 13:24:31 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Sep 2007 11:24:31 -0700 Subject: [llvm-commits] BrainF compiler In-Reply-To: <46E755C2.50502@ir.iit.edu> References: <46E032E3.2030401@ir.iit.edu> <4D473BAF-D716-4DAA-B60A-76121345D347@apple.com> <46E755C2.50502@ir.iit.edu> Message-ID: <1643FF0A-9A2F-406B-892A-A46B6D399514@apple.com> On Sep 11, 2007, at 7:58 PM, S3 wrote: > > I have made the requested changes. > It is now split into separate files. > The code should be clean now. > >> This is a new BrainF compiler to replace the old one. >> It uses the C++ API so it will generate code in the >> proper format. It consolidates similar commands >> (blocks of ('+' and '-') and ('<' and '>')). >> It has an option for array bounds checking. Committed, thanks! -Chris From clattner at apple.com Wed Sep 12 13:26:53 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Sep 2007 11:26:53 -0700 Subject: [llvm-commits] [llvm] r41879 - in /llvm/trunk: docs/GarbageCollection.html lib/Transforms/Scalar/LowerGC.cpp In-Reply-To: References: <200709121753.l8CHrD19030366@zion.cs.uiuc.edu> Message-ID: On Sep 12, 2007, at 11:14 AM, Gordon Henriksen wrote: > Hm. Are you sure this is wise? I realize my patch didn't provide > root initialization, but I have that fixed locally. Without > liveness analysis, leaving stack roots uninitialized seems unwise, > since gc points are not entirely predictable from the IR. I think it is fine. trivially, any front-end that produced a call to the gcroot intrinsic could emit that intrinsic and a store of null, so there is no power lost here. The reason it is useful is for things like this (C syntax): void foo(object *P) { gcroot(&P, 0); ... use P ... } when converted to LLVM, this turns into the equivalent of: void foo(object *P) { P_addr = alloca object* store P -> P_addr gcroot(P_addr, 0); ... use *P_addr... } With the null'ing property of gcroot, it would clobber the live in value. -Chris From clattner at apple.com Wed Sep 12 13:48:06 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Sep 2007 11:48:06 -0700 Subject: [llvm-commits] Garbage collection patch series In-Reply-To: <13858288-5288-498B-A3A0-2E464219BD3A@mac.com> References: <13858288-5288-498B-A3A0-2E464219BD3A@mac.com> Message-ID: Hi Gordon, FYI, I haven't forgotten about this patch set. However, on the verge of LLVM 2.1, I think it's best to wait until the beginning of the next release cycle. I will try to dive into these in the next week or two. -Chris On Sep 3, 2007, at 11:18 PM, Gordon Henriksen wrote: > As followups to this post, I will post a series of six patches > which significantly improve LLVM's garbage collection support. > These patches are not all fully independent, but I have broken them > up into more digestible units for review. > > ? gc-1-registry.patch (+288 lines) > My previous Registry.h header, as well as Collectors.h, which is > the registry for dynamically-loaded garbage collectors. > > ? gc-2-metadata.patch (+303 lines) > CollectorMetadata is the data structure populated by back-ends > during code-generation. > > ? gc-3-collector.patch (+401 lines) > Collector is the base class for garbage collector code generators. > It provides its subclasses with both static configuration and > callbacks through which they can exert its will upon all relevant > stages of code generation. > > ? gc-4-integration.patch (+113, -17 lines) > In this patch, Collector winds its tendrils throughout the > compiler. Overhead should be minimal when disabled. > > ? gc-5-shadowstack.patch (+59, -406 lines) > With this patch, the LowerGC transformation is adapted to become > the ShadowStackCollector. > > ? gc-6-ocaml.patch (+190 lines) > Finally, the new OcamlCollector emits the Ocaml frametable data > structure and related symbols. > > Hopefully I can get feedback so that this can be rolled into 2.2 > early in the development cycle. > > ? Gordon > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Wed Sep 12 13:55:14 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 12 Sep 2007 18:55:14 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41882 - in /llvm-gcc-4.0/trunk/gcc: config/darwin.h llvm-backend.cpp varasm.c Message-ID: <200709121855.l8CItFuU000417@zion.cs.uiuc.edu> Author: void Date: Wed Sep 12 13:55:13 2007 New Revision: 41882 URL: http://llvm.org/viewvc/llvm-project?rev=41882&view=rev Log: Alias definitions aren't supported on some platforms. Create a flag (TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS) that indicates this and stops us from creating aliases. Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp llvm-gcc-4.0/trunk/gcc/varasm.c Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/darwin.h?rev=41882&r1=41881&r2=41882&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.0/trunk/gcc/config/darwin.h Wed Sep 12 13:55:13 2007 @@ -674,6 +674,9 @@ } while (0) /* APPLE LOCAL begin LLVM */ +/* As in the warning above, alias definitions aren't supported on Mach-O. */ +#define TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS + /* weak_import, a Darwin special, does not make function definitions weak. */ #define TARGET_ADJUST_LLVM_LINKAGE(FN, DECL) \ do { \ Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp?rev=41882&r1=41881&r2=41882&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Wed Sep 12 13:55:13 2007 @@ -677,7 +677,7 @@ else if (Function *F = dyn_cast(V)) F->eraseFromParent(); else - assert(0 && "Unsuported global value"); + assert(0 && "Unsupported global value"); TREE_ASM_WRITTEN(decl) = 1; Modified: llvm-gcc-4.0/trunk/gcc/varasm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/varasm.c?rev=41882&r1=41881&r2=41882&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/varasm.c (original) +++ llvm-gcc-4.0/trunk/gcc/varasm.c Wed Sep 12 13:55:13 2007 @@ -4762,7 +4762,12 @@ { tree target_decl; target_decl = find_decl_and_mark_needed (p->decl, p->target); +#ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS + if (target_decl) + warning ("%Jalias definitions not supported; ignored", target_decl); +#else emit_alias_to_llvm(p->decl, p->target, target_decl); +#endif } #else do_assemble_alias (p->decl, p->target); @@ -4819,11 +4824,19 @@ alias. This saves a tad o memory. */ target_decl = find_decl_and_mark_needed (decl, target); if (target_decl && TREE_ASM_WRITTEN (target_decl)) + /* APPLE LOCAL begin LLVM */ + { #ifdef ENABLE_LLVM - emit_alias_to_llvm(decl, target, target_decl); +#ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS + warning ("%Jalias definitions not supported; ignored", target_decl); #else - do_assemble_alias (decl, target); + emit_alias_to_llvm(decl, target, target_decl); #endif +#else + do_assemble_alias (decl, target); +#endif + } + /* APPLE LOCAL end LLVM */ else { alias_pair p; From isanbard at gmail.com Wed Sep 12 14:00:04 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 12 Sep 2007 19:00:04 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41883 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.h varasm.c Message-ID: <200709121900.l8CJ0D39000562@zion.cs.uiuc.edu> Author: void Date: Wed Sep 12 13:59:44 2007 New Revision: 41883 URL: http://llvm.org/viewvc/llvm-project?rev=41883&view=rev Log: Port of r41882: Alias definitions aren't supported on some platforms. Create a flag (TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS) that indicates this and stops us from creating aliases. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h llvm-gcc-4.2/trunk/gcc/varasm.c Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=41883&r1=41882&r2=41883&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Wed Sep 12 13:59:44 2007 @@ -583,6 +583,9 @@ } while (0) /* LLVM LOCAL begin */ +/* As in the warning above, alias definitions aren't supported on Mach-O. */ +#define TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS + /* weak_import, a Darwin special, does not make function definitions weak. */ #define TARGET_ADJUST_LLVM_LINKAGE(FN, DECL) \ do { \ Modified: llvm-gcc-4.2/trunk/gcc/varasm.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/varasm.c?rev=41883&r1=41882&r2=41883&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/varasm.c (original) +++ llvm-gcc-4.2/trunk/gcc/varasm.c Wed Sep 12 13:59:44 2007 @@ -5177,7 +5177,12 @@ } target_decl = find_decl_and_mark_needed (p->decl, p->target); +#ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS + if (target_decl) + warning ("%Jalias definitions not supported; ignored", target_decl); +#else emit_alias_to_llvm(p->decl, p->target, target_decl); +#endif } #else do_assemble_alias (p->decl, p->target); @@ -5260,7 +5265,11 @@ target_decl = find_decl_and_mark_needed (decl, target); if (target_decl && TREE_ASM_WRITTEN (target_decl)) #ifdef ENABLE_LLVM - emit_alias_to_llvm(decl, target, target_decl); +#ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS + warning ("%Jalias definitions not supported; ignored", target_decl); +#else + emit_alias_to_llvm(decl, target, target_decl); +#endif #else do_assemble_alias (decl, target); #endif From ghenriksen at carbonite.com Wed Sep 12 14:54:59 2007 From: ghenriksen at carbonite.com (Gordon Henriksen) Date: Wed, 12 Sep 2007 15:54:59 -0400 Subject: [llvm-commits] Garbage collection patch series In-Reply-To: References: <13858288-5288-498B-A3A0-2E464219BD3A@mac.com> Message-ID: <7AD8F11F-47BA-4849-84FC-47BAAB6196D1@carbonite.com> Of course. I didn't expect these changes to hit SVN until early October. On 2007-09-12, at 14:48, Chris Lattner wrote: > Hi Gordon, > > FYI, I haven't forgotten about this patch set. However, on the verge > of LLVM 2.1, I think it's best to wait until the beginning of the > next release cycle. I will try to dive into these in the next week > or two. > > -Chris > > On Sep 3, 2007, at 11:18 PM, Gordon Henriksen wrote: > >> As followups to this post, I will post a series of six patches >> which significantly improve LLVM's garbage collection support. >> These patches are not all fully independent, but I have broken them >> up into more digestible units for review. >> >> ? gc-1-registry.patch (+288 lines) >> My previous Registry.h header, as well as Collectors.h, which is >> the registry for dynamically-loaded garbage collectors. >> >> ? gc-2-metadata.patch (+303 lines) >> CollectorMetadata is the data structure populated by back-ends >> during code-generation. >> >> ? gc-3-collector.patch (+401 lines) >> Collector is the base class for garbage collector code generators. >> It provides its subclasses with both static configuration and >> callbacks through which they can exert its will upon all relevant >> stages of code generation. >> >> ? gc-4-integration.patch (+113, -17 lines) >> In this patch, Collector winds its tendrils throughout the >> compiler. Overhead should be minimal when disabled. >> >> ? gc-5-shadowstack.patch (+59, -406 lines) >> With this patch, the LowerGC transformation is adapted to become >> the ShadowStackCollector. >> >> ? gc-6-ocaml.patch (+190 lines) >> Finally, the new OcamlCollector emits the Ocaml frametable data >> structure and related symbols. >> >> Hopefully I can get feedback so that this can be rolled into 2.2 >> early in the development cycle. >> >> ? Gordon >> >> _______________________________________________ >> 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 ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070912/9147e57d/attachment.html From ghenriksen at carbonite.com Wed Sep 12 15:14:04 2007 From: ghenriksen at carbonite.com (Gordon Henriksen) Date: Wed, 12 Sep 2007 16:14:04 -0400 Subject: [llvm-commits] [llvm] r41879 - in /llvm/trunk: docs/GarbageCollection.html lib/Transforms/Scalar/LowerGC.cpp In-Reply-To: References: <200709121753.l8CHrD19030366@zion.cs.uiuc.edu> Message-ID: <5F65BAA7-FDE6-40D4-A760-CEE24BB20BB0@carbonite.com> On 2007-09-12, at 14:26, Chris Lattner wrote: > On Sep 12, 2007, at 11:14 AM, Gordon Henriksen wrote: > >> Hm. Are you sure this is wise? I realize my patch didn't provide >> root initialization, but I have that fixed locally. Without >> liveness analysis, leaving stack roots uninitialized seems unwise, >> since gc points are not entirely predictable from the IR. > > I think it is fine. trivially, any front-end that produced a call > to the gcroot intrinsic could emit that intrinsic and a store of > null, so there is no power lost here. > > The reason it is useful is for things like this (C syntax): > > void foo(object *P) { > gcroot(&P, 0); > > ... use P ... > } > > when converted to LLVM, this turns into the equivalent of: > > void foo(object *P) { > P_addr = alloca object* > store P -> P_addr > gcroot(P_addr, 0); > > ... use *P_addr... > } > > With the null'ing property of gcroot, it would clobber the live in > value. Well, this would also fix that: P_addr = alloca object* - store P -> P_addr gcroot(P_addr, 0); + store P -> P_addr But I'd be more concerned about more complex codes: void f(object[] ar) { g(); foreach (object o : ar) h(o); } becomes void @f({ i32, [0 x %object*] }* %ar) { entry: %ar_addr = alloca { i32, [0 x %object*] }* @llvm.gcroot(%ar_addr, 0) store %ar -> %ar_addr %o_addr = alloca %object* @llvm.gcroot(%o_addr, 0) store null -> %o_addr ; **** @g() tmp.0 = load %ar_addr tmp.1 = gep %tmp.0, 0, 0 index.0 = load tmp.1 loop: ... } Here, the FE must emit the highlighted null initializer separate from the use, declaration, and scope of o; otherwise, a GC at a safepoint corresponding to call @g will likely segfault the collector. Of more concern, the FE must do so before any gc points, which are implementation-defined. It's that last property which makes this potentially error-prone. But upon further musings, I'm actually convinced your new spec is best. llvm.gcroot should be purely an annotation, with no runtime component. ? In the case of a liveness-accurate collector: The initializers are not necessary, so the collector is free to omit them. The alloca has the same value as if llvm.gcroot were not present. ? In the case of a collector without liveness: The null initializers are necessary, but the initializer should immediately follow alloca rather than replacing call @llvm.gcroot. Effectively, the initial value of the alloca becomes null if and only if required by the collector. This change enables your alloca-store- gcroot sequence to behave as desired. Regardless of the collector, the FE should not rely on the contents of an uninitialized alloca; it FE should emit initializers if that is necessary for the source language. The collector should perform a trivial DSE of the initial basic block to avoid obviously redundant initializers; the difference is that it can do this reliably, since it has knowledge of where safe points might occur. I need to tweak the collector infrastructure slightly, but that's okay; it's definitely a stronger spec if I comply with it in this manner, since: 1. The semantics of alloca are entirely preserved by the llvm.gcroot annotation. 2. The user program's interaction with the collector is even more robust than before. ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070912/52e7d864/attachment.html From clattner at apple.com Wed Sep 12 15:57:00 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Sep 2007 13:57:00 -0700 Subject: [llvm-commits] [llvm] r41879 - in /llvm/trunk: docs/GarbageCollection.html lib/Transforms/Scalar/LowerGC.cpp In-Reply-To: <5F65BAA7-FDE6-40D4-A760-CEE24BB20BB0@carbonite.com> References: <200709121753.l8CHrD19030366@zion.cs.uiuc.edu> <5F65BAA7-FDE6-40D4-A760-CEE24BB20BB0@carbonite.com> Message-ID: <137996DD-2439-4AA5-A7DE-4EFA55736AB0@apple.com> > Here, the FE must emit the highlighted null initializer separate > from the use, declaration, and scope of o; otherwise, a GC at a > safepoint corresponding to call @g will likely segfault the > collector. Of more concern, the FE must do so before any gc points, > which are implementation-defined. It's that last property which > makes this potentially error-prone. > > > But upon further musings, I'm actually convinced your new spec is > best. llvm.gcroot should be purely an annotation, with no runtime > component. Yes, that's the real reason I felt it was best. gcroot should only be a request to the code generator, not change the actual code :). > ? In the case of a liveness-accurate collector: > The initializers are not necessary, so the collector is free to > omit them. The alloca has the same value as if llvm.gcroot were not > present. Ok. > ? In the case of a collector without liveness: > The null initializers are necessary, but the initializer should > immediately follow alloca rather than replacing call @llvm.gcroot. Yep. This is something the frontend can do. > Effectively, the initial value of the alloca becomes null if and > only if required by the collector. This change enables your alloca- > store-gcroot sequence to behave as desired. Yep! > Regardless of the collector, the FE should not rely on the contents > of an uninitialized alloca; it FE should emit initializers if that > is necessary for the source language. The collector should perform > a trivial DSE of the initial basic block to avoid obviously > redundant initializers; the difference is that it can do this > reliably, since it has knowledge of where safe points might occur. Yep! > I need to tweak the collector infrastructure slightly, but that's > okay; it's definitely a stronger spec if I comply with it in this > manner, since: > > 1. The semantics of alloca are entirely preserved by the > llvm.gcroot annotation. > 2. The user program's interaction with the collector is even more > robust than before. Excellent, -Chris From isanbard at gmail.com Wed Sep 12 17:19:00 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 12 Sep 2007 22:19:00 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41891 - /llvm-gcc-4.0/tags/llvm-gcc-1200-12/ Message-ID: <200709122219.l8CMJ2f2008089@zion.cs.uiuc.edu> Author: void Date: Wed Sep 12 17:18:57 2007 New Revision: 41891 URL: http://llvm.org/viewvc/llvm-project?rev=41891&view=rev Log: Creating llvm-gcc-1200-12 branch Added: llvm-gcc-4.0/tags/llvm-gcc-1200-12/ - copied from r41890, llvm-gcc-4.0/trunk/ From isanbard at gmail.com Wed Sep 12 17:19:09 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 12 Sep 2007 22:19:09 -0000 Subject: [llvm-commits] [llvm] r41892 - /llvm/tags/Apple/llvm-1200-12/ Message-ID: <200709122219.l8CMJ9Dl008104@zion.cs.uiuc.edu> Author: void Date: Wed Sep 12 17:19:09 2007 New Revision: 41892 URL: http://llvm.org/viewvc/llvm-project?rev=41892&view=rev Log: Creating llvm-1200-12 branch Added: llvm/tags/Apple/llvm-1200-12/ - copied from r41891, llvm/trunk/ From evan.cheng at apple.com Wed Sep 12 18:02:08 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Sep 2007 23:02:08 -0000 Subject: [llvm-commits] [llvm] r41893 - in /llvm/trunk: lib/CodeGen/LiveVariables.cpp test/CodeGen/PowerPC/2007-09-12-LiveIntervalsAssert.ll Message-ID: <200709122302.l8CN29br009277@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 18:02:04 2007 New Revision: 41893 URL: http://llvm.org/viewvc/llvm-project?rev=41893&view=rev Log: Fixed a typo that's causing a missing kill marker. Added: llvm/trunk/test/CodeGen/PowerPC/2007-09-12-LiveIntervalsAssert.ll Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=41893&r1=41892&r2=41893&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Wed Sep 12 18:02:04 2007 @@ -306,9 +306,8 @@ for (const unsigned *SubRegs = RegInfo->getImmediateSubRegisters(Reg); unsigned SubReg = *SubRegs; ++SubRegs) { MachineInstr *LastRef = PhysRegInfo[SubReg]; - if (LastRef != RefMI) - SubKills.insert(SubReg); - else if (!HandlePhysRegKill(SubReg, RefMI, SubKills)) + if (LastRef != RefMI || + !HandlePhysRegKill(SubReg, RefMI, SubKills)) SubKills.insert(SubReg); } @@ -336,7 +335,7 @@ bool LiveVariables::HandlePhysRegKill(unsigned Reg, MachineInstr *RefMI) { SmallSet SubKills; if (HandlePhysRegKill(Reg, RefMI, SubKills)) { - addRegisterKilled(Reg, RefMI); + addRegisterKilled(Reg, RefMI, true); return true; } else { // Some sub-registers are killed by another MI. Added: llvm/trunk/test/CodeGen/PowerPC/2007-09-12-LiveIntervalsAssert.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/2007-09-12-LiveIntervalsAssert.ll?rev=41893&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/2007-09-12-LiveIntervalsAssert.ll (added) +++ llvm/trunk/test/CodeGen/PowerPC/2007-09-12-LiveIntervalsAssert.ll Wed Sep 12 18:02:04 2007 @@ -0,0 +1,15 @@ +; RUN: llvm-as < %s | llc -mtriple=powerpc64-apple-darwin + +declare void @cxa_atexit_check_1(i8*) + +define i32 @check_cxa_atexit(i32 (void (i8*)*, i8*, i8*)* %cxa_atexit, void (i8*)* %cxa_finalize) { +entry: + %tmp7 = call i32 null( void (i8*)* @cxa_atexit_check_1, i8* null, i8* null ) ; [#uses=0] + br i1 false, label %cond_true, label %cond_next + +cond_true: ; preds = %entry + ret i32 0 + +cond_next: ; preds = %entry + ret i32 0 +} From isanbard at gmail.com Wed Sep 12 18:11:16 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 12 Sep 2007 23:11:16 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41895 - /llvm-gcc-4.0/tags/llvm-gcc-1200-13/ Message-ID: <200709122311.l8CNBH3H009580@zion.cs.uiuc.edu> Author: void Date: Wed Sep 12 18:11:16 2007 New Revision: 41895 URL: http://llvm.org/viewvc/llvm-project?rev=41895&view=rev Log: Creating llvm-gcc-1200-13 branch Added: llvm-gcc-4.0/tags/llvm-gcc-1200-13/ - copied from r41894, llvm-gcc-4.0/trunk/ From isanbard at gmail.com Wed Sep 12 18:11:23 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 12 Sep 2007 23:11:23 -0000 Subject: [llvm-commits] [llvm] r41896 - /llvm/tags/Apple/llvm-1200-13/ Message-ID: <200709122311.l8CNBNx5009592@zion.cs.uiuc.edu> Author: void Date: Wed Sep 12 18:11:23 2007 New Revision: 41896 URL: http://llvm.org/viewvc/llvm-project?rev=41896&view=rev Log: Creating llvm-1200-13 branch Added: llvm/tags/Apple/llvm-1200-13/ - copied from r41895, llvm/trunk/ From evan.cheng at apple.com Wed Sep 12 18:30:14 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Sep 2007 23:30:14 -0000 Subject: [llvm-commits] [llvm] r41897 - in /llvm/trunk: lib/Target/TargetSelectionDAG.td utils/TableGen/DAGISelEmitter.cpp utils/TableGen/DAGISelEmitter.h Message-ID: <200709122330.l8CNUEIw010040@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 18:30:14 2007 New Revision: 41897 URL: http://llvm.org/viewvc/llvm-project?rev=41897&view=rev Log: Initial support for multi-result patterns: 1. [(set GR32:$dst, (add GR32:$src1, GR32:$src2)), (modify EFLAGS)] This indicates the source pattern expects the instruction would produce 2 values. The first is the result of the addition. The second is an implicit definition in register EFLAGS. 2. def : Pat<(parallel (addc GR32:$src1, GR32:$src2), (modify EFLAGS)), ()> Similar to #1 except this is used for def : Pat patterns. Modified: llvm/trunk/lib/Target/TargetSelectionDAG.td llvm/trunk/utils/TableGen/DAGISelEmitter.cpp llvm/trunk/utils/TableGen/DAGISelEmitter.h Modified: llvm/trunk/lib/Target/TargetSelectionDAG.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetSelectionDAG.td?rev=41897&r1=41896&r2=41897&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetSelectionDAG.td (original) +++ llvm/trunk/lib/Target/TargetSelectionDAG.td Wed Sep 12 18:30:14 2007 @@ -197,6 +197,8 @@ } def set; +def modify; +def parallel; def node; def srcvalue; Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=41897&r1=41896&r2=41897&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Wed Sep 12 18:30:14 2007 @@ -691,6 +691,13 @@ MadeChange |= UpdateNodeType(MVT::isVoid, TP); } return MadeChange; + } else if (getOperator()->getName() == "modify" || + getOperator()->getName() == "parallel") { + bool MadeChange = false; + for (unsigned i = 0; i < getNumChildren(); ++i) + MadeChange = getChild(i)->ApplyTypeConstraints(TP, NotRegisters); + MadeChange |= UpdateNodeType(MVT::isVoid, TP); + return MadeChange; } else if (getOperator() == ISE.get_intrinsic_void_sdnode() || getOperator() == ISE.get_intrinsic_w_chain_sdnode() || getOperator() == ISE.get_intrinsic_wo_chain_sdnode()) { @@ -968,7 +975,9 @@ !Operator->isSubClassOf("Instruction") && !Operator->isSubClassOf("SDNodeXForm") && !Operator->isSubClassOf("Intrinsic") && - Operator->getName() != "set") + Operator->getName() != "set" && + Operator->getName() != "modify" && + Operator->getName() != "parallel") error("Unrecognized node '" + Operator->getName() + "'!"); // Check to see if this is something that is illegal in an input pattern. @@ -1376,6 +1385,18 @@ if (!isUse && Pat->getTransformFn()) I->error("Cannot specify a transform function for a non-input value!"); return; + } else if (Pat->getOperator()->getName() == "modify") { + for (unsigned i = 0, e = Pat->getNumChildren(); i != e; ++i) { + TreePatternNode *Dest = Pat->getChild(i); + if (!Dest->isLeaf()) + I->error("modify value should be a register!"); + + DefInit *Val = dynamic_cast(Dest->getLeafValue()); + if (!Val || !Val->getDef()->isSubClassOf("Register")) + I->error("modify value should be a register!"); + InstImpResults.push_back(Val->getDef()); + } + return; } else if (Pat->getOperator()->getName() != "set") { // If this is not a set, verify that the children nodes are not void typed, // and recurse. @@ -1424,7 +1445,6 @@ InstResults[Dest->getName()] = Dest; } else if (Val->getDef()->isSubClassOf("Register")) { InstImpResults.push_back(Val->getDef()); - ; } else { I->error("set destination should be a register!"); } @@ -1621,6 +1641,8 @@ ResultPattern->setTypes(Res0Node->getExtTypes()); // Create and insert the instruction. + // FIXME: InstImpResults and InstImpInputs should not be part of + // DAGInstruction. DAGInstruction TheInst(I, Results, Operands, InstImpResults, InstImpInputs); Instructions.insert(std::make_pair(I->getRecord(), TheInst)); @@ -1643,10 +1665,8 @@ TreePattern *I = TheInst.getPattern(); if (I == 0) continue; // No pattern. - if (I->getNumTrees() != 1) { - cerr << "CANNOT HANDLE: " << I->getRecord()->getName() << " yet!"; - continue; - } + // FIXME: Assume only the first tree is the pattern. The others are clobber + // nodes. TreePatternNode *Pattern = I->getTree(0); TreePatternNode *SrcPattern; if (Pattern->getOperator()->getName() == "set") { @@ -1664,7 +1684,7 @@ TreePatternNode *DstPattern = TheInst.getResultPattern(); PatternsToMatch. push_back(PatternToMatch(Instr->getValueAsListInit("Predicates"), - SrcPattern, DstPattern, + SrcPattern, DstPattern, TheInst.getImpResults(), Instr->getValueAsInt("AddedComplexity"))); } } @@ -1674,7 +1694,18 @@ for (unsigned i = 0, e = Patterns.size(); i != e; ++i) { DagInit *Tree = Patterns[i]->getValueAsDag("PatternToMatch"); - TreePattern *Pattern = new TreePattern(Patterns[i], Tree, true, *this); + DefInit *OpDef = dynamic_cast(Tree->getOperator()); + Record *Operator = OpDef->getDef(); + TreePattern *Pattern; + if (Operator->getName() != "parallel") + Pattern = new TreePattern(Patterns[i], Tree, true, *this); + else { + std::vector Values; + for (unsigned j = 0, ee = Tree->getNumArgs(); j != ee; ++j) + Values.push_back(Tree->getArg(j)); + ListInit *LI = new ListInit(Values); + Pattern = new TreePattern(Patterns[i], LI, true, *this); + } // Inline pattern fragments into it. Pattern->InlinePatternFragments(); @@ -1707,10 +1738,10 @@ // resolve cases where the input type is known to be a pointer type (which // is considered resolved), but the result knows it needs to be 32- or // 64-bits. Infer the other way for good measure. - IterateInference = Pattern->getOnlyTree()-> - UpdateNodeType(Result->getOnlyTree()->getExtTypes(), *Result); - IterateInference |= Result->getOnlyTree()-> - UpdateNodeType(Pattern->getOnlyTree()->getExtTypes(), *Result); + IterateInference = Pattern->getTree(0)-> + UpdateNodeType(Result->getTree(0)->getExtTypes(), *Result); + IterateInference |= Result->getTree(0)-> + UpdateNodeType(Pattern->getTree(0)->getExtTypes(), *Result); } while (IterateInference); // Verify that we inferred enough types that we can do something with the @@ -1721,19 +1752,18 @@ Result->error("Could not infer all types in pattern result!"); // Validate that the input pattern is correct. - { - std::map InstInputs; - std::map InstResults; - std::vector InstImpInputs; - std::vector InstImpResults; - FindPatternInputsAndOutputs(Pattern, Pattern->getOnlyTree(), + std::map InstInputs; + std::map InstResults; + std::vector InstImpInputs; + std::vector InstImpResults; + for (unsigned j = 0, ee = Pattern->getNumTrees(); j != ee; ++j) + FindPatternInputsAndOutputs(Pattern, Pattern->getTree(j), InstInputs, InstResults, InstImpInputs, InstImpResults); - } // Promote the xform function to be an explicit node if set. - std::vector ResultNodeOperands; TreePatternNode *DstPattern = Result->getOnlyTree(); + std::vector ResultNodeOperands; for (unsigned ii = 0, ee = DstPattern->getNumChildren(); ii != ee; ++ii) { TreePatternNode *OpNode = DstPattern->getChild(ii); if (Record *Xform = OpNode->getTransformFn()) { @@ -1753,13 +1783,13 @@ Temp.InferAllTypes(); std::string Reason; - if (!Pattern->getOnlyTree()->canPatternMatch(Reason, *this)) + if (!Pattern->getTree(0)->canPatternMatch(Reason, *this)) Pattern->error("Pattern can never match: " + Reason); PatternsToMatch. push_back(PatternToMatch(Patterns[i]->getValueAsListInit("Predicates"), - Pattern->getOnlyTree(), - Temp.getOnlyTree(), + Pattern->getTree(0), + Temp.getOnlyTree(), InstImpResults, Patterns[i]->getValueAsInt("AddedComplexity"))); } } @@ -2017,6 +2047,7 @@ PatternsToMatch. push_back(PatternToMatch(PatternsToMatch[i].getPredicates(), Variant, PatternsToMatch[i].getDstPattern(), + PatternsToMatch[i].getDstRegs(), PatternsToMatch[i].getAddedComplexity())); } @@ -2617,7 +2648,8 @@ /// EmitResultCode - Emit the action for a pattern. Now that it has matched /// we actually have to build a DAG! std::vector - EmitResultCode(TreePatternNode *N, bool RetSelected, + EmitResultCode(TreePatternNode *N, std::vector DstRegs, + bool RetSelected, bool InFlagDecled, bool ResNodeDecled, bool LikeLeaf = false, bool isRoot = false) { // List of arguments of getTargetNode() or SelectNodeTo(). @@ -2758,15 +2790,17 @@ CodeGenInstruction &II = CGT.getInstruction(Op->getName()); const DAGInstruction &Inst = ISE.getInstruction(Op); TreePattern *InstPat = Inst.getPattern(); + // FIXME: Assume actual pattern comes before "modify". TreePatternNode *InstPatNode = - isRoot ? (InstPat ? InstPat->getOnlyTree() : Pattern) - : (InstPat ? InstPat->getOnlyTree() : NULL); + isRoot ? (InstPat ? InstPat->getTree(0) : Pattern) + : (InstPat ? InstPat->getTree(0) : NULL); if (InstPatNode && InstPatNode->getOperator()->getName() == "set") { InstPatNode = InstPatNode->getChild(InstPatNode->getNumChildren()-1); } bool HasVarOps = isRoot && II.hasVariableNumberOfOperands; + // FIXME: fix how we deal with physical register operands. bool HasImpInputs = isRoot && Inst.getNumImpOperands() > 0; - bool HasImpResults = isRoot && Inst.getNumImpResults() > 0; + bool HasImpResults = isRoot && DstRegs.size() > 0; bool NodeHasOptInFlag = isRoot && PatternHasProperty(Pattern, SDNPOptInFlag, ISE); bool NodeHasInFlag = isRoot && @@ -2778,6 +2812,7 @@ bool InputHasChain = isRoot && NodeHasProperty(Pattern, SDNPHasChain, ISE); unsigned NumResults = Inst.getNumResults(); + unsigned NumDstRegs = HasImpResults ? DstRegs.size() : 0; if (NodeHasOptInFlag) { emitCode("bool HasInFlag = " @@ -2787,11 +2822,11 @@ emitCode("SmallVector Ops" + utostr(OpcNo) + ";"); // How many results is this pattern expected to produce? - unsigned PatResults = 0; + unsigned NumPatResults = 0; for (unsigned i = 0, e = Pattern->getExtTypes().size(); i != e; i++) { MVT::ValueType VT = Pattern->getTypeNum(i); if (VT != MVT::isVoid && VT != MVT::Flag) - PatResults++; + NumPatResults++; } if (OrigChains.size() > 0) { @@ -2832,7 +2867,7 @@ if ((!OperandNode->isSubClassOf("PredicateOperand") && !OperandNode->isSubClassOf("OptionalDefOperand")) || ISE.getDefaultOperand(OperandNode).DefaultOps.empty()) { - Ops = EmitResultCode(N->getChild(ChildNo), RetSelected, + Ops = EmitResultCode(N->getChild(ChildNo), DstRegs, RetSelected, InFlagDecled, ResNodeDecled); AllOps.insert(AllOps.end(), Ops.begin(), Ops.end()); ++ChildNo; @@ -2842,7 +2877,7 @@ const DAGDefaultOperand &DefaultOp = ISE.getDefaultOperand(II.OperandList[InstOpNo].Rec); for (unsigned i = 0, e = DefaultOp.DefaultOps.size(); i != e; ++i) { - Ops = EmitResultCode(DefaultOp.DefaultOps[i], RetSelected, + Ops = EmitResultCode(DefaultOp.DefaultOps[i], DstRegs, RetSelected, InFlagDecled, ResNodeDecled); AllOps.insert(AllOps.end(), Ops.begin(), Ops.end()); NumEAInputs += Ops.size(); @@ -2888,7 +2923,7 @@ Code2 = NodeName + " = "; } - Code = "CurDAG->getTargetNode(Opc" + utostr(OpcNo); + Code += "CurDAG->getTargetNode(Opc" + utostr(OpcNo); unsigned OpsNo = OpcNo; emitOpcode(II.Namespace + "::" + II.TheDef->getName()); @@ -2900,14 +2935,11 @@ } // Add types for implicit results in physical registers, scheduler will // care of adding copyfromreg nodes. - if (HasImpResults) { - for (unsigned i = 0, e = Inst.getNumImpResults(); i < e; i++) { - Record *RR = Inst.getImpResult(i); - if (RR->isSubClassOf("Register")) { - MVT::ValueType RVT = getRegisterValueType(RR, CGT); - Code += ", " + getEnumName(RVT); - ++NumResults; - } + for (unsigned i = 0; i < NumDstRegs; i++) { + Record *RR = DstRegs[i]; + if (RR->isSubClassOf("Register")) { + MVT::ValueType RVT = getRegisterValueType(RR, CGT); + Code += ", " + getEnumName(RVT); } } if (NodeHasChain) @@ -2961,7 +2993,7 @@ Code += ", &Ops" + utostr(OpsNo) + "[0], Ops" + utostr(OpsNo) + ".size()"; } else if (NodeHasInFlag || NodeHasOptInFlag || HasImpInputs) - AllOps.push_back("InFlag"); + AllOps.push_back("InFlag"); unsigned NumOps = AllOps.size(); if (NumOps) { @@ -2993,10 +3025,10 @@ // Remember which op produces the chain. if (!isRoot) emitCode(ChainName + " = SDOperand(" + NodeName + - ".Val, " + utostr(PatResults) + ");"); + ".Val, " + utostr(NumResults+NumDstRegs) + ");"); else emitCode(ChainName + " = SDOperand(" + NodeName + - ", " + utostr(PatResults) + ");"); + ", " + utostr(NumResults+NumDstRegs) + ");"); if (!isRoot) { NodeOps.push_back("Tmp" + utostr(ResNo)); @@ -3007,11 +3039,11 @@ if (NodeHasOutFlag) { if (!InFlagDecled) { emitCode("SDOperand InFlag(ResNode, " + - utostr(NumResults + (unsigned)NodeHasChain) + ");"); + utostr(NumResults+NumDstRegs+(unsigned)NodeHasChain) + ");"); InFlagDecled = true; } else emitCode("InFlag = SDOperand(ResNode, " + - utostr(NumResults + (unsigned)NodeHasChain) + ");"); + utostr(NumResults+NumDstRegs+(unsigned)NodeHasChain) + ");"); } if (FoldedChains.size() > 0) { @@ -3020,23 +3052,23 @@ emitCode("ReplaceUses(SDOperand(" + FoldedChains[j].first + ".Val, " + utostr(FoldedChains[j].second) + "), SDOperand(ResNode, " + - utostr(NumResults) + "));"); + utostr(NumResults+NumDstRegs) + "));"); NeedReplace = true; } if (NodeHasOutFlag) { emitCode("ReplaceUses(SDOperand(N.Val, " + - utostr(PatResults + (unsigned)InputHasChain) +"), InFlag);"); + utostr(NumPatResults + (unsigned)InputHasChain) +"), InFlag);"); NeedReplace = true; } if (NeedReplace) { - for (unsigned i = 0; i < NumResults; i++) + for (unsigned i = 0; i < NumPatResults; i++) emitCode("ReplaceUses(SDOperand(N.Val, " + utostr(i) + "), SDOperand(ResNode, " + utostr(i) + "));"); if (InputHasChain) emitCode("ReplaceUses(SDOperand(N.Val, " + - utostr(PatResults) + "), SDOperand(" + ChainName + ".Val, " + utostr(NumPatResults) + "), SDOperand(" + ChainName + ".Val, " + ChainName + ".ResNo" + "));"); } else RetSelected = true; @@ -3047,12 +3079,12 @@ } else if (InputHasChain && !NodeHasChain) { // One of the inner node produces a chain. if (NodeHasOutFlag) - emitCode("ReplaceUses(SDOperand(N.Val, " + utostr(PatResults+1) + + emitCode("ReplaceUses(SDOperand(N.Val, " + utostr(NumPatResults+1) + "), SDOperand(ResNode, N.ResNo-1));"); - for (unsigned i = 0; i < PatResults; ++i) + for (unsigned i = 0; i < NumPatResults; ++i) emitCode("ReplaceUses(SDOperand(N.Val, " + utostr(i) + "), SDOperand(ResNode, " + utostr(i) + "));"); - emitCode("ReplaceUses(SDOperand(N.Val, " + utostr(PatResults) + + emitCode("ReplaceUses(SDOperand(N.Val, " + utostr(NumPatResults) + "), " + ChainName + ");"); RetSelected = false; } @@ -3101,7 +3133,7 @@ // PatLeaf node - the operand may or may not be a leaf node. But it should // behave like one. std::vector Ops = - EmitResultCode(N->getChild(0), RetSelected, InFlagDecled, + EmitResultCode(N->getChild(0), DstRegs, RetSelected, InFlagDecled, ResNodeDecled, true); unsigned ResNo = TmpNo++; emitCode("SDOperand Tmp" + utostr(ResNo) + " = Transform_" + Op->getName() @@ -3267,7 +3299,7 @@ // otherwise we are done. } while (Emitter.InsertOneTypeCheck(Pat, Pattern.getSrcPattern(), "N", true)); - Emitter.EmitResultCode(Pattern.getDstPattern(), + Emitter.EmitResultCode(Pattern.getDstPattern(), Pattern.getDstRegs(), false, false, false, false, true); delete Pat; } @@ -3924,8 +3956,15 @@ OS << " setSelected(F.Val->getNodeId());\n"; OS << " RemoveKilled();\n"; OS << "}\n"; - OS << "inline void ReplaceUses(SDNode *F, SDNode *T) {\n"; - OS << " CurDAG->ReplaceAllUsesWith(F, T, &ISelKilled);\n"; + OS << "void ReplaceUses(SDNode *F, SDNode *T) DISABLE_INLINE {\n"; + OS << " unsigned NumVals = F->getNumValues();\n"; + OS << " if (NumVals < T->getNumValues()) {\n"; + OS << " for (unsigned i = 0; i < NumVals; ++i)\n"; + OS << " CurDAG->ReplaceAllUsesOfValueWith(SDOperand(F, i), " + << "SDOperand(T, i), ISelKilled);\n"; + OS << " } else {\n"; + OS << " CurDAG->ReplaceAllUsesWith(F, T, &ISelKilled);\n"; + OS << " }\n"; OS << " setSelected(F->getNodeId());\n"; OS << " RemoveKilled();\n"; OS << "}\n\n"; Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.h?rev=41897&r1=41896&r2=41897&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.h (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.h Wed Sep 12 18:30:14 2007 @@ -371,6 +371,7 @@ unsigned getNumOperands() const { return Operands.size(); } unsigned getNumImpResults() const { return ImpResults.size(); } unsigned getNumImpOperands() const { return ImpOperands.size(); } + const std::vector& getImpResults() const { return ImpResults; } void setResultPattern(TreePatternNode *R) { ResultPattern = R; } @@ -402,18 +403,21 @@ struct PatternToMatch { PatternToMatch(ListInit *preds, TreePatternNode *src, TreePatternNode *dst, + const std::vector &dstregs, unsigned complexity): - Predicates(preds), SrcPattern(src), DstPattern(dst), + Predicates(preds), SrcPattern(src), DstPattern(dst), Dstregs(dstregs), AddedComplexity(complexity) {}; ListInit *Predicates; // Top level predicate conditions to match. TreePatternNode *SrcPattern; // Source pattern to match. TreePatternNode *DstPattern; // Resulting pattern. + std::vector Dstregs; // Physical register defs being matched. unsigned AddedComplexity; // Add to matching pattern complexity. ListInit *getPredicates() const { return Predicates; } TreePatternNode *getSrcPattern() const { return SrcPattern; } TreePatternNode *getDstPattern() const { return DstPattern; } + const std::vector &getDstRegs() const { return Dstregs; } unsigned getAddedComplexity() const { return AddedComplexity; } }; From evan.cheng at apple.com Wed Sep 12 18:39:49 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Sep 2007 23:39:49 -0000 Subject: [llvm-commits] [llvm] r41898 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200709122339.l8CNdnqb010331@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 18:39:49 2007 New Revision: 41898 URL: http://llvm.org/viewvc/llvm-project?rev=41898&view=rev Log: Yet another getTargetNode variant. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=41898&r1=41897&r2=41898&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Sep 12 18:39:49 2007 @@ -410,6 +410,10 @@ SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, MVT::ValueType VT2, MVT::ValueType VT3, const SDOperand *Ops, unsigned NumOps); + SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, + MVT::ValueType VT2, MVT::ValueType VT3, + MVT::ValueType VT4, + const SDOperand *Ops, unsigned NumOps); /// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead. /// This can cause recursive merging of nodes in the DAG. Use the first Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=41898&r1=41897&r2=41898&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Sep 12 18:39:49 2007 @@ -3041,6 +3041,18 @@ const MVT::ValueType *VTs = getNodeValueTypes(VT1, VT2, VT3); return getNode(ISD::BUILTIN_OP_END+Opcode, VTs, 3, Ops, NumOps).Val; } +SDNode *SelectionDAG::getTargetNode(unsigned Opcode, MVT::ValueType VT1, + MVT::ValueType VT2, MVT::ValueType VT3, + MVT::ValueType VT4, + const SDOperand *Ops, unsigned NumOps) { + std::vector VTList; + VTList.push_back(VT1); + VTList.push_back(VT2); + VTList.push_back(VT3); + VTList.push_back(VT4); + const MVT::ValueType *VTs = getNodeValueTypes(VTList); + return getNode(ISD::BUILTIN_OP_END+Opcode, VTs, 4, Ops, NumOps).Val; +} /// ReplaceAllUsesWith - Modify anything using 'From' to use 'To' instead. /// This can cause recursive merging of nodes in the DAG. From evan.cheng at apple.com Wed Sep 12 18:45:46 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Sep 2007 23:45:46 -0000 Subject: [llvm-commits] [llvm] r41899 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Message-ID: <200709122345.l8CNjlWq010495@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 18:45:46 2007 New Revision: 41899 URL: http://llvm.org/viewvc/llvm-project?rev=41899&view=rev Log: Remove dead code. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=41899&r1=41898&r2=41899&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Wed Sep 12 18:45:46 2007 @@ -182,7 +182,7 @@ void ScheduleDAG::CalculateDepths() { std::vector > WorkList; for (unsigned i = 0, e = SUnits.size(); i != e; ++i) - if (SUnits[i].Preds.size() == 0/* && &SUnits[i] != Entry*/) + if (SUnits[i].Preds.size() == 0) WorkList.push_back(std::make_pair(&SUnits[i], 0U)); while (!WorkList.empty()) { From evan.cheng at apple.com Wed Sep 12 19:06:01 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Sep 2007 00:06:01 -0000 Subject: [llvm-commits] [llvm] r41900 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Message-ID: <200709130006.l8D061VT011554@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 19:06:00 2007 New Revision: 41900 URL: http://llvm.org/viewvc/llvm-project?rev=41900&view=rev Log: Bug fixes. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=41900&r1=41899&r2=41900&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Wed Sep 12 19:06:00 2007 @@ -123,7 +123,7 @@ if (!SU) continue; if (SU->isCommutable) { unsigned Opc = SU->Node->getTargetOpcode(); - unsigned NumRes = CountResults(SU->Node); + unsigned NumRes = TII->getNumDefs(Opc); unsigned NumOps = CountOperands(SU->Node); for (unsigned j = 0; j != NumOps; ++j) { if (TII->getOperandConstraint(Opc, j+NumRes, TOI::TIED_TO) == -1) @@ -521,7 +521,7 @@ bool isDUOperand(const SUnit *SU1, const SUnit *SU2) { unsigned Opc = SU1->Node->getTargetOpcode(); - unsigned NumRes = ScheduleDAG::CountResults(SU1->Node); + unsigned NumRes = TII->getNumDefs(Opc); unsigned NumOps = ScheduleDAG::CountOperands(SU1->Node); for (unsigned i = 0; i != NumOps; ++i) { if (TII->getOperandConstraint(Opc, i+NumRes, TOI::TIED_TO) == -1) @@ -705,7 +705,7 @@ bool BURegReductionPriorityQueue::canClobber(SUnit *SU, SUnit *Op) { if (SU->isTwoAddress) { unsigned Opc = SU->Node->getTargetOpcode(); - unsigned NumRes = ScheduleDAG::CountResults(SU->Node); + unsigned NumRes = TII->getNumDefs(Opc); unsigned NumOps = ScheduleDAG::CountOperands(SU->Node); for (unsigned i = 0; i != NumOps; ++i) { if (TII->getOperandConstraint(Opc, i+NumRes, TOI::TIED_TO) != -1) { @@ -735,7 +735,7 @@ continue; unsigned Opc = Node->getTargetOpcode(); - unsigned NumRes = ScheduleDAG::CountResults(Node); + unsigned NumRes = TII->getNumDefs(Opc); unsigned NumOps = ScheduleDAG::CountOperands(Node); for (unsigned j = 0; j != NumOps; ++j) { if (TII->getOperandConstraint(Opc, j+NumRes, TOI::TIED_TO) != -1) { From evan.cheng at apple.com Wed Sep 12 19:16:30 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Sep 2007 00:16:30 -0000 Subject: [llvm-commits] [llvm] r41901 - /llvm/trunk/include/llvm/Target/TargetInstrInfo.h Message-ID: <200709130016.l8D0GU3m012024@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 19:16:29 2007 New Revision: 41901 URL: http://llvm.org/viewvc/llvm-project?rev=41901&view=rev Log: Added getNumDefs(). Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=41901&r1=41900&r2=41901&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Wed Sep 12 19:16:29 2007 @@ -201,6 +201,10 @@ return get(Opcode).numOperands; } + int getNumDefs(MachineOpCode Opcode) const { + return get(Opcode).numDefs; + } + InstrSchedClass getSchedClass(MachineOpCode Opcode) const { return get(Opcode).schedClass; } From evan.cheng at apple.com Wed Sep 12 19:18:50 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Sep 2007 00:18:50 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41902 - /llvm-gcc-4.0/trunk/gcc/config/darwin.h Message-ID: <200709130018.l8D0IpE7012086@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 19:18:50 2007 New Revision: 41902 URL: http://llvm.org/viewvc/llvm-project?rev=41902&view=rev Log: Mac OS X 64-bit is PIC only. Silently ignore -mdynamic-no-pic and -static. Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/darwin.h?rev=41902&r1=41901&r2=41902&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.0/trunk/gcc/config/darwin.h Wed Sep 12 19:18:50 2007 @@ -1721,10 +1721,11 @@ const char *darwin_objc_llvm_implicit_target_global_var_section(tree); #define LLVM_SET_TARGET_OPTIONS(argvec) \ - if (flag_pic) \ - argvec.push_back ("--relocation-model=pic"); \ - else if (!MACHO_DYNAMIC_NO_PIC_P) \ - argvec.push_back ("--relocation-model=static") + if (!TARGET_64BIT) \ + if (flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else if (!MACHO_DYNAMIC_NO_PIC_P) \ + argvec.push_back ("--relocation-model=static") #endif /* APPLE LOCAL end LLVM */ From evan.cheng at apple.com Wed Sep 12 19:22:25 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Sep 2007 00:22:25 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41903 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h Message-ID: <200709130022.l8D0MQYt012174@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 19:22:25 2007 New Revision: 41903 URL: http://llvm.org/viewvc/llvm-project?rev=41903&view=rev Log: Merge -r41901:41902 svn/llvm-project/llvm-gcc-4.0/trunk Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=41903&r1=41902&r2=41903&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Wed Sep 12 19:22:25 2007 @@ -1258,10 +1258,11 @@ const char *darwin_objc_llvm_implicit_target_global_var_section(tree); #define LLVM_SET_TARGET_OPTIONS(argvec) \ - if (flag_pic) \ - argvec.push_back ("--relocation-model=pic"); \ - else if (!MACHO_DYNAMIC_NO_PIC_P) \ - argvec.push_back ("--relocation-model=static") + if (!TARGET_64BIT) \ + if (flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else if (!MACHO_DYNAMIC_NO_PIC_P) \ + argvec.push_back ("--relocation-model=static") #endif /* LLVM LOCAL end */ From evan.cheng at apple.com Wed Sep 12 19:53:29 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Sep 2007 00:53:29 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41904 - /llvm-gcc-4.0/trunk/gcc/config/darwin.h Message-ID: <200709130053.l8D0rT1u013461@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 19:53:28 2007 New Revision: 41904 URL: http://llvm.org/viewvc/llvm-project?rev=41904&view=rev Log: Only ignore -mdynamic-no-pic and -static for x86-64. Not true for ppc64. Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/darwin.h?rev=41904&r1=41903&r2=41904&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.0/trunk/gcc/config/darwin.h Wed Sep 12 19:53:28 2007 @@ -1720,12 +1720,20 @@ darwin_objc_llvm_implicit_target_global_var_section(decl) : 0) const char *darwin_objc_llvm_implicit_target_global_var_section(tree); +#if defined (TARGET_386) #define LLVM_SET_TARGET_OPTIONS(argvec) \ if (!TARGET_64BIT) \ if (flag_pic) \ argvec.push_back ("--relocation-model=pic"); \ else if (!MACHO_DYNAMIC_NO_PIC_P) \ argvec.push_back ("--relocation-model=static") +#else /* defined (TARGET_386) */ +#define LLVM_SET_TARGET_OPTIONS(argvec) \ + if (flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else if (!MACHO_DYNAMIC_NO_PIC_P) \ + argvec.push_back ("--relocation-model=static") +#endif /* defined (TARGET_386) */ #endif /* APPLE LOCAL end LLVM */ From evan.cheng at apple.com Wed Sep 12 19:55:26 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Sep 2007 00:55:26 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41905 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h Message-ID: <200709130055.l8D0tRXL013515@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 19:55:26 2007 New Revision: 41905 URL: http://llvm.org/viewvc/llvm-project?rev=41905&view=rev Log: Merge -r41903:41904 svn/llvm-project/llvm-gcc-4.0/trunk Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=41905&r1=41904&r2=41905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Wed Sep 12 19:55:26 2007 @@ -1257,12 +1257,20 @@ darwin_objc_llvm_implicit_target_global_var_section(decl) : 0) const char *darwin_objc_llvm_implicit_target_global_var_section(tree); +#if defined (TARGET_386) #define LLVM_SET_TARGET_OPTIONS(argvec) \ if (!TARGET_64BIT) \ if (flag_pic) \ argvec.push_back ("--relocation-model=pic"); \ else if (!MACHO_DYNAMIC_NO_PIC_P) \ argvec.push_back ("--relocation-model=static") +#else /* defined (TARGET_386) */ +#define LLVM_SET_TARGET_OPTIONS(argvec) \ + if (flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else if (!MACHO_DYNAMIC_NO_PIC_P) \ + argvec.push_back ("--relocation-model=static") +#endif /* defined (TARGET_386) */ #endif /* LLVM LOCAL end */ From clattner at apple.com Wed Sep 12 19:55:37 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Sep 2007 17:55:37 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r41902 - /llvm-gcc-4.0/trunk/gcc/config/darwin.h In-Reply-To: <200709130018.l8D0IpE7012086@zion.cs.uiuc.edu> References: <200709130018.l8D0IpE7012086@zion.cs.uiuc.edu> Message-ID: On Sep 12, 2007, at 5:18 PM, Evan Cheng wrote: > Mac OS X 64-bit is PIC only. Silently ignore -mdynamic-no-pic and - > static. Hi Evan, This is not obvious, can you please add this as a comment above LLVM_SET_TARGET_OPTIONS? Thanks, -Chris > Modified: > llvm-gcc-4.0/trunk/gcc/config/darwin.h > > Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/ > config/darwin.h?rev=41902&r1=41901&r2=41902&view=diff > > ====================================================================== > ======== > --- llvm-gcc-4.0/trunk/gcc/config/darwin.h (original) > +++ llvm-gcc-4.0/trunk/gcc/config/darwin.h Wed Sep 12 19:18:50 2007 > @@ -1721,10 +1721,11 @@ > const char *darwin_objc_llvm_implicit_target_global_var_section > (tree); > > #define LLVM_SET_TARGET_OPTIONS(argvec) \ > - if (flag_pic) \ > - argvec.push_back ("--relocation-model=pic"); \ > - else if (!MACHO_DYNAMIC_NO_PIC_P) \ > - argvec.push_back ("--relocation-model=static") > + if (!TARGET_64BIT) \ > + if (flag_pic) \ > + argvec.push_back ("--relocation-model=pic"); \ > + else if (!MACHO_DYNAMIC_NO_PIC_P) \ > + argvec.push_back ("--relocation-model=static") > #endif > /* APPLE LOCAL end LLVM */ > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Sep 12 20:00:14 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Sep 2007 18:00:14 -0700 Subject: [llvm-commits] [llvm] r41897 - in /llvm/trunk: lib/Target/TargetSelectionDAG.td utils/TableGen/DAGISelEmitter.cpp utils/TableGen/DAGISelEmitter.h In-Reply-To: <200709122330.l8CNUEIw010040@zion.cs.uiuc.edu> References: <200709122330.l8CNUEIw010040@zion.cs.uiuc.edu> Message-ID: <93DE383D-2335-42F9-9488-59F2C2DF2593@apple.com> > Initial support for multi-result patterns: > 1. > [(set GR32:$dst, (add GR32:$src1, GR32:$src2)), > (modify EFLAGS)] > This indicates the source pattern expects the instruction would > produce 2 values. The first is the result of the addition. The > second is an implicit definition in register EFLAGS. Nice! > 2. > def : Pat<(parallel (addc GR32:$src1, GR32:$src2), (modify > EFLAGS)), ()> > Similar to #1 except this is used for def : Pat patterns. Do we really need this? Pat is just defined as: // Pat - A simple (but common) form of a pattern, which produces a simple result // not needing a full list. class Pat : Pattern; I would be straight-forward to define a version that took a list explicitly. Also, what does it mean to match on a modify of EFLAGS? -Chris From evan.cheng at apple.com Wed Sep 12 20:44:46 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Sep 2007 18:44:46 -0700 Subject: [llvm-commits] [llvm] r41897 - in /llvm/trunk: lib/Target/TargetSelectionDAG.td utils/TableGen/DAGISelEmitter.cpp utils/TableGen/DAGISelEmitter.h In-Reply-To: <93DE383D-2335-42F9-9488-59F2C2DF2593@apple.com> References: <200709122330.l8CNUEIw010040@zion.cs.uiuc.edu> <93DE383D-2335-42F9-9488-59F2C2DF2593@apple.com> Message-ID: <4BD49371-B471-47A8-B1C4-BBCBACEC1D70@apple.com> On Sep 12, 2007, at 6:00 PM, Chris Lattner wrote: >> Initial support for multi-result patterns: >> 1. >> [(set GR32:$dst, (add GR32:$src1, GR32:$src2)), >> (modify EFLAGS)] >> This indicates the source pattern expects the instruction would >> produce 2 values. The first is the result of the addition. The >> second is an implicit definition in register EFLAGS. > > Nice! > >> 2. >> def : Pat<(parallel (addc GR32:$src1, GR32:$src2), (modify >> EFLAGS)), ()> >> Similar to #1 except this is used for def : Pat patterns. > > Do we really need this? Pat is just defined as: > > // Pat - A simple (but common) form of a pattern, which produces a > simple result > // not needing a full list. > class Pat : Pattern; > > I would be straight-forward to define a version that took a list > explicitly. Ok. I'll play with this a bit more. This is not currently used. > Also, what does it mean to match on a modify of EFLAGS? This is fairly restricted right now. It means the matched instruction must implicitly define EFLAGS register and it is being modeled as an explicit value produced by the node. For the bogus example listed before, it's selected to a ADD32rr that produces 2 values. The scheduler will automatically convert the second value into a copy from EFLAGS (details still being worked out). Evan > > > -Chris > > _______________________________________________ > 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 Wed Sep 12 20:45:44 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Sep 2007 01:45:44 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41909 - /llvm-gcc-4.0/trunk/gcc/config/darwin.h Message-ID: <200709130145.l8D1jiZp015815@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 20:45:44 2007 New Revision: 41909 URL: http://llvm.org/viewvc/llvm-project?rev=41909&view=rev Log: Obviously I can't read my own code. Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/darwin.h?rev=41909&r1=41908&r2=41909&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.0/trunk/gcc/config/darwin.h Wed Sep 12 20:45:44 2007 @@ -1720,13 +1720,13 @@ darwin_objc_llvm_implicit_target_global_var_section(decl) : 0) const char *darwin_objc_llvm_implicit_target_global_var_section(tree); +/* Darwin X86-64 only supports PIC code generation. */ #if defined (TARGET_386) #define LLVM_SET_TARGET_OPTIONS(argvec) \ - if (!TARGET_64BIT) \ - if (flag_pic) \ - argvec.push_back ("--relocation-model=pic"); \ - else if (!MACHO_DYNAMIC_NO_PIC_P) \ - argvec.push_back ("--relocation-model=static") + if ((TARGET_64BIT) || flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else if (!MACHO_DYNAMIC_NO_PIC_P) \ + argvec.push_back ("--relocation-model=static") #else /* defined (TARGET_386) */ #define LLVM_SET_TARGET_OPTIONS(argvec) \ if (flag_pic) \ From evan.cheng at apple.com Wed Sep 12 20:46:37 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Sep 2007 01:46:37 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41910 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h Message-ID: <200709130146.l8D1kbMP015884@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 12 20:46:36 2007 New Revision: 41910 URL: http://llvm.org/viewvc/llvm-project?rev=41910&view=rev Log: Merge -r41908:41909 svn/llvm-project/llvm-gcc-4.0/trunk Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=41910&r1=41909&r2=41910&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Wed Sep 12 20:46:36 2007 @@ -1257,13 +1257,13 @@ darwin_objc_llvm_implicit_target_global_var_section(decl) : 0) const char *darwin_objc_llvm_implicit_target_global_var_section(tree); +/* Darwin X86-64 only supports PIC code generation. */ #if defined (TARGET_386) #define LLVM_SET_TARGET_OPTIONS(argvec) \ - if (!TARGET_64BIT) \ - if (flag_pic) \ - argvec.push_back ("--relocation-model=pic"); \ - else if (!MACHO_DYNAMIC_NO_PIC_P) \ - argvec.push_back ("--relocation-model=static") + if ((TARGET_64BIT) || flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else if (!MACHO_DYNAMIC_NO_PIC_P) \ + argvec.push_back ("--relocation-model=static") #else /* defined (TARGET_386) */ #define LLVM_SET_TARGET_OPTIONS(argvec) \ if (flag_pic) \ From tonic at nondot.org Wed Sep 12 23:24:32 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:24:32 -0000 Subject: [llvm-commits] [test-suite] r41911 - /test-suite/branches/release_21/ Message-ID: <200709130424.l8D4OWFT022804@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:24:31 2007 New Revision: 41911 URL: http://llvm.org/viewvc/llvm-project?rev=41911&view=rev Log: Creating 2.1 release branch. Added: test-suite/branches/release_21/ From tonic at nondot.org Wed Sep 12 23:26:13 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:26:13 -0000 Subject: [llvm-commits] [test-suite] r41912 - /test-suite/branches/release_21/trunk/ Message-ID: <200709130426.l8D4QDpf022869@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:26:13 2007 New Revision: 41912 URL: http://llvm.org/viewvc/llvm-project?rev=41912&view=rev Log: Creating release 2.1 branch. Added: test-suite/branches/release_21/trunk/ - copied from r41911, test-suite/trunk/ From tonic at nondot.org Wed Sep 12 23:30:00 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:30:00 -0000 Subject: [llvm-commits] [llvm] r41913 - /llvm/branches/release_21/ Message-ID: <200709130430.l8D4U0YO023060@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:30:00 2007 New Revision: 41913 URL: http://llvm.org/viewvc/llvm-project?rev=41913&view=rev Log: 2.1 release branch Added: llvm/branches/release_21/ From tonic at nondot.org Wed Sep 12 23:30:54 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:30:54 -0000 Subject: [llvm-commits] [llvm] r41914 - /llvm/branches/release_21/trunk/ Message-ID: <200709130430.l8D4Ushu023102@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:30:54 2007 New Revision: 41914 URL: http://llvm.org/viewvc/llvm-project?rev=41914&view=rev Log: 2.1 release branch Added: llvm/branches/release_21/trunk/ - copied from r41913, llvm/trunk/ From tonic at nondot.org Wed Sep 12 23:32:21 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:32:21 -0000 Subject: [llvm-commits] [test-suite] r41915 - /test-suite/branches/release_21/trunk/ Message-ID: <200709130432.l8D4WLa2023266@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:32:21 2007 New Revision: 41915 URL: http://llvm.org/viewvc/llvm-project?rev=41915&view=rev Log: Trying to get release branch right without trunk subdir Removed: test-suite/branches/release_21/trunk/ From tonic at nondot.org Wed Sep 12 23:33:01 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:33:01 -0000 Subject: [llvm-commits] [test-suite] r41916 - /test-suite/branches/release_21/trunk/ Message-ID: <200709130433.l8D4X1vo023350@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:33:00 2007 New Revision: 41916 URL: http://llvm.org/viewvc/llvm-project?rev=41916&view=rev Log: Creating 2.1 release branch Added: test-suite/branches/release_21/trunk/ - copied from r41915, test-suite/trunk/ From tonic at nondot.org Wed Sep 12 23:37:03 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:37:03 -0000 Subject: [llvm-commits] [test-suite] r41917 - /test-suite/branches/release_21/ Message-ID: <200709130437.l8D4b3aD023673@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:37:02 2007 New Revision: 41917 URL: http://llvm.org/viewvc/llvm-project?rev=41917&view=rev Log: Removing branch. Removed: test-suite/branches/release_21/ From tonic at nondot.org Wed Sep 12 23:37:16 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:37:16 -0000 Subject: [llvm-commits] [test-suite] r41918 - /test-suite/branches/release_21/ Message-ID: <200709130437.l8D4bGIO023695@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:37:15 2007 New Revision: 41918 URL: http://llvm.org/viewvc/llvm-project?rev=41918&view=rev Log: Creating 2.1 release branch Added: test-suite/branches/release_21/ - copied from r41917, test-suite/trunk/ From tonic at nondot.org Wed Sep 12 23:37:56 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:37:56 -0000 Subject: [llvm-commits] [llvm] r41919 - /llvm/branches/release_21/ Message-ID: <200709130437.l8D4bujE023759@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:37:56 2007 New Revision: 41919 URL: http://llvm.org/viewvc/llvm-project?rev=41919&view=rev Log: Removing 2.1 branch. Removed: llvm/branches/release_21/ From tonic at nondot.org Wed Sep 12 23:38:30 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:38:30 -0000 Subject: [llvm-commits] [llvm] r41920 - /llvm/branches/release_21/ Message-ID: <200709130438.l8D4cUrO023803@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:38:30 2007 New Revision: 41920 URL: http://llvm.org/viewvc/llvm-project?rev=41920&view=rev Log: Creating 2.1 release branch. Added: llvm/branches/release_21/ - copied from r41919, llvm/trunk/ From tonic at nondot.org Wed Sep 12 23:39:57 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:39:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41921 - /llvm-gcc-4.0/branches/release_21/ Message-ID: <200709130439.l8D4dvoI023931@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:39:57 2007 New Revision: 41921 URL: http://llvm.org/viewvc/llvm-project?rev=41921&view=rev Log: Create 2.1 release branch. Added: llvm-gcc-4.0/branches/release_21/ - copied from r41920, llvm-gcc-4.0/trunk/ From tonic at nondot.org Wed Sep 12 23:40:30 2007 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 13 Sep 2007 04:40:30 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41922 - /llvm-gcc-4.2/branches/release_21/ Message-ID: <200709130440.l8D4eUlX024002@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 12 23:40:30 2007 New Revision: 41922 URL: http://llvm.org/viewvc/llvm-project?rev=41922&view=rev Log: Create 2.1 release branch. Added: llvm-gcc-4.2/branches/release_21/ - copied from r41921, llvm-gcc-4.2/trunk/ From sabre at nondot.org Thu Sep 13 01:09:48 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 13 Sep 2007 06:09:48 -0000 Subject: [llvm-commits] [llvm] r41923 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200709130609.l8D69mQK028720@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 13 01:09:48 2007 New Revision: 41923 URL: http://llvm.org/viewvc/llvm-project?rev=41923&view=rev Log: Fix build problems on Cygwin (PR1652), patch by Patrick Walton. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=41923&r1=41922&r2=41923&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Sep 13 01:09:48 2007 @@ -375,7 +375,7 @@ LoadSDNode *LD = cast(N); ID.AddInteger(LD->getAddressingMode()); ID.AddInteger(LD->getExtensionType()); - ID.AddInteger(LD->getLoadedVT()); + ID.AddInteger((unsigned int)(LD->getLoadedVT())); ID.AddPointer(LD->getSrcValue()); ID.AddInteger(LD->getSrcValueOffset()); ID.AddInteger(LD->getAlignment()); @@ -386,7 +386,7 @@ StoreSDNode *ST = cast(N); ID.AddInteger(ST->getAddressingMode()); ID.AddInteger(ST->isTruncatingStore()); - ID.AddInteger(ST->getStoredVT()); + ID.AddInteger((unsigned int)(ST->getStoredVT())); ID.AddPointer(ST->getSrcValue()); ID.AddInteger(ST->getSrcValueOffset()); ID.AddInteger(ST->getAlignment()); @@ -636,7 +636,7 @@ if (const LoadSDNode *LD = dyn_cast(N)) { ID.AddInteger(LD->getAddressingMode()); ID.AddInteger(LD->getExtensionType()); - ID.AddInteger(LD->getLoadedVT()); + ID.AddInteger((unsigned int)(LD->getLoadedVT())); ID.AddPointer(LD->getSrcValue()); ID.AddInteger(LD->getSrcValueOffset()); ID.AddInteger(LD->getAlignment()); @@ -644,7 +644,7 @@ } else if (const StoreSDNode *ST = dyn_cast(N)) { ID.AddInteger(ST->getAddressingMode()); ID.AddInteger(ST->isTruncatingStore()); - ID.AddInteger(ST->getStoredVT()); + ID.AddInteger((unsigned int)(ST->getStoredVT())); ID.AddPointer(ST->getSrcValue()); ID.AddInteger(ST->getSrcValueOffset()); ID.AddInteger(ST->getAlignment()); @@ -2253,7 +2253,7 @@ AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(ISD::NON_EXTLOAD); - ID.AddInteger(VT); + ID.AddInteger((unsigned int)VT); ID.AddPointer(SV); ID.AddInteger(SVOffset); ID.AddInteger(Alignment); @@ -2307,7 +2307,7 @@ AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(ExtType); - ID.AddInteger(EVT); + ID.AddInteger((unsigned int)EVT); ID.AddPointer(SV); ID.AddInteger(SVOffset); ID.AddInteger(Alignment); @@ -2335,7 +2335,7 @@ AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); ID.AddInteger(AM); ID.AddInteger(LD->getExtensionType()); - ID.AddInteger(LD->getLoadedVT()); + ID.AddInteger((unsigned int)(LD->getLoadedVT())); ID.AddPointer(LD->getSrcValue()); ID.AddInteger(LD->getSrcValueOffset()); ID.AddInteger(LD->getAlignment()); @@ -2376,7 +2376,7 @@ AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(false); - ID.AddInteger(VT); + ID.AddInteger((unsigned int)VT); ID.AddPointer(SV); ID.AddInteger(SVOffset); ID.AddInteger(Alignment); @@ -2421,7 +2421,7 @@ AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(isTrunc); - ID.AddInteger(SVT); + ID.AddInteger((unsigned int)SVT); ID.AddPointer(SV); ID.AddInteger(SVOffset); ID.AddInteger(Alignment); @@ -2448,7 +2448,7 @@ AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(AM); ID.AddInteger(ST->isTruncatingStore()); - ID.AddInteger(ST->getStoredVT()); + ID.AddInteger((unsigned int)(ST->getStoredVT())); ID.AddPointer(ST->getSrcValue()); ID.AddInteger(ST->getSrcValueOffset()); ID.AddInteger(ST->getAlignment()); From sabre at nondot.org Thu Sep 13 01:15:57 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 13 Sep 2007 06:15:57 -0000 Subject: [llvm-commits] [llvm] r41924 - /llvm/trunk/include/llvm/ADT/APFloat.h Message-ID: <200709130615.l8D6FvjJ029128@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 13 01:15:57 2007 New Revision: 41924 URL: http://llvm.org/viewvc/llvm-project?rev=41924&view=rev Log: Make single-argument ctors explicit to avoid tricky bugs :) Modified: llvm/trunk/include/llvm/ADT/APFloat.h Modified: llvm/trunk/include/llvm/ADT/APFloat.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=41924&r1=41923&r2=41924&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APFloat.h (original) +++ llvm/trunk/include/llvm/ADT/APFloat.h Thu Sep 13 01:15:57 2007 @@ -168,9 +168,9 @@ APFloat(const fltSemantics &, const char *); APFloat(const fltSemantics &, integerPart); APFloat(const fltSemantics &, fltCategory, bool negative); - APFloat(double d); - APFloat(float f); - APFloat(const APInt &); + explicit APFloat(double d); + explicit APFloat(float f); + explicit APFloat(const APInt &); APFloat(const APFloat &); ~APFloat(); From sabre at nondot.org Thu Sep 13 01:18:05 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 13 Sep 2007 06:18:05 -0000 Subject: [llvm-commits] [llvm] r41925 - /llvm/trunk/include/llvm/Type.h Message-ID: <200709130618.l8D6I55a029270@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 13 01:18:04 2007 New Revision: 41925 URL: http://llvm.org/viewvc/llvm-project?rev=41925&view=rev Log: remove dead enum value. Modified: llvm/trunk/include/llvm/Type.h Modified: llvm/trunk/include/llvm/Type.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Type.h?rev=41925&r1=41924&r2=41925&view=diff ============================================================================== --- llvm/trunk/include/llvm/Type.h (original) +++ llvm/trunk/include/llvm/Type.h Thu Sep 13 01:18:04 2007 @@ -80,11 +80,10 @@ IntegerTyID, ///< 7: Arbitrary bit width integers FunctionTyID, ///< 8: Functions StructTyID, ///< 9: Structures - PackedStructTyID,///< 10: Packed Structure. This is for bitcode only - ArrayTyID, ///< 11: Arrays - PointerTyID, ///< 12: Pointers - OpaqueTyID, ///< 13: Opaque: type with unknown structure - VectorTyID, ///< 14: SIMD 'packed' format, or other vector type + ArrayTyID, ///< 10: Arrays + PointerTyID, ///< 11: Pointers + OpaqueTyID, ///< 12: Opaque: type with unknown structure + VectorTyID, ///< 13: SIMD 'packed' format, or other vector type NumTypeIDs, // Must remain as last defined ID LastPrimitiveTyID = LabelTyID, @@ -230,8 +229,7 @@ return true; // If it is not something that can have a size (e.g. a function or label), // it doesn't have a size. - if (ID != StructTyID && ID != ArrayTyID && ID != VectorTyID && - ID != PackedStructTyID) + if (ID != StructTyID && ID != ArrayTyID && ID != VectorTyID) return false; // If it is something that can have a size and it's concrete, it definitely // has a size, otherwise we have to try harder to decide. From gordonhenriksen at mac.com Thu Sep 13 08:22:01 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Thu, 13 Sep 2007 09:22:01 -0400 Subject: [llvm-commits] [llvm] r41925 - /llvm/trunk/include/llvm/Type.h In-Reply-To: <200709130618.l8D6I55a029270@zion.cs.uiuc.edu> References: <200709130618.l8D6I55a029270@zion.cs.uiuc.edu> Message-ID: <81746B69-38C8-4EC0-8376-E0595D163065@mac.com> Thanks Chris. On 2007-09-13, at 02:18, Chris Lattner wrote: > Author: lattner > Date: Thu Sep 13 01:18:04 2007 > New Revision: 41925 > > URL: http://llvm.org/viewvc/llvm-project?rev=41925&view=rev > Log: > remove dead enum value. > > Modified: > llvm/trunk/include/llvm/Type.h > > Modified: llvm/trunk/include/llvm/Type.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ > Type.h?rev=41925&r1=41924&r2=41925&view=diff > > ====================================================================== > ======== > --- llvm/trunk/include/llvm/Type.h (original) > +++ llvm/trunk/include/llvm/Type.h Thu Sep 13 01:18:04 2007 > @@ -80,11 +80,10 @@ > IntegerTyID, ///< 7: Arbitrary bit width integers > FunctionTyID, ///< 8: Functions > StructTyID, ///< 9: Structures > - PackedStructTyID,///< 10: Packed Structure. This is for > bitcode only > - ArrayTyID, ///< 11: Arrays > - PointerTyID, ///< 12: Pointers > - OpaqueTyID, ///< 13: Opaque: type with unknown structure > - VectorTyID, ///< 14: SIMD 'packed' format, or other > vector type > + ArrayTyID, ///< 10: Arrays > + PointerTyID, ///< 11: Pointers > + OpaqueTyID, ///< 12: Opaque: type with unknown structure > + VectorTyID, ///< 13: SIMD 'packed' format, or other > vector type > > NumTypeIDs, // Must remain as last > defined ID > LastPrimitiveTyID = LabelTyID, > @@ -230,8 +229,7 @@ > return true; > // If it is not something that can have a size (e.g. a > function or label), > // it doesn't have a size. > - if (ID != StructTyID && ID != ArrayTyID && ID != VectorTyID && > - ID != PackedStructTyID) > + if (ID != StructTyID && ID != ArrayTyID && ID != VectorTyID) > return false; > // If it is something that can have a size and it's concrete, > it definitely > // has a size, otherwise we have to try harder to decide. > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070913/ed83409f/attachment.html From sabre at nondot.org Thu Sep 13 11:30:20 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 13 Sep 2007 16:30:20 -0000 Subject: [llvm-commits] [llvm] r41927 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200709131630.l8DGUKa5025352@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 13 11:30:19 2007 New Revision: 41927 URL: http://llvm.org/viewvc/llvm-project?rev=41927&view=rev Log: Make AllUsesOfLoadedValueWillTrapIfNull strong enough to see through PHI nodes. This is the first step of the fix for PR1639. Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=41927&r1=41926&r2=41927&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 13 11:30:19 2007 @@ -26,6 +26,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" @@ -493,8 +494,10 @@ } /// AllUsesOfValueWillTrapIfNull - Return true if all users of the specified -/// value will trap if the value is dynamically null. -static bool AllUsesOfValueWillTrapIfNull(Value *V) { +/// value will trap if the value is dynamically null. PHIs keeps track of any +/// phi nodes we've seen to avoid reprocessing them. +static bool AllUsesOfValueWillTrapIfNull(Value *V, + SmallPtrSet &PHIs) { for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI) if (isa(*UI)) { // Will trap. @@ -513,10 +516,15 @@ //cerr << "NONTRAPPING USE: " << **UI; return false; // Not calling the ptr } - } else if (CastInst *CI = dyn_cast(*UI)) { - if (!AllUsesOfValueWillTrapIfNull(CI)) return false; + } else if (BitCastInst *CI = dyn_cast(*UI)) { + if (!AllUsesOfValueWillTrapIfNull(CI, PHIs)) return false; } else if (GetElementPtrInst *GEPI = dyn_cast(*UI)) { - if (!AllUsesOfValueWillTrapIfNull(GEPI)) return false; + if (!AllUsesOfValueWillTrapIfNull(GEPI, PHIs)) return false; + } else if (PHINode *PN = dyn_cast(*UI)) { + // If we've already seen this phi node, ignore it, it has already been + // checked. + if (PHIs.insert(PN)) + return AllUsesOfValueWillTrapIfNull(PN, PHIs); } else if (isa(*UI) && isa(UI->getOperand(1))) { // Ignore setcc X, null @@ -533,7 +541,8 @@ static bool AllUsesOfLoadedValueWillTrapIfNull(GlobalVariable *GV) { for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end(); UI!=E; ++UI) if (LoadInst *LI = dyn_cast(*UI)) { - if (!AllUsesOfValueWillTrapIfNull(LI)) + SmallPtrSet PHIs; + if (!AllUsesOfValueWillTrapIfNull(LI, PHIs)) return false; } else if (isa(*UI)) { // Ignore stores to the global. From sabre at nondot.org Thu Sep 13 11:37:21 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 13 Sep 2007 16:37:21 -0000 Subject: [llvm-commits] [llvm] r41928 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200709131637.l8DGbMMt025510@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 13 11:37:20 2007 New Revision: 41928 URL: http://llvm.org/viewvc/llvm-project?rev=41928&view=rev Log: Make ValueIsOnlyUsedLocallyOrStoredToOneGlobal smart enough to see through bitcasts and phis. This is a step to fixing PR1639. Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=41928&r1=41927&r2=41928&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 13 11:37:20 2007 @@ -811,7 +811,8 @@ /// like dereferencing the pointer, but not storing through the address, unless /// it is to the specified global. static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V, - GlobalVariable *GV) { + GlobalVariable *GV, + SmallPtrSet &PHIs) { for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI) if (isa(*UI) || isa(*UI)) { // Fine, ignore. @@ -819,9 +820,16 @@ if (SI->getOperand(0) == V && SI->getOperand(1) != GV) return false; // Storing the pointer itself... bad. // Otherwise, storing through it, or storing into GV... fine. - } else if (isa(*UI) || isa(*UI)) { - if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(cast(*UI),GV)) + } else if (isa(*UI) || isa(*UI) || + isa(*UI)) { + if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(cast(*UI), + GV, PHIs)) return false; + } else if (PHINode *PN = dyn_cast(*UI)) { + // PHIs are ok if all uses are ok. Don't infinitely recurse through PHI + // cycles. + if (PHIs.insert(PN)) + return ValueIsOnlyUsedLocallyOrStoredToOneGlobal(PN, GV, PHIs); } else { return false; } @@ -1125,8 +1133,11 @@ // malloc to be stored into the specified global, loaded setcc'd, and // GEP'd. These are all things we could transform to using the global // for. - if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(MI, GV)) - return false; + { + SmallPtrSet PHIs; + if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(MI, GV, PHIs)) + return false; + } // If we have a global that is only initialized with a fixed size malloc, From sabre at nondot.org Thu Sep 13 12:29:07 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 13 Sep 2007 17:29:07 -0000 Subject: [llvm-commits] [llvm] r41929 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200709131729.l8DHT7LM027286@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 13 12:29:05 2007 New Revision: 41929 URL: http://llvm.org/viewvc/llvm-project?rev=41929&view=rev Log: refactor some code, no functionality change. On the path to PR1639 Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=41929&r1=41928&r2=41929&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 13 12:29:05 2007 @@ -891,63 +891,69 @@ return true; } +/// RewriteHeapSROALoadUser - Given a load instruction and a value derived from +/// the load, rewrite the derived value to use the HeapSRoA'd load. +static void RewriteHeapSROALoadUser(LoadInst *Load, Instruction *LoadUser, + const std::vector &FieldGlobals, + std::vector &InsertedLoadsForPtr) { + // If this is a comparison against null, handle it. + if (ICmpInst *SCI = dyn_cast(LoadUser)) { + assert(isa(SCI->getOperand(1))); + // If we have a setcc of the loaded pointer, we can use a setcc of any + // field. + Value *NPtr; + if (InsertedLoadsForPtr.empty()) { + NPtr = new LoadInst(FieldGlobals[0], Load->getName()+".f0", Load); + InsertedLoadsForPtr.push_back(Load); + } else { + NPtr = InsertedLoadsForPtr.back(); + } + + Value *New = new ICmpInst(SCI->getPredicate(), NPtr, + Constant::getNullValue(NPtr->getType()), + SCI->getName(), SCI); + SCI->replaceAllUsesWith(New); + SCI->eraseFromParent(); + return; + } + + // Otherwise, this should be: 'getelementptr Ptr, Idx, uint FieldNo ...' + GetElementPtrInst *GEPI = cast(LoadUser); + assert(GEPI->getNumOperands() >= 3 && isa(GEPI->getOperand(2)) + && "Unexpected GEPI!"); + + // Load the pointer for this field. + unsigned FieldNo = cast(GEPI->getOperand(2))->getZExtValue(); + if (InsertedLoadsForPtr.size() <= FieldNo) + InsertedLoadsForPtr.resize(FieldNo+1); + if (InsertedLoadsForPtr[FieldNo] == 0) + InsertedLoadsForPtr[FieldNo] = new LoadInst(FieldGlobals[FieldNo], + Load->getName()+".f" + + utostr(FieldNo), Load); + Value *NewPtr = InsertedLoadsForPtr[FieldNo]; + + // Create the new GEP idx vector. + SmallVector GEPIdx; + GEPIdx.push_back(GEPI->getOperand(1)); + GEPIdx.append(GEPI->op_begin()+3, GEPI->op_end()); + + Value *NGEPI = new GetElementPtrInst(NewPtr, GEPIdx.begin(), GEPIdx.end(), + GEPI->getName(), GEPI); + GEPI->replaceAllUsesWith(NGEPI); + GEPI->eraseFromParent(); +} + /// RewriteUsesOfLoadForHeapSRoA - We are performing Heap SRoA on a global. Ptr /// is a value loaded from the global. Eliminate all uses of Ptr, making them /// use FieldGlobals instead. All uses of loaded values satisfy /// GlobalLoadUsesSimpleEnoughForHeapSRA. -static void RewriteUsesOfLoadForHeapSRoA(LoadInst *Ptr, +static void RewriteUsesOfLoadForHeapSRoA(LoadInst *Load, const std::vector &FieldGlobals) { std::vector InsertedLoadsForPtr; //InsertedLoadsForPtr.resize(FieldGlobals.size()); - while (!Ptr->use_empty()) { - Instruction *User = Ptr->use_back(); - - // If this is a comparison against null, handle it. - if (ICmpInst *SCI = dyn_cast(User)) { - assert(isa(SCI->getOperand(1))); - // If we have a setcc of the loaded pointer, we can use a setcc of any - // field. - Value *NPtr; - if (InsertedLoadsForPtr.empty()) { - NPtr = new LoadInst(FieldGlobals[0], Ptr->getName()+".f0", Ptr); - InsertedLoadsForPtr.push_back(Ptr); - } else { - NPtr = InsertedLoadsForPtr.back(); - } - - Value *New = new ICmpInst(SCI->getPredicate(), NPtr, - Constant::getNullValue(NPtr->getType()), - SCI->getName(), SCI); - SCI->replaceAllUsesWith(New); - SCI->eraseFromParent(); - continue; - } - - // Otherwise, this should be: 'getelementptr Ptr, Idx, uint FieldNo ...' - GetElementPtrInst *GEPI = cast(User); - assert(GEPI->getNumOperands() >= 3 && isa(GEPI->getOperand(2)) - && "Unexpected GEPI!"); - - // Load the pointer for this field. - unsigned FieldNo = cast(GEPI->getOperand(2))->getZExtValue(); - if (InsertedLoadsForPtr.size() <= FieldNo) - InsertedLoadsForPtr.resize(FieldNo+1); - if (InsertedLoadsForPtr[FieldNo] == 0) - InsertedLoadsForPtr[FieldNo] = new LoadInst(FieldGlobals[FieldNo], - Ptr->getName()+".f" + - utostr(FieldNo), Ptr); - Value *NewPtr = InsertedLoadsForPtr[FieldNo]; - - // Create the new GEP idx vector. - SmallVector GEPIdx; - GEPIdx.push_back(GEPI->getOperand(1)); - GEPIdx.append(GEPI->op_begin()+3, GEPI->op_end()); - - Value *NGEPI = new GetElementPtrInst(NewPtr, GEPIdx.begin(), GEPIdx.end(), - GEPI->getName(), GEPI); - GEPI->replaceAllUsesWith(NGEPI); - GEPI->eraseFromParent(); - } + while (!Load->use_empty()) + RewriteHeapSROALoadUser(Load, Load->use_back(), + FieldGlobals, InsertedLoadsForPtr); } /// PerformHeapAllocSRoA - MI is an allocation of an array of structures. Break From sabre at nondot.org Thu Sep 13 13:00:32 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 13 Sep 2007 18:00:32 -0000 Subject: [llvm-commits] [llvm] r41930 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200709131800.l8DI0W26028181@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 13 13:00:31 2007 New Revision: 41930 URL: http://llvm.org/viewvc/llvm-project?rev=41930&view=rev Log: be tolerant of PHI nodes when rewriting heap SROA code. This is a step along the way of PR1639 Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=41930&r1=41929&r2=41930&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 13 13:00:31 2007 @@ -844,17 +844,23 @@ static void ReplaceUsesOfMallocWithGlobal(Instruction *Alloc, GlobalVariable *GV) { while (!Alloc->use_empty()) { - Instruction *U = Alloc->use_back(); + Instruction *U = cast(*Alloc->use_begin()); + Instruction *InsertPt = U; if (StoreInst *SI = dyn_cast(U)) { // If this is the store of the allocation into the global, remove it. if (SI->getOperand(1) == GV) { SI->eraseFromParent(); continue; } + } else if (PHINode *PN = dyn_cast(U)) { + // Insert the load in the corresponding predecessor, not right before the + // PHI. + unsigned PredNo = Alloc->use_begin().getOperandNo()/2; + InsertPt = PN->getIncomingBlock(PredNo)->getTerminator(); } // Insert a load from the global, and use it instead of the malloc. - Value *NL = new LoadInst(GV, GV->getName()+".val", U); + Value *NL = new LoadInst(GV, GV->getName()+".val", InsertPt); U->replaceUsesOfWith(Alloc, NL); } } @@ -891,6 +897,20 @@ return true; } +/// GetHeapSROALoad - Return the load for the specified field of the HeapSROA'd +/// value, lazily creating it on demand. +static Value *GetHeapSROALoad(LoadInst *Load, unsigned FieldNo, + const std::vector &FieldGlobals, + std::vector &InsertedLoadsForPtr) { + if (InsertedLoadsForPtr.size() <= FieldNo) + InsertedLoadsForPtr.resize(FieldNo+1); + if (InsertedLoadsForPtr[FieldNo] == 0) + InsertedLoadsForPtr[FieldNo] = new LoadInst(FieldGlobals[FieldNo], + Load->getName()+".f" + + utostr(FieldNo), Load); + return InsertedLoadsForPtr[FieldNo]; +} + /// RewriteHeapSROALoadUser - Given a load instruction and a value derived from /// the load, rewrite the derived value to use the HeapSRoA'd load. static void RewriteHeapSROALoadUser(LoadInst *Load, Instruction *LoadUser, @@ -903,8 +923,7 @@ // field. Value *NPtr; if (InsertedLoadsForPtr.empty()) { - NPtr = new LoadInst(FieldGlobals[0], Load->getName()+".f0", Load); - InsertedLoadsForPtr.push_back(Load); + NPtr = GetHeapSROALoad(Load, 0, FieldGlobals, InsertedLoadsForPtr); } else { NPtr = InsertedLoadsForPtr.back(); } @@ -917,30 +936,35 @@ return; } - // Otherwise, this should be: 'getelementptr Ptr, Idx, uint FieldNo ...' - GetElementPtrInst *GEPI = cast(LoadUser); - assert(GEPI->getNumOperands() >= 3 && isa(GEPI->getOperand(2)) - && "Unexpected GEPI!"); - - // Load the pointer for this field. - unsigned FieldNo = cast(GEPI->getOperand(2))->getZExtValue(); - if (InsertedLoadsForPtr.size() <= FieldNo) - InsertedLoadsForPtr.resize(FieldNo+1); - if (InsertedLoadsForPtr[FieldNo] == 0) - InsertedLoadsForPtr[FieldNo] = new LoadInst(FieldGlobals[FieldNo], - Load->getName()+".f" + - utostr(FieldNo), Load); - Value *NewPtr = InsertedLoadsForPtr[FieldNo]; + // Handle 'getelementptr Ptr, Idx, uint FieldNo ...' + if (GetElementPtrInst *GEPI = dyn_cast(LoadUser)) { + assert(GEPI->getNumOperands() >= 3 && isa(GEPI->getOperand(2)) + && "Unexpected GEPI!"); + + // Load the pointer for this field. + unsigned FieldNo = cast(GEPI->getOperand(2))->getZExtValue(); + Value *NewPtr = GetHeapSROALoad(Load, FieldNo, + FieldGlobals, InsertedLoadsForPtr); + + // Create the new GEP idx vector. + SmallVector GEPIdx; + GEPIdx.push_back(GEPI->getOperand(1)); + GEPIdx.append(GEPI->op_begin()+3, GEPI->op_end()); + + Value *NGEPI = new GetElementPtrInst(NewPtr, GEPIdx.begin(), GEPIdx.end(), + GEPI->getName(), GEPI); + GEPI->replaceAllUsesWith(NGEPI); + GEPI->eraseFromParent(); + return; + } - // Create the new GEP idx vector. - SmallVector GEPIdx; - GEPIdx.push_back(GEPI->getOperand(1)); - GEPIdx.append(GEPI->op_begin()+3, GEPI->op_end()); - - Value *NGEPI = new GetElementPtrInst(NewPtr, GEPIdx.begin(), GEPIdx.end(), - GEPI->getName(), GEPI); - GEPI->replaceAllUsesWith(NGEPI); - GEPI->eraseFromParent(); + // Handle PHI nodes. All PHI nodes must be merging in the same values, so + // just treat them like a copy. + PHINode *PN = cast(LoadUser); + while (!PN->use_empty()) + RewriteHeapSROALoadUser(Load, PN->use_back(), + FieldGlobals, InsertedLoadsForPtr); + PN->eraseFromParent(); } /// RewriteUsesOfLoadForHeapSRoA - We are performing Heap SRoA on a global. Ptr From sabre at nondot.org Thu Sep 13 16:31:37 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 13 Sep 2007 21:31:37 -0000 Subject: [llvm-commits] [llvm] r41933 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200709132131.l8DLVcd1002213@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 13 16:31:36 2007 New Revision: 41933 URL: http://llvm.org/viewvc/llvm-project?rev=41933&view=rev Log: Teach GlobalLoadUsesSimpleEnoughForHeapSRA and the SROA rewriter how to handle a limited form of PHI nodes. This finally fixes PR1639, speeding 179.art up from 7.84s to 3.13s on PPC. Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=41933&r1=41932&r2=41933&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 13 16:31:36 2007 @@ -867,7 +867,8 @@ /// GlobalLoadUsesSimpleEnoughForHeapSRA - If all users of values loaded from /// GV are simple enough to perform HeapSRA, return true. -static bool GlobalLoadUsesSimpleEnoughForHeapSRA(GlobalVariable *GV) { +static bool GlobalLoadUsesSimpleEnoughForHeapSRA(GlobalVariable *GV, + MallocInst *MI) { for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end(); UI != E; ++UI) if (LoadInst *LI = dyn_cast(*UI)) { @@ -883,15 +884,35 @@ } // getelementptr is also ok, but only a simple form. - GetElementPtrInst *GEPI = dyn_cast(*UI); - if (!GEPI) return false; + if (GetElementPtrInst *GEPI = dyn_cast(*UI)) { + // Must index into the array and into the struct. + if (GEPI->getNumOperands() < 3) + return false; + + // Otherwise the GEP is ok. + continue; + } - // Must index into the array and into the struct. - if (GEPI->getNumOperands() < 3) - return false; + if (PHINode *PN = dyn_cast(*UI)) { + // We have a phi of a load from the global. We can only handle this + // if the other PHI'd values are actually the same. In this case, + // the rewriter will just drop the phi entirely. + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { + Value *IV = PN->getIncomingValue(i); + if (IV == LI) continue; // Trivial the same. + + // If the phi'd value is from the malloc that initializes the value, + // we can xform it. + if (IV == MI) continue; + + // Otherwise, we don't know what it is. + return false; + } + return true; + } - // Otherwise the GEP is ok. - continue; + // Otherwise we don't know what this is, not ok. + return false; } } return true; @@ -899,7 +920,7 @@ /// GetHeapSROALoad - Return the load for the specified field of the HeapSROA'd /// value, lazily creating it on demand. -static Value *GetHeapSROALoad(LoadInst *Load, unsigned FieldNo, +static Value *GetHeapSROALoad(Instruction *Load, unsigned FieldNo, const std::vector &FieldGlobals, std::vector &InsertedLoadsForPtr) { if (InsertedLoadsForPtr.size() <= FieldNo) @@ -958,12 +979,39 @@ return; } - // Handle PHI nodes. All PHI nodes must be merging in the same values, so - // just treat them like a copy. + // Handle PHI nodes. PHI nodes must be merging in the same values, plus + // potentially the original malloc. Insert phi nodes for each field, then + // process uses of the PHI. PHINode *PN = cast(LoadUser); + std::vector PHIsForField; + PHIsForField.resize(FieldGlobals.size()); + for (unsigned i = 0, e = FieldGlobals.size(); i != e; ++i) { + Value *LoadV = GetHeapSROALoad(Load, i, FieldGlobals, InsertedLoadsForPtr); + + PHINode *FieldPN = new PHINode(LoadV->getType(), + PN->getName()+"."+utostr(i), PN); + // Fill in the predecessor values. + for (unsigned pred = 0, e = PN->getNumIncomingValues(); pred != e; ++pred) { + // Each predecessor either uses the load or the original malloc. + Value *InVal = PN->getIncomingValue(pred); + BasicBlock *BB = PN->getIncomingBlock(pred); + Value *NewVal; + if (isa(InVal)) { + // Insert a reload from the global in the predecessor. + NewVal = GetHeapSROALoad(BB->getTerminator(), i, FieldGlobals, + PHIsForField); + } else { + NewVal = InsertedLoadsForPtr[i]; + } + FieldPN->addIncoming(NewVal, BB); + } + PHIsForField[i] = FieldPN; + } + + // Since PHIsForField specifies a phi for every input value, the lazy inserter + // will never insert a load. while (!PN->use_empty()) - RewriteHeapSROALoadUser(Load, PN->use_back(), - FieldGlobals, InsertedLoadsForPtr); + RewriteHeapSROALoadUser(Load, PN->use_back(), FieldGlobals, PHIsForField); PN->eraseFromParent(); } @@ -1193,7 +1241,7 @@ // This the structure has an unreasonable number of fields, leave it // alone. if (AllocTy->getNumElements() <= 16 && AllocTy->getNumElements() > 0 && - GlobalLoadUsesSimpleEnoughForHeapSRA(GV)) { + GlobalLoadUsesSimpleEnoughForHeapSRA(GV, MI)) { GVI = PerformHeapAllocSRoA(GV, MI); return true; } From isanbard at gmail.com Thu Sep 13 19:26:28 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 14 Sep 2007 00:26:28 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41936 - /llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200709140026.l8E0QSJD008622@zion.cs.uiuc.edu> Author: void Date: Thu Sep 13 19:26:28 2007 New Revision: 41936 URL: http://llvm.org/viewvc/llvm-project?rev=41936&view=rev Log: APFloats have "explicit" now. Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp?rev=41936&r1=41935&r2=41936&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Thu Sep 13 19:26:28 2007 @@ -376,7 +376,7 @@ return true; case IX86_BUILTIN_LOADQ: { PointerType *f64Ptr = PointerType::get(Type::DoubleTy); - Value *Zero = ConstantFP::get(Type::DoubleTy, 0.0); + Value *Zero = ConstantFP::get(Type::DoubleTy, APFloat(0.0)); Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); Ops[0] = Builder.CreateLoad(Ops[0], "tmp"); Result = BuildVector(Ops[0], Zero, NULL); From isanbard at gmail.com Thu Sep 13 19:28:04 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 14 Sep 2007 00:28:04 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41937 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200709140028.l8E0S5T5008692@zion.cs.uiuc.edu> Author: void Date: Thu Sep 13 19:28:04 2007 New Revision: 41937 URL: http://llvm.org/viewvc/llvm-project?rev=41937&view=rev Log: APFloat uses "exlicit" now. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=41937&r1=41936&r2=41937&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Thu Sep 13 19:28:04 2007 @@ -376,7 +376,7 @@ return true; case IX86_BUILTIN_LOADQ: { PointerType *f64Ptr = PointerType::get(Type::DoubleTy); - Value *Zero = ConstantFP::get(Type::DoubleTy, 0.0); + Value *Zero = ConstantFP::get(Type::DoubleTy, APFloat(0.0)); Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); Ops[0] = Builder.CreateLoad(Ops[0], "tmp"); Result = BuildVector(Ops[0], Zero, NULL); From isanbard at gmail.com Thu Sep 13 20:13:55 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 14 Sep 2007 01:13:55 -0000 Subject: [llvm-commits] [llvm] r41938 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709140113.l8E1Dth1010358@zion.cs.uiuc.edu> Author: void Date: Thu Sep 13 20:13:55 2007 New Revision: 41938 URL: http://llvm.org/viewvc/llvm-project?rev=41938&view=rev Log: Temporary reverting r41817 (http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070910/053370.html). It's causing SPASS to fail. Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=41938&r1=41937&r2=41938&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Thu Sep 13 20:13:55 2007 @@ -336,24 +336,14 @@ if (!CI) return; - // FIXME - if (CI->getPredicate() == ICmpInst::ICMP_EQ - || CI->getPredicate() == ICmpInst::ICMP_NE) - return; - + // FIXME if (CI->getPredicate() == ICmpInst::ICMP_SGT || CI->getPredicate() == ICmpInst::ICMP_UGT || CI->getPredicate() == ICmpInst::ICMP_SGE - || CI->getPredicate() == ICmpInst::ICMP_UGE) { - - BasicBlock *FirstSuccessor = BR->getSuccessor(0); - // splitLoop() is expecting LT/LE as exit condition predicate. - // Swap operands here if possible to meet this requirement. - if (!L->contains(FirstSuccessor)) - CI->swapOperands(); - else - return; - } + || CI->getPredicate() == ICmpInst::ICMP_UGE + || CI->getPredicate() == ICmpInst::ICMP_EQ + || CI->getPredicate() == ICmpInst::ICMP_NE) + return; ExitCondition = CI; From isanbard at gmail.com Thu Sep 13 20:14:14 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 14 Sep 2007 01:14:14 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41939 - /llvm-gcc-4.0/tags/llvm-gcc-1200-14/ Message-ID: <200709140114.l8E1EEYg010392@zion.cs.uiuc.edu> Author: void Date: Thu Sep 13 20:14:14 2007 New Revision: 41939 URL: http://llvm.org/viewvc/llvm-project?rev=41939&view=rev Log: Creating llvm-gcc-1200-14 branch Added: llvm-gcc-4.0/tags/llvm-gcc-1200-14/ - copied from r41938, llvm-gcc-4.0/trunk/ From isanbard at gmail.com Thu Sep 13 20:14:23 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 14 Sep 2007 01:14:23 -0000 Subject: [llvm-commits] [llvm] r41940 - /llvm/tags/Apple/llvm-1200-14/ Message-ID: <200709140114.l8E1ENcU010409@zion.cs.uiuc.edu> Author: void Date: Thu Sep 13 20:14:22 2007 New Revision: 41940 URL: http://llvm.org/viewvc/llvm-project?rev=41940&view=rev Log: Creating llvm-1200-14 branch Added: llvm/tags/Apple/llvm-1200-14/ - copied from r41939, llvm/trunk/ From tonic at nondot.org Thu Sep 13 20:24:13 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 14 Sep 2007 01:24:13 -0000 Subject: [llvm-commits] [llvm] r41941 - in /llvm/trunk: autoconf/configure.ac configure Message-ID: <200709140124.l8E1OEVL010991@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Sep 13 20:24:13 2007 New Revision: 41941 URL: http://llvm.org/viewvc/llvm-project?rev=41941&view=rev Log: Change to 2.2svn. Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/configure Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=41941&r1=41940&r2=41941&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Thu Sep 13 20:24:13 2007 @@ -31,7 +31,7 @@ dnl===-----------------------------------------------------------------------=== dnl Initialize autoconf and define the package name, version number and dnl email address for reporting bugs. -AC_INIT([[llvm]],[[2.1svn]],[llvmbugs at cs.uiuc.edu]) +AC_INIT([[llvm]],[[2.2svn]],[llvmbugs at cs.uiuc.edu]) dnl Provide a copyright substitution and ensure the copyright notice is included dnl in the output of --version option of the generated configure script. Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=41941&r1=41940&r2=41941&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Thu Sep 13 20:24:13 2007 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for llvm 2.1svn. +# Generated by GNU Autoconf 2.60 for llvm 2.2svn. # # Report bugs to . # @@ -715,8 +715,8 @@ # Identity of this package. PACKAGE_NAME='llvm' PACKAGE_TARNAME='-llvm-' -PACKAGE_VERSION='2.1svn' -PACKAGE_STRING='llvm 2.1svn' +PACKAGE_VERSION='2.2svn' +PACKAGE_STRING='llvm 2.2svn' PACKAGE_BUGREPORT='llvmbugs at cs.uiuc.edu' ac_unique_file="lib/VMCore/Module.cpp" @@ -1453,7 +1453,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures llvm 2.1svn to adapt to many kinds of systems. +\`configure' configures llvm 2.2svn to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1519,7 +1519,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of llvm 2.1svn:";; + short | recursive ) echo "Configuration of llvm 2.2svn:";; esac cat <<\_ACEOF @@ -1646,7 +1646,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -llvm configure 2.1svn +llvm configure 2.2svn generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1662,7 +1662,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by llvm $as_me 2.1svn, which was +It was created by llvm $as_me 2.2svn, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ @@ -34453,7 +34453,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by llvm $as_me 2.1svn, which was +This file was extended by llvm $as_me 2.2svn, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -34506,7 +34506,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -llvm config.status 2.1svn +llvm config.status 2.2svn configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" From tonic at nondot.org Thu Sep 13 20:24:38 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 14 Sep 2007 01:24:38 -0000 Subject: [llvm-commits] [test-suite] r41942 - in /test-suite/trunk: autoconf/configure.ac configure Message-ID: <200709140124.l8E1OcTP011026@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Sep 13 20:24:37 2007 New Revision: 41942 URL: http://llvm.org/viewvc/llvm-project?rev=41942&view=rev Log: Change to 2.2svn. Modified: test-suite/trunk/autoconf/configure.ac test-suite/trunk/configure Modified: test-suite/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/autoconf/configure.ac?rev=41942&r1=41941&r2=41942&view=diff ============================================================================== --- test-suite/trunk/autoconf/configure.ac (original) +++ test-suite/trunk/autoconf/configure.ac Thu Sep 13 20:24:37 2007 @@ -1,5 +1,5 @@ dnl Initialize autoconf -AC_INIT([[LLVM-TEST]],[[2.1cvs]],[llvmbugs at cs.uiuc.edu]) +AC_INIT([[LLVM-TEST]],[[2.2svn]],[llvmbugs at cs.uiuc.edu]) dnl Place all of the extra autoconf files into the config subdirectory AC_CONFIG_AUX_DIR([autoconf]) Modified: test-suite/trunk/configure URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/configure?rev=41942&r1=41941&r2=41942&view=diff ============================================================================== --- test-suite/trunk/configure (original) +++ test-suite/trunk/configure Thu Sep 13 20:24:37 2007 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for LLVM-TEST 2.1cvs. +# Generated by GNU Autoconf 2.60 for LLVM-TEST 2.2svn. # # Report bugs to . # @@ -713,8 +713,8 @@ # Identity of this package. PACKAGE_NAME='LLVM-TEST' PACKAGE_TARNAME='-llvm-test-' -PACKAGE_VERSION='2.1cvs' -PACKAGE_STRING='LLVM-TEST 2.1cvs' +PACKAGE_VERSION='2.2svn' +PACKAGE_STRING='LLVM-TEST 2.2svn' PACKAGE_BUGREPORT='llvmbugs at cs.uiuc.edu' ac_unique_file="SingleSource/Benchmarks/Makefile" @@ -1389,7 +1389,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures LLVM-TEST 2.1cvs to adapt to many kinds of systems. +\`configure' configures LLVM-TEST 2.2svn to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1454,7 +1454,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of LLVM-TEST 2.1cvs:";; + short | recursive ) echo "Configuration of LLVM-TEST 2.2svn:";; esac cat <<\_ACEOF @@ -1576,7 +1576,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -LLVM-TEST configure 2.1cvs +LLVM-TEST configure 2.2svn generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1590,7 +1590,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by LLVM-TEST $as_me 2.1cvs, which was +It was created by LLVM-TEST $as_me 2.2svn, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ @@ -21254,7 +21254,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by LLVM-TEST $as_me 2.1cvs, which was +This file was extended by LLVM-TEST $as_me 2.2svn, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21301,7 +21301,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -LLVM-TEST config.status 2.1cvs +LLVM-TEST config.status 2.2svn configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" From tonic at nondot.org Thu Sep 13 20:26:42 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 14 Sep 2007 01:26:42 -0000 Subject: [llvm-commits] [llvm] r41943 - in /llvm/branches/release_21: autoconf/configure.ac configure Message-ID: <200709140126.l8E1QgdK011384@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Sep 13 20:26:42 2007 New Revision: 41943 URL: http://llvm.org/viewvc/llvm-project?rev=41943&view=rev Log: Set version number Modified: llvm/branches/release_21/autoconf/configure.ac llvm/branches/release_21/configure Modified: llvm/branches/release_21/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/autoconf/configure.ac?rev=41943&r1=41942&r2=41943&view=diff ============================================================================== --- llvm/branches/release_21/autoconf/configure.ac (original) +++ llvm/branches/release_21/autoconf/configure.ac Thu Sep 13 20:26:42 2007 @@ -31,7 +31,7 @@ dnl===-----------------------------------------------------------------------=== dnl Initialize autoconf and define the package name, version number and dnl email address for reporting bugs. -AC_INIT([[llvm]],[[2.1svn]],[llvmbugs at cs.uiuc.edu]) +AC_INIT([[llvm]],[[2.1]],[llvmbugs at cs.uiuc.edu]) dnl Provide a copyright substitution and ensure the copyright notice is included dnl in the output of --version option of the generated configure script. Modified: llvm/branches/release_21/configure URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/configure?rev=41943&r1=41942&r2=41943&view=diff ============================================================================== --- llvm/branches/release_21/configure (original) +++ llvm/branches/release_21/configure Thu Sep 13 20:26:42 2007 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for llvm 2.1svn. +# Generated by GNU Autoconf 2.60 for llvm 2.1. # # Report bugs to . # @@ -715,8 +715,8 @@ # Identity of this package. PACKAGE_NAME='llvm' PACKAGE_TARNAME='-llvm-' -PACKAGE_VERSION='2.1svn' -PACKAGE_STRING='llvm 2.1svn' +PACKAGE_VERSION='2.1' +PACKAGE_STRING='llvm 2.1' PACKAGE_BUGREPORT='llvmbugs at cs.uiuc.edu' ac_unique_file="lib/VMCore/Module.cpp" @@ -1453,7 +1453,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures llvm 2.1svn to adapt to many kinds of systems. +\`configure' configures llvm 2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1519,7 +1519,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of llvm 2.1svn:";; + short | recursive ) echo "Configuration of llvm 2.1:";; esac cat <<\_ACEOF @@ -1646,7 +1646,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -llvm configure 2.1svn +llvm configure 2.1 generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1662,7 +1662,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by llvm $as_me 2.1svn, which was +It was created by llvm $as_me 2.1, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ @@ -34453,7 +34453,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by llvm $as_me 2.1svn, which was +This file was extended by llvm $as_me 2.1, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -34506,7 +34506,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -llvm config.status 2.1svn +llvm config.status 2.1 configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" From tonic at nondot.org Thu Sep 13 20:31:20 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 14 Sep 2007 01:31:20 -0000 Subject: [llvm-commits] [test-suite] r41944 - in /test-suite/branches/release_21: autoconf/configure.ac configure Message-ID: <200709140131.l8E1VK6w011807@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Sep 13 20:31:20 2007 New Revision: 41944 URL: http://llvm.org/viewvc/llvm-project?rev=41944&view=rev Log: Set release version. Modified: test-suite/branches/release_21/autoconf/configure.ac test-suite/branches/release_21/configure Modified: test-suite/branches/release_21/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/test-suite/branches/release_21/autoconf/configure.ac?rev=41944&r1=41943&r2=41944&view=diff ============================================================================== --- test-suite/branches/release_21/autoconf/configure.ac (original) +++ test-suite/branches/release_21/autoconf/configure.ac Thu Sep 13 20:31:20 2007 @@ -1,5 +1,5 @@ dnl Initialize autoconf -AC_INIT([[LLVM-TEST]],[[2.1cvs]],[llvmbugs at cs.uiuc.edu]) +AC_INIT([[LLVM-TEST]],[[2.1]],[llvmbugs at cs.uiuc.edu]) dnl Place all of the extra autoconf files into the config subdirectory AC_CONFIG_AUX_DIR([autoconf]) Modified: test-suite/branches/release_21/configure URL: http://llvm.org/viewvc/llvm-project/test-suite/branches/release_21/configure?rev=41944&r1=41943&r2=41944&view=diff ============================================================================== --- test-suite/branches/release_21/configure (original) +++ test-suite/branches/release_21/configure Thu Sep 13 20:31:20 2007 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for LLVM-TEST 2.1cvs. +# Generated by GNU Autoconf 2.60 for LLVM-TEST 2.1. # # Report bugs to . # @@ -713,8 +713,8 @@ # Identity of this package. PACKAGE_NAME='LLVM-TEST' PACKAGE_TARNAME='-llvm-test-' -PACKAGE_VERSION='2.1cvs' -PACKAGE_STRING='LLVM-TEST 2.1cvs' +PACKAGE_VERSION='2.1' +PACKAGE_STRING='LLVM-TEST 2.1' PACKAGE_BUGREPORT='llvmbugs at cs.uiuc.edu' ac_unique_file="SingleSource/Benchmarks/Makefile" @@ -1389,7 +1389,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures LLVM-TEST 2.1cvs to adapt to many kinds of systems. +\`configure' configures LLVM-TEST 2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1454,7 +1454,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of LLVM-TEST 2.1cvs:";; + short | recursive ) echo "Configuration of LLVM-TEST 2.1:";; esac cat <<\_ACEOF @@ -1576,7 +1576,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -LLVM-TEST configure 2.1cvs +LLVM-TEST configure 2.1 generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1590,7 +1590,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by LLVM-TEST $as_me 2.1cvs, which was +It was created by LLVM-TEST $as_me 2.1, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ @@ -21254,7 +21254,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by LLVM-TEST $as_me 2.1cvs, which was +This file was extended by LLVM-TEST $as_me 2.1, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21301,7 +21301,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -LLVM-TEST config.status 2.1cvs +LLVM-TEST config.status 2.1 configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" From tonic at nondot.org Thu Sep 13 20:41:09 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 14 Sep 2007 01:41:09 -0000 Subject: [llvm-commits] [llvm] r41945 - /llvm/branches/release_21/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200709140141.l8E1f9Xh012286@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Sep 13 20:41:09 2007 New Revision: 41945 URL: http://llvm.org/viewvc/llvm-project?rev=41945&view=rev Log: Merge from mainline for PR1652. Modified: llvm/branches/release_21/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/branches/release_21/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=41945&r1=41944&r2=41945&view=diff ============================================================================== --- llvm/branches/release_21/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/branches/release_21/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Sep 13 20:41:09 2007 @@ -375,7 +375,7 @@ LoadSDNode *LD = cast(N); ID.AddInteger(LD->getAddressingMode()); ID.AddInteger(LD->getExtensionType()); - ID.AddInteger(LD->getLoadedVT()); + ID.AddInteger((unsigned int)(LD->getLoadedVT())); ID.AddPointer(LD->getSrcValue()); ID.AddInteger(LD->getSrcValueOffset()); ID.AddInteger(LD->getAlignment()); @@ -386,7 +386,7 @@ StoreSDNode *ST = cast(N); ID.AddInteger(ST->getAddressingMode()); ID.AddInteger(ST->isTruncatingStore()); - ID.AddInteger(ST->getStoredVT()); + ID.AddInteger((unsigned int)(ST->getStoredVT())); ID.AddPointer(ST->getSrcValue()); ID.AddInteger(ST->getSrcValueOffset()); ID.AddInteger(ST->getAlignment()); @@ -636,7 +636,7 @@ if (const LoadSDNode *LD = dyn_cast(N)) { ID.AddInteger(LD->getAddressingMode()); ID.AddInteger(LD->getExtensionType()); - ID.AddInteger(LD->getLoadedVT()); + ID.AddInteger((unsigned int)(LD->getLoadedVT())); ID.AddPointer(LD->getSrcValue()); ID.AddInteger(LD->getSrcValueOffset()); ID.AddInteger(LD->getAlignment()); @@ -644,7 +644,7 @@ } else if (const StoreSDNode *ST = dyn_cast(N)) { ID.AddInteger(ST->getAddressingMode()); ID.AddInteger(ST->isTruncatingStore()); - ID.AddInteger(ST->getStoredVT()); + ID.AddInteger((unsigned int)(ST->getStoredVT())); ID.AddPointer(ST->getSrcValue()); ID.AddInteger(ST->getSrcValueOffset()); ID.AddInteger(ST->getAlignment()); @@ -2253,7 +2253,7 @@ AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(ISD::NON_EXTLOAD); - ID.AddInteger(VT); + ID.AddInteger((unsigned int)VT); ID.AddPointer(SV); ID.AddInteger(SVOffset); ID.AddInteger(Alignment); @@ -2307,7 +2307,7 @@ AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(ExtType); - ID.AddInteger(EVT); + ID.AddInteger((unsigned int)EVT); ID.AddPointer(SV); ID.AddInteger(SVOffset); ID.AddInteger(Alignment); @@ -2335,7 +2335,7 @@ AddNodeIDNode(ID, ISD::LOAD, VTs, Ops, 3); ID.AddInteger(AM); ID.AddInteger(LD->getExtensionType()); - ID.AddInteger(LD->getLoadedVT()); + ID.AddInteger((unsigned int)(LD->getLoadedVT())); ID.AddPointer(LD->getSrcValue()); ID.AddInteger(LD->getSrcValueOffset()); ID.AddInteger(LD->getAlignment()); @@ -2376,7 +2376,7 @@ AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(false); - ID.AddInteger(VT); + ID.AddInteger((unsigned int)VT); ID.AddPointer(SV); ID.AddInteger(SVOffset); ID.AddInteger(Alignment); @@ -2421,7 +2421,7 @@ AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(ISD::UNINDEXED); ID.AddInteger(isTrunc); - ID.AddInteger(SVT); + ID.AddInteger((unsigned int)SVT); ID.AddPointer(SV); ID.AddInteger(SVOffset); ID.AddInteger(Alignment); @@ -2448,7 +2448,7 @@ AddNodeIDNode(ID, ISD::STORE, VTs, Ops, 4); ID.AddInteger(AM); ID.AddInteger(ST->isTruncatingStore()); - ID.AddInteger(ST->getStoredVT()); + ID.AddInteger((unsigned int)(ST->getStoredVT())); ID.AddPointer(ST->getSrcValue()); ID.AddInteger(ST->getSrcValueOffset()); ID.AddInteger(ST->getAlignment()); From tonic at nondot.org Thu Sep 13 20:49:48 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 14 Sep 2007 01:49:48 -0000 Subject: [llvm-commits] [llvm] r41946 - /llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200709140149.l8E1nmjn012859@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Sep 13 20:49:48 2007 New Revision: 41946 URL: http://llvm.org/viewvc/llvm-project?rev=41946&view=rev Log: Merge from mainline for PR1639 Modified: llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp?rev=41946&r1=41945&r2=41946&view=diff ============================================================================== --- llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 13 20:49:48 2007 @@ -26,6 +26,7 @@ #include "llvm/Target/TargetData.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" @@ -493,8 +494,10 @@ } /// AllUsesOfValueWillTrapIfNull - Return true if all users of the specified -/// value will trap if the value is dynamically null. -static bool AllUsesOfValueWillTrapIfNull(Value *V) { +/// value will trap if the value is dynamically null. PHIs keeps track of any +/// phi nodes we've seen to avoid reprocessing them. +static bool AllUsesOfValueWillTrapIfNull(Value *V, + SmallPtrSet &PHIs) { for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI) if (isa(*UI)) { // Will trap. @@ -513,10 +516,15 @@ //cerr << "NONTRAPPING USE: " << **UI; return false; // Not calling the ptr } - } else if (CastInst *CI = dyn_cast(*UI)) { - if (!AllUsesOfValueWillTrapIfNull(CI)) return false; + } else if (BitCastInst *CI = dyn_cast(*UI)) { + if (!AllUsesOfValueWillTrapIfNull(CI, PHIs)) return false; } else if (GetElementPtrInst *GEPI = dyn_cast(*UI)) { - if (!AllUsesOfValueWillTrapIfNull(GEPI)) return false; + if (!AllUsesOfValueWillTrapIfNull(GEPI, PHIs)) return false; + } else if (PHINode *PN = dyn_cast(*UI)) { + // If we've already seen this phi node, ignore it, it has already been + // checked. + if (PHIs.insert(PN)) + return AllUsesOfValueWillTrapIfNull(PN, PHIs); } else if (isa(*UI) && isa(UI->getOperand(1))) { // Ignore setcc X, null @@ -533,7 +541,8 @@ static bool AllUsesOfLoadedValueWillTrapIfNull(GlobalVariable *GV) { for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end(); UI!=E; ++UI) if (LoadInst *LI = dyn_cast(*UI)) { - if (!AllUsesOfValueWillTrapIfNull(LI)) + SmallPtrSet PHIs; + if (!AllUsesOfValueWillTrapIfNull(LI, PHIs)) return false; } else if (isa(*UI)) { // Ignore stores to the global. @@ -802,7 +811,8 @@ /// like dereferencing the pointer, but not storing through the address, unless /// it is to the specified global. static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V, - GlobalVariable *GV) { + GlobalVariable *GV, + SmallPtrSet &PHIs) { for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI) if (isa(*UI) || isa(*UI)) { // Fine, ignore. @@ -810,9 +820,16 @@ if (SI->getOperand(0) == V && SI->getOperand(1) != GV) return false; // Storing the pointer itself... bad. // Otherwise, storing through it, or storing into GV... fine. - } else if (isa(*UI) || isa(*UI)) { - if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(cast(*UI),GV)) + } else if (isa(*UI) || isa(*UI) || + isa(*UI)) { + if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(cast(*UI), + GV, PHIs)) return false; + } else if (PHINode *PN = dyn_cast(*UI)) { + // PHIs are ok if all uses are ok. Don't infinitely recurse through PHI + // cycles. + if (PHIs.insert(PN)) + return ValueIsOnlyUsedLocallyOrStoredToOneGlobal(PN, GV, PHIs); } else { return false; } @@ -827,24 +844,31 @@ static void ReplaceUsesOfMallocWithGlobal(Instruction *Alloc, GlobalVariable *GV) { while (!Alloc->use_empty()) { - Instruction *U = Alloc->use_back(); + Instruction *U = cast(*Alloc->use_begin()); + Instruction *InsertPt = U; if (StoreInst *SI = dyn_cast(U)) { // If this is the store of the allocation into the global, remove it. if (SI->getOperand(1) == GV) { SI->eraseFromParent(); continue; } + } else if (PHINode *PN = dyn_cast(U)) { + // Insert the load in the corresponding predecessor, not right before the + // PHI. + unsigned PredNo = Alloc->use_begin().getOperandNo()/2; + InsertPt = PN->getIncomingBlock(PredNo)->getTerminator(); } // Insert a load from the global, and use it instead of the malloc. - Value *NL = new LoadInst(GV, GV->getName()+".val", U); + Value *NL = new LoadInst(GV, GV->getName()+".val", InsertPt); U->replaceUsesOfWith(Alloc, NL); } } /// GlobalLoadUsesSimpleEnoughForHeapSRA - If all users of values loaded from /// GV are simple enough to perform HeapSRA, return true. -static bool GlobalLoadUsesSimpleEnoughForHeapSRA(GlobalVariable *GV) { +static bool GlobalLoadUsesSimpleEnoughForHeapSRA(GlobalVariable *GV, + MallocInst *MI) { for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end(); UI != E; ++UI) if (LoadInst *LI = dyn_cast(*UI)) { @@ -860,77 +884,148 @@ } // getelementptr is also ok, but only a simple form. - GetElementPtrInst *GEPI = dyn_cast(*UI); - if (!GEPI) return false; + if (GetElementPtrInst *GEPI = dyn_cast(*UI)) { + // Must index into the array and into the struct. + if (GEPI->getNumOperands() < 3) + return false; + + // Otherwise the GEP is ok. + continue; + } - // Must index into the array and into the struct. - if (GEPI->getNumOperands() < 3) - return false; + if (PHINode *PN = dyn_cast(*UI)) { + // We have a phi of a load from the global. We can only handle this + // if the other PHI'd values are actually the same. In this case, + // the rewriter will just drop the phi entirely. + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) { + Value *IV = PN->getIncomingValue(i); + if (IV == LI) continue; // Trivial the same. + + // If the phi'd value is from the malloc that initializes the value, + // we can xform it. + if (IV == MI) continue; + + // Otherwise, we don't know what it is. + return false; + } + return true; + } - // Otherwise the GEP is ok. - continue; + // Otherwise we don't know what this is, not ok. + return false; } } return true; } -/// RewriteUsesOfLoadForHeapSRoA - We are performing Heap SRoA on a global. Ptr -/// is a value loaded from the global. Eliminate all uses of Ptr, making them -/// use FieldGlobals instead. All uses of loaded values satisfy -/// GlobalLoadUsesSimpleEnoughForHeapSRA. -static void RewriteUsesOfLoadForHeapSRoA(LoadInst *Ptr, - const std::vector &FieldGlobals) { - std::vector InsertedLoadsForPtr; - //InsertedLoadsForPtr.resize(FieldGlobals.size()); - while (!Ptr->use_empty()) { - Instruction *User = Ptr->use_back(); - - // If this is a comparison against null, handle it. - if (ICmpInst *SCI = dyn_cast(User)) { - assert(isa(SCI->getOperand(1))); - // If we have a setcc of the loaded pointer, we can use a setcc of any - // field. - Value *NPtr; - if (InsertedLoadsForPtr.empty()) { - NPtr = new LoadInst(FieldGlobals[0], Ptr->getName()+".f0", Ptr); - InsertedLoadsForPtr.push_back(Ptr); - } else { - NPtr = InsertedLoadsForPtr.back(); - } - - Value *New = new ICmpInst(SCI->getPredicate(), NPtr, - Constant::getNullValue(NPtr->getType()), - SCI->getName(), SCI); - SCI->replaceAllUsesWith(New); - SCI->eraseFromParent(); - continue; +/// GetHeapSROALoad - Return the load for the specified field of the HeapSROA'd +/// value, lazily creating it on demand. +static Value *GetHeapSROALoad(Instruction *Load, unsigned FieldNo, + const std::vector &FieldGlobals, + std::vector &InsertedLoadsForPtr) { + if (InsertedLoadsForPtr.size() <= FieldNo) + InsertedLoadsForPtr.resize(FieldNo+1); + if (InsertedLoadsForPtr[FieldNo] == 0) + InsertedLoadsForPtr[FieldNo] = new LoadInst(FieldGlobals[FieldNo], + Load->getName()+".f" + + utostr(FieldNo), Load); + return InsertedLoadsForPtr[FieldNo]; +} + +/// RewriteHeapSROALoadUser - Given a load instruction and a value derived from +/// the load, rewrite the derived value to use the HeapSRoA'd load. +static void RewriteHeapSROALoadUser(LoadInst *Load, Instruction *LoadUser, + const std::vector &FieldGlobals, + std::vector &InsertedLoadsForPtr) { + // If this is a comparison against null, handle it. + if (ICmpInst *SCI = dyn_cast(LoadUser)) { + assert(isa(SCI->getOperand(1))); + // If we have a setcc of the loaded pointer, we can use a setcc of any + // field. + Value *NPtr; + if (InsertedLoadsForPtr.empty()) { + NPtr = GetHeapSROALoad(Load, 0, FieldGlobals, InsertedLoadsForPtr); + } else { + NPtr = InsertedLoadsForPtr.back(); } - // Otherwise, this should be: 'getelementptr Ptr, Idx, uint FieldNo ...' - GetElementPtrInst *GEPI = cast(User); + Value *New = new ICmpInst(SCI->getPredicate(), NPtr, + Constant::getNullValue(NPtr->getType()), + SCI->getName(), SCI); + SCI->replaceAllUsesWith(New); + SCI->eraseFromParent(); + return; + } + + // Handle 'getelementptr Ptr, Idx, uint FieldNo ...' + if (GetElementPtrInst *GEPI = dyn_cast(LoadUser)) { assert(GEPI->getNumOperands() >= 3 && isa(GEPI->getOperand(2)) && "Unexpected GEPI!"); - + // Load the pointer for this field. unsigned FieldNo = cast(GEPI->getOperand(2))->getZExtValue(); - if (InsertedLoadsForPtr.size() <= FieldNo) - InsertedLoadsForPtr.resize(FieldNo+1); - if (InsertedLoadsForPtr[FieldNo] == 0) - InsertedLoadsForPtr[FieldNo] = new LoadInst(FieldGlobals[FieldNo], - Ptr->getName()+".f" + - utostr(FieldNo), Ptr); - Value *NewPtr = InsertedLoadsForPtr[FieldNo]; - + Value *NewPtr = GetHeapSROALoad(Load, FieldNo, + FieldGlobals, InsertedLoadsForPtr); + // Create the new GEP idx vector. SmallVector GEPIdx; GEPIdx.push_back(GEPI->getOperand(1)); GEPIdx.append(GEPI->op_begin()+3, GEPI->op_end()); - + Value *NGEPI = new GetElementPtrInst(NewPtr, GEPIdx.begin(), GEPIdx.end(), GEPI->getName(), GEPI); GEPI->replaceAllUsesWith(NGEPI); GEPI->eraseFromParent(); + return; + } + + // Handle PHI nodes. PHI nodes must be merging in the same values, plus + // potentially the original malloc. Insert phi nodes for each field, then + // process uses of the PHI. + PHINode *PN = cast(LoadUser); + std::vector PHIsForField; + PHIsForField.resize(FieldGlobals.size()); + for (unsigned i = 0, e = FieldGlobals.size(); i != e; ++i) { + Value *LoadV = GetHeapSROALoad(Load, i, FieldGlobals, InsertedLoadsForPtr); + + PHINode *FieldPN = new PHINode(LoadV->getType(), + PN->getName()+"."+utostr(i), PN); + // Fill in the predecessor values. + for (unsigned pred = 0, e = PN->getNumIncomingValues(); pred != e; ++pred) { + // Each predecessor either uses the load or the original malloc. + Value *InVal = PN->getIncomingValue(pred); + BasicBlock *BB = PN->getIncomingBlock(pred); + Value *NewVal; + if (isa(InVal)) { + // Insert a reload from the global in the predecessor. + NewVal = GetHeapSROALoad(BB->getTerminator(), i, FieldGlobals, + PHIsForField); + } else { + NewVal = InsertedLoadsForPtr[i]; + } + FieldPN->addIncoming(NewVal, BB); + } + PHIsForField[i] = FieldPN; } + + // Since PHIsForField specifies a phi for every input value, the lazy inserter + // will never insert a load. + while (!PN->use_empty()) + RewriteHeapSROALoadUser(Load, PN->use_back(), FieldGlobals, PHIsForField); + PN->eraseFromParent(); +} + +/// RewriteUsesOfLoadForHeapSRoA - We are performing Heap SRoA on a global. Ptr +/// is a value loaded from the global. Eliminate all uses of Ptr, making them +/// use FieldGlobals instead. All uses of loaded values satisfy +/// GlobalLoadUsesSimpleEnoughForHeapSRA. +static void RewriteUsesOfLoadForHeapSRoA(LoadInst *Load, + const std::vector &FieldGlobals) { + std::vector InsertedLoadsForPtr; + //InsertedLoadsForPtr.resize(FieldGlobals.size()); + while (!Load->use_empty()) + RewriteHeapSROALoadUser(Load, Load->use_back(), + FieldGlobals, InsertedLoadsForPtr); } /// PerformHeapAllocSRoA - MI is an allocation of an array of structures. Break @@ -1116,8 +1211,11 @@ // malloc to be stored into the specified global, loaded setcc'd, and // GEP'd. These are all things we could transform to using the global // for. - if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(MI, GV)) - return false; + { + SmallPtrSet PHIs; + if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(MI, GV, PHIs)) + return false; + } // If we have a global that is only initialized with a fixed size malloc, @@ -1143,7 +1241,7 @@ // This the structure has an unreasonable number of fields, leave it // alone. if (AllocTy->getNumElements() <= 16 && AllocTy->getNumElements() > 0 && - GlobalLoadUsesSimpleEnoughForHeapSRA(GV)) { + GlobalLoadUsesSimpleEnoughForHeapSRA(GV, MI)) { GVI = PerformHeapAllocSRoA(GV, MI); return true; } From evan.cheng at apple.com Thu Sep 13 20:57:02 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 14 Sep 2007 01:57:02 -0000 Subject: [llvm-commits] [llvm] r41947 - /llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Message-ID: <200709140157.l8E1v2tf013234@zion.cs.uiuc.edu> Author: evancheng Date: Thu Sep 13 20:57:02 2007 New Revision: 41947 URL: http://llvm.org/viewvc/llvm-project?rev=41947&view=rev Log: Fix comments. Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=41947&r1=41946&r2=41947&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Thu Sep 13 20:57:02 2007 @@ -157,8 +157,8 @@ .addReg(PPC::R0, false, false, true), FrameIdx); } else if (RC == PPC::VRRCRegisterClass) { // We don't have indexed addressing for vector loads. Emit: - // R11 = ADDI FI# - // Dest = LVX R0, R11 + // R0 = ADDI FI# + // STVX VAL, 0, R0 // // FIXME: We use R0 here, because it isn't available for RA. addFrameReference(BuildMI(MBB, MI, TII.get(PPC::ADDI), PPC::R0), @@ -210,8 +210,8 @@ BuildMI(MBB, MI, TII.get(PPC::MTCRF), DestReg).addReg(PPC::R0); } else if (RC == PPC::VRRCRegisterClass) { // We don't have indexed addressing for vector loads. Emit: - // R11 = ADDI FI# - // Dest = LVX R0, R11 + // R0 = ADDI FI# + // Dest = LVX 0, R0 // // FIXME: We use R0 here, because it isn't available for RA. addFrameReference(BuildMI(MBB, MI, TII.get(PPC::ADDI), PPC::R0), From sabre at nondot.org Thu Sep 13 22:07:25 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 14 Sep 2007 03:07:25 -0000 Subject: [llvm-commits] [llvm] r41949 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200709140307.l8E37QnV017438@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 13 22:07:24 2007 New Revision: 41949 URL: http://llvm.org/viewvc/llvm-project?rev=41949&view=rev Log: silence a bogus gcc warning. Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=41949&r1=41948&r2=41949&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Thu Sep 13 22:07:24 2007 @@ -7861,7 +7861,7 @@ if (const ParamAttrsList *NestAttrs = NestFTy->getParamAttrs()) { unsigned NestIdx = 1; const Type *NestTy = 0; - uint16_t NestAttr; + uint16_t NestAttr = 0; Instruction *Caller = CS.getInstruction(); From sabre at nondot.org Thu Sep 13 22:41:22 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 14 Sep 2007 03:41:22 -0000 Subject: [llvm-commits] [llvm] r41950 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200709140341.l8E3fMOl019045@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 13 22:41:21 2007 New Revision: 41950 URL: http://llvm.org/viewvc/llvm-project?rev=41950&view=rev Log: Fix a logic error in ValueIsOnlyUsedLocallyOrStoredToOneGlobal that caused miscompilation of 188.ammp. Reject select and bitcast in ValueIsOnlyUsedLocallyOrStoredToOneGlobal because RewriteHeapSROALoadUser can't handle it. Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=41950&r1=41949&r2=41950&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 13 22:41:21 2007 @@ -813,15 +813,14 @@ static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V, GlobalVariable *GV, SmallPtrSet &PHIs) { - for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI) + for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI) if (isa(*UI) || isa(*UI)) { // Fine, ignore. } else if (StoreInst *SI = dyn_cast(*UI)) { if (SI->getOperand(0) == V && SI->getOperand(1) != GV) return false; // Storing the pointer itself... bad. // Otherwise, storing through it, or storing into GV... fine. - } else if (isa(*UI) || isa(*UI) || - isa(*UI)) { + } else if (isa(*UI)) { if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(cast(*UI), GV, PHIs)) return false; @@ -829,7 +828,8 @@ // PHIs are ok if all uses are ok. Don't infinitely recurse through PHI // cycles. if (PHIs.insert(PN)) - return ValueIsOnlyUsedLocallyOrStoredToOneGlobal(PN, GV, PHIs); + if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(PN, GV, PHIs)) + return false; } else { return false; } From tonic at nondot.org Thu Sep 13 22:43:40 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 14 Sep 2007 03:43:40 -0000 Subject: [llvm-commits] [llvm] r41951 - /llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200709140343.l8E3heUs019193@zion.cs.uiuc.edu> Author: tbrethou Date: Thu Sep 13 22:43:40 2007 New Revision: 41951 URL: http://llvm.org/viewvc/llvm-project?rev=41951&view=rev Log: Merge from mainline. Modified: llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp Modified: llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp?rev=41951&r1=41950&r2=41951&view=diff ============================================================================== --- llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/branches/release_21/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 13 22:43:40 2007 @@ -813,15 +813,14 @@ static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V, GlobalVariable *GV, SmallPtrSet &PHIs) { - for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI) + for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI) if (isa(*UI) || isa(*UI)) { // Fine, ignore. } else if (StoreInst *SI = dyn_cast(*UI)) { if (SI->getOperand(0) == V && SI->getOperand(1) != GV) return false; // Storing the pointer itself... bad. // Otherwise, storing through it, or storing into GV... fine. - } else if (isa(*UI) || isa(*UI) || - isa(*UI)) { + } else if (isa(*UI)) { if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(cast(*UI), GV, PHIs)) return false; @@ -829,7 +828,8 @@ // PHIs are ok if all uses are ok. Don't infinitely recurse through PHI // cycles. if (PHIs.insert(PN)) - return ValueIsOnlyUsedLocallyOrStoredToOneGlobal(PN, GV, PHIs); + if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(PN, GV, PHIs)) + return false; } else { return false; } From clattner at apple.com Thu Sep 13 23:15:20 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 13 Sep 2007 21:15:20 -0700 Subject: [llvm-commits] [llvm] r41938 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp In-Reply-To: <200709140113.l8E1Dth1010358@zion.cs.uiuc.edu> References: <200709140113.l8E1Dth1010358@zion.cs.uiuc.edu> Message-ID: <3AD27B4C-422B-4299-B610-123B4B600C19@apple.com> On Sep 13, 2007, at 6:13 PM, Bill Wendling wrote: > Author: void > Date: Thu Sep 13 20:13:55 2007 > New Revision: 41938 > > URL: http://llvm.org/viewvc/llvm-project?rev=41938&view=rev > Log: > Temporary reverting r41817 > (http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- > Mon-20070910/053370.html). It's > causing SPASS to fail. Thanks Bill. Tanya, this fixes the SPASS failures on PPC and X86, please merge into the 2.1 release when appropriate. -Chris > > Modified: > llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ > Scalar/LoopIndexSplit.cpp?rev=41938&r1=41937&r2=41938&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Thu Sep 13 > 20:13:55 2007 > @@ -336,24 +336,14 @@ > if (!CI) > return; > > - // FIXME > - if (CI->getPredicate() == ICmpInst::ICMP_EQ > - || CI->getPredicate() == ICmpInst::ICMP_NE) > - return; > - > + // FIXME > if (CI->getPredicate() == ICmpInst::ICMP_SGT > || CI->getPredicate() == ICmpInst::ICMP_UGT > || CI->getPredicate() == ICmpInst::ICMP_SGE > - || CI->getPredicate() == ICmpInst::ICMP_UGE) { > - > - BasicBlock *FirstSuccessor = BR->getSuccessor(0); > - // splitLoop() is expecting LT/LE as exit condition predicate. > - // Swap operands here if possible to meet this requirement. > - if (!L->contains(FirstSuccessor)) > - CI->swapOperands(); > - else > - return; > - } > + || CI->getPredicate() == ICmpInst::ICMP_UGE > + || CI->getPredicate() == ICmpInst::ICMP_EQ > + || CI->getPredicate() == ICmpInst::ICMP_NE) > + return; > > ExitCondition = CI; > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From tonic at nondot.org Fri Sep 14 00:08:13 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 14 Sep 2007 05:08:13 -0000 Subject: [llvm-commits] [llvm] r41952 - /llvm/branches/release_21/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709140508.l8E58DQX025123@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 14 00:08:12 2007 New Revision: 41952 URL: http://llvm.org/viewvc/llvm-project?rev=41952&view=rev Log: Merge from mainline. Modified: llvm/branches/release_21/lib/Transforms/Scalar/LoopIndexSplit.cpp Modified: llvm/branches/release_21/lib/Transforms/Scalar/LoopIndexSplit.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/Transforms/Scalar/LoopIndexSplit.cpp?rev=41952&r1=41951&r2=41952&view=diff ============================================================================== --- llvm/branches/release_21/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/branches/release_21/lib/Transforms/Scalar/LoopIndexSplit.cpp Fri Sep 14 00:08:12 2007 @@ -336,24 +336,14 @@ if (!CI) return; - // FIXME - if (CI->getPredicate() == ICmpInst::ICMP_EQ - || CI->getPredicate() == ICmpInst::ICMP_NE) - return; - + // FIXME if (CI->getPredicate() == ICmpInst::ICMP_SGT || CI->getPredicate() == ICmpInst::ICMP_UGT || CI->getPredicate() == ICmpInst::ICMP_SGE - || CI->getPredicate() == ICmpInst::ICMP_UGE) { - - BasicBlock *FirstSuccessor = BR->getSuccessor(0); - // splitLoop() is expecting LT/LE as exit condition predicate. - // Swap operands here if possible to meet this requirement. - if (!L->contains(FirstSuccessor)) - CI->swapOperands(); - else - return; - } + || CI->getPredicate() == ICmpInst::ICMP_UGE + || CI->getPredicate() == ICmpInst::ICMP_EQ + || CI->getPredicate() == ICmpInst::ICMP_NE) + return; ExitCondition = CI; From bruno.cardoso at gmail.com Fri Sep 14 10:32:42 2007 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Fri, 14 Sep 2007 12:32:42 -0300 Subject: [llvm-commits] [llvm] r41150 - /llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp In-Reply-To: <155630D4-E0B8-4C49-8F2B-8C49A3C0062F@apple.com> References: <200708180150.l7I1olg1001234@zion.cs.uiuc.edu> <155630D4-E0B8-4C49-8F2B-8C49A3C0062F@apple.com> Message-ID: <275e64e40709140832k3815abd9gbe2e4d93a38c3be4@mail.gmail.com> Hi Evan, Sorry, I was reviewing my commits and i only saw your email now. I'll change that! :) 2007/8/27, Evan Cheng : > Hi Bruno, > > Sparc backend also has a delay slot filler that does exactly the same > thing. Can you change this into a target independent pass instead > (then you just need to add a target hook to emit nop)? > > Evan > > On Aug 17, 2007, at 6:50 PM, Bruno Cardoso Lopes wrote: > > > Author: bruno > > Date: Fri Aug 17 20:50:47 2007 > > New Revision: 41150 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=41150&view=rev > > Log: > > A Pass to insert Nops on intructions with DelaySlot > > > > Added: > > llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp > > > > Added: llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp > > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp?rev=41150&view=auto > > > > = > > = > > = > > = > > = > > = > > = > > = > > ====================================================================== > > --- llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp (added) > > +++ llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp Fri Aug 17 > > 20:50:47 2007 > > @@ -0,0 +1,77 @@ > > +//===-- DelaySlotFiller.cpp - Mips delay slot filler > > ---------------------===// > > +// > > +// The LLVM Compiler Infrastructure > > +// > > +// This file was developed by Bruno Cardoso Lopes and is > > distributed under > > +// the University of Illinois Open Source License. See LICENSE.TXT > > for details. > > +// > > +// > > = > > = > > = > > ----------------------------------------------------------------------= > > ==// > > +// > > +// Simple pass to fills delay slots with NOPs. > > +// > > +// > > = > > = > > = > > ----------------------------------------------------------------------= > > ==// > > + > > +#define DEBUG_TYPE "delay-slot-filler" > > + > > +#include "Mips.h" > > +#include "MipsTargetMachine.h" > > +#include "llvm/CodeGen/MachineFunctionPass.h" > > +#include "llvm/CodeGen/MachineInstrBuilder.h" > > +#include "llvm/Target/TargetInstrInfo.h" > > +#include "llvm/ADT/Statistic.h" > > + > > +using namespace llvm; > > + > > +STATISTIC(FilledSlots, "Number of delay slots filled"); > > + > > +namespace { > > + struct Filler : public MachineFunctionPass { > > + > > + TargetMachine &TM; > > + const TargetInstrInfo *TII; > > + > > + static char ID; > > + Filler(TargetMachine &tm) > > + : MachineFunctionPass((intptr_t)&ID), TM(tm), > > TII(tm.getInstrInfo()) { } > > + > > + virtual const char *getPassName() const { > > + return "Mips Delay Slot Filler"; > > + } > > + > > + bool runOnMachineBasicBlock(MachineBasicBlock &MBB); > > + bool runOnMachineFunction(MachineFunction &F) { > > + bool Changed = false; > > + for (MachineFunction::iterator FI = F.begin(), FE = F.end(); > > + FI != FE; ++FI) > > + Changed |= runOnMachineBasicBlock(*FI); > > + return Changed; > > + } > > + > > + }; > > + char Filler::ID = 0; > > +} // end of anonymous namespace > > + > > +/// runOnMachineBasicBlock - Fill in delay slots for the given > > basic block. > > +/// Currently, we fill delay slots with NOPs. We assume there is > > only one > > +/// delay slot per delayed instruction. > > +bool Filler:: > > +runOnMachineBasicBlock(MachineBasicBlock &MBB) > > +{ > > + bool Changed = false; > > + for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); > > ++I) > > + if (TII->hasDelaySlot(I->getOpcode())) { > > + MachineBasicBlock::iterator J = I; > > + ++J; > > + BuildMI(MBB, J, TII->get(Mips::NOP)); > > + ++FilledSlots; > > + Changed = true; > > + } > > + return Changed; > > +} > > + > > +/// createMipsDelaySlotFillerPass - Returns a pass that fills in > > delay > > +/// slots in Mips MachineFunctions > > +FunctionPass *llvm::createMipsDelaySlotFillerPass(MipsTargetMachine > > &tm) { > > + return new Filler(tm); > > +} > > + > > > > > > _______________________________________________ > > 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 > -- Bruno Cardoso Lopes http://www.brunocardoso.org "The Man in Black fled across the desert and the gunslinger followed" - Childe Roland to the Dark Tower Came From rafael.espindola at gmail.com Fri Sep 14 10:48:25 2007 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Fri, 14 Sep 2007 15:48:25 -0000 Subject: [llvm-commits] [llvm] r41953 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h test/CodeGen/X86/byval.ll Message-ID: <200709141548.l8EFmaJr017349@zion.cs.uiuc.edu> Author: rafael Date: Fri Sep 14 10:48:13 2007 New Revision: 41953 URL: http://llvm.org/viewvc/llvm-project?rev=41953&view=rev Log: Add support for functions with byval arguments on x86 Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/test/CodeGen/X86/byval.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=41953&r1=41952&r2=41953&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Sep 14 10:48:13 2007 @@ -694,6 +694,23 @@ return VReg; } +SDOperand X86TargetLowering::LowerMemArgument(SDOperand Op, SelectionDAG &DAG, + const CCValAssign &VA, + MachineFrameInfo *MFI, + SDOperand Root, unsigned i) { + // Create the nodes corresponding to a load from this parameter slot. + int FI = MFI->CreateFixedObject(MVT::getSizeInBits(VA.getValVT())/8, + VA.getLocMemOffset()); + SDOperand FIN = DAG.getFrameIndex(FI, getPointerTy()); + + unsigned Flags = cast(Op.getOperand(3 + i))->getValue(); + + if (Flags & ISD::ParamFlags::ByVal) + return FIN; + else + return DAG.getLoad(VA.getValVT(), Root, FIN, NULL, 0); +} + SDOperand X86TargetLowering::LowerCCCArguments(SDOperand Op, SelectionDAG &DAG, bool isStdCall) { unsigned NumArgs = Op.Val->getNumValues() - 1; @@ -747,12 +764,7 @@ ArgValues.push_back(ArgValue); } else { assert(VA.isMemLoc()); - - // Create the nodes corresponding to a load from this parameter slot. - int FI = MFI->CreateFixedObject(MVT::getSizeInBits(VA.getValVT())/8, - VA.getLocMemOffset()); - SDOperand FIN = DAG.getFrameIndex(FI, getPointerTy()); - ArgValues.push_back(DAG.getLoad(VA.getValVT(), Root, FIN, NULL, 0)); + ArgValues.push_back(LowerMemArgument(Op, DAG, VA, MFI, Root, i)); } } @@ -1279,17 +1291,7 @@ ArgValues.push_back(ArgValue); } else { assert(VA.isMemLoc()); - - // Create the nodes corresponding to a load from this parameter slot. - int FI = MFI->CreateFixedObject(MVT::getSizeInBits(VA.getValVT())/8, - VA.getLocMemOffset()); - SDOperand FIN = DAG.getFrameIndex(FI, getPointerTy()); - - unsigned Flags = cast(Op.getOperand(3 + i))->getValue(); - if (Flags & ISD::ParamFlags::ByVal) - ArgValues.push_back(FIN); - else - ArgValues.push_back(DAG.getLoad(VA.getValVT(), Root, FIN, NULL, 0)); + ArgValues.push_back(LowerMemArgument(Op, DAG, VA, MFI, Root, i)); } } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=41953&r1=41952&r2=41953&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Fri Sep 14 10:48:13 2007 @@ -380,6 +380,10 @@ unsigned CallingConv, SelectionDAG &DAG); + SDOperand LowerMemArgument(SDOperand Op, SelectionDAG &DAG, + const CCValAssign &VA, MachineFrameInfo *MFI, + SDOperand Root, unsigned i); + SDOperand LowerMemOpCallTo(SDOperand Op, SelectionDAG &DAG, const SDOperand &StackPtr, const CCValAssign &VA, SDOperand Chain, Modified: llvm/trunk/test/CodeGen/X86/byval.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/byval.ll?rev=41953&r1=41952&r2=41953&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/byval.ll (original) +++ llvm/trunk/test/CodeGen/X86/byval.ll Fri Sep 14 10:48:13 2007 @@ -1,4 +1,7 @@ -; RUN: llvm-as < %s | llc -march=x86-64 | grep movq.*8.*rsp.*rax +; RUN: llvm-as < %s | llc -march=x86-64 | grep {movq 8(%rsp), %rax} +; RUN: llvm-as < %s | llc -march=x86 > %t +; RUN: grep {movl 8(%esp), %edx} %t +; RUN: grep {movl 4(%esp), %eax} %t %struct.s = type { i64, i64, i64 } From evan.cheng at apple.com Fri Sep 14 11:43:54 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 14 Sep 2007 09:43:54 -0700 Subject: [llvm-commits] [llvm] r41150 - /llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp In-Reply-To: <275e64e40709140832k3815abd9gbe2e4d93a38c3be4@mail.gmail.com> References: <200708180150.l7I1olg1001234@zion.cs.uiuc.edu> <155630D4-E0B8-4C49-8F2B-8C49A3C0062F@apple.com> <275e64e40709140832k3815abd9gbe2e4d93a38c3be4@mail.gmail.com> Message-ID: On Sep 14, 2007, at 8:32 AM, Bruno Cardoso Lopes wrote: > Hi Evan, > > Sorry, I was reviewing my commits and i only saw your email now. > I'll change that! :) Thanks! Evan > > 2007/8/27, Evan Cheng : >> Hi Bruno, >> >> Sparc backend also has a delay slot filler that does exactly the same >> thing. Can you change this into a target independent pass instead >> (then you just need to add a target hook to emit nop)? >> >> Evan >> >> On Aug 17, 2007, at 6:50 PM, Bruno Cardoso Lopes wrote: >> >>> Author: bruno >>> Date: Fri Aug 17 20:50:47 2007 >>> New Revision: 41150 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=41150&view=rev >>> Log: >>> A Pass to insert Nops on intructions with DelaySlot >>> >>> Added: >>> llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp >>> >>> Added: llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp >>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ >>> Mips/MipsDelaySlotFiller.cpp?rev=41150&view=auto >>> >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> = >>> ==================================================================== >>> == >>> --- llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp (added) >>> +++ llvm/trunk/lib/Target/Mips/MipsDelaySlotFiller.cpp Fri Aug 17 >>> 20:50:47 2007 >>> @@ -0,0 +1,77 @@ >>> +//===-- DelaySlotFiller.cpp - Mips delay slot filler >>> ---------------------===// >>> +// >>> +// The LLVM Compiler Infrastructure >>> +// >>> +// This file was developed by Bruno Cardoso Lopes and is >>> distributed under >>> +// the University of Illinois Open Source License. See LICENSE.TXT >>> for details. >>> +// >>> +// >>> = >>> = >>> = >>> -------------------------------------------------------------------- >>> --= >>> ==// >>> +// >>> +// Simple pass to fills delay slots with NOPs. >>> +// >>> +// >>> = >>> = >>> = >>> -------------------------------------------------------------------- >>> --= >>> ==// >>> + >>> +#define DEBUG_TYPE "delay-slot-filler" >>> + >>> +#include "Mips.h" >>> +#include "MipsTargetMachine.h" >>> +#include "llvm/CodeGen/MachineFunctionPass.h" >>> +#include "llvm/CodeGen/MachineInstrBuilder.h" >>> +#include "llvm/Target/TargetInstrInfo.h" >>> +#include "llvm/ADT/Statistic.h" >>> + >>> +using namespace llvm; >>> + >>> +STATISTIC(FilledSlots, "Number of delay slots filled"); >>> + >>> +namespace { >>> + struct Filler : public MachineFunctionPass { >>> + >>> + TargetMachine &TM; >>> + const TargetInstrInfo *TII; >>> + >>> + static char ID; >>> + Filler(TargetMachine &tm) >>> + : MachineFunctionPass((intptr_t)&ID), TM(tm), >>> TII(tm.getInstrInfo()) { } >>> + >>> + virtual const char *getPassName() const { >>> + return "Mips Delay Slot Filler"; >>> + } >>> + >>> + bool runOnMachineBasicBlock(MachineBasicBlock &MBB); >>> + bool runOnMachineFunction(MachineFunction &F) { >>> + bool Changed = false; >>> + for (MachineFunction::iterator FI = F.begin(), FE = F.end(); >>> + FI != FE; ++FI) >>> + Changed |= runOnMachineBasicBlock(*FI); >>> + return Changed; >>> + } >>> + >>> + }; >>> + char Filler::ID = 0; >>> +} // end of anonymous namespace >>> + >>> +/// runOnMachineBasicBlock - Fill in delay slots for the given >>> basic block. >>> +/// Currently, we fill delay slots with NOPs. We assume there is >>> only one >>> +/// delay slot per delayed instruction. >>> +bool Filler:: >>> +runOnMachineBasicBlock(MachineBasicBlock &MBB) >>> +{ >>> + bool Changed = false; >>> + for (MachineBasicBlock::iterator I = MBB.begin(); I != MBB.end(); >>> ++I) >>> + if (TII->hasDelaySlot(I->getOpcode())) { >>> + MachineBasicBlock::iterator J = I; >>> + ++J; >>> + BuildMI(MBB, J, TII->get(Mips::NOP)); >>> + ++FilledSlots; >>> + Changed = true; >>> + } >>> + return Changed; >>> +} >>> + >>> +/// createMipsDelaySlotFillerPass - Returns a pass that fills in >>> delay >>> +/// slots in Mips MachineFunctions >>> +FunctionPass *llvm::createMipsDelaySlotFillerPass(MipsTargetMachine >>> &tm) { >>> + return new Filler(tm); >>> +} >>> + >>> >>> >>> _______________________________________________ >>> 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 >> > > > -- > Bruno Cardoso Lopes > http://www.brunocardoso.org > > "The Man in Black fled across the desert and the gunslinger followed" > - Childe Roland to the Dark Tower Came > _______________________________________________ > 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 Sep 14 11:46:17 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 14 Sep 2007 09:46:17 -0700 Subject: [llvm-commits] [llvm] r41775 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86InstrX86-64.td test/CodeGen/X86/zero-remat.ll In-Reply-To: <20070910204829.GQ4760@village.us.cray.com> References: <20070910204829.GQ4760@village.us.cray.com> Message-ID: <3336B30F-1F9A-44E9-A3C3-FC5EEFD85D4A@apple.com> On Sep 10, 2007, at 1:48 PM, Dan Gohman wrote: >> Hi Dan, >> >> This is not safe because xor will clobber flags. It's a >> miscompilation >> if the user of the rematerialized value is a conditional move (e.g. >> cmovne). > > Thanks for spotting that! > >> The current fix is to X86RegisterInfo::reMaterialize() should >> rematerialize it as a move instruction. > > Are you saying such a fix exists already, or that this is how a fix > should work? If the latter, I'd prefer to just revert the change to > the instructions that use xor so that they are not marked > rematerializable for now (though the ones that use pxor/xorps/xorpd > are ok). s/current/correct :-) I've already implemented it though. Why do you prefer to revert the change? Evan > > Dan > > -- > Dan Gohman, Cray Inc. > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From criswell at cs.uiuc.edu Fri Sep 14 12:33:43 2007 From: criswell at cs.uiuc.edu (John Criswell) Date: Fri, 14 Sep 2007 12:33:43 -0500 Subject: [llvm-commits] CVS: llvm-www/pubs/2007-SOSP-SVA.pdf Message-ID: <200709141733.MAA05888@choi.cs.uiuc.edu> Changes in directory llvm-www/pubs: 2007-SOSP-SVA.pdf added (r1.1) --- Log message: SOSP 2007 paper. --- Diffs of the changes: (+0 -0) 2007-SOSP-SVA.pdf | 0 1 files changed Index: llvm-www/pubs/2007-SOSP-SVA.pdf From dalej at apple.com Fri Sep 14 13:51:50 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 14 Sep 2007 18:51:50 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41955 - in /llvm-gcc-4.0/trunk/gcc: llvm-convert.cpp llvm-types.cpp Message-ID: <200709141851.l8EIpps5023237@zion.cs.uiuc.edu> Author: johannes Date: Fri Sep 14 13:51:50 2007 New Revision: 41955 URL: http://llvm.org/viewvc/llvm-project?rev=41955&view=rev Log: Handle x86 long double in conversions. Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=41955&r1=41954&r2=41955&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Fri Sep 14 13:51:50 2007 @@ -5569,31 +5569,55 @@ int UArr[2]; double V; }; - REAL_VALUE_TO_TARGET_DOUBLE(TREE_REAL_CST(exp), RealArr); - - // Here's how this works: - // REAL_VALUE_TO_TARGET_DOUBLE() will generate the floating point number - // as an array of integers in the hosts's representation. Each integer - // in the array will hold 32 bits of the result REGARDLESS OF THE HOST'S - // INTEGER SIZE. - // - // This, then, makes the conversion pretty simple. The tricky part is - // getting the byte ordering correct and make sure you don't print any - // more than 32 bits per integer on platforms with ints > 32 bits. - // - bool HostBigEndian = false; + if (Ty==Type::FloatTy || Ty==Type::DoubleTy) { + REAL_VALUE_TO_TARGET_DOUBLE(TREE_REAL_CST(exp), RealArr); + + // Here's how this works: + // REAL_VALUE_TO_TARGET_DOUBLE() will generate the floating point number + // as an array of integers in the hosts's representation. Each integer + // in the array will hold 32 bits of the result REGARDLESS OF THE HOST'S + // INTEGER SIZE. + // + // This, then, makes the conversion pretty simple. The tricky part is + // getting the byte ordering correct and make sure you don't print any + // more than 32 bits per integer on platforms with ints > 32 bits. + // + bool HostBigEndian = false; #ifdef HOST_WORDS_BIG_ENDIAN - HostBigEndian = true; + HostBigEndian = true; #endif - - UArr[0] = RealArr[0]; // Long -> int convert - UArr[1] = RealArr[1]; - if (WORDS_BIG_ENDIAN != HostBigEndian) - std::swap(UArr[0], UArr[1]); - - return ConstantFP::get(Ty, Ty==Type::FloatTy ? APFloat((float)V) - : APFloat(V)); + UArr[0] = RealArr[0]; // Long -> int convert + UArr[1] = RealArr[1]; + + if (WORDS_BIG_ENDIAN != HostBigEndian) + std::swap(UArr[0], UArr[1]); + + return ConstantFP::get(Ty, Ty==Type::FloatTy ? APFloat((float)V) + : APFloat(V)); + } else if (Ty==Type::X86_FP80Ty) { + long RealArr[4]; + uint64_t UArr[2]; + REAL_VALUE_TO_TARGET_LONG_DOUBLE(TREE_REAL_CST(exp), RealArr); + + bool HostBigEndian = false; +#ifdef HOST_WORDS_BIG_ENDIAN + HostBigEndian = true; +#endif + + if (WORDS_BIG_ENDIAN != HostBigEndian) { + // FIXME + } else { + UArr[0] = ((uint64_t)((uint16_t)RealArr[2]) << 48) | + ((uint64_t)((uint32_t)RealArr[1]) << 16) | + ((uint64_t)((uint16_t)(RealArr[0] >> 16))); + UArr[1] = (uint16_t)RealArr[0]; + + return ConstantFP::get(Ty, APFloat(APInt(80, 2, UArr))); + } + } + assert(0 && "Floating point type not handled yet"); + return 0; // outwit compiler warning } Constant *TreeConstantToLLVM::ConvertVECTOR_CST(tree exp) { Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=41955&r1=41954&r2=41955&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Fri Sep 14 13:51:50 2007 @@ -698,6 +698,7 @@ abort(); case 32: return SET_TYPE_LLVM(type, Type::FloatTy); case 64: return SET_TYPE_LLVM(type, Type::DoubleTy); + case 80: return SET_TYPE_LLVM(type, Type::X86_FP80Ty); case 128: // 128-bit long doubles map onto { double, double }. const Type *Ty = Type::DoubleTy; From djg at cray.com Fri Sep 14 15:04:35 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 14 Sep 2007 15:04:35 -0500 Subject: [llvm-commits] [llvm] r41775 - in /llvm/trunk: lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86InstrX86-64.td test/CodeGen/X86/zero-remat.ll Message-ID: <20070914200435.GB10864@village.us.cray.com> >> Are you saying such a fix exists already, or that this is how a fix >> should work? If the latter, I'd prefer to just revert the change to >> the instructions that use xor so that they are not marked >> rematerializable for now (though the ones that use pxor/xorps/xorpd >> are ok). > > s/current/correct :-) I've already implemented it though. Ok, thanks! > Why do you prefer to revert the change? I don't, now that the fix is in. Dan -- Dan Gohman, Cray Inc. From djg at cray.com Fri Sep 14 15:08:20 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 14 Sep 2007 20:08:20 -0000 Subject: [llvm-commits] [llvm] r41956 - in /llvm/trunk: include/llvm/CodeGen/MachineInstr.h lib/CodeGen/MachineInstr.cpp lib/Support/APFloat.cpp lib/System/Unix/Program.inc utils/TableGen/CodeGenRegisters.h Message-ID: <200709142008.l8EK8KL1025113@zion.cs.uiuc.edu> Author: djg Date: Fri Sep 14 15:08:19 2007 New Revision: 41956 URL: http://llvm.org/viewvc/llvm-project?rev=41956&view=rev Log: Remove spurious consts. This fixes warnings with compilers that are strict about such things. Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/lib/Support/APFloat.cpp llvm/trunk/lib/System/Unix/Program.inc llvm/trunk/utils/TableGen/CodeGenRegisters.h Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=41956&r1=41955&r2=41956&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Fri Sep 14 15:08:19 2007 @@ -363,7 +363,7 @@ /// getOpcode - Returns the opcode of this MachineInstr. /// - const int getOpcode() const; + int getOpcode() const; /// Access to explicit operands of the instruction. /// Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=41956&r1=41955&r2=41956&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Fri Sep 14 15:08:19 2007 @@ -116,7 +116,7 @@ /// getOpcode - Returns the opcode of this MachineInstr. /// -const int MachineInstr::getOpcode() const { +int MachineInstr::getOpcode() const { return TID->Opcode; } Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=41956&r1=41955&r2=41956&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Fri Sep 14 15:08:19 2007 @@ -1629,7 +1629,7 @@ APInt APFloat::convertDoubleAPFloatToAPInt() const { - assert(semantics == (const llvm::fltSemantics* const)&IEEEdouble); + assert(semantics == (const llvm::fltSemantics*)&IEEEdouble); assert (partCount()==1); uint64_t myexponent, mysignificand; @@ -1659,7 +1659,7 @@ APInt APFloat::convertFloatAPFloatToAPInt() const { - assert(semantics == (const llvm::fltSemantics* const)&IEEEsingle); + assert(semantics == (const llvm::fltSemantics*)&IEEEsingle); assert (partCount()==1); uint32_t myexponent, mysignificand; Modified: llvm/trunk/lib/System/Unix/Program.inc URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Program.inc?rev=41956&r1=41955&r2=41956&view=diff ============================================================================== --- llvm/trunk/lib/System/Unix/Program.inc (original) +++ llvm/trunk/lib/System/Unix/Program.inc Fri Sep 14 15:08:19 2007 @@ -196,9 +196,9 @@ // Execute! if (envp != 0) - execve (path.c_str(), (char** const)args, (char**)envp); + execve (path.c_str(), (char**)args, (char**)envp); else - execv (path.c_str(), (char** const)args); + execv (path.c_str(), (char**)args); // If the execve() failed, we should exit and let the parent pick up // our non-zero exit status. exit (errno); Modified: llvm/trunk/utils/TableGen/CodeGenRegisters.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenRegisters.h?rev=41956&r1=41955&r2=41956&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenRegisters.h (original) +++ llvm/trunk/utils/TableGen/CodeGenRegisters.h Fri Sep 14 15:08:19 2007 @@ -45,7 +45,7 @@ const std::vector &getValueTypes() const { return VTs; } unsigned getNumValueTypes() const { return VTs.size(); } - const MVT::ValueType getValueTypeNum(unsigned VTNum) const { + MVT::ValueType getValueTypeNum(unsigned VTNum) const { if (VTNum < VTs.size()) return VTs[VTNum]; assert(0 && "VTNum greater than number of ValueTypes in RegClass!"); From djg at cray.com Fri Sep 14 15:11:41 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 14 Sep 2007 20:11:41 -0000 Subject: [llvm-commits] [llvm] r41957 - /llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Message-ID: <200709142011.l8EKBftw025268@zion.cs.uiuc.edu> Author: djg Date: Fri Sep 14 15:11:40 2007 New Revision: 41957 URL: http://llvm.org/viewvc/llvm-project?rev=41957&view=rev Log: Change "tmp." to "tmp" for temporaries created by ScalarEvolutionExpander for consistency with many other transforms. Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Modified: llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp?rev=41957&r1=41956&r2=41957&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolutionExpander.cpp Fri Sep 14 15:11:40 2007 @@ -94,7 +94,7 @@ } // If we don't have - return BinaryOperator::create(Opcode, LHS, RHS, "tmp.", InsertPt); + return BinaryOperator::create(Opcode, LHS, RHS, "tmp", InsertPt); } Value *SCEVExpander::visitMulExpr(SCEVMulExpr *S) { From djg at cray.com Fri Sep 14 15:33:02 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 14 Sep 2007 20:33:02 -0000 Subject: [llvm-commits] [llvm] r41958 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/ lib/Target/ lib/Target/ARM/ lib/Target/PowerPC/ lib/Target/X86/ Message-ID: <200709142033.l8EKX3nO025812@zion.cs.uiuc.edu> Author: djg Date: Fri Sep 14 15:33:02 2007 New Revision: 41958 URL: http://llvm.org/viewvc/llvm-project?rev=41958&view=rev Log: Remove isReg, isImm, and isMBB, and change all their users to use isRegister, isImmediate, and isMachineBasicBlock, which are equivalent, and more popular. Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h llvm/trunk/include/llvm/CodeGen/MachineInstr.h llvm/trunk/lib/CodeGen/AsmPrinter.cpp llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/LiveVariables.cpp llvm/trunk/lib/CodeGen/LowerSubregs.cpp llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/lib/CodeGen/RegisterScavenging.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/trunk/lib/CodeGen/VirtRegMap.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPCBranchSelector.cpp llvm/trunk/lib/Target/TargetInstrInfo.cpp llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveVariables.h?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveVariables.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveVariables.h Fri Sep 14 15:33:02 2007 @@ -229,7 +229,7 @@ bool Removed = false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isKill() && MO.getReg() == reg) { + if (MO.isRegister() && MO.isKill() && MO.getReg() == reg) { MO.unsetIsKill(); Removed = true; break; @@ -266,7 +266,7 @@ bool Removed = false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isDef() && MO.getReg() == reg) { + if (MO.isRegister() && MO.isDef() && MO.getReg() == reg) { MO.unsetIsDead(); Removed = true; break; Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Fri Sep 14 15:33:02 2007 @@ -131,10 +131,6 @@ /// Accessors that tell you what kind of MachineOperand you're looking at. /// - bool isReg() const { return opType == MO_Register; } - bool isImm() const { return opType == MO_Immediate; } - bool isMBB() const { return opType == MO_MachineBasicBlock; } - bool isRegister() const { return opType == MO_Register; } bool isImmediate() const { return opType == MO_Immediate; } bool isMachineBasicBlock() const { return opType == MO_MachineBasicBlock; } @@ -145,12 +141,12 @@ bool isExternalSymbol() const { return opType == MO_ExternalSymbol; } int64_t getImm() const { - assert(isImm() && "Wrong MachineOperand accessor"); + assert(isImmediate() && "Wrong MachineOperand accessor"); return contents.immedVal; } int64_t getImmedValue() const { - assert(isImm() && "Wrong MachineOperand accessor"); + assert(isImmediate() && "Wrong MachineOperand accessor"); return contents.immedVal; } MachineBasicBlock *getMBB() const { @@ -257,11 +253,11 @@ } void setImmedValue(int64_t immVal) { - assert(isImm() && "Wrong MachineOperand mutator"); + assert(isImmediate() && "Wrong MachineOperand mutator"); contents.immedVal = immVal; } void setImm(int64_t immVal) { - assert(isImm() && "Wrong MachineOperand mutator"); + assert(isImmediate() && "Wrong MachineOperand mutator"); contents.immedVal = immVal; } Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Fri Sep 14 15:33:02 2007 @@ -982,7 +982,7 @@ // Count the number of register definitions. unsigned NumDefs = 0; - for (; MI->getOperand(NumDefs).isReg() && MI->getOperand(NumDefs).isDef(); + for (; MI->getOperand(NumDefs).isRegister() && MI->getOperand(NumDefs).isDef(); ++NumDefs) assert(NumDefs != NumOperands-1 && "No asm string?"); Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Sep 14 15:33:02 2007 @@ -413,7 +413,7 @@ bool HasUse = mop.isUse(); bool HasDef = mop.isDef(); for (unsigned j = i+1, e = MI->getNumOperands(); j != e; ++j) { - if (MI->getOperand(j).isReg() && + if (MI->getOperand(j).isRegister() && MI->getOperand(j).getReg() == li.reg) { MI->getOperand(j).setReg(NewVReg); HasUse |= MI->getOperand(j).isUse(); Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Fri Sep 14 15:33:02 2007 @@ -78,7 +78,7 @@ bool LiveVariables::KillsRegister(MachineInstr *MI, unsigned Reg) const { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isKill()) { + if (MO.isRegister() && MO.isKill()) { if ((MO.getReg() == Reg) || (MRegisterInfo::isPhysicalRegister(MO.getReg()) && MRegisterInfo::isPhysicalRegister(Reg) && @@ -92,7 +92,7 @@ bool LiveVariables::RegisterDefIsDead(MachineInstr *MI, unsigned Reg) const { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isDead()) { + if (MO.isRegister() && MO.isDead()) { if ((MO.getReg() == Reg) || (MRegisterInfo::isPhysicalRegister(MO.getReg()) && MRegisterInfo::isPhysicalRegister(Reg) && @@ -106,7 +106,7 @@ bool LiveVariables::ModifiesRegister(MachineInstr *MI, unsigned Reg) const { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isDef() && MO.getReg() == Reg) + if (MO.isRegister() && MO.isDef() && MO.getReg() == Reg) return true; } return false; @@ -190,7 +190,7 @@ bool Found = false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isUse()) { + if (MO.isRegister() && MO.isUse()) { unsigned Reg = MO.getReg(); if (!Reg) continue; @@ -221,7 +221,7 @@ bool Found = false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isDef()) { + if (MO.isRegister() && MO.isDef()) { unsigned Reg = MO.getReg(); if (!Reg) continue; @@ -614,7 +614,7 @@ void LiveVariables::removeVirtualRegistersKilled(MachineInstr *MI) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isKill()) { + if (MO.isRegister() && MO.isKill()) { MO.unsetIsKill(); unsigned Reg = MO.getReg(); if (MRegisterInfo::isVirtualRegister(Reg)) { @@ -630,7 +630,7 @@ void LiveVariables::removeVirtualRegistersDead(MachineInstr *MI) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isDead()) { + if (MO.isRegister() && MO.isDead()) { MO.unsetIsDead(); unsigned Reg = MO.getReg(); if (MRegisterInfo::isVirtualRegister(Reg)) { Modified: llvm/trunk/lib/CodeGen/LowerSubregs.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LowerSubregs.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LowerSubregs.cpp (original) +++ llvm/trunk/lib/CodeGen/LowerSubregs.cpp Fri Sep 14 15:33:02 2007 @@ -66,7 +66,7 @@ assert(MI->getOperand(0).isRegister() && MI->getOperand(0).isDef() && MI->getOperand(1).isRegister() && MI->getOperand(1).isUse() && - MI->getOperand(2).isImm() && "Malformed extract_subreg"); + MI->getOperand(2).isImmediate() && "Malformed extract_subreg"); unsigned SuperReg = MI->getOperand(1).getReg(); unsigned SubIdx = MI->getOperand(2).getImm(); @@ -113,7 +113,7 @@ if (MI->getNumOperands() == 3) { assert((MI->getOperand(0).isRegister() && MI->getOperand(0).isDef()) && (MI->getOperand(1).isRegister() && MI->getOperand(1).isUse()) && - MI->getOperand(2).isImm() && "Invalid extract_subreg"); + MI->getOperand(2).isImmediate() && "Invalid extract_subreg"); DstReg = MI->getOperand(0).getReg(); SrcReg = DstReg; InsReg = MI->getOperand(1).getReg(); @@ -122,7 +122,7 @@ assert((MI->getOperand(0).isRegister() && MI->getOperand(0).isDef()) && (MI->getOperand(1).isRegister() && MI->getOperand(1).isUse()) && (MI->getOperand(2).isRegister() && MI->getOperand(2).isUse()) && - MI->getOperand(3).isImm() && "Invalid extract_subreg"); + MI->getOperand(3).isImmediate() && "Invalid extract_subreg"); DstReg = MI->getOperand(0).getReg(); SrcReg = MI->getOperand(1).getReg(); InsReg = MI->getOperand(2).getReg(); Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Fri Sep 14 15:33:02 2007 @@ -188,7 +188,7 @@ int MachineInstr::findRegisterUseOperandIdx(unsigned Reg, bool isKill) const { for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { const MachineOperand &MO = getOperand(i); - if (MO.isReg() && MO.isUse() && MO.getReg() == Reg) + if (MO.isRegister() && MO.isUse() && MO.getReg() == Reg) if (!isKill || MO.isKill()) return i; } @@ -200,7 +200,7 @@ MachineOperand *MachineInstr::findRegisterDefOperand(unsigned Reg) { for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); - if (MO.isReg() && MO.isDef() && MO.getReg() == Reg) + if (MO.isRegister() && MO.isDef() && MO.getReg() == Reg) return &MO; } return NULL; @@ -225,7 +225,7 @@ void MachineInstr::copyKillDeadInfo(const MachineInstr *MI) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg() || (!MO.isKill() && !MO.isDead())) + if (!MO.isRegister() || (!MO.isKill() && !MO.isDead())) continue; for (unsigned j = 0, ee = getNumOperands(); j != ee; ++j) { MachineOperand &MOp = getOperand(j); @@ -248,7 +248,7 @@ if ((TID->OpInfo[i].Flags & M_PREDICATE_OPERAND)) { const MachineOperand &MO = MI->getOperand(i); // Predicated operands must be last operands. - if (MO.isReg()) + if (MO.isRegister()) addRegOperand(MO.getReg(), false); else { addImmOperand(MO.getImm()); @@ -319,7 +319,7 @@ unsigned StartOp = 0; // Specialize printing if op#0 is definition - if (getNumOperands() && getOperand(0).isReg() && getOperand(0).isDef()) { + if (getNumOperands() && getOperand(0).isRegister() && getOperand(0).isDef()) { ::print(getOperand(0), OS, TM); if (getOperand(0).isDead()) OS << ""; @@ -337,7 +337,7 @@ OS << " "; ::print(mop, OS, TM); - if (mop.isReg()) { + if (mop.isRegister()) { if (mop.isDef() || mop.isKill() || mop.isDead() || mop.isImplicit()) { OS << "<"; bool NeedComma = false; @@ -381,7 +381,7 @@ for (unsigned i = 0, N = getNumOperands(); i < N; i++) { os << "\t" << getOperand(i); - if (getOperand(i).isReg() && getOperand(i).isDef()) + if (getOperand(i).isRegister() && getOperand(i).isDef()) os << ""; } Modified: llvm/trunk/lib/CodeGen/RegisterScavenging.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegisterScavenging.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegisterScavenging.cpp (original) +++ llvm/trunk/lib/CodeGen/RegisterScavenging.cpp Fri Sep 14 15:33:02 2007 @@ -102,7 +102,7 @@ BitVector ChangedRegs(NumPhysRegs); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg() || !MO.isUse()) + if (!MO.isRegister() || !MO.isUse()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) @@ -125,7 +125,7 @@ const TargetInstrDescriptor *TID = MI->getInstrDescriptor(); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg() || !MO.isDef()) + if (!MO.isRegister() || !MO.isDef()) continue; unsigned Reg = MO.getReg(); // If it's dead upon def, then it is now free. @@ -155,7 +155,7 @@ const TargetInstrDescriptor *TID = MI->getInstrDescriptor(); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg() || !MO.isDef()) + if (!MO.isRegister() || !MO.isDef()) continue; // Skip two-address destination operand. if (TID->findTiedToSrcOperand(i) != -1) @@ -170,7 +170,7 @@ BitVector ChangedRegs(NumPhysRegs); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (!MO.isReg() || !MO.isUse()) + if (!MO.isRegister() || !MO.isUse()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) @@ -257,7 +257,7 @@ // Exclude all the registers being used by the instruction. for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) { MachineOperand &MO = I->getOperand(i); - if (MO.isReg()) + if (MO.isRegister()) Candidates.reset(MO.getReg()); } Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Fri Sep 14 15:33:02 2007 @@ -986,7 +986,7 @@ for (unsigned i = 0, NumOps = MI->getNumOperands(); i != NumOps; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isUse() && MO.getReg() && + if (MO.isRegister() && MO.isUse() && MO.getReg() && mri_->regsOverlap(rep(MO.getReg()), Reg)) { MOU = &MO; return MI; @@ -1005,7 +1005,7 @@ MachineOperand *SimpleRegisterCoalescing::findDefOperand(MachineInstr *MI, unsigned Reg) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isDef() && + if (MO.isRegister() && MO.isDef() && mri_->regsOverlap(rep(MO.getReg()), Reg)) return &MO; } @@ -1017,7 +1017,7 @@ void SimpleRegisterCoalescing::unsetRegisterKill(MachineInstr *MI, unsigned Reg) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isKill() && MO.getReg() && + if (MO.isRegister() && MO.isKill() && MO.getReg() && mri_->regsOverlap(rep(MO.getReg()), Reg)) MO.unsetIsKill(); } @@ -1041,7 +1041,7 @@ for (unsigned i = 0, NumOps = MI->getNumOperands(); i != NumOps; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isKill() && MO.getReg() && + if (MO.isRegister() && MO.isKill() && MO.getReg() && mri_->regsOverlap(rep(MO.getReg()), Reg)) { MO.unsetIsKill(); } @@ -1056,7 +1056,7 @@ bool SimpleRegisterCoalescing::hasRegisterDef(MachineInstr *MI, unsigned Reg) { for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isDef() && + if (MO.isRegister() && MO.isDef() && mri_->regsOverlap(rep(MO.getReg()), Reg)) return true; } Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Fri Sep 14 15:33:02 2007 @@ -446,7 +446,7 @@ SmallVector *KillRegs = NULL) { for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (!MO.isReg() || !MO.isUse() || !MO.isKill()) + if (!MO.isRegister() || !MO.isUse() || !MO.isKill()) continue; unsigned Reg = MO.getReg(); if (KillRegs) @@ -471,7 +471,7 @@ MachineOperand *DefOp = NULL; for (unsigned i = 0, e = DefMI->getNumOperands(); i != e; ++i) { MachineOperand &MO = DefMI->getOperand(i); - if (MO.isReg() && MO.isDef()) { + if (MO.isRegister() && MO.isDef()) { if (MO.getReg() == Reg) DefOp = &MO; else if (!MO.isDead()) @@ -488,7 +488,7 @@ MachineInstr *NMI = I; for (unsigned j = 0, ee = NMI->getNumOperands(); j != ee; ++j) { MachineOperand &MO = NMI->getOperand(j); - if (!MO.isReg() || MO.getReg() != Reg) + if (!MO.isRegister() || MO.getReg() != Reg) continue; if (MO.isUse()) FoundUse = true; @@ -511,7 +511,7 @@ const TargetInstrDescriptor *TID = MI.getInstrDescriptor(); for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { MachineOperand &MO = MI.getOperand(i); - if (!MO.isReg() || !MO.isUse()) + if (!MO.isRegister() || !MO.isUse()) continue; unsigned Reg = MO.getReg(); if (Reg == 0) @@ -535,7 +535,7 @@ for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI.getOperand(i); - if (!MO.isReg() || !MO.isDef()) + if (!MO.isRegister() || !MO.isDef()) continue; unsigned Reg = MO.getReg(); RegKills.reset(Reg); @@ -826,7 +826,7 @@ bool CanReuse = true; int ti = TID->getOperandConstraint(i, TOI::TIED_TO); if (ti != -1 && - MI.getOperand(ti).isReg() && + MI.getOperand(ti).isRegister() && MI.getOperand(ti).getReg() == VirtReg) { // Okay, we have a two address operand. We can reuse this physreg as // long as we are allowed to clobber the value and there isn't an Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Fri Sep 14 15:33:02 2007 @@ -68,7 +68,7 @@ default: break; case ARM::LDR: if (MI->getOperand(1).isFrameIndex() && - MI->getOperand(2).isReg() && + MI->getOperand(2).isRegister() && MI->getOperand(3).isImmediate() && MI->getOperand(2).getReg() == 0 && MI->getOperand(3).getImmedValue() == 0) { @@ -102,7 +102,7 @@ default: break; case ARM::STR: if (MI->getOperand(1).isFrameIndex() && - MI->getOperand(2).isReg() && + MI->getOperand(2).isRegister() && MI->getOperand(3).isImmediate() && MI->getOperand(2).getReg() == 0 && MI->getOperand(3).getImmedValue() == 0) { @@ -521,7 +521,7 @@ bool Found = false; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.getReg() == ARM::CPSR) { + if (MO.isRegister() && MO.getReg() == ARM::CPSR) { Pred.push_back(MO); Found = true; } Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Fri Sep 14 15:33:02 2007 @@ -450,7 +450,7 @@ case 'I': // Write 'i' if an integer constant, otherwise nothing. Used to print // addi vs add, etc. - if (MI->getOperand(OpNo).isImm()) + if (MI->getOperand(OpNo).isImmediate()) O << "i"; return false; } Modified: llvm/trunk/lib/Target/PowerPC/PPCBranchSelector.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCBranchSelector.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCBranchSelector.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCBranchSelector.cpp Fri Sep 14 15:33:02 2007 @@ -129,7 +129,7 @@ unsigned MBBStartOffset = 0; for (MachineBasicBlock::iterator I = MBB.begin(), E = MBB.end(); I != E; ++I) { - if (I->getOpcode() != PPC::BCC || I->getOperand(2).isImm()) { + if (I->getOpcode() != PPC::BCC || I->getOperand(2).isImmediate()) { MBBStartOffset += getNumBytesForInstruction(I); continue; } Modified: llvm/trunk/lib/Target/TargetInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetInstrInfo.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetInstrInfo.cpp Fri Sep 14 15:33:02 2007 @@ -68,13 +68,13 @@ for (unsigned j = 0, i = 0, e = MI->getNumOperands(); i != e; ++i) { if ((TID->OpInfo[i].Flags & M_PREDICATE_OPERAND)) { MachineOperand &MO = MI->getOperand(i); - if (MO.isReg()) { + if (MO.isRegister()) { MO.setReg(Pred[j].getReg()); MadeChange = true; - } else if (MO.isImm()) { + } else if (MO.isImmediate()) { MO.setImm(Pred[j].getImmedValue()); MadeChange = true; - } else if (MO.isMBB()) { + } else if (MO.isMachineBasicBlock()) { MO.setMachineBasicBlock(Pred[j].getMachineBasicBlock()); MadeChange = true; } Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Fri Sep 14 15:33:02 2007 @@ -547,7 +547,7 @@ case 'h': // Print QImode high register case 'w': // Print HImode register case 'k': // Print SImode register - if (MI->getOperand(OpNo).isReg()) + if (MI->getOperand(OpNo).isRegister()) return printAsmMRegister(MI->getOperand(OpNo), ExtraCode[0]); printOperand(MI, OpNo); return false; Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Fri Sep 14 15:33:02 2007 @@ -220,7 +220,7 @@ SmallVector DeadRegs; for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { const MachineOperand &MO = MI->getOperand(i); - if (MO.isReg() && MO.isDead()) + if (MO.isRegister() && MO.isDead()) DeadRegs.push_back(MO.getReg()); } Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=41958&r1=41957&r2=41958&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Sep 14 15:33:02 2007 @@ -291,9 +291,9 @@ static const MachineInstrBuilder &FuseInstrAddOperand(MachineInstrBuilder &MIB, MachineOperand &MO) { - if (MO.isReg()) + if (MO.isRegister()) MIB = MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit()); - else if (MO.isImm()) + else if (MO.isImmediate()) MIB = MIB.addImm(MO.getImm()); else if (MO.isFrameIndex()) MIB = MIB.addFrameIndex(MO.getFrameIndex()); @@ -340,7 +340,7 @@ for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand &MO = MI->getOperand(i); if (i == OpNo) { - assert(MO.isReg() && "Expected to fold into reg operand!"); + assert(MO.isRegister() && "Expected to fold into reg operand!"); unsigned NumAddrOps = MOs.size(); for (unsigned i = 0; i != NumAddrOps; ++i) MIB = FuseInstrAddOperand(MIB, MOs[i]); @@ -440,8 +440,8 @@ // instruction is different than folding it other places. It requires // replacing the *two* registers with the memory location. if (isTwoAddr && NumOps >= 2 && i < 2 && - MI->getOperand(0).isReg() && - MI->getOperand(1).isReg() && + MI->getOperand(0).isRegister() && + MI->getOperand(1).isRegister() && MI->getOperand(0).getReg() == MI->getOperand(1).getReg()) { static const TableEntry OpcodeTable[] = { { X86::ADC32ri, X86::ADC32mi }, @@ -1528,7 +1528,7 @@ if (RetOpcode == X86::EH_RETURN) { MBBI = prior(MBB.end()); MachineOperand &DestAddr = MBBI->getOperand(0); - assert(DestAddr.isReg() && "Offset should be in register!"); + assert(DestAddr.isRegister() && "Offset should be in register!"); BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr),StackPtr). addReg(DestAddr.getReg()); } From djg at cray.com Fri Sep 14 15:37:18 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 14 Sep 2007 20:37:18 -0000 Subject: [llvm-commits] [llvm] r41959 - /llvm/trunk/test/CodeGen/PowerPC/fabs.ll Message-ID: <200709142037.l8EKbIRl025920@zion.cs.uiuc.edu> Author: djg Date: Fri Sep 14 15:37:18 2007 New Revision: 41959 URL: http://llvm.org/viewvc/llvm-project?rev=41959&view=rev Log: Add explicit triples to avoid default behavior that varies by host. Modified: llvm/trunk/test/CodeGen/PowerPC/fabs.ll Modified: llvm/trunk/test/CodeGen/PowerPC/fabs.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/fabs.ll?rev=41959&r1=41958&r2=41959&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/PowerPC/fabs.ll (original) +++ llvm/trunk/test/CodeGen/PowerPC/fabs.ll Fri Sep 14 15:37:18 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=ppc32 | grep {fabs f1, f1} +; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin | grep {fabs f1, f1} define double @fabs(double %f) { entry: From djg at cray.com Fri Sep 14 15:48:42 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 14 Sep 2007 20:48:42 -0000 Subject: [llvm-commits] [llvm] r41960 - in /llvm/trunk: include/llvm/ADT/FoldingSet.h lib/Support/FoldingSet.cpp Message-ID: <200709142048.l8EKmgw2026187@zion.cs.uiuc.edu> Author: djg Date: Fri Sep 14 15:48:42 2007 New Revision: 41960 URL: http://llvm.org/viewvc/llvm-project?rev=41960&view=rev Log: And an FoldingSetImpl::NodeID::AddInteger overload for int64_t, to avoid ambiguity. Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h llvm/trunk/lib/Support/FoldingSet.cpp Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=41960&r1=41959&r2=41960&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/FoldingSet.h (original) +++ llvm/trunk/include/llvm/ADT/FoldingSet.h Fri Sep 14 15:48:42 2007 @@ -149,6 +149,7 @@ void AddPointer(const void *Ptr); void AddInteger(signed I); void AddInteger(unsigned I); + void AddInteger(int64_t I); void AddInteger(uint64_t I); void AddFloat(float F); void AddDouble(double D); Modified: llvm/trunk/lib/Support/FoldingSet.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=41960&r1=41959&r2=41960&view=diff ============================================================================== --- llvm/trunk/lib/Support/FoldingSet.cpp (original) +++ llvm/trunk/lib/Support/FoldingSet.cpp Fri Sep 14 15:48:42 2007 @@ -40,6 +40,9 @@ void FoldingSetImpl::NodeID::AddInteger(unsigned I) { Bits.push_back(I); } +void FoldingSetImpl::NodeID::AddInteger(int64_t I) { + AddInteger((uint64_t)I); +} void FoldingSetImpl::NodeID::AddInteger(uint64_t I) { Bits.push_back(unsigned(I)); From evan.cheng at apple.com Fri Sep 14 16:48:27 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 14 Sep 2007 21:48:27 -0000 Subject: [llvm-commits] [llvm] r41962 - in /llvm/trunk/lib/Target/X86: X86InstrFPStack.td X86InstrInfo.cpp X86InstrInfo.td X86InstrSSE.td X86InstrX86-64.td Message-ID: <200709142148.l8ELmSSr027784@zion.cs.uiuc.edu> Author: evancheng Date: Fri Sep 14 16:48:26 2007 New Revision: 41962 URL: http://llvm.org/viewvc/llvm-project?rev=41962&view=rev Log: Add implicit def of EFLAGS on those instructions that may modify flags. Modified: llvm/trunk/lib/Target/X86/X86InstrFPStack.td llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/lib/Target/X86/X86InstrX86-64.td Modified: llvm/trunk/lib/Target/X86/X86InstrFPStack.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFPStack.td?rev=41962&r1=41961&r2=41962&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFPStack.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFPStack.td Fri Sep 14 16:48:26 2007 @@ -488,7 +488,7 @@ def UCOM_FpIr80: FpI_<(outs), (ins RFP80:$lhs, RFP80:$rhs), CompareFP, [(X86cmp RFP80:$lhs, RFP80:$rhs)]>; // CC = ST(0) cmp ST(i) -let Uses = [ST0] in { +let Defs = [EFLAGS], Uses = [ST0] in { def UCOM_Fr : FPI<0xE0, AddRegFrm, // FPSW = cmp ST(0) with ST(i) (outs), (ins RST:$reg), "fucom\t$reg">, DD; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=41962&r1=41961&r2=41962&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Sep 14 16:48:26 2007 @@ -182,7 +182,7 @@ break; } case X86::SHL64ri: { - assert(MI->getNumOperands() == 3 && "Unknown shift instruction!"); + assert(MI->getNumOperands() >= 3 && "Unknown shift instruction!"); // NOTE: LEA doesn't produce flags like shift does, but LLVM never uses // the flags produced by a shift yet, so this is safe. unsigned Dest = MI->getOperand(0).getReg(); @@ -195,7 +195,7 @@ break; } case X86::SHL32ri: { - assert(MI->getNumOperands() == 3 && "Unknown shift instruction!"); + assert(MI->getNumOperands() >= 3 && "Unknown shift instruction!"); // NOTE: LEA doesn't produce flags like shift does, but LLVM never uses // the flags produced by a shift yet, so this is safe. unsigned Dest = MI->getOperand(0).getReg(); @@ -210,7 +210,7 @@ break; } case X86::SHL16ri: { - assert(MI->getNumOperands() == 3 && "Unknown shift instruction!"); + assert(MI->getNumOperands() >= 3 && "Unknown shift instruction!"); // NOTE: LEA doesn't produce flags like shift does, but LLVM never uses // the flags produced by a shift yet, so this is safe. unsigned Dest = MI->getOperand(0).getReg(); @@ -259,40 +259,40 @@ switch (MI->getOpcode()) { case X86::INC32r: case X86::INC64_32r: - assert(MI->getNumOperands() == 2 && "Unknown inc instruction!"); + assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!"); NewMI = addRegOffset(BuildMI(get(X86::LEA32r), Dest), Src, 1); break; case X86::INC16r: case X86::INC64_16r: if (DisableLEA16) return 0; - assert(MI->getNumOperands() == 2 && "Unknown inc instruction!"); + assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!"); NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, 1); break; case X86::DEC32r: case X86::DEC64_32r: - assert(MI->getNumOperands() == 2 && "Unknown dec instruction!"); + assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!"); NewMI = addRegOffset(BuildMI(get(X86::LEA32r), Dest), Src, -1); break; case X86::DEC16r: case X86::DEC64_16r: if (DisableLEA16) return 0; - assert(MI->getNumOperands() == 2 && "Unknown dec instruction!"); + assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!"); NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, -1); break; case X86::ADD32rr: - assert(MI->getNumOperands() == 3 && "Unknown add instruction!"); + assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); NewMI = addRegReg(BuildMI(get(X86::LEA32r), Dest), Src, MI->getOperand(2).getReg()); break; case X86::ADD16rr: if (DisableLEA16) return 0; - assert(MI->getNumOperands() == 3 && "Unknown add instruction!"); + assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); NewMI = addRegReg(BuildMI(get(X86::LEA16r), Dest), Src, MI->getOperand(2).getReg()); break; case X86::ADD32ri: case X86::ADD32ri8: - assert(MI->getNumOperands() == 3 && "Unknown add instruction!"); + assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); if (MI->getOperand(2).isImmediate()) NewMI = addRegOffset(BuildMI(get(X86::LEA32r), Dest), Src, MI->getOperand(2).getImmedValue()); @@ -300,7 +300,7 @@ case X86::ADD16ri: case X86::ADD16ri8: if (DisableLEA16) return 0; - assert(MI->getNumOperands() == 3 && "Unknown add instruction!"); + assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); if (MI->getOperand(2).isImmediate()) NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, MI->getOperand(2).getImmedValue()); @@ -308,7 +308,7 @@ case X86::SHL16ri: if (DisableLEA16) return 0; case X86::SHL32ri: - assert(MI->getNumOperands() == 3 && MI->getOperand(2).isImmediate() && + assert(MI->getNumOperands() >= 3 && MI->getOperand(2).isImmediate() && "Unknown shl instruction!"); unsigned ShAmt = MI->getOperand(2).getImmedValue(); if (ShAmt == 1 || ShAmt == 2 || ShAmt == 3) { Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=41962&r1=41961&r2=41962&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Fri Sep 14 16:48:26 2007 @@ -547,45 +547,45 @@ // // Extra precision multiplication -let Defs = [AL,AH], Uses = [AL] in +let Defs = [AL,AH,EFLAGS], Uses = [AL] in def MUL8r : I<0xF6, MRM4r, (outs), (ins GR8:$src), "mul{b}\t$src", // FIXME: Used for 8-bit mul, ignore result upper 8 bits. // This probably ought to be moved to a def : Pat<> if the // syntax can be accepted. [(set AL, (mul AL, GR8:$src))]>; // AL,AH = AL*GR8 -let Defs = [AX,DX], Uses = [AX] in +let Defs = [AX,DX,EFLAGS], Uses = [AX] in def MUL16r : I<0xF7, MRM4r, (outs), (ins GR16:$src), "mul{w}\t$src", []>, OpSize; // AX,DX = AX*GR16 -let Defs = [EAX,EDX], Uses = [EAX] in +let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in def MUL32r : I<0xF7, MRM4r, (outs), (ins GR32:$src), "mul{l}\t$src", []>; // EAX,EDX = EAX*GR32 -let Defs = [AL,AH], Uses = [AL] in +let Defs = [AL,AH,EFLAGS], Uses = [AL] in def MUL8m : I<0xF6, MRM4m, (outs), (ins i8mem :$src), "mul{b}\t$src", // FIXME: Used for 8-bit mul, ignore result upper 8 bits. // This probably ought to be moved to a def : Pat<> if the // syntax can be accepted. [(set AL, (mul AL, (loadi8 addr:$src)))]>; // AL,AH = AL*[mem8] -let Defs = [AX,DX], Uses = [AX] in +let Defs = [AX,DX,EFLAGS], Uses = [AX] in def MUL16m : I<0xF7, MRM4m, (outs), (ins i16mem:$src), "mul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16] -let Defs = [EAX,EDX], Uses = [EAX] in +let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in def MUL32m : I<0xF7, MRM4m, (outs), (ins i32mem:$src), "mul{l}\t$src", []>; // EAX,EDX = EAX*[mem32] -let Defs = [AL,AH], Uses = [AL] in +let Defs = [AL,AH,EFLAGS], Uses = [AL] in def IMUL8r : I<0xF6, MRM5r, (outs), (ins GR8:$src), "imul{b}\t$src", []>; // AL,AH = AL*GR8 -let Defs = [AX,DX], Uses = [AX] in +let Defs = [AX,DX,EFLAGS], Uses = [AX] in def IMUL16r : I<0xF7, MRM5r, (outs), (ins GR16:$src), "imul{w}\t$src", []>, OpSize; // AX,DX = AX*GR16 -let Defs = [EAX,EDX], Uses = [EAX] in +let Defs = [EAX,EDX,EFLAGS], Uses = [EAX] in def IMUL32r : I<0xF7, MRM5r, (outs), (ins GR32:$src), "imul{l}\t$src", []>; // EAX,EDX = EAX*GR32 -let Defs = [AL,AH], Uses = [AL] in +let Defs = [AL,AH,EFLAGS], Uses = [AL] in def IMUL8m : I<0xF6, MRM5m, (outs), (ins i8mem :$src), "imul{b}\t$src", []>; // AL,AH = AL*[mem8] -let Defs = [AX,DX], Uses = [AX] in +let Defs = [AX,DX,EFLAGS], Uses = [AX] in def IMUL16m : I<0xF7, MRM5m, (outs), (ins i16mem:$src), "imul{w}\t$src", []>, OpSize; // AX,DX = AX*[mem16] let Defs = [EAX,EDX], Uses = [EAX] in @@ -593,42 +593,42 @@ "imul{l}\t$src", []>; // EAX,EDX = EAX*[mem32] // unsigned division/remainder -let Defs = [AX], Uses = [AL,AH] in +let Defs = [AX,EFLAGS], Uses = [AL,AH] in def DIV8r : I<0xF6, MRM6r, (outs), (ins GR8:$src), // AX/r8 = AL,AH "div{b}\t$src", []>; -let Defs = [AX,DX], Uses = [AX,DX] in +let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in def DIV16r : I<0xF7, MRM6r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX "div{w}\t$src", []>, OpSize; -let Defs = [EAX,EDX], Uses = [EAX,EDX] in +let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in def DIV32r : I<0xF7, MRM6r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX "div{l}\t$src", []>; -let Defs = [AX], Uses = [AL,AH] in +let Defs = [AX,EFLAGS], Uses = [AL,AH] in def DIV8m : I<0xF6, MRM6m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH "div{b}\t$src", []>; -let Defs = [AX,DX], Uses = [AX,DX] in +let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in def DIV16m : I<0xF7, MRM6m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX "div{w}\t$src", []>, OpSize; -let Defs = [EAX,EDX], Uses = [EAX,EDX] in +let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in def DIV32m : I<0xF7, MRM6m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX "div{l}\t$src", []>; // Signed division/remainder. -let Defs = [AX], Uses = [AL,AH] in +let Defs = [AX,EFLAGS], Uses = [AL,AH] in def IDIV8r : I<0xF6, MRM7r, (outs), (ins GR8:$src), // AX/r8 = AL,AH "idiv{b}\t$src", []>; -let Defs = [AX,DX], Uses = [AX,DX] in +let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in def IDIV16r: I<0xF7, MRM7r, (outs), (ins GR16:$src), // DX:AX/r16 = AX,DX "idiv{w}\t$src", []>, OpSize; -let Defs = [EAX,EDX], Uses = [EAX,EDX] in +let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in def IDIV32r: I<0xF7, MRM7r, (outs), (ins GR32:$src), // EDX:EAX/r32 = EAX,EDX "idiv{l}\t$src", []>; -let Defs = [AX], Uses = [AL,AH] in +let Defs = [AX,EFLAGS], Uses = [AL,AH] in def IDIV8m : I<0xF6, MRM7m, (outs), (ins i8mem:$src), // AX/[mem8] = AL,AH "idiv{b}\t$src", []>; -let Defs = [AX,DX], Uses = [AX,DX] in +let Defs = [AX,DX,EFLAGS], Uses = [AX,DX] in def IDIV16m: I<0xF7, MRM7m, (outs), (ins i16mem:$src), // DX:AX/[mem16] = AX,DX "idiv{w}\t$src", []>, OpSize; -let Defs = [EAX,EDX], Uses = [EAX,EDX] in +let Defs = [EAX,EDX,EFLAGS], Uses = [EAX,EDX] in def IDIV32m: I<0xF7, MRM7m, (outs), (ins i32mem:$src), // EDX:EAX/[mem32] = EAX,EDX "idiv{l}\t$src", []>; @@ -992,6 +992,7 @@ // unary instructions let CodeSize = 2 in { +let Defs = [EFLAGS] in { def NEG8r : I<0xF6, MRM3r, (outs GR8 :$dst), (ins GR8 :$src), "neg{b}\t$dst", [(set GR8:$dst, (ineg GR8:$src))]>; def NEG16r : I<0xF7, MRM3r, (outs GR16:$dst), (ins GR16:$src), "neg{w}\t$dst", @@ -1007,6 +1008,7 @@ [(store (ineg (loadi32 addr:$dst)), addr:$dst)]>; } +} // Defs = [EFLAGS] def NOT8r : I<0xF6, MRM2r, (outs GR8 :$dst), (ins GR8 :$src), "not{b}\t$dst", [(set GR8:$dst, (not GR8:$src))]>; @@ -1025,6 +1027,7 @@ } // CodeSize // TODO: inc/dec is slow for P4, but fast for Pentium-M. +let Defs = [EFLAGS] in { let CodeSize = 2 in def INC8r : I<0xFE, MRM0r, (outs GR8 :$dst), (ins GR8 :$src), "inc{b}\t$dst", [(set GR8:$dst, (add GR8:$src, 1))]>; @@ -1063,8 +1066,10 @@ def DEC32m : I<0xFF, MRM1m, (outs), (ins i32mem:$dst), "dec{l}\t$dst", [(store (add (loadi32 addr:$dst), -1), addr:$dst)]>; } +} // Defs = [EFLAGS] // Logical operators... +let Defs = [EFLAGS] in { let isCommutable = 1 in { // X = AND Y, Z --> X = AND Z, Y def AND8rr : I<0x20, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), @@ -1307,8 +1312,10 @@ "xor{l}\t{$src, $dst|$dst, $src}", [(store (xor (load addr:$dst), i32immSExt8:$src), addr:$dst)]>; } +} // Defs = [EFLAGS] // Shift instructions +let Defs = [EFLAGS] in { let Uses = [CL] in { def SHL8rCL : I<0xD2, MRM4r, (outs GR8 :$dst), (ins GR8 :$src), "shl{b}\t{%cl, $dst|$dst, %CL}", @@ -1750,9 +1757,11 @@ (i8 imm:$src3)), addr:$dst)]>, TB, OpSize; } +} // Defs = [EFLAGS] // Arithmetic. +let Defs = [EFLAGS] in { let isCommutable = 1 in { // X = ADD Y, Z --> X = ADD Z, Y def ADD8rr : I<0x00, MRMDestReg, (outs GR8 :$dst), (ins GR8 :$src1, GR8 :$src2), @@ -1812,7 +1821,7 @@ def ADD16mr : I<0x01, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), "add{w}\t{$src2, $dst|$dst, $src2}", [(store (add (load addr:$dst), GR16:$src2), addr:$dst)]>, - OpSize; + OpSize; def ADD32mr : I<0x01, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), "add{l}\t{$src2, $dst|$dst, $src2}", [(store (add (load addr:$dst), GR32:$src2), addr:$dst)]>; @@ -1822,14 +1831,14 @@ def ADD16mi : Ii16<0x81, MRM0m, (outs), (ins i16mem:$dst, i16imm:$src2), "add{w}\t{$src2, $dst|$dst, $src2}", [(store (add (loadi16 addr:$dst), imm:$src2), addr:$dst)]>, - OpSize; + OpSize; def ADD32mi : Ii32<0x81, MRM0m, (outs), (ins i32mem:$dst, i32imm:$src2), "add{l}\t{$src2, $dst|$dst, $src2}", [(store (add (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; def ADD16mi8 : Ii8<0x83, MRM0m, (outs), (ins i16mem:$dst, i16i8imm :$src2), "add{w}\t{$src2, $dst|$dst, $src2}", [(store (add (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>, - OpSize; + OpSize; def ADD32mi8 : Ii8<0x83, MRM0m, (outs), (ins i32mem:$dst, i32i8imm :$src2), "add{l}\t{$src2, $dst|$dst, $src2}", [(store (add (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; @@ -1893,7 +1902,7 @@ def SUB16ri8 : Ii8<0x83, MRM5r, (outs GR16:$dst), (ins GR16:$src1, i16i8imm:$src2), "sub{w}\t{$src2, $dst|$dst, $src2}", [(set GR16:$dst, (sub GR16:$src1, i16immSExt8:$src2))]>, - OpSize; + OpSize; def SUB32ri8 : Ii8<0x83, MRM5r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), "sub{l}\t{$src2, $dst|$dst, $src2}", [(set GR32:$dst, (sub GR32:$src1, i32immSExt8:$src2))]>; @@ -1904,7 +1913,7 @@ def SUB16mr : I<0x29, MRMDestMem, (outs), (ins i16mem:$dst, GR16:$src2), "sub{w}\t{$src2, $dst|$dst, $src2}", [(store (sub (load addr:$dst), GR16:$src2), addr:$dst)]>, - OpSize; + OpSize; def SUB32mr : I<0x29, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), "sub{l}\t{$src2, $dst|$dst, $src2}", [(store (sub (load addr:$dst), GR32:$src2), addr:$dst)]>; @@ -1914,14 +1923,14 @@ def SUB16mi : Ii16<0x81, MRM5m, (outs), (ins i16mem:$dst, i16imm:$src2), "sub{w}\t{$src2, $dst|$dst, $src2}", [(store (sub (loadi16 addr:$dst), imm:$src2), addr:$dst)]>, - OpSize; + OpSize; def SUB32mi : Ii32<0x81, MRM5m, (outs), (ins i32mem:$dst, i32imm:$src2), "sub{l}\t{$src2, $dst|$dst, $src2}", [(store (sub (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; def SUB16mi8 : Ii8<0x83, MRM5m, (outs), (ins i16mem:$dst, i16i8imm :$src2), "sub{w}\t{$src2, $dst|$dst, $src2}", [(store (sub (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>, - OpSize; + OpSize; def SUB32mi8 : Ii8<0x83, MRM5m, (outs), (ins i32mem:$dst, i32i8imm :$src2), "sub{l}\t{$src2, $dst|$dst, $src2}", [(store (sub (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; @@ -1929,7 +1938,7 @@ def SBB32rr : I<0x19, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2), "sbb{l}\t{$src2, $dst|$dst, $src2}", - [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>; + [(set GR32:$dst, (sube GR32:$src1, GR32:$src2))]>; let isTwoAddress = 0 in { def SBB32mr : I<0x19, MRMDestMem, (outs), (ins i32mem:$dst, GR32:$src2), @@ -1943,7 +1952,7 @@ [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; def SBB32mi8 : Ii8<0x83, MRM3m, (outs), (ins i32mem:$dst, i32i8imm :$src2), "sbb{l}\t{$src2, $dst|$dst, $src2}", - [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; + [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; } def SBB32rm : I<0x1B, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), "sbb{l}\t{$src2, $dst|$dst, $src2}", @@ -1954,7 +1963,9 @@ def SBB32ri8 : Ii8<0x83, MRM3r, (outs GR32:$dst), (ins GR32:$src1, i32i8imm:$src2), "sbb{l}\t{$src2, $dst|$dst, $src2}", [(set GR32:$dst, (sube GR32:$src1, i32immSExt8:$src2))]>; +} // Defs = [EFLAGS] +let Defs = [EFLAGS] in { let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y def IMUL16rr : I<0xAF, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src1, GR16:$src2), "imul{w}\t{$src2, $dst|$dst, $src2}", @@ -1970,10 +1981,11 @@ def IMUL32rm : I<0xAF, MRMSrcMem, (outs GR32:$dst), (ins GR32:$src1, i32mem:$src2), "imul{l}\t{$src2, $dst|$dst, $src2}", [(set GR32:$dst, (mul GR32:$src1, (load addr:$src2)))]>, TB; - +} // Defs = [EFLAGS] } // end Two Address instructions // Suprisingly enough, these are not two address instructions! +let Defs = [EFLAGS] in { def IMUL16rri : Ii16<0x69, MRMSrcReg, // GR16 = GR16*I16 (outs GR16:$dst), (ins GR16:$src1, i16imm:$src2), "imul{w}\t{$src2, $src1, $dst|$dst, $src1, $src2}", @@ -2010,10 +2022,12 @@ (outs GR32:$dst), (ins i32mem:$src1, i32i8imm: $src2), "imul{l}\t{$src2, $src1, $dst|$dst, $src1, $src2}", [(set GR32:$dst, (mul (load addr:$src1), i32immSExt8:$src2))]>; +} // Defs = [EFLAGS] //===----------------------------------------------------------------------===// // Test instructions are just like AND, except they don't generate a result. // + let Defs = [EFLAGS] in { let isCommutable = 1 in { // TEST X, Y --> TEST Y, X def TEST8rr : I<0x84, MRMDestReg, (outs), (ins GR8:$src1, GR8:$src2), "test{b}\t{$src2, $src1|$src1, $src2}", @@ -2063,12 +2077,13 @@ (outs), (ins i32mem:$src1, i32imm:$src2), "test{l}\t{$src2, $src1|$src1, $src2}", [(X86cmp (and (loadi32 addr:$src1), imm:$src2), 0)]>; +} // Defs = [EFLAGS] // Condition code ops, incl. set if equal/not equal/... -let Uses = [AH] in +let Defs = [EFLAGS], Uses = [AH] in def SAHF : I<0x9E, RawFrm, (outs), (ins), "sahf", []>; // flags = AH -let Defs = [AH] in +let Defs = [AH], Uses = [EFLAGS] in def LAHF : I<0x9F, RawFrm, (outs), (ins), "lahf", []>; // AH = flags def SETEr : I<0x94, MRM0r, @@ -2215,6 +2230,7 @@ TB; // [mem8] = not parity // Integer comparisons +let Defs = [EFLAGS] in { def CMP8rr : I<0x38, MRMDestReg, (outs), (ins GR8 :$src1, GR8 :$src2), "cmp{b}\t{$src2, $src1|$src1, $src2}", @@ -2291,6 +2307,7 @@ (outs), (ins GR32:$src1, i32i8imm:$src2), "cmp{l}\t{$src2, $src1|$src1, $src2}", [(X86cmp GR32:$src1, i32immSExt8:$src2)]>; +} // Defs = [EFLAGS] // Sign/Zero extenders def MOVSX16rr8 : I<0xBE, MRMSrcReg, (outs GR16:$dst), (ins GR8 :$src), @@ -2352,7 +2369,7 @@ // Alias instructions that map movr0 to xor. // FIXME: remove when we can teach regalloc that xor reg, reg is ok. -let isReMaterializable = 1 in { +let Defs = [EFLAGS], isReMaterializable = 1 in { def MOV8r0 : I<0x30, MRMInitReg, (outs GR8 :$dst), (ins), "xor{b}\t$dst, $dst", [(set GR8:$dst, 0)]>; Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=41962&r1=41961&r2=41962&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Fri Sep 14 16:48:26 2007 @@ -360,12 +360,14 @@ "cmp${cc}ss\t{$src, $dst|$dst, $src}", []>; } +let Defs = [EFLAGS] in { def UCOMISSrr: PSI<0x2E, MRMSrcReg, (outs), (ins FR32:$src1, FR32:$src2), "ucomiss\t{$src2, $src1|$src1, $src2}", [(X86cmp FR32:$src1, FR32:$src2)]>; def UCOMISSrm: PSI<0x2E, MRMSrcMem, (outs), (ins FR32:$src1, f32mem:$src2), "ucomiss\t{$src2, $src1|$src1, $src2}", [(X86cmp FR32:$src1, (loadf32 addr:$src2))]>; +} // Defs = [EFLAGS] // Aliases to match intrinsics which expect XMM operand(s). let isTwoAddress = 1 in { @@ -381,6 +383,7 @@ (load addr:$src), imm:$cc))]>; } +let Defs = [EFLAGS] in { def Int_UCOMISSrr: PSI<0x2E, MRMSrcReg, (outs), (ins VR128:$src1, VR128:$src2), "ucomiss\t{$src2, $src1|$src1, $src2}", [(X86ucomi (v4f32 VR128:$src1), VR128:$src2)]>; @@ -394,6 +397,7 @@ def Int_COMISSrm: PSI<0x2F, MRMSrcMem, (outs), (ins VR128:$src1, f128mem:$src2), "comiss\t{$src2, $src1|$src1, $src2}", [(X86comi (v4f32 VR128:$src1), (load addr:$src2))]>; +} // Defs = [EFLAGS] // Aliases of packed SSE1 instructions for scalar use. These all have names that // start with 'Fs'. Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=41962&r1=41961&r2=41962&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Fri Sep 14 16:48:26 2007 @@ -226,6 +226,7 @@ // Arithmetic Instructions... // +let Defs = [EFLAGS] in { let isTwoAddress = 1 in { let isConvertibleToThreeAddress = 1 in { let isCommutable = 1 in @@ -337,9 +338,10 @@ def SBB64mi8 : RIi8<0x83, MRM3m, (outs), (ins i64mem:$dst, i64i8imm :$src2), "sbb{q}\t{$src2, $dst|$dst, $src2}", [(store (sube (load addr:$dst), i64immSExt8:$src2), addr:$dst)]>; +} // Defs = [EFLAGS] // Unsigned multiplication -let Defs = [RAX,RDX], Uses = [RAX] in { +let Defs = [RAX,RDX,EFLAGS], Uses = [RAX] in { def MUL64r : RI<0xF7, MRM4r, (outs), (ins GR64:$src), "mul{q}\t$src", []>; // RAX,RDX = RAX*GR64 def MUL64m : RI<0xF7, MRM4m, (outs), (ins i64mem:$src), @@ -352,6 +354,7 @@ "imul{q}\t$src", []>; // RAX,RDX = RAX*[mem64] } +let Defs = [EFLAGS] in { let isTwoAddress = 1 in { let isCommutable = 1 in def IMUL64rr : RI<0xAF, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2), @@ -380,9 +383,10 @@ (outs GR64:$dst), (ins i64mem:$src1, i64i8imm: $src2), "imul{q}\t{$src2, $src1, $dst|$dst, $src1, $src2}", [(set GR64:$dst, (mul (load addr:$src1), i64immSExt8:$src2))]>; +} // Defs = [EFLAGS] // Unsigned division / remainder -let Defs = [RAX,RDX], Uses = [RAX,RDX] in { +let Defs = [RAX,RDX,EFLAGS], Uses = [RAX,RDX] in { def DIV64r : RI<0xF7, MRM6r, (outs), (ins GR64:$src), // RDX:RAX/r64 = RAX,RDX "div{q}\t$src", []>; def DIV64m : RI<0xF7, MRM6m, (outs), (ins i64mem:$src), // RDX:RAX/[mem64] = RAX,RDX @@ -396,7 +400,7 @@ } // Unary instructions -let CodeSize = 2 in { +let Defs = [EFLAGS], CodeSize = 2 in { let isTwoAddress = 1 in def NEG64r : RI<0xF7, MRM3r, (outs GR64:$dst), (ins GR64:$src), "neg{q}\t$dst", [(set GR64:$dst, (ineg GR64:$src))]>; @@ -431,9 +435,10 @@ [(set GR32:$dst, (add GR32:$src, -1))]>, Requires<[In64BitMode]>; } // isConvertibleToThreeAddress -} // CodeSize +} // Defs = [EFLAGS], CodeSize +let Defs = [EFLAGS] in { // Shift instructions let isTwoAddress = 1 in { let Uses = [CL] in @@ -592,6 +597,7 @@ (outs), (ins i64mem:$dst, GR64:$src2, i8imm:$src3), "shrd{q}\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>, TB; +} // Defs = [EFLAGS] //===----------------------------------------------------------------------===// // Logical Instructions... @@ -603,6 +609,7 @@ def NOT64m : RI<0xF7, MRM2m, (outs), (ins i64mem:$dst), "not{q}\t$dst", [(store (not (loadi64 addr:$dst)), addr:$dst)]>; +let Defs = [EFLAGS] in { let isTwoAddress = 1 in { let isCommutable = 1 in def AND64rr : RI<0x21, MRMDestReg, @@ -688,12 +695,14 @@ def XOR64mi8 : RIi8<0x83, MRM6m, (outs), (ins i64mem:$dst, i64i8imm :$src), "xor{q}\t{$src, $dst|$dst, $src}", [(store (xor (load addr:$dst), i64immSExt8:$src), addr:$dst)]>; +} // Defs = [EFLAGS] //===----------------------------------------------------------------------===// // Comparison Instructions... // // Integer comparison +let Defs = [EFLAGS] in { let isCommutable = 1 in def TEST64rr : RI<0x85, MRMDestReg, (outs), (ins GR64:$src1, GR64:$src2), "test{q}\t{$src2, $src1|$src1, $src2}", @@ -729,6 +738,7 @@ def CMP64ri8 : RIi8<0x83, MRM7r, (outs), (ins GR64:$src1, i64i8imm:$src2), "cmp{q}\t{$src2, $src1|$src1, $src2}", [(X86cmp GR64:$src1, i64immSExt8:$src2)]>; +} // Defs = [EFLAGS] // Conditional moves let isTwoAddress = 1 in { @@ -1000,7 +1010,7 @@ // FIXME: remove when we can teach regalloc that xor reg, reg is ok. // FIXME: AddedComplexity gives MOV64r0 a higher priority than MOV64ri32. Remove // when we have a better way to specify isel priority. -let AddedComplexity = 1, isReMaterializable = 1 in +let Defs = [EFLAGS], AddedComplexity = 1, isReMaterializable = 1 in def MOV64r0 : RI<0x31, MRMInitReg, (outs GR64:$dst), (ins), "xor{q}\t$dst, $dst", [(set GR64:$dst, 0)]>; From dalej at apple.com Fri Sep 14 16:53:35 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 14 Sep 2007 21:53:35 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41963 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp Message-ID: <200709142153.l8ELrZHc027944@zion.cs.uiuc.edu> Author: johannes Date: Fri Sep 14 16:53:34 2007 New Revision: 41963 URL: http://llvm.org/viewvc/llvm-project?rev=41963&view=rev Log: Support x86 long double in conversions. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=41963&r1=41962&r2=41963&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Sep 14 16:53:34 2007 @@ -5164,28 +5164,47 @@ int UArr[2]; double V; }; - REAL_VALUE_TO_TARGET_DOUBLE(TREE_REAL_CST(exp), RealArr); - - // Here's how this works: - // REAL_VALUE_TO_TARGET_DOUBLE() will generate the floating point number - // as an array of integers in the target's representation. Each integer - // in the array will hold 32 bits of the result REGARDLESS OF THE HOST'S - // INTEGER SIZE. - // - // This, then, makes the conversion pretty simple. The tricky part is - // getting the byte ordering correct and make sure you don't print any - // more than 32 bits per integer on platforms with ints > 32 bits. - - UArr[0] = RealArr[0]; // Long -> int convert - UArr[1] = RealArr[1]; - - // FIXME: verify on big-endian targets and cross from big- to little- endian - // targets - if (FLOAT_WORDS_BIG_ENDIAN) - std::swap(UArr[0], UArr[1]); + if (Ty==Type::FloatTy || Ty==Type::DoubleTy) { + REAL_VALUE_TO_TARGET_DOUBLE(TREE_REAL_CST(exp), RealArr); + + // Here's how this works: + // REAL_VALUE_TO_TARGET_DOUBLE() will generate the floating point number + // as an array of integers in the target's representation. Each integer + // in the array will hold 32 bits of the result REGARDLESS OF THE HOST'S + // INTEGER SIZE. + // + // This, then, makes the conversion pretty simple. The tricky part is + // getting the byte ordering correct and make sure you don't print any + // more than 32 bits per integer on platforms with ints > 32 bits. + + UArr[0] = RealArr[0]; // Long -> int convert + UArr[1] = RealArr[1]; + + // FIXME: verify on big-endian targets and cross from big- to little- endian + // targets + if (FLOAT_WORDS_BIG_ENDIAN) + std::swap(UArr[0], UArr[1]); + + return ConstantFP::get(Ty, Ty==Type::FloatTy ? APFloat((float)V) + : APFloat(V)); + } else if (Ty==Type::X86_FP80Ty) { + long RealArr[4]; + uint64_t UArr[2]; + REAL_VALUE_TO_TARGET_LONG_DOUBLE(TREE_REAL_CST(exp), RealArr); + + if (FLOAT_WORDS_BIG_ENDIAN) { + // FIXME + } else { + UArr[0] = ((uint64_t)((uint16_t)RealArr[2]) << 48) | + ((uint64_t)((uint32_t)RealArr[1]) << 16) | + ((uint64_t)((uint16_t)(RealArr[0] >> 16))); + UArr[1] = (uint16_t)RealArr[0]; - return ConstantFP::get(Ty, Ty==Type::FloatTy ? APFloat((float)V) - : APFloat(V)); + return ConstantFP::get(Ty, APFloat(APInt(80, 2, UArr))); + } + } + assert(0 && "Floating point type not handled yet"); + return 0; // outwit compiler warning } Constant *TreeConstantToLLVM::ConvertVECTOR_CST(tree exp) { Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=41963&r1=41962&r2=41963&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Sep 14 16:53:34 2007 @@ -730,6 +730,7 @@ abort(); case 32: return SET_TYPE_LLVM(type, Type::FloatTy); case 64: return SET_TYPE_LLVM(type, Type::DoubleTy); + case 80: return SET_TYPE_LLVM(type, Type::X86_FP80Ty); case 128: // 128-bit long doubles map onto { double, double }. const Type *Ty = Type::DoubleTy; From echristo at apple.com Fri Sep 14 17:16:12 2007 From: echristo at apple.com (Eric Christopher) Date: Fri, 14 Sep 2007 15:16:12 -0700 Subject: [llvm-commits] remove libstdc++ from llvm-gcc configure targets Message-ID: As it says. Tested on x86-darwin. -eric 2007-09-14 Eric Christopher * configure.in (powerpc*-*-darwin*): Add target-libstdc++-v3 to noconfidirs. (*-*-darwin*): Ditto. * configure: Regenerate. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: configure.in.diff.txt Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070914/84d1e92b/attachment.txt -------------- next part -------------- From sabre at nondot.org Fri Sep 14 17:25:06 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 14 Sep 2007 22:25:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41965 - /llvm-gcc-4.0/trunk/configure.in Message-ID: <200709142225.l8EMP6kA028808@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 14 17:25:06 2007 New Revision: 41965 URL: http://llvm.org/viewvc/llvm-project?rev=41965&view=rev Log: When building on darwin, automatically disable building libstdc++. Patch by Eric Christopher! Modified: llvm-gcc-4.0/trunk/configure.in Modified: llvm-gcc-4.0/trunk/configure.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/configure.in?rev=41965&r1=41964&r2=41965&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/configure.in (original) +++ llvm-gcc-4.0/trunk/configure.in Fri Sep 14 17:25:06 2007 @@ -371,12 +371,12 @@ powerpc-*-darwin*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" # APPLE LOCAL 64-bit bringup - noconfigdirs="$noconfigdirs target-libobjc" + noconfigdirs="$noconfigdirs target-libobjc target-libstdc++-v3" ;; *-*-darwin*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" # APPLE LOCAL 64-bit bringup - noconfigdirs="$noconfigdirs target-libobjc ${libgcj}" + noconfigdirs="$noconfigdirs target-libobjc ${libgcj} target-libstdc++-v3" ;; *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" From sabre at nondot.org Fri Sep 14 17:25:19 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 14 Sep 2007 22:25:19 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41966 - /llvm-gcc-4.0/trunk/configure Message-ID: <200709142225.l8EMPKft028823@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 14 17:25:19 2007 New Revision: 41966 URL: http://llvm.org/viewvc/llvm-project?rev=41966&view=rev Log: regenerate. Modified: llvm-gcc-4.0/trunk/configure Modified: llvm-gcc-4.0/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/configure?rev=41966&r1=41965&r2=41966&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/configure (original) +++ llvm-gcc-4.0/trunk/configure Fri Sep 14 17:25:19 2007 @@ -1162,12 +1162,12 @@ powerpc-*-darwin*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" # APPLE LOCAL 64-bit bringup - noconfigdirs="$noconfigdirs target-libobjc" + noconfigdirs="$noconfigdirs target-libobjc target-libstdc++-v3" ;; *-*-darwin*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" # APPLE LOCAL 64-bit bringup - noconfigdirs="$noconfigdirs target-libobjc ${libgcj}" + noconfigdirs="$noconfigdirs target-libobjc ${libgcj} target-libstdc++-v3" ;; *-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" @@ -1269,10 +1269,6 @@ arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* ) noconfigdirs="$noconfigdirs target-libffi target-qthreads" ;; - arm*-*-linux-gnueabi) - noconfigdirs="$noconfigdirs target-libffi target-qthreads" - noconfigdirs="$noconfigdirs target-libjava target-libobjc" - ;; arm*-*-symbianelf*) noconfigdirs="$noconfigdirs ${libgcj} target-libiberty" ;; @@ -1816,7 +1812,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1820: checking for $ac_word" >&5 +echo "configure:1816: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1846,7 +1842,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1850: checking for $ac_word" >&5 +echo "configure:1846: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1897,7 +1893,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1901: checking for $ac_word" >&5 +echo "configure:1897: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1929,7 +1925,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1933: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1929: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1940,12 +1936,12 @@ cat > conftest.$ac_ext << EOF -#line 1944 "configure" +#line 1940 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1971,12 +1967,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1975: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1971: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1980: checking whether we are using GNU C" >&5 +echo "configure:1976: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1985,7 +1981,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2004,7 +2000,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2008: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2004: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2071,7 +2067,7 @@ # Extract the first word of "${ac_tool_prefix}gnatbind", so it can be a program name with args. set dummy ${ac_tool_prefix}gnatbind; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2075: checking for $ac_word" >&5 +echo "configure:2071: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2103,7 +2099,7 @@ # Extract the first word of "gnatbind", so it can be a program name with args. set dummy gnatbind; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2107: checking for $ac_word" >&5 +echo "configure:2103: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_GNATBIND'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2136,7 +2132,7 @@ fi echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6 -echo "configure:2140: checking whether compiler driver understands Ada" >&5 +echo "configure:2136: checking whether compiler driver understands Ada" >&5 if eval "test \"`echo '$''{'acx_cv_cc_gcc_supports_ada'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2168,7 +2164,7 @@ fi echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6 -echo "configure:2172: checking how to compare bootstrapped objects" >&5 +echo "configure:2168: checking how to compare bootstrapped objects" >&5 if eval "test \"`echo '$''{'gcc_cv_prog_cmp_skip'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2266,9 +2262,9 @@ CFLAGS="$CFLAGS $gmpinc" # Check GMP actually works echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6 -echo "configure:2270: checking for correct version of gmp.h" >&5 +echo "configure:2266: checking for correct version of gmp.h" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2279: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2292,12 +2288,12 @@ if test x"$have_gmp" = xyes; then echo $ac_n "checking for MPFR""... $ac_c" 1>&6 -echo "configure:2296: checking for MPFR" >&5 +echo "configure:2292: checking for MPFR" >&5 saved_LIBS="$LIBS" LIBS="$LIBS $gmplibs" cat > conftest.$ac_ext < #include @@ -2305,7 +2301,7 @@ mpfr_t n; mpfr_init(n); ; return 0; } EOF -if { (eval echo configure:2309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2792,7 +2788,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2796: checking for $ac_word" >&5 +echo "configure:2792: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_BISON'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2827,7 +2823,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2831: checking for $ac_word" >&5 +echo "configure:2827: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2862,7 +2858,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2866: checking for $ac_word" >&5 +echo "configure:2862: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_M4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2897,7 +2893,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2901: checking for $ac_word" >&5 +echo "configure:2897: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_FLEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2932,7 +2928,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2936: checking for $ac_word" >&5 +echo "configure:2932: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_LEX'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2967,7 +2963,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2971: checking for $ac_word" >&5 +echo "configure:2967: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_MAKEINFO'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3614,7 +3610,7 @@ # Extract the first word of "${ncn_tool_prefix}ar", so it can be a program name with args. set dummy ${ncn_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3618: checking for $ac_word" >&5 +echo "configure:3614: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3647,7 +3643,7 @@ # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3651: checking for $ac_word" >&5 +echo "configure:3647: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3686,7 +3682,7 @@ # Extract the first word of "${ncn_tool_prefix}as", so it can be a program name with args. set dummy ${ncn_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3690: checking for $ac_word" >&5 +echo "configure:3686: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3719,7 +3715,7 @@ # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3723: checking for $ac_word" >&5 +echo "configure:3719: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_AS'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3758,7 +3754,7 @@ # Extract the first word of "${ncn_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ncn_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3762: checking for $ac_word" >&5 +echo "configure:3758: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3791,7 +3787,7 @@ # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3795: checking for $ac_word" >&5 +echo "configure:3791: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_DLLTOOL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3830,7 +3826,7 @@ # Extract the first word of "${ncn_tool_prefix}ld", so it can be a program name with args. set dummy ${ncn_tool_prefix}ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3834: checking for $ac_word" >&5 +echo "configure:3830: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3863,7 +3859,7 @@ # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3867: checking for $ac_word" >&5 +echo "configure:3863: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_LD'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3902,7 +3898,7 @@ # Extract the first word of "${ncn_tool_prefix}nm", so it can be a program name with args. set dummy ${ncn_tool_prefix}nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3906: checking for $ac_word" >&5 +echo "configure:3902: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3935,7 +3931,7 @@ # Extract the first word of "nm", so it can be a program name with args. set dummy nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3939: checking for $ac_word" >&5 +echo "configure:3935: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_NM'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3974,7 +3970,7 @@ # Extract the first word of "${ncn_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ncn_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:3978: checking for $ac_word" >&5 +echo "configure:3974: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4007,7 +4003,7 @@ # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4011: checking for $ac_word" >&5 +echo "configure:4007: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4046,7 +4042,7 @@ # Extract the first word of "${ncn_tool_prefix}windres", so it can be a program name with args. set dummy ${ncn_tool_prefix}windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4050: checking for $ac_word" >&5 +echo "configure:4046: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4079,7 +4075,7 @@ # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4083: checking for $ac_word" >&5 +echo "configure:4079: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_WINDRES'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4118,7 +4114,7 @@ # Extract the first word of "${ncn_tool_prefix}objcopy", so it can be a program name with args. set dummy ${ncn_tool_prefix}objcopy; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4122: checking for $ac_word" >&5 +echo "configure:4118: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4151,7 +4147,7 @@ # Extract the first word of "objcopy", so it can be a program name with args. set dummy objcopy; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4155: checking for $ac_word" >&5 +echo "configure:4151: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4190,7 +4186,7 @@ # Extract the first word of "${ncn_tool_prefix}objdump", so it can be a program name with args. set dummy ${ncn_tool_prefix}objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4194: checking for $ac_word" >&5 +echo "configure:4190: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4223,7 +4219,7 @@ # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4227: checking for $ac_word" >&5 +echo "configure:4223: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_OBJDUMP'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4269,7 +4265,7 @@ # Extract the first word of "${ncn_target_tool_prefix}ar", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4273: checking for $ac_word" >&5 +echo "configure:4269: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4302,7 +4298,7 @@ # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4306: checking for $ac_word" >&5 +echo "configure:4302: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_AR_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4341,7 +4337,7 @@ # Extract the first word of "${ncn_target_tool_prefix}as", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4345: checking for $ac_word" >&5 +echo "configure:4341: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4374,7 +4370,7 @@ # Extract the first word of "as", so it can be a program name with args. set dummy as; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4378: checking for $ac_word" >&5 +echo "configure:4374: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_AS_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4413,7 +4409,7 @@ # Extract the first word of "${ncn_target_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4417: checking for $ac_word" >&5 +echo "configure:4413: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4446,7 +4442,7 @@ # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4450: checking for $ac_word" >&5 +echo "configure:4446: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_DLLTOOL_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4485,7 +4481,7 @@ # Extract the first word of "${ncn_target_tool_prefix}ld", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4489: checking for $ac_word" >&5 +echo "configure:4485: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4518,7 +4514,7 @@ # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4522: checking for $ac_word" >&5 +echo "configure:4518: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_LD_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4557,7 +4553,7 @@ # Extract the first word of "${ncn_target_tool_prefix}lipo", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}lipo; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4561: checking for $ac_word" >&5 +echo "configure:4557: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4590,7 +4586,7 @@ # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4594: checking for $ac_word" >&5 +echo "configure:4590: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_LIPO_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4629,7 +4625,7 @@ # Extract the first word of "${ncn_target_tool_prefix}nm", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4633: checking for $ac_word" >&5 +echo "configure:4629: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4662,7 +4658,7 @@ # Extract the first word of "nm", so it can be a program name with args. set dummy nm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4666: checking for $ac_word" >&5 +echo "configure:4662: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_NM_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4701,7 +4697,7 @@ # Extract the first word of "${ncn_target_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4705: checking for $ac_word" >&5 +echo "configure:4701: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4734,7 +4730,7 @@ # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4738: checking for $ac_word" >&5 +echo "configure:4734: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_RANLIB_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4773,7 +4769,7 @@ # Extract the first word of "${ncn_target_tool_prefix}strip", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4777: checking for $ac_word" >&5 +echo "configure:4773: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4806,7 +4802,7 @@ # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4810: checking for $ac_word" >&5 +echo "configure:4806: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_STRIP_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4845,7 +4841,7 @@ # Extract the first word of "${ncn_target_tool_prefix}windres", so it can be a program name with args. set dummy ${ncn_target_tool_prefix}windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4849: checking for $ac_word" >&5 +echo "configure:4845: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CONFIGURED_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4878,7 +4874,7 @@ # Extract the first word of "windres", so it can be a program name with args. set dummy windres; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4882: checking for $ac_word" >&5 +echo "configure:4878: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_ncn_cv_CONFIGURED_WINDRES_FOR_TARGET'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4969,7 +4965,7 @@ NM_FOR_TARGET=${NM_FOR_TARGET}${extra_nmflags_for_target} echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:4973: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:4969: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -5016,7 +5012,7 @@ # gcc for stageN-gcc and stagePREV-gcc for stage(N-1). In case this is not # possible, however, we can resort to mv. echo $ac_n "checking if symbolic links between directories work""... $ac_c" 1>&6 -echo "configure:5020: checking if symbolic links between directories work" >&5 +echo "configure:5016: checking if symbolic links between directories work" >&5 if eval "test \"`echo '$''{'gcc_cv_prog_ln_s_dir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else From dalej at apple.com Fri Sep 14 17:26:36 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 14 Sep 2007 22:26:36 -0000 Subject: [llvm-commits] [llvm] r41967 - in /llvm/trunk: include/llvm/ADT/APInt.h include/llvm/ADT/FoldingSet.h include/llvm/Constants.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Support/APInt.cpp lib/Support/FoldingSet.cpp lib/Target/CBackend/CBackend.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86RegisterInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Constants.cpp Message-ID: <200709142226.l8EMQbLv028880@zion.cs.uiuc.edu> Author: johannes Date: Fri Sep 14 17:26:36 2007 New Revision: 41967 URL: http://llvm.org/viewvc/llvm-project?rev=41967&view=rev Log: Remove the assumption that FP's are either float or double from some of the many places in the optimizers it appears, and do something reasonable with x86 long double. Make APInt::dump() public, remove newline, use it to dump ConstantSDNode's. Allow APFloats in FoldingSet. Expand X86 backend handling of long doubles (conversions to/from int, mostly). Modified: llvm/trunk/include/llvm/ADT/APInt.h llvm/trunk/include/llvm/ADT/FoldingSet.h llvm/trunk/include/llvm/Constants.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Support/APInt.cpp llvm/trunk/lib/Support/FoldingSet.cpp llvm/trunk/lib/Target/CBackend/CBackend.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/include/llvm/ADT/APInt.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APInt.h (original) +++ llvm/trunk/include/llvm/ADT/APInt.h Fri Sep 14 17:26:36 2007 @@ -153,11 +153,6 @@ const APInt &RHS, uint32_t rhsWords, APInt *Quotient, APInt *Remainder); -#ifndef NDEBUG - /// @brief debug method - void dump() const; -#endif - public: /// @name Constructors /// @{ @@ -1165,6 +1160,11 @@ static void tcSetLeastSignificantBits(integerPart *, unsigned int, unsigned int bits); +#ifndef NDEBUG + /// @brief debug method + void dump() const; +#endif + /// @} }; Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/FoldingSet.h (original) +++ llvm/trunk/include/llvm/ADT/FoldingSet.h Fri Sep 14 17:26:36 2007 @@ -18,6 +18,7 @@ #include "llvm/Support/DataTypes.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/APFloat.h" #include namespace llvm { @@ -153,6 +154,7 @@ void AddInteger(uint64_t I); void AddFloat(float F); void AddDouble(double D); + void AddAPFloat(const APFloat& apf); void AddString(const std::string &String); /// ComputeHash - Compute a strong hash value for this NodeID, used to Modified: llvm/trunk/include/llvm/Constants.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constants.h?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constants.h (original) +++ llvm/trunk/include/llvm/Constants.h Fri Sep 14 17:26:36 2007 @@ -231,6 +231,9 @@ /// considers -0.0 to be null as well as 0.0. :( virtual bool isNullValue() const; + // Get a negative zero. + static ConstantFP *getNegativeZero(const Type* Ty); + /// isExactlyValue - We don't rely on operator== working on double values, as /// it returns true for things that are clearly not equal, like -0.0 and 0.0. /// As such, this method can be used to do an exact bit-for-bit comparison of Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Sep 14 17:26:36 2007 @@ -486,15 +486,23 @@ // double. MVT::ValueType VT = CFP->getValueType(0); bool isDouble = VT == MVT::f64; - ConstantFP *LLVMC = ConstantFP::get(isDouble ? Type::DoubleTy : - Type::FloatTy, CFP->getValueAPF()); + ConstantFP *LLVMC = ConstantFP::get(VT==MVT::f64 ? Type::DoubleTy : + VT==MVT::f32 ? Type::FloatTy : + VT==MVT::f80 ? Type::X86_FP80Ty : + VT==MVT::f128 ? Type::FP128Ty : + VT==MVT::ppcf128 ? Type::PPC_FP128Ty : + Type::VoidTy, // error + CFP->getValueAPF()); if (!UseCP) { + if (VT!=MVT::f64 && VT!=MVT::f32) + assert(0 && "Invalid type expansion"); return DAG.getConstant(LLVMC->getValueAPF().convertToAPInt().getZExtValue(), isDouble ? MVT::i64 : MVT::i32); } if (isDouble && CFP->isValueValidForType(MVT::f32, CFP->getValueAPF()) && // Only do this if the target has a native EXTLOAD instruction from f32. + // Do not try to be clever about long doubles (so far) TLI.isLoadXLegal(ISD::EXTLOAD, MVT::f32)) { LLVMC = cast(ConstantExpr::getFPTrunc(LLVMC,Type::FloatTy)); VT = MVT::f32; @@ -1976,19 +1984,22 @@ // 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())) { + // We generally can't do this one for long doubles. + if (ConstantFPSDNode *CFP =dyn_cast(ST->getValue())) { if (CFP->getValueType(0) == MVT::f32) { Tmp3 = DAG.getConstant((uint32_t)CFP->getValueAPF(). convertToAPInt().getZExtValue(), MVT::i32); - } else { - assert(CFP->getValueType(0) == MVT::f64 && "Unknown FP type!"); + Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), + SVOffset, isVolatile, Alignment); + break; + } else if (CFP->getValueType(0) == MVT::f64) { Tmp3 = DAG.getConstant(CFP->getValueAPF().convertToAPInt(). getZExtValue(), MVT::i64); + Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), + SVOffset, isVolatile, Alignment); + break; } - Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(), - SVOffset, isVolatile, Alignment); - break; } switch (getTypeAction(ST->getStoredVT())) { @@ -4609,12 +4620,16 @@ SDOperand FudgeInReg; if (DestTy == MVT::f32) FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx, NULL, 0); - else { - assert(DestTy == MVT::f64 && "Unexpected conversion"); + else if (DestTy == MVT::f64) // FIXME: Avoid the extend by construction the right constantpool? FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, DAG.getEntryNode(), CPIdx, NULL, 0, MVT::f32); - } + else if (DestTy == MVT::f80) + FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, MVT::f80, DAG.getEntryNode(), + CPIdx, NULL, 0, MVT::f32); + else + assert(0 && "Unexpected conversion"); + MVT::ValueType SCVT = SignedConv.getValueType(); if (SCVT != DestTy) { // Destination type needs to be expanded as well. The FADD now we are @@ -4722,9 +4737,11 @@ if (DestVT == MVT::f64) { // do nothing Result = Sub; - } else { + } else if (DestVT == MVT::f32) { // if f32 then cast to f32 Result = DAG.getNode(ISD::FP_ROUND, MVT::f32, Sub); + } else if (DestVT == MVT::f80) { + Result = DAG.getNode(ISD::FP_EXTEND, MVT::f80, Sub); } return Result; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Sep 14 17:26:36 2007 @@ -322,13 +322,7 @@ break; case ISD::TargetConstantFP: case ISD::ConstantFP: { - APFloat V = cast(N)->getValueAPF(); - if (&V.getSemantics() == &APFloat::IEEEdouble) - ID.AddDouble(V.convertToDouble()); - else if (&V.getSemantics() == &APFloat::IEEEsingle) - ID.AddDouble((double)V.convertToFloat()); - else - assert(0); + ID.AddAPFloat(cast(N)->getValueAPF()); break; } case ISD::TargetGlobalAddress: @@ -709,25 +703,21 @@ MVT::ValueType EltVT = MVT::isVector(VT) ? MVT::getVectorElementType(VT) : VT; - bool isDouble = (EltVT == MVT::f64); - double Val = isDouble ? V.convertToDouble() : (double)V.convertToFloat(); // Do the map lookup using the actual bit pattern for the floating point // value, so that we don't have problems with 0.0 comparing equal to -0.0, and // we don't have issues with SNANs. unsigned Opc = isTarget ? ISD::TargetConstantFP : ISD::ConstantFP; - // ?? Should we store float/double/longdouble separately in ID? FoldingSetNodeID ID; AddNodeIDNode(ID, Opc, getVTList(EltVT), 0, 0); - ID.AddDouble(Val); + ID.AddAPFloat(V); void *IP = 0; SDNode *N = NULL; if ((N = CSEMap.FindNodeOrInsertPos(ID, IP))) if (!MVT::isVector(VT)) return SDOperand(N, 0); if (!N) { - N = new ConstantFPSDNode(isTarget, - isDouble ? APFloat(Val) : APFloat((float)Val), EltVT); + N = new ConstantFPSDNode(isTarget, V, EltVT); CSEMap.InsertNode(N, IP); AllNodes.push_back(N); } @@ -3724,9 +3714,15 @@ if (const ConstantSDNode *CSDN = dyn_cast(this)) { cerr << "<" << CSDN->getValue() << ">"; } else if (const ConstantFPSDNode *CSDN = dyn_cast(this)) { - cerr << "<" << (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEsingle ? - CSDN->getValueAPF().convertToFloat() : - CSDN->getValueAPF().convertToDouble()) << ">"; + if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEsingle) + cerr << "<" << CSDN->getValueAPF().convertToFloat() << ">"; + else if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEdouble) + cerr << "<" << CSDN->getValueAPF().convertToDouble() << ">"; + else { + cerr << "getValueAPF().convertToAPInt().dump(); + cerr << ")>"; + } } else if (const GlobalAddressSDNode *GADN = dyn_cast(this)) { int offset = GADN->getOffset(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Sep 14 17:26:36 2007 @@ -2004,8 +2004,7 @@ const Type *ElTy = DestTy->getElementType(); if (ElTy->isFloatingPoint()) { unsigned VL = DestTy->getNumElements(); - std::vector NZ(VL, ConstantFP::get(ElTy, - ElTy==Type::FloatTy ? APFloat(-0.0f) : APFloat(-0.0))); + std::vector NZ(VL, ConstantFP::getNegativeZero(ElTy)); Constant *CNZ = ConstantVector::get(&NZ[0], NZ.size()); if (CV == CNZ) { SDOperand Op2 = getValue(I.getOperand(1)); @@ -2017,7 +2016,7 @@ } if (Ty->isFloatingPoint()) { if (ConstantFP *CFP = dyn_cast(I.getOperand(0))) - if (CFP->isExactlyValue(-0.0)) { + if (CFP->isExactlyValue(ConstantFP::getNegativeZero(Ty)->getValueAPF())) { SDOperand Op2 = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FNEG, Op2.getValueType(), Op2)); return; Modified: llvm/trunk/lib/Support/APInt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/lib/Support/APInt.cpp (original) +++ llvm/trunk/lib/Support/APInt.cpp Fri Sep 14 17:26:36 2007 @@ -2009,7 +2009,7 @@ cerr << pVal[i-1] << " "; } cerr << " U(" << this->toStringUnsigned(10) << ") S(" - << this->toStringSigned(10) << ")\n" << std::setbase(10); + << this->toStringSigned(10) << ")" << std::setbase(10); } #endif Modified: llvm/trunk/lib/Support/FoldingSet.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/lib/Support/FoldingSet.cpp (original) +++ llvm/trunk/lib/Support/FoldingSet.cpp Fri Sep 14 17:26:36 2007 @@ -56,6 +56,12 @@ void FoldingSetImpl::NodeID::AddDouble(double D) { AddInteger(DoubleToBits(D)); } +void FoldingSetImpl::NodeID::AddAPFloat(const APFloat& apf) { + APInt api = apf.convertToAPInt(); + const uint64_t *p = api.getRawData(); + for (int i=0; igetType()!=Type::FloatTy && CFP->getType()!=Type::DoubleTy) + return false; APFloat APF = APFloat(CFP->getValueAPF()); // copy if (CFP->getType()==Type::FloatTy) APF.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Sep 14 17:26:36 2007 @@ -99,9 +99,11 @@ setOperationAction(ISD::SINT_TO_FP , MVT::i1 , Promote); setOperationAction(ISD::SINT_TO_FP , MVT::i8 , Promote); // SSE has no i16 to fp conversion, only i32 - if (X86ScalarSSE) + if (X86ScalarSSE) { setOperationAction(ISD::SINT_TO_FP , MVT::i16 , Promote); - else { + // f32 and f64 cases are Legal, f80 case is not + setOperationAction(ISD::SINT_TO_FP , MVT::i32 , Custom); + } else { setOperationAction(ISD::SINT_TO_FP , MVT::i16 , Custom); setOperationAction(ISD::SINT_TO_FP , MVT::i32 , Custom); } @@ -119,6 +121,8 @@ if (X86ScalarSSE) { setOperationAction(ISD::FP_TO_SINT , MVT::i16 , Promote); + // f32 and f64 cases are Legal, f80 case is not + setOperationAction(ISD::FP_TO_SINT , MVT::i32 , Custom); } else { setOperationAction(ISD::FP_TO_SINT , MVT::i16 , Custom); setOperationAction(ISD::FP_TO_SINT , MVT::i32 , Custom); @@ -189,11 +193,13 @@ setOperationAction(ISD::SELECT , MVT::i32 , Custom); setOperationAction(ISD::SELECT , MVT::f32 , Custom); setOperationAction(ISD::SELECT , MVT::f64 , Custom); + setOperationAction(ISD::SELECT , MVT::f80 , Custom); setOperationAction(ISD::SETCC , MVT::i8 , Custom); setOperationAction(ISD::SETCC , MVT::i16 , Custom); setOperationAction(ISD::SETCC , MVT::i32 , Custom); setOperationAction(ISD::SETCC , MVT::f32 , Custom); setOperationAction(ISD::SETCC , MVT::f64 , Custom); + setOperationAction(ISD::SETCC , MVT::f80 , Custom); if (Subtarget->is64Bit()) { setOperationAction(ISD::SELECT , MVT::i64 , Custom); setOperationAction(ISD::SETCC , MVT::i64 , Custom); @@ -334,6 +340,9 @@ // Long double always uses X87. addRegisterClass(MVT::f80, X86::RFP80RegisterClass); + setOperationAction(ISD::UNDEF, MVT::f80, Expand); + setOperationAction(ISD::FCOPYSIGN, MVT::f80, Expand); + setOperationAction(ISD::ConstantFP, MVT::f80, Expand); // First set operation action for all vector types to expand. Then we // will selectively turn on ones that can be effectively codegen'd. @@ -3326,9 +3335,14 @@ SDOperand Chain = DAG.getStore(DAG.getEntryNode(), Op.getOperand(0), StackSlot, NULL, 0); + // These are really Legal; caller falls through into that case. + if (SrcVT==MVT::i32 && Op.getValueType() != MVT::f80 && X86ScalarSSE) + return Result; + // Build the FILD SDVTList Tys; - if (X86ScalarSSE) + bool useSSE = X86ScalarSSE && Op.getValueType() != MVT::f80; + if (useSSE) Tys = DAG.getVTList(MVT::f64, MVT::Other, MVT::Flag); else Tys = DAG.getVTList(Op.getValueType(), MVT::Other); @@ -3336,10 +3350,10 @@ Ops.push_back(Chain); Ops.push_back(StackSlot); Ops.push_back(DAG.getValueType(SrcVT)); - Result = DAG.getNode(X86ScalarSSE ? X86ISD::FILD_FLAG :X86ISD::FILD, + Result = DAG.getNode(useSSE ? X86ISD::FILD_FLAG :X86ISD::FILD, Tys, &Ops[0], Ops.size()); - if (X86ScalarSSE) { + if (useSSE) { Chain = Result.getValue(1); SDOperand InFlag = Result.getValue(2); @@ -3368,11 +3382,17 @@ "Unknown FP_TO_SINT to lower!"); // We lower FP->sint64 into FISTP64, followed by a load, all to a temporary // stack slot. + SDOperand Result; MachineFunction &MF = DAG.getMachineFunction(); unsigned MemSize = MVT::getSizeInBits(Op.getValueType())/8; int SSFI = MF.getFrameInfo()->CreateStackObject(MemSize, MemSize); SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy()); + // These are really Legal. + if (Op.getValueType() == MVT::i32 && X86ScalarSSE && + Op.getOperand(0).getValueType() != MVT::f80) + return Result; + unsigned Opc; switch (Op.getValueType()) { default: assert(0 && "Invalid FP_TO_SINT to lower!"); @@ -3383,7 +3403,7 @@ SDOperand Chain = DAG.getEntryNode(); SDOperand Value = Op.getOperand(0); - if (X86ScalarSSE) { + if (X86ScalarSSE && Op.getOperand(0).getValueType() != MVT::f80) { assert(Op.getValueType() == MVT::i64 && "Invalid FP_TO_SINT to lower!"); Chain = DAG.getStore(Chain, Value, StackSlot, NULL, 0); SDVTList Tys = DAG.getVTList(Op.getOperand(0).getValueType(), MVT::Other); Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Sep 14 17:26:36 2007 @@ -168,7 +168,11 @@ Opc = X86::MOV32_mr; } else if (RC == &X86::GR16_RegClass) { Opc = X86::MOV16_mr; + } else if (RC == &X86::RFP80RegClass) { + Opc = X86::ST_FpP80m; // pops } else if (RC == &X86::RFP64RegClass || RC == &X86::RSTRegClass) { + /// FIXME spilling long double values as 64 bit does not work. + /// We need RST80, unfortunately. Opc = X86::ST_Fp64m; } else if (RC == &X86::RFP32RegClass) { Opc = X86::ST_Fp32m; @@ -205,6 +209,8 @@ Opc = X86::MOV32_rm; } else if (RC == &X86::GR16_RegClass) { Opc = X86::MOV16_rm; + } else if (RC == &X86::RFP80RegClass) { + Opc = X86::LD_Fp80m; } else if (RC == &X86::RFP64RegClass || RC == &X86::RSTRegClass) { Opc = X86::LD_Fp64m; } else if (RC == &X86::RFP32RegClass) { @@ -245,6 +251,8 @@ Opc = X86::MOV_Fp3232; } else if (RC == &X86::RFP64RegClass || RC == &X86::RSTRegClass) { Opc = X86::MOV_Fp6464; + } else if (RC == &X86::RFP80RegClass) { + Opc = X86::MOV_Fp8080; } else if (RC == &X86::FR32RegClass) { Opc = X86::FsMOVAPSrr; } else if (RC == &X86::FR64RegClass) { Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri Sep 14 17:26:36 2007 @@ -1949,7 +1949,8 @@ if (RHSC->isNullValue()) return ReplaceInstUsesWith(I, LHS); } else if (ConstantFP *CFP = dyn_cast(RHSC)) { - if (CFP->isExactlyValue(-0.0)) + if (CFP->isExactlyValue(ConstantFP::getNegativeZero + (I.getType())->getValueAPF())) return ReplaceInstUsesWith(I, LHS); } @@ -2349,8 +2350,10 @@ // "In IEEE floating point, x*1 is not equivalent to x for nans. However, // ANSI says we can drop signals, so we can do this anyway." (from GCC) - if (Op1F->isExactlyValue(1.0)) - return ReplaceInstUsesWith(I, Op0); // Eliminate 'mul double %X, 1.0' + // We need a better interface for long double here. + if (Op1->getType() == Type::FloatTy || Op1->getType() == Type::DoubleTy) + if (Op1F->isExactlyValue(1.0)) + return ReplaceInstUsesWith(I, Op0); // Eliminate 'mul double %X, 1.0' } if (BinaryOperator *Op0I = dyn_cast(Op0)) Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=41967&r1=41966&r2=41967&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Fri Sep 14 17:26:36 2007 @@ -103,17 +103,19 @@ // Static constructor to create a '0' constant of arbitrary type... Constant *Constant::getNullValue(const Type *Ty) { + static uint64_t zero[2] = {0, 0}; switch (Ty->getTypeID()) { case Type::IntegerTyID: return ConstantInt::get(Ty, 0); case Type::FloatTyID: - return ConstantFP::get(Ty, APFloat(0.0f)); + return ConstantFP::get(Ty, APFloat(APInt(32, 0))); case Type::DoubleTyID: - return ConstantFP::get(Ty, APFloat(0.0)); + return ConstantFP::get(Ty, APFloat(APInt(64, 0))); case Type::X86_FP80TyID: - case Type::PPC_FP128TyID: + return ConstantFP::get(Ty, APFloat(APInt(80, 2, zero))); case Type::FP128TyID: - return ConstantFP::get(Ty, APFloat(0.0)); //FIXME + case Type::PPC_FP128TyID: + return ConstantFP::get(Ty, APFloat(APInt(128, 2, zero))); case Type::PointerTyID: return ConstantPointerNull::get(cast(Ty)); case Type::StructTyID: @@ -259,6 +261,12 @@ return Val.isZero() && !Val.isNegative(); } +ConstantFP *ConstantFP::getNegativeZero(const Type *Ty) { + APFloat apf = cast (Constant::getNullValue(Ty))->getValueAPF(); + apf.changeSign(); + return ConstantFP::get(Ty, apf); +} + bool ConstantFP::isExactlyValue(const APFloat& V) const { return Val.bitwiseIsEqual(V); } @@ -1925,15 +1933,12 @@ if (const VectorType *PTy = dyn_cast(Ty)) if (PTy->getElementType()->isFloatingPoint()) { std::vector zeros(PTy->getNumElements(), - ConstantFP::get(PTy->getElementType(), - PTy->getElementType()==Type::FloatTy ? - APFloat(-0.0f) : APFloat(0.0))); + ConstantFP::getNegativeZero(PTy->getElementType())); return ConstantVector::get(PTy, zeros); } - if (Ty->isFloatingPoint()) - return ConstantFP::get(Ty, Ty==Type::FloatTy ? APFloat(-0.0f) : - APFloat(-0.0)); + if (Ty->isFloatingPoint()) + return ConstantFP::getNegativeZero(Ty); return Constant::getNullValue(Ty); } From clattner at apple.com Fri Sep 14 17:30:37 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 14 Sep 2007 15:30:37 -0700 Subject: [llvm-commits] remove libstdc++ from llvm-gcc configure targets In-Reply-To: References: Message-ID: <5D84C826-0B58-4302-AAD5-F04FC27CCE50@apple.com> On Sep 14, 2007, at 3:16 PM, Eric Christopher wrote: > As it says. Tested on x86-darwin. > > -eric > > 2007-09-14 Eric Christopher > > * configure.in (powerpc*-*-darwin*): Add target-libstdc++-v3 to > noconfidirs. > (*-*-darwin*): Ditto. > * configure: Regenerate. Thanks! I applied your patch: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- Mon-20070910/053528.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- Mon-20070910/053529.html FYI, you don't need to produce a formal change log for LLVM, a description of what changed is sufficient. Thanks again! -Chris From clattner at apple.com Fri Sep 14 17:31:46 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 14 Sep 2007 15:31:46 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r41966 - /llvm-gcc-4.0/trunk/configure In-Reply-To: <200709142225.l8EMPKft028823@zion.cs.uiuc.edu> References: <200709142225.l8EMPKft028823@zion.cs.uiuc.edu> Message-ID: <9867CF1F-4E96-43EB-A330-857A2226CA8A@apple.com> > @@ -1269,10 +1269,6 @@ > arm-*-elf* | strongarm-*-elf* | xscale-*-elf* | arm*-*-eabi* ) > noconfigdirs="$noconfigdirs target-libffi target-qthreads" > ;; > - arm*-*-linux-gnueabi) > - noconfigdirs="$noconfigdirs target-libffi target-qthreads" > - noconfigdirs="$noconfigdirs target-libjava target-libobjc" > - ;; FYI, Lauro, it looks like the linux-gnueabi portion here isn't in configure.in, only in configure. If it is important, please add it to both again, thanks! -Chris From resistor at mac.com Fri Sep 14 17:33:52 2007 From: resistor at mac.com (Owen Anderson) Date: Fri, 14 Sep 2007 22:33:52 -0000 Subject: [llvm-commits] [llvm] r41968 - /llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp Message-ID: <200709142233.l8EMXqY2029069@zion.cs.uiuc.edu> Author: resistor Date: Fri Sep 14 17:33:52 2007 New Revision: 41968 URL: http://llvm.org/viewvc/llvm-project?rev=41968&view=rev Log: Remove RLE. It is subsumed by GVN. Removed: llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp Removed: llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp?rev=41967&view=auto ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp (removed) @@ -1,135 +0,0 @@ -//===- FastDLE.cpp - Fast Dead Load Elimination ---------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by Owen Anderson and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file implements a trivial dead load elimination that only considers -// basic-block local redundant load. -// -// FIXME: This should eventually be extended to be a post-dominator tree -// traversal. Doing so would be pretty trivial. -// -//===----------------------------------------------------------------------===// - -#define DEBUG_TYPE "rle" -#include "llvm/Transforms/Scalar.h" -#include "llvm/Function.h" -#include "llvm/Instructions.h" -#include "llvm/Pass.h" -#include "llvm/ADT/SmallPtrSet.h" -#include "llvm/ADT/Statistic.h" -#include "llvm/Analysis/MemoryDependenceAnalysis.h" -#include "llvm/Transforms/Utils/Local.h" -#include "llvm/Support/Compiler.h" -using namespace llvm; - -STATISTIC(NumFastLoads, "Number of loads deleted"); - -namespace { - struct VISIBILITY_HIDDEN RLE : public FunctionPass { - static char ID; // Pass identification, replacement for typeid - RLE() : FunctionPass((intptr_t)&ID) {} - - virtual bool runOnFunction(Function &F) { - bool Changed = false; - for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) - Changed |= runOnBasicBlock(*I); - return Changed; - } - - bool runOnBasicBlock(BasicBlock &BB); - - // getAnalysisUsage - We require post dominance frontiers (aka Control - // Dependence Graph) - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesCFG(); - AU.addRequired(); - AU.addPreserved(); - } - }; - char RLE::ID = 0; - RegisterPass X("rle", "Redundant Load Elimination"); -} - -FunctionPass *llvm::createRedundantLoadEliminationPass() { return new RLE(); } - -bool RLE::runOnBasicBlock(BasicBlock &BB) { - MemoryDependenceAnalysis& MD = getAnalysis(); - - // Record the last-seen load from this pointer - DenseMap lastLoad; - - bool MadeChange = false; - - // Do a top-down walk on the BB - for (BasicBlock::iterator BBI = BB.begin(), BBE = BB.end(); - BBI != BBE; ++BBI) { - // If we find a store or a free... - if (LoadInst* L = dyn_cast(BBI)) { - // We can't delete volatile loads - if (L->isVolatile()) { - lastLoad[L->getPointerOperand()] = L; - continue; - } - - Value* pointer = L->getPointerOperand(); - LoadInst*& last = lastLoad[pointer]; - - // ... to a pointer that has been loaded from before... - Instruction* dep = MD.getDependency(BBI); - bool deletedLoad = false; - - while (dep != MemoryDependenceAnalysis::None && - dep != MemoryDependenceAnalysis::NonLocal && - (isa(dep) || isa(dep))) { - // ... that depends on a store ... - if (StoreInst* S = dyn_cast(dep)) { - if (S->getPointerOperand() == pointer) { - // Remove it! - MD.removeInstruction(BBI); - - BBI--; - L->replaceAllUsesWith(S->getOperand(0)); - L->eraseFromParent(); - NumFastLoads++; - deletedLoad = true; - MadeChange = true; - } - - // Whether we removed it or not, we can't - // go any further - break; - } else if (!last) { - // If we don't depend on a store, and we haven't - // been loaded before, bail. - break; - } else if (dep == last) { - // Remove it! - MD.removeInstruction(BBI); - - BBI--; - L->replaceAllUsesWith(last); - L->eraseFromParent(); - deletedLoad = true; - NumFastLoads++; - MadeChange = true; - - break; - } else { - dep = MD.getDependency(BBI, dep); - } - } - - if (!deletedLoad) - last = L; - } - } - - return MadeChange; -} - - From asl at math.spbu.ru Fri Sep 14 17:35:36 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 14 Sep 2007 22:35:36 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41969 - in /llvm-gcc-4.2/trunk: configure configure.in Message-ID: <200709142235.l8EMZadq029119@zion.cs.uiuc.edu> Author: asl Date: Fri Sep 14 17:35:36 2007 New Revision: 41969 URL: http://llvm.org/viewvc/llvm-project?rev=41969&view=rev Log: Forward of r41965: When building on darwin, automatically disable building libstdc++. Patch by Eric Christopher! Modified: llvm-gcc-4.2/trunk/configure llvm-gcc-4.2/trunk/configure.in Modified: llvm-gcc-4.2/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure?rev=41969&r1=41968&r2=41969&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/configure (original) +++ llvm-gcc-4.2/trunk/configure Fri Sep 14 17:35:36 2007 @@ -1210,12 +1210,12 @@ ;; powerpc-*-darwin* | i[3456789]86-*-darwin*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" - noconfigdirs="$noconfigdirs sim target-rda" + noconfigdirs="$noconfigdirs sim target-rda target-libstdc++-v3" ;; *-*-darwin*) noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" - noconfigdirs="$noconfigdirs ${libgcj}" + noconfigdirs="$noconfigdirs ${libgcj} target-libstdc++-v3" ;; *-*-freebsd[12] | *-*-freebsd[12].* | *-*-freebsd*aout*) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" Modified: llvm-gcc-4.2/trunk/configure.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure.in?rev=41969&r1=41968&r2=41969&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/configure.in (original) +++ llvm-gcc-4.2/trunk/configure.in Fri Sep 14 17:35:36 2007 @@ -370,12 +370,12 @@ ;; powerpc-*-darwin* | i[[3456789]]86-*-darwin*) noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof" - noconfigdirs="$noconfigdirs sim target-rda" + noconfigdirs="$noconfigdirs sim target-rda target-libstdc++-v3" ;; *-*-darwin*) noconfigdirs="$noconfigdirs ld gas gdb gprof" noconfigdirs="$noconfigdirs sim target-rda" - noconfigdirs="$noconfigdirs ${libgcj}" + noconfigdirs="$noconfigdirs ${libgcj} target-libstdc++-v3" ;; *-*-freebsd[[12]] | *-*-freebsd[[12]].* | *-*-freebsd*aout*) noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}" From resistor at mac.com Fri Sep 14 17:54:47 2007 From: resistor at mac.com (Owen Anderson) Date: Fri, 14 Sep 2007 22:54:47 -0000 Subject: [llvm-commits] [llvm] r41971 - in /llvm/trunk/include/llvm: LinkAllPasses.h Transforms/Scalar.h Message-ID: <200709142254.l8EMsl3D029687@zion.cs.uiuc.edu> Author: resistor Date: Fri Sep 14 17:54:46 2007 New Revision: 41971 URL: http://llvm.org/viewvc/llvm-project?rev=41971&view=rev Log: Remove RLE from the headers, since the pass itself is gone now. Modified: llvm/trunk/include/llvm/LinkAllPasses.h llvm/trunk/include/llvm/Transforms/Scalar.h Modified: llvm/trunk/include/llvm/LinkAllPasses.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllPasses.h?rev=41971&r1=41970&r2=41971&view=diff ============================================================================== --- llvm/trunk/include/llvm/LinkAllPasses.h (original) +++ llvm/trunk/include/llvm/LinkAllPasses.h Fri Sep 14 17:54:46 2007 @@ -61,7 +61,6 @@ (void) llvm::createDeadStoreEliminationPass(); (void) llvm::createDeadTypeEliminationPass(); (void) llvm::createEdgeProfilerPass(); - (void) llvm::createRedundantLoadEliminationPass(); (void) llvm::createFunctionInliningPass(); (void) llvm::createFunctionProfilerPass(); (void) llvm::createGCSEPass(); Modified: llvm/trunk/include/llvm/Transforms/Scalar.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Scalar.h?rev=41971&r1=41970&r2=41971&view=diff ============================================================================== --- llvm/trunk/include/llvm/Transforms/Scalar.h (original) +++ llvm/trunk/include/llvm/Transforms/Scalar.h Fri Sep 14 17:54:46 2007 @@ -332,13 +332,6 @@ //===----------------------------------------------------------------------===// // -// RedundantLoadElimination - This pass deletes loads that are dominated by -// must-aliased loads and are not stored to between the loads. -// -FunctionPass *createRedundantLoadEliminationPass(); - -//===----------------------------------------------------------------------===// -// // GVN - This pass performs global value numbering and redundant load // elimination cotemporaneously. // From sabre at nondot.org Fri Sep 14 17:57:00 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 14 Sep 2007 22:57:00 -0000 Subject: [llvm-commits] [llvm] r41972 - /llvm/trunk/lib/Support/FoldingSet.cpp Message-ID: <200709142257.l8EMv0c5029759@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 14 17:57:00 2007 New Revision: 41972 URL: http://llvm.org/viewvc/llvm-project?rev=41972&view=rev Log: fix a gcc warning: comparison between signed and unsigned integer expressions Modified: llvm/trunk/lib/Support/FoldingSet.cpp Modified: llvm/trunk/lib/Support/FoldingSet.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=41972&r1=41971&r2=41972&view=diff ============================================================================== --- llvm/trunk/lib/Support/FoldingSet.cpp (original) +++ llvm/trunk/lib/Support/FoldingSet.cpp Fri Sep 14 17:57:00 2007 @@ -59,7 +59,7 @@ void FoldingSetImpl::NodeID::AddAPFloat(const APFloat& apf) { APInt api = apf.convertToAPInt(); const uint64_t *p = api.getRawData(); - for (int i=0; i Author: djg Date: Fri Sep 14 18:17:45 2007 New Revision: 41975 URL: http://llvm.org/viewvc/llvm-project?rev=41975&view=rev Log: Add patterns for SHLD64* and SHRD64*. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrX86-64.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=41975&r1=41974&r2=41975&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Sep 14 18:17:45 2007 @@ -338,7 +338,9 @@ case X86::SHRD16rri8: // A = SHRD16rri8 B, C, I -> A = SHLD16rri8 C, B, (16-I) case X86::SHLD16rri8: // A = SHLD16rri8 B, C, I -> A = SHRD16rri8 C, B, (16-I) case X86::SHRD32rri8: // A = SHRD32rri8 B, C, I -> A = SHLD32rri8 C, B, (32-I) - case X86::SHLD32rri8:{// A = SHLD32rri8 B, C, I -> A = SHRD32rri8 C, B, (32-I) + case X86::SHLD32rri8: // A = SHLD32rri8 B, C, I -> A = SHRD32rri8 C, B, (32-I) + case X86::SHRD64rri8: // A = SHRD64rri8 B, C, I -> A = SHLD64rri8 C, B, (64-I) + case X86::SHLD64rri8:{// A = SHLD64rri8 B, C, I -> A = SHRD64rri8 C, B, (64-I) unsigned Opc; unsigned Size; switch (MI->getOpcode()) { @@ -347,6 +349,8 @@ case X86::SHLD16rri8: Size = 16; Opc = X86::SHRD16rri8; break; case X86::SHRD32rri8: Size = 32; Opc = X86::SHLD32rri8; break; case X86::SHLD32rri8: Size = 32; Opc = X86::SHRD32rri8; break; + case X86::SHRD64rri8: Size = 64; Opc = X86::SHLD64rri8; break; + case X86::SHLD64rri8: Size = 64; Opc = X86::SHRD64rri8; break; } unsigned Amt = MI->getOperand(3).getImmedValue(); unsigned A = MI->getOperand(0).getReg(); Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=41975&r1=41974&r2=41975&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Fri Sep 14 18:17:45 2007 @@ -564,38 +564,50 @@ let isTwoAddress = 1 in { let Uses = [CL] in { def SHLD64rrCL : RI<0xA5, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2), - "shld{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, TB; + "shld{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", + [(set GR64:$dst, (X86shld GR64:$src1, GR64:$src2, CL))]>, TB; def SHRD64rrCL : RI<0xAD, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2), - "shrd{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, TB; + "shrd{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", + [(set GR64:$dst, (X86shrd GR64:$src1, GR64:$src2, CL))]>, TB; } let isCommutable = 1 in { // FIXME: Update X86InstrInfo::commuteInstruction def SHLD64rri8 : RIi8<0xA4, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2, i8imm:$src3), - "shld{q}\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>, - TB; + "shld{q}\t{$src3, $src2, $dst|$dst, $src2, $src3}", + [(set GR64:$dst, (X86shld GR64:$src1, GR64:$src2, + (i8 imm:$src3)))]>, + TB; def SHRD64rri8 : RIi8<0xAC, MRMDestReg, (outs GR64:$dst), (ins GR64:$src1, GR64:$src2, i8imm:$src3), - "shrd{q}\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>, + "shrd{q}\t{$src3, $src2, $dst|$dst, $src2, $src3}", + [(set GR64:$dst, (X86shrd GR64:$src1, GR64:$src2, + (i8 imm:$src3)))]>, TB; } // isCommutable } // isTwoAddress -// Temporary hack: there is no patterns associated with these instructions -// so we have to tell tblgen that these do not produce results. let Uses = [CL] in { def SHLD64mrCL : RI<0xA5, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src2), - "shld{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, TB; + "shld{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", + [(store (X86shld (loadi64 addr:$dst), GR64:$src2, CL), + addr:$dst)]>, TB; def SHRD64mrCL : RI<0xAD, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src2), - "shrd{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", []>, TB; + "shrd{q}\t{%cl, $src2, $dst|$dst, $src2, %CL}", + [(store (X86shrd (loadi64 addr:$dst), GR64:$src2, CL), + addr:$dst)]>, TB; } def SHLD64mri8 : RIi8<0xA4, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src2, i8imm:$src3), - "shld{q}\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>, + "shld{q}\t{$src3, $src2, $dst|$dst, $src2, $src3}", + [(store (X86shld (loadi64 addr:$dst), GR64:$src2, + (i8 imm:$src3)), addr:$dst)]>, TB; def SHRD64mri8 : RIi8<0xAC, MRMDestMem, (outs), (ins i64mem:$dst, GR64:$src2, i8imm:$src3), - "shrd{q}\t{$src3, $src2, $dst|$dst, $src2, $src3}", []>, + "shrd{q}\t{$src3, $src2, $dst|$dst, $src2, $src3}", + [(store (X86shrd (loadi64 addr:$dst), GR64:$src2, + (i8 imm:$src3)), addr:$dst)]>, TB; } // Defs = [EFLAGS] From tonic at nondot.org Fri Sep 14 18:22:06 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 14 Sep 2007 23:22:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41976 - /llvm-gcc-4.0/trunk/README.LLVM Message-ID: <200709142322.l8ENM6tc030447@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 14 18:22:06 2007 New Revision: 41976 URL: http://llvm.org/viewvc/llvm-project?rev=41976&view=rev Log: Suggest program prefix. Modified: llvm-gcc-4.0/trunk/README.LLVM Modified: llvm-gcc-4.0/trunk/README.LLVM URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/README.LLVM?rev=41976&r1=41975&r2=41976&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/README.LLVM (original) +++ llvm-gcc-4.0/trunk/README.LLVM Fri Sep 14 18:22:06 2007 @@ -119,7 +119,7 @@ $ mkdir obj $ mkdir install $ cd obj -$ ../llvm-gcc4-x.y.source/configure --prefix=`pwd`/../install \ +$ ../llvm-gcc4-x.y.source/configure --prefix=`pwd`/../install --program-prefix=llvm- \ --enable-llvm=$LLVMOBJDIR --enable-languages=c,c++$EXTRALANGS $TARGETOPTIONS $ make $BUILDOPTIONS $ make install From sabre at nondot.org Fri Sep 14 23:43:13 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 15 Sep 2007 04:43:13 -0000 Subject: [llvm-commits] [test-suite] r41977 - in /test-suite/trunk/SingleSource/UnitTests/Vector/Altivec: Makefile alti.isamax.c Message-ID: <200709150443.l8F4hDKM009634@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 14 23:43:12 2007 New Revision: 41977 URL: http://llvm.org/viewvc/llvm-project?rev=41977&view=rev Log: some portability fixes Modified: test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/Makefile test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/alti.isamax.c Modified: test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/Makefile?rev=41977&r1=41976&r2=41977&view=diff ============================================================================== --- test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/Makefile (original) +++ test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/Makefile Fri Sep 14 23:43:12 2007 @@ -7,5 +7,5 @@ # FIXME: CBE doesn't support vectors: PR1126 DISABLE_CBE=1 -TARGET_FLAGS += -maltivec -LCCFLAGS += -maltivec +TARGET_FLAGS += -maltivec -faltivec +LCCFLAGS += -maltivec -faltivec Modified: test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/alti.isamax.c URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/alti.isamax.c?rev=41977&r1=41976&r2=41977&view=diff ============================================================================== --- test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/alti.isamax.c (original) +++ test-suite/trunk/SingleSource/UnitTests/Vector/Altivec/alti.isamax.c Fri Sep 14 23:43:12 2007 @@ -2,7 +2,7 @@ #include #include #include -#define N 1027 +#define N 1028 main() { /* @@ -12,7 +12,7 @@ Oxford Univ. Press, 2004 wpp 5/8/2002 */ - float x[N]; + float x[N] __attribute__((aligned(16))); float xb; int err,flag,i,im,k,ki,kl,ib,n0,n; int isamax(int,float *); @@ -43,6 +43,7 @@ kl = 4; // for n > 1, 3 steps of increase in n } if(flag==0) printf(" All n tests pass\n"); + return 0; } #define NS 12 int isamax(int n, float *x) @@ -55,7 +56,9 @@ vector float V7 = (vector float) (0.0,1.0,2.0,3.0); const vector float incr_4 = (vector float) (4.0,4.0,4.0,4.0); const vector float minus0 = (vector float) (-0.0,-0.0,-0.0,-0.0); - float big,xbig[4],indx[4]; + float big; + float xbig[4] __attribute__((aligned(16))); + float indx[4] __attribute__((aligned(16))); // n < NS done in scalar mode if(n < NS){ ibig = 0; From tonic at nondot.org Fri Sep 14 23:47:07 2007 From: tonic at nondot.org (Tanya Lattner) Date: Sat, 15 Sep 2007 04:47:07 -0000 Subject: [llvm-commits] [llvm] r41978 - /llvm/branches/release_21/test/CodeGen/PowerPC/fabs.ll Message-ID: <200709150447.l8F4l7p6009781@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 14 23:47:06 2007 New Revision: 41978 URL: http://llvm.org/viewvc/llvm-project?rev=41978&view=rev Log: Merge from mainline to fix make check error on x86. Modified: llvm/branches/release_21/test/CodeGen/PowerPC/fabs.ll Modified: llvm/branches/release_21/test/CodeGen/PowerPC/fabs.ll URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/test/CodeGen/PowerPC/fabs.ll?rev=41978&r1=41977&r2=41978&view=diff ============================================================================== --- llvm/branches/release_21/test/CodeGen/PowerPC/fabs.ll (original) +++ llvm/branches/release_21/test/CodeGen/PowerPC/fabs.ll Fri Sep 14 23:47:06 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=ppc32 | grep {fabs f1, f1} +; RUN: llvm-as < %s | llc -march=ppc32 -mtriple=powerpc-apple-darwin | grep {fabs f1, f1} define double @fabs(double %f) { entry: From sabre at nondot.org Sat Sep 15 00:46:42 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 15 Sep 2007 05:46:42 -0000 Subject: [llvm-commits] [llvm] r41979 - /llvm/trunk/test/CFrontend/2007-09-14-NegatePointer.c Message-ID: <200709150546.l8F5kg5U025010@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 15 00:46:41 2007 New Revision: 41979 URL: http://llvm.org/viewvc/llvm-project?rev=41979&view=rev Log: New testcase for PR1662. GCC trees are horrible :( Added: llvm/trunk/test/CFrontend/2007-09-14-NegatePointer.c Added: llvm/trunk/test/CFrontend/2007-09-14-NegatePointer.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-09-14-NegatePointer.c?rev=41979&view=auto ============================================================================== --- llvm/trunk/test/CFrontend/2007-09-14-NegatePointer.c (added) +++ llvm/trunk/test/CFrontend/2007-09-14-NegatePointer.c Sat Sep 15 00:46:41 2007 @@ -0,0 +1,7 @@ +// RUN: %llvmgcc -S %s -o - +// PR1662 + +int foo(unsigned char *test) { + return 0U - (unsigned int )test; +} + From sabre at nondot.org Sat Sep 15 00:47:05 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 15 Sep 2007 05:47:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r41980 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Message-ID: <200709150547.l8F5l5nZ025035@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 15 00:47:04 2007 New Revision: 41980 URL: http://llvm.org/viewvc/llvm-project?rev=41980&view=rev Log: Fix PR1662 by handling pointer NEGATE_EXPR. Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=41980&r1=41979&r2=41980&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Sat Sep 15 00:47:04 2007 @@ -3156,8 +3156,17 @@ } Value *TreeToLLVM::EmitNEGATE_EXPR(tree exp, Value *DestLoc) { - if (!DestLoc) - return Builder.CreateNeg(Emit(TREE_OPERAND(exp, 0), 0), "tmp"); + if (!DestLoc) { + Value *V = Emit(TREE_OPERAND(exp, 0), 0); + if (!isa(V->getType())) + return Builder.CreateNeg(V, "tmp"); + + // GCC allows NEGATE_EXPR on pointers as well. Cast to int, negate, cast + // back. + V = CastToAnyType(V, false, TD.getIntPtrType(), false); + V = Builder.CreateNeg(V, "tmp"); + return CastToType(Instruction::IntToPtr, V, ConvertType(TREE_TYPE(exp))); + } // Emit the operand to a temporary. const Type *ComplexTy=cast(DestLoc->getType())->getElementType(); From sabre at nondot.org Sat Sep 15 00:47:38 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 15 Sep 2007 05:47:38 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r41981 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200709150547.l8F5lcIq025120@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 15 00:47:38 2007 New Revision: 41981 URL: http://llvm.org/viewvc/llvm-project?rev=41981&view=rev Log: Fix PR1662 by handling pointer negate_expr. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=41981&r1=41980&r2=41981&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sat Sep 15 00:47:38 2007 @@ -2683,8 +2683,17 @@ } Value *TreeToLLVM::EmitNEGATE_EXPR(tree exp, Value *DestLoc) { - if (!DestLoc) - return Builder.CreateNeg(Emit(TREE_OPERAND(exp, 0), 0), "tmp"); + if (!DestLoc) { + Value *V = Emit(TREE_OPERAND(exp, 0), 0); + if (!isa(V->getType())) + return Builder.CreateNeg(V, "tmp"); + + // GCC allows NEGATE_EXPR on pointers as well. Cast to int, negate, cast + // back. + V = CastToAnyType(V, false, TD.getIntPtrType(), false); + V = Builder.CreateNeg(V, "tmp"); + return CastToType(Instruction::IntToPtr, V, ConvertType(TREE_TYPE(exp))); + } // Emit the operand to a temporary. const Type *ComplexTy=cast(DestLoc->getType())->getElementType(); From sabre at nondot.org Sat Sep 15 01:00:44 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 15 Sep 2007 06:00:44 -0000 Subject: [llvm-commits] [test-suite] r41982 - /test-suite/trunk/External/SPEC/Makefile.spec Message-ID: <200709150600.l8F60iqj019722@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 15 01:00:44 2007 New Revision: 41982 URL: http://llvm.org/viewvc/llvm-project?rev=41982&view=rev Log: add bugpoint-cbe target Modified: test-suite/trunk/External/SPEC/Makefile.spec Modified: test-suite/trunk/External/SPEC/Makefile.spec URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/Makefile.spec?rev=41982&r1=41981&r2=41982&view=diff ============================================================================== --- test-suite/trunk/External/SPEC/Makefile.spec (original) +++ test-suite/trunk/External/SPEC/Makefile.spec Sat Sep 15 01:00:44 2007 @@ -161,6 +161,13 @@ $(LLCBETAOPTION) $(BUGPOINT_ARGS) @echo "===> Leaving Output/bugpoint-$(RUN_TYPE)" +$(PROGRAMS_TO_TEST:%=Output/%.bugpoint-cbe): \ +Output/%.bugpoint-cbe: Output/%.llvm.bc $(LBUGPOINT) Output/%.out-nat + $(SPEC_SANDBOX) bugpoint-$(RUN_TYPE) $@ $(REF_IN_DIR) \ + $(LBUGPOINT) ../$*.llvm.bc -cbe-bug $(BUGPOINT_OPTIONS) \ + $(BUGPOINT_ARGS) + @echo "===> Leaving Output/bugpoint-$(RUN_TYPE)" + LIBPROFILESO = $(LLVM_OBJ_ROOT)/Debug/lib/libprofile_rt.so From clattner at apple.com Sat Sep 15 01:12:55 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 14 Sep 2007 23:12:55 -0700 Subject: [llvm-commits] [llvm] r41967 - in /llvm/trunk: include/llvm/ADT/APInt.h include/llvm/ADT/FoldingSet.h include/llvm/Constants.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Support/APInt.cpp lib/Support/FoldingSet.cpp lib/Target/CBackend/CBackend.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86RegisterInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Constants.cpp In-Reply-To: <200709142226.l8EMQbLv028880@zion.cs.uiuc.edu> References: <200709142226.l8EMQbLv028880@zion.cs.uiuc.edu> Message-ID: > Remove the assumption that FP's are either float or > double from some of the many places in the optimizers > it appears, and do something reasonable with x86 > long double. Nice! > ====================================================================== > ======== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Sep 14 > 17:26:36 2007 > @@ -486,15 +486,23 @@ > // double. > MVT::ValueType VT = CFP->getValueType(0); > bool isDouble = VT == MVT::f64; > - ConstantFP *LLVMC = ConstantFP::get(isDouble ? Type::DoubleTy : > - Type::FloatTy, CFP- > >getValueAPF()); > + ConstantFP *LLVMC = ConstantFP::get(VT==MVT::f64 ? Type::DoubleTy : > + VT==MVT::f32 ? Type::FloatTy : > + VT==MVT::f80 ? > Type::X86_FP80Ty : > + VT==MVT::f128 ? Type::FP128Ty : > + VT==MVT::ppcf128 ? > Type::PPC_FP128Ty : > + Type::VoidTy, // error > + CFP->getValueAPF()); This should probably use MVT::getTypeForValueType(VT) > @@ -4609,12 +4620,16 @@ > SDOperand FudgeInReg; > if (DestTy == MVT::f32) > FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), > CPIdx, NULL, 0); > - else { > - assert(DestTy == MVT::f64 && "Unexpected conversion"); > + else if (DestTy == MVT::f64) > // FIXME: Avoid the extend by construction the right > constantpool? > FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, > DAG.getEntryNode(), > CPIdx, NULL, 0, MVT::f32); > - } > + else if (DestTy == MVT::f80) > + FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, MVT::f80, > DAG.getEntryNode(), > + CPIdx, NULL, 0, MVT::f32); > + else > + assert(0 && "Unexpected conversion"); Can this just be turned into something like: if (DestTy == MVT::f32) FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx, NULL, 0); else { assert(DestTy > MVT::f32 && "Unexpected conversion"); // FIXME: Avoid the extend by construction the right constantpool? FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, DestTy, DAG.getEntryNode(), CPIdx, NULL, 0, MVT::f32); } ? > @@ -4722,9 +4737,11 @@ > if (DestVT == MVT::f64) { > // do nothing > Result = Sub; > - } else { > + } else if (DestVT == MVT::f32) { > // if f32 then cast to f32 > Result = DAG.getNode(ISD::FP_ROUND, MVT::f32, Sub); > + } else if (DestVT == MVT::f80) { > + Result = DAG.getNode(ISD::FP_EXTEND, MVT::f80, Sub); > } How about "if DestVT < f32 use round. If DestVT > f64, use FP_EXTEND"? > ====================================================================== > ======== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Sep 14 > 17:26:36 2007 > @@ -3724,9 +3714,15 @@ > if (const ConstantSDNode *CSDN = dyn_cast(this)) { > cerr << "<" << CSDN->getValue() << ">"; > } else if (const ConstantFPSDNode *CSDN = > dyn_cast(this)) { > - cerr << "<" << (&CSDN->getValueAPF().getSemantics() > ==&APFloat::IEEEsingle ? > - CSDN->getValueAPF().convertToFloat() : > - CSDN->getValueAPF().convertToDouble()) << ">"; > + if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEsingle) > + cerr << "<" << CSDN->getValueAPF().convertToFloat() << ">"; > + else if (&CSDN->getValueAPF().getSemantics() > ==&APFloat::IEEEdouble) > + cerr << "<" << CSDN->getValueAPF().convertToDouble() << ">"; > + else { > + cerr << " + CSDN->getValueAPF().convertToAPInt().dump(); > + cerr << ")>"; > + } APFloat really needs a "convertToString" method. :) > ====================================================================== > ======== > --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Sep 14 > 17:26:36 2007 > @@ -168,7 +168,11 @@ > Opc = X86::MOV32_mr; > } else if (RC == &X86::GR16_RegClass) { > Opc = X86::MOV16_mr; > + } else if (RC == &X86::RFP80RegClass) { > + Opc = X86::ST_FpP80m; // pops > } else if (RC == &X86::RFP64RegClass || RC == &X86::RSTRegClass) { > + /// FIXME spilling long double values as 64 bit does not work. > + /// We need RST80, unfortunately. The FP Stack has 80 bit load and store instructions, what is the issue? or is it just a todo? > > +ConstantFP *ConstantFP::getNegativeZero(const Type *Ty) { > + APFloat apf = cast (Constant::getNullValue(Ty))- > >getValueAPF(); > + apf.changeSign(); > + return ConstantFP::get(Ty, apf); > +} This seems fairly expensive. Why not just start by creating an APFloat of the appropriate zero type, changing its sign, then returning it. Why start with a Constant? Overall, very nice patch! -Chris From sabre at nondot.org Sat Sep 15 01:51:04 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 15 Sep 2007 06:51:04 -0000 Subject: [llvm-commits] [llvm] r41983 - in /llvm/trunk: include/llvm/Instructions.h lib/Target/CBackend/CBackend.cpp Message-ID: <200709150651.l8F6p4fA017995@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 15 01:51:03 2007 New Revision: 41983 URL: http://llvm.org/viewvc/llvm-project?rev=41983&view=rev Log: Fix PR1666, SPASS with the CBE and 254.gap with the CBE. GCC optimizes away things like ptr < NULL to false. To "fix" this, have the CBE emit casts of pointers to intptr_t when doing relational pointer comparisons. Modified: llvm/trunk/include/llvm/Instructions.h llvm/trunk/lib/Target/CBackend/CBackend.cpp Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=41983&r1=41982&r2=41983&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Sat Sep 15 01:51:03 2007 @@ -660,7 +660,7 @@ /// @returns true if the predicate of this ICmpInst is signed, false otherwise /// @brief Determine if this instruction's predicate is signed. - bool isSignedPredicate() { return isSignedPredicate(getPredicate()); } + bool isSignedPredicate() const { return isSignedPredicate(getPredicate()); } /// @returns true if the predicate provided is signed, false otherwise /// @brief Determine if the predicate is signed. Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=41983&r1=41982&r2=41983&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Sat Sep 15 01:51:03 2007 @@ -138,7 +138,7 @@ void writeOperandRaw(Value *Operand); void writeOperandInternal(Value *Operand); void writeOperandWithCast(Value* Operand, unsigned Opcode); - void writeOperandWithCast(Value* Operand, ICmpInst::Predicate predicate); + void writeOperandWithCast(Value* Operand, const ICmpInst &I); bool writeInstructionCast(const Instruction &I); private : @@ -1248,52 +1248,34 @@ // Write the operand with a cast to another type based on the icmp predicate // being used. -void CWriter::writeOperandWithCast(Value* Operand, ICmpInst::Predicate predicate) { - - // Extract the operand's type, we'll need it. - const Type* OpTy = Operand->getType(); - - // Indicate whether to do the cast or not. - bool shouldCast = false; - - // Indicate whether the cast should be to a signed type or not. - bool castIsSigned = false; - - // Based on the Opcode for which this Operand is being written, determine - // the new type to which the operand should be casted by setting the value - // of OpTy. If we change OpTy, also set shouldCast to true. - switch (predicate) { - default: - // for eq and ne, it doesn't matter - break; - case ICmpInst::ICMP_UGT: - case ICmpInst::ICMP_UGE: - case ICmpInst::ICMP_ULT: - case ICmpInst::ICMP_ULE: - shouldCast = true; - break; - case ICmpInst::ICMP_SGT: - case ICmpInst::ICMP_SGE: - case ICmpInst::ICMP_SLT: - case ICmpInst::ICMP_SLE: - shouldCast = true; - castIsSigned = true; - break; - } +void CWriter::writeOperandWithCast(Value* Operand, const ICmpInst &Cmp) { + // This has to do a cast to ensure the operand has the right signedness. + // Also, if the operand is a pointer, we make sure to cast to an integer when + // doing the comparison both for signedness and so that the C compiler doesn't + // optimize things like "p < NULL" to false (p may contain an integer value + // f.e.). + bool shouldCast = Cmp.isRelational(); // Write out the casted operand if we should, otherwise just write the // operand. - if (shouldCast) { - Out << "(("; - if (OpTy->isInteger() && OpTy != Type::Int1Ty) - printSimpleType(Out, OpTy, castIsSigned); - else - printType(Out, OpTy); // not integer, sign doesn't matter - Out << ")"; - writeOperand(Operand); - Out << ")"; - } else + if (!shouldCast) { writeOperand(Operand); + return; + } + + // Should this be a signed comparison? If so, convert to signed. + bool castIsSigned = Cmp.isSignedPredicate(); + + // If the operand was a pointer, convert to a large integer type. + const Type* OpTy = Operand->getType(); + if (isa(OpTy)) + OpTy = TD->getIntPtrType(); + + Out << "(("; + printSimpleType(Out, OpTy, castIsSigned); + Out << ")"; + writeOperand(Operand); + Out << ")"; } // generateCompilerSpecificCode - This is where we add conditional compilation @@ -2265,7 +2247,7 @@ // Certain icmp predicate require the operand to be forced to a specific type // so we use writeOperandWithCast here instead of writeOperand. Similarly // below for operand 1 - writeOperandWithCast(I.getOperand(0), I.getPredicate()); + writeOperandWithCast(I.getOperand(0), I); switch (I.getPredicate()) { case ICmpInst::ICMP_EQ: Out << " == "; break; @@ -2281,7 +2263,7 @@ default: cerr << "Invalid icmp predicate!" << I; abort(); } - writeOperandWithCast(I.getOperand(1), I.getPredicate()); + writeOperandWithCast(I.getOperand(1), I); if (NeedsClosingParens) Out << "))"; From dalej at apple.com Sat Sep 15 02:16:59 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 15 Sep 2007 00:16:59 -0700 Subject: [llvm-commits] [llvm] r41967 - in /llvm/trunk: include/llvm/ADT/APInt.h include/llvm/ADT/FoldingSet.h include/llvm/Constants.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Support/APInt.cpp lib/Support/FoldingSet.cpp lib/Target/CBackend/CBackend.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86RegisterInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Constants.cpp In-Reply-To: References: <200709142226.l8EMQbLv028880@zion.cs.uiuc.edu> Message-ID: <07694B6B-5B32-465D-B14D-B349F37CD0AB@apple.com> On Sep 14, 2007, at 11:12 PM, Chris Lattner wrote: >> @@ -4722,9 +4737,11 @@ >> if (DestVT == MVT::f64) { >> // do nothing >> Result = Sub; >> - } else { >> + } else if (DestVT == MVT::f32) { >> // if f32 then cast to f32 >> Result = DAG.getNode(ISD::FP_ROUND, MVT::f32, Sub); >> + } else if (DestVT == MVT::f80) { >> + Result = DAG.getNode(ISD::FP_EXTEND, MVT::f80, Sub); >> } > > How about "if DestVT < f32 use round. If DestVT > f64, use > FP_EXTEND"? Comparisons other than equality against an enum? Ick. IMO, that sort of thing is a bad misuse of enums. Obviously you disagree, we should talk? >> ===================================================================== >> = >> ======== >> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Sep 14 >> 17:26:36 2007 >> @@ -3724,9 +3714,15 @@ >> if (const ConstantSDNode *CSDN = dyn_cast(this)) { >> cerr << "<" << CSDN->getValue() << ">"; >> } else if (const ConstantFPSDNode *CSDN = >> dyn_cast(this)) { >> - cerr << "<" << (&CSDN->getValueAPF().getSemantics() >> ==&APFloat::IEEEsingle ? >> - CSDN->getValueAPF().convertToFloat() : >> - CSDN->getValueAPF().convertToDouble()) << ">"; >> + if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEsingle) >> + cerr << "<" << CSDN->getValueAPF().convertToFloat() << ">"; >> + else if (&CSDN->getValueAPF().getSemantics() >> ==&APFloat::IEEEdouble) >> + cerr << "<" << CSDN->getValueAPF().convertToDouble() << ">"; >> + else { >> + cerr << "> + CSDN->getValueAPF().convertToAPInt().dump(); >> + cerr << ")>"; >> + } > > APFloat really needs a "convertToString" method. :) Yeah. That would help CBackend too. It's not trivial. >> ===================================================================== >> = >> ======== >> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Sep 14 >> 17:26:36 2007 >> @@ -168,7 +168,11 @@ >> Opc = X86::MOV32_mr; >> } else if (RC == &X86::GR16_RegClass) { >> Opc = X86::MOV16_mr; >> + } else if (RC == &X86::RFP80RegClass) { >> + Opc = X86::ST_FpP80m; // pops >> } else if (RC == &X86::RFP64RegClass || RC == &X86::RSTRegClass) { >> + /// FIXME spilling long double values as 64 bit does not work. >> + /// We need RST80, unfortunately. > > The FP Stack has 80 bit load and store instructions, what is the > issue? or is it just a todo? I may be missing something, but I think when we've gotten to the RST regclass, we don't know what size the value in the register is, so we'd need to use the 80-bit insns for all spills. That's possible, but slower and more consumptive of stack space. I haven't looked recently, but IIRC the time difference is significant. (There's a difference in precision of the result also, but that's randomly optimization-dependent anyway.) From evan.cheng at apple.com Sat Sep 15 02:39:44 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 15 Sep 2007 00:39:44 -0700 Subject: [llvm-commits] [llvm] r41967 - in /llvm/trunk: include/llvm/ADT/APInt.h include/llvm/ADT/FoldingSet.h include/llvm/Constants.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Support/APInt.cpp lib/Support/FoldingSet.cpp lib/Target/CBackend/CBackend.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86RegisterInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Constants.cpp In-Reply-To: <07694B6B-5B32-465D-B14D-B349F37CD0AB@apple.com> References: <200709142226.l8EMQbLv028880@zion.cs.uiuc.edu> <07694B6B-5B32-465D-B14D-B349F37CD0AB@apple.com> Message-ID: <6DF70549-E178-4BAD-89E8-5A62B2B026F1@apple.com> On Sep 15, 2007, at 12:16 AM, Dale Johannesen wrote: > > On Sep 14, 2007, at 11:12 PM, Chris Lattner wrote: >>> @@ -4722,9 +4737,11 @@ >>> if (DestVT == MVT::f64) { >>> // do nothing >>> Result = Sub; >>> - } else { >>> + } else if (DestVT == MVT::f32) { >>> // if f32 then cast to f32 >>> Result = DAG.getNode(ISD::FP_ROUND, MVT::f32, Sub); >>> + } else if (DestVT == MVT::f80) { >>> + Result = DAG.getNode(ISD::FP_EXTEND, MVT::f80, Sub); >>> } >> >> How about "if DestVT < f32 use round. If DestVT > f64, use >> FP_EXTEND"? > > Comparisons other than equality against an enum? Ick. IMO, that > sort of thing > is a bad misuse of enums. Obviously you disagree, we should talk? Why not just compare getSizeInBits? Evan > > >>> === >>> ================================================================== >>> = >>> ======== >>> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) >>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Sep 14 >>> 17:26:36 2007 >>> @@ -3724,9 +3714,15 @@ >>> if (const ConstantSDNode *CSDN = dyn_cast(this)) { >>> cerr << "<" << CSDN->getValue() << ">"; >>> } else if (const ConstantFPSDNode *CSDN = >>> dyn_cast(this)) { >>> - cerr << "<" << (&CSDN->getValueAPF().getSemantics() >>> ==&APFloat::IEEEsingle ? >>> - CSDN->getValueAPF().convertToFloat() : >>> - CSDN->getValueAPF().convertToDouble()) << ">"; >>> + if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEsingle) >>> + cerr << "<" << CSDN->getValueAPF().convertToFloat() << ">"; >>> + else if (&CSDN->getValueAPF().getSemantics() >>> ==&APFloat::IEEEdouble) >>> + cerr << "<" << CSDN->getValueAPF().convertToDouble() << ">"; >>> + else { >>> + cerr << ">> + CSDN->getValueAPF().convertToAPInt().dump(); >>> + cerr << ")>"; >>> + } >> >> APFloat really needs a "convertToString" method. :) > > Yeah. That would help CBackend too. It's not trivial. > >>> === >>> ================================================================== >>> = >>> ======== >>> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) >>> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Sep 14 >>> 17:26:36 2007 >>> @@ -168,7 +168,11 @@ >>> Opc = X86::MOV32_mr; >>> } else if (RC == &X86::GR16_RegClass) { >>> Opc = X86::MOV16_mr; >>> + } else if (RC == &X86::RFP80RegClass) { >>> + Opc = X86::ST_FpP80m; // pops >>> } else if (RC == &X86::RFP64RegClass || RC == &X86::RSTRegClass) { >>> + /// FIXME spilling long double values as 64 bit does not work. >>> + /// We need RST80, unfortunately. >> >> The FP Stack has 80 bit load and store instructions, what is the >> issue? or is it just a todo? > > I may be missing something, but I think when we've gotten to the RST > regclass, > we don't know what size the value in the register is, so we'd need to > use the 80-bit > insns for all spills. That's possible, but slower and more > consumptive of stack space. > I haven't looked recently, but IIRC the time difference is > significant. > (There's a difference in precision of the result also, but that's > randomly > optimization-dependent anyway.) > > _______________________________________________ > 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 Sat Sep 15 02:49:07 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 15 Sep 2007 00:49:07 -0700 Subject: [llvm-commits] [llvm] r41967 - in /llvm/trunk: include/llvm/ADT/APInt.h include/llvm/ADT/FoldingSet.h include/llvm/Constants.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Support/APInt.cpp lib/Support/FoldingSet.cpp lib/Target/CBackend/CBackend.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86RegisterInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Constants.cpp In-Reply-To: <07694B6B-5B32-465D-B14D-B349F37CD0AB@apple.com> References: <200709142226.l8EMQbLv028880@zion.cs.uiuc.edu> <07694B6B-5B32-465D-B14D-B349F37CD0AB@apple.com> Message-ID: Sent from my iPhone On Sep 15, 2007, at 12:16 AM, Dale Johannesen wrote: > > On Sep 14, 2007, at 11:12 PM, Chris Lattner wrote: >>> @@ -4722,9 +4737,11 @@ >>> if (DestVT == MVT::f64) { >>> // do nothing >>> Result = Sub; >>> - } else { >>> + } else if (DestVT == MVT::f32) { >>> // if f32 then cast to f32 >>> Result = DAG.getNode(ISD::FP_ROUND, MVT::f32, Sub); >>> + } else if (DestVT == MVT::f80) { >>> + Result = DAG.getNode(ISD::FP_EXTEND, MVT::f80, Sub); >>> } >> >> How about "if DestVT < f32 use round. If DestVT > f64, use >> FP_EXTEND"? > > Comparisons other than equality against an enum? Ick. IMO, that > sort of thing > is a bad misuse of enums. Obviously you disagree, we should talk? > >>> === >>> ================================================================== >>> = >>> ======== >>> --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) >>> +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Sep 14 >>> 17:26:36 2007 >>> @@ -3724,9 +3714,15 @@ >>> if (const ConstantSDNode *CSDN = dyn_cast(this)) { >>> cerr << "<" << CSDN->getValue() << ">"; >>> } else if (const ConstantFPSDNode *CSDN = >>> dyn_cast(this)) { >>> - cerr << "<" << (&CSDN->getValueAPF().getSemantics() >>> ==&APFloat::IEEEsingle ? >>> - CSDN->getValueAPF().convertToFloat() : >>> - CSDN->getValueAPF().convertToDouble()) << ">"; >>> + if (&CSDN->getValueAPF().getSemantics()==&APFloat::IEEEsingle) >>> + cerr << "<" << CSDN->getValueAPF().convertToFloat() << ">"; >>> + else if (&CSDN->getValueAPF().getSemantics() >>> ==&APFloat::IEEEdouble) >>> + cerr << "<" << CSDN->getValueAPF().convertToDouble() << ">"; >>> + else { >>> + cerr << ">> + CSDN->getValueAPF().convertToAPInt().dump(); >>> + cerr << ")>"; >>> + } >> >> APFloat really needs a "convertToString" method. :) > > Yeah. That would help CBackend too. It's not trivial. > >>> === >>> ================================================================== >>> = >>> ======== >>> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) >>> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Sep 14 >>> 17:26:36 2007 >>> @@ -168,7 +168,11 @@ >>> Opc = X86::MOV32_mr; >>> } else if (RC == &X86::GR16_RegClass) { >>> Opc = X86::MOV16_mr; >>> + } else if (RC == &X86::RFP80RegClass) { >>> + Opc = X86::ST_FpP80m; // pops >>> } else if (RC == &X86::RFP64RegClass || RC == &X86::RSTRegClass) { >>> + /// FIXME spilling long double values as 64 bit does not work. >>> + /// We need RST80, unfortunately. >> >> The FP Stack has 80 bit load and store instructions, what is the >> issue? or is it just a todo? > > I may be missing something, but I think when we've gotten to the RST > regclass, > we don't know what size the value in the register is, so we'd need to Right. > > use the 80-bit > insns for all spills. That's possible, but slower and more > consumptive of stack space. I agree we don't want to hurt performance of 64 bit to code. So defaulting to 80 bit instructions is not ideal. I don't see a solution other than creating rst80 register class and duplicating a bunch of instructions unfortunately. :( Evan > > I haven't looked recently, but IIRC the time difference is > significant. > (There's a difference in precision of the result also, but that's > randomly > optimization-dependent anyway.) > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Sat Sep 15 05:32:40 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 15 Sep 2007 03:32:40 -0700 Subject: [llvm-commits] [llvm] r41968 - /llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp In-Reply-To: <200709142233.l8EMXqY2029069@zion.cs.uiuc.edu> References: <200709142233.l8EMXqY2029069@zion.cs.uiuc.edu> Message-ID: Hi Owen, I think these failures are due to this. :-) Running /Volumes/Gir/devel/llvm/llvm.src/test/Transforms/ RedundantLoadElimination/dg.exp ... FAIL: /Volumes/Gir/devel/llvm/llvm.src/test/Transforms/ RedundantLoadElimination/simple.ll Failed with exit(1) at line 1 while running: llvm-as < /Volumes/Gir/devel/llvm/llvm.src/test/ Transforms/RedundantLoadElimination/simple.ll | opt -rle | llvm-dis | not grep DEAD opt: Unknown command line argument '-rle'. Try: 'opt --help' llvm-dis: bitcode didn't read correctly. FAIL: /Volumes/Gir/devel/llvm/llvm.src/test/Transforms/ RedundantLoadElimination/volatile.ll Failed with exit(1) at line 1 while running: llvm-as < /Volumes/Gir/devel/llvm/llvm.src/test/ Transforms/RedundantLoadElimination/volatile.ll | opt -rle | llvm-dis | grep NOTDEAD opt: Unknown command line argument '-rle'. Try: 'opt --help' llvm-dis: bitcode didn't read correctly. -bw On Sep 14, 2007, at 3:33 PM, Owen Anderson wrote: > Author: resistor > Date: Fri Sep 14 17:33:52 2007 > New Revision: 41968 > > URL: http://llvm.org/viewvc/llvm-project?rev=41968&view=rev > Log: > Remove RLE. It is subsumed by GVN. > > Removed: > llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp > > Removed: llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ > Scalar/RedundantLoadElimination.cpp?rev=41967&view=auto > > ====================================================================== > ======== > --- llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp > (original) > +++ llvm/trunk/lib/Transforms/Scalar/RedundantLoadElimination.cpp > (removed) > @@ -1,135 +0,0 @@ > -//===- FastDLE.cpp - Fast Dead Load Elimination > ---------------------------===// > -// > -// The LLVM Compiler Infrastructure > -// > -// This file was developed by Owen Anderson and is distributed under > -// the University of Illinois Open Source License. See LICENSE.TXT > for details. > -// > -// > ===------------------------------------------------------------------- > ---===// > -// > -// This file implements a trivial dead load elimination that only > considers > -// basic-block local redundant load. > -// > -// FIXME: This should eventually be extended to be a post- > dominator tree > -// traversal. Doing so would be pretty trivial. > -// > -// > ===------------------------------------------------------------------- > ---===// > - > -#define DEBUG_TYPE "rle" > -#include "llvm/Transforms/Scalar.h" > -#include "llvm/Function.h" > -#include "llvm/Instructions.h" > -#include "llvm/Pass.h" > -#include "llvm/ADT/SmallPtrSet.h" > -#include "llvm/ADT/Statistic.h" > -#include "llvm/Analysis/MemoryDependenceAnalysis.h" > -#include "llvm/Transforms/Utils/Local.h" > -#include "llvm/Support/Compiler.h" > -using namespace llvm; > - > -STATISTIC(NumFastLoads, "Number of loads deleted"); > - > -namespace { > - struct VISIBILITY_HIDDEN RLE : public FunctionPass { > - static char ID; // Pass identification, replacement for typeid > - RLE() : FunctionPass((intptr_t)&ID) {} > - > - virtual bool runOnFunction(Function &F) { > - bool Changed = false; > - for (Function::iterator I = F.begin(), E = F.end(); I != E; + > +I) > - Changed |= runOnBasicBlock(*I); > - return Changed; > - } > - > - bool runOnBasicBlock(BasicBlock &BB); > - > - // getAnalysisUsage - We require post dominance frontiers (aka > Control > - // Dependence Graph) > - virtual void getAnalysisUsage(AnalysisUsage &AU) const { > - AU.setPreservesCFG(); > - AU.addRequired(); > - AU.addPreserved(); > - } > - }; > - char RLE::ID = 0; > - RegisterPass X("rle", "Redundant Load Elimination"); > -} > - > -FunctionPass *llvm::createRedundantLoadEliminationPass() { return > new RLE(); } > - > -bool RLE::runOnBasicBlock(BasicBlock &BB) { > - MemoryDependenceAnalysis& MD = > getAnalysis(); > - > - // Record the last-seen load from this pointer > - DenseMap lastLoad; > - > - bool MadeChange = false; > - > - // Do a top-down walk on the BB > - for (BasicBlock::iterator BBI = BB.begin(), BBE = BB.end(); > - BBI != BBE; ++BBI) { > - // If we find a store or a free... > - if (LoadInst* L = dyn_cast(BBI)) { > - // We can't delete volatile loads > - if (L->isVolatile()) { > - lastLoad[L->getPointerOperand()] = L; > - continue; > - } > - > - Value* pointer = L->getPointerOperand(); > - LoadInst*& last = lastLoad[pointer]; > - > - // ... to a pointer that has been loaded from before... > - Instruction* dep = MD.getDependency(BBI); > - bool deletedLoad = false; > - > - while (dep != MemoryDependenceAnalysis::None && > - dep != MemoryDependenceAnalysis::NonLocal && > - (isa(dep) || isa(dep))) { > - // ... that depends on a store ... > - if (StoreInst* S = dyn_cast(dep)) { > - if (S->getPointerOperand() == pointer) { > - // Remove it! > - MD.removeInstruction(BBI); > - > - BBI--; > - L->replaceAllUsesWith(S->getOperand(0)); > - L->eraseFromParent(); > - NumFastLoads++; > - deletedLoad = true; > - MadeChange = true; > - } > - > - // Whether we removed it or not, we can't > - // go any further > - break; > - } else if (!last) { > - // If we don't depend on a store, and we haven't > - // been loaded before, bail. > - break; > - } else if (dep == last) { > - // Remove it! > - MD.removeInstruction(BBI); > - > - BBI--; > - L->replaceAllUsesWith(last); > - L->eraseFromParent(); > - deletedLoad = true; > - NumFastLoads++; > - MadeChange = true; > - > - break; > - } else { > - dep = MD.getDependency(BBI, dep); > - } > - } > - > - if (!deletedLoad) > - last = L; > - } > - } > - > - return MadeChange; > -} > - > - > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Sat Sep 15 09:00:39 2007 From: baldrick at free.fr (Duncan Sands) Date: Sat, 15 Sep 2007 16:00:39 +0200 Subject: [llvm-commits] [llvm-gcc-4.0] r41882 - in /llvm-gcc-4.0/trunk/gcc: config/darwin.h llvm-backend.cpp varasm.c In-Reply-To: <200709121855.l8CItFuU000417@zion.cs.uiuc.edu> References: <200709121855.l8CItFuU000417@zion.cs.uiuc.edu> Message-ID: <200709151600.40230.baldrick@free.fr> Hi Bill, > Alias definitions aren't supported on some platforms. Create a flag (TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS) that indicates this and stops us from creating aliases. is doing this in the front-end really the right approach? If a target doesn't support aliases surely it is LLVM codegen that should complain or ignore the alias. Also, how does gcc handle aliases on Darwin? Either it succeeds in outputting them somehow, in which case llvm-gcc should too, or it rejects them in which case there shouldn't be any need for a new flag - the info that darwin doesn't support aliases should exist in gcc already. Ciao, Duncan. > Modified: > llvm-gcc-4.0/trunk/gcc/config/darwin.h > llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp > llvm-gcc-4.0/trunk/gcc/varasm.c > > Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/darwin.h?rev=41882&r1=41881&r2=41882&view=diff > > ============================================================================== > --- llvm-gcc-4.0/trunk/gcc/config/darwin.h (original) > +++ llvm-gcc-4.0/trunk/gcc/config/darwin.h Wed Sep 12 13:55:13 2007 > @@ -674,6 +674,9 @@ > } while (0) > > /* APPLE LOCAL begin LLVM */ > +/* As in the warning above, alias definitions aren't supported on Mach-O. */ > +#define TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS > + > /* weak_import, a Darwin special, does not make function definitions weak. */ > #define TARGET_ADJUST_LLVM_LINKAGE(FN, DECL) \ > do { \ > > Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp?rev=41882&r1=41881&r2=41882&view=diff > > ============================================================================== > --- llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp (original) > +++ llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Wed Sep 12 13:55:13 2007 > @@ -677,7 +677,7 @@ > else if (Function *F = dyn_cast(V)) > F->eraseFromParent(); > else > - assert(0 && "Unsuported global value"); > + assert(0 && "Unsupported global value"); > > TREE_ASM_WRITTEN(decl) = 1; > > > Modified: llvm-gcc-4.0/trunk/gcc/varasm.c > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/varasm.c?rev=41882&r1=41881&r2=41882&view=diff > > ============================================================================== > --- llvm-gcc-4.0/trunk/gcc/varasm.c (original) > +++ llvm-gcc-4.0/trunk/gcc/varasm.c Wed Sep 12 13:55:13 2007 > @@ -4762,7 +4762,12 @@ > { > tree target_decl; > target_decl = find_decl_and_mark_needed (p->decl, p->target); > +#ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS > + if (target_decl) > + warning ("%Jalias definitions not supported; ignored", target_decl); > +#else > emit_alias_to_llvm(p->decl, p->target, target_decl); > +#endif > } > #else > do_assemble_alias (p->decl, p->target); > @@ -4819,11 +4824,19 @@ > alias. This saves a tad o memory. */ > target_decl = find_decl_and_mark_needed (decl, target); > if (target_decl && TREE_ASM_WRITTEN (target_decl)) > + /* APPLE LOCAL begin LLVM */ > + { > #ifdef ENABLE_LLVM > - emit_alias_to_llvm(decl, target, target_decl); > +#ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS > + warning ("%Jalias definitions not supported; ignored", target_decl); > #else > - do_assemble_alias (decl, target); > + emit_alias_to_llvm(decl, target, target_decl); > #endif > +#else > + do_assemble_alias (decl, target); > +#endif > + } > + /* APPLE LOCAL end LLVM */ > else > { > alias_pair p; > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From sabre at nondot.org Sat Sep 15 12:38:06 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 15 Sep 2007 17:38:06 -0000 Subject: [llvm-commits] [llvm] r41984 - /llvm/trunk/test/Transforms/RedundantLoadElimination/ Message-ID: <200709151738.l8FHc66K014232@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 15 12:38:04 2007 New Revision: 41984 URL: http://llvm.org/viewvc/llvm-project?rev=41984&view=rev Log: remove obsolete tests. Removed: llvm/trunk/test/Transforms/RedundantLoadElimination/ From isanbard at gmail.com Sat Sep 15 13:20:39 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 15 Sep 2007 11:20:39 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r41882 - in /llvm-gcc-4.0/trunk/gcc: config/darwin.h llvm-backend.cpp varasm.c In-Reply-To: <200709151600.40230.baldrick@free.fr> References: <200709121855.l8CItFuU000417@zion.cs.uiuc.edu> <200709151600.40230.baldrick@free.fr> Message-ID: Hi Duncan, >> Alias definitions aren't supported on some platforms. Create a >> flag (TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS) that indicates >> this and stops us from creating aliases. > > is doing this in the front-end really the right approach? If a > target doesn't > support aliases surely it is LLVM codegen that should complain or > ignore the > alias. It's debatable. I'm not 100% familiar with the "emit_alias_to_llvm()" function, but it seems to be modifying the generated LLVM bitcode to point to the new alias. If so, then we need to stop it from doing that at that point, which is what my patch does. Also, I don't think there's anything that emits a warning in LLVM after the front-end generates the bitcode. I'm not excited about emitting warnings there now. :-) > Also, how does gcc handle aliases on Darwin? Either it succeeds in > outputting them somehow, in which case llvm-gcc should too, or it > rejects them > in which case there shouldn't be any need for a new flag - the info > that darwin > doesn't support aliases should exist in gcc already. > GCC ignores it. If you look at config/darwin.h, it emits a warning saying that it won't be doing anything with aliases. -bw From resistor at mac.com Sun Sep 16 03:04:16 2007 From: resistor at mac.com (Owen Anderson) Date: Sun, 16 Sep 2007 08:04:16 -0000 Subject: [llvm-commits] [llvm] r41998 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200709160804.l8G84HM6022768@zion.cs.uiuc.edu> Author: resistor Date: Sun Sep 16 03:04:16 2007 New Revision: 41998 URL: http://llvm.org/viewvc/llvm-project?rev=41998&view=rev Log: Be more careful when constant-folding PHI nodes. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=41998&r1=41997&r2=41998&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Sun Sep 16 03:04:16 2007 @@ -673,6 +673,7 @@ void dump(DenseMap& d); bool iterateOnFunction(Function &F); Value* CollapsePhi(PHINode* p); + bool isSafeReplacement(PHINode* p, Instruction* inst); }; char GVN::ID = 0; @@ -731,7 +732,8 @@ if (constVal) { if (Instruction* inst = dyn_cast(constVal)) { if (DT.dominates(inst, p)) - return inst; + if (isSafeReplacement(p, inst)) + return inst; } else { return constVal; } @@ -740,6 +742,19 @@ return 0; } +bool GVN::isSafeReplacement(PHINode* p, Instruction* inst) { + if (!isa(inst)) + return true; + + for (Instruction::use_iterator UI = p->use_begin(), E = p->use_end(); + UI != E; ++UI) + if (PHINode* use_phi = dyn_cast(UI)) + if (use_phi->getParent() == inst->getParent()) + return false; + + return true; +} + /// GetValueForBlock - Get the value to use within the specified basic block. /// available values are in Phis. Value *GVN::GetValueForBlock(BasicBlock *BB, LoadInst* orig, From isanbard at gmail.com Sun Sep 16 05:36:21 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 16 Sep 2007 10:36:21 -0000 Subject: [llvm-commits] [llvm] r41999 - /llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Message-ID: <200709161036.l8GAaMXQ011459@zion.cs.uiuc.edu> Author: void Date: Sun Sep 16 05:36:17 2007 New Revision: 41999 URL: http://llvm.org/viewvc/llvm-project?rev=41999&view=rev Log: Only emit the personality function as a global value if the backend actually supports it. This solves this error on the Darwin x86-64 platform: $ cat testcase.ii struct A { A(); }; A *bork() { return new A; } $ llvm-g++ -arch x86_64 -c testcase.ii /var/tmp//cc3U8fd8.s:52:unknown section type: non_lazy_symbol_pointers /var/tmp//cc3U8fd8.s:52:Rest of line ignored. 1st junk character valued 76 (L). /var/tmp//cc3U8fd8.s:53:Unknown pseudo-op: .indirect_symbol /var/tmp//cc3U8fd8.s:53:Rest of line ignored. 1st junk character valued 95 (_). Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=41999&r1=41998&r2=41999&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Sun Sep 16 05:36:17 2007 @@ -352,7 +352,7 @@ O << "\n"; - if (MMI) { + if (TAI->doesSupportExceptionHandling() && MMI) { // Add the (possibly multiple) personalities to the set of global values. const std::vector& Personalities = MMI->getPersonalities(); From isanbard at gmail.com Sun Sep 16 05:43:11 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 16 Sep 2007 03:43:11 -0700 Subject: [llvm-commits] [llvm] r41999 - /llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp In-Reply-To: <200709161036.l8GAaMXQ011459@zion.cs.uiuc.edu> References: <200709161036.l8GAaMXQ011459@zion.cs.uiuc.edu> Message-ID: Tanya, If no one has any objections, could you put this in the 2.1 branch? Thanks! -bw On Sep 16, 2007, at 3:36 AM, Bill Wendling wrote: > Author: void > Date: Sun Sep 16 05:36:17 2007 > New Revision: 41999 > > URL: http://llvm.org/viewvc/llvm-project?rev=41999&view=rev > Log: > Only emit the personality function as a global value if the backend > actually > supports it. This solves this error on the Darwin x86-64 platform: > > $ cat testcase.ii > struct A { > A(); > }; > > A *bork() { > return new A; > } > $ llvm-g++ -arch x86_64 -c testcase.ii > /var/tmp//cc3U8fd8.s:52:unknown section type: non_lazy_symbol_pointers > /var/tmp//cc3U8fd8.s:52:Rest of line ignored. 1st junk character > valued 76 (L). > /var/tmp//cc3U8fd8.s:53:Unknown pseudo-op: .indirect_symbol > /var/tmp//cc3U8fd8.s:53:Rest of line ignored. 1st junk character > valued 95 (_). > > > Modified: > llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp > > Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/ > X86AsmPrinter.cpp?rev=41999&r1=41998&r2=41999&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Sun Sep 16 05:36:17 > 2007 > @@ -352,7 +352,7 @@ > > O << "\n"; > > - if (MMI) { > + if (TAI->doesSupportExceptionHandling() && MMI) { > // Add the (possibly multiple) personalities to the set of > global values. > const std::vector& Personalities = MMI- > >getPersonalities(); > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Sun Sep 16 11:51:49 2007 From: dalej at apple.com (Dale Johannesen) Date: Sun, 16 Sep 2007 16:51:49 -0000 Subject: [llvm-commits] [llvm] r42002 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200709161651.l8GGpo0s023523@zion.cs.uiuc.edu> Author: johannes Date: Sun Sep 16 11:51:49 2007 New Revision: 42002 URL: http://llvm.org/viewvc/llvm-project?rev=42002&view=rev Log: Adjust per revew comments. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=42002&r1=42001&r2=42002&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Sep 16 11:51:49 2007 @@ -486,12 +486,7 @@ // double. MVT::ValueType VT = CFP->getValueType(0); bool isDouble = VT == MVT::f64; - ConstantFP *LLVMC = ConstantFP::get(VT==MVT::f64 ? Type::DoubleTy : - VT==MVT::f32 ? Type::FloatTy : - VT==MVT::f80 ? Type::X86_FP80Ty : - VT==MVT::f128 ? Type::FP128Ty : - VT==MVT::ppcf128 ? Type::PPC_FP128Ty : - Type::VoidTy, // error + ConstantFP *LLVMC = ConstantFP::get(MVT::getTypeForValueType(VT), CFP->getValueAPF()); if (!UseCP) { if (VT!=MVT::f64 && VT!=MVT::f32) @@ -4620,12 +4615,9 @@ SDOperand FudgeInReg; if (DestTy == MVT::f32) FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx, NULL, 0); - else if (DestTy == MVT::f64) + else if (MVT::getSizeInBits(DestTy) > MVT::getSizeInBits(MVT::f32)) // FIXME: Avoid the extend by construction the right constantpool? - FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, DAG.getEntryNode(), - CPIdx, NULL, 0, MVT::f32); - else if (DestTy == MVT::f80) - FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, MVT::f80, DAG.getEntryNode(), + FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, DestTy, DAG.getEntryNode(), CPIdx, NULL, 0, MVT::f32); else assert(0 && "Unexpected conversion"); @@ -4737,11 +4729,10 @@ if (DestVT == MVT::f64) { // do nothing Result = Sub; - } else if (DestVT == MVT::f32) { - // if f32 then cast to f32 - Result = DAG.getNode(ISD::FP_ROUND, MVT::f32, Sub); - } else if (DestVT == MVT::f80) { - Result = DAG.getNode(ISD::FP_EXTEND, MVT::f80, Sub); + } else if (MVT::getSizeInBits(DestVT) < MVT::getSizeInBits(MVT::f64)) { + Result = DAG.getNode(ISD::FP_ROUND, DestVT, Sub); + } else if (MVT::getSizeInBits(DestVT) > MVT::getSizeInBits(MVT::f64)) { + Result = DAG.getNode(ISD::FP_EXTEND, DestVT, Sub); } return Result; } From dalej at apple.com Sun Sep 16 11:55:55 2007 From: dalej at apple.com (Dale Johannesen) Date: Sun, 16 Sep 2007 09:55:55 -0700 Subject: [llvm-commits] [llvm] r41967 - in /llvm/trunk: include/llvm/ADT/APInt.h include/llvm/ADT/FoldingSet.h include/llvm/Constants.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Support/APInt.cpp lib/Support/FoldingSet.cpp lib/Target/CBackend/CBackend.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86RegisterInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Constants.cpp In-Reply-To: References: <200709142226.l8EMQbLv028880@zion.cs.uiuc.edu> Message-ID: <1DF313D1-B00A-4615-BB59-BC6DA6DFEDC1@apple.com> On Sep 14, 2007, at 11:12 PM, Chris Lattner wrote: >> +ConstantFP *ConstantFP::getNegativeZero(const Type *Ty) { >> + APFloat apf = cast (Constant::getNullValue(Ty))- >>> getValueAPF(); >> + apf.changeSign(); >> + return ConstantFP::get(Ty, apf); >> +} > > This seems fairly expensive. Why not just start by creating an > APFloat of the appropriate zero type, changing its sign, then > returning it. Why start with a Constant? Because there's no easy way to make "an APFloat of the appropriate zero type", you need a switch like the one in getNullValue. This is cleaner. (It's true I'm getting tired of converting from MVT to Type to fpSemantics all over the place, maybe I'll do something about that...) From sabre at nondot.org Sun Sep 16 13:16:54 2007 From: sabre at nondot.org (Chris Lattner) Date: Sun, 16 Sep 2007 18:16:54 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42003 - /llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200709161816.l8GIGssv025870@zion.cs.uiuc.edu> Author: lattner Date: Sun Sep 16 13:16:53 2007 New Revision: 42003 URL: http://llvm.org/viewvc/llvm-project?rev=42003&view=rev Log: Fix PR1673: G++ does promotions on the builtin arguments, so they are not the types we expect to to match the vector elements. Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp?rev=42003&r1=42002&r2=42003&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Sun Sep 16 13:16:53 2007 @@ -433,9 +433,15 @@ Result = BuildVector(Ops[0], Ops[1], NULL); return true; case IX86_BUILTIN_VEC_INIT_V4HI: + // Sometimes G++ promotes arguments to int. + for (unsigned i = 0; i != 4; ++i) + Ops[i] = Builder.CreateIntCast(Ops[i], Type::Int16Ty, false, "tmp"); Result = BuildVector(Ops[0], Ops[1], Ops[2], Ops[3], NULL); return true; case IX86_BUILTIN_VEC_INIT_V8QI: + // Sometimes G++ promotes arguments to int. + for (unsigned i = 0; i != 8; ++i) + Ops[i] = Builder.CreateIntCast(Ops[i], Type::Int8Ty, false, "tmp"); Result = BuildVector(Ops[0], Ops[1], Ops[2], Ops[3], Ops[4], Ops[5], Ops[6], Ops[7], NULL); return true; From sabre at nondot.org Sun Sep 16 13:18:13 2007 From: sabre at nondot.org (Chris Lattner) Date: Sun, 16 Sep 2007 18:18:13 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42004 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200709161818.l8GIIEdJ025935@zion.cs.uiuc.edu> Author: lattner Date: Sun Sep 16 13:18:12 2007 New Revision: 42004 URL: http://llvm.org/viewvc/llvm-project?rev=42004&view=rev Log: Fix PR1673: G++ does promotions on the builtin arguments, so they are not the types we expect to to match the vector elements. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=42004&r1=42003&r2=42004&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Sun Sep 16 13:18:12 2007 @@ -433,9 +433,15 @@ Result = BuildVector(Ops[0], Ops[1], NULL); return true; case IX86_BUILTIN_VEC_INIT_V4HI: + // Sometimes G++ promotes arguments to int. + for (unsigned i = 0; i != 4; ++i) + Ops[i] = Builder.CreateIntCast(Ops[i], Type::Int16Ty, false, "tmp"); Result = BuildVector(Ops[0], Ops[1], Ops[2], Ops[3], NULL); return true; case IX86_BUILTIN_VEC_INIT_V8QI: + // Sometimes G++ promotes arguments to int. + for (unsigned i = 0; i != 8; ++i) + Ops[i] = Builder.CreateIntCast(Ops[i], Type::Int16Ty, false, "tmp"); Result = BuildVector(Ops[0], Ops[1], Ops[2], Ops[3], Ops[4], Ops[5], Ops[6], Ops[7], NULL); return true; From clattner at apple.com Sun Sep 16 13:25:52 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 16 Sep 2007 11:25:52 -0700 Subject: [llvm-commits] [llvm] r41999 - /llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp In-Reply-To: References: <200709161036.l8GAaMXQ011459@zion.cs.uiuc.edu> Message-ID: <2AC04981-C8C1-44C6-8086-DF577E058150@apple.com> On Sep 16, 2007, at 3:43 AM, Bill Wendling wrote: > Tanya, > If no one has any objections, could you put this in the 2.1 branch? Thanks Bill, Tanya, I agree with Bill. This is a regression from 2.0 that prevents building libstdc++ in x86-64 mode. -Chris > Thanks! > -bw > > On Sep 16, 2007, at 3:36 AM, Bill Wendling wrote: > >> Author: void >> Date: Sun Sep 16 05:36:17 2007 >> New Revision: 41999 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=41999&view=rev >> Log: >> Only emit the personality function as a global value if the backend >> actually >> supports it. This solves this error on the Darwin x86-64 platform: >> >> $ cat testcase.ii >> struct A { >> A(); >> }; >> >> A *bork() { >> return new A; >> } >> $ llvm-g++ -arch x86_64 -c testcase.ii >> /var/tmp//cc3U8fd8.s:52:unknown section type: >> non_lazy_symbol_pointers >> /var/tmp//cc3U8fd8.s:52:Rest of line ignored. 1st junk character >> valued 76 (L). >> /var/tmp//cc3U8fd8.s:53:Unknown pseudo-op: .indirect_symbol >> /var/tmp//cc3U8fd8.s:53:Rest of line ignored. 1st junk character >> valued 95 (_). >> >> >> Modified: >> llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp >> >> Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/ >> X86AsmPrinter.cpp?rev=41999&r1=41998&r2=41999&view=diff >> >> ===================================================================== >> = >> ======== >> --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Sun Sep 16 05:36:17 >> 2007 >> @@ -352,7 +352,7 @@ >> >> O << "\n"; >> >> - if (MMI) { >> + if (TAI->doesSupportExceptionHandling() && MMI) { >> // Add the (possibly multiple) personalities to the set of >> global values. >> const std::vector& Personalities = MMI- >>> getPersonalities(); >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Sun Sep 16 13:32:43 2007 From: sabre at nondot.org (Chris Lattner) Date: Sun, 16 Sep 2007 18:32:43 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42005 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200709161832.l8GIWh6V026569@zion.cs.uiuc.edu> Author: lattner Date: Sun Sep 16 13:32:42 2007 New Revision: 42005 URL: http://llvm.org/viewvc/llvm-project?rev=42005&view=rev Log: Fix typo in my previous patch that I fixed in 4.0 but not 4.2 Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=42005&r1=42004&r2=42005&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Sun Sep 16 13:32:42 2007 @@ -441,7 +441,7 @@ case IX86_BUILTIN_VEC_INIT_V8QI: // Sometimes G++ promotes arguments to int. for (unsigned i = 0; i != 8; ++i) - Ops[i] = Builder.CreateIntCast(Ops[i], Type::Int16Ty, false, "tmp"); + Ops[i] = Builder.CreateIntCast(Ops[i], Type::Int8Ty, false, "tmp"); Result = BuildVector(Ops[0], Ops[1], Ops[2], Ops[3], Ops[4], Ops[5], Ops[6], Ops[7], NULL); return true; From clattner at apple.com Sun Sep 16 14:02:18 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 16 Sep 2007 12:02:18 -0700 Subject: [llvm-commits] [llvm] r41967 - in /llvm/trunk: include/llvm/ADT/APInt.h include/llvm/ADT/FoldingSet.h include/llvm/Constants.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Support/APInt.cpp lib/Support/FoldingSet.cpp lib/Target/CBackend/CBackend.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86RegisterInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/VMCore/Constants.cpp In-Reply-To: <1DF313D1-B00A-4615-BB59-BC6DA6DFEDC1@apple.com> References: <200709142226.l8EMQbLv028880@zion.cs.uiuc.edu> <1DF313D1-B00A-4615-BB59-BC6DA6DFEDC1@apple.com> Message-ID: On Sep 16, 2007, at 9:55 AM, Dale Johannesen wrote: > On Sep 14, 2007, at 11:12 PM, Chris Lattner wrote: >>> +ConstantFP *ConstantFP::getNegativeZero(const Type *Ty) { >>> + APFloat apf = cast (Constant::getNullValue(Ty))- >>>> getValueAPF(); >>> + apf.changeSign(); >>> + return ConstantFP::get(Ty, apf); >>> +} >> >> This seems fairly expensive. Why not just start by creating an >> APFloat of the appropriate zero type, changing its sign, then >> returning it. Why start with a Constant? > > Because there's no easy way to make "an APFloat of the appropriate > zero type", you need a switch like the one in getNullValue. This is > cleaner. (It's true I'm getting tired of converting from MVT to Type > to fpSemantics all over the place, maybe I'll do something about > that...) Ah, good point. I think that's a great problem to solve :). One possibility: how about making APFloat use an MVT as its "fpsemantics" enum? -Chris From isanbard at gmail.com Sun Sep 16 14:21:09 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 16 Sep 2007 19:21:09 -0000 Subject: [llvm-commits] [llvm] r42008 - /llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Message-ID: <200709161921.l8GJL9dE028271@zion.cs.uiuc.edu> Author: void Date: Sun Sep 16 14:21:08 2007 New Revision: 42008 URL: http://llvm.org/viewvc/llvm-project?rev=42008&view=rev Log: Follow-up to patch r41999. Make the conditional that emits the personality stub match the conditional that turns on exception handling emittion in the asm printer. Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=42008&r1=42007&r2=42008&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Sun Sep 16 14:21:08 2007 @@ -352,7 +352,7 @@ O << "\n"; - if (TAI->doesSupportExceptionHandling() && MMI) { + if (ExceptionHandling && TAI->doesSupportExceptionHandling() && MMI) { // Add the (possibly multiple) personalities to the set of global values. const std::vector& Personalities = MMI->getPersonalities(); From isanbard at gmail.com Sun Sep 16 14:23:36 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 16 Sep 2007 12:23:36 -0700 Subject: [llvm-commits] [llvm] r42008 - /llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp In-Reply-To: <200709161921.l8GJL9dE028271@zion.cs.uiuc.edu> References: <200709161921.l8GJL9dE028271@zion.cs.uiuc.edu> Message-ID: <1E5E39FC-65FE-488C-808A-49FAB8EF0E6E@gmail.com> Hi Tanya, This is a follow-up to my previous patch r41999. It makes the conditional the same as that in AsmPrinter.cpp. Sorry about two patches. Late-night coding and all. ;-) Please apply also to the 2.1 branch pending approval. Thanks! -bw On Sep 16, 2007, at 12:21 PM, Bill Wendling wrote: > Author: void > Date: Sun Sep 16 14:21:08 2007 > New Revision: 42008 > > URL: http://llvm.org/viewvc/llvm-project?rev=42008&view=rev > Log: > Follow-up to patch r41999. Make the conditional that emits the > personality stub > match the conditional that turns on exception handling emittion in > the asm > printer. > > > Modified: > llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp > > Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/ > X86AsmPrinter.cpp?rev=42008&r1=42007&r2=42008&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Sun Sep 16 14:21:08 > 2007 > @@ -352,7 +352,7 @@ > > O << "\n"; > > - if (TAI->doesSupportExceptionHandling() && MMI) { > + if (ExceptionHandling && TAI->doesSupportExceptionHandling() > && MMI) { > // Add the (possibly multiple) personalities to the set of > global values. > const std::vector& Personalities = MMI- > >getPersonalities(); > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dberlin at dberlin.org Sun Sep 16 16:45:03 2007 From: dberlin at dberlin.org (Daniel Berlin) Date: Sun, 16 Sep 2007 21:45:03 -0000 Subject: [llvm-commits] [llvm] r42016 - /llvm/trunk/lib/Analysis/IPA/Andersens.cpp Message-ID: <200709162145.l8GLj3Bg001134@zion.cs.uiuc.edu> Author: dannyb Date: Sun Sep 16 16:45:02 2007 New Revision: 42016 URL: http://llvm.org/viewvc/llvm-project?rev=42016&view=rev Log: Rewrite of andersen's to be about 100x faster, cleaner, and begin to support field sensitivity Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=42016&r1=42015&r2=42016&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Sun Sep 16 16:45:02 2007 @@ -7,14 +7,11 @@ // //===----------------------------------------------------------------------===// // -// This file defines a very simple implementation of Andersen's interprocedural -// alias analysis. This implementation does not include any of the fancy -// features that make Andersen's reasonably efficient (like cycle elimination or -// variable substitution), but it should be useful for getting precision -// numbers and can be extended in the future. +// This file defines an implementation of Andersen's interprocedural alias +// analysis // // In pointer analysis terms, this is a subset-based, flow-insensitive, -// field-insensitive, and context-insensitive algorithm pointer algorithm. +// field-sensitive, and context-insensitive algorithm pointer algorithm. // // This algorithm is implemented as three stages: // 1. Object identification. @@ -29,24 +26,23 @@ // in the program by scanning the program, looking for pointer assignments and // other statements that effect the points-to graph. For a statement like "A = // B", this statement is processed to indicate that A can point to anything that -// B can point to. Constraints can handle copies, loads, and stores. +// B can point to. Constraints can handle copies, loads, and stores, and +// address taking. // // The inclusion constraint solving phase iteratively propagates the inclusion // constraints until a fixed point is reached. This is an O(N^3) algorithm. // -// In the initial pass, all indirect function calls are completely ignored. As -// the analysis discovers new targets of function pointers, it iteratively -// resolves a precise (and conservative) call graph. Also related, this -// analysis initially assumes that all internal functions have known incoming -// pointers. If we find that an internal function's address escapes outside of -// the program, we update this assumption. +// Function constraints are handled as if they were structs with X fields. +// Thus, an access to argument X of function Y is an access to node index +// getNode(Y) + X. This representation allows handling of indirect calls +// without any issues. To wit, an indirect call Y(a,b) is equivalence to +// *(Y + 1) = a, *(Y + 2) = b. +// The return node for a function is always located at getNode(F) + +// CallReturnPos. The arguments start at getNode(F) + CallArgPos. // // Future Improvements: -// This implementation of Andersen's algorithm is extremely slow. To make it -// scale reasonably well, the inclusion constraints could be sorted (easy), -// offline variable substitution would be a huge win (straight-forward), and -// online cycle elimination (trickier) might help as well. -// +// Offline variable substitution, offline detection of online +// cycles. Use of BDD's. //===----------------------------------------------------------------------===// #define DEBUG_TYPE "anders-aa" @@ -62,31 +58,77 @@ #include "llvm/Analysis/Passes.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/Statistic.h" +#include "llvm/ADT/SparseBitVector.h" #include #include -using namespace llvm; +#include +#include +#include +using namespace llvm; STATISTIC(NumIters , "Number of iterations to reach convergence"); STATISTIC(NumConstraints , "Number of constraints"); STATISTIC(NumNodes , "Number of nodes"); -STATISTIC(NumEscapingFunctions, "Number of internal functions that escape"); -STATISTIC(NumIndirectCallees , "Number of indirect callees found"); +STATISTIC(NumUnified , "Number of variables unified"); namespace { + const unsigned SelfRep = (unsigned)-1; + const unsigned Unvisited = (unsigned)-1; + // Position of the function return node relative to the function node. + const unsigned CallReturnPos = 2; + // Position of the function call node relative to the function node. + const unsigned CallFirstArgPos = 3; + class VISIBILITY_HIDDEN Andersens : public ModulePass, public AliasAnalysis, private InstVisitor { - public: - static char ID; // Class identification, replacement for typeinfo - Andersens() : ModulePass((intptr_t)&ID) {} - private: - /// Node class - This class is used to represent a memory object in the - /// program, and is the primitive used to build the points-to graph. - class Node { - std::vector Pointees; - Value *Val; - public: - static const unsigned ID; // Pass identification, replacement for typeid - Node() : Val(0) {} + class Node; + + /// Constraint - Objects of this structure are used to represent the various + /// constraints identified by the algorithm. The constraints are 'copy', + /// for statements like "A = B", 'load' for statements like "A = *B", + /// 'store' for statements like "*A = B", and AddressOf for statements like + /// A = alloca; The Offset is applied as *(A + K) = B for stores, + /// A = *(B + K) for loads, and A = B + K for copies. It is + /// illegal on addressof constraints (Because it is statically + /// resolvable to A = &C where C = B + K) + + struct Constraint { + enum ConstraintType { Copy, Load, Store, AddressOf } Type; + unsigned Dest; + unsigned Src; + unsigned Offset; + + Constraint(ConstraintType Ty, unsigned D, unsigned S, unsigned O = 0) + : Type(Ty), Dest(D), Src(S), Offset(O) { + assert(Offset == 0 || Ty != AddressOf && + "Offset is illegal on addressof constraints"); + } + }; + + // Node class - This class is used to represent a node + // in the constraint graph. Due to various optimizations, + // not always the case that there is a mapping from a Node to a + // Value. In particular, we add artificial + // Node's that represent the set of pointed-to variables + // shared for each location equivalent Node. + struct Node { + Value *Val; + SparseBitVector<> *Edges; + SparseBitVector<> *PointsTo; + SparseBitVector<> *OldPointsTo; + bool Changed; + std::list Constraints; + + // Nodes in cycles (or in equivalence classes) are united + // together using a standard union-find representation with path + // compression. NodeRep gives the index into GraphNodes + // representative for this one. + unsigned NodeRep; public: + + Node() : Val(0), Edges(0), PointsTo(0), OldPointsTo(0), Changed(false), + NodeRep(SelfRep) { + } + Node *setValue(Value *V) { assert(Val == 0 && "Value already set for this node!"); Val = V; @@ -97,21 +139,11 @@ /// Value *getValue() const { return Val; } - typedef std::vector::const_iterator iterator; - iterator begin() const { return Pointees.begin(); } - iterator end() const { return Pointees.end(); } - /// addPointerTo - Add a pointer to the list of pointees of this node, /// returning true if this caused a new pointer to be added, or false if /// we already knew about the points-to relation. - bool addPointerTo(Node *N) { - std::vector::iterator I = std::lower_bound(Pointees.begin(), - Pointees.end(), - N); - if (I != Pointees.end() && *I == N) - return false; - Pointees.insert(I, N); - return true; + bool addPointerTo(unsigned Node) { + return PointsTo->test_and_set(Node); } /// intersects - Return true if the points-to set of this node intersects @@ -121,12 +153,7 @@ /// intersectsIgnoring - Return true if the points-to set of this node /// intersects with the points-to set of the specified node on any nodes /// except for the specified node to ignore. - bool intersectsIgnoring(Node *N, Node *Ignoring) const; - - // Constraint application methods. - bool copyFrom(Node *N); - bool loadFrom(Node *N); - bool storeThrough(Node *N); + bool intersectsIgnoring(Node *N, unsigned) const; }; /// GraphNodes - This vector is populated as part of the object @@ -152,41 +179,14 @@ /// take variable arguments. std::map VarargNodes; - /// Constraint - Objects of this structure are used to represent the various - /// constraints identified by the algorithm. The constraints are 'copy', - /// for statements like "A = B", 'load' for statements like "A = *B", and - /// 'store' for statements like "*A = B". - struct Constraint { - enum ConstraintType { Copy, Load, Store } Type; - Node *Dest, *Src; - - Constraint(ConstraintType Ty, Node *D, Node *S) - : Type(Ty), Dest(D), Src(S) {} - }; /// Constraints - This vector contains a list of all of the constraints /// identified by the program. std::vector Constraints; - /// EscapingInternalFunctions - This set contains all of the internal - /// functions that are found to escape from the program. If the address of - /// an internal function is passed to an external function or otherwise - /// escapes from the analyzed portion of the program, we must assume that - /// any pointer arguments can alias the universal node. This set keeps - /// track of those functions we are assuming to escape so far. - std::set EscapingInternalFunctions; - - /// IndirectCalls - This contains a list of all of the indirect call sites - /// in the program. Since the call graph is iteratively discovered, we may - /// need to add constraints to our graph as we find new targets of function - /// pointers. - std::vector IndirectCalls; - - /// IndirectCallees - For each call site in the indirect calls list, keep - /// track of the callees that we have discovered so far. As the analysis - /// proceeds, more callees are discovered, until the call graph finally - /// stabilizes. - std::map > IndirectCallees; + // Map from graph node to maximum K value that is allowed (For functions, + // this is equivalent to the number of arguments + CallFirstArgPos) + std::map MaxK; /// This enum defines the GraphNodes indices that correspond to important /// fixed sets. @@ -195,8 +195,24 @@ NullPtr = 1, NullObject = 2 }; + // Stack for Tarjans + std::stack SCCStack; + // Topological Index -> Graph node + std::vector Topo2Node; + // Graph Node -> Topological Index; + std::vector Node2Topo; + // Map from Graph Node to DFS number + std::vector Node2DFS; + // Map from Graph Node to Deleted from graph. + std::vector Node2Deleted; + // Current DFS and RPO numbers + unsigned DFSNumber; + unsigned RPONumber; public: + static char ID; + Andersens() : ModulePass((intptr_t)&ID) {} + bool runOnModule(Module &M) { InitializeAliasAnalysis(this); IdentifyObjects(M); @@ -210,7 +226,6 @@ ObjectNodes.clear(); ReturnNodes.clear(); VarargNodes.clear(); - EscapingInternalFunctions.clear(); std::vector().swap(Constraints); return false; } @@ -255,7 +270,7 @@ private: /// getNode - Return the node corresponding to the specified pointer scalar. /// - Node *getNode(Value *V) { + unsigned getNode(Value *V) { if (Constant *C = dyn_cast(V)) if (!isa(C)) return getNodeForConstantPointer(C); @@ -267,47 +282,55 @@ #endif assert(0 && "Value does not have a node in the points-to graph!"); } - return &GraphNodes[I->second]; + return I->second; } /// getObject - Return the node corresponding to the memory object for the /// specified global or allocation instruction. - Node *getObject(Value *V) { + unsigned getObject(Value *V) { std::map::iterator I = ObjectNodes.find(V); assert(I != ObjectNodes.end() && "Value does not have an object in the points-to graph!"); - return &GraphNodes[I->second]; + return I->second; } /// getReturnNode - Return the node representing the return value for the /// specified function. - Node *getReturnNode(Function *F) { + unsigned getReturnNode(Function *F) { std::map::iterator I = ReturnNodes.find(F); assert(I != ReturnNodes.end() && "Function does not return a value!"); - return &GraphNodes[I->second]; + return I->second; } /// getVarargNode - Return the node representing the variable arguments /// formal for the specified function. - Node *getVarargNode(Function *F) { + unsigned getVarargNode(Function *F) { std::map::iterator I = VarargNodes.find(F); assert(I != VarargNodes.end() && "Function does not take var args!"); - return &GraphNodes[I->second]; + return I->second; } /// getNodeValue - Get the node for the specified LLVM value and set the /// value for it to be the specified value. - Node *getNodeValue(Value &V) { - return getNode(&V)->setValue(&V); + unsigned getNodeValue(Value &V) { + unsigned Index = getNode(&V); + GraphNodes[Index].setValue(&V); + return Index; } + unsigned UniteNodes(unsigned First, unsigned Second); + unsigned FindNode(unsigned Node); + void IdentifyObjects(Module &M); void CollectConstraints(Module &M); + bool AnalyzeUsesOfFunction(Value *); + void CreateConstraintGraph(); void SolveConstraints(); + void QueryNode(unsigned Node); - Node *getNodeForConstantPointer(Constant *C); - Node *getNodeForConstantPointerTarget(Constant *C); - void AddGlobalInitializerConstraints(Node *N, Constant *C); + unsigned getNodeForConstantPointer(Constant *C); + unsigned getNodeForConstantPointerTarget(Constant *C); + void AddGlobalInitializerConstraints(unsigned, Constant *C); void AddConstraintsForNonInternalLinkage(Function *F); void AddConstraintsForCall(CallSite CS, Function *F); @@ -337,6 +360,7 @@ void visitSelectInst(SelectInst &SI); void visitVAArg(VAArgInst &I); void visitInstruction(Instruction &I); + }; char Andersens::ID = 0; @@ -353,12 +377,12 @@ AliasAnalysis::AliasResult Andersens::alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size) { - Node *N1 = getNode(const_cast(V1)); - Node *N2 = getNode(const_cast(V2)); + Node *N1 = &GraphNodes[FindNode(getNode(const_cast(V1)))]; + Node *N2 = &GraphNodes[FindNode(getNode(const_cast(V2)))]; // Check to see if the two pointers are known to not alias. They don't alias // if their points-to sets do not intersect. - if (!N1->intersectsIgnoring(N2, &GraphNodes[NullObject])) + if (!N1->intersectsIgnoring(N2, NullObject)) return NoAlias; return AliasAnalysis::alias(V1, V1Size, V2, V2Size); @@ -376,14 +400,12 @@ // is, after all, a "research quality" implementation of Andersen's analysis. if (Function *F = CS.getCalledFunction()) if (F->isDeclaration()) { - Node *N1 = getNode(P); + Node *N1 = &GraphNodes[FindNode(getNode(P))]; - if (N1->begin() == N1->end()) - return NoModRef; // P doesn't point to anything. + if (N1->PointsTo->empty()) + return NoModRef; - // Get the first pointee. - Node *FirstPointee = *N1->begin(); - if (FirstPointee != &GraphNodes[UniversalSet]) + if (!N1->PointsTo->test(UniversalSet)) return NoModRef; // P doesn't point to the universal set. } @@ -401,30 +423,23 @@ /// variables or any other memory memory objects because we do not track whether /// a pointer points to the beginning of an object or a field of it. void Andersens::getMustAliases(Value *P, std::vector &RetVals) { - Node *N = getNode(P); - Node::iterator I = N->begin(); - if (I != N->end()) { - // If there is exactly one element in the points-to set for the object... - ++I; - if (I == N->end()) { - Node *Pointee = *N->begin(); - - // If a function is the only object in the points-to set, then it must be - // the destination. Note that we can't handle global variables here, - // because we don't know if the pointer is actually pointing to a field of - // the global or to the beginning of it. - if (Value *V = Pointee->getValue()) { - if (Function *F = dyn_cast(V)) - RetVals.push_back(F); - } else { - // If the object in the points-to set is the null object, then the null - // pointer is a must alias. - if (Pointee == &GraphNodes[NullObject]) - RetVals.push_back(Constant::getNullValue(P->getType())); - } + Node *N = &GraphNodes[FindNode(getNode(P))]; + if (N->PointsTo->count() == 1) { + Node *Pointee = &GraphNodes[N->PointsTo->find_first()]; + // If a function is the only object in the points-to set, then it must be + // the destination. Note that we can't handle global variables here, + // because we don't know if the pointer is actually pointing to a field of + // the global or to the beginning of it. + if (Value *V = Pointee->getValue()) { + if (Function *F = dyn_cast(V)) + RetVals.push_back(F); + } else { + // If the object in the points-to set is the null object, then the null + // pointer is a must alias. + if (Pointee == &GraphNodes[NullObject]) + RetVals.push_back(Constant::getNullValue(P->getType())); } } - AliasAnalysis::getMustAliases(P, RetVals); } @@ -434,14 +449,20 @@ /// return true. /// bool Andersens::pointsToConstantMemory(const Value *P) { - Node *N = getNode((Value*)P); - for (Node::iterator I = N->begin(), E = N->end(); I != E; ++I) { - if (Value *V = (*I)->getValue()) { + Node *N = &GraphNodes[FindNode(getNode((Value*)P))]; + unsigned i; + + for (SparseBitVector<>::iterator bi = N->PointsTo->begin(); + bi != N->PointsTo->end(); + ++bi) { + i = *bi; + Node *Pointee = &GraphNodes[i]; + if (Value *V = Pointee->getValue()) { if (!isa(V) || (isa(V) && !cast(V)->isConstant())) return AliasAnalysis::pointsToConstantMemory(P); } else { - if (*I != &GraphNodes[NullObject]) + if (i != NullObject) return AliasAnalysis::pointsToConstantMemory(P); } } @@ -483,6 +504,7 @@ // Add nodes for all of the functions and the instructions inside of them. for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { // The function itself is a memory object. + unsigned First = NumObjects; ValueNodes[F] = NumObjects++; ObjectNodes[F] = NumObjects++; if (isa(F->getFunctionType()->getReturnType())) @@ -490,11 +512,14 @@ if (F->getFunctionType()->isVarArg()) VarargNodes[F] = NumObjects++; + // Add nodes for all of the incoming pointer arguments. for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I) if (isa(I->getType())) ValueNodes[I] = NumObjects++; + MaxK[First] = NumObjects - First; + MaxK[First + 1] = NumObjects - First - 1; // Scan the function body, creating a memory object for each heap/stack // allocation in the body of the function and a node to represent all @@ -521,11 +546,11 @@ /// getNodeForConstantPointer - Return the node corresponding to the constant /// pointer itself. -Andersens::Node *Andersens::getNodeForConstantPointer(Constant *C) { +unsigned Andersens::getNodeForConstantPointer(Constant *C) { assert(isa(C->getType()) && "Not a constant pointer!"); if (isa(C) || isa(C)) - return &GraphNodes[NullPtr]; + return NullPtr; else if (GlobalValue *GV = dyn_cast(C)) return getNode(GV); else if (ConstantExpr *CE = dyn_cast(C)) { @@ -533,7 +558,7 @@ case Instruction::GetElementPtr: return getNodeForConstantPointer(CE->getOperand(0)); case Instruction::IntToPtr: - return &GraphNodes[UniversalSet]; + return UniversalSet; case Instruction::BitCast: return getNodeForConstantPointer(CE->getOperand(0)); default: @@ -548,11 +573,11 @@ /// getNodeForConstantPointerTarget - Return the node POINTED TO by the /// specified constant pointer. -Andersens::Node *Andersens::getNodeForConstantPointerTarget(Constant *C) { +unsigned Andersens::getNodeForConstantPointerTarget(Constant *C) { assert(isa(C->getType()) && "Not a constant pointer!"); if (isa(C)) - return &GraphNodes[NullObject]; + return NullObject; else if (GlobalValue *GV = dyn_cast(C)) return getObject(GV); else if (ConstantExpr *CE = dyn_cast(C)) { @@ -560,7 +585,7 @@ case Instruction::GetElementPtr: return getNodeForConstantPointerTarget(CE->getOperand(0)); case Instruction::IntToPtr: - return &GraphNodes[UniversalSet]; + return UniversalSet; case Instruction::BitCast: return getNodeForConstantPointerTarget(CE->getOperand(0)); default: @@ -575,19 +600,22 @@ /// AddGlobalInitializerConstraints - Add inclusion constraints for the memory /// object N, which contains values indicated by C. -void Andersens::AddGlobalInitializerConstraints(Node *N, Constant *C) { +void Andersens::AddGlobalInitializerConstraints(unsigned NodeIndex, + Constant *C) { if (C->getType()->isFirstClassType()) { if (isa(C->getType())) - N->copyFrom(getNodeForConstantPointer(C)); - + Constraints.push_back(Constraint(Constraint::Copy, NodeIndex, + getNodeForConstantPointer(C))); } else if (C->isNullValue()) { - N->addPointerTo(&GraphNodes[NullObject]); + Constraints.push_back(Constraint(Constraint::Copy, NodeIndex, + NullObject)); return; } else if (!isa(C)) { // If this is an array or struct, include constraints for each element. assert(isa(C) || isa(C)); for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i) - AddGlobalInitializerConstraints(N, cast(C->getOperand(i))); + AddGlobalInitializerConstraints(NodeIndex, + cast(C->getOperand(i))); } } @@ -600,7 +628,7 @@ // If this is an argument of an externally accessible function, the // incoming pointer might point to anything. Constraints.push_back(Constraint(Constraint::Copy, getNode(I), - &GraphNodes[UniversalSet])); + UniversalSet)); } /// AddConstraintsForCall - If this is a call to a "known" function, add the @@ -653,14 +681,20 @@ // These functions do induce points-to edges. - if (F->getName() == "llvm.memcpy.i32" || F->getName() == "llvm.memcpy.i64" || + if (F->getName() == "llvm.memcpy.i32" || F->getName() == "llvm.memcpy.i64" || F->getName() == "llvm.memmove.i32" ||F->getName() == "llvm.memmove.i64" || F->getName() == "memmove") { - // Note: this is a poor approximation, this says Dest = Src, instead of - // *Dest = *Src. - Constraints.push_back(Constraint(Constraint::Copy, - getNode(CS.getArgument(0)), - getNode(CS.getArgument(1)))); + + // *Dest = *Src, which requires an artificial graph node to represent the + // constraint. It is broken up into *Dest = temp, temp = *Src + unsigned FirstArg = getNode(CS.getArgument(0)); + unsigned SecondArg = getNode(CS.getArgument(1)); + unsigned TempArg = GraphNodes.size(); + GraphNodes.push_back(Node()); + Constraints.push_back(Constraint(Constraint::Store, + FirstArg, TempArg)); + Constraints.push_back(Constraint(Constraint::Load, + TempArg, SecondArg)); return true; } @@ -679,49 +713,99 @@ +/// AnalyzeUsesOfFunction - Look at all of the users of the specified function. +/// If this is used by anything complex (i.e., the address escapes), return +/// true. +bool Andersens::AnalyzeUsesOfFunction(Value *V) { + + if (!isa(V->getType())) return true; + + for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI) + if (dyn_cast(*UI)) { + return false; + } else if (StoreInst *SI = dyn_cast(*UI)) { + if (V == SI->getOperand(1)) { + return false; + } else if (SI->getOperand(1)) { + return true; // Storing the pointer + } + } else if (GetElementPtrInst *GEP = dyn_cast(*UI)) { + if (AnalyzeUsesOfFunction(GEP)) return true; + } else if (CallInst *CI = dyn_cast(*UI)) { + // Make sure that this is just the function being called, not that it is + // passing into the function. + for (unsigned i = 1, e = CI->getNumOperands(); i != e; ++i) + if (CI->getOperand(i) == V) return true; + } else if (InvokeInst *II = dyn_cast(*UI)) { + // Make sure that this is just the function being called, not that it is + // passing into the function. + for (unsigned i = 3, e = II->getNumOperands(); i != e; ++i) + if (II->getOperand(i) == V) return true; + } else if (ConstantExpr *CE = dyn_cast(*UI)) { + if (CE->getOpcode() == Instruction::GetElementPtr || + CE->getOpcode() == Instruction::BitCast) { + if (AnalyzeUsesOfFunction(CE)) + return true; + } else { + return true; + } + } else if (ICmpInst *ICI = dyn_cast(*UI)) { + if (!isa(ICI->getOperand(1))) + return true; // Allow comparison against null. + } else if (dyn_cast(*UI)) { + return false; + } else { + return true; + } + return false; +} + /// CollectConstraints - This stage scans the program, adding a constraint to /// the Constraints list for each instruction in the program that induces a /// constraint, and setting up the initial points-to graph. /// void Andersens::CollectConstraints(Module &M) { // First, the universal set points to itself. - GraphNodes[UniversalSet].addPointerTo(&GraphNodes[UniversalSet]); - //Constraints.push_back(Constraint(Constraint::Load, &GraphNodes[UniversalSet], - // &GraphNodes[UniversalSet])); - Constraints.push_back(Constraint(Constraint::Store, &GraphNodes[UniversalSet], - &GraphNodes[UniversalSet])); + Constraints.push_back(Constraint(Constraint::AddressOf, UniversalSet, + UniversalSet)); + Constraints.push_back(Constraint(Constraint::Store, UniversalSet, + UniversalSet)); // Next, the null pointer points to the null object. - GraphNodes[NullPtr].addPointerTo(&GraphNodes[NullObject]); + Constraints.push_back(Constraint(Constraint::AddressOf, NullPtr, NullObject)); // Next, add any constraints on global variables and their initializers. for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { // Associate the address of the global object as pointing to the memory for // the global: &G = - Node *Object = getObject(I); + unsigned ObjectIndex = getObject(I); + Node *Object = &GraphNodes[ObjectIndex]; Object->setValue(I); - getNodeValue(*I)->addPointerTo(Object); + Constraints.push_back(Constraint(Constraint::AddressOf, getNodeValue(*I), + ObjectIndex)); if (I->hasInitializer()) { - AddGlobalInitializerConstraints(Object, I->getInitializer()); + AddGlobalInitializerConstraints(ObjectIndex, I->getInitializer()); } else { // If it doesn't have an initializer (i.e. it's defined in another // translation unit), it points to the universal set. - Constraints.push_back(Constraint(Constraint::Copy, Object, - &GraphNodes[UniversalSet])); + Constraints.push_back(Constraint(Constraint::Copy, ObjectIndex, + UniversalSet)); } } for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) { // Make the function address point to the function object. - getNodeValue(*F)->addPointerTo(getObject(F)->setValue(F)); - + unsigned ObjectIndex = getObject(F); + GraphNodes[ObjectIndex].setValue(F); + Constraints.push_back(Constraint(Constraint::AddressOf, getNodeValue(*F), + ObjectIndex)); // Set up the return value node. if (isa(F->getFunctionType()->getReturnType())) - getReturnNode(F)->setValue(F); + GraphNodes[getReturnNode(F)].setValue(F); if (F->getFunctionType()->isVarArg()) - getVarargNode(F)->setValue(F); + GraphNodes[getVarargNode(F)].setValue(F); // Set up incoming argument nodes. for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); @@ -729,7 +813,10 @@ if (isa(I->getType())) getNodeValue(*I); - if (!F->hasInternalLinkage()) + // At some point we should just add constraints for the escaping functions + // at solve time, but this slows down solving. For now, we simply mark + // address taken functions as escaping and treat them as external. + if (!F->hasInternalLinkage() || AnalyzeUsesOfFunction(F)) AddConstraintsForNonInternalLinkage(F); if (!F->isDeclaration()) { @@ -742,7 +829,7 @@ if (isa(F->getFunctionType()->getReturnType())) Constraints.push_back(Constraint(Constraint::Copy, getReturnNode(F), - &GraphNodes[UniversalSet])); + UniversalSet)); // Any pointers that are passed into the function have the universal set // stored into them. @@ -752,11 +839,11 @@ // Pointers passed into external functions could have anything stored // through them. Constraints.push_back(Constraint(Constraint::Store, getNode(I), - &GraphNodes[UniversalSet])); + UniversalSet)); // Memory objects passed into external function calls can have the // universal set point to them. Constraints.push_back(Constraint(Constraint::Copy, - &GraphNodes[UniversalSet], + UniversalSet, getNode(I))); } @@ -764,7 +851,7 @@ // into any pointers passed through the varargs section. if (F->getFunctionType()->isVarArg()) Constraints.push_back(Constraint(Constraint::Store, getVarargNode(F), - &GraphNodes[UniversalSet])); + UniversalSet)); } } NumConstraints += Constraints.size(); @@ -795,7 +882,10 @@ } void Andersens::visitAllocationInst(AllocationInst &AI) { - getNodeValue(AI)->addPointerTo(getObject(&AI)->setValue(&AI)); + unsigned ObjectIndex = getObject(&AI); + GraphNodes[ObjectIndex].setValue(&AI); + Constraints.push_back(Constraint(Constraint::AddressOf, getNodeValue(AI), + ObjectIndex)); } void Andersens::visitReturnInst(ReturnInst &RI) { @@ -829,7 +919,7 @@ void Andersens::visitPHINode(PHINode &PN) { if (isa(PN.getType())) { - Node *PNN = getNodeValue(PN); + unsigned PNN = getNodeValue(PN); for (unsigned i = 0, e = PN.getNumIncomingValues(); i != e; ++i) // P1 = phi P2, P3 --> , , ... Constraints.push_back(Constraint(Constraint::Copy, PNN, @@ -848,7 +938,7 @@ // P1 = cast int --> #if 0 Constraints.push_back(Constraint(Constraint::Copy, getNodeValue(CI), - &GraphNodes[UniversalSet])); + UniversalSet)); #else getNodeValue(CI); #endif @@ -857,7 +947,7 @@ // int = cast P1 --> #if 0 Constraints.push_back(Constraint(Constraint::Copy, - &GraphNodes[UniversalSet], + UniversalSet, getNode(CI.getOperand(0)))); #else getNode(CI.getOperand(0)); @@ -867,7 +957,7 @@ void Andersens::visitSelectInst(SelectInst &SI) { if (isa(SI.getType())) { - Node *SIN = getNodeValue(SI); + unsigned SIN = getNodeValue(SI); // P1 = select C, P2, P3 ---> , Constraints.push_back(Constraint(Constraint::Copy, SIN, getNode(SI.getOperand(1)))); @@ -886,48 +976,72 @@ /// the function pointer has been casted. If this is the case, do something /// reasonable. void Andersens::AddConstraintsForCall(CallSite CS, Function *F) { - // If this is a call to an external function, handle it directly to get some - // taste of context sensitivity. - if (F->isDeclaration() && AddConstraintsForExternalCall(CS, F)) + Value *CallValue = CS.getCalledValue(); + bool IsDeref = F == NULL; + + // If this is a call to an external function, try to handle it directly to get + // some taste of context sensitivity. + if (F && F->isDeclaration() && AddConstraintsForExternalCall(CS, F)) return; if (isa(CS.getType())) { - Node *CSN = getNode(CS.getInstruction()); - if (isa(F->getFunctionType()->getReturnType())) { - Constraints.push_back(Constraint(Constraint::Copy, CSN, - getReturnNode(F))); + unsigned CSN = getNode(CS.getInstruction()); + if (!F || isa(F->getFunctionType()->getReturnType())) { + if (IsDeref) + Constraints.push_back(Constraint(Constraint::Load, CSN, + getNode(CallValue), CallReturnPos)); + else + Constraints.push_back(Constraint(Constraint::Copy, CSN, + getNode(CallValue) + CallReturnPos)); } else { // If the function returns a non-pointer value, handle this just like we // treat a nonpointer cast to pointer. Constraints.push_back(Constraint(Constraint::Copy, CSN, - &GraphNodes[UniversalSet])); + UniversalSet)); } - } else if (isa(F->getFunctionType()->getReturnType())) { + } else if (F && isa(F->getFunctionType()->getReturnType())) { Constraints.push_back(Constraint(Constraint::Copy, - &GraphNodes[UniversalSet], - getReturnNode(F))); + UniversalSet, + getNode(CallValue) + CallReturnPos)); } - Function::arg_iterator AI = F->arg_begin(), AE = F->arg_end(); CallSite::arg_iterator ArgI = CS.arg_begin(), ArgE = CS.arg_end(); - for (; AI != AE && ArgI != ArgE; ++AI, ++ArgI) - if (isa(AI->getType())) { + if (F) { + // Direct Call + Function::arg_iterator AI = F->arg_begin(), AE = F->arg_end(); + for (; AI != AE && ArgI != ArgE; ++AI, ++ArgI) + if (isa(AI->getType())) { + if (isa((*ArgI)->getType())) { + // Copy the actual argument into the formal argument. + Constraints.push_back(Constraint(Constraint::Copy, getNode(AI), + getNode(*ArgI))); + } else { + Constraints.push_back(Constraint(Constraint::Copy, getNode(AI), + UniversalSet)); + } + } else if (isa((*ArgI)->getType())) { + Constraints.push_back(Constraint(Constraint::Copy, + UniversalSet, + getNode(*ArgI))); + } + } else { + //Indirect Call + unsigned ArgPos = CallFirstArgPos; + for (; ArgI != ArgE; ++ArgI) { if (isa((*ArgI)->getType())) { // Copy the actual argument into the formal argument. - Constraints.push_back(Constraint(Constraint::Copy, getNode(AI), - getNode(*ArgI))); + Constraints.push_back(Constraint(Constraint::Store, + getNode(CallValue), + getNode(*ArgI), ArgPos++)); } else { - Constraints.push_back(Constraint(Constraint::Copy, getNode(AI), - &GraphNodes[UniversalSet])); + Constraints.push_back(Constraint(Constraint::Store, + getNode (CallValue), + UniversalSet, ArgPos++)); } - } else if (isa((*ArgI)->getType())) { - Constraints.push_back(Constraint(Constraint::Copy, - &GraphNodes[UniversalSet], - getNode(*ArgI))); } - + } // Copy all pointers passed through the varargs section to the varargs node. - if (F->getFunctionType()->isVarArg()) + if (F && F->getFunctionType()->isVarArg()) for (; ArgI != ArgE; ++ArgI) if (isa((*ArgI)->getType())) Constraints.push_back(Constraint(Constraint::Copy, getVarargNode(F), @@ -942,9 +1056,7 @@ if (Function *F = CS.getCalledFunction()) { AddConstraintsForCall(CS, F); } else { - // We don't handle indirect call sites yet. Keep track of them for when we - // discover the call graph incrementally. - IndirectCalls.push_back(CS); + AddConstraintsForCall(CS, NULL); } } @@ -955,74 +1067,109 @@ /// intersects - Return true if the points-to set of this node intersects /// with the points-to set of the specified node. bool Andersens::Node::intersects(Node *N) const { - iterator I1 = begin(), I2 = N->begin(), E1 = end(), E2 = N->end(); - while (I1 != E1 && I2 != E2) { - if (*I1 == *I2) return true; - if (*I1 < *I2) - ++I1; - else - ++I2; - } - return false; + return PointsTo->intersects(N->PointsTo); } /// intersectsIgnoring - Return true if the points-to set of this node /// intersects with the points-to set of the specified node on any nodes /// except for the specified node to ignore. -bool Andersens::Node::intersectsIgnoring(Node *N, Node *Ignoring) const { - iterator I1 = begin(), I2 = N->begin(), E1 = end(), E2 = N->end(); - while (I1 != E1 && I2 != E2) { - if (*I1 == *I2) { - if (*I1 != Ignoring) return true; - ++I1; ++I2; - } else if (*I1 < *I2) - ++I1; +bool Andersens::Node::intersectsIgnoring(Node *N, unsigned Ignoring) const { + // TODO: If we are only going to call this with the same value for Ignoring, + // we should move the special values out of the points-to bitmap. + bool WeHadIt = PointsTo->test(Ignoring); + bool NHadIt = N->PointsTo->test(Ignoring); + bool Result = false; + if (WeHadIt) + PointsTo->reset(Ignoring); + if (NHadIt) + N->PointsTo->reset(Ignoring); + Result = PointsTo->intersects(N->PointsTo); + if (WeHadIt) + PointsTo->set(Ignoring); + if (NHadIt) + N->PointsTo->set(Ignoring); + return Result; +} + +// Create the constraint graph used for solving points-to analysis. +// +void Andersens::CreateConstraintGraph() { + for (unsigned i = 0, e = Constraints.size(); i != e; ++i) { + Constraint &C = Constraints[i]; + assert (C.Src < GraphNodes.size() && C.Dest < GraphNodes.size()); + if (C.Type == Constraint::AddressOf) + GraphNodes[C.Dest].PointsTo->set(C.Src); + else if (C.Type == Constraint::Load) + GraphNodes[C.Src].Constraints.push_back(C); + else if (C.Type == Constraint::Store) + GraphNodes[C.Dest].Constraints.push_back(C); + else if (C.Offset != 0) + GraphNodes[C.Src].Constraints.push_back(C); else - ++I2; + GraphNodes[C.Src].Edges->set(C.Dest); } - return false; } -// Copy constraint: all edges out of the source node get copied to the -// destination node. This returns true if a change is made. -bool Andersens::Node::copyFrom(Node *N) { - // Use a mostly linear-time merge since both of the lists are sorted. - bool Changed = false; - iterator I = N->begin(), E = N->end(); - unsigned i = 0; - while (I != E && i != Pointees.size()) { - if (Pointees[i] < *I) { - ++i; - } else if (Pointees[i] == *I) { - ++i; ++I; - } else { - // We found a new element to copy over. - Changed = true; - Pointees.insert(Pointees.begin()+i, *I); - ++i; ++I; +// Perform cycle detection, DFS, and RPO finding. +void Andersens::QueryNode(unsigned Node) { + assert(GraphNodes[Node].NodeRep == SelfRep && "Querying a non-rep node"); + unsigned OurDFS = ++DFSNumber; + SparseBitVector<> ToErase; + SparseBitVector<> NewEdges; + Node2DFS[Node] = OurDFS; + + for (SparseBitVector<>::iterator bi = GraphNodes[Node].Edges->begin(); + bi != GraphNodes[Node].Edges->end(); + ++bi) { + unsigned RepNode = FindNode(*bi); + // If we are going to add an edge to repnode, we have no need for the edge + // to e anymore. + if (RepNode != *bi && NewEdges.test(RepNode)){ + ToErase.set(*bi); + continue; + } + + // Continue about our DFS. + if (!Node2Deleted[RepNode]){ + if (Node2DFS[RepNode] == 0) { + QueryNode(RepNode); + // May have been changed by query + RepNode = FindNode(RepNode); + } + if (Node2DFS[RepNode] < Node2DFS[Node]) + Node2DFS[Node] = Node2DFS[RepNode]; + } + // We may have just discovered that e belongs to a cycle, in which case we + // can also erase it. + if (RepNode != *bi) { + ToErase.set(*bi); + NewEdges.set(RepNode); } } - if (I != E) { - Pointees.insert(Pointees.end(), I, E); - Changed = true; - } + GraphNodes[Node].Edges->intersectWithComplement(ToErase); + GraphNodes[Node].Edges |= NewEdges; - return Changed; -} + // If this node is a root of a non-trivial SCC, place it on our worklist to be + // processed + if (OurDFS == Node2DFS[Node]) { + bool Changed = false; + while (!SCCStack.empty() && Node2DFS[SCCStack.top()] >= OurDFS) { + Node = UniteNodes(Node, FindNode(SCCStack.top())); -bool Andersens::Node::loadFrom(Node *N) { - bool Changed = false; - for (iterator I = N->begin(), E = N->end(); I != E; ++I) - Changed |= copyFrom(*I); - return Changed; -} + SCCStack.pop(); + Changed = true; + } + Node2Deleted[Node] = true; + RPONumber++; -bool Andersens::Node::storeThrough(Node *N) { - bool Changed = false; - for (iterator I = begin(), E = end(); I != E; ++I) - Changed |= (*I)->copyFrom(N); - return Changed; + Topo2Node.at(GraphNodes.size() - RPONumber) = Node; + Node2Topo[Node] = GraphNodes.size() - RPONumber; + if (Changed) + GraphNodes[Node].Changed = true; + } else { + SCCStack.push(Node); + } } @@ -1033,73 +1180,257 @@ void Andersens::SolveConstraints() { bool Changed = true; unsigned Iteration = 0; - while (Changed) { - Changed = false; - ++NumIters; - DOUT << "Starting iteration #" << Iteration++ << "!\n"; - // Loop over all of the constraints, applying them in turn. - for (unsigned i = 0, e = Constraints.size(); i != e; ++i) { - Constraint &C = Constraints[i]; - switch (C.Type) { - case Constraint::Copy: - Changed |= C.Dest->copyFrom(C.Src); - break; - case Constraint::Load: - Changed |= C.Dest->loadFrom(C.Src); - break; - case Constraint::Store: - Changed |= C.Dest->storeThrough(C.Src); - break; - default: - assert(0 && "Unknown constraint!"); - } + // We create the bitmaps here to avoid getting jerked around by the compiler + // creating objects behind our back and wasting lots of memory. + for (unsigned i = 0; i < GraphNodes.size(); ++i) { + Node *N = &GraphNodes[i]; + N->PointsTo = new SparseBitVector<>; + N->OldPointsTo = new SparseBitVector<>; + N->Edges = new SparseBitVector<>; + } + CreateConstraintGraph(); + + Topo2Node.insert(Topo2Node.begin(), GraphNodes.size(), Unvisited); + Node2Topo.insert(Node2Topo.begin(), GraphNodes.size(), Unvisited); + Node2DFS.insert(Node2DFS.begin(), GraphNodes.size(), 0); + Node2Deleted.insert(Node2Deleted.begin(), GraphNodes.size(), false); + DFSNumber = 0; + RPONumber = 0; + // Order graph and mark starting nodes as changed. + for (unsigned i = 0; i < GraphNodes.size(); ++i) { + unsigned N = FindNode(i); + Node *INode = &GraphNodes[i]; + if (Node2DFS[N] == 0) { + QueryNode(N); + // Mark as changed if it's a representation and can contribute to the + // calculation right now. + if (INode->NodeRep == SelfRep && !INode->PointsTo->empty() + && (!INode->Edges->empty() || !INode->Constraints.empty())) + INode->Changed = true; } + } - if (Changed) { - // Check to see if any internal function's addresses have been passed to - // external functions. If so, we have to assume that their incoming - // arguments could be anything. If there are any internal functions in - // the universal node that we don't know about, we must iterate. - for (Node::iterator I = GraphNodes[UniversalSet].begin(), - E = GraphNodes[UniversalSet].end(); I != E; ++I) - if (Function *F = dyn_cast_or_null((*I)->getValue())) - if (F->hasInternalLinkage() && - EscapingInternalFunctions.insert(F).second) { - // We found a function that is just now escaping. Mark it as if it - // didn't have internal linkage. - AddConstraintsForNonInternalLinkage(F); - DOUT << "Found escaping internal function: " << F->getName() <<"\n"; - ++NumEscapingFunctions; - } + do { + Changed = false; - // Check to see if we have discovered any new callees of the indirect call - // sites. If so, add constraints to the analysis. - for (unsigned i = 0, e = IndirectCalls.size(); i != e; ++i) { - CallSite CS = IndirectCalls[i]; - std::vector &KnownCallees = IndirectCallees[CS]; - Node *CN = getNode(CS.getCalledValue()); - - for (Node::iterator NI = CN->begin(), E = CN->end(); NI != E; ++NI) - if (Function *F = dyn_cast_or_null((*NI)->getValue())) { - std::vector::iterator IP = - std::lower_bound(KnownCallees.begin(), KnownCallees.end(), F); - if (IP == KnownCallees.end() || *IP != F) { - // Add the constraints for the call now. - AddConstraintsForCall(CS, F); - DOUT << "Found actual callee '" - << F->getName() << "' for call: " - << *CS.getInstruction() << "\n"; - ++NumIndirectCallees; - KnownCallees.insert(IP, F); + ++NumIters; + DOUT << "Starting iteration #" << Iteration++ << "!\n"; + // TODO: In the microoptimization category, we could just make Topo2Node + // a fast map and thus only contain the visited nodes. + for (unsigned i = 0; i < GraphNodes.size(); ++i) { + unsigned CurrNodeIndex = Topo2Node[i]; + Node *CurrNode; + + // We may not revisit all nodes on every iteration + if (CurrNodeIndex == Unvisited) + continue; + CurrNode = &GraphNodes[CurrNodeIndex]; + // See if this is a node we need to process on this iteration + if (!CurrNode->Changed || CurrNode->NodeRep != SelfRep) + continue; + CurrNode->Changed = false; + + // Figure out the changed points to bits + SparseBitVector<> CurrPointsTo; + CurrPointsTo.intersectWithComplement(CurrNode->PointsTo, + CurrNode->OldPointsTo); + if (CurrPointsTo.empty()){ + continue; + } + *(CurrNode->OldPointsTo) |= CurrPointsTo; + + /* Now process the constraints for this node. */ + for (std::list::iterator li = CurrNode->Constraints.begin(); + li != CurrNode->Constraints.end(); ) { + li->Src = FindNode(li->Src); + li->Dest = FindNode(li->Dest); + + // TODO: We could delete redundant constraints here. + // Src and Dest will be the vars we are going to process. + // This may look a bit ugly, but what it does is allow us to process + // both store and load constraints with the same function. + // Load constraints say that every member of our RHS solution has K + // added to it, and that variable gets an edge to LHS. We also union + // RHS+K's solution into the LHS solution. + // Store constraints say that every member of our LHS solution has K + // added to it, and that variable gets an edge from RHS. We also union + // RHS's solution into the LHS+K solution. + unsigned *Src; + unsigned *Dest; + unsigned K = li->Offset; + unsigned CurrMember; + if (li->Type == Constraint::Load) { + Src = &CurrMember; + Dest = &li->Dest; + } else if (li->Type == Constraint::Store) { + Src = &li->Src; + Dest = &CurrMember; + } else { + // TODO Handle offseted copy constraint + li++; + continue; + } + // TODO: hybrid cycle detection would go here, we should check + // if it was a statically detected offline equivalence that + // involves pointers , and if so, remove the redundant constraints. + + const SparseBitVector<> &Solution = CurrPointsTo; + + for (SparseBitVector<>::iterator bi = Solution.begin(); + bi != Solution.end(); + ++bi) { + CurrMember = *bi; + + // Need to increment the member by K since that is where we are + // supposed to copy to/from + // Node that in positive weight cycles, which occur in address taking + // of fields, K can go past + // MaxK[CurrMember] elements, even though that is all it could + // point to. + if (K > 0 && K > MaxK[CurrMember]) + continue; + else + CurrMember = FindNode(CurrMember + K); + + // Add an edge to the graph, so we can just do regular bitmap ior next + // time. It may also let us notice a cycle. + if (!GraphNodes[*Src].Edges->test_and_set(*Dest)) { + if (GraphNodes[*Dest].PointsTo |= *(GraphNodes[*Src].PointsTo)) { + GraphNodes[*Dest].Changed = true; + // If we changed a node we've already processed, we need another + // iteration. + if (Node2Topo[*Dest] <= i) + Changed = true; } } + } + li++; } + SparseBitVector<> NewEdges; + SparseBitVector<> ToErase; + + // Now all we have left to do is propagate points-to info along the + // edges, erasing the redundant edges. + + + for (SparseBitVector<>::iterator bi = CurrNode->Edges->begin(); + bi != CurrNode->Edges->end(); + ++bi) { + + unsigned DestVar = *bi; + unsigned Rep = FindNode(DestVar); + + // If we ended up with this node as our destination, or we've already + // got an edge for the representative, delete the current edge. + if (Rep == CurrNodeIndex || + (Rep != DestVar && NewEdges.test(Rep))) { + ToErase.set(DestVar); + continue; + } + // Union the points-to sets into the dest + if (GraphNodes[Rep].PointsTo |= CurrPointsTo) { + GraphNodes[Rep].Changed = true; + if (Node2Topo[Rep] <= i) + Changed = true; + } + // If this edge's destination was collapsed, rewrite the edge. + if (Rep != DestVar) { + ToErase.set(DestVar); + NewEdges.set(Rep); + } + } + CurrNode->Edges->intersectWithComplement(ToErase); + CurrNode->Edges |= NewEdges; } + if (Changed) { + DFSNumber = RPONumber = 0; + Node2Deleted.clear(); + Topo2Node.clear(); + Node2Topo.clear(); + Node2DFS.clear(); + Topo2Node.insert(Topo2Node.begin(), GraphNodes.size(), Unvisited); + Node2Topo.insert(Node2Topo.begin(), GraphNodes.size(), Unvisited); + Node2DFS.insert(Node2DFS.begin(), GraphNodes.size(), 0); + Node2Deleted.insert(Node2Deleted.begin(), GraphNodes.size(), false); + // Rediscover the DFS/Topo ordering, and cycle detect. + for (unsigned j = 0; j < GraphNodes.size(); j++) { + unsigned JRep = FindNode(j); + if (Node2DFS[JRep] == 0) + QueryNode(JRep); + } + } + + } while (Changed); + + Node2Topo.clear(); + Topo2Node.clear(); + Node2DFS.clear(); + Node2Deleted.clear(); + for (unsigned i = 0; i < GraphNodes.size(); ++i) { + Node *N = &GraphNodes[i]; + delete N->OldPointsTo; + delete N->Edges; } } +//===----------------------------------------------------------------------===// +// Union-Find +//===----------------------------------------------------------------------===// +// Unite nodes First and Second, returning the one which is now the +// representative node. First and Second are indexes into GraphNodes +unsigned Andersens::UniteNodes(unsigned First, unsigned Second) { + assert (First < GraphNodes.size() && Second < GraphNodes.size() && + "Attempting to merge nodes that don't exist"); + // TODO: implement union by rank + Node *FirstNode = &GraphNodes[First]; + Node *SecondNode = &GraphNodes[Second]; + + assert (SecondNode->NodeRep == SelfRep && FirstNode->NodeRep == SelfRep && + "Trying to unite two non-representative nodes!"); + if (First == Second) + return First; + + SecondNode->NodeRep = First; + FirstNode->Changed |= SecondNode->Changed; + FirstNode->PointsTo |= *(SecondNode->PointsTo); + FirstNode->Edges |= *(SecondNode->Edges); + FirstNode->Constraints.splice(FirstNode->Constraints.begin(), + SecondNode->Constraints); + delete FirstNode->OldPointsTo; + FirstNode->OldPointsTo = new SparseBitVector<>; + + // Destroy interesting parts of the merged-from node. + delete SecondNode->OldPointsTo; + delete SecondNode->Edges; + delete SecondNode->PointsTo; + SecondNode->Edges = NULL; + SecondNode->PointsTo = NULL; + SecondNode->OldPointsTo = NULL; + + NumUnified++; + DOUT << "Unified Node "; + DEBUG(PrintNode(FirstNode)); + DOUT << " and Node "; + DEBUG(PrintNode(SecondNode)); + DOUT << "\n"; + + // TODO: Handle SDT + return First; +} + +// Find the index into GraphNodes of the node representing Node, performing +// path compression along the way +unsigned Andersens::FindNode(unsigned NodeIndex) { + assert (NodeIndex < GraphNodes.size() + && "Attempting to find a node that can't exist"); + Node *N = &GraphNodes[NodeIndex]; + if (N->NodeRep == SelfRep) + return NodeIndex; + else + return (N->NodeRep = FindNode(N->NodeRep)); +} //===----------------------------------------------------------------------===// // Debugging Output @@ -1116,15 +1447,20 @@ cerr << ""; return; } + if (!N->getValue()) { + cerr << "artificial" << (intptr_t) N; + return; + } assert(N->getValue() != 0 && "Never set node label!"); Value *V = N->getValue(); if (Function *F = dyn_cast(V)) { if (isa(F->getFunctionType()->getReturnType()) && - N == getReturnNode(F)) { + N == &GraphNodes[getReturnNode(F)]) { cerr << F->getName() << ":retval"; return; - } else if (F->getFunctionType()->isVarArg() && N == getVarargNode(F)) { + } else if (F->getFunctionType()->isVarArg() && + N == &GraphNodes[getVarargNode(F)]) { cerr << F->getName() << ":vararg"; return; } @@ -1141,22 +1477,36 @@ cerr << "(unnamed)"; if (isa(V) || isa(V)) - if (N == getObject(V)) + if (N == &GraphNodes[getObject(V)]) cerr << ""; } void Andersens::PrintConstraints() { cerr << "Constraints:\n"; + for (unsigned i = 0, e = Constraints.size(); i != e; ++i) { - cerr << " #" << i << ": "; - Constraint &C = Constraints[i]; - if (C.Type == Constraint::Store) + const Constraint &C = Constraints[i]; + if (C.Type == Constraint::Store) { cerr << "*"; - PrintNode(C.Dest); + if (C.Offset != 0) + cerr << "("; + } + PrintNode(&GraphNodes[C.Dest]); + if (C.Type == Constraint::Store && C.Offset != 0) + cerr << " + " << C.Offset << ")"; cerr << " = "; - if (C.Type == Constraint::Load) + if (C.Type == Constraint::Load) { cerr << "*"; - PrintNode(C.Src); + if (C.Offset != 0) + cerr << "("; + } + else if (C.Type == Constraint::AddressOf) + cerr << "&"; + PrintNode(&GraphNodes[C.Src]); + if (C.Offset != 0 && C.Type != Constraint::Store) + cerr << " + " << C.Offset; + if (C.Type == Constraint::Load && C.Offset != 0) + cerr << ")"; cerr << "\n"; } } @@ -1165,13 +1515,26 @@ cerr << "Points-to graph:\n"; for (unsigned i = 0, e = GraphNodes.size(); i != e; ++i) { Node *N = &GraphNodes[i]; - cerr << "[" << (N->end() - N->begin()) << "] "; - PrintNode(N); - cerr << "\t--> "; - for (Node::iterator I = N->begin(), E = N->end(); I != E; ++I) { - if (I != N->begin()) cerr << ", "; - PrintNode(*I); + if (FindNode (i) != i) { + PrintNode(N); + cerr << "\t--> same as "; + PrintNode(&GraphNodes[FindNode(i)]); + cerr << "\n"; + } else { + cerr << "[" << (N->PointsTo->count()) << "] "; + PrintNode(N); + cerr << "\t--> "; + + bool first = true; + for (SparseBitVector<>::iterator bi = N->PointsTo->begin(); + bi != N->PointsTo->end(); + ++bi) { + if (!first) + cerr << ", "; + PrintNode(&GraphNodes[*bi]); + first = false; + } + cerr << "\n"; } - cerr << "\n"; } } From dberlin at dberlin.org Sun Sep 16 17:31:47 2007 From: dberlin at dberlin.org (Daniel Berlin) Date: Sun, 16 Sep 2007 22:31:47 -0000 Subject: [llvm-commits] [llvm] r42017 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h Message-ID: <200709162231.l8GMVlwh002855@zion.cs.uiuc.edu> Author: dannyb Date: Sun Sep 16 17:31:47 2007 New Revision: 42017 URL: http://llvm.org/viewvc/llvm-project?rev=42017&view=rev Log: Fix a few bugs related to zero'ing of elements Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=42017&r1=42016&r2=42017&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original) +++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Sun Sep 16 17:31:47 2007 @@ -212,7 +212,7 @@ BitWord old = changed ? 0 : Bits[i]; Bits[i] |= RHS.Bits[i]; - if (old != Bits[i]) + if (!changed && old != Bits[i]) changed = true; } return changed; @@ -242,17 +242,17 @@ if (Bits[i] != 0) allzero = false; - if (old != Bits[i]) + if (!changed && old != Bits[i]) changed = true; } - BecameZero = !allzero; + BecameZero = allzero; return changed; } // Intersect this Element with the complement of RHS and return true if this // one changed. BecameZero is set to true if this element became all-zero // bits. bool intersectWithComplement(const SparseBitVectorElement &RHS, - bool &BecameZero) { + bool &BecameZero) { bool changed = false; bool allzero = true; @@ -264,10 +264,10 @@ if (Bits[i] != 0) allzero = false; - if (old != Bits[i]) + if (!changed && old != Bits[i]) changed = true; } - BecameZero = !allzero; + BecameZero = allzero; return changed; } // Three argument version of intersectWithComplement that intersects @@ -283,7 +283,7 @@ if (Bits[i] != 0) allzero = false; } - BecameZero = !allzero; + BecameZero = allzero; } }; @@ -548,12 +548,6 @@ if (Elements.empty() && RHS.Elements.empty()) return false; - // See if the first bitmap element is the same in both. This is only - // possible if they are the same bitmap. - if (Iter1 != Elements.end() && Iter2 != RHS.Elements.end()) - if (*Iter1 == *Iter2) - return false; - while (Iter2 != RHS.Elements.end()) { if (Iter1 == Elements.end() || Iter1->index() > Iter2->index()) { Elements.insert(Iter1, @@ -582,12 +576,6 @@ if (Elements.empty() && RHS.Elements.empty()) return false; - // See if the first bitmap element is the same in both. This is only - // possible if they are the same bitmap. - if (Iter1 != Elements.end() && Iter2 != RHS.Elements.end()) - if (*Iter1 == *Iter2) - return false; - // Loop through, intersecting as we go, erasing elements when necessary. while (Iter2 != RHS.Elements.end()) { if (Iter1 == Elements.end()) @@ -600,9 +588,11 @@ changed |= Iter1->intersectWith(*Iter2, BecameZero); if (BecameZero) { ElementListIter IterTmp = Iter1; + ++Iter1; Elements.erase(IterTmp); + } else { + ++Iter1; } - ++Iter1; ++Iter2; } else { ElementListIter IterTmp = Iter1; @@ -626,14 +616,6 @@ if (Elements.empty() && RHS.Elements.empty()) return false; - // See if the first bitmap element is the same in both. This is only - // possible if they are the same bitmap. - if (Iter1 != Elements.end() && Iter2 != RHS.Elements.end()) - if (*Iter1 == *Iter2) { - Elements.clear(); - return true; - } - // Loop through, intersecting as we go, erasing elements when necessary. while (Iter2 != RHS.Elements.end()) { if (Iter1 == Elements.end()) @@ -646,9 +628,11 @@ changed |= Iter1->intersectWithComplement(*Iter2, BecameZero); if (BecameZero) { ElementListIter IterTmp = Iter1; + ++Iter1; Elements.erase(IterTmp); + } else { + ++Iter1; } - ++Iter1; ++Iter2; } else { ElementListIter IterTmp = Iter1; @@ -678,13 +662,6 @@ if (RHS1.empty() && RHS2.empty()) return; - // See if the first bitmap element is the same in both. This is only - // possible if they are the same bitmap. - if (Iter1 != RHS1.Elements.end() && Iter2 != RHS2.Elements.end()) - if (*Iter1 == *Iter2) { - return; - } - // Loop through, intersecting as we go, erasing elements when necessary. while (Iter2 != RHS2.Elements.end()) { if (Iter1 == RHS1.Elements.end()) @@ -702,7 +679,6 @@ } else delete NewElement; - ++Iter1; ++Iter2; } else { @@ -740,13 +716,6 @@ if (Elements.empty() && RHS.Elements.empty()) return false; - // See if the first bitmap element is the same in both. This is only - // possible if they are the same bitmap. - if (Iter1 != Elements.end() && Iter2 != RHS.Elements.end()) - if (*Iter1 == *Iter2) { - return true; - } - // Loop through, intersecting stopping when we hit bits in common. while (Iter2 != RHS.Elements.end()) { if (Iter1 == Elements.end()) @@ -824,7 +793,7 @@ const SparseBitVector *RHS) { return LHS &= (*RHS); } - + // Dump a SparseBitVector to a stream template From dberlin at dberlin.org Sun Sep 16 18:59:53 2007 From: dberlin at dberlin.org (Daniel Berlin) Date: Sun, 16 Sep 2007 23:59:53 -0000 Subject: [llvm-commits] [llvm] r42018 - in /llvm/trunk: include/llvm/ADT/SparseBitVector.h lib/Analysis/IPA/Andersens.cpp Message-ID: <200709162359.l8GNxrOH006196@zion.cs.uiuc.edu> Author: dannyb Date: Sun Sep 16 18:59:53 2007 New Revision: 42018 URL: http://llvm.org/viewvc/llvm-project?rev=42018&view=rev Log: Fix bug in andersen's related to test_and_set. Add operator == and != to SparseBitVector. Simplify code for test_and_set Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h llvm/trunk/lib/Analysis/IPA/Andersens.cpp Modified: llvm/trunk/include/llvm/ADT/SparseBitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SparseBitVector.h?rev=42018&r1=42017&r2=42018&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original) +++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Sun Sep 16 18:59:53 2007 @@ -128,9 +128,11 @@ bool test_and_set (unsigned Idx) { bool old = test(Idx); - if (!old) + if (!old) { set(Idx); - return !old; + return true; + } + return false; } void reset(unsigned Idx) { @@ -533,9 +535,29 @@ bool test_and_set (unsigned Idx) { bool old = test(Idx); - if (!old) + if (!old) { set(Idx); - return !old; + return true; + } + return false; + } + + bool operator!=(const SparseBitVector &RHS) { + return !(*this == RHS); + } + + bool operator==(const SparseBitVector &RHS) { + ElementListConstIter Iter1 = Elements.begin(); + ElementListConstIter Iter2 = RHS.Elements.begin(); + + while (Iter2 != RHS.Elements.end()) { + if (Iter1->index() != Iter2->index() + || *Iter1 != *Iter2) + return false; + ++Iter1; + ++Iter2; + } + return Iter1 == Elements.end(); } // Union our bitmap with the RHS and return true if we changed. Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=42018&r1=42017&r2=42018&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Sun Sep 16 18:59:53 2007 @@ -1212,10 +1212,9 @@ } do { - Changed = false; - + Changed = false; ++NumIters; - DOUT << "Starting iteration #" << Iteration++ << "!\n"; + DOUT << "Starting iteration #" << Iteration++; // TODO: In the microoptimization category, we could just make Topo2Node // a fast map and thus only contain the visited nodes. for (unsigned i = 0; i < GraphNodes.size(); ++i) { @@ -1295,7 +1294,7 @@ // Add an edge to the graph, so we can just do regular bitmap ior next // time. It may also let us notice a cycle. - if (!GraphNodes[*Src].Edges->test_and_set(*Dest)) { + if (GraphNodes[*Src].Edges->test_and_set(*Dest)) { if (GraphNodes[*Dest].PointsTo |= *(GraphNodes[*Src].PointsTo)) { GraphNodes[*Dest].Changed = true; // If we changed a node we've already processed, we need another From dalej at apple.com Sun Sep 16 19:38:27 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 17 Sep 2007 00:38:27 -0000 Subject: [llvm-commits] [llvm] r42019 - /llvm/trunk/lib/Target/CBackend/CBackend.cpp Message-ID: <200709170038.l8H0cR4D007542@zion.cs.uiuc.edu> Author: johannes Date: Sun Sep 16 19:38:27 2007 New Revision: 42019 URL: http://llvm.org/viewvc/llvm-project?rev=42019&view=rev Log: Implement x86 long double (uses host long double, so only works on x86 target). Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp Modified: llvm/trunk/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CBackend/CBackend.cpp?rev=42019&r1=42018&r2=42019&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Sun Sep 16 19:38:27 2007 @@ -406,6 +406,11 @@ } case Type::FloatTyID: return Out << "float " << NameSoFar; case Type::DoubleTyID: return Out << "double " << NameSoFar; + // Lacking emulation of FP80 on PPC, etc., we assume whichever of these is + // present matches host 'long double'. + case Type::X86_FP80TyID: + case Type::PPC_FP128TyID: + case Type::FP128TyID: return Out << "long double " << NameSoFar; default : cerr << "Unknown primitive type: " << *Ty << "\n"; abort(); @@ -604,7 +609,7 @@ // only deal in IEEE FP). // static bool isFPCSafeToPrint(const ConstantFP *CFP) { - // Do long doubles the hard way for now. + // Do long doubles in hex for now. if (CFP->getType()!=Type::FloatTy && CFP->getType()!=Type::DoubleTy) return false; APFloat APF = APFloat(CFP->getValueAPF()); // copy @@ -878,15 +883,22 @@ switch (CPV->getType()->getTypeID()) { case Type::FloatTyID: - case Type::DoubleTyID: { + case Type::DoubleTyID: + case Type::X86_FP80TyID: + case Type::PPC_FP128TyID: + case Type::FP128TyID: { ConstantFP *FPC = cast(CPV); std::map::iterator I = FPConstantMap.find(FPC); if (I != FPConstantMap.end()) { // Because of FP precision problems we must load from a stack allocated // value that holds the value in hex. - Out << "(*(" << (FPC->getType() == Type::FloatTy ? "float" : "double") + Out << "(*(" << (FPC->getType() == Type::FloatTy ? "float" : + FPC->getType() == Type::DoubleTy ? "double" : + "long double") << "*)&FPConstant" << I->second << ')'; } else { + assert(FPC->getType() == Type::FloatTy || + FPC->getType() == Type::DoubleTy); double V = FPC->getType() == Type::FloatTy ? FPC->getValueAPF().convertToFloat() : FPC->getValueAPF().convertToDouble(); @@ -1490,7 +1502,10 @@ << "\n\n/* Support for floating point constants */\n" << "typedef unsigned long long ConstantDoubleTy;\n" << "typedef unsigned int ConstantFloatTy;\n" - + << "typedef struct { unsigned long long f1; unsigned short f2; " + "unsigned short pad[3]; } ConstantFP80Ty;\n" + << "typedef struct { unsigned long long f1; unsigned long long f2; }" + " ConstantFP128Ty;\n" << "\n\n/* Global Declarations */\n"; // First output all the declarations for the program, because C requires @@ -1529,6 +1544,7 @@ Out << "\n/* Function Declarations */\n"; Out << "double fmod(double, double);\n"; // Support for FP rem Out << "float fmodf(float, float);\n"; + Out << "long double fmodl(long double, long double);\n"; for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) { // Don't print declarations for intrinsic functions. @@ -1711,6 +1727,13 @@ Out << "static const ConstantFloatTy FPConstant" << FPCounter++ << " = 0x" << std::hex << i << std::dec << "U; /* " << Val << " */\n"; + } else if (FPC->getType() == Type::X86_FP80Ty) { + const uint64_t *p = FPC->getValueAPF().convertToAPInt().getRawData(); + Out << "static const ConstantFP80Ty FPConstant" << FPCounter++ + << " = { 0x" << std::hex + << ((uint16_t)p[1] | (p[0] & 0xffffffffffffLL)<<16) + << ", 0x" << (uint16_t)(p[0] >> 48) << ",0,0,0" + << "}; /* Long double constant */\n" << std::dec; } else assert(0 && "Unknown float type!"); } @@ -2190,8 +2213,10 @@ // Output a call to fmod/fmodf instead of emitting a%b if (I.getType() == Type::FloatTy) Out << "fmodf("; - else + else if (I.getType() == Type::DoubleTy) Out << "fmod("; + else // all 3 flavors of long double + Out << "fmodl("; writeOperand(I.getOperand(0)); Out << ", "; writeOperand(I.getOperand(1));