From baldrick at free.fr Mon Sep 17 03:59:53 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Sep 2007 10:59:53 +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: References: <200709121855.l8CItFuU000417@zion.cs.uiuc.edu> <200709151600.40230.baldrick@free.fr> Message-ID: <200709171059.54888.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. > > 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. I've CC'd Anton since he's the one who knows all about this stuff. Presumably when A is an alias for B there are two cases: either this is a "weak alias" or weakref, meaning that at link time it may turn out that A wasn't an alias for B after all, or A is a strong alias (a term I just invented) for B, meaning that this is definitive: you can replace uses of A with uses of B everywhere. In the first case linker support is required, but not in the second case, so presumably it is wrong to turn off alias support in the second case. I don't know if your patch turned this second case off or not. In the first case (weakrefs) we output a special declaration to the bitcode saying that A is a weak alias for B. I think it is a mistake not to output this even for platforms like Darwin that don't handle weakrefs: such aliases may be resolvable by LLVM, for example when linking modules using llvm-link. Think also of running bitcode under lli. Thus there are some cases in which weakrefs can work correctly even on Darwin. Instead, I suggest we output a warning in the f-e that aliases are not supported, but still generate the alias in the bitcode. Then we teach the code generators, which presumably means the asm printer, to ignore aliases on Darwin. On the other hand, not all bitcode is generated by llvm-gcc. It may be a bad idea to have LLVM quietly ignore aliases on Darwin because of the potential surprise and trouble it may create for front-end writers who aren't aware of this. > 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. Ciao, Duncan. From baldrick at free.fr Mon Sep 17 05:26:40 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Sep 2007 10:26:40 -0000 Subject: [llvm-commits] [llvm] r42021 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200709171026.l8HAQfhV001699@zion.cs.uiuc.edu> Author: baldrick Date: Mon Sep 17 05:26:40 2007 New Revision: 42021 URL: http://llvm.org/viewvc/llvm-project?rev=42021&view=rev Log: Factor the trampoline transformation into a subroutine. 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=42021&r1=42020&r2=42021&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Sep 17 05:26:40 2007 @@ -235,6 +235,7 @@ private: Instruction *visitCallSite(CallSite CS); bool transformConstExprCastCall(CallSite CS); + Instruction *transformCallThroughTrampoline(CallSite CS); public: // InsertNewInstBefore - insert an instruction New before instruction Old @@ -7834,6 +7835,11 @@ return EraseInstFromFunction(*CS.getInstruction()); } + if (BitCastInst *BC = dyn_cast(Callee)) + if (IntrinsicInst *In = dyn_cast(BC->getOperand(0))) + if (In->getIntrinsicID() == Intrinsic::init_trampoline) + return transformCallThroughTrampoline(CS); + const PointerType *PTy = cast(Callee->getType()); const FunctionType *FTy = cast(PTy->getElementType()); if (FTy->isVarArg()) { @@ -7852,143 +7858,6 @@ } } - 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 = 0; - - 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; } @@ -8191,6 +8060,148 @@ return true; } +// transformCallThroughTrampoline - Turn a call to a function created by the +// init_trampoline intrinsic into a direct call to the underlying function. +// +Instruction *InstCombiner::transformCallThroughTrampoline(CallSite CS) { + Value *Callee = CS.getCalledValue(); + const PointerType *PTy = cast(Callee->getType()); + const FunctionType *FTy = cast(PTy->getElementType()); + + IntrinsicInst *Tramp = + cast(cast(Callee)->getOperand(0)); + + Function *NestF = + cast(IntrinsicInst::StripPointerCasts(Tramp->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 = 0; + + // 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) { + Instruction *Caller = CS.getInstruction(); + 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 = Tramp->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); + return CS.getInstruction(); +} + /// FoldPHIArgBinOpIntoPHI - If we have something like phi [add (a,b), add(c,d)] /// and if a/b/c/d and the add's all have a single use, turn this into two phi's /// and a single binop. From baldrick at free.fr Mon Sep 17 05:29:56 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Sep 2007 12:29:56 +0200 Subject: [llvm-commits] [llvm] r41844 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp In-Reply-To: References: <200709111435.l8BEZj3w032506@zion.cs.uiuc.edu> Message-ID: <200709171229.58060.baldrick@free.fr> Hi Chris, > Nice! Can you please add a testcase? I already did (Transforms/InstCombine/2007-09-11-Trampoline.ll). > 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? Done. > Thanks work, I think the single intrinsic approach is much cleaner! :) I thought of pushing this to mainline gcc, but I'm not sure they'll be interested. Ciao, Duncan. From baldrick at free.fr Mon Sep 17 05:45:31 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Sep 2007 12:45:31 +0200 Subject: [llvm-commits] Trampoline changes In-Reply-To: References: <200709090003.59557.baldrick@free.fr> <200709091046.23869.baldrick@free.fr> Message-ID: <200709171245.31771.baldrick@free.fr> Hi Chris, > > 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. that's a very interesting idea. It sounds hard to an LLVM minnow like myself though :) > 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. Yes, it would be pretty nice. But how feasible is it? Surely it will only work well if we can find out all or at least most of the places that the trampoline function pointer gets passed to. This requires effective alias analysis, but currently alias analysis doesn't seem up to it. For example, the use of exception handling blows away alias info (due to the eh intrinsics using IntrWriteMem) but almost all Ada code has eh in it. Likewise, the init_trampoline intrinsic itself blocks effective alias analysis. Best wishes, Duncan. From baldrick at free.fr Mon Sep 17 08:10:38 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 17 Sep 2007 15:10:38 +0200 Subject: [llvm-commits] [llvm] r42016 - /llvm/trunk/lib/Analysis/IPA/Andersens.cpp In-Reply-To: <200709162145.l8GLj3Bg001134@zion.cs.uiuc.edu> References: <200709162145.l8GLj3Bg001134@zion.cs.uiuc.edu> Message-ID: <200709171510.39213.baldrick@free.fr> Hi, > Rewrite of andersen's to be about 100x faster, cleaner, and begin to support field sensitivity some nitpicking comments: > +// without any issues. To wit, an indirect call Y(a,b) is equivalence to equivalence -> equivalent > 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"); there are now a lot of pointless spaces here. How about aligning commas on the end of NumConstraints? > + /// 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 Because -> because Also, in this and other comments some lines are rather short, and I can't always see why you break them early. > + struct Node { > + Value *Val; > + SparseBitVector<> *Edges; strange indentation of Val. > + // compression. NodeRep gives the index into GraphNodes > + // representative for this one. Probably "the GraphNodes representative" > + unsigned NodeRep; public: shouldn't "public:" be on the next line? > + > + Node() : Val(0), Edges(0), PointsTo(0), OldPointsTo(0), Changed(false), > + NodeRep(SelfRep) { > + } Closing } could follow the opening { on the previous line. > + // Map from graph node to maximum K value that is allowed (For functions, For -> for > + // Stack for Tarjans Tarjan's > + // This may look a bit ugly, but what it does is allow us to process > + // both store and load constraints with the same function. with the same function -> within the same function (?) > + // Need to increment the member by K since that is where we are > + // supposed to copy to/from Missing full stop. > + // Node that in positive weight cycles, which occur in address taking Node that -> Note that Ciao, Duncan. From dberlin at dberlin.org Mon Sep 17 09:18:07 2007 From: dberlin at dberlin.org (Daniel Berlin) Date: Mon, 17 Sep 2007 10:18:07 -0400 Subject: [llvm-commits] [llvm] r42016 - /llvm/trunk/lib/Analysis/IPA/Andersens.cpp In-Reply-To: <200709171510.39213.baldrick@free.fr> References: <200709162145.l8GLj3Bg001134@zion.cs.uiuc.edu> <200709171510.39213.baldrick@free.fr> Message-ID: <4aca3dc20709170718m1689ee77odd443fc89bf73a90@mail.gmail.com> On 9/17/07, Duncan Sands wrote: > Hi, > > > Rewrite of andersen's to be about 100x faster, cleaner, and begin to support field sensitivity > > some nitpicking comments: > > > +// without any issues. To wit, an indirect call Y(a,b) is equivalence to > > equivalence -> equivalent Fixed > > > 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"); > > there are now a lot of pointless spaces here. How about aligning commas on the > end of NumConstraints? Sure > > > + /// 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 > > Because -> because Fixed > > Also, in this and other comments some lines are rather short, and I can't always see why > you break them early. I just do whatever emacs fill-paragraph does. I'll rerun it on the comments :) > > > + struct Node { > > + Value *Val; > > + SparseBitVector<> *Edges; > > strange indentation of Val. Fixed > > > + // compression. NodeRep gives the index into GraphNodes > > + // representative for this one. > > Probably "the GraphNodes representative" Fixed > > > + unsigned NodeRep; public: > > shouldn't "public:" be on the next line? > Fixed > > + > > + Node() : Val(0), Edges(0), PointsTo(0), OldPointsTo(0), Changed(false), > > + NodeRep(SelfRep) { > > + } > > Closing } could follow the opening { on the previous line. Fixed > > > + // Map from graph node to maximum K value that is allowed (For functions, > > For -> for Fixed > > > + // Stack for Tarjans > > Tarjan's Fixed > + // This may look a bit ugly, but what it does is allow us to process > > + // both store and load constraints with the same function. > > with the same function -> within the same function (?) No. It really should be "with the same code" > > + // Need to increment the member by K since that is where we are > > + // supposed to copy to/from > > Missing full stop. Fixed > > > + // Node that in positive weight cycles, which occur in address taking > > Node that -> Note that Fixed. Thanks! I have something that spell checks comments, but not something that grammar checks them, so these things are always helpful :) From djg at cray.com Mon Sep 17 09:35:24 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 17 Sep 2007 14:35:24 -0000 Subject: [llvm-commits] [llvm] r42024 - in /llvm/trunk: lib/Target/X86/X86InstrX86-64.td test/CodeGen/X86/cmp0.ll Message-ID: <200709171435.l8HEZOul009279@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 17 09:35:24 2007 New Revision: 42024 URL: http://llvm.org/viewvc/llvm-project?rev=42024&view=rev Log: Use "test reg,reg" in place of "cmp reg,0" for 64-bit operands. This was previously only done for 32-bit and smaller operands. Added: llvm/trunk/test/CodeGen/X86/cmp0.ll Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td 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=42024&r1=42023&r2=42024&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Mon Sep 17 09:35:24 2007 @@ -1076,6 +1076,12 @@ def : Pat<(X86tailcall GR64:$dst), (CALL64r GR64:$dst)>; +// Comparisons. + +// TEST R,R is smaller than CMP R,0 +def : Pat<(X86cmp GR64:$src1, 0), + (TEST64rr GR64:$src1, GR64:$src1)>; + // {s|z}extload bool -> {s|z}extload byte def : Pat<(sextloadi64i1 addr:$src), (MOVSX64rm8 addr:$src)>; def : Pat<(zextloadi64i1 addr:$src), (MOVZX64rm8 addr:$src)>; Added: llvm/trunk/test/CodeGen/X86/cmp0.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmp0.ll?rev=42024&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/cmp0.ll (added) +++ llvm/trunk/test/CodeGen/X86/cmp0.ll Mon Sep 17 09:35:24 2007 @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | grep -v cmp + +define i64 @foo(i64 %x) { + %t = icmp eq i64 %x, 0 + %r = zext i1 %t to i64 + ret i64 %r +} From djg at cray.com Mon Sep 17 09:49:27 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 17 Sep 2007 14:49:27 -0000 Subject: [llvm-commits] [llvm] r42026 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/cmp1.ll Message-ID: <200709171449.l8HEnRvR009707@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 17 09:49:27 2007 New Revision: 42026 URL: http://llvm.org/viewvc/llvm-project?rev=42026&view=rev Log: Emit integer x<1 as x<=0, as comparisons with zero (now includeing 64-bit) can use test instead of cmp with an immediate. Added: llvm/trunk/test/CodeGen/X86/cmp1.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=42026&r1=42025&r2=42026&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Sep 17 09:49:27 2007 @@ -1546,6 +1546,11 @@ // X < 0 -> X == 0, jump on sign. X86CC = X86::COND_S; return true; + } else if (SetCCOpcode == ISD::SETLT && RHSC->getValue() == 1) { + // X < 1 -> X <= 0 + RHS = DAG.getConstant(0, RHS.getValueType()); + X86CC = X86::COND_LE; + return true; } } Added: llvm/trunk/test/CodeGen/X86/cmp1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/cmp1.ll?rev=42026&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/cmp1.ll (added) +++ llvm/trunk/test/CodeGen/X86/cmp1.ll Mon Sep 17 09:49:27 2007 @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s | llc -march=x86-64 | grep -v cmp + +define i64 @foo(i64 %x) { + %t = icmp slt i64 %x, 1 + %r = zext i1 %t to i64 + ret i64 %r +} From djg at cray.com Mon Sep 17 09:55:08 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 17 Sep 2007 14:55:08 -0000 Subject: [llvm-commits] [llvm] r42027 - /llvm/trunk/lib/Target/X86/X86InstrX86-64.td Message-ID: <200709171455.l8HEt8p8009857@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 17 09:55:08 2007 New Revision: 42027 URL: http://llvm.org/viewvc/llvm-project?rev=42027&view=rev Log: Use xorl instead of xorq to enter a zero into a 64-bit register. Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td 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=42027&r1=42026&r2=42027&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Mon Sep 17 09:55:08 2007 @@ -1018,13 +1018,15 @@ [(set GR64:$dst, (zextloadi64i32 addr:$src))]>; -// Alias instructions that map movr0 to xor. +// Alias instructions that map movr0 to xor. Use xorl instead of xorq; it's +// equivalent due to implicit zero-extending, and it sometimes has a smaller +// encoding. // 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 Defs = [EFLAGS], AddedComplexity = 1, isReMaterializable = 1 in def MOV64r0 : RI<0x31, MRMInitReg, (outs GR64:$dst), (ins), - "xor{q}\t$dst, $dst", + "xor{l}\t${dst:subreg32}, ${dst:subreg32}", [(set GR64:$dst, 0)]>; // Materialize i64 constant where top 32-bits are zero. From djg at cray.com Mon Sep 17 10:19:08 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 17 Sep 2007 15:19:08 -0000 Subject: [llvm-commits] [llvm] r42029 - /llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Message-ID: <200709171519.l8HFJ8k2010460@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 17 10:19:08 2007 New Revision: 42029 URL: http://llvm.org/viewvc/llvm-project?rev=42029&view=rev Log: Add 64-bit jmp instructions to the list of instructions that can terminate a block with no fall-through. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=42029&r1=42028&r2=42029&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Sep 17 10:19:08 2007 @@ -582,7 +582,9 @@ case X86::TAILJMPm: case X86::JMP: // Uncond branch. case X86::JMP32r: // Indirect branch. + case X86::JMP64r: // Indirect branch (64-bit). case X86::JMP32m: // Indirect branch through mem. + case X86::JMP64m: // Indirect branch through mem (64-bit). return true; default: return false; } From gordonhenriksen at mac.com Mon Sep 17 12:04:45 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Mon, 17 Sep 2007 17:04:45 -0000 Subject: [llvm-commits] [llvm] r42032 - /llvm/trunk/CREDITS.TXT Message-ID: <200709171704.l8HH4jFB017211@zion.cs.uiuc.edu> Author: gordon Date: Mon Sep 17 12:04:44 2007 New Revision: 42032 URL: http://llvm.org/viewvc/llvm-project?rev=42032&view=rev Log: Adding myself to credits. Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=42032&r1=42031&r2=42032&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Mon Sep 17 12:04:44 2007 @@ -106,6 +106,10 @@ D: Miscellaneous bug fixes D: Register allocation refactoring +N: Gordon Henriksen +E: gordonhenriksen at mac.com +D: C interface + N: Raul Fernandes Herbster E: raul at dsc.ufcg.edu.br D: JIT support for ARM From djg at cray.com Mon Sep 17 12:31:57 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 17 Sep 2007 17:31:57 -0000 Subject: [llvm-commits] [llvm] r42035 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/srem.ll test/Transforms/InstCombine/urem.ll Message-ID: <200709171731.l8HHVvEp020169@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 17 12:31:57 2007 New Revision: 42035 URL: http://llvm.org/viewvc/llvm-project?rev=42035&view=rev Log: Instcombine x-((x/y)*y) into a remainder operator. Added: llvm/trunk/test/Transforms/InstCombine/srem.ll llvm/trunk/test/Transforms/InstCombine/urem.ll 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=42035&r1=42034&r2=42035&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Sep 17 12:31:57 2007 @@ -2257,6 +2257,17 @@ Constant *CP1 = Subtract(ConstantInt::get(I.getType(), 1), C2); return BinaryOperator::createMul(Op0, CP1); } + + // X - ((X / Y) * Y) --> X % Y + if (Op1I->getOpcode() == Instruction::Mul) + if (Instruction *I = dyn_cast(Op1I->getOperand(0))) + if (Op0 == I->getOperand(0) && + Op1I->getOperand(1) == I->getOperand(1)) { + if (I->getOpcode() == Instruction::SDiv) + return BinaryOperator::createSRem(Op0, Op1I->getOperand(1)); + if (I->getOpcode() == Instruction::UDiv) + return BinaryOperator::createURem(Op0, Op1I->getOperand(1)); + } } } @@ -2902,7 +2913,7 @@ /// getICmpValue - This is the complement of getICmpCode, which turns an /// opcode and two operands into either a constant true or false, or a brand -/// new /// ICmp instruction. The sign is passed in to determine which kind +/// new ICmp instruction. The sign is passed in to determine which kind /// of predicate to use in new icmp instructions. static Value *getICmpValue(bool sign, unsigned code, Value *LHS, Value *RHS) { switch (code) { Added: llvm/trunk/test/Transforms/InstCombine/srem.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/srem.ll?rev=42035&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/srem.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/srem.ll Mon Sep 17 12:31:57 2007 @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep srem + +define i64 @foo(i64 %x1, i64 %y2) { + %r = sdiv i64 %x1, %y2 + %r7 = mul i64 %r, %y2 + %r8 = sub i64 %x1, %r7 + ret i64 %r8 +} Added: llvm/trunk/test/Transforms/InstCombine/urem.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/urem.ll?rev=42035&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/urem.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/urem.ll Mon Sep 17 12:31:57 2007 @@ -0,0 +1,8 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep urem + +define i64 @rem_unsigned(i64 %x1, i64 %y2) { + %r = udiv i64 %x1, %y2 + %r7 = mul i64 %r, %y2 + %r8 = sub i64 %x1, %r7 + ret i64 %r8 +} From sabre at nondot.org Mon Sep 17 12:40:48 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 17 Sep 2007 17:40:48 -0000 Subject: [llvm-commits] [llvm] r42036 - in /llvm/trunk/utils/TableGen: FileLexer.cpp.cvs FileParser.cpp.cvs FileParser.h.cvs Message-ID: <200709171740.l8HHenXn021610@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 17 12:40:48 2007 New Revision: 42036 URL: http://llvm.org/viewvc/llvm-project?rev=42036&view=rev Log: regenerate Modified: llvm/trunk/utils/TableGen/FileLexer.cpp.cvs llvm/trunk/utils/TableGen/FileParser.cpp.cvs llvm/trunk/utils/TableGen/FileParser.h.cvs Modified: llvm/trunk/utils/TableGen/FileLexer.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FileLexer.cpp.cvs?rev=42036&r1=42035&r2=42036&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FileLexer.cpp.cvs (original) +++ llvm/trunk/utils/TableGen/FileLexer.cpp.cvs Mon Sep 17 12:40:48 2007 @@ -21,7 +21,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header$ + * $Header: /cvs/root/flex/flex/skel.c,v 1.2 2004/05/07 00:28:17 jkh Exp $ */ #define FLEX_SCANNER @@ -502,7 +502,7 @@ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 1 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" #define INITIAL 0 /*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===// // @@ -520,7 +520,7 @@ #define YY_NEVER_INTERACTIVE 1 #define comment 1 -#line 30 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 30 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" #include "llvm/Config/config.h" #include "llvm/Support/Streams.h" #include "Record.h" @@ -817,7 +817,7 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 185 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 185 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" #line 824 "Lexer.cpp" @@ -913,185 +913,185 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 187 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 187 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { /* Ignore comments */ } YY_BREAK case 2: YY_RULE_SETUP -#line 189 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { HandleInclude(yytext); } YY_BREAK case 3: YY_RULE_SETUP -#line 190 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 190 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2); return CODEFRAGMENT; } YY_BREAK case 4: YY_RULE_SETUP -#line 193 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 193 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return INT; } YY_BREAK case 5: YY_RULE_SETUP -#line 194 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 194 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return BIT; } YY_BREAK case 6: YY_RULE_SETUP -#line 195 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 195 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return BITS; } YY_BREAK case 7: YY_RULE_SETUP -#line 196 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 196 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return STRING; } YY_BREAK case 8: YY_RULE_SETUP -#line 197 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 197 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return LIST; } YY_BREAK case 9: YY_RULE_SETUP -#line 198 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 198 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return CODE; } YY_BREAK case 10: YY_RULE_SETUP -#line 199 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 199 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return DAG; } YY_BREAK case 11: YY_RULE_SETUP -#line 201 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 201 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return CLASS; } YY_BREAK case 12: YY_RULE_SETUP -#line 202 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 202 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return DEF; } YY_BREAK case 13: YY_RULE_SETUP -#line 203 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 203 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return DEFM; } YY_BREAK case 14: YY_RULE_SETUP -#line 204 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 204 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return MULTICLASS; } YY_BREAK case 15: YY_RULE_SETUP -#line 205 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 205 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return FIELD; } YY_BREAK case 16: YY_RULE_SETUP -#line 206 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 206 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return LET; } YY_BREAK case 17: YY_RULE_SETUP -#line 207 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 207 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return IN; } YY_BREAK case 18: YY_RULE_SETUP -#line 209 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 209 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return CONCATTOK; } YY_BREAK case 19: YY_RULE_SETUP -#line 210 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return SRATOK; } YY_BREAK case 20: YY_RULE_SETUP -#line 211 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 211 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return SRLTOK; } YY_BREAK case 21: YY_RULE_SETUP -#line 212 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 212 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return SHLTOK; } YY_BREAK case 22: YY_RULE_SETUP -#line 213 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 213 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return STRCONCATTOK; } YY_BREAK case 23: YY_RULE_SETUP -#line 216 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 216 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext, yytext+yyleng); return ID; } YY_BREAK case 24: YY_RULE_SETUP -#line 218 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 218 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng); return VARNAME; } YY_BREAK case 25: YY_RULE_SETUP -#line 221 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 221 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1); return STRVAL; } YY_BREAK case 26: YY_RULE_SETUP -#line 224 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 224 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.IntVal = ParseInt(Filetext); return INTVAL; } YY_BREAK case 27: YY_RULE_SETUP -#line 226 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 226 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { /* Ignore whitespace */ } YY_BREAK case 28: YY_RULE_SETUP -#line 229 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 229 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { BEGIN(comment); CommentDepth++; } YY_BREAK case 29: YY_RULE_SETUP -#line 230 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 230 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" {} /* eat anything that's not a '*' or '/' */ YY_BREAK case 30: YY_RULE_SETUP -#line 231 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 231 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" {} /* eat up '*'s not followed by '/'s */ YY_BREAK case 31: YY_RULE_SETUP -#line 232 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 232 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { ++CommentDepth; } YY_BREAK case 32: YY_RULE_SETUP -#line 233 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 233 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" {} /* eat up /'s not followed by *'s */ YY_BREAK case 33: YY_RULE_SETUP -#line 234 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { if (!--CommentDepth) { BEGIN(INITIAL); } } YY_BREAK case YY_STATE_EOF(comment): -#line 235 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 235 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { err() << "Unterminated comment!\n"; exit(1); } YY_BREAK case 34: YY_RULE_SETUP -#line 237 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 237 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return Filetext[0]; } YY_BREAK case 35: YY_RULE_SETUP -#line 239 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 1098 "Lexer.cpp" @@ -1978,6 +1978,6 @@ return 0; } #endif -#line 239 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" Modified: llvm/trunk/utils/TableGen/FileParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FileParser.cpp.cvs?rev=42036&r1=42035&r2=42036&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FileParser.cpp.cvs (original) +++ llvm/trunk/utils/TableGen/FileParser.cpp.cvs Mon Sep 17 12:40:48 2007 @@ -1,134 +1,42 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y + by GNU Bison version 1.28 */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. +#define YYBISON 1 /* Identify Bison output. */ - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.3" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - -/* Substitute the variable and function names. */ #define yyparse Fileparse -#define yylex Filelex +#define yylex Filelex #define yyerror Fileerror -#define yylval Filelval -#define yychar Filechar +#define yylval Filelval +#define yychar Filechar #define yydebug Filedebug #define yynerrs Filenerrs +#define INT 257 +#define BIT 258 +#define STRING 259 +#define BITS 260 +#define LIST 261 +#define CODE 262 +#define DAG 263 +#define CLASS 264 +#define DEF 265 +#define MULTICLASS 266 +#define DEFM 267 +#define FIELD 268 +#define LET 269 +#define IN 270 +#define CONCATTOK 271 +#define SHLTOK 272 +#define SRATOK 273 +#define SRLTOK 274 +#define STRCONCATTOK 275 +#define INTVAL 276 +#define ID 277 +#define VARNAME 278 +#define STRVAL 279 +#define CODEFRAGMENT 280 - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - INT = 258, - BIT = 259, - STRING = 260, - BITS = 261, - LIST = 262, - CODE = 263, - DAG = 264, - CLASS = 265, - DEF = 266, - MULTICLASS = 267, - DEFM = 268, - FIELD = 269, - LET = 270, - IN = 271, - SHLTOK = 272, - SRATOK = 273, - SRLTOK = 274, - STRCONCATTOK = 275, - INTVAL = 276, - ID = 277, - VARNAME = 278, - STRVAL = 279, - CODEFRAGMENT = 280 - }; -#endif -/* Tokens. */ -#define INT 258 -#define BIT 259 -#define STRING 260 -#define BITS 261 -#define LIST 262 -#define CODE 263 -#define DAG 264 -#define CLASS 265 -#define DEF 266 -#define MULTICLASS 267 -#define DEFM 268 -#define FIELD 269 -#define LET 270 -#define IN 271 -#define SHLTOK 272 -#define SRATOK 273 -#define SRLTOK 274 -#define STRCONCATTOK 275 -#define INTVAL 276 -#define ID 277 -#define VARNAME 278 -#define STRVAL 279 -#define CODEFRAGMENT 280 - - - - -/* Copy the first part of user declarations. */ -#line 14 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" +#line 14 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" #include "Record.h" #include "llvm/ADT/StringExtras.h" @@ -324,29 +232,8 @@ using namespace llvm; - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 210 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" -{ +#line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +typedef union { std::string* StrVal; int IntVal; llvm::RecTy* Ty; @@ -358,1195 +245,575 @@ SubClassRefTy* SubClassRef; std::vector* SubClassList; std::vector >* DagValueList; -} -/* Line 193 of yacc.c. */ -#line 364 "FileParser.tab.c" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif +} YYSTYPE; +#include +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif -/* Copy the second part of user declarations. */ +#define YYFINAL 194 +#define YYFLAG -32768 +#define YYNTBASE 42 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 280 ? yytranslate[x] : 91) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 36, + 37, 2, 2, 38, 40, 35, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 39, 41, 27, + 29, 28, 30, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 33, 2, 34, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 31, 2, 32, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 +}; -/* Line 216 of yacc.c. */ -#line 377 "FileParser.tab.c" +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 4, 6, 11, 13, 18, 20, 22, 24, + 25, 27, 28, 31, 33, 35, 37, 39, 41, 43, + 47, 52, 57, 61, 65, 70, 75, 82, 89, 96, + 103, 110, 111, 114, 117, 122, 123, 125, 127, 131, + 134, 138, 144, 149, 151, 152, 156, 157, 159, 161, + 165, 170, 173, 180, 181, 184, 186, 190, 192, 197, + 199, 203, 204, 207, 209, 213, 217, 218, 220, 222, + 223, 225, 227, 229, 230, 234, 235, 236, 243, 247, + 249, 251, 254, 256, 257, 258, 267, 268, 275, 277, + 279, 281, 283, 288, 290, 294, 295, 300, 305, 308, + 310, 313 +}; -#ifdef short -# undef short -#endif +static const short yyrhs[] = { 23, + 0, 5, 0, 4, 0, 6, 27, 22, 28, 0, + 3, 0, 7, 27, 43, 28, 0, 8, 0, 9, + 0, 42, 0, 0, 14, 0, 0, 29, 47, 0, + 23, 0, 46, 0, 22, 0, 25, 0, 26, 0, + 30, 0, 31, 54, 32, 0, 23, 27, 55, 28, + 0, 47, 31, 52, 32, 0, 33, 54, 34, 0, + 47, 35, 23, 0, 36, 46, 50, 37, 0, 47, + 33, 52, 34, 0, 17, 36, 47, 38, 47, 37, + 0, 18, 36, 47, 38, 47, 37, 0, 19, 36, + 47, 38, 47, 37, 0, 20, 36, 47, 38, 47, + 37, 0, 21, 36, 47, 38, 47, 37, 0, 0, + 39, 24, 0, 47, 48, 0, 49, 38, 47, 48, + 0, 0, 49, 0, 22, 0, 22, 40, 22, 0, + 22, 22, 0, 51, 38, 22, 0, 51, 38, 22, + 40, 22, 0, 51, 38, 22, 22, 0, 51, 0, + 0, 31, 52, 32, 0, 0, 55, 0, 47, 0, + 55, 38, 47, 0, 44, 43, 23, 45, 0, 56, + 41, 0, 15, 23, 53, 29, 47, 41, 0, 0, + 58, 57, 0, 41, 0, 31, 58, 32, 0, 42, + 0, 42, 27, 55, 28, 0, 60, 0, 61, 38, + 60, 0, 0, 39, 61, 0, 56, 0, 63, 38, + 56, 0, 27, 63, 28, 0, 0, 64, 0, 23, + 0, 0, 66, 0, 67, 0, 67, 0, 0, 62, + 71, 59, 0, 0, 0, 10, 68, 73, 65, 74, + 70, 0, 11, 69, 70, 0, 75, 0, 76, 0, + 77, 76, 0, 23, 0, 0, 0, 12, 78, 80, + 65, 81, 31, 77, 32, 0, 0, 13, 23, 83, + 39, 60, 41, 0, 72, 0, 75, 0, 79, 0, + 82, 0, 23, 53, 29, 47, 0, 85, 0, 86, + 38, 85, 0, 0, 15, 88, 86, 16, 0, 87, + 31, 89, 32, 0, 87, 84, 0, 84, 0, 89, + 84, 0, 89, 0 +}; -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 246, 268, 270, 272, 274, 276, 278, 280, 282, 286, + 286, 288, 288, 290, 313, 315, 317, 320, 323, 325, + 338, 366, 373, 376, 383, 386, 394, 396, 398, 400, + 402, 406, 409, 413, 418, 424, 427, 430, 433, 446, + 460, 462, 475, 491, 493, 493, 497, 499, 503, 506, + 510, 527, 529, 535, 535, 536, 536, 538, 540, 544, + 549, 554, 557, 561, 564, 569, 570, 570, 572, 572, + 574, 581, 599, 624, 638, 643, 645, 647, 651, 661, + 675, 678, 682, 693, 695, 697, 702, 702, 776, 776, + 777, 777, 779, 784, 784, 787, 787, 790, 793, 797, + 797, 799 +}; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} +static const char * const yytname[] = { "$","error","$undefined.","INT","BIT", +"STRING","BITS","LIST","CODE","DAG","CLASS","DEF","MULTICLASS","DEFM","FIELD", +"LET","IN","CONCATTOK","SHLTOK","SRATOK","SRLTOK","STRCONCATTOK","INTVAL","ID", +"VARNAME","STRVAL","CODEFRAGMENT","'<'","'>'","'='","'?'","'{'","'}'","'['", +"']'","'.'","'('","')'","','","':'","'-'","';'","ClassID","Type","OptPrefix", +"OptValue","IDValue","Value","OptVarName","DagArgListNE","DagArgList","RBitList", +"BitList","OptBitList","ValueList","ValueListNE","Declaration","BodyItem","BodyList", +"Body","SubClassRef","ClassListNE","ClassList","DeclListNE","TemplateArgList", +"OptTemplateArgList","OptID","ObjectName","ClassName","DefName","ObjectBody", +"@1","ClassInst","@2","@3","DefInst","MultiClassDef","MultiClassBody","MultiClassName", +"MultiClassInst","@4","@5","DefMInst","@6","Object","LETItem","LETList","LETCommand", +"@7","ObjectList","File", NULL +}; #endif -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss; - YYSTYPE yyvs; - }; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 27 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 204 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 41 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 50 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 102 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 188 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 280 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 35, 36, 2, 2, 37, 39, 34, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 38, 40, - 26, 28, 27, 29, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 32, 2, 33, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 30, 2, 31, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25 +static const short yyr1[] = { 0, + 42, 43, 43, 43, 43, 43, 43, 43, 43, 44, + 44, 45, 45, 46, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 48, 48, 49, 49, 50, 50, 51, 51, 51, + 51, 51, 51, 52, 53, 53, 54, 54, 55, 55, + 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, + 61, 62, 62, 63, 63, 64, 65, 65, 66, 66, + 67, 68, 69, 71, 70, 73, 74, 72, 75, 76, + 77, 77, 78, 80, 81, 79, 83, 82, 84, 84, + 84, 84, 85, 86, 86, 88, 87, 84, 84, 89, + 89, 90 }; -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 5, 7, 9, 14, 16, 21, 23, - 25, 27, 28, 30, 31, 34, 36, 38, 40, 42, - 44, 46, 50, 55, 60, 64, 68, 73, 78, 85, - 92, 99, 106, 107, 110, 113, 118, 119, 121, 123, - 127, 130, 134, 140, 145, 147, 148, 152, 153, 155, - 157, 161, 166, 169, 176, 177, 180, 182, 186, 188, - 193, 195, 199, 200, 203, 205, 209, 213, 214, 216, - 218, 219, 221, 223, 225, 226, 230, 231, 232, 239, - 243, 245, 247, 250, 252, 253, 254, 263, 264, 271, - 273, 275, 277, 279, 284, 286, 290, 291, 296, 301, - 304, 306, 309 +static const short yyr2[] = { 0, + 1, 1, 1, 4, 1, 4, 1, 1, 1, 0, + 1, 0, 2, 1, 1, 1, 1, 1, 1, 3, + 4, 4, 3, 3, 4, 4, 6, 6, 6, 6, + 6, 0, 2, 2, 4, 0, 1, 1, 3, 2, + 3, 5, 4, 1, 0, 3, 0, 1, 1, 3, + 4, 2, 6, 0, 2, 1, 3, 1, 4, 1, + 3, 0, 2, 1, 3, 3, 0, 1, 1, 0, + 1, 1, 1, 0, 3, 0, 0, 6, 3, 1, + 1, 2, 1, 0, 0, 8, 0, 6, 1, 1, + 1, 1, 4, 1, 3, 0, 4, 4, 2, 1, + 2, 1 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 90, 0, -1, 22, -1, 5, -1, 4, -1, 6, - 26, 21, 27, -1, 3, -1, 7, 26, 43, 27, - -1, 8, -1, 9, -1, 42, -1, -1, 14, -1, - -1, 28, 47, -1, 22, -1, 46, -1, 21, -1, - 24, -1, 25, -1, 29, -1, 30, 54, 31, -1, - 22, 26, 55, 27, -1, 47, 30, 52, 31, -1, - 32, 54, 33, -1, 47, 34, 22, -1, 35, 46, - 50, 36, -1, 47, 32, 52, 33, -1, 17, 35, - 47, 37, 47, 36, -1, 18, 35, 47, 37, 47, - 36, -1, 19, 35, 47, 37, 47, 36, -1, 20, - 35, 47, 37, 47, 36, -1, -1, 38, 23, -1, - 47, 48, -1, 49, 37, 47, 48, -1, -1, 49, - -1, 21, -1, 21, 39, 21, -1, 21, 21, -1, - 51, 37, 21, -1, 51, 37, 21, 39, 21, -1, - 51, 37, 21, 21, -1, 51, -1, -1, 30, 52, - 31, -1, -1, 55, -1, 47, -1, 55, 37, 47, - -1, 44, 43, 22, 45, -1, 56, 40, -1, 15, - 22, 53, 28, 47, 40, -1, -1, 58, 57, -1, - 40, -1, 30, 58, 31, -1, 42, -1, 42, 26, - 55, 27, -1, 60, -1, 61, 37, 60, -1, -1, - 38, 61, -1, 56, -1, 63, 37, 56, -1, 26, - 63, 27, -1, -1, 64, -1, 22, -1, -1, 66, - -1, 67, -1, 67, -1, -1, 62, 71, 59, -1, - -1, -1, 10, 68, 73, 65, 74, 70, -1, 11, - 69, 70, -1, 75, -1, 76, -1, 77, 76, -1, - 22, -1, -1, -1, 12, 78, 80, 65, 81, 30, - 77, 31, -1, -1, 13, 22, 83, 38, 60, 40, - -1, 72, -1, 75, -1, 79, -1, 82, -1, 22, - 53, 28, 47, -1, 85, -1, 86, 37, 85, -1, - -1, 15, 88, 86, 16, -1, 87, 30, 89, 31, - -1, 87, 84, -1, 84, -1, 89, 84, -1, 89, - -1 +static const short yydefact[] = { 0, + 70, 70, 0, 0, 96, 89, 90, 91, 92, 100, + 0, 102, 69, 71, 72, 76, 73, 62, 83, 84, + 87, 0, 0, 99, 101, 67, 0, 74, 79, 67, + 0, 45, 94, 0, 0, 10, 68, 77, 1, 58, + 60, 63, 0, 85, 0, 0, 0, 97, 0, 98, + 11, 0, 64, 0, 62, 0, 0, 54, 56, 75, + 0, 0, 38, 44, 0, 0, 95, 5, 3, 2, + 0, 0, 7, 8, 9, 0, 66, 10, 78, 0, + 0, 0, 0, 0, 16, 14, 17, 18, 19, 47, + 47, 0, 15, 49, 0, 61, 10, 0, 88, 40, + 0, 0, 46, 93, 0, 0, 12, 65, 0, 0, + 0, 0, 0, 0, 0, 48, 0, 14, 36, 0, + 0, 0, 59, 0, 0, 57, 0, 55, 80, 81, + 0, 39, 41, 0, 0, 0, 51, 0, 0, 0, + 0, 0, 0, 20, 23, 32, 37, 0, 0, 0, + 24, 50, 45, 52, 86, 82, 43, 0, 4, 6, + 13, 0, 0, 0, 0, 0, 21, 0, 34, 0, + 25, 22, 26, 0, 42, 0, 0, 0, 0, 0, + 33, 32, 0, 27, 28, 29, 30, 31, 35, 0, + 53, 0, 0, 0 }; -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 246, 246, 268, 270, 272, 274, 276, 278, 280, - 282, 286, 286, 288, 288, 290, 313, 315, 317, 320, - 323, 325, 338, 366, 373, 376, 383, 386, 394, 396, - 398, 400, 404, 407, 411, 416, 422, 425, 428, 431, - 444, 458, 460, 473, 489, 491, 491, 495, 497, 501, - 504, 508, 525, 527, 533, 533, 534, 534, 536, 538, - 542, 547, 552, 555, 559, 562, 567, 568, 568, 570, - 570, 572, 579, 597, 622, 622, 641, 643, 641, 649, - 659, 673, 676, 680, 691, 693, 691, 700, 700, 774, - 774, 775, 775, 777, 782, 782, 785, 785, 788, 791, - 795, 795, 797 +static const short yydefgoto[] = { 40, + 76, 52, 137, 93, 94, 169, 147, 148, 64, 65, + 47, 115, 116, 53, 128, 97, 60, 41, 42, 28, + 54, 37, 38, 14, 15, 16, 18, 29, 43, 6, + 26, 55, 7, 130, 131, 20, 8, 30, 61, 9, + 31, 10, 33, 34, 11, 22, 12, 192 }; -#endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "INT", "BIT", "STRING", "BITS", "LIST", - "CODE", "DAG", "CLASS", "DEF", "MULTICLASS", "DEFM", "FIELD", "LET", - "IN", "SHLTOK", "SRATOK", "SRLTOK", "STRCONCATTOK", "INTVAL", "ID", - "VARNAME", "STRVAL", "CODEFRAGMENT", "'<'", "'>'", "'='", "'?'", "'{'", - "'}'", "'['", "']'", "'.'", "'('", "')'", "','", "':'", "'-'", "';'", - "$accept", "ClassID", "Type", "OptPrefix", "OptValue", "IDValue", - "Value", "OptVarName", "DagArgListNE", "DagArgList", "RBitList", - "BitList", "OptBitList", "ValueList", "ValueListNE", "Declaration", - "BodyItem", "BodyList", "Body", "SubClassRef", "ClassListNE", - "ClassList", "DeclListNE", "TemplateArgList", "OptTemplateArgList", - "OptID", "ObjectName", "ClassName", "DefName", "ObjectBody", "@1", - "ClassInst", "@2", "@3", "DefInst", "MultiClassDef", "MultiClassBody", - "MultiClassName", "MultiClassInst", "@4", "@5", "DefMInst", "@6", - "Object", "LETItem", "LETList", "LETCommand", "@7", "ObjectList", "File", 0 +static const short yypact[] = { 147, + -17, -17, 8, 12,-32768,-32768,-32768,-32768,-32768,-32768, + 3, 147,-32768,-32768,-32768,-32768,-32768, -13,-32768,-32768, +-32768, 17, 147,-32768,-32768, 21, 58,-32768,-32768, 21, + 45, 55,-32768, -5, -3, 77,-32768,-32768,-32768, 68, +-32768, 64, -4,-32768, 58, 84, 81,-32768, 17,-32768, +-32768, 16,-32768, 13, -13, 43, 58,-32768,-32768,-32768, + 88, 74, 10, 83, 93, 43,-32768,-32768,-32768,-32768, + 100, 104,-32768,-32768,-32768, 110,-32768, 77,-32768, 117, + 125, 127, 128, 129,-32768, 139,-32768,-32768,-32768, 43, + 43, 132,-32768, 59, 14,-32768, 40, 156,-32768,-32768, + 146, 148,-32768, 59, 149, 16, 140,-32768, 43, 43, + 43, 43, 43, 43, 141, 134, 142,-32768, 43, 84, + 84, 151,-32768, 43, 152,-32768, 136,-32768,-32768,-32768, + 6,-32768, 35, 150, 153, 43,-32768, 70, 76, 85, + 91, 97, 39,-32768,-32768, 54, 144, 143, 154, 145, +-32768, 59, 55,-32768,-32768,-32768,-32768, 161,-32768,-32768, + 59, 43, 43, 43, 43, 43,-32768, 160,-32768, 43, +-32768,-32768,-32768, 158,-32768, 103, 106, 111, 114, 119, +-32768, 54, 43,-32768,-32768,-32768,-32768,-32768,-32768, 47, +-32768, 185, 188,-32768 }; -#endif -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 60, 62, 61, 63, - 123, 125, 91, 93, 46, 40, 41, 44, 58, 45, - 59 +static const short yypgoto[] = { -50, + 86,-32768,-32768, 98, -66, 7,-32768,-32768,-32768, -8, + 38, 102, -55, -48,-32768,-32768,-32768, 26,-32768,-32768, +-32768,-32768, 164,-32768, 193,-32768,-32768, 155,-32768,-32768, +-32768,-32768, -95, 65,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, -7, 157,-32768,-32768,-32768, 174,-32768 }; -# endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 41, 42, 43, 43, 43, 43, 43, 43, 43, - 43, 44, 44, 45, 45, 46, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, - 51, 51, 51, 51, 52, 53, 53, 54, 54, 55, - 55, 56, 57, 57, 58, 58, 59, 59, 60, 60, - 61, 61, 62, 62, 63, 63, 64, 65, 65, 66, - 66, 67, 68, 69, 71, 70, 73, 74, 72, 75, - 76, 77, 77, 78, 80, 81, 79, 83, 82, 84, - 84, 84, 84, 85, 86, 86, 88, 87, 84, 84, - 89, 89, 90 -}; -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 1, 4, 1, 4, 1, 1, - 1, 0, 1, 0, 2, 1, 1, 1, 1, 1, - 1, 3, 4, 4, 3, 3, 4, 4, 6, 6, - 6, 6, 0, 2, 2, 4, 0, 1, 1, 3, - 2, 3, 5, 4, 1, 0, 3, 0, 1, 1, - 3, 4, 2, 6, 0, 2, 1, 3, 1, 4, - 1, 3, 0, 2, 1, 3, 3, 0, 1, 1, - 0, 1, 1, 1, 0, 3, 0, 0, 6, 3, - 1, 1, 2, 1, 0, 0, 8, 0, 6, 1, - 1, 1, 1, 4, 1, 3, 0, 4, 4, 2, - 1, 2, 1 -}; +#define YYLAST 210 -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 70, 70, 0, 0, 96, 89, 90, 91, 92, - 100, 0, 102, 0, 69, 71, 72, 76, 73, 62, - 83, 84, 87, 0, 0, 99, 101, 1, 67, 0, - 74, 79, 67, 0, 45, 94, 0, 0, 11, 68, - 77, 2, 58, 60, 63, 0, 85, 0, 0, 0, - 97, 0, 98, 12, 0, 64, 0, 62, 0, 0, - 54, 56, 75, 0, 0, 38, 44, 0, 0, 95, - 6, 4, 3, 0, 0, 8, 9, 10, 0, 66, - 11, 78, 0, 0, 0, 0, 17, 15, 18, 19, - 20, 47, 47, 0, 16, 49, 0, 61, 11, 0, - 88, 40, 0, 0, 46, 93, 0, 0, 13, 65, - 0, 0, 0, 0, 0, 0, 48, 0, 15, 36, - 0, 0, 0, 59, 0, 0, 57, 0, 55, 80, - 81, 0, 39, 41, 0, 0, 0, 51, 0, 0, - 0, 0, 0, 21, 24, 32, 37, 0, 0, 0, - 25, 50, 45, 52, 86, 82, 43, 0, 5, 7, - 14, 0, 0, 0, 0, 22, 0, 34, 0, 26, - 23, 27, 0, 42, 0, 0, 0, 0, 33, 32, - 0, 28, 29, 30, 31, 35, 0, 53 -}; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 42, 78, 54, 137, 94, 95, 167, 146, 147, - 66, 67, 49, 115, 116, 55, 128, 98, 62, 43, - 44, 30, 56, 39, 40, 15, 16, 17, 19, 31, - 45, 6, 28, 57, 7, 130, 131, 21, 8, 32, - 63, 9, 33, 10, 35, 36, 11, 23, 12, 13 +static const short yytable[] = { 104, + 95, 75, 129, 24, 25, 13, 1, 2, 3, 4, + 48, 5, 1, 2, 3, 4, 2, 5, 68, 69, + 70, 71, 72, 73, 74, 27, 58, 25, 50, 108, + 19, 100, 49, 23, 21, 129, 59, 155, 39, 32, + 77, 123, 138, 139, 140, 141, 142, 36, 127, 101, + 78, 124, 146, 51, 125, 75, 157, 152, 143, 80, + 81, 82, 83, 84, 85, 86, 167, 87, 88, 161, + 62, 126, 89, 90, 158, 91, 124, 120, 92, 121, + 39, 122, 96, 45, 120, 46, 121, 191, 122, 120, + 51, 121, 168, 122, 56, 176, 177, 178, 179, 180, + 120, 57, 121, 182, 122, 63, 120, 162, 121, 66, + 122, 149, 150, 163, 99, 120, 190, 121, 98, 122, + 102, 120, 164, 121, 103, 122, 105, 120, 165, 121, + 106, 122, 107, 120, 166, 121, 120, 122, 121, 184, + 122, 120, 185, 121, 120, 122, 121, 186, 122, 120, + 187, 121, 109, 122, 118, 188, 1, 2, 3, 4, + 110, 5, 111, 112, 113, 114, 2, 132, 136, 133, + 134, 124, 144, 151, 153, 145, 154, 159, 173, 171, + 160, 170, 175, 181, 193, 172, 183, 194, 189, 119, + 174, 135, 117, 44, 17, 156, 35, 0, 0, 0, + 0, 0, 0, 0, 0, 67, 0, 0, 0, 79 }; -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -97 -static const yytype_int16 yypact[] = -{ - 129, 3, 3, 11, 19, -97, -97, -97, -97, -97, - -97, 2, 129, 48, -97, -97, -97, -97, -97, 29, - -97, -97, -97, 31, 129, -97, -97, -97, 43, 56, - -97, -97, 43, 42, 53, -97, -6, -4, 71, -97, - -97, -97, 72, -97, 65, 9, -97, 56, 87, 78, - -97, 31, -97, -97, 15, -97, 13, 29, 41, 56, - -97, -97, -97, 84, 80, 7, 81, 106, 41, -97, - -97, -97, -97, 120, 122, -97, -97, -97, 127, -97, - 71, -97, 115, 116, 117, 118, -97, 128, -97, -97, - -97, 41, 41, 133, -97, 113, 27, -97, 60, 145, - -97, -97, 136, 137, -97, 113, 138, 15, 132, -97, - 41, 41, 41, 41, 41, 130, 125, 131, -97, 41, - 87, 87, 141, -97, 41, 143, -97, 126, -97, -97, - -97, 5, -97, 8, 140, 142, 41, -97, 67, 73, - 79, 85, 45, -97, -97, 54, 134, 139, 146, 135, - -97, 113, 53, -97, -97, -97, -97, 149, -97, -97, - 113, 41, 41, 41, 41, -97, 150, -97, 41, -97, - -97, -97, 144, -97, 91, 94, 99, 102, -97, 54, - 41, -97, -97, -97, -97, -97, 47, -97 +static const short yycheck[] = { 66, + 56, 52, 98, 11, 12, 23, 10, 11, 12, 13, + 16, 15, 10, 11, 12, 13, 11, 15, 3, 4, + 5, 6, 7, 8, 9, 39, 31, 35, 32, 78, + 23, 22, 38, 31, 23, 131, 41, 32, 23, 23, + 28, 28, 109, 110, 111, 112, 113, 27, 97, 40, + 38, 38, 119, 14, 15, 106, 22, 124, 114, 17, + 18, 19, 20, 21, 22, 23, 28, 25, 26, 136, + 45, 32, 30, 31, 40, 33, 38, 31, 36, 33, + 23, 35, 57, 39, 31, 31, 33, 41, 35, 31, + 14, 33, 39, 35, 27, 162, 163, 164, 165, 166, + 31, 38, 33, 170, 35, 22, 31, 38, 33, 29, + 35, 120, 121, 38, 41, 31, 183, 33, 31, 35, + 38, 31, 38, 33, 32, 35, 27, 31, 38, 33, + 27, 35, 23, 31, 38, 33, 31, 35, 33, 37, + 35, 31, 37, 33, 31, 35, 33, 37, 35, 31, + 37, 33, 36, 35, 23, 37, 10, 11, 12, 13, + 36, 15, 36, 36, 36, 27, 11, 22, 29, 22, + 22, 38, 32, 23, 23, 34, 41, 28, 34, 37, + 28, 38, 22, 24, 0, 32, 29, 0, 182, 92, + 153, 106, 91, 30, 2, 131, 23, -1, -1, -1, + -1, -1, -1, -1, -1, 49, -1, -1, -1, 55 }; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/share/bison.simple" +/* This file comes from bison-1.28. */ -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -97, -52, 69, -97, -97, 86, -68, -5, -97, -97, - -97, -31, 26, 88, -57, -46, -97, -97, -97, -21, - -97, -97, -97, -97, 151, -97, 179, -97, -97, 147, - -97, -97, -97, -97, -96, 51, -97, -97, -97, -97, - -97, -97, -97, -7, 148, -97, -97, -97, 160, -97 -}; +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const yytype_uint8 yytable[] = -{ - 105, 96, 77, 129, 25, 26, 1, 2, 3, 4, - 50, 5, 1, 2, 3, 4, 2, 5, 70, 71, - 72, 73, 74, 75, 76, 14, 64, 52, 101, 156, - 26, 51, 24, 20, 109, 129, 154, 41, 97, 60, - 79, 22, 138, 139, 140, 141, 102, 157, 27, 61, - 80, 145, 127, 34, 123, 77, 151, 142, 82, 83, - 84, 85, 86, 87, 124, 88, 89, 29, 160, 38, - 90, 91, 165, 92, 53, 125, 93, 120, 41, 121, - 47, 122, 124, 48, 120, 53, 121, 187, 122, 148, - 149, 126, 166, 174, 175, 176, 177, 120, 58, 121, - 179, 122, 59, 120, 161, 121, 68, 122, 65, 120, - 162, 121, 186, 122, 99, 120, 163, 121, 103, 122, - 100, 120, 164, 121, 120, 122, 121, 181, 122, 120, - 182, 121, 120, 122, 121, 183, 122, 104, 184, 1, - 2, 3, 4, 120, 5, 121, 106, 122, 107, 108, - 110, 111, 112, 113, 114, 118, 2, 132, 133, 134, - 136, 143, 124, 150, 144, 152, 153, 158, 171, 159, - 173, 168, 180, 178, 185, 169, 135, 170, 172, 119, - 117, 18, 155, 46, 37, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, - 0, 0, 0, 0, 81 -}; + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. -static const yytype_int16 yycheck[] = -{ - 68, 58, 54, 99, 11, 12, 10, 11, 12, 13, - 16, 15, 10, 11, 12, 13, 11, 15, 3, 4, - 5, 6, 7, 8, 9, 22, 47, 31, 21, 21, - 37, 37, 30, 22, 80, 131, 31, 22, 59, 30, - 27, 22, 110, 111, 112, 113, 39, 39, 0, 40, - 37, 119, 98, 22, 27, 107, 124, 114, 17, 18, - 19, 20, 21, 22, 37, 24, 25, 38, 136, 26, - 29, 30, 27, 32, 14, 15, 35, 30, 22, 32, - 38, 34, 37, 30, 30, 14, 32, 40, 34, 120, - 121, 31, 38, 161, 162, 163, 164, 30, 26, 32, - 168, 34, 37, 30, 37, 32, 28, 34, 21, 30, - 37, 32, 180, 34, 30, 30, 37, 32, 37, 34, - 40, 30, 37, 32, 30, 34, 32, 36, 34, 30, - 36, 32, 30, 34, 32, 36, 34, 31, 36, 10, - 11, 12, 13, 30, 15, 32, 26, 34, 26, 22, - 35, 35, 35, 35, 26, 22, 11, 21, 21, 21, - 28, 31, 37, 22, 33, 22, 40, 27, 33, 27, - 21, 37, 28, 23, 179, 36, 107, 31, 152, 93, - 92, 2, 131, 32, 24, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, - -1, -1, -1, -1, 57 -}; + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 10, 11, 12, 13, 15, 72, 75, 79, 82, - 84, 87, 89, 90, 22, 66, 67, 68, 67, 69, - 22, 78, 22, 88, 30, 84, 84, 0, 73, 38, - 62, 70, 80, 83, 22, 85, 86, 89, 26, 64, - 65, 22, 42, 60, 61, 71, 65, 38, 30, 53, - 16, 37, 31, 14, 44, 56, 63, 74, 26, 37, - 30, 40, 59, 81, 60, 21, 51, 52, 28, 85, - 3, 4, 5, 6, 7, 8, 9, 42, 43, 27, - 37, 70, 17, 18, 19, 20, 21, 22, 24, 25, - 29, 30, 32, 35, 46, 47, 55, 60, 58, 30, - 40, 21, 39, 37, 31, 47, 26, 26, 22, 56, - 35, 35, 35, 35, 26, 54, 55, 54, 22, 46, - 30, 32, 34, 27, 37, 15, 31, 56, 57, 75, - 76, 77, 21, 21, 21, 43, 28, 45, 47, 47, - 47, 47, 55, 31, 33, 47, 49, 50, 52, 52, - 22, 47, 22, 40, 31, 76, 21, 39, 27, 27, - 47, 37, 37, 37, 37, 27, 38, 48, 37, 36, - 31, 33, 53, 21, 47, 47, 47, 47, 23, 47, - 28, 36, 36, 36, 36, 48, 47, 40 -}; + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA +#include +#else /* not sparc */ +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ +#include +#endif +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include */ + #pragma alloca +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible at ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#endif /* __hpux */ +#endif +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc +#endif + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) +#define YYEMPTY -2 #define YYEOF 0 - #define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ - #define YYFAIL goto yyerrlab - #define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ +#define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ goto yybackup; \ } \ else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) #define YYTERROR 1 #define YYERRCODE 256 - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +#ifndef YYPURE +#define YYLEX yylex() #endif - -/* YYLEX -- calling `yylex' with the right arguments. */ - +#ifdef YYPURE +#ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else -# define YYLEX yylex () +#define YYLEX yylex(&yylval, &yylloc) #endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) #else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; +#define YYLEX yylex(&yylval) #endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; +#endif /* not YYLSP_NEEDED */ #endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ +/* If nonreentrant, generate the variables here */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) -#else -static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); - YYFPRINTF (stderr, "\n"); -} +#ifndef YYPURE -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ #endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); - } -} -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ +/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -/* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -# define YYINITDEPTH 200 +#define YYINITDEPTH 200 #endif -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif #ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 +#define YYMAXDEPTH 10000 #endif - +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + unsigned int count; +{ + register char *f = from; + register char *t = to; + register int i = count; - return yyd - 1; + while (i-- > 0) + *t++ = *f++; } -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif +#else /* __cplusplus */ -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, unsigned int count) { - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; + register char *t = to; + register char *f = from; + register int i = count; - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } + while (i-- > 0) + *t++ = *f++; } -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; #endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} +#endif +#line 217 "/usr/share/bison.simple" -/* Prevent warnings from -Wmissing-prototypes. */ +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ #ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); #else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus int yyparse (void); -#else -int yyparse (); #endif -#endif /* ! YYPARSE_PARAM */ - - - -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; +#endif -/* Number of syntax errors so far. */ -int yynerrs; +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ -/*----------. -| yyparse. | -`----------*/ +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; +#define YYPOPSTACK (yyvsp--, yyssp--) #endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; #endif #endif -{ - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + int yylen; - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - YYDPRINTF ((stderr, "Starting parse\n")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif yystate = 0; yyerrstatus = 0; @@ -1558,665 +825,676 @@ so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; + yyssp = yyss - 1; yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: - yysetstate: - *yyssp = yystate; + *++yyssp = yystate; - if (yyss + yystacksize - 1 <= yyssp) + if (yyssp >= yyss + yystacksize - 1) { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + int size = yyssp - yyss + 1; #ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif #else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) + if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif #endif /* no yyoverflow */ - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif - if (yyss + yystacksize - 1 <= yyssp) + if (yyssp >= yyss + yystacksize - 1) YYABORT; } - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif goto yybackup; + yybackup: -/*-----------. -| yybackup. | -`-----------*/ -yybackup: +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + /* First try to decide what to do without reference to lookahead token. */ - /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yyn == YYFLAG) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif yychar = YYLEX; } - if (yychar <= YYEOF) + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif } else { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif } - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; + yyn = yytable[yyn]; - if (yyn <= 0) + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) + if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } + else if (yyn == 0) + goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; + /* Shift the lookahead token. */ - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif - /* Discard the shifted token unless it is eof. */ + /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; - yystate = yyn; *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif - goto yynewstate; + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + yystate = yyn; + goto yynewstate; -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ +/* Do the default action for the current state. */ yydefault: + yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; - goto yyreduce; - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ +/* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: - /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. +#if YYDEBUG != 0 + if (yydebug) + { + int i; - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: -#line 246 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + + switch (yyn) { + +case 1: +#line 246 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ if (CurDefmPrefix) { // If CurDefmPrefix is set, we're parsing a defm, which means that this is // actually the name of a multiclass. - MultiClass *MC = MultiClasses[*(yyvsp[(1) - (1)].StrVal)]; + MultiClass *MC = MultiClasses[*yyvsp[0].StrVal]; if (MC == 0) { - err() << "Couldn't find class '" << *(yyvsp[(1) - (1)].StrVal) << "'!\n"; + err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n"; exit(1); } - (yyval.Rec) = &MC->Rec; + yyval.Rec = &MC->Rec; } else { - (yyval.Rec) = Records.getClass(*(yyvsp[(1) - (1)].StrVal)); + yyval.Rec = Records.getClass(*yyvsp[0].StrVal); } - if ((yyval.Rec) == 0) { - err() << "Couldn't find class '" << *(yyvsp[(1) - (1)].StrVal) << "'!\n"; + if (yyval.Rec == 0) { + err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n"; exit(1); } - delete (yyvsp[(1) - (1)].StrVal); - ;} - break; - - case 3: -#line 268 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // string type - (yyval.Ty) = new StringRecTy(); - ;} - break; - - case 4: -#line 270 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // bit type - (yyval.Ty) = new BitRecTy(); - ;} - break; - - case 5: -#line 272 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // bits type - (yyval.Ty) = new BitsRecTy((yyvsp[(3) - (4)].IntVal)); - ;} - break; - - case 6: -#line 274 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // int type - (yyval.Ty) = new IntRecTy(); - ;} - break; - - case 7: -#line 276 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // list type - (yyval.Ty) = new ListRecTy((yyvsp[(3) - (4)].Ty)); - ;} - break; - - case 8: -#line 278 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // code type - (yyval.Ty) = new CodeRecTy(); - ;} - break; - - case 9: -#line 280 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // dag type - (yyval.Ty) = new DagRecTy(); - ;} - break; - - case 10: -#line 282 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // Record Type - (yyval.Ty) = new RecordRecTy((yyvsp[(1) - (1)].Rec)); - ;} - break; - - case 11: -#line 286 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.IntVal) = 0; ;} - break; - - case 12: -#line 286 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.IntVal) = 1; ;} - break; - - case 13: -#line 288 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.Initializer) = 0; ;} - break; - - case 14: -#line 288 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.Initializer) = (yyvsp[(2) - (2)].Initializer); ;} - break; - - case 15: -#line 290 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - if (const RecordVal *RV = (CurRec ? CurRec->getValue(*(yyvsp[(1) - (1)].StrVal)) : 0)) { - (yyval.Initializer) = new VarInit(*(yyvsp[(1) - (1)].StrVal), RV->getType()); - } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*(yyvsp[(1) - (1)].StrVal))) { - const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*(yyvsp[(1) - (1)].StrVal)); + delete yyvsp[0].StrVal; + ; + break;} +case 2: +#line 268 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // string type + yyval.Ty = new StringRecTy(); + ; + break;} +case 3: +#line 270 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // bit type + yyval.Ty = new BitRecTy(); + ; + break;} +case 4: +#line 272 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // bits type + yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal); + ; + break;} +case 5: +#line 274 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // int type + yyval.Ty = new IntRecTy(); + ; + break;} +case 6: +#line 276 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // list type + yyval.Ty = new ListRecTy(yyvsp[-1].Ty); + ; + break;} +case 7: +#line 278 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // code type + yyval.Ty = new CodeRecTy(); + ; + break;} +case 8: +#line 280 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // dag type + yyval.Ty = new DagRecTy(); + ; + break;} +case 9: +#line 282 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // Record Type + yyval.Ty = new RecordRecTy(yyvsp[0].Rec); + ; + break;} +case 10: +#line 286 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.IntVal = 0; ; + break;} +case 11: +#line 286 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.IntVal = 1; ; + break;} +case 12: +#line 288 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.Initializer = 0; ; + break;} +case 13: +#line 288 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.Initializer = yyvsp[0].Initializer; ; + break;} +case 14: +#line 290 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) { + yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType()); + } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*yyvsp[0].StrVal)) { + const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*yyvsp[0].StrVal); assert(RV && "Template arg doesn't exist??"); - (yyval.Initializer) = new VarInit(CurRec->getName()+":"+*(yyvsp[(1) - (1)].StrVal), RV->getType()); + yyval.Initializer = new VarInit(CurRec->getName()+":"+*yyvsp[0].StrVal, RV->getType()); } else if (CurMultiClass && - CurMultiClass->Rec.isTemplateArg(CurMultiClass->Rec.getName()+"::"+*(yyvsp[(1) - (1)].StrVal))) { - std::string Name = CurMultiClass->Rec.getName()+"::"+*(yyvsp[(1) - (1)].StrVal); + CurMultiClass->Rec.isTemplateArg(CurMultiClass->Rec.getName()+"::"+*yyvsp[0].StrVal)) { + std::string Name = CurMultiClass->Rec.getName()+"::"+*yyvsp[0].StrVal; const RecordVal *RV = CurMultiClass->Rec.getValue(Name); assert(RV && "Template arg doesn't exist??"); - (yyval.Initializer) = new VarInit(Name, RV->getType()); - } else if (Record *D = Records.getDef(*(yyvsp[(1) - (1)].StrVal))) { - (yyval.Initializer) = new DefInit(D); + yyval.Initializer = new VarInit(Name, RV->getType()); + } else if (Record *D = Records.getDef(*yyvsp[0].StrVal)) { + yyval.Initializer = new DefInit(D); } else { - err() << "Variable not defined: '" << *(yyvsp[(1) - (1)].StrVal) << "'!\n"; + err() << "Variable not defined: '" << *yyvsp[0].StrVal << "'!\n"; exit(1); } - delete (yyvsp[(1) - (1)].StrVal); -;} - break; - - case 16: -#line 313 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (yyvsp[(1) - (1)].Initializer); - ;} - break; - - case 17: -#line 315 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new IntInit((yyvsp[(1) - (1)].IntVal)); - ;} - break; - - case 18: -#line 317 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new StringInit(*(yyvsp[(1) - (1)].StrVal)); - delete (yyvsp[(1) - (1)].StrVal); - ;} - break; - - case 19: -#line 320 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new CodeInit(*(yyvsp[(1) - (1)].StrVal)); - delete (yyvsp[(1) - (1)].StrVal); - ;} - break; - - case 20: -#line 323 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new UnsetInit(); - ;} - break; - - case 21: -#line 325 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - BitsInit *Init = new BitsInit((yyvsp[(2) - (3)].FieldList)->size()); - for (unsigned i = 0, e = (yyvsp[(2) - (3)].FieldList)->size(); i != e; ++i) { - struct Init *Bit = (*(yyvsp[(2) - (3)].FieldList))[i]->convertInitializerTo(new BitRecTy()); + delete yyvsp[0].StrVal; +; + break;} +case 15: +#line 313 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = yyvsp[0].Initializer; + ; + break;} +case 16: +#line 315 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new IntInit(yyvsp[0].IntVal); + ; + break;} +case 17: +#line 317 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new StringInit(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + ; + break;} +case 18: +#line 320 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new CodeInit(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + ; + break;} +case 19: +#line 323 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new UnsetInit(); + ; + break;} +case 20: +#line 325 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size()); + for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) { + struct Init *Bit = (*yyvsp[-1].FieldList)[i]->convertInitializerTo(new BitRecTy()); if (Bit == 0) { - err() << "Element #" << i << " (" << *(*(yyvsp[(2) - (3)].FieldList))[i] + err() << "Element #" << i << " (" << *(*yyvsp[-1].FieldList)[i] << ") is not convertable to a bit!\n"; exit(1); } - Init->setBit((yyvsp[(2) - (3)].FieldList)->size()-i-1, Bit); + Init->setBit(yyvsp[-1].FieldList->size()-i-1, Bit); } - (yyval.Initializer) = Init; - delete (yyvsp[(2) - (3)].FieldList); - ;} - break; - - case 22: -#line 338 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + yyval.Initializer = Init; + delete yyvsp[-1].FieldList; + ; + break;} +case 21: +#line 338 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // This is a CLASS expression. This is supposed to synthesize // a new anonymous definition, deriving from CLASS with no // body. - Record *Class = Records.getClass(*(yyvsp[(1) - (4)].StrVal)); + Record *Class = Records.getClass(*yyvsp[-3].StrVal); if (!Class) { - err() << "Expected a class, got '" << *(yyvsp[(1) - (4)].StrVal) << "'!\n"; + err() << "Expected a class, got '" << *yyvsp[-3].StrVal << "'!\n"; exit(1); } - delete (yyvsp[(1) - (4)].StrVal); + delete yyvsp[-3].StrVal; static unsigned AnonCounter = 0; Record *OldRec = CurRec; // Save CurRec. // Create the new record, set it as CurRec temporarily. CurRec = new Record("anonymous.val."+utostr(AnonCounter++)); - addSubClass(Class, *(yyvsp[(3) - (4)].FieldList)); // Add info about the subclass to CurRec. - delete (yyvsp[(3) - (4)].FieldList); // Free up the template args. + addSubClass(Class, *yyvsp[-1].FieldList); // Add info about the subclass to CurRec. + delete yyvsp[-1].FieldList; // Free up the template args. CurRec->resolveReferences(); Records.addDef(CurRec); // The result of the expression is a reference to the new record. - (yyval.Initializer) = new DefInit(CurRec); + yyval.Initializer = new DefInit(CurRec); // Restore the old CurRec CurRec = OldRec; - ;} - break; - - case 23: -#line 366 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (yyvsp[(1) - (4)].Initializer)->convertInitializerBitRange(*(yyvsp[(3) - (4)].BitList)); - if ((yyval.Initializer) == 0) { - err() << "Invalid bit range for value '" << *(yyvsp[(1) - (4)].Initializer) << "'!\n"; + ; + break;} +case 22: +#line 366 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList); + if (yyval.Initializer == 0) { + err() << "Invalid bit range for value '" << *yyvsp[-3].Initializer << "'!\n"; exit(1); } - delete (yyvsp[(3) - (4)].BitList); - ;} - break; - - case 24: -#line 373 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new ListInit(*(yyvsp[(2) - (3)].FieldList)); - delete (yyvsp[(2) - (3)].FieldList); - ;} - break; - - case 25: -#line 376 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - if (!(yyvsp[(1) - (3)].Initializer)->getFieldType(*(yyvsp[(3) - (3)].StrVal))) { - err() << "Cannot access field '" << *(yyvsp[(3) - (3)].StrVal) << "' of value '" << *(yyvsp[(1) - (3)].Initializer) << "!\n"; + delete yyvsp[-1].BitList; + ; + break;} +case 23: +#line 373 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new ListInit(*yyvsp[-1].FieldList); + delete yyvsp[-1].FieldList; + ; + break;} +case 24: +#line 376 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) { + err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n"; exit(1); } - (yyval.Initializer) = new FieldInit((yyvsp[(1) - (3)].Initializer), *(yyvsp[(3) - (3)].StrVal)); - delete (yyvsp[(3) - (3)].StrVal); - ;} - break; - - case 26: -#line 383 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new DagInit((yyvsp[(2) - (4)].Initializer), *(yyvsp[(3) - (4)].DagValueList)); - delete (yyvsp[(3) - (4)].DagValueList); - ;} - break; - - case 27: -#line 386 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - std::reverse((yyvsp[(3) - (4)].BitList)->begin(), (yyvsp[(3) - (4)].BitList)->end()); - (yyval.Initializer) = (yyvsp[(1) - (4)].Initializer)->convertInitListSlice(*(yyvsp[(3) - (4)].BitList)); - if ((yyval.Initializer) == 0) { - err() << "Invalid list slice for value '" << *(yyvsp[(1) - (4)].Initializer) << "'!\n"; + yyval.Initializer = new FieldInit(yyvsp[-2].Initializer, *yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + ; + break;} +case 25: +#line 383 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new DagInit(yyvsp[-2].Initializer, *yyvsp[-1].DagValueList); + delete yyvsp[-1].DagValueList; + ; + break;} +case 26: +#line 386 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end()); + yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList); + if (yyval.Initializer == 0) { + err() << "Invalid list slice for value '" << *yyvsp[-3].Initializer << "'!\n"; exit(1); } - delete (yyvsp[(3) - (4)].BitList); - ;} - break; - - case 28: -#line 394 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (new BinOpInit(BinOpInit::SHL, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold(); - ;} - break; - - case 29: -#line 396 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (new BinOpInit(BinOpInit::SRA, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold(); - ;} - break; - - case 30: -#line 398 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (new BinOpInit(BinOpInit::SRL, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold(); - ;} - break; - - case 31: -#line 400 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (new BinOpInit(BinOpInit::STRCONCAT, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold(); - ;} - break; - - case 32: -#line 404 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.StrVal) = new std::string(); - ;} - break; - - case 33: -#line 407 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); - ;} - break; - - case 34: -#line 411 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.DagValueList) = new std::vector >(); - (yyval.DagValueList)->push_back(std::make_pair((yyvsp[(1) - (2)].Initializer), *(yyvsp[(2) - (2)].StrVal))); - delete (yyvsp[(2) - (2)].StrVal); - ;} - break; - - case 35: -#line 416 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyvsp[(1) - (4)].DagValueList)->push_back(std::make_pair((yyvsp[(3) - (4)].Initializer), *(yyvsp[(4) - (4)].StrVal))); - delete (yyvsp[(4) - (4)].StrVal); - (yyval.DagValueList) = (yyvsp[(1) - (4)].DagValueList); - ;} - break; - - case 36: -#line 422 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.DagValueList) = new std::vector >(); - ;} - break; - - case 37: -#line 425 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.DagValueList) = (yyvsp[(1) - (1)].DagValueList); ;} - break; - - case 38: -#line 428 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.BitList) = new std::vector(); - (yyval.BitList)->push_back((yyvsp[(1) - (1)].IntVal)); - ;} - break; - - case 39: -#line 431 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - if ((yyvsp[(1) - (3)].IntVal) < 0 || (yyvsp[(3) - (3)].IntVal) < 0) { - err() << "Invalid range: " << (yyvsp[(1) - (3)].IntVal) << "-" << (yyvsp[(3) - (3)].IntVal) << "!\n"; + delete yyvsp[-1].BitList; + ; + break;} +case 27: +#line 394 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = (new BinOpInit(BinOpInit::CONCAT, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); + ; + break;} +case 28: +#line 396 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = (new BinOpInit(BinOpInit::SHL, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); + ; + break;} +case 29: +#line 398 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = (new BinOpInit(BinOpInit::SRA, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); + ; + break;} +case 30: +#line 400 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = (new BinOpInit(BinOpInit::SRL, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); + ; + break;} +case 31: +#line 402 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = (new BinOpInit(BinOpInit::STRCONCAT, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); + ; + break;} +case 32: +#line 406 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.StrVal = new std::string(); + ; + break;} +case 33: +#line 409 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.StrVal = yyvsp[0].StrVal; + ; + break;} +case 34: +#line 413 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.DagValueList = new std::vector >(); + yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal)); + delete yyvsp[0].StrVal; + ; + break;} +case 35: +#line 418 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal)); + delete yyvsp[0].StrVal; + yyval.DagValueList = yyvsp[-3].DagValueList; + ; + break;} +case 36: +#line 424 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.DagValueList = new std::vector >(); + ; + break;} +case 37: +#line 427 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.DagValueList = yyvsp[0].DagValueList; ; + break;} +case 38: +#line 430 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.BitList = new std::vector(); + yyval.BitList->push_back(yyvsp[0].IntVal); + ; + break;} +case 39: +#line 433 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n"; exit(1); } - (yyval.BitList) = new std::vector(); - if ((yyvsp[(1) - (3)].IntVal) < (yyvsp[(3) - (3)].IntVal)) { - for (int i = (yyvsp[(1) - (3)].IntVal); i <= (yyvsp[(3) - (3)].IntVal); ++i) - (yyval.BitList)->push_back(i); + yyval.BitList = new std::vector(); + if (yyvsp[-2].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); } else { - for (int i = (yyvsp[(1) - (3)].IntVal); i >= (yyvsp[(3) - (3)].IntVal); --i) - (yyval.BitList)->push_back(i); + for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); } - ;} - break; - - case 40: -#line 444 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyvsp[(2) - (2)].IntVal) = -(yyvsp[(2) - (2)].IntVal); - if ((yyvsp[(1) - (2)].IntVal) < 0 || (yyvsp[(2) - (2)].IntVal) < 0) { - err() << "Invalid range: " << (yyvsp[(1) - (2)].IntVal) << "-" << (yyvsp[(2) - (2)].IntVal) << "!\n"; + ; + break;} +case 40: +#line 446 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyvsp[0].IntVal = -yyvsp[0].IntVal; + if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n"; exit(1); } - (yyval.BitList) = new std::vector(); - if ((yyvsp[(1) - (2)].IntVal) < (yyvsp[(2) - (2)].IntVal)) { - for (int i = (yyvsp[(1) - (2)].IntVal); i <= (yyvsp[(2) - (2)].IntVal); ++i) - (yyval.BitList)->push_back(i); + yyval.BitList = new std::vector(); + if (yyvsp[-1].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); } else { - for (int i = (yyvsp[(1) - (2)].IntVal); i >= (yyvsp[(2) - (2)].IntVal); --i) - (yyval.BitList)->push_back(i); + for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); } - ;} - break; - - case 41: -#line 458 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - ((yyval.BitList)=(yyvsp[(1) - (3)].BitList))->push_back((yyvsp[(3) - (3)].IntVal)); - ;} - break; - - case 42: -#line 460 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - if ((yyvsp[(3) - (5)].IntVal) < 0 || (yyvsp[(5) - (5)].IntVal) < 0) { - err() << "Invalid range: " << (yyvsp[(3) - (5)].IntVal) << "-" << (yyvsp[(5) - (5)].IntVal) << "!\n"; + ; + break;} +case 41: +#line 460 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + (yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal); + ; + break;} +case 42: +#line 462 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n"; exit(1); } - (yyval.BitList) = (yyvsp[(1) - (5)].BitList); - if ((yyvsp[(3) - (5)].IntVal) < (yyvsp[(5) - (5)].IntVal)) { - for (int i = (yyvsp[(3) - (5)].IntVal); i <= (yyvsp[(5) - (5)].IntVal); ++i) - (yyval.BitList)->push_back(i); + yyval.BitList = yyvsp[-4].BitList; + if (yyvsp[-2].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); } else { - for (int i = (yyvsp[(3) - (5)].IntVal); i >= (yyvsp[(5) - (5)].IntVal); --i) - (yyval.BitList)->push_back(i); + for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); } - ;} - break; - - case 43: -#line 473 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyvsp[(4) - (4)].IntVal) = -(yyvsp[(4) - (4)].IntVal); - if ((yyvsp[(3) - (4)].IntVal) < 0 || (yyvsp[(4) - (4)].IntVal) < 0) { - err() << "Invalid range: " << (yyvsp[(3) - (4)].IntVal) << "-" << (yyvsp[(4) - (4)].IntVal) << "!\n"; + ; + break;} +case 43: +#line 475 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyvsp[0].IntVal = -yyvsp[0].IntVal; + if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n"; exit(1); } - (yyval.BitList) = (yyvsp[(1) - (4)].BitList); - if ((yyvsp[(3) - (4)].IntVal) < (yyvsp[(4) - (4)].IntVal)) { - for (int i = (yyvsp[(3) - (4)].IntVal); i <= (yyvsp[(4) - (4)].IntVal); ++i) - (yyval.BitList)->push_back(i); + yyval.BitList = yyvsp[-3].BitList; + if (yyvsp[-1].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); } else { - for (int i = (yyvsp[(3) - (4)].IntVal); i >= (yyvsp[(4) - (4)].IntVal); --i) - (yyval.BitList)->push_back(i); + for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); } - ;} - break; - - case 44: -#line 489 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.BitList) = (yyvsp[(1) - (1)].BitList); std::reverse((yyvsp[(1) - (1)].BitList)->begin(), (yyvsp[(1) - (1)].BitList)->end()); ;} - break; - - case 45: -#line 491 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.BitList) = 0; ;} - break; - - case 46: -#line 491 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.BitList) = (yyvsp[(2) - (3)].BitList); ;} - break; - - case 47: -#line 495 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.FieldList) = new std::vector(); - ;} - break; - - case 48: -#line 497 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.FieldList) = (yyvsp[(1) - (1)].FieldList); - ;} - break; - - case 49: -#line 501 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.FieldList) = new std::vector(); - (yyval.FieldList)->push_back((yyvsp[(1) - (1)].Initializer)); - ;} - break; - - case 50: -#line 504 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - ((yyval.FieldList) = (yyvsp[(1) - (3)].FieldList))->push_back((yyvsp[(3) - (3)].Initializer)); - ;} - break; - - case 51: -#line 508 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - std::string DecName = *(yyvsp[(3) - (4)].StrVal); + ; + break;} +case 44: +#line 491 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ; + break;} +case 45: +#line 493 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.BitList = 0; ; + break;} +case 46: +#line 493 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.BitList = yyvsp[-1].BitList; ; + break;} +case 47: +#line 497 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.FieldList = new std::vector(); + ; + break;} +case 48: +#line 499 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.FieldList = yyvsp[0].FieldList; + ; + break;} +case 49: +#line 503 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.FieldList = new std::vector(); + yyval.FieldList->push_back(yyvsp[0].Initializer); + ; + break;} +case 50: +#line 506 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + (yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer); + ; + break;} +case 51: +#line 510 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + std::string DecName = *yyvsp[-1].StrVal; if (ParsingTemplateArgs) { if (CurRec) { DecName = CurRec->getName() + ":" + DecName; @@ -2227,119 +1505,104 @@ DecName = CurMultiClass->Rec.getName() + "::" + DecName; } - addValue(RecordVal(DecName, (yyvsp[(2) - (4)].Ty), (yyvsp[(1) - (4)].IntVal))); - setValue(DecName, 0, (yyvsp[(4) - (4)].Initializer)); - (yyval.StrVal) = new std::string(DecName); -;} - break; - - case 52: -#line 525 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - delete (yyvsp[(1) - (2)].StrVal); -;} - break; - - case 53: -#line 527 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - setValue(*(yyvsp[(2) - (6)].StrVal), (yyvsp[(3) - (6)].BitList), (yyvsp[(5) - (6)].Initializer)); - delete (yyvsp[(2) - (6)].StrVal); - delete (yyvsp[(3) - (6)].BitList); -;} - break; - - case 58: -#line 536 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.SubClassRef) = new SubClassRefTy((yyvsp[(1) - (1)].Rec), new std::vector()); - ;} - break; - - case 59: -#line 538 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.SubClassRef) = new SubClassRefTy((yyvsp[(1) - (4)].Rec), (yyvsp[(3) - (4)].FieldList)); - ;} - break; - - case 60: -#line 542 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.SubClassList) = new std::vector(); - (yyval.SubClassList)->push_back(*(yyvsp[(1) - (1)].SubClassRef)); - delete (yyvsp[(1) - (1)].SubClassRef); - ;} - break; - - case 61: -#line 547 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - ((yyval.SubClassList)=(yyvsp[(1) - (3)].SubClassList))->push_back(*(yyvsp[(3) - (3)].SubClassRef)); - delete (yyvsp[(3) - (3)].SubClassRef); - ;} - break; - - case 62: -#line 552 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.SubClassList) = new std::vector(); - ;} - break; - - case 63: -#line 555 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.SubClassList) = (yyvsp[(2) - (2)].SubClassList); - ;} - break; - - case 64: -#line 559 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - getActiveRec()->addTemplateArg(*(yyvsp[(1) - (1)].StrVal)); - delete (yyvsp[(1) - (1)].StrVal); -;} - break; - - case 65: -#line 562 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - getActiveRec()->addTemplateArg(*(yyvsp[(3) - (3)].StrVal)); - delete (yyvsp[(3) - (3)].StrVal); -;} - break; - - case 66: -#line 567 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - {;} - break; - - case 69: -#line 570 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} - break; - - case 70: -#line 570 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.StrVal) = new std::string(); ;} - break; - - case 71: -#line 572 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + addValue(RecordVal(DecName, yyvsp[-2].Ty, yyvsp[-3].IntVal)); + setValue(DecName, 0, yyvsp[0].Initializer); + yyval.StrVal = new std::string(DecName); +; + break;} +case 52: +#line 527 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + delete yyvsp[-1].StrVal; +; + break;} +case 53: +#line 529 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer); + delete yyvsp[-4].StrVal; + delete yyvsp[-3].BitList; +; + break;} +case 58: +#line 538 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector()); + ; + break;} +case 59: +#line 540 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList); + ; + break;} +case 60: +#line 544 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.SubClassList = new std::vector(); + yyval.SubClassList->push_back(*yyvsp[0].SubClassRef); + delete yyvsp[0].SubClassRef; + ; + break;} +case 61: +#line 549 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + (yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef); + delete yyvsp[0].SubClassRef; + ; + break;} +case 62: +#line 554 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.SubClassList = new std::vector(); + ; + break;} +case 63: +#line 557 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.SubClassList = yyvsp[0].SubClassList; + ; + break;} +case 64: +#line 561 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + getActiveRec()->addTemplateArg(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; +; + break;} +case 65: +#line 564 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + getActiveRec()->addTemplateArg(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; +; + break;} +case 66: +#line 569 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +case 69: +#line 572 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.StrVal = yyvsp[0].StrVal; ; + break;} +case 70: +#line 572 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.StrVal = new std::string(); ; + break;} +case 71: +#line 574 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ static unsigned AnonCounter = 0; - if ((yyvsp[(1) - (1)].StrVal)->empty()) - *(yyvsp[(1) - (1)].StrVal) = "anonymous."+utostr(AnonCounter++); - (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); -;} - break; - - case 72: -#line 579 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + if (yyvsp[0].StrVal->empty()) + *yyvsp[0].StrVal = "anonymous."+utostr(AnonCounter++); + yyval.StrVal = yyvsp[0].StrVal; +; + break;} +case 72: +#line 581 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // If a class of this name already exists, it must be a forward ref. - if ((CurRec = Records.getClass(*(yyvsp[(1) - (1)].StrVal)))) { + if ((CurRec = Records.getClass(*yyvsp[0].StrVal))) { // If the body was previously defined, this is an error. if (!CurRec->getValues().empty() || !CurRec->getSuperClasses().empty() || @@ -2349,18 +1612,17 @@ } } else { // If this is the first reference to this class, create and add it. - CurRec = new Record(*(yyvsp[(1) - (1)].StrVal)); + CurRec = new Record(*yyvsp[0].StrVal); Records.addClass(CurRec); } - delete (yyvsp[(1) - (1)].StrVal); -;} - break; - - case 73: -#line 597 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - CurRec = new Record(*(yyvsp[(1) - (1)].StrVal)); - delete (yyvsp[(1) - (1)].StrVal); + delete yyvsp[0].StrVal; +; + break;} +case 73: +#line 599 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + CurRec = new Record(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; if (!CurMultiClass) { // Top-level def definition. @@ -2381,18 +1643,17 @@ } CurMultiClass->DefPrototypes.push_back(CurRec); } -;} - break; - - case 74: -#line 622 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - for (unsigned i = 0, e = (yyvsp[(1) - (1)].SubClassList)->size(); i != e; ++i) { - addSubClass((*(yyvsp[(1) - (1)].SubClassList))[i].first, *(*(yyvsp[(1) - (1)].SubClassList))[i].second); +; + break;} +case 74: +#line 624 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) { + addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second); // Delete the template arg values for the class - delete (*(yyvsp[(1) - (1)].SubClassList))[i].second; + delete (*yyvsp[0].SubClassList)[i].second; } - delete (yyvsp[(1) - (1)].SubClassList); // Delete the class list. + delete yyvsp[0].SubClassList; // Delete the class list. // Process any variables on the let stack. for (unsigned i = 0, e = LetStack.size(); i != e; ++i) @@ -2400,129 +1661,115 @@ setValue(LetStack[i][j].Name, LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0, LetStack[i][j].Value); - ;} - break; - - case 75: -#line 636 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Rec) = CurRec; + ; + break;} +case 75: +#line 638 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Rec = CurRec; CurRec = 0; - ;} - break; - - case 76: -#line 641 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 76: +#line 643 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ ParsingTemplateArgs = true; - ;} - break; - - case 77: -#line 643 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 77: +#line 645 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ ParsingTemplateArgs = false; - ;} - break; - - case 78: -#line 645 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Rec) = (yyvsp[(6) - (6)].Rec); - ;} - break; - - case 79: -#line 649 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 78: +#line 647 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Rec = yyvsp[0].Rec; + ; + break;} +case 79: +#line 651 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ if (CurMultiClass == 0) // Def's in multiclasses aren't really defs. - (yyvsp[(3) - (3)].Rec)->resolveReferences(); + yyvsp[0].Rec->resolveReferences(); // If ObjectBody has template arguments, it's an error. - assert((yyvsp[(3) - (3)].Rec)->getTemplateArgs().empty() && "How'd this get template args?"); - (yyval.Rec) = (yyvsp[(3) - (3)].Rec); -;} - break; - - case 80: -#line 659 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Rec) = (yyvsp[(1) - (1)].Rec); + assert(yyvsp[0].Rec->getTemplateArgs().empty() && "How'd this get template args?"); + yyval.Rec = yyvsp[0].Rec; +; + break;} +case 80: +#line 661 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Rec = yyvsp[0].Rec; // Copy the template arguments for the multiclass into the def. const std::vector &TArgs = CurMultiClass->Rec.getTemplateArgs(); for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { const RecordVal *RV = CurMultiClass->Rec.getValue(TArgs[i]); assert(RV && "Template arg doesn't exist?"); - (yyval.Rec)->addValue(*RV); + yyval.Rec->addValue(*RV); } -;} - break; - - case 81: -#line 673 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.RecList) = new std::vector(); - (yyval.RecList)->push_back((yyvsp[(1) - (1)].Rec)); -;} - break; - - case 82: -#line 676 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.RecList)->push_back((yyvsp[(2) - (2)].Rec)); -;} - break; - - case 83: -#line 680 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - MultiClass *&MCE = MultiClasses[*(yyvsp[(1) - (1)].StrVal)]; +; + break;} +case 81: +#line 675 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.RecList = new std::vector(); + yyval.RecList->push_back(yyvsp[0].Rec); +; + break;} +case 82: +#line 678 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.RecList->push_back(yyvsp[0].Rec); +; + break;} +case 83: +#line 682 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + MultiClass *&MCE = MultiClasses[*yyvsp[0].StrVal]; if (MCE) { - err() << "multiclass '" << *(yyvsp[(1) - (1)].StrVal) << "' already defined!\n"; + err() << "multiclass '" << *yyvsp[0].StrVal << "' already defined!\n"; exit(1); } - MCE = CurMultiClass = new MultiClass(*(yyvsp[(1) - (1)].StrVal)); - delete (yyvsp[(1) - (1)].StrVal); -;} - break; - - case 84: -#line 691 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + MCE = CurMultiClass = new MultiClass(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; +; + break;} +case 84: +#line 693 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ ParsingTemplateArgs = true; - ;} - break; - - case 85: -#line 693 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 85: +#line 695 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ ParsingTemplateArgs = false; - ;} - break; - - case 86: -#line 695 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 86: +#line 697 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ CurMultiClass = 0; -;} - break; - - case 87: -#line 700 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { CurDefmPrefix = (yyvsp[(2) - (2)].StrVal); ;} - break; - - case 88: -#line 700 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { +; + break;} +case 87: +#line 702 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ CurDefmPrefix = yyvsp[0].StrVal; ; + break;} +case 88: +#line 702 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // To instantiate a multiclass, we need to first get the multiclass, then // instantiate each def contained in the multiclass with the SubClassRef // template parameters. - MultiClass *MC = MultiClasses[(yyvsp[(5) - (6)].SubClassRef)->first->getName()]; + MultiClass *MC = MultiClasses[yyvsp[-1].SubClassRef->first->getName()]; assert(MC && "Didn't lookup multiclass correctly?"); - std::vector &TemplateVals = *(yyvsp[(5) - (6)].SubClassRef)->second; - delete (yyvsp[(5) - (6)].SubClassRef); + std::vector &TemplateVals = *yyvsp[-1].SubClassRef->second; + delete yyvsp[-1].SubClassRef; // Verify that the correct number of template arguments were specified. const std::vector &TArgs = MC->Rec.getTemplateArgs(); @@ -2537,7 +1784,7 @@ // Add the suffix to the defm name to get the new name. assert(CurRec == 0 && "A def is current?"); - CurRec = new Record(*(yyvsp[(2) - (6)].StrVal) + DefProto->getName()); + CurRec = new Record(*yyvsp[-4].StrVal + DefProto->getName()); addSubClass(DefProto, std::vector()); @@ -2573,7 +1820,7 @@ // Ensure redefinition doesn't happen. if (Records.getDef(CurRec->getName())) { err() << "def '" << CurRec->getName() << "' already defined, " - << "instantiating defm '" << *(yyvsp[(2) - (6)].StrVal) << "' with subdef '" + << "instantiating defm '" << *yyvsp[-4].StrVal << "' with subdef '" << DefProto->getName() << "'!\n"; exit(1); } @@ -2585,279 +1832,275 @@ } delete &TemplateVals; - delete (yyvsp[(2) - (6)].StrVal); + delete yyvsp[-4].StrVal; CurDefmPrefix = 0; -;} - break; - - case 89: -#line 774 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - {;} - break; - - case 90: -#line 774 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - {;} - break; - - case 93: -#line 777 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - LetStack.back().push_back(LetRecord(*(yyvsp[(1) - (4)].StrVal), (yyvsp[(2) - (4)].BitList), (yyvsp[(4) - (4)].Initializer))); - delete (yyvsp[(1) - (4)].StrVal); delete (yyvsp[(2) - (4)].BitList); -;} - break; - - case 96: -#line 785 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { LetStack.push_back(std::vector()); ;} - break; - - case 98: -#line 788 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { +; + break;} +case 89: +#line 776 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +case 90: +#line 776 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +case 93: +#line 779 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer)); + delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList; +; + break;} +case 96: +#line 787 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ LetStack.push_back(std::vector()); ; + break;} +case 98: +#line 790 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ LetStack.pop_back(); - ;} - break; - - case 99: -#line 791 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 99: +#line 793 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ LetStack.pop_back(); - ;} - break; - - case 100: -#line 795 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - {;} - break; - - case 101: -#line 795 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - {;} - break; - + ; + break;} +case 100: +#line 797 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +case 101: +#line 797 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 543 "/usr/share/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif -/* Line 1267 of yacc.c. */ -#line 2643 "FileParser.tab.c" - default: break; +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); +#endif *++yyvsp = yyval; +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTOKENS]; + yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; +yyerrlab: /* here on detecting error */ -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ { ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ - - if (yychar <= YYEOF) + if (yyn > YYFLAG && yyn < YYLAST) { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); } - /* Else will try to reuse look-ahead token after shifting the error - token. */ goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif - for (;;) +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; +yyerrhandle: + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; } + else if (yyn == 0) + goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; - *++yyvsp = yylval; - +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif yystate = yyn; goto yynewstate; + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + } + return 1; } - - -#line 799 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" +#line 801 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" int yyerror(const char *ErrorMsg) { err() << "Error parsing: " << ErrorMsg << "\n"; exit(1); } - Modified: llvm/trunk/utils/TableGen/FileParser.h.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/FileParser.h.cvs?rev=42036&r1=42035&r2=42036&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/FileParser.h.cvs (original) +++ llvm/trunk/utils/TableGen/FileParser.h.cvs Mon Sep 17 12:40:48 2007 @@ -1,101 +1,4 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - INT = 258, - BIT = 259, - STRING = 260, - BITS = 261, - LIST = 262, - CODE = 263, - DAG = 264, - CLASS = 265, - DEF = 266, - MULTICLASS = 267, - DEFM = 268, - FIELD = 269, - LET = 270, - IN = 271, - SHLTOK = 272, - SRATOK = 273, - SRLTOK = 274, - STRCONCATTOK = 275, - INTVAL = 276, - ID = 277, - VARNAME = 278, - STRVAL = 279, - CODEFRAGMENT = 280 - }; -#endif -/* Tokens. */ -#define INT 258 -#define BIT 259 -#define STRING 260 -#define BITS 261 -#define LIST 262 -#define CODE 263 -#define DAG 264 -#define CLASS 265 -#define DEF 266 -#define MULTICLASS 267 -#define DEFM 268 -#define FIELD 269 -#define LET 270 -#define IN 271 -#define SHLTOK 272 -#define SRATOK 273 -#define SRLTOK 274 -#define STRCONCATTOK 275 -#define INTVAL 276 -#define ID 277 -#define VARNAME 278 -#define STRVAL 279 -#define CODEFRAGMENT 280 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 210 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" -{ +typedef union { std::string* StrVal; int IntVal; llvm::RecTy* Ty; @@ -107,14 +10,31 @@ SubClassRefTy* SubClassRef; std::vector* SubClassList; std::vector >* DagValueList; -} -/* Line 1529 of yacc.c. */ -#line 113 "FileParser.tab.h" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif +} YYSTYPE; +#define INT 257 +#define BIT 258 +#define STRING 259 +#define BITS 260 +#define LIST 261 +#define CODE 262 +#define DAG 263 +#define CLASS 264 +#define DEF 265 +#define MULTICLASS 266 +#define DEFM 267 +#define FIELD 268 +#define LET 269 +#define IN 270 +#define CONCATTOK 271 +#define SHLTOK 272 +#define SRATOK 273 +#define SRLTOK 274 +#define STRCONCATTOK 275 +#define INTVAL 276 +#define ID 277 +#define VARNAME 278 +#define STRVAL 279 +#define CODEFRAGMENT 280 -extern YYSTYPE Filelval; +extern YYSTYPE Filelval; From evan.cheng at apple.com Mon Sep 17 12:42:53 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 17 Sep 2007 17:42:53 -0000 Subject: [llvm-commits] [llvm] r42037 - /llvm/trunk/lib/Target/X86/X86ISelLowering.h Message-ID: <200709171742.l8HHgroa021929@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 17 12:42:53 2007 New Revision: 42037 URL: http://llvm.org/viewvc/llvm-project?rev=42037&view=rev Log: X86ISD::TEST is dead. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=42037&r1=42036&r2=42037&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Mon Sep 17 12:42:53 2007 @@ -116,7 +116,7 @@ RDTSC_DAG, /// X86 compare and logical compare instructions. - CMP, TEST, COMI, UCOMI, + CMP, COMI, UCOMI, /// X86 SetCC. Operand 1 is condition code, and operand 2 is the flag /// operand produced by a CMP instruction. From djg at cray.com Mon Sep 17 12:44:31 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 17 Sep 2007 17:44:31 -0000 Subject: [llvm-commits] [llvm] r42038 - /llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Message-ID: <200709171744.l8HHiW1h022064@zion.cs.uiuc.edu> Author: djg Date: Mon Sep 17 12:44:31 2007 New Revision: 42038 URL: http://llvm.org/viewvc/llvm-project?rev=42038&view=rev Log: Add a utility function to SDOperand for testing if a value is unused. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=42038&r1=42037&r2=42038&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Mon Sep 17 12:44:31 2007 @@ -766,6 +766,10 @@ /// hasOneUse - Return true if there is exactly one operation using this /// result value of the defining operator. inline bool hasOneUse() const; + + /// use_empty - Return true if there are no operations using this + /// result value of the defining operator. + inline bool use_empty() const; }; @@ -1035,6 +1039,9 @@ inline bool SDOperand::hasOneUse() const { return Val->hasNUsesOfValue(1, ResNo); } +inline bool SDOperand::use_empty() const { + return !Val->hasAnyUseOfValue(ResNo); +} /// UnarySDNode - This class is used for single-operand SDNodes. This is solely /// to allow co-allocation of node operands with the node itself. From evan.cheng at apple.com Mon Sep 17 12:50:59 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 17 Sep 2007 10:50:59 -0700 Subject: [llvm-commits] [llvm] r42029 - /llvm/trunk/lib/Target/X86/X86InstrInfo.cpp In-Reply-To: <200709171519.l8HFJ8k2010460@zion.cs.uiuc.edu> References: <200709171519.l8HFJ8k2010460@zion.cs.uiuc.edu> Message-ID: <00B174F3-F244-4EBD-8CC3-9EF758EA4B52@apple.com> Doh. Thanks Dan. Was this breaking anything? Seems to me this fix should be merged into the release branch. What do you say? Evan On Sep 17, 2007, at 8:19 AM, Dan Gohman wrote: > Author: djg > Date: Mon Sep 17 10:19:08 2007 > New Revision: 42029 > > URL: http://llvm.org/viewvc/llvm-project?rev=42029&view=rev > Log: > Add 64-bit jmp instructions to the list of instructions that > can terminate a block with no fall-through. > > Modified: > llvm/trunk/lib/Target/X86/X86InstrInfo.cpp > > Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=42029&r1=42028&r2=42029&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Sep 17 10:19:08 > 2007 > @@ -582,7 +582,9 @@ > case X86::TAILJMPm: > case X86::JMP: // Uncond branch. > case X86::JMP32r: // Indirect branch. > + case X86::JMP64r: // Indirect branch (64-bit). > case X86::JMP32m: // Indirect branch through mem. > + case X86::JMP64m: // Indirect branch through mem (64-bit). > return true; > default: return false; > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dberlin at dberlin.org Mon Sep 17 13:04:21 2007 From: dberlin at dberlin.org (Daniel Berlin) Date: Mon, 17 Sep 2007 18:04:21 -0000 Subject: [llvm-commits] [llvm] r42039 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h Message-ID: <200709171804.l8HI4L5S024079@zion.cs.uiuc.edu> Author: dannyb Date: Mon Sep 17 13:04:21 2007 New Revision: 42039 URL: http://llvm.org/viewvc/llvm-project?rev=42039&view=rev Log: Fix iterator so it doesn't sometimes report bits that aren't in the bitmap 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=42039&r1=42038&r2=42039&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original) +++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Mon Sep 17 13:04:21 2007 @@ -405,6 +405,8 @@ WordNumber = (NextSetBitNumber % ElementSize) / BITWORD_SIZE; Bits = Iter->word(WordNumber); Bits >>= NextSetBitNumber % BITWORD_SIZE; + BitNumber = Iter->index() * ElementSize; + BitNumber += NextSetBitNumber; } } } From dberlin at dberlin.org Mon Sep 17 13:05:59 2007 From: dberlin at dberlin.org (Daniel Berlin) Date: Mon, 17 Sep 2007 18:05:59 -0000 Subject: [llvm-commits] [llvm] r42040 - /llvm/trunk/include/llvm/ADT/SparseBitVector.h Message-ID: <200709171805.l8HI5xTG024269@zion.cs.uiuc.edu> Author: dannyb Date: Mon Sep 17 13:05:59 2007 New Revision: 42040 URL: http://llvm.org/viewvc/llvm-project?rev=42040&view=rev Log: That's what i get for using carbon emacs in a terminal 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=42040&r1=42039&r2=42040&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SparseBitVector.h (original) +++ llvm/trunk/include/llvm/ADT/SparseBitVector.h Mon Sep 17 13:05:59 2007 @@ -405,8 +405,8 @@ WordNumber = (NextSetBitNumber % ElementSize) / BITWORD_SIZE; Bits = Iter->word(WordNumber); Bits >>= NextSetBitNumber % BITWORD_SIZE; - BitNumber = Iter->index() * ElementSize; - BitNumber += NextSetBitNumber; + BitNumber = Iter->index() * ElementSize; + BitNumber += NextSetBitNumber; } } } From evan.cheng at apple.com Mon Sep 17 13:18:19 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 17 Sep 2007 11:18:19 -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: <200709171059.54888.baldrick@free.fr> References: <200709121855.l8CItFuU000417@zion.cs.uiuc.edu> <200709151600.40230.baldrick@free.fr> <200709171059.54888.baldrick@free.fr> Message-ID: On Sep 17, 2007, at 1:59 AM, Duncan Sands wrote: > 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. >> >> 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. > > I've CC'd Anton since he's the one who knows all about this stuff. > Presumably Anton CC'd. > > when A is an alias for B there are two cases: either this is a "weak > alias" or > weakref, meaning that at link time it may turn out that A wasn't an > alias for > B after all, or A is a strong alias (a term I just invented) for B, > meaning that > this is definitive: you can replace uses of A with uses of B > everywhere. In the > first case linker support is required, but not in the second case, > so presumably > it is wrong to turn off alias support in the second case. I don't > know if your > patch turned this second case off or not. Hmm. I thought "weak alias" just means "weak" and "alias". It's a different animal from weakref (which Darwin supports). > In the first case (weakrefs) we output a special declaration to the > bitcode > saying that A is a weak alias for B. I think it is a mistake not to > output > this even for platforms like Darwin that don't handle weakrefs: such > aliases > may be resolvable by LLVM, for example when linking modules using > llvm-link. > Think also of running bitcode under lli. Thus there are some cases > in which > weakrefs can work correctly even on Darwin. I don't think Bill's patch affects weakref. Bill? > > > Instead, I suggest we output a warning in the f-e that aliases are > not supported, > but still generate the alias in the bitcode. Then we teach the code > generators, > which presumably means the asm printer, to ignore aliases on Darwin. We are already relying on asm printer too much as it is. I'd like not to add any more target specific knowledge to asm printer if possible. Evan > > > On the other hand, not all bitcode is generated by llvm-gcc. It may > be a bad > idea to have LLVM quietly ignore aliases on Darwin because of the > potential > surprise and trouble it may create for front-end writers who aren't > aware of > this. > >> 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. > > Ciao, > > Duncan. > _______________________________________________ > 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 17 13:34:06 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 17 Sep 2007 18:34:06 -0000 Subject: [llvm-commits] [llvm] r42042 - in /llvm/trunk: docs/ProgrammersManual.html include/llvm/ADT/DenseMap.h include/llvm/CodeGen/SelectionDAGNodes.h lib/CodeGen/DwarfWriter.cpp lib/CodeGen/RegAllocBigBlock.cpp lib/Target/TargetData.cpp lib/Transforms/Scalar/GVN.cpp lib/Transforms/Scalar/GVNPRE.cpp lib/Transforms/Utils/PromoteMemoryToRegister.cpp lib/VMCore/Constants.cpp Message-ID: <200709171834.l8HIY6Ir027357@zion.cs.uiuc.edu> Author: lattner Date: Mon Sep 17 13:34:04 2007 New Revision: 42042 URL: http://llvm.org/viewvc/llvm-project?rev=42042&view=rev Log: Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfo Add a new DenseMapInfo::isEqual method to allow clients to redefine the equality predicate used when probing the hash table. Modified: llvm/trunk/docs/ProgrammersManual.html llvm/trunk/include/llvm/ADT/DenseMap.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/DwarfWriter.cpp llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp llvm/trunk/lib/Target/TargetData.cpp llvm/trunk/lib/Transforms/Scalar/GVN.cpp llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/docs/ProgrammersManual.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ProgrammersManual.html?rev=42042&r1=42041&r2=42042&view=diff ============================================================================== --- llvm/trunk/docs/ProgrammersManual.html (original) +++ llvm/trunk/docs/ProgrammersManual.html Mon Sep 17 13:34:04 2007 @@ -1225,7 +1225,7 @@ map. Also, because DenseMap allocates space for a large number of key/value pairs (it starts with 64 by default), it will waste a lot of space if your keys or values are large. Finally, you must implement a partial specialization of -DenseMapKeyInfo for the key that you want, if it isn't already supported. This +DenseMapInfo for the key that you want, if it isn't already supported. This is required to tell DenseMap about two special marker values (which can never be inserted into the map) that it needs internally.

Modified: llvm/trunk/include/llvm/ADT/DenseMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=42042&r1=42041&r2=42042&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) +++ llvm/trunk/include/llvm/ADT/DenseMap.h Mon Sep 17 13:34:04 2007 @@ -22,48 +22,39 @@ namespace llvm { template -struct DenseMapKeyInfo { +struct DenseMapInfo { //static inline T getEmptyKey(); //static inline T getTombstoneKey(); //static unsigned getHashValue(const T &Val); + //static bool isEqual(const T &LHS, const T &RHS); //static bool isPod() }; -// Provide DenseMapKeyInfo for all pointers. +// Provide DenseMapInfo for all pointers. template -struct DenseMapKeyInfo { +struct DenseMapInfo { static inline T* getEmptyKey() { return reinterpret_cast(-1); } static inline T* getTombstoneKey() { return reinterpret_cast(-2); } static unsigned getHashValue(const T *PtrVal) { return (unsigned(uintptr_t(PtrVal)) >> 4) ^ (unsigned(uintptr_t(PtrVal)) >> 9); } - static bool isPod() { return true; } -}; - -template -struct DenseMapValueInfo { - //static bool isPod() -}; - -// Provide DenseMapValueInfo for all pointers. -template -struct DenseMapValueInfo { + static bool isEqual(const T *LHS, const T *RHS) { return LHS == RHS; } static bool isPod() { return true; } }; template, - typename ValueInfoT = DenseMapValueInfo > + typename KeyInfoT = DenseMapInfo, + typename ValueInfoT = DenseMapInfo > class DenseMapIterator; template, - typename ValueInfoT = DenseMapValueInfo > + typename KeyInfoT = DenseMapInfo, + typename ValueInfoT = DenseMapInfo > class DenseMapConstIterator; template, - typename ValueInfoT = DenseMapValueInfo > + typename KeyInfoT = DenseMapInfo, + typename ValueInfoT = DenseMapInfo > class DenseMap { typedef std::pair BucketT; unsigned NumBuckets; @@ -280,14 +271,14 @@ while (1) { BucketT *ThisBucket = BucketsPtr + (BucketNo & (NumBuckets-1)); // Found Val's bucket? If so, return it. - if (ThisBucket->first == Val) { + if (KeyInfoT::isEqual(ThisBucket->first, Val)) { FoundBucket = ThisBucket; return true; } // If we found an empty bucket, the key doesn't exist in the set. // Insert it and return the default value. - if (ThisBucket->first == EmptyKey) { + if (KeyInfoT::isEqual(ThisBucket->first, EmptyKey)) { // If we've already seen a tombstone while probing, fill it in instead // of the empty bucket we eventually probed to. if (FoundTombstone) ThisBucket = FoundTombstone; @@ -297,7 +288,7 @@ // If this is a tombstone, remember it. If Val ends up not in the map, we // prefer to return it than something that would require more probing. - if (ThisBucket->first == TombstoneKey && !FoundTombstone) + if (KeyInfoT::isEqual(ThisBucket->first, TombstoneKey) && !FoundTombstone) FoundTombstone = ThisBucket; // Remember the first tombstone found. // Otherwise, it's a hash collision or a tombstone, continue quadratic @@ -425,7 +416,9 @@ const KeyT Empty = KeyInfoT::getEmptyKey(); const KeyT Tombstone = KeyInfoT::getTombstoneKey(); - while (Ptr != End && (Ptr->first == Empty || Ptr->first == Tombstone)) + while (Ptr != End && + (KeyInfoT::isEqual(Ptr->first, Empty) || + KeyInfoT::isEqual(Ptr->first, Tombstone))) ++Ptr; } }; Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=42042&r1=42041&r2=42042&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Mon Sep 17 13:34:04 2007 @@ -35,7 +35,7 @@ class MachineBasicBlock; class MachineConstantPoolValue; class SDNode; -template struct DenseMapKeyInfo; +template struct DenseMapInfo; template struct simplify_type; template struct ilist_traits; template class iplist; @@ -773,13 +773,16 @@ }; -template<> struct DenseMapKeyInfo { +template<> struct DenseMapInfo { static inline SDOperand getEmptyKey() { return SDOperand((SDNode*)-1, -1U); } static inline SDOperand getTombstoneKey() { return SDOperand((SDNode*)-1, 0);} static unsigned getHashValue(const SDOperand &Val) { return (unsigned)((uintptr_t)Val.Val >> 4) ^ (unsigned)((uintptr_t)Val.Val >> 9) + Val.ResNo; } + static bool isEqual(const SDOperand &LHS, const SDOperand &RHS) { + return LHS == RHS; + } static bool isPod() { return true; } }; Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=42042&r1=42041&r2=42042&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Mon Sep 17 13:34:04 2007 @@ -2942,6 +2942,7 @@ static inline unsigned getEmptyKey() { return -1U; } static inline unsigned getTombstoneKey() { return -2U; } static unsigned getHashValue(const unsigned &Key) { return Key; } + static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; } static bool isPod() { return true; } }; Modified: llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp?rev=42042&r1=42041&r2=42042&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp (original) +++ llvm/trunk/lib/CodeGen/RegAllocBigBlock.cpp Mon Sep 17 13:34:04 2007 @@ -63,6 +63,7 @@ struct VRegKeyInfo { static inline unsigned getEmptyKey() { return -1U; } static inline unsigned getTombstoneKey() { return -2U; } + static bool isEqual(unsigned LHS, unsigned RHS) { return LHS == RHS; } static unsigned getHashValue(const unsigned &Key) { return Key; } }; Modified: llvm/trunk/lib/Target/TargetData.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=42042&r1=42041&r2=42042&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetData.cpp (original) +++ llvm/trunk/lib/Target/TargetData.cpp Mon Sep 17 13:34:04 2007 @@ -316,9 +316,13 @@ return LayoutKey((TargetData*)(intptr_t)-1, 0); } static unsigned getHashValue(const LayoutKey &Val) { - return DenseMapKeyInfo::getHashValue(Val.first) ^ - DenseMapKeyInfo::getHashValue(Val.second); + return DenseMapInfo::getHashValue(Val.first) ^ + DenseMapInfo::getHashValue(Val.second); } + static bool isEqual(const LayoutKey &LHS, const LayoutKey &RHS) { + return LHS == RHS; + } + static bool isPod() { return true; } }; Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=42042&r1=42041&r2=42042&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Sep 17 13:34:04 2007 @@ -145,7 +145,7 @@ } namespace llvm { -template <> struct DenseMapKeyInfo { +template <> struct DenseMapInfo { static inline Expression getEmptyKey() { return Expression(Expression::EMPTY); } @@ -171,6 +171,9 @@ return hash; } + static bool isEqual(const Expression &LHS, const Expression &RHS) { + return LHS == RHS; + } static bool isPod() { return true; } }; } Modified: llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp?rev=42042&r1=42041&r2=42042&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp Mon Sep 17 13:34:04 2007 @@ -155,7 +155,7 @@ } namespace llvm { -template <> struct DenseMapKeyInfo { +template <> struct DenseMapInfo { static inline Expression getEmptyKey() { return Expression(Expression::EMPTY); } @@ -181,6 +181,9 @@ return hash; } + static bool isEqual(const Expression &LHS, const Expression &RHS) { + return LHS == RHS; + } static bool isPod() { return true; } }; } Modified: llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp?rev=42042&r1=42041&r2=42042&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/PromoteMemoryToRegister.cpp Mon Sep 17 13:34:04 2007 @@ -39,18 +39,22 @@ STATISTIC(NumDeadAlloca, "Number of dead alloca's removed"); STATISTIC(NumPHIInsert, "Number of PHI nodes inserted"); -// Provide DenseMapKeyInfo for all pointers. +// Provide DenseMapInfo for all pointers. namespace llvm { template<> -struct DenseMapKeyInfo > { - static inline std::pair getEmptyKey() { - return std::make_pair((BasicBlock*)-1, ~0U); +struct DenseMapInfo > { + typedef std::pair EltTy; + static inline EltTy getEmptyKey() { + return EltTy(reinterpret_cast(-1), ~0U); } - static inline std::pair getTombstoneKey() { - return std::make_pair((BasicBlock*)-2, 0U); + static inline EltTy getTombstoneKey() { + return EltTy(reinterpret_cast(-2), 0U); } static unsigned getHashValue(const std::pair &Val) { - return DenseMapKeyInfo::getHashValue(Val.first) + Val.second*2; + return DenseMapInfo::getHashValue(Val.first) + Val.second*2; + } + static bool isEqual(const EltTy &LHS, const EltTy &RHS) { + return LHS == RHS; } static bool isPod() { return true; } }; Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=42042&r1=42041&r2=42042&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Mon Sep 17 13:34:04 2007 @@ -203,9 +203,12 @@ static inline KeyTy getEmptyKey() { return KeyTy(APInt(1,0), 0); } static inline KeyTy getTombstoneKey() { return KeyTy(APInt(1,1), 0); } static unsigned getHashValue(const KeyTy &Key) { - return DenseMapKeyInfo::getHashValue(Key.type) ^ + return DenseMapInfo::getHashValue(Key.type) ^ Key.val.getHashValue(); } + static bool isEqual(const KeyTy &LHS, const KeyTy &RHS) { + return LHS == RHS; + } static bool isPod() { return false; } }; } @@ -293,6 +296,9 @@ static unsigned getHashValue(const KeyTy &Key) { return Key.val.getHashValue(); } + static bool isEqual(const KeyTy &LHS, const KeyTy &RHS) { + return LHS == RHS; + } static bool isPod() { return false; } }; } From djg at cray.com Mon Sep 17 13:37:45 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 17 Sep 2007 13:37:45 -0500 Subject: [llvm-commits] [llvm] r42029 - /llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Message-ID: <20070917183745.GE10864@village.us.cray.com> > Doh. Thanks Dan. Was this breaking anything? Seems to me this fix > should be merged into the release branch. What do you say? The only in-tree user of BlockHasNoFallThrough appears to be BranchFolding, and there it's just guarding an optimization. Dan -- Dan Gohman, Cray Inc. From dalej at apple.com Mon Sep 17 13:44:13 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 17 Sep 2007 18:44:13 -0000 Subject: [llvm-commits] [llvm] r42043 - in /llvm/trunk: include/llvm/ExecutionEngine/GenericValue.h lib/ExecutionEngine/ExecutionEngine.cpp lib/ExecutionEngine/JIT/JIT.cpp Message-ID: <200709171844.l8HIiDSH028563@zion.cs.uiuc.edu> Author: johannes Date: Mon Sep 17 13:44:13 2007 New Revision: 42043 URL: http://llvm.org/viewvc/llvm-project?rev=42043&view=rev Log: Implement x86 long double in jit (not really complete, but common cases work) Modified: llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Modified: llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h?rev=42043&r1=42042&r2=42043&view=diff ============================================================================== --- llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h (original) +++ llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h Mon Sep 17 13:44:13 2007 @@ -31,7 +31,7 @@ struct { unsigned int first; unsigned int second; } UIntPairVal; unsigned char Untyped[8]; }; - APInt IntVal; + APInt IntVal; // also used for long doubles GenericValue() : DoubleVal(0.0), IntVal(1,0) {} GenericValue(void *V) : PointerVal(V), IntVal(1,0) { } Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=42043&r1=42042&r2=42043&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Mon Sep 17 13:44:13 2007 @@ -376,11 +376,13 @@ return GV; } case Instruction::FPTrunc: { + // FIXME long double GenericValue GV = getConstantValue(Op0); GV.FloatVal = float(GV.DoubleVal); return GV; } case Instruction::FPExt:{ + // FIXME long double GenericValue GV = getConstantValue(Op0); GV.DoubleVal = double(GV.FloatVal); return GV; @@ -389,16 +391,30 @@ GenericValue GV = getConstantValue(Op0); if (CE->getType() == Type::FloatTy) GV.FloatVal = float(GV.IntVal.roundToDouble()); - else + else if (CE->getType() == Type::DoubleTy) GV.DoubleVal = GV.IntVal.roundToDouble(); + else if (CE->getType() == Type::X86_FP80Ty) { + const uint64_t zero[] = {0, 0}; + APFloat apf = APFloat(APInt(80, 2, zero)); + (void)apf.convertFromInteger(GV.IntVal.getRawData(), 2, false, + APFloat::rmTowardZero); + GV.IntVal = apf.convertToAPInt(); + } return GV; } case Instruction::SIToFP: { GenericValue GV = getConstantValue(Op0); if (CE->getType() == Type::FloatTy) GV.FloatVal = float(GV.IntVal.signedRoundToDouble()); - else + else if (CE->getType() == Type::DoubleTy) GV.DoubleVal = GV.IntVal.signedRoundToDouble(); + else if (CE->getType() == Type::X86_FP80Ty) { + const uint64_t zero[] = { 0, 0}; + APFloat apf = APFloat(APInt(80, 2, zero)); + (void)apf.convertFromInteger(GV.IntVal.getRawData(), 2, true, + APFloat::rmTowardZero); + GV.IntVal = apf.convertToAPInt(); + } return GV; } case Instruction::FPToUI: // double->APInt conversion handles sign @@ -407,8 +423,16 @@ uint32_t BitWidth = cast(CE->getType())->getBitWidth(); if (Op0->getType() == Type::FloatTy) GV.IntVal = APIntOps::RoundFloatToAPInt(GV.FloatVal, BitWidth); - else + else if (Op0->getType() == Type::DoubleTy) GV.IntVal = APIntOps::RoundDoubleToAPInt(GV.DoubleVal, BitWidth); + else if (Op0->getType() == Type::X86_FP80Ty) { + APFloat apf = APFloat(GV.IntVal); + uint64_t v; + (void)apf.convertToInteger(&v, BitWidth, + CE->getOpcode()==Instruction::FPToSI, + APFloat::rmTowardZero); + GV.IntVal = v; // endian? + } return GV; } case Instruction::PtrToInt: { @@ -512,6 +536,35 @@ GV.DoubleVal = ::fmod(LHS.DoubleVal,RHS.DoubleVal); break; } break; + case Type::X86_FP80TyID: + case Type::PPC_FP128TyID: + case Type::FP128TyID: { + APFloat apfLHS = APFloat(LHS.IntVal); + switch (CE->getOpcode()) { + default: assert(0 && "Invalid long double opcode"); abort(); + case Instruction::Add: + apfLHS.add(APFloat(RHS.IntVal), APFloat::rmNearestTiesToEven); + GV.IntVal = apfLHS.convertToAPInt(); + break; + case Instruction::Sub: + apfLHS.subtract(APFloat(RHS.IntVal), APFloat::rmNearestTiesToEven); + GV.IntVal = apfLHS.convertToAPInt(); + break; + case Instruction::Mul: + apfLHS.multiply(APFloat(RHS.IntVal), APFloat::rmNearestTiesToEven); + GV.IntVal = apfLHS.convertToAPInt(); + break; + case Instruction::FDiv: + apfLHS.divide(APFloat(RHS.IntVal), APFloat::rmNearestTiesToEven); + GV.IntVal = apfLHS.convertToAPInt(); + break; + case Instruction::FRem: + apfLHS.mod(APFloat(RHS.IntVal), APFloat::rmNearestTiesToEven); + GV.IntVal = apfLHS.convertToAPInt(); + break; + } + } + break; } return GV; } @@ -530,6 +583,11 @@ case Type::DoubleTyID: Result.DoubleVal = cast(C)->getValueAPF().convertToDouble(); break; + case Type::X86_FP80TyID: + case Type::FP128TyID: + case Type::PPC_FP128TyID: + Result.IntVal = cast (C)->getValueAPF().convertToAPInt(); + break; case Type::IntegerTyID: Result.IntVal = cast(C)->getValue(); break; @@ -583,6 +641,17 @@ case Type::DoubleTyID: *((double*)Ptr) = Val.DoubleVal; break; + case Type::X86_FP80TyID: { + uint16_t *Dest = (uint16_t*)Ptr; + const uint16_t *Src = (uint16_t*)Val.IntVal.getRawData(); + // This is endian dependent, but it will only work on x86 anyway. + Dest[0] = Src[4]; + Dest[1] = Src[0]; + Dest[2] = Src[1]; + Dest[3] = Src[2]; + Dest[4] = Src[3]; + break; + } case Type::PointerTyID: *((PointerTy*)Ptr) = Val.PointerVal; break; @@ -620,6 +689,17 @@ case Type::PointerTyID: Result.PointerVal = *((PointerTy*)Ptr); break; + case Type::X86_FP80TyID: { + // This is endian dependent, but it will only work on x86 anyway. + uint16_t x[8], *p = (uint16_t*)Ptr; + x[0] = p[1]; + x[1] = p[2]; + x[2] = p[3]; + x[3] = p[4]; + x[4] = p[0]; + Result.IntVal = APInt(80, 2, x); + break; + } default: cerr << "Cannot load value of type " << *Ty << "!\n"; abort(); Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=42043&r1=42042&r2=42043&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Mon Sep 17 13:44:13 2007 @@ -178,6 +178,11 @@ case Type::DoubleTyID: rv.DoubleVal = ((double(*)())(intptr_t)FPtr)(); return rv; + case Type::X86_FP80TyID: + case Type::FP128TyID: + case Type::PPC_FP128TyID: + assert(0 && "long double not supported yet"); + return rv; case Type::PointerTyID: return PTOGV(((void*(*)())(intptr_t)FPtr)()); } @@ -209,7 +214,11 @@ case Type::FloatTyID: C = ConstantFP ::get(ArgTy, APFloat(AV.FloatVal)); break; case Type::DoubleTyID: C = ConstantFP ::get(ArgTy, APFloat(AV.DoubleVal)); - break; + break; + case Type::PPC_FP128TyID: + case Type::X86_FP80TyID: + case Type::FP128TyID: C = ConstantFP ::get(ArgTy, APFloat(AV.IntVal)); + break; case Type::PointerTyID: void *ArgPtr = GVTOP(AV); if (sizeof(void*) == 4) { From lauro.venancio at gmail.com Mon Sep 17 13:47:09 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Mon, 17 Sep 2007 15:47:09 -0300 Subject: [llvm-commits] Unbreak objc FE compilation on non-darwin In-Reply-To: <1188512868.10219.21.camel@asl.dorms.spbu.ru> References: <1188512868.10219.21.camel@asl.dorms.spbu.ru> Message-ID: <9c10c9f0709171147y110fb188sa03afd90694d4258@mail.gmail.com> I think a similar patch should be applied to llvm-gcc 4.0. Lauro 2007/8/30, Anton Korobeynikov : > Hello, Everyone. > > Please find attached patch for unbreaking objc FE for llvm-gcc 4.2. I've > just fixed couple of "apple local" stuff (some of them were > "generalized", some - just cleaned). > > Ok to commit? > > -- > With best regards, Anton Korobeynikov. > > Faculty of Mathematics & Mechanics, Saint Petersburg State University. > > > _______________________________________________ > 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 Mon Sep 17 13:47:42 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 17 Sep 2007 11:47:42 -0700 Subject: [llvm-commits] [llvm] r42029 - /llvm/trunk/lib/Target/X86/X86InstrInfo.cpp In-Reply-To: <20070917183745.GE10864@village.us.cray.com> References: <20070917183745.GE10864@village.us.cray.com> Message-ID: <8DD77FE6-A808-4AA1-A3D6-ED6A3E6BB6AC@apple.com> Ok, then it doesn't need to be merged into 2.1. Thx. Evan On Sep 17, 2007, at 11:37 AM, Dan Gohman wrote: >> Doh. Thanks Dan. Was this breaking anything? Seems to me this fix >> should be merged into the release branch. What do you say? > > The only in-tree user of BlockHasNoFallThrough appears to be > BranchFolding, > and there it's just guarding an optimization. > > 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 lauro.venancio at gmail.com Mon Sep 17 14:09:16 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Mon, 17 Sep 2007 19:09:16 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42044 - /llvm-gcc-4.0/trunk/configure.in Message-ID: <200709171909.l8HJ9Giw031685@zion.cs.uiuc.edu> Author: laurov Date: Mon Sep 17 14:09:15 2007 New Revision: 42044 URL: http://llvm.org/viewvc/llvm-project?rev=42044&view=rev Log: Readd. 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=42044&r1=42043&r2=42044&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/configure.in (original) +++ llvm-gcc-4.0/trunk/configure.in Mon Sep 17 14:09:15 2007 @@ -478,6 +478,10 @@ 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" ;; From lauro.venancio at gmail.com Mon Sep 17 14:09:52 2007 From: lauro.venancio at gmail.com (Lauro Ramos Venancio) Date: Mon, 17 Sep 2007 19:09:52 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42045 - /llvm-gcc-4.0/trunk/configure Message-ID: <200709171909.l8HJ9riY031728@zion.cs.uiuc.edu> Author: laurov Date: Mon Sep 17 14:09:51 2007 New Revision: 42045 URL: http://llvm.org/viewvc/llvm-project?rev=42045&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=42045&r1=42044&r2=42045&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/configure (original) +++ llvm-gcc-4.0/trunk/configure Mon Sep 17 14:09:51 2007 @@ -1269,6 +1269,10 @@ 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" ;; @@ -1812,7 +1816,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:1816: checking for $ac_word" >&5 +echo "configure:1820: 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 @@ -1842,7 +1846,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:1846: checking for $ac_word" >&5 +echo "configure:1850: 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 @@ -1893,7 +1897,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:1897: checking for $ac_word" >&5 +echo "configure:1901: 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 @@ -1925,7 +1929,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1929: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1933: 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. @@ -1936,12 +1940,12 @@ cat > conftest.$ac_ext << EOF -#line 1940 "configure" +#line 1944 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1949: \"$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 @@ -1967,12 +1971,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:1971: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1975: 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:1976: checking whether we are using GNU C" >&5 +echo "configure:1980: 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 @@ -1981,7 +1985,7 @@ yes; #endif EOF -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 +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 ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -2000,7 +2004,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:2004: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:2008: 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 @@ -2067,7 +2071,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:2071: checking for $ac_word" >&5 +echo "configure:2075: 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 @@ -2099,7 +2103,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:2103: checking for $ac_word" >&5 +echo "configure:2107: 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 @@ -2132,7 +2136,7 @@ fi echo $ac_n "checking whether compiler driver understands Ada""... $ac_c" 1>&6 -echo "configure:2136: checking whether compiler driver understands Ada" >&5 +echo "configure:2140: 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 @@ -2164,7 +2168,7 @@ fi echo $ac_n "checking how to compare bootstrapped objects""... $ac_c" 1>&6 -echo "configure:2168: checking how to compare bootstrapped objects" >&5 +echo "configure:2172: 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 @@ -2262,9 +2266,9 @@ CFLAGS="$CFLAGS $gmpinc" # Check GMP actually works echo $ac_n "checking for correct version of gmp.h""... $ac_c" 1>&6 -echo "configure:2266: checking for correct version of gmp.h" >&5 +echo "configure:2270: checking for correct version of gmp.h" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2288,12 +2292,12 @@ if test x"$have_gmp" = xyes; then echo $ac_n "checking for MPFR""... $ac_c" 1>&6 -echo "configure:2292: checking for MPFR" >&5 +echo "configure:2296: checking for MPFR" >&5 saved_LIBS="$LIBS" LIBS="$LIBS $gmplibs" cat > conftest.$ac_ext < #include @@ -2301,7 +2305,7 @@ mpfr_t n; mpfr_init(n); ; return 0; } EOF -if { (eval echo configure:2305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2309: \"$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 @@ -2788,7 +2792,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:2792: checking for $ac_word" >&5 +echo "configure:2796: 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 @@ -2823,7 +2827,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:2827: checking for $ac_word" >&5 +echo "configure:2831: 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 @@ -2858,7 +2862,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:2862: checking for $ac_word" >&5 +echo "configure:2866: 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 @@ -2893,7 +2897,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:2897: checking for $ac_word" >&5 +echo "configure:2901: 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 @@ -2928,7 +2932,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:2932: checking for $ac_word" >&5 +echo "configure:2936: 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 @@ -2963,7 +2967,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:2967: checking for $ac_word" >&5 +echo "configure:2971: 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 @@ -3610,7 +3614,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:3614: checking for $ac_word" >&5 +echo "configure:3618: 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 @@ -3643,7 +3647,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:3647: checking for $ac_word" >&5 +echo "configure:3651: 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 @@ -3682,7 +3686,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:3686: checking for $ac_word" >&5 +echo "configure:3690: 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 @@ -3715,7 +3719,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:3719: checking for $ac_word" >&5 +echo "configure:3723: 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 @@ -3754,7 +3758,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:3758: checking for $ac_word" >&5 +echo "configure:3762: 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 @@ -3787,7 +3791,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:3791: checking for $ac_word" >&5 +echo "configure:3795: 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 @@ -3826,7 +3830,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:3830: checking for $ac_word" >&5 +echo "configure:3834: 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 @@ -3859,7 +3863,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:3863: checking for $ac_word" >&5 +echo "configure:3867: 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 @@ -3898,7 +3902,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:3902: checking for $ac_word" >&5 +echo "configure:3906: 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 @@ -3931,7 +3935,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:3935: checking for $ac_word" >&5 +echo "configure:3939: 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 @@ -3970,7 +3974,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:3974: checking for $ac_word" >&5 +echo "configure:3978: 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 @@ -4003,7 +4007,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:4007: checking for $ac_word" >&5 +echo "configure:4011: 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 @@ -4042,7 +4046,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:4046: checking for $ac_word" >&5 +echo "configure:4050: 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 @@ -4075,7 +4079,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:4079: checking for $ac_word" >&5 +echo "configure:4083: 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 @@ -4114,7 +4118,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:4118: checking for $ac_word" >&5 +echo "configure:4122: 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 @@ -4147,7 +4151,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:4151: checking for $ac_word" >&5 +echo "configure:4155: 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 @@ -4186,7 +4190,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:4190: checking for $ac_word" >&5 +echo "configure:4194: 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 @@ -4219,7 +4223,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:4223: checking for $ac_word" >&5 +echo "configure:4227: 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 @@ -4265,7 +4269,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:4269: checking for $ac_word" >&5 +echo "configure:4273: 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 @@ -4298,7 +4302,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:4302: checking for $ac_word" >&5 +echo "configure:4306: 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 @@ -4337,7 +4341,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:4341: checking for $ac_word" >&5 +echo "configure:4345: 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 @@ -4370,7 +4374,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:4374: checking for $ac_word" >&5 +echo "configure:4378: 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 @@ -4409,7 +4413,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:4413: checking for $ac_word" >&5 +echo "configure:4417: 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 @@ -4442,7 +4446,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:4446: checking for $ac_word" >&5 +echo "configure:4450: 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 @@ -4481,7 +4485,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:4485: checking for $ac_word" >&5 +echo "configure:4489: 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 @@ -4514,7 +4518,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:4518: checking for $ac_word" >&5 +echo "configure:4522: 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 @@ -4553,7 +4557,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:4557: checking for $ac_word" >&5 +echo "configure:4561: 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 @@ -4586,7 +4590,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:4590: checking for $ac_word" >&5 +echo "configure:4594: 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 @@ -4625,7 +4629,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:4629: checking for $ac_word" >&5 +echo "configure:4633: 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 @@ -4658,7 +4662,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:4662: checking for $ac_word" >&5 +echo "configure:4666: 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 @@ -4697,7 +4701,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:4701: checking for $ac_word" >&5 +echo "configure:4705: 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 @@ -4730,7 +4734,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:4734: checking for $ac_word" >&5 +echo "configure:4738: 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 @@ -4769,7 +4773,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:4773: checking for $ac_word" >&5 +echo "configure:4777: 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 @@ -4802,7 +4806,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:4806: checking for $ac_word" >&5 +echo "configure:4810: 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 @@ -4841,7 +4845,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:4845: checking for $ac_word" >&5 +echo "configure:4849: 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 @@ -4874,7 +4878,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:4878: checking for $ac_word" >&5 +echo "configure:4882: 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 @@ -4965,7 +4969,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:4969: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:4973: 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" @@ -5012,7 +5016,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:5016: checking if symbolic links between directories work" >&5 +echo "configure:5020: 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 dpatel at apple.com Mon Sep 17 15:03:03 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 17 Sep 2007 20:03:03 -0000 Subject: [llvm-commits] [llvm] r42047 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200709172003.l8HK33jC005180@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 17 15:03:03 2007 New Revision: 42047 URL: http://llvm.org/viewvc/llvm-project?rev=42047&view=rev Log: This is not ideal but unbreaks build failure. APInt::dump() is inside #ifndef NDEBUG, however SelectionDAG dump() routines are not. 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=42047&r1=42046&r2=42047&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Sep 17 15:03:03 2007 @@ -3720,7 +3720,9 @@ cerr << "<" << CSDN->getValueAPF().convertToDouble() << ">"; else { cerr << "getValueAPF().convertToAPInt().dump(); +#endif cerr << ")>"; } } else if (const GlobalAddressSDNode *GADN = From clattner at apple.com Mon Sep 17 15:06:33 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 17 Sep 2007 13:06:33 -0700 Subject: [llvm-commits] [llvm] r42047 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <200709172003.l8HK33jC005180@zion.cs.uiuc.edu> References: <200709172003.l8HK33jC005180@zion.cs.uiuc.edu> Message-ID: <1BADE138-4703-4EA7-8510-3642826D3F97@apple.com> On Sep 17, 2007, at 1:03 PM, Devang Patel wrote: > Author: dpatel > Date: Mon Sep 17 15:03:03 2007 > New Revision: 42047 > > URL: http://llvm.org/viewvc/llvm-project?rev=42047&view=rev > Log: > This is not ideal but unbreaks build failure. > APInt::dump() is inside #ifndef NDEBUG, however SelectionDAG dump() > routines are not. APInt::dump should be pulled out of the ifdef, it should be unconditionally available. -Chris > 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=42047&r1=42046&r2=42047&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Sep 17 > 15:03:03 2007 > @@ -3720,7 +3720,9 @@ > cerr << "<" << CSDN->getValueAPF().convertToDouble() << ">"; > else { > cerr << " +#ifndef NDEBUG > CSDN->getValueAPF().convertToAPInt().dump(); > +#endif > cerr << ")>"; > } > } else if (const GlobalAddressSDNode *GADN = > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dpatel at apple.com Mon Sep 17 15:07:41 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 17 Sep 2007 20:07:41 -0000 Subject: [llvm-commits] [llvm] r42048 - /llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Message-ID: <200709172007.l8HK7fZa005632@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 17 15:07:40 2007 New Revision: 42048 URL: http://llvm.org/viewvc/llvm-project?rev=42048&view=rev Log: Fix comment. Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Modified: llvm/trunk/lib/Transforms/Utils/InlineCost.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineCost.cpp?rev=42048&r1=42047&r2=42048&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineCost.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineCost.cpp Mon Sep 17 15:07:40 2007 @@ -96,7 +96,7 @@ unsigned NumInsts = 0, NumBlocks = 0; // Look at the size of the callee. Each basic block counts as 20 units, and - // each instruction counts as 10. + // each instruction counts as 5. for (Function::const_iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { for (BasicBlock::const_iterator II = BB->begin(), E = BB->end(); II != E; ++II) { From dalej at apple.com Mon Sep 17 15:15:38 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 17 Sep 2007 20:15:38 -0000 Subject: [llvm-commits] [llvm] r42049 - in /llvm/trunk/lib/Target/X86: X86FloatingPoint.cpp X86RegisterInfo.cpp Message-ID: <200709172015.l8HKFcWM006191@zion.cs.uiuc.edu> Author: johannes Date: Mon Sep 17 15:15:38 2007 New Revision: 42049 URL: http://llvm.org/viewvc/llvm-project?rev=42049&view=rev Log: Remove RSTRegClass case from loadRegFromStackSlot and storeRegToStackSlot. Evan and I concluded this should never be needed and it appears to be true. (It if is needed, adjustment would be needed for long double to work.) Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=42049&r1=42048&r2=42049&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Mon Sep 17 15:15:38 2007 @@ -608,7 +608,7 @@ // If we have one _and_ we don't want to pop the operand, duplicate the value // on the stack instead of moving it. This ensure that popping the value is // always ok. - // Ditto FISTTP16m, FISTTP32m, FISTTP64m. + // Ditto FISTTP16m, FISTTP32m, FISTTP64m, ST_FpP80m. // if (!KillsSrc && (MI->getOpcode() == X86::IST_Fp64m32 || Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=42049&r1=42048&r2=42049&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Mon Sep 17 15:15:38 2007 @@ -170,9 +170,7 @@ 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. + } else if (RC == &X86::RFP64RegClass) { Opc = X86::ST_Fp64m; } else if (RC == &X86::RFP32RegClass) { Opc = X86::ST_Fp32m; @@ -211,7 +209,7 @@ Opc = X86::MOV16_rm; } else if (RC == &X86::RFP80RegClass) { Opc = X86::LD_Fp80m; - } else if (RC == &X86::RFP64RegClass || RC == &X86::RSTRegClass) { + } else if (RC == &X86::RFP64RegClass) { Opc = X86::LD_Fp64m; } else if (RC == &X86::RFP32RegClass) { Opc = X86::LD_Fp32m; From gordonhenriksen at mac.com Mon Sep 17 15:30:04 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Mon, 17 Sep 2007 20:30:04 -0000 Subject: [llvm-commits] [llvm] r42051 - in /llvm/trunk: lib/VMCore/Verifier.cpp test/CodeGen/Generic/GC/lower_gcroot.ll test/Verifier/gcread-ptrptr.ll test/Verifier/gcroot-alloca.ll test/Verifier/gcroot-meta.ll test/Verifier/gcroot-ptrptr.ll test/Verifier/gcwrite-ptrptr.ll Message-ID: <200709172030.l8HKU4QG008512@zion.cs.uiuc.edu> Author: gordon Date: Mon Sep 17 15:30:04 2007 New Revision: 42051 URL: http://llvm.org/viewvc/llvm-project?rev=42051&view=rev Log: Fix for PR1633: Verifier doesn't fully verify GC intrinsics LLVM now enforces the following prototypes for the write barriers: * @llvm.gcread(*, **) void @llvm.gcwrite(*, *, **) And for @llvm.gcroot, the first stack slot is verified to be an alloca or a bitcast of an alloca. Fixes test/CodeGen/Generic/GC/lower_gcroot.ll, which violated these. Added: llvm/trunk/test/Verifier/gcread-ptrptr.ll llvm/trunk/test/Verifier/gcroot-alloca.ll llvm/trunk/test/Verifier/gcroot-meta.ll llvm/trunk/test/Verifier/gcroot-ptrptr.ll llvm/trunk/test/Verifier/gcwrite-ptrptr.ll Modified: llvm/trunk/lib/VMCore/Verifier.cpp llvm/trunk/test/CodeGen/Generic/GC/lower_gcroot.ll Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=42051&r1=42050&r2=42051&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Mon Sep 17 15:30:04 2007 @@ -1072,6 +1072,18 @@ InstsInThisBlock.insert(&I); } +static bool HasPtrPtrType(Value *Val) { + if (const PointerType *PtrTy = dyn_cast(Val->getType())) + return isa(PtrTy->getElementType()); + return false; +} + +static Value *StripBitCasts(Value *Val) { + if (BitCastInst *CI = dyn_cast(Val)) + return StripBitCasts(CI->getOperand(0)); + return Val; +} + /// visitIntrinsicFunction - Allow intrinsics to be verified in different ways. /// void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { @@ -1082,6 +1094,30 @@ #define GET_INTRINSIC_VERIFIER #include "llvm/Intrinsics.gen" #undef GET_INTRINSIC_VERIFIER + + switch (ID) { + default: + break; + case Intrinsic::gcroot: + Assert1(HasPtrPtrType(CI.getOperand(1)), + "llvm.gcroot parameter #1 must be a pointer to a pointer.", &CI); + Assert1(isa(StripBitCasts(CI.getOperand(1))), + "llvm.gcroot parameter #1 must be an alloca (or a bitcast).", &CI); + Assert1(isa(CI.getOperand(2)), + "llvm.gcroot parameter #2 must be a constant or global.", &CI); + break; + case Intrinsic::gcwrite: + Assert1(CI.getOperand(3)->getType() + == PointerType::get(CI.getOperand(1)->getType()), + "Call to llvm.gcwrite must be with type 'void (%ty*, %ty2*, %ty**)'.", + &CI); + break; + case Intrinsic::gcread: + Assert1(CI.getOperand(2)->getType() == PointerType::get(CI.getType()), + "Call to llvm.gcread must be with type '%ty* (%ty2*, %ty**).'", + &CI); + break; + } } /// VerifyIntrinsicPrototype - TableGen emits calls to this function into Modified: llvm/trunk/test/CodeGen/Generic/GC/lower_gcroot.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/GC/lower_gcroot.ll?rev=42051&r1=42050&r2=42051&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/Generic/GC/lower_gcroot.ll (original) +++ llvm/trunk/test/CodeGen/Generic/GC/lower_gcroot.ll Mon Sep 17 15:30:04 2007 @@ -3,7 +3,8 @@ %Env = type opaque* define void @.main(%Env) { - call void @llvm.gcroot( %Env* null, %Env null ) + %Root = alloca %Env + call void @llvm.gcroot( %Env* %Root, %Env null ) unreachable } Added: llvm/trunk/test/Verifier/gcread-ptrptr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/gcread-ptrptr.ll?rev=42051&view=auto ============================================================================== --- llvm/trunk/test/Verifier/gcread-ptrptr.ll (added) +++ llvm/trunk/test/Verifier/gcread-ptrptr.ll Mon Sep 17 15:30:04 2007 @@ -0,0 +1,13 @@ +; RUN: not llvm-as < %s +; PR1633 + +%meta = type { i8* } +%obj = type { %meta* } + +declare %obj* @llvm.gcread(%obj*, %obj*) + +define %obj* @f() { +entry: + %x = call %obj* @llvm.gcread(%obj* null, %obj* null) + ret %obj* %x +} Added: llvm/trunk/test/Verifier/gcroot-alloca.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/gcroot-alloca.ll?rev=42051&view=auto ============================================================================== --- llvm/trunk/test/Verifier/gcroot-alloca.ll (added) +++ llvm/trunk/test/Verifier/gcroot-alloca.ll Mon Sep 17 15:30:04 2007 @@ -0,0 +1,14 @@ +; RUN: not llvm-as < %s +; PR1633 + +%meta = type { i8* } +%obj = type { %meta* } + +declare void @llvm.gcroot(%obj**, %meta*) + +define void @f() { +entry: + call void @llvm.gcroot(%obj** null, %meta* null) + + ret void +} Added: llvm/trunk/test/Verifier/gcroot-meta.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/gcroot-meta.ll?rev=42051&view=auto ============================================================================== --- llvm/trunk/test/Verifier/gcroot-meta.ll (added) +++ llvm/trunk/test/Verifier/gcroot-meta.ll Mon Sep 17 15:30:04 2007 @@ -0,0 +1,16 @@ +; RUN: not llvm-as < %s +; PR1633 + +%meta = type { i8* } +%obj = type { %meta* } + +declare void @llvm.gcroot(%obj**, %meta*) + +define void @f() { +entry: + %local.obj = alloca %obj* + %local.meta = alloca %meta + call void @llvm.gcroot(%obj** %local.obj, %meta* %local.meta) + + ret void +} Added: llvm/trunk/test/Verifier/gcroot-ptrptr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/gcroot-ptrptr.ll?rev=42051&view=auto ============================================================================== --- llvm/trunk/test/Verifier/gcroot-ptrptr.ll (added) +++ llvm/trunk/test/Verifier/gcroot-ptrptr.ll Mon Sep 17 15:30:04 2007 @@ -0,0 +1,14 @@ +; RUN: not llvm-as < %s +; PR1633 + +%meta = type { i8* } +%obj = type { %meta* } + +declare void @llvm.gcroot(%obj*, %meta*) + +define void @f() { +entry: + %local.obj = alloca %obj + call void @llvm.gcroot(%obj* %local.obj, %meta* null) + ret void +} Added: llvm/trunk/test/Verifier/gcwrite-ptrptr.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/gcwrite-ptrptr.ll?rev=42051&view=auto ============================================================================== --- llvm/trunk/test/Verifier/gcwrite-ptrptr.ll (added) +++ llvm/trunk/test/Verifier/gcwrite-ptrptr.ll Mon Sep 17 15:30:04 2007 @@ -0,0 +1,13 @@ +; RUN: not llvm-as < %s +; PR1633 + +%meta = type { i8* } +%obj = type { %meta* } + +declare void @llvm.gcwrite(%obj*, %obj*, %obj*) + +define void @f() { +entry: + call void @llvm.gcwrite(%obj* null, %obj* null, %obj* null) + ret void +} From tonic at nondot.org Mon Sep 17 15:36:18 2007 From: tonic at nondot.org (Tanya Lattner) Date: Mon, 17 Sep 2007 20:36:18 -0000 Subject: [llvm-commits] [llvm] r42052 - /llvm/branches/release_21/tools/opt/opt.cpp Message-ID: <200709172036.l8HKaIWi018464@zion.cs.uiuc.edu> Author: tbrethou Date: Mon Sep 17 15:36:17 2007 New Revision: 42052 URL: http://llvm.org/viewvc/llvm-project?rev=42052&view=rev Log: Disable LoopIndexSplitting for 2.1 Modified: llvm/branches/release_21/tools/opt/opt.cpp Modified: llvm/branches/release_21/tools/opt/opt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/tools/opt/opt.cpp?rev=42052&r1=42051&r2=42052&view=diff ============================================================================== --- llvm/branches/release_21/tools/opt/opt.cpp (original) +++ llvm/branches/release_21/tools/opt/opt.cpp Mon Sep 17 15:36:17 2007 @@ -277,7 +277,8 @@ addPass(PM, createLoopRotatePass()); addPass(PM, createLICMPass()); // Hoist loop invariants addPass(PM, createLoopUnswitchPass()); // Unswitch loops. - addPass(PM, createLoopIndexSplitPass()); // Index split loops. + // Diable for 2.1 + //addPass(PM, createLoopIndexSplitPass()); // Index split loops. addPass(PM, createInstructionCombiningPass()); // Clean up after LICM/reassoc addPass(PM, createIndVarSimplifyPass()); // Canonicalize indvars addPass(PM, createLoopUnrollPass()); // Unroll small loops From tonic at nondot.org Mon Sep 17 15:37:09 2007 From: tonic at nondot.org (Tanya Lattner) Date: Mon, 17 Sep 2007 20:37:09 -0000 Subject: [llvm-commits] [llvm] r42053 - /llvm/branches/release_21/tools/opt/opt.cpp Message-ID: <200709172037.l8HKb9uk018502@zion.cs.uiuc.edu> Author: tbrethou Date: Mon Sep 17 15:37:09 2007 New Revision: 42053 URL: http://llvm.org/viewvc/llvm-project?rev=42053&view=rev Log: Spell things correctly. Modified: llvm/branches/release_21/tools/opt/opt.cpp Modified: llvm/branches/release_21/tools/opt/opt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/tools/opt/opt.cpp?rev=42053&r1=42052&r2=42053&view=diff ============================================================================== --- llvm/branches/release_21/tools/opt/opt.cpp (original) +++ llvm/branches/release_21/tools/opt/opt.cpp Mon Sep 17 15:37:09 2007 @@ -277,7 +277,7 @@ addPass(PM, createLoopRotatePass()); addPass(PM, createLICMPass()); // Hoist loop invariants addPass(PM, createLoopUnswitchPass()); // Unswitch loops. - // Diable for 2.1 + // Disable for 2.1 //addPass(PM, createLoopIndexSplitPass()); // Index split loops. addPass(PM, createInstructionCombiningPass()); // Clean up after LICM/reassoc addPass(PM, createIndVarSimplifyPass()); // Canonicalize indvars From dpatel at apple.com Mon Sep 17 15:39:49 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 17 Sep 2007 20:39:49 -0000 Subject: [llvm-commits] [llvm] r42054 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709172039.l8HKdnFL018680@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 17 15:39:48 2007 New Revision: 42054 URL: http://llvm.org/viewvc/llvm-project?rev=42054&view=rev Log: Skeleton for transformations to truncate loop's iteration space. 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=42054&r1=42053&r2=42054&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Sep 17 15:39:48 2007 @@ -111,7 +111,14 @@ /// instruction then loop body is executed only for one iteration. In /// such case eliminate loop structure surrounding this loop body. For bool processOneIterationLoop(SplitInfo &SD); - + + void updateLoopBounds(ICmpInst *CI); + /// updateLoopIterationSpace - Current loop body is covered by an AND + /// instruction whose operands compares induction variables with loop + /// invariants. If possible, hoist this check outside the loop by + /// updating appropriate start and end values for induction variable. + bool updateLoopIterationSpace(SplitInfo &SD); + /// If loop header includes loop variant instruction operands then /// this loop may not be eliminated. bool safeHeader(SplitInfo &SD, BasicBlock *BB); @@ -229,7 +236,19 @@ E = SplitData.end(); SI != E;) { SplitInfo &SD = *SI; ICmpInst *CI = dyn_cast(SD.SplitCondition); - if (CI && CI->getPredicate() == ICmpInst::ICMP_EQ) { + if (SD.SplitCondition->getOpcode() == Instruction::And) { + Changed = updateLoopIterationSpace(SD); + if (Changed) { + ++NumIndexSplit; + // If is loop is eliminated then nothing else to do here. + return Changed; + } else { + SmallVector::iterator Delete_SI = SI; + ++SI; + SplitData.erase(Delete_SI); + } + } + else if (CI && CI->getPredicate() == ICmpInst::ICMP_EQ) { Changed = processOneIterationLoop(SD); if (Changed) { ++NumIndexSplit; @@ -391,6 +410,25 @@ if (BR->isUnconditional()) continue; + if (Instruction *AndI = dyn_cast(BR->getCondition())) { + if (AndI->getOpcode() == Instruction::And) { + ICmpInst *Op0 = dyn_cast(AndI->getOperand(0)); + ICmpInst *Op1 = dyn_cast(AndI->getOperand(1)); + + if (!Op0 || !Op1) + continue; + + if (!safeICmpInst(Op0, SD)) + continue; + SD.clear(); + if (!safeICmpInst(Op1, SD)) + continue; + SD.clear(); + SD.SplitCondition = AndI; + SplitData.push_back(SD); + continue; + } + } ICmpInst *CI = dyn_cast(BR->getCondition()); if (!CI || CI == ExitCondition) continue; @@ -662,6 +700,164 @@ return true; } +void LoopIndexSplit::updateLoopBounds(ICmpInst *CI) { + + Value *V0 = CI->getOperand(0); + Value *V1 = CI->getOperand(1); + Value *NV = NULL; + + SCEVHandle SH0 = SE->getSCEV(V0); + + if (SH0->isLoopInvariant(L)) + NV = V0; + else + NV = V1; + + switch (CI->getPredicate()) { + case ICmpInst::ICMP_ULE: + case ICmpInst::ICMP_SLE: + // for (i = LB; i < UB; ++i) + // if (i <= NV && ...) + // LOOP_BODY + // + // is transformed into + // NUB = min (NV+1, UB) + // for (i = LB; i < NUB ; ++i) + // LOOP_BODY + // + + + + // for (i = LB; i <= UB; ++i) + // if (i <= NV && ...) + // LOOP_BODY + // + // is transformed into + // NUB = min (NV, UB) + // for (i = LB; i <= NUB ; ++i) + // LOOP_BODY + // + break; + case ICmpInst::ICMP_ULT: + case ICmpInst::ICMP_SLT: + // for (i = LB; i < UB; ++i) + // if (i < NV && ...) + // LOOP_BODY + // + // is transformed into + // NUB = min (NV, UB) + // for (i = LB; i < NUB ; ++i) + // LOOP_BODY + // + + + + // for (i = LB; i <= UB; ++i) + // if (i < NV && ...) + // LOOP_BODY + // + // is transformed into + // NUB = min (NV -1 , UB) + // for (i = LB; i <= NUB ; ++i) + // LOOP_BODY + // + break; + case ICmpInst::ICMP_UGE: + case ICmpInst::ICMP_SGE: + // for (i = LB; i (< or <=) UB; ++i) + // if (i >= NV && ...) + // LOOP_BODY + // + // is transformed into + // NLB = max (NV, LB) + // for (i = NLB; i (< or <=) UB ; ++i) + // LOOP_BODY + // + break; + case ICmpInst::ICMP_UGT: + case ICmpInst::ICMP_SGT: + // for (i = LB; i (< or <=) UB; ++i) + // if (i > NV && ...) + // LOOP_BODY + // + // is transformed into + // NLB = max (NV+1, LB) + // for (i = NLB; i (< or <=) UB ; ++i) + // LOOP_BODY + // + break; + default: + assert ( 0 && "Unexpected split condition predicate"); + } +} +/// updateLoopIterationSpace - Current loop body is covered by an AND +/// instruction whose operands compares induction variables with loop +/// invariants. If possible, hoist this check outside the loop by +/// updating appropriate start and end values for induction variable. +bool LoopIndexSplit::updateLoopIterationSpace(SplitInfo &SD) { + BasicBlock *Header = L->getHeader(); + ICmpInst *Op0 = cast(SD.SplitCondition->getOperand(0)); + ICmpInst *Op1 = cast(SD.SplitCondition->getOperand(1)); + + if (Op0->getPredicate() == ICmpInst::ICMP_EQ + || Op0->getPredicate() == ICmpInst::ICMP_NE + || Op0->getPredicate() == ICmpInst::ICMP_EQ + || Op0->getPredicate() == ICmpInst::ICMP_NE) + return false; + + // Check if SplitCondition dominates entire loop body + // or not. + + // If SplitCondition is not in loop header then this loop is not suitable + // for this transformation. + if (SD.SplitCondition->getParent() != Header) + return false; + + // If loop header includes loop variant instruction operands then + // this loop may not be eliminated. + Instruction *Terminator = Header->getTerminator(); + for(BasicBlock::iterator BI = Header->begin(), BE = Header->end(); + BI != BE; ++BI) { + Instruction *I = BI; + + // PHI Nodes are OK. + if (isa(I)) + continue; + + // SplitCondition itself is OK. + if (I == SD.SplitCondition) + continue; + if (I == Op0 || I == Op1) + continue; + + // Induction variable is OK. + if (I == IndVar) + continue; + + // Induction variable increment is OK. + if (I == IndVarIncrement) + continue; + + // Terminator is also harmless. + if (I == Terminator) + continue; + + // Otherwise we have a instruction that may not be safe. + return false; + } + + // If Exiting block includes loop variant instructions then this + // loop may not be eliminated. + if (!safeExitingBlock(SD, ExitCondition->getParent())) + return false; + + updateLoopBounds(Op0); + updateLoopBounds(Op1); + // Update CFG + return true; +} + + /// removeBlocks - Remove basic block DeadBB and all blocks dominated by DeadBB. /// This routine is used to remove split condition's dead branch, dominated by /// DeadBB. LiveBB dominates split conidition's other branch. From dalej at apple.com Mon Sep 17 15:58:23 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 17 Sep 2007 13:58:23 -0700 Subject: [llvm-commits] x86 long double coming Message-ID: I think this has come far enough that I can turn the switch in llvm- gcc that makes long doubles 80 bits on x86. There are probably bugs, but quite a few things work, including all the long doubles in the test suite. This is an ABI change, so I'm giving notice. I'm planning to do this sometime tomorrow morning California time, say 20 hours from now. Let me know if you have objections. From dpatel at apple.com Mon Sep 17 16:01:05 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 17 Sep 2007 21:01:05 -0000 Subject: [llvm-commits] [llvm] r42058 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709172101.l8HL15st021582@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 17 16:01:05 2007 New Revision: 42058 URL: http://llvm.org/viewvc/llvm-project?rev=42058&view=rev Log: Do not eliminate loop when it is invalid to do so. For example, for(int i = 0; i < N; i++) { if ( i == XYZ) { A; else B; } C; D; } 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=42058&r1=42057&r2=42058&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Mon Sep 17 16:01:05 2007 @@ -528,6 +528,20 @@ if (!safeExitingBlock(SD, ExitCondition->getParent())) return false; + // If split condition is not safe then do not process this loop. + // For example, + // for(int i = 0; i < N; i++) { + // if ( i == XYZ) { + // A; + // else + // B; + // } + // C; + // D; + // } + if (!safeSplitCondition(SD)) + return false; + // Update CFG. // Replace index variable with split value in loop body. Loop body is executed @@ -956,24 +970,11 @@ bool LoopIndexSplit::safeSplitCondition(SplitInfo &SD) { BasicBlock *SplitCondBlock = SD.SplitCondition->getParent(); - - // Unable to handle triange loops at the moment. - // In triangle loop, split condition is in header and one of the - // the split destination is loop latch. If split condition is EQ - // then such loops are already handle in processOneIterationLoop(). - BasicBlock *Latch = L->getLoopLatch(); + BasicBlock *Latch = L->getLoopLatch(); BranchInst *SplitTerminator = cast(SplitCondBlock->getTerminator()); BasicBlock *Succ0 = SplitTerminator->getSuccessor(0); BasicBlock *Succ1 = SplitTerminator->getSuccessor(1); - if (L->getHeader() == SplitCondBlock - && (Latch == Succ0 || Latch == Succ1)) - return false; - - // If split condition branches heads do not have single predecessor, - // SplitCondBlock, then is not possible to remove inactive branch. - if (!Succ0->getSinglePredecessor() || !Succ1->getSinglePredecessor()) - return false; // Finally this split condition is safe only if merge point for // split condition branch is loop latch. This check along with previous @@ -1196,6 +1197,26 @@ if (!safeSplitCondition(SD)) return false; + BasicBlock *SplitCondBlock = SD.SplitCondition->getParent(); + + // Unable to handle triange loops at the moment. + // In triangle loop, split condition is in header and one of the + // the split destination is loop latch. If split condition is EQ + // then such loops are already handle in processOneIterationLoop(). + BasicBlock *Latch = L->getLoopLatch(); + BranchInst *SplitTerminator = + cast(SplitCondBlock->getTerminator()); + BasicBlock *Succ0 = SplitTerminator->getSuccessor(0); + BasicBlock *Succ1 = SplitTerminator->getSuccessor(1); + if (L->getHeader() == SplitCondBlock + && (Latch == Succ0 || Latch == Succ1)) + return false; + + // If split condition branches heads do not have single predecessor, + // SplitCondBlock, then is not possible to remove inactive branch. + if (!Succ0->getSinglePredecessor() || !Succ1->getSinglePredecessor()) + return false; + // After loop is cloned there are two loops. // // First loop, referred as ALoop, executes first part of loop's iteration From tonic at nondot.org Mon Sep 17 16:36:59 2007 From: tonic at nondot.org (Tanya Lattner) Date: Mon, 17 Sep 2007 21:36:59 -0000 Subject: [llvm-commits] [llvm] r42064 - /llvm/branches/release_21/autoconf/m4/libtool.m4 Message-ID: <200709172136.l8HLax9H026610@zion.cs.uiuc.edu> Author: tbrethou Date: Mon Sep 17 16:36:59 2007 New Revision: 42064 URL: http://llvm.org/viewvc/llvm-project?rev=42064&view=rev Log: Fix incorrect default values in help string. Modified: llvm/branches/release_21/autoconf/m4/libtool.m4 Modified: llvm/branches/release_21/autoconf/m4/libtool.m4 URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/autoconf/m4/libtool.m4?rev=42064&r1=42063&r2=42064&view=diff ============================================================================== --- llvm/branches/release_21/autoconf/m4/libtool.m4 (original) +++ llvm/branches/release_21/autoconf/m4/libtool.m4 Mon Sep 17 16:36:59 2007 @@ -1905,7 +1905,7 @@ AC_DEFUN([AC_ENABLE_SHARED], [define([enable_shared_default], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],[build shared libraries @<:@default=enable_shared_default@:>@])], + AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],[build shared libraries @<:@default=enable_shared_default@:>@]), [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; @@ -1943,7 +1943,7 @@ AC_DEFUN([AC_ENABLE_STATIC], [define([enable_static_default], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],[build static libraries @<:@default=enable_static_default@:>@])], + AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],[build static libraries @<:@default=enable_static_default@:>@]), [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; @@ -1981,7 +1981,7 @@ AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([enable_Fast_install_default], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],[optimize for fast installation @<:@default=enable_Fast_install_default@:>@])], + AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],[optimize for fast installation @<:@default=enable_Fast_install_default@:>@]), [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; From tonic at nondot.org Mon Sep 17 16:37:52 2007 From: tonic at nondot.org (Tanya Lattner) Date: Mon, 17 Sep 2007 21:37:52 -0000 Subject: [llvm-commits] [llvm] r42065 - /llvm/branches/release_21/configure Message-ID: <200709172137.l8HLbruR026971@zion.cs.uiuc.edu> Author: tbrethou Date: Mon Sep 17 16:37:52 2007 New Revision: 42065 URL: http://llvm.org/viewvc/llvm-project?rev=42065&view=rev Log: Regenerated configure script to fix help strings. Modified: llvm/branches/release_21/configure Modified: llvm/branches/release_21/configure URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/configure?rev=42065&r1=42064&r2=42065&view=diff ============================================================================== --- llvm/branches/release_21/configure (original) +++ llvm/branches/release_21/configure Mon Sep 17 16:37:52 2007 @@ -1542,12 +1542,12 @@ %a (default is YES) --enable-ltdl-install install libltdl --enable-shared[=PKGS] build shared libraries - [default=enable_shared_default] + [default=yes] --enable-static[=PKGS] build static libraries - [default=enable_static_default] + [default=yes] --enable-fast-install[=PKGS] optimize for fast installation - [default=enable_Fast_install_default] + [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: From tonic at nondot.org Mon Sep 17 16:41:15 2007 From: tonic at nondot.org (Tanya Lattner) Date: Mon, 17 Sep 2007 21:41:15 -0000 Subject: [llvm-commits] [llvm] r42066 - in /llvm/trunk: autoconf/m4/libtool.m4 configure Message-ID: <200709172141.l8HLfFg8027609@zion.cs.uiuc.edu> Author: tbrethou Date: Mon Sep 17 16:41:15 2007 New Revision: 42066 URL: http://llvm.org/viewvc/llvm-project?rev=42066&view=rev Log: Fix broken default help strings for enable-shared, enable-static, and enable-fast-install. Regenerate configure script. Modified: llvm/trunk/autoconf/m4/libtool.m4 llvm/trunk/configure Modified: llvm/trunk/autoconf/m4/libtool.m4 URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/m4/libtool.m4?rev=42066&r1=42065&r2=42066&view=diff ============================================================================== --- llvm/trunk/autoconf/m4/libtool.m4 (original) +++ llvm/trunk/autoconf/m4/libtool.m4 Mon Sep 17 16:41:15 2007 @@ -1905,7 +1905,7 @@ AC_DEFUN([AC_ENABLE_SHARED], [define([enable_shared_default], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],[build shared libraries @<:@default=enable_shared_default@:>@])], + AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],[build shared libraries @<:@default=enable_shared_default@:>@]), [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; @@ -1943,7 +1943,7 @@ AC_DEFUN([AC_ENABLE_STATIC], [define([enable_static_default], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],[build static libraries @<:@default=enable_static_default@:>@])], + AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],[build static libraries @<:@default=enable_static_default@:>@]), [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; @@ -1981,7 +1981,7 @@ AC_DEFUN([AC_ENABLE_FAST_INSTALL], [define([enable_Fast_install_default], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],[optimize for fast installation @<:@default=enable_Fast_install_default@:>@])], + AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],[optimize for fast installation @<:@default=enable_Fast_install_default@:>@]), [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=42066&r1=42065&r2=42066&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Mon Sep 17 16:41:15 2007 @@ -1542,12 +1542,12 @@ %a (default is YES) --enable-ltdl-install install libltdl --enable-shared[=PKGS] build shared libraries - [default=enable_shared_default] + [default=yes] --enable-static[=PKGS] build static libraries - [default=enable_static_default] + [default=yes] --enable-fast-install[=PKGS] optimize for fast installation - [default=enable_Fast_install_default] + [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) Optional Packages: From dpatel at apple.com Mon Sep 17 17:24:01 2007 From: dpatel at apple.com (Devang Patel) Date: Mon, 17 Sep 2007 22:24:01 -0000 Subject: [llvm-commits] [llvm] r42068 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Support/APInt.cpp Message-ID: <200709172224.l8HMO1g9030208@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 17 17:24:00 2007 New Revision: 42068 URL: http://llvm.org/viewvc/llvm-project?rev=42068&view=rev Log: Do not hide APInt::dump() inside #ifndef NDEBUG. Modified: llvm/trunk/include/llvm/ADT/APInt.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Support/APInt.cpp Modified: llvm/trunk/include/llvm/ADT/APInt.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=42068&r1=42067&r2=42068&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APInt.h (original) +++ llvm/trunk/include/llvm/ADT/APInt.h Mon Sep 17 17:24:00 2007 @@ -1160,10 +1160,8 @@ static void tcSetLeastSignificantBits(integerPart *, unsigned int, unsigned int bits); -#ifndef NDEBUG /// @brief debug method void dump() const; -#endif /// @} }; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=42068&r1=42067&r2=42068&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Sep 17 17:24:00 2007 @@ -3720,9 +3720,7 @@ cerr << "<" << CSDN->getValueAPF().convertToDouble() << ">"; else { cerr << "getValueAPF().convertToAPInt().dump(); -#endif cerr << ")>"; } } else if (const GlobalAddressSDNode *GADN = Modified: llvm/trunk/lib/Support/APInt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=42068&r1=42067&r2=42068&view=diff ============================================================================== --- llvm/trunk/lib/Support/APInt.cpp (original) +++ llvm/trunk/lib/Support/APInt.cpp Mon Sep 17 17:24:00 2007 @@ -21,9 +21,7 @@ #include #include #include -#ifndef NDEBUG #include -#endif using namespace llvm; @@ -1999,7 +1997,6 @@ return result; } -#ifndef NDEBUG void APInt::dump() const { cerr << "APInt(" << BitWidth << ")=" << std::setbase(16); @@ -2011,7 +2008,6 @@ cerr << " U(" << this->toStringUnsigned(10) << ") S(" << this->toStringSigned(10) << ")" << std::setbase(10); } -#endif // This implements a variety of operations on a representation of // arbitrary precision, two's-complement, bignum integer values. From evan.cheng at apple.com Mon Sep 17 17:26:41 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 17 Sep 2007 22:26:41 -0000 Subject: [llvm-commits] [llvm] r42069 - /llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200709172226.l8HMQflf030402@zion.cs.uiuc.edu> Author: evancheng Date: Mon Sep 17 17:26:41 2007 New Revision: 42069 URL: http://llvm.org/viewvc/llvm-project?rev=42069&view=rev Log: Bug fix and minor clean up of generated code. 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=42069&r1=42068&r2=42069&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Mon Sep 17 17:26:41 2007 @@ -2649,7 +2649,6 @@ /// we actually have to build a DAG! std::vector 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(). @@ -2867,7 +2866,7 @@ if ((!OperandNode->isSubClassOf("PredicateOperand") && !OperandNode->isSubClassOf("OptionalDefOperand")) || ISE.getDefaultOperand(OperandNode).DefaultOps.empty()) { - Ops = EmitResultCode(N->getChild(ChildNo), DstRegs, RetSelected, + Ops = EmitResultCode(N->getChild(ChildNo), DstRegs, InFlagDecled, ResNodeDecled); AllOps.insert(AllOps.end(), Ops.begin(), Ops.end()); ++ChildNo; @@ -2877,7 +2876,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], DstRegs, RetSelected, + Ops = EmitResultCode(DefaultOp.DefaultOps[i], DstRegs, InFlagDecled, ResNodeDecled); AllOps.insert(AllOps.end(), Ops.begin(), Ops.end()); NumEAInputs += Ops.size(); @@ -3039,11 +3038,11 @@ if (NodeHasOutFlag) { if (!InFlagDecled) { emitCode("SDOperand InFlag(ResNode, " + - utostr(NumResults+NumDstRegs+(unsigned)NodeHasChain) + ");"); + utostr(NumResults+NumDstRegs+(unsigned)NodeHasChain) + ");"); InFlagDecled = true; } else emitCode("InFlag = SDOperand(ResNode, " + - utostr(NumResults+NumDstRegs+(unsigned)NodeHasChain) + ");"); + utostr(NumResults+NumDstRegs+(unsigned)NodeHasChain) + ");"); } if (FoldedChains.size() > 0) { @@ -3058,20 +3057,15 @@ if (NodeHasOutFlag) { emitCode("ReplaceUses(SDOperand(N.Val, " + - utostr(NumPatResults + (unsigned)InputHasChain) +"), InFlag);"); + utostr(NumPatResults + (unsigned)InputHasChain) + +"), InFlag);"); NeedReplace = true; } - if (NeedReplace) { - 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(NumPatResults) + "), SDOperand(" + ChainName + ".Val, " - + ChainName + ".ResNo" + "));"); - } else - RetSelected = true; + if (NeedReplace && InputHasChain) + emitCode("ReplaceUses(SDOperand(N.Val, " + + utostr(NumPatResults) + "), SDOperand(" + ChainName + + ".Val, " + ChainName + ".ResNo" + "));"); // User does not expect the instruction would produce a chain! if ((!InputHasChain && NodeHasChain) && NodeHasOutFlag) { @@ -3081,18 +3075,11 @@ if (NodeHasOutFlag) emitCode("ReplaceUses(SDOperand(N.Val, " + utostr(NumPatResults+1) + "), SDOperand(ResNode, N.ResNo-1));"); - for (unsigned i = 0; i < NumPatResults; ++i) - emitCode("ReplaceUses(SDOperand(N.Val, " + utostr(i) + - "), SDOperand(ResNode, " + utostr(i) + "));"); emitCode("ReplaceUses(SDOperand(N.Val, " + utostr(NumPatResults) + "), " + ChainName + ");"); - RetSelected = false; } - if (RetSelected) - emitCode("return ResNode;"); - else - emitCode("return NULL;"); + emitCode("return ResNode;"); } else { std::string Code = "return CurDAG->SelectNodeTo(N.Val, Opc" + utostr(OpcNo); @@ -3133,7 +3120,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), DstRegs, RetSelected, InFlagDecled, + EmitResultCode(N->getChild(0), DstRegs, InFlagDecled, ResNodeDecled, true); unsigned ResNo = TmpNo++; emitCode("SDOperand Tmp" + utostr(ResNo) + " = Transform_" + Op->getName() @@ -3300,7 +3287,7 @@ } while (Emitter.InsertOneTypeCheck(Pat, Pattern.getSrcPattern(), "N", true)); Emitter.EmitResultCode(Pattern.getDstPattern(), Pattern.getDstRegs(), - false, false, false, false, true); + false, false, false, true); delete Pat; } @@ -3957,9 +3944,11 @@ OS << " RemoveKilled();\n"; OS << "}\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 << " unsigned FNumVals = F->getNumValues();\n"; + OS << " unsigned TNumVals = T->getNumValues();\n"; + OS << " if (FNumVals != TNumVals) {\n"; + OS << " for (unsigned i = 0, e = std::min(FNumVals, TNumVals); " + << "i < e; ++i)\n"; OS << " CurDAG->ReplaceAllUsesOfValueWith(SDOperand(F, i), " << "SDOperand(T, i), ISelKilled);\n"; OS << " } else {\n"; From isanbard at gmail.com Mon Sep 17 17:35:16 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 17 Sep 2007 15:35:16 -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: <200709171059.54888.baldrick@free.fr> References: <200709121855.l8CItFuU000417@zion.cs.uiuc.edu> <200709151600.40230.baldrick@free.fr> <200709171059.54888.baldrick@free.fr> Message-ID: <16e5fdf90709171535i6150d80ah452f54ab897289c3@mail.gmail.com> Hi Duncan (et al), > I've CC'd Anton since he's the one who knows all about this stuff. Presumably > when A is an alias for B there are two cases: either this is a "weak alias" or > weakref, meaning that at link time it may turn out that A wasn't an alias for > B after all, or A is a strong alias (a term I just invented) for B, meaning that > this is definitive: you can replace uses of A with uses of B everywhere. In the > first case linker support is required, but not in the second case, so presumably > it is wrong to turn off alias support in the second case. I don't know if your > patch turned this second case off or not. > > In the first case (weakrefs) we output a special declaration to the bitcode > saying that A is a weak alias for B. I think it is a mistake not to output > this even for platforms like Darwin that don't handle weakrefs: such aliases > may be resolvable by LLVM, for example when linking modules using llvm-link. > Think also of running bitcode under lli. Thus there are some cases in which > weakrefs can work correctly even on Darwin. > > Instead, I suggest we output a warning in the f-e that aliases are not supported, > but still generate the alias in the bitcode. Then we teach the code generators, > which presumably means the asm printer, to ignore aliases on Darwin. > > On the other hand, not all bitcode is generated by llvm-gcc. It may be a bad > idea to have LLVM quietly ignore aliases on Darwin because of the potential > surprise and trouble it may create for front-end writers who aren't aware of > this. > Good point. As Evan points out, the asm printer is already doing a lot of stuff that it shouldn't, but my patch doesn't handle the case where bitcode is generated by non-llvm-gcc programs or on other platforms. :-/ I'll check into this more. The macro can stay and we can just emit the warning, still emit the global aliasing code, but ignore it during assembly emission. Evan, does this sound like an okay idea? -bw From isanbard at gmail.com Mon Sep 17 17:37:56 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 17 Sep 2007 15:37:56 -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: References: <200709121855.l8CItFuU000417@zion.cs.uiuc.edu> <200709151600.40230.baldrick@free.fr> <200709171059.54888.baldrick@free.fr> Message-ID: <16e5fdf90709171537w586bda60l979e1ed37e045943@mail.gmail.com> On 9/17/07, Evan Cheng wrote: > I don't think Bill's patch affects weakref. Bill? > I don't think so either. But, as pointed out, it will fail for other reasons. > We are already relying on asm printer too much as it is. I'd like not > to add any more target specific knowledge to asm printer if possible. > There's a PR to address this issue. I think that Duncan's idea is the best way to go for right now, though. -bw From isanbard at gmail.com Mon Sep 17 17:39:32 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 17 Sep 2007 22:39:32 -0000 Subject: [llvm-commits] [llvm] r42071 - in /llvm/trunk: include/llvm/Support/Mangler.h lib/VMCore/Mangler.cpp Message-ID: <200709172239.l8HMdWGA031765@zion.cs.uiuc.edu> Author: void Date: Mon Sep 17 17:39:32 2007 New Revision: 42071 URL: http://llvm.org/viewvc/llvm-project?rev=42071&view=rev Log: Add support for appending a suffix to the end of a mangled name. Modified: llvm/trunk/include/llvm/Support/Mangler.h llvm/trunk/lib/VMCore/Mangler.cpp Modified: llvm/trunk/include/llvm/Support/Mangler.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Mangler.h?rev=42071&r1=42070&r2=42071&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Mangler.h (original) +++ llvm/trunk/include/llvm/Support/Mangler.h Mon Sep 17 17:39:32 2007 @@ -94,7 +94,7 @@ /// getValueName - Returns the mangled name of V, an LLVM Value, /// in the current module. /// - std::string getValueName(const GlobalValue *V); + std::string getValueName(const GlobalValue *V, const char *Suffix = ""); std::string getValueName(const Value *V); /// makeNameProper - We don't want identifier names with ., space, or Modified: llvm/trunk/lib/VMCore/Mangler.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Mangler.cpp?rev=42071&r1=42070&r2=42071&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Mangler.cpp (original) +++ llvm/trunk/lib/VMCore/Mangler.cpp Mon Sep 17 17:39:32 2007 @@ -126,7 +126,7 @@ } -std::string Mangler::getValueName(const GlobalValue *GV) { +std::string Mangler::getValueName(const GlobalValue *GV, const char * Suffix) { // Check to see whether we've already named V. std::string &Name = Memo[GV]; if (!Name.empty()) @@ -143,7 +143,7 @@ static unsigned GlobalID = 0; Name = "__unnamed_" + utostr(TypeUniqueID) + "_" + utostr(GlobalID++); } else if (!MangledGlobals.count(GV)) { - Name = makeNameProper(GV->getName(), Prefix); + Name = makeNameProper(GV->getName() + Suffix, Prefix); } else { unsigned TypeUniqueID = getTypeID(GV->getType()); Name = "l" + utostr(TypeUniqueID) + "_" + makeNameProper(GV->getName()); From evan.cheng at apple.com Mon Sep 17 18:09:10 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 17 Sep 2007 16:09:10 -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: <16e5fdf90709171535i6150d80ah452f54ab897289c3@mail.gmail.com> References: <200709121855.l8CItFuU000417@zion.cs.uiuc.edu> <200709151600.40230.baldrick@free.fr> <200709171059.54888.baldrick@free.fr> <16e5fdf90709171535i6150d80ah452f54ab897289c3@mail.gmail.com> Message-ID: <9FEEC795-7484-47D1-BEAB-01D81EB1B6D1@apple.com> On Sep 17, 2007, at 3:35 PM, Bill Wendling wrote: > Hi Duncan (et al), > >> I've CC'd Anton since he's the one who knows all about this stuff. >> Presumably >> when A is an alias for B there are two cases: either this is a >> "weak alias" or >> weakref, meaning that at link time it may turn out that A wasn't an >> alias for >> B after all, or A is a strong alias (a term I just invented) for B, >> meaning that >> this is definitive: you can replace uses of A with uses of B >> everywhere. In the >> first case linker support is required, but not in the second case, >> so presumably >> it is wrong to turn off alias support in the second case. I don't >> know if your >> patch turned this second case off or not. >> >> In the first case (weakrefs) we output a special declaration to the >> bitcode >> saying that A is a weak alias for B. I think it is a mistake not >> to output >> this even for platforms like Darwin that don't handle weakrefs: >> such aliases >> may be resolvable by LLVM, for example when linking modules using >> llvm-link. >> Think also of running bitcode under lli. Thus there are some cases >> in which >> weakrefs can work correctly even on Darwin. >> >> Instead, I suggest we output a warning in the f-e that aliases are >> not supported, >> but still generate the alias in the bitcode. Then we teach the >> code generators, >> which presumably means the asm printer, to ignore aliases on Darwin. >> >> On the other hand, not all bitcode is generated by llvm-gcc. It >> may be a bad >> idea to have LLVM quietly ignore aliases on Darwin because of the >> potential >> surprise and trouble it may create for front-end writers who aren't >> aware of >> this. >> > Good point. As Evan points out, the asm printer is already doing a lot > of stuff that it shouldn't, but my patch doesn't handle the case where > bitcode is generated by non-llvm-gcc programs or on other platforms. > :-/ I'll check into this more. The macro can stay and we can just emit > the warning, still emit the global aliasing code, but ignore it during > assembly emission. > > Evan, does this sound like an okay idea? I don't really see a clean solution at this point. I guess asm printer will have to handle bitcode generated for a different target. :-( Evan > > > -bw > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Mon Sep 17 20:47:22 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 18 Sep 2007 01:47:22 -0000 Subject: [llvm-commits] [llvm] r42074 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter.cpp lib/CodeGen/DwarfWriter.cpp test/CodeGen/X86/2007-09-17-ObjcFrameEH.ll Message-ID: <200709180147.l8I1lMX3010148@zion.cs.uiuc.edu> Author: void Date: Mon Sep 17 20:47:22 2007 New Revision: 42074 URL: http://llvm.org/viewvc/llvm-project?rev=42074&view=rev Log: Objective-C was generating EH frame info like this: "_-[NSString(local) isNullOrNil]".eh = 0 .no_dead_strip "_-[NSString(local) isNullOrNil]".eh The ".eh" should be inside the quotes. Added: llvm/trunk/test/CodeGen/X86/2007-09-17-ObjcFrameEH.ll Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter.cpp llvm/trunk/lib/CodeGen/DwarfWriter.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=42074&r1=42073&r2=42074&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Mon Sep 17 20:47:22 2007 @@ -43,6 +43,11 @@ /// unsigned FunctionNumber; + /// Cache of mangled exception handling name for current function. This is + /// recalculated at the beginning of each call to runOnMachineFunction(). + /// + std::string CurrentFnEHName; + protected: // Necessary for external weak linkage support std::set ExtWeakSymbols; @@ -112,6 +117,11 @@ /// Should be overridden if an indirect reference should be used. virtual void EmitExternalGlobal(const GlobalVariable *GV); + /// getCurrentFunctionEHName - Called to return (and cache) the + /// CurrentFnEHName. + /// + const std::string &getCurrentFunctionEHName(const MachineFunction *MF); + protected: /// doInitialization - Set up the AsmPrinter when we are working on a new /// module. If your pass overrides this, it must make sure to explicitly Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=42074&r1=42073&r2=42074&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Mon Sep 17 20:47:22 2007 @@ -160,6 +160,15 @@ return false; } +const std::string & +AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF) { + assert(MF && "No machine function?"); + if (CurrentFnEHName != "") return CurrentFnEHName; + return CurrentFnEHName = + Mang->makeNameProper(MF->getFunction()->getName() + ".eh", + TAI->getGlobalPrefix()); +} + void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { // What's my mangled name? CurrentFnName = Mang->getValueName(MF.getFunction()); Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=42074&r1=42073&r2=42074&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Mon Sep 17 20:47:22 2007 @@ -2833,13 +2833,13 @@ // Externally visible entry into the functions eh frame info. if (const char *GlobalDirective = TAI->getGlobalDirective()) - O << GlobalDirective << EHFrameInfo.FnName << ".eh\n"; + O << GlobalDirective << EHFrameInfo.FnName << "\n"; // If there are no calls then you can't unwind. if (!EHFrameInfo.hasCalls) { - O << EHFrameInfo.FnName << ".eh = 0\n"; + O << EHFrameInfo.FnName << " = 0\n"; } else { - O << EHFrameInfo.FnName << ".eh:\n"; + O << EHFrameInfo.FnName << ":\n"; // EH frame header. EmitDifference("eh_frame_end", EHFrameInfo.Number, @@ -2887,7 +2887,7 @@ } if (const char *UsedDirective = TAI->getUsedDirective()) - O << UsedDirective << EHFrameInfo.FnName << ".eh\n\n"; + O << UsedDirective << EHFrameInfo.FnName << "\n\n"; } /// EmitExceptionTable - Emit landing pads and actions. @@ -3321,12 +3321,13 @@ EmitExceptionTable(); // Save EH frame information - EHFrames.push_back(FunctionEHFrameInfo(getAsm()->CurrentFnName, - SubprogramCount, - MMI->getPersonalityIndex(), - MF->getFrameInfo()->hasCalls(), - !MMI->getLandingPads().empty(), - MMI->getFrameMoves())); + EHFrames. + push_back(FunctionEHFrameInfo(getAsm()->getCurrentFunctionEHName(MF), + SubprogramCount, + MMI->getPersonalityIndex(), + MF->getFrameInfo()->hasCalls(), + !MMI->getLandingPads().empty(), + MMI->getFrameMoves())); } }; Added: llvm/trunk/test/CodeGen/X86/2007-09-17-ObjcFrameEH.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-09-17-ObjcFrameEH.ll?rev=42074&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-09-17-ObjcFrameEH.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-09-17-ObjcFrameEH.ll Mon Sep 17 20:47:22 2007 @@ -0,0 +1,65 @@ +; RUN: llvm-as < %s | llc -march=x86 -enable-eh | grep {isNullOrNil].eh"} | wc -l | grep 2 + + %struct.NSString = type { } + %struct._objc__method_prototype_list = type opaque + %struct._objc_category = type { i8*, i8*, %struct._objc_method_list*, %struct._objc_method_list*, %struct._objc_protocol**, i32, %struct._prop_list_t* } + %struct._objc_method = type { %struct.objc_selector*, i8*, i8* } + %struct._objc_method_list = type opaque + %struct._objc_module = type { i32, i32, i8*, %struct._objc_symtab* } + %struct._objc_protocol = type { %struct._objc_protocol_extension*, i8*, %struct._objc_protocol**, %struct._objc__method_prototype_list*, %struct._objc__method_prototype_list* } + %struct._objc_protocol_extension = type opaque + %struct._objc_symtab = type { i32, %struct.objc_selector**, i16, i16, [1 x i8*] } + %struct._prop_list_t = type opaque + %struct.anon = type { %struct._objc__method_prototype_list*, i32, [1 x %struct._objc_method] } + %struct.objc_selector = type opaque +@"\01L_OBJC_SYMBOLS" = internal global { i32, i32, i16, i16, [1 x %struct._objc_category*] } { + i32 0, + i32 0, + i16 0, + i16 1, + [1 x %struct._objc_category*] [ %struct._objc_category* bitcast ({ i8*, i8*, %struct._objc_method_list*, i32, i32, i32, i32 }* @"\01L_OBJC_CATEGORY_NSString_local" to %struct._objc_category*) ] }, section "__OBJC,__symbols,regular,no_dead_strip" ; <{ i32, i32, i16, i16, [1 x %struct._objc_category*] }*> [#uses=2] +@"\01L_OBJC_CATEGORY_INSTANCE_METHODS_NSString_local" = internal global { i32, i32, [1 x %struct._objc_method] } { + i32 0, + i32 1, + [1 x %struct._objc_method] [ %struct._objc_method { + %struct.objc_selector* bitcast ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_0" to %struct.objc_selector*), + i8* getelementptr ([7 x i8]* @"\01L_OBJC_METH_VAR_TYPE_0", i32 0, i32 0), + i8* bitcast (i8 (%struct.NSString*, %struct.objc_selector*) signext * @"-[NSString(local) isNullOrNil]" to i8*) } ] }, section "__OBJC,__cat_inst_meth,regular,no_dead_strip" ; <{ i32, i32, [1 x %struct._objc_method] }*> [#uses=3] +@"\01L_OBJC_CATEGORY_NSString_local" = internal global { i8*, i8*, %struct._objc_method_list*, i32, i32, i32, i32 } { + i8* getelementptr ([6 x i8]* @"\01L_OBJC_CLASS_NAME_0", i32 0, i32 0), + i8* getelementptr ([9 x i8]* @"\01L_OBJC_CLASS_NAME_1", i32 0, i32 0), + %struct._objc_method_list* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01L_OBJC_CATEGORY_INSTANCE_METHODS_NSString_local" to %struct._objc_method_list*), + i32 0, + i32 0, + i32 28, + i32 0 }, section "__OBJC,__category,regular,no_dead_strip" ; <{ i8*, i8*, %struct._objc_method_list*, i32, i32, i32, i32 }*> [#uses=2] +@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] zeroinitializer, section "__OBJC,__image_info,regular" ; <[2 x i32]*> [#uses=1] +@"\01L_OBJC_MODULES" = internal global %struct._objc_module { + i32 7, + i32 16, + i8* getelementptr ([1 x i8]* @"\01L_OBJC_CLASS_NAME_2", i32 0, i32 0), + %struct._objc_symtab* bitcast ({ i32, i32, i16, i16, [1 x %struct._objc_category*] }* @"\01L_OBJC_SYMBOLS" to %struct._objc_symtab*) }, section "__OBJC,__module_info,regular,no_dead_strip" ; <%struct._objc_module*> [#uses=1] +@"\01.objc_class_ref_NSString" = internal global i8* @"\01.objc_class_name_NSString" ; [#uses=0] +@"\01.objc_class_name_NSString" = external global i8 ; [#uses=1] +@"\01.objc_category_name_NSString_local" = constant i32 0 ; [#uses=1] +@"\01L_OBJC_CLASS_NAME_2" = internal global [1 x i8] zeroinitializer, section "__TEXT,__cstring,cstring_literals" ; <[1 x i8]*> [#uses=2] +@"\01L_OBJC_CLASS_NAME_1" = internal global [9 x i8] c"NSString\00", section "__TEXT,__cstring,cstring_literals" ; <[9 x i8]*> [#uses=2] +@"\01L_OBJC_CLASS_NAME_0" = internal global [6 x i8] c"local\00", section "__TEXT,__cstring,cstring_literals" ; <[6 x i8]*> [#uses=2] +@"\01L_OBJC_METH_VAR_NAME_0" = internal global [12 x i8] c"isNullOrNil\00", section "__TEXT,__cstring,cstring_literals" ; <[12 x i8]*> [#uses=3] +@"\01L_OBJC_METH_VAR_TYPE_0" = internal global [7 x i8] c"c8 at 0:4\00", section "__TEXT,__cstring,cstring_literals" ; <[7 x i8]*> [#uses=2] + at llvm.used = appending global [11 x i8*] [ i8* bitcast ({ i32, i32, i16, i16, [1 x %struct._objc_category*] }* @"\01L_OBJC_SYMBOLS" to i8*), i8* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01L_OBJC_CATEGORY_INSTANCE_METHODS_NSString_local" to i8*), i8* bitcast ({ i8*, i8*, %struct._objc_method_list*, i32, i32, i32, i32 }* @"\01L_OBJC_CATEGORY_NSString_local" to i8*), i8* bitcast ([2 x i32]* @"\01L_OBJC_IMAGE_INFO" to i8*), i8* bitcast (%struct._objc_module* @"\01L_OBJC_MODULES" to i8*), i8* bitcast (i32* @"\01.objc_category_name_NSString_local" to i8*), i8* getelementptr ([1 x i8]* @"\01L_OBJC_CLASS_NAME_2", i32 0, i32 0), i8* getelementptr ([9 x i8]* @"\01L_OBJC_CLASS_NAME_1", i32 0, i32 0), i8* getelementptr ([6 x i8]* @"\01L_OBJC_CLASS_NAME_0", i32 0, i32 0), i8* getelementptr ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_0", i32 0, i32 0), i8* getelementptr ([7 x i8]* @"\01L_OBJC_METH_VAR_TYPE_0", i32 0, i32 0) ], section "llvm.metadata" ; <[11 x i8*]*> [#uses=0] + +define internal i8 @"-[NSString(local) isNullOrNil]"(%struct.NSString* %self, %struct.objc_selector* %_cmd) signext { +entry: + %self_addr = alloca %struct.NSString* ; <%struct.NSString**> [#uses=1] + %_cmd_addr = alloca %struct.objc_selector* ; <%struct.objc_selector**> [#uses=1] + %retval = alloca i8, align 1 ; [#uses=1] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store %struct.NSString* %self, %struct.NSString** %self_addr + store %struct.objc_selector* %_cmd, %struct.objc_selector** %_cmd_addr + br label %return + +return: ; preds = %entry + %retval1 = load i8* %retval ; [#uses=1] + ret i8 %retval1 +} From dpatel at apple.com Mon Sep 17 20:54:43 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 18 Sep 2007 01:54:43 -0000 Subject: [llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll Message-ID: <200709180154.l8I1shCf010621@zion.cs.uiuc.edu> Author: dpatel Date: Mon Sep 17 20:54:42 2007 New Revision: 42075 URL: http://llvm.org/viewvc/llvm-project?rev=42075&view=rev Log: Fix PR1657 Added: llvm/trunk/test/Transforms/LICM/2007-09-17-PrompteValue.ll Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=42075&r1=42074&r2=42075&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Mon Sep 17 20:54:42 2007 @@ -791,6 +791,14 @@ break; } + // If GEP base is NULL then the calculated address used by Store or + // Load instruction is invalid. Do not promote this value because + // it may expose load and store instruction that are covered by + // condition which may not yet folded. + if (GetElementPtrInst *GEP = dyn_cast(V)) + if (isa(GEP->getOperand(0))) + PointerOk = false; + if (PointerOk) { const Type *Ty = cast(V->getType())->getElementType(); AllocaInst *AI = new AllocaInst(Ty, 0, V->getName()+".tmp", FnStart); Added: llvm/trunk/test/Transforms/LICM/2007-09-17-PrompteValue.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/2007-09-17-PrompteValue.ll?rev=42075&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LICM/2007-09-17-PrompteValue.ll (added) +++ llvm/trunk/test/Transforms/LICM/2007-09-17-PrompteValue.ll Mon Sep 17 20:54:42 2007 @@ -0,0 +1,26 @@ +; ModuleID = 'PR1657.bc' +; Do not promote getelementptr because it may exposes load from a null pointer +; and store from a null pointer which are covered by +; icmp eq %struct.decision* null, null condition. +; RUN: llvm-as < %s | opt -licm | llvm-dis | not grep promoted + %struct.decision = type { i8, %struct.decision* } + +define i32 @main() { +entry: + br label %blah.i + +blah.i: ; preds = %cond_true.i, %entry + %tmp3.i = icmp eq %struct.decision* null, null ; [#uses=1] + br i1 %tmp3.i, label %clear_modes.exit, label %cond_true.i + +cond_true.i: ; preds = %blah.i + %tmp1.i = getelementptr %struct.decision* null, i32 0, i32 0 ; [#uses=1] + store i8 0, i8* %tmp1.i + br label %blah.i + +clear_modes.exit: ; preds = %blah.i + call void @exit( i32 0 ) + unreachable +} + +declare void @exit(i32) From gordonhenriksen at mac.com Mon Sep 17 21:09:34 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 02:09:34 -0000 Subject: [llvm-commits] [llvm] r42076 - in /llvm/trunk: Xcode/ Xcode/LLVM.xcodeproj/ examples/BrainF/ include/llvm/Module.h lib/Target/Mips/ test/Transforms/GVN/ Message-ID: <200709180209.l8I29YXl011630@zion.cs.uiuc.edu> Author: gordon Date: Mon Sep 17 21:09:34 2007 New Revision: 42076 URL: http://llvm.org/viewvc/llvm-project?rev=42076&view=rev Log: Fixing an comment in Module.h that refers to a nonexistent parameter. Also adding some missing svn:ignores that've been bothering me. Modified: llvm/trunk/Xcode/ (props changed) llvm/trunk/Xcode/LLVM.xcodeproj/ (props changed) llvm/trunk/examples/BrainF/ (props changed) llvm/trunk/include/llvm/Module.h llvm/trunk/lib/Target/Mips/ (props changed) llvm/trunk/test/Transforms/GVN/ (props changed) Propchange: llvm/trunk/Xcode/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Sep 17 21:09:34 2007 @@ -0,0 +1 @@ +build Propchange: llvm/trunk/Xcode/LLVM.xcodeproj/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Sep 17 21:09:34 2007 @@ -0,0 +1,2 @@ +*.perspective +*.pbxuser Propchange: llvm/trunk/examples/BrainF/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Sep 17 21:09:34 2007 @@ -0,0 +1,2 @@ +Release +Debug Modified: llvm/trunk/include/llvm/Module.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Module.h?rev=42076&r1=42075&r2=42076&view=diff ============================================================================== --- llvm/trunk/include/llvm/Module.h (original) +++ llvm/trunk/include/llvm/Module.h Mon Sep 17 21:09:34 2007 @@ -215,11 +215,9 @@ /// @{ public: /// getGlobalVariable - Look up the specified global variable in the module - /// symbol table. If it does not exist, return null. The type argument - /// should be the underlying type of the global, i.e., it should not have - /// the top-level PointerType, which represents the address of the global. - /// If AllowInternal is set to true, this function will return types that - /// have InternalLinkage. By default, these types are not returned. + /// symbol table. If it does not exist, return null. If AllowInternal is set + /// to true, this function will return types that have InternalLinkage. By + /// default, these types are not returned. GlobalVariable *getGlobalVariable(const std::string &Name, bool AllowInternal = false) const; Propchange: llvm/trunk/lib/Target/Mips/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Sep 17 21:09:34 2007 @@ -0,0 +1,3 @@ +*.inc +Debug +Release Propchange: llvm/trunk/test/Transforms/GVN/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Sep 17 21:09:34 2007 @@ -0,0 +1 @@ +Output From gordonhenriksen at mac.com Mon Sep 17 22:18:58 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 03:18:58 -0000 Subject: [llvm-commits] [llvm] r42077 - in /llvm/trunk: include/llvm-c/BitWriter.h include/llvm-c/Core.h include/llvm/CHelpers.h lib/Bitcode/Writer/BitWriter.cpp lib/VMCore/Core.cpp Message-ID: <200709180318.l8I3IwM5015598@zion.cs.uiuc.edu> Author: gordon Date: Mon Sep 17 22:18:57 2007 New Revision: 42077 URL: http://llvm.org/viewvc/llvm-project?rev=42077&view=rev Log: C bindings for libLLVMCore.a and libLLVMBitWriter.a. - The naming prefix is LLVM. - All types are represented using opaque references. - Functions are not named LLVM{Type}{Method}; the names became unreadable goop. Instead, they are named LLVM{ImperativeSentence}. - Where an attribute only appears once in the class hierarchy (e.g., linkage only applies to values; parameter types only apply to function types), the class is omitted from identifiers for brevity. Tastes like methods. - Strings are C strings or string/length tuples on a case-by-case basis. - APIs which give the caller ownership of an object are not mapped (removeFromParent, certain constructor overloads). This keeps keep memory management as simple as possible. For each library with bindings: llvm-c/.h - Declares the bindings. lib//.cpp - Implements the bindings. So just link with the library of your choice and use the C header instead of the C++ one. Added: llvm/trunk/include/llvm-c/BitWriter.h llvm/trunk/include/llvm-c/Core.h llvm/trunk/include/llvm/CHelpers.h llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp llvm/trunk/lib/VMCore/Core.cpp Added: llvm/trunk/include/llvm-c/BitWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/BitWriter.h?rev=42077&view=auto ============================================================================== --- llvm/trunk/include/llvm-c/BitWriter.h (added) +++ llvm/trunk/include/llvm-c/BitWriter.h Mon Sep 17 22:18:57 2007 @@ -0,0 +1,42 @@ +/*===-- llvm-c/BitWriter.h - BitWriter Library C Interface ------*- C++ -*-===*\ +|* *| +|* The LLVM Compiler Infrastructure *| +|* *| +|* This file was developed by Gordon Henriksen and is distributed under the *| +|* University of Illinois Open Source License. See LICENSE.TXT for details. *| +|* *| +|*===----------------------------------------------------------------------===*| +|* *| +|* This header declares the C interface to libLLVMBitWriter.a, which *| +|* implements output of the LLVM bitcode format. *| +|* *| +|* Many exotic languages can interoperate with C code but have a harder time *| +|* with C++ due to name mangling. So in addition to C, this interface enables *| +|* tools written in such languages. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_C_BITCODEWRITER_H +#define LLVM_C_BITCODEWRITER_H + +#include "llvm-c/Core.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/*===-- Operations on modules ---------------------------------------------===*/ + +/* Writes a module to an open file descriptor. Returns 0 on success. */ +int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle); + +/* Writes a module to the specified path. Returns 0 on success. */ +int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path); + + +#ifdef __cplusplus +} +#endif + +#endif Added: llvm/trunk/include/llvm-c/Core.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=42077&view=auto ============================================================================== --- llvm/trunk/include/llvm-c/Core.h (added) +++ llvm/trunk/include/llvm-c/Core.h Mon Sep 17 22:18:57 2007 @@ -0,0 +1,221 @@ +/*===-- llvm-c/Core.h - Core Library C Interface ------------------*- C -*-===*\ +|* *| +|* The LLVM Compiler Infrastructure *| +|* *| +|* This file was developed by Gordon Henriksen and is distributed under the *| +|* University of Illinois Open Source License. See LICENSE.TXT for details. *| +|* *| +|*===----------------------------------------------------------------------===*| +|* *| +|* This header declares the C interface to libLLVMCore.a, which implements *| +|* the LLVM intermediate representation. *| +|* *| +|* LLVM uses a polymorphic type hierarchy which C cannot represent, therefore *| +|* parameters must be passed as base types. Despite the declared types, most *| +|* of the functions provided operate only on branches of the type hierarchy. *| +|* The declared parameter names are descriptive and specify which type is *| +|* required. Additionally, each type hierarchy is documented along with the *| +|* functions that operate upon it. For more detail, refer to LLVM's C++ code. *| +|* If in doubt, refer to Core.cpp, which performs paramter downcasts in the *| +|* form unwrap(Param). *| +|* *| +|* Many exotic languages can interoperate with C code but have a harder time *| +|* with C++ due to name mangling. So in addition to C, this interface enables *| +|* tools written in such languages. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_C_CORE_H +#define LLVM_C_CORE_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Opaque types. */ +typedef struct LLVMOpaqueModule *LLVMModuleRef; +typedef struct LLVMOpaqueType *LLVMTypeRef; +typedef struct LLVMOpaqueValue *LLVMValueRef; + +typedef enum { + LLVMVoidTypeKind = 0, /* type with no size */ + LLVMFloatTypeKind, /* 32 bit floating point type */ + LLVMDoubleTypeKind, /* 64 bit floating point type */ + LLVMX86_FP80TypeKind, /* 80 bit floating point type (X87) */ + LLVMFP128TypeKind, /* 128 bit floating point type (112-bit mantissa) */ + LLVMPPC_FP128TypeKind, /* 128 bit floating point type (two 64-bits) */ + LLVMLabelTypeKind, /* Labels */ + LLVMIntegerTypeKind, /* Arbitrary bit width integers */ + LLVMFunctionTypeKind, /* Functions */ + LLVMStructTypeKind, /* Structures */ + LLVMArrayTypeKind, /* Arrays */ + LLVMPointerTypeKind, /* Pointers */ + LLVMOpaqueTypeKind, /* Opaque: type with unknown structure */ + LLVMVectorTypeKind /* SIMD 'packed' format, or other vector type */ +} LLVMTypeKind; + +typedef enum { + LLVMExternalLinkage = 0,/* Externally visible function */ + LLVMLinkOnceLinkage, /* Keep one copy of function when linking (inline) */ + LLVMWeakLinkage, /* Keep one copy of function when linking (weak) */ + LLVMAppendingLinkage, /* Special purpose, only applies to global arrays */ + LLVMInternalLinkage, /* Rename collisions when linking (static functions)*/ + LLVMDLLImportLinkage, /* Function to be imported from DLL */ + LLVMDLLExportLinkage, /* Function to be accessible from DLL */ + LLVMExternalWeakLinkage,/* ExternalWeak linkage description */ + LLVMGhostLinkage /* Stand-in functions for streaming fns from bitcode*/ +} LLVMLinkage; + +typedef enum { + LLVMDefaultVisibility = 0, /* The GV is visible */ + LLVMHiddenVisibility, /* The GV is hidden */ + LLVMProtectedVisibility /* The GV is protected */ +} LLVMVisibility; + + +/*===-- Modules -----------------------------------------------------------===*/ + +/* Create and destroy modules. */ +LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID); +void LLVMDisposeModule(LLVMModuleRef M); + +/* Same as Module::addTypeName. */ +int LLVMAddTypeName(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty); +int LLVMDeleteTypeName(LLVMModuleRef M, const char *Name); + + +/*===-- Types --------------------------------------------------------------===*/ + +/* LLVM types conform to the following hierarchy: + * + * types: + * integer type + * real type + * function type + * sequence types: + * array type + * pointer type + * vector type + * void type + * label type + * opaque type + */ + +LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty); +void LLVMRefineAbstractType(LLVMTypeRef AbstractType, LLVMTypeRef ConcreteType); + +/* Operations on integer types */ +LLVMTypeRef LLVMInt1Type(); +LLVMTypeRef LLVMInt8Type(); +LLVMTypeRef LLVMInt16Type(); +LLVMTypeRef LLVMInt32Type(); +LLVMTypeRef LLVMInt64Type(); +LLVMTypeRef LLVMCreateIntegerType(unsigned NumBits); +unsigned LLVMGetIntegerTypeWidth(LLVMTypeRef IntegerTy); + +/* Operations on real types */ +LLVMTypeRef LLVMFloatType(); +LLVMTypeRef LLVMDoubleType(); +LLVMTypeRef LLVMX86FP80Type(); +LLVMTypeRef LLVMFP128Type(); +LLVMTypeRef LLVMPPCFP128Type(); + +/* Operations on function types */ +LLVMTypeRef LLVMCreateFunctionType(LLVMTypeRef ReturnType, + LLVMTypeRef *ParamTypes, unsigned ParamCount, + int IsVarArg); +int LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy); +LLVMTypeRef LLVMGetFunctionReturnType(LLVMTypeRef FunctionTy); +unsigned LLVMGetFunctionParamCount(LLVMTypeRef FunctionTy); +void LLVMGetFunctionParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest); + +/* Operations on struct types */ +LLVMTypeRef LLVMCreateStructType(LLVMTypeRef *ElementTypes, + unsigned ElementCount, int Packed); +unsigned LLVMGetStructElementCount(LLVMTypeRef StructTy); +void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest); +int LLVMIsPackedStruct(LLVMTypeRef StructTy); + +/* Operations on array, pointer, and vector types (sequence types) */ +LLVMTypeRef LLVMCreateArrayType(LLVMTypeRef ElementType, unsigned ElementCount); +LLVMTypeRef LLVMCreatePointerType(LLVMTypeRef ElementType); +LLVMTypeRef LLVMCreateVectorType(LLVMTypeRef ElementType,unsigned ElementCount); + +LLVMTypeRef LLVMGetElementType(LLVMTypeRef Ty); +unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy); +unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy); + +/* Operations on other types */ +LLVMTypeRef LLVMVoidType(); +LLVMTypeRef LLVMLabelType(); +LLVMTypeRef LLVMCreateOpaqueType(); + + +/*===-- Values ------------------------------------------------------------===*/ + +/* The bulk of LLVM's object model consists of values, which comprise a very + * rich type hierarchy. + * + * values: + * constants: + * scalar constants + * composite contants + * globals: + * global variable + * function + * alias + */ + +/* Operations on all values */ +LLVMTypeRef LLVMGetTypeOfValue(LLVMValueRef Val); +const char *LLVMGetValueName(LLVMValueRef Val); +void LLVMSetValueName(LLVMValueRef Val, const char *Name); + +/* Operations on constants of any type */ +LLVMValueRef LLVMGetNull(LLVMTypeRef Ty); /* all zeroes */ +LLVMValueRef LLVMGetAllOnes(LLVMTypeRef Ty); /* only for int/vector */ +LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty); +int LLVMIsNull(LLVMValueRef Val); + +/* Operations on scalar constants */ +LLVMValueRef LLVMGetIntConstant(LLVMTypeRef IntTy, unsigned long long N, + int SignExtend); +LLVMValueRef LLVMGetRealConstant(LLVMTypeRef RealTy, double N); + +/* Operations on composite constants */ +LLVMValueRef LLVMGetStringConstant(const char *Str, unsigned Length, + int DontNullTerminate); +LLVMValueRef LLVMGetArrayConstant(LLVMTypeRef ArrayTy, + LLVMValueRef *ConstantVals, unsigned Length); +LLVMValueRef LLVMGetStructConstant(LLVMValueRef *ConstantVals, unsigned Count, + int packed); +LLVMValueRef LLVMGetVectorConstant(LLVMValueRef *ScalarConstantVals, + unsigned Size); + +/* Operations on global variables, functions, and aliases (globals) */ +int LLVMIsDeclaration(LLVMValueRef Global); +LLVMLinkage LLVMGetLinkage(LLVMValueRef Global); +void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage); +const char *LLVMGetSection(LLVMValueRef Global); +void LLVMSetSection(LLVMValueRef Global, const char *Section); +LLVMVisibility LLVMGetVisibility(LLVMValueRef Global); +void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz); +unsigned LLVMGetAlignment(LLVMValueRef Global); +void LLVMSetAlignment(LLVMValueRef Global, unsigned Bytes); + +/* Operations on global variables */ +LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name); +void LLVMDeleteGlobal(LLVMValueRef GlobalVar); +int LLVMHasInitializer(LLVMValueRef GlobalVar); +LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar); +void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal); +int LLVMIsThreadLocal(LLVMValueRef GlobalVar); +void LLVMSetThreadLocal(LLVMValueRef GlobalVar, int IsThreadLocal); + + +#ifdef __cplusplus +} +#endif + +#endif Added: llvm/trunk/include/llvm/CHelpers.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CHelpers.h?rev=42077&view=auto ============================================================================== --- llvm/trunk/include/llvm/CHelpers.h (added) +++ llvm/trunk/include/llvm/CHelpers.h Mon Sep 17 22:18:57 2007 @@ -0,0 +1,94 @@ +//===-- Support/CHelpers.h - Utilities for writing C bindings -------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// These opaque reference<-->pointer conversions are shorter and more tightly +// typed than writing the casts by hand in C bindings. In assert builds, they +// will do type checking. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_CHELPERS_H +#define LLVM_SUPPORT_CHELPERS_H + +#include "llvm/Module.h" +#include "llvm/Type.h" +#include "llvm/Value.h" + +typedef struct LLVMOpaqueModule *LLVMModuleRef; +typedef struct LLVMOpaqueType *LLVMTypeRef; +typedef struct LLVMOpaqueValue *LLVMValueRef; + +namespace llvm { + /// Opaque module conversions + /// + inline Module *unwrap(LLVMModuleRef M) { + return reinterpret_cast(M); + } + + inline LLVMModuleRef wrap(Module *M) { + return reinterpret_cast(M); + } + + /// Opaque type conversions + /// + inline Type *unwrap(LLVMTypeRef Ty) { + return reinterpret_cast(Ty); + } + + template + inline T *unwrap(LLVMTypeRef Ty) { + return cast(unwrap(Ty)); + } + + inline Type **unwrap(LLVMTypeRef* Tys) { + return reinterpret_cast(Tys); + } + + inline LLVMTypeRef wrap(const Type *Ty) { + return reinterpret_cast(const_cast(Ty)); + } + + inline LLVMTypeRef *wrap(const Type **Tys) { + return reinterpret_cast(const_cast(Tys)); + } + + /// Opaque value conversions + /// + inline Value *unwrap(LLVMValueRef Val) { + return reinterpret_cast(Val); + } + + template + inline T *unwrap(LLVMValueRef Val) { + return cast(unwrap(Val)); + } + + inline Value **unwrap(LLVMValueRef *Vals) { + return reinterpret_cast(Vals); + } + + template + inline T **unwrap(LLVMValueRef *Vals, unsigned Length) { + #if DEBUG + for (LLVMValueRef *I = Vals, E = Vals + Length; I != E; ++I) + cast(*I); + #endif + return reinterpret_cast(Vals); + } + + inline LLVMValueRef wrap(const Value *Val) { + return reinterpret_cast(const_cast(Val)); + } + + inline LLVMValueRef *wrap(const Value **Vals) { + return reinterpret_cast(const_cast(Vals)); + } +} + +#endif Added: llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp?rev=42077&view=auto ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp (added) +++ llvm/trunk/lib/Bitcode/Writer/BitWriter.cpp Mon Sep 17 22:18:57 2007 @@ -0,0 +1,51 @@ +//===-- BitWriter.cpp -----------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm-c/BitWriter.h" +#include "llvm/CHelpers.h" +#include "llvm/Bitcode/ReaderWriter.h" +#include + +using namespace llvm; + + +/*===-- Operations on modules ---------------------------------------------===*/ + +int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path) { + std::ofstream OS(Path); + + if (!OS.fail()) + WriteBitcodeToFile(unwrap(M), OS); + + if (OS.fail()) + return -1; + + return 0; +} + +#ifdef __GNUC__ +#include + +// FIXME: Control this with configure? Provide some portable abstraction in +// libSystem? As is, the user will just get a linker error if they use this on +// non-GCC. Some C++ stdlibs even have ofstream::ofstream(int fd). +int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int FileHandle) { + __gnu_cxx::stdio_filebuf Buffer(FileHandle, std::ios_base::out); + std::ostream OS(&Buffer); + + if (!OS.fail()) + WriteBitcodeToFile(unwrap(M), OS); + + if (OS.fail()) + return -1; + + return 0; +} + +#endif Added: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=42077&view=auto ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (added) +++ llvm/trunk/lib/VMCore/Core.cpp Mon Sep 17 22:18:57 2007 @@ -0,0 +1,322 @@ +//===-- Core.cpp ----------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Gordon Henriksen and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the C bindings for libLLVMCore.a, which implements +// the LLVM intermediate representation. +// +//===----------------------------------------------------------------------===// + +#include "llvm-c/Core.h" +#include "llvm/Bitcode/ReaderWriter.h" +#include "llvm/CHelpers.h" +#include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" +#include "llvm/GlobalVariable.h" +#include +#include +#include + +using namespace llvm; + + +/*===-- Operations on modules ---------------------------------------------===*/ + +LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID) { + return wrap(new Module(ModuleID)); +} + +void LLVMDisposeModule(LLVMModuleRef M) { + delete unwrap(M); +} + +int LLVMAddTypeName(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty) { + return unwrap(M)->addTypeName(Name, unwrap(Ty)); +} + + +/*===-- Operations on types -----------------------------------------------===*/ + +/*--.. Operations on all types (mostly) ....................................--*/ + +LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty) { + return static_cast(unwrap(Ty)->getTypeID()); +} + +void LLVMRefineAbstractType(LLVMTypeRef AbstractType, LLVMTypeRef ConcreteType){ + DerivedType *Ty = unwrap(AbstractType); + Ty->refineAbstractTypeTo(unwrap(ConcreteType)); +} + +/*--.. Operations on integer types .........................................--*/ + +LLVMTypeRef LLVMInt1Type() { return (LLVMTypeRef) Type::Int1Ty; } +LLVMTypeRef LLVMInt8Type() { return (LLVMTypeRef) Type::Int8Ty; } +LLVMTypeRef LLVMInt16Type() { return (LLVMTypeRef) Type::Int16Ty; } +LLVMTypeRef LLVMInt32Type() { return (LLVMTypeRef) Type::Int32Ty; } +LLVMTypeRef LLVMInt64Type() { return (LLVMTypeRef) Type::Int64Ty; } + +LLVMTypeRef LLVMCreateIntegerType(unsigned NumBits) { + return wrap(IntegerType::get(NumBits)); +} + +unsigned LLVMGetIntegerTypeWidth(LLVMTypeRef IntegerTy) { + return unwrap(IntegerTy)->getBitWidth(); +} + +/*--.. Operations on real types ............................................--*/ + +LLVMTypeRef LLVMFloatType() { return (LLVMTypeRef) Type::FloatTy; } +LLVMTypeRef LLVMDoubleType() { return (LLVMTypeRef) Type::DoubleTy; } +LLVMTypeRef LLVMX86FP80Type() { return (LLVMTypeRef) Type::X86_FP80Ty; } +LLVMTypeRef LLVMFP128Type() { return (LLVMTypeRef) Type::FP128Ty; } +LLVMTypeRef LLVMPPCFP128Type() { return (LLVMTypeRef) Type::PPC_FP128Ty; } + +/*--.. Operations on function types ........................................--*/ + +LLVMTypeRef LLVMCreateFunctionType(LLVMTypeRef ReturnType, + LLVMTypeRef *ParamTypes, unsigned ParamCount, + int IsVarArg) { + std::vector Tys; + for (LLVMTypeRef *I = ParamTypes, *E = ParamTypes + ParamCount; I != E; ++I) + Tys.push_back(unwrap(*I)); + + return wrap(FunctionType::get(unwrap(ReturnType), Tys, IsVarArg != 0)); +} + +int LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy) { + return unwrap(FunctionTy)->isVarArg(); +} + +LLVMTypeRef LLVMGetFunctionReturnType(LLVMTypeRef FunctionTy) { + return wrap(unwrap(FunctionTy)->getReturnType()); +} + +unsigned LLVMGetFunctionParamCount(LLVMTypeRef FunctionTy) { + return unwrap(FunctionTy)->getNumParams(); +} + +void LLVMGetFunctionParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest) { + FunctionType *Ty = unwrap(FunctionTy); + for (FunctionType::param_iterator I = Ty->param_begin(), + E = Ty->param_end(); I != E; ++I) + *Dest++ = wrap(*I); +} + +/*--.. Operations on struct types ..........................................--*/ + +LLVMTypeRef LLVMCreateStructType(LLVMTypeRef *ElementTypes, + unsigned ElementCount, int Packed) { + std::vector Tys; + for (LLVMTypeRef *I = ElementTypes, + *E = ElementTypes + ElementCount; I != E; ++I) + Tys.push_back(unwrap(*I)); + + return wrap(StructType::get(Tys, Packed != 0)); +} + +unsigned LLVMGetStructElementCount(LLVMTypeRef StructTy) { + return unwrap(StructTy)->getNumElements(); +} + +void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest) { + StructType *Ty = unwrap(StructTy); + for (FunctionType::param_iterator I = Ty->element_begin(), + E = Ty->element_end(); I != E; ++I) + *Dest++ = wrap(*I); +} + +int LLVMIsPackedStruct(LLVMTypeRef StructTy) { + return unwrap(StructTy)->isPacked(); +} + +/*--.. Operations on array, pointer, and vector types (sequence types) .....--*/ + +LLVMTypeRef LLVMCreateArrayType(LLVMTypeRef ElementType, unsigned ElementCount){ + return wrap(ArrayType::get(unwrap(ElementType), ElementCount)); +} + +LLVMTypeRef LLVMCreatePointerType(LLVMTypeRef ElementType) { + return wrap(PointerType::get(unwrap(ElementType))); +} + +LLVMTypeRef LLVMCreateVectorType(LLVMTypeRef ElementType,unsigned ElementCount){ + return wrap(VectorType::get(unwrap(ElementType), ElementCount)); +} + +LLVMTypeRef LLVMGetElementType(LLVMTypeRef Ty) { + return wrap(unwrap(Ty)->getElementType()); +} + +unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy) { + return unwrap(ArrayTy)->getNumElements(); +} + +unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy) { + return unwrap(VectorTy)->getNumElements(); +} + +/*--.. Operations on other types ...........................................--*/ + +LLVMTypeRef LLVMVoidType() { return (LLVMTypeRef) Type::VoidTy; } +LLVMTypeRef LLVMLabelType() { return (LLVMTypeRef) Type::LabelTy; } + +LLVMTypeRef LLVMCreateOpaqueType() { + return wrap(llvm::OpaqueType::get()); +} + + +/*===-- Operations on values ----------------------------------------------===*/ + +/*--.. Operations on all values ............................................--*/ + +LLVMTypeRef LLVMGetTypeOfValue(LLVMValueRef Val) { + return wrap(unwrap(Val)->getType()); +} + +const char *LLVMGetValueName(LLVMValueRef Val) { + return unwrap(Val)->getNameStart(); +} + +void LLVMSetValueName(LLVMValueRef Val, const char *Name) { + unwrap(Val)->setName(Name); +} + +/*--.. Operations on constants of any type .................................--*/ + +LLVMValueRef LLVMGetNull(LLVMTypeRef Ty) { + return wrap(Constant::getNullValue(unwrap(Ty))); +} + +LLVMValueRef LLVMGetAllOnes(LLVMTypeRef Ty) { + return wrap(Constant::getAllOnesValue(unwrap(Ty))); +} + +LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty) { + return wrap(UndefValue::get(unwrap(Ty))); +} + +int LLVMIsNull(LLVMValueRef Val) { + if (Constant *C = dyn_cast(unwrap(Val))) + return C->isNullValue(); + return false; +} + +/*--.. Operations on scalar constants ......................................--*/ + +LLVMValueRef LLVMGetIntConstant(LLVMTypeRef IntTy, unsigned long long N, + int SignExtend) { + return wrap(ConstantInt::get(unwrap(IntTy), N, SignExtend != 0)); +} + +LLVMValueRef LLVMGetRealConstant(LLVMTypeRef RealTy, double N) { + return wrap(ConstantFP::get(unwrap(RealTy), APFloat(N))); +} + +/*--.. Operations on composite constants ...................................--*/ + +LLVMValueRef LLVMGetStringConstant(const char *Str, unsigned Length, + int DontNullTerminate) { + /* Inverted the sense of AddNull because ', 0)' is a + better mnemonic for null termination than ', 1)'. */ + return wrap(ConstantArray::get(std::string(Str, Length), + DontNullTerminate == 0)); +} + +LLVMValueRef LLVMGetArrayConstant(LLVMTypeRef ElementTy, + LLVMValueRef *ConstantVals, unsigned Length) { + return wrap(ConstantArray::get(ArrayType::get(unwrap(ElementTy), Length), + unwrap(ConstantVals, Length), + Length)); +} + +LLVMValueRef LLVMGetStructConstant(LLVMValueRef *ConstantVals, unsigned Count, + int Packed) { + return wrap(ConstantStruct::get(unwrap(ConstantVals, Count), + Count, Packed != 0)); +} + +LLVMValueRef LLVMGetVectorConstant(LLVMValueRef *ScalarConstantVals, + unsigned Size) { + return wrap(ConstantVector::get(unwrap(ScalarConstantVals, Size), + Size)); +} + +/*--.. Operations on global variables, functions, and aliases (globals) ....--*/ + +int LLVMIsDeclaration(LLVMValueRef Global) { + return unwrap(Global)->isDeclaration(); +} + +LLVMLinkage LLVMGetLinkage(LLVMValueRef Global) { + return static_cast(unwrap(Global)->getLinkage()); +} + +void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage) { + unwrap(Global) + ->setLinkage(static_cast(Linkage)); +} + +const char *LLVMGetSection(LLVMValueRef Global) { + return unwrap(Global)->getSection().c_str(); +} + +void LLVMSetSection(LLVMValueRef Global, const char *Section) { + unwrap(Global)->setSection(Section); +} + +LLVMVisibility LLVMGetVisibility(LLVMValueRef Global) { + return static_cast( + unwrap(Global)->getVisibility()); +} + +void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz) { + unwrap(Global) + ->setVisibility(static_cast(Viz)); +} + +unsigned LLVMGetAlignment(LLVMValueRef Global) { + return unwrap(Global)->getAlignment(); +} + +void LLVMSetAlignment(LLVMValueRef Global, unsigned Bytes) { + unwrap(Global)->setAlignment(Bytes); +} + +/*--.. Operations on global variables ......................................--*/ + +LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name) { + return wrap(new GlobalVariable(unwrap(Ty), false, + GlobalValue::ExternalLinkage, 0, Name, unwrap(M))); +} + +void LLVMDeleteGlobal(LLVMValueRef GlobalVar) { + unwrap(GlobalVar)->eraseFromParent(); +} + +int LLVMHasInitializer(LLVMValueRef GlobalVar) { + return unwrap(GlobalVar)->hasInitializer(); +} + +LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar) { + return wrap(unwrap(GlobalVar)->getInitializer()); +} + +void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal) { + unwrap(GlobalVar) + ->setInitializer(unwrap(ConstantVal)); +} + +int LLVMIsThreadLocal(LLVMValueRef GlobalVar) { + return unwrap(GlobalVar)->isThreadLocal(); +} + +void LLVMSetThreadLocal(LLVMValueRef GlobalVar, int IsThreadLocal) { + unwrap(GlobalVar)->setThreadLocal(IsThreadLocal != 0); +} + From clattner at apple.com Mon Sep 17 23:05:50 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 17 Sep 2007 21:05:50 -0700 Subject: [llvm-commits] [llvm] r42074 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter.cpp lib/CodeGen/DwarfWriter.cpp test/CodeGen/X86/2007-09-17-ObjcFrameEH.ll In-Reply-To: <200709180147.l8I1lMX3010148@zion.cs.uiuc.edu> References: <200709180147.l8I1lMX3010148@zion.cs.uiuc.edu> Message-ID: <3DF3BFA7-E693-485A-8F1A-B322EB701E19@apple.com> On Sep 17, 2007, at 6:47 PM, Bill Wendling wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=42074&view=rev > Log: > Objective-C was generating EH frame info like this: > > "_-[NSString(local) isNullOrNil]".eh = 0 > .no_dead_strip "_-[NSString(local) isNullOrNil]".eh > + /// Cache of mangled exception handling name for current > function. This is > + /// recalculated at the beginning of each call to > runOnMachineFunction(). > + /// > + std::string CurrentFnEHName; This should be reset to "" at the start or end of the function, right? We don't want subsequent functions to reuse earlier functions names. > +const std::string & > +AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF) { > + assert(MF && "No machine function?"); > + if (CurrentFnEHName != "") return CurrentFnEHName; please use "if (!CurrentFnEHName.empty())". Thanks Bill, -Chris From clattner at apple.com Mon Sep 17 23:09:08 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 17 Sep 2007 21:09:08 -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: <16e5fdf90709171535i6150d80ah452f54ab897289c3@mail.gmail.com> References: <200709121855.l8CItFuU000417@zion.cs.uiuc.edu> <200709151600.40230.baldrick@free.fr> <200709171059.54888.baldrick@free.fr> <16e5fdf90709171535i6150d80ah452f54ab897289c3@mail.gmail.com> Message-ID: <330EB2C5-3B15-4241-B67F-42483D6E0F98@apple.com> On Sep 17, 2007, at 3:35 PM, Bill Wendling wrote: >> Instead, I suggest we output a warning in the f-e that aliases are >> not supported, >> but still generate the alias in the bitcode. Then we teach the >> code generators, >> which presumably means the asm printer, to ignore aliases on Darwin Will this really work? If the optimizer sees aliases, it could presumably do something with them, potentially adding dependencies on them being handled "right". If nothing else, the alias that will eventually not get emitted can cause symbol table clashes as link stages are done. I don't think it's a good idea for targets that don't support aliases to have aliases in their module. >> >> On the other hand, not all bitcode is generated by llvm-gcc. It >> may be a bad >> idea to have LLVM quietly ignore aliases on Darwin because of the >> potential >> surprise and trouble it may create for front-end writers who >> aren't aware of >> this. >> > Good point. As Evan points out, the asm printer is already doing a lot > of stuff that it shouldn't, but my patch doesn't handle the case where > bitcode is generated by non-llvm-gcc programs or on other platforms. > :-/ I'll check into this more. The macro can stay and we can just emit > the warning, still emit the global aliasing code, but ignore it during > assembly emission. > > Evan, does this sound like an okay idea? I think it is reasonable for the target to tolerate and ignore aliases if it sees them and they aren't supported, but I think this is an area where a front-end needs to be "target aware". Maybe TargetAsmInfo (which is used by the front-end) should have a bool indicating whether aliases are supported, and maybe we should use that to control llvm-gcc instead of the GCC macro? -Chris From isanbard at gmail.com Tue Sep 18 00:03:45 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 18 Sep 2007 05:03:45 -0000 Subject: [llvm-commits] [llvm] r42078 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter.cpp Message-ID: <200709180503.l8I53jDK021542@zion.cs.uiuc.edu> Author: void Date: Tue Sep 18 00:03:44 2007 New Revision: 42078 URL: http://llvm.org/viewvc/llvm-project?rev=42078&view=rev Log: The exception handling function info should be reset for each new function. The information isn't used heavily -- it's only used at the end of exception handling emission -- so there's no need to cache it. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=42078&r1=42077&r2=42078&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Sep 18 00:03:44 2007 @@ -43,11 +43,6 @@ /// unsigned FunctionNumber; - /// Cache of mangled exception handling name for current function. This is - /// recalculated at the beginning of each call to runOnMachineFunction(). - /// - std::string CurrentFnEHName; - protected: // Necessary for external weak linkage support std::set ExtWeakSymbols; Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=42078&r1=42077&r2=42078&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Tue Sep 18 00:03:44 2007 @@ -163,10 +163,8 @@ const std::string & AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF) { assert(MF && "No machine function?"); - if (CurrentFnEHName != "") return CurrentFnEHName; - return CurrentFnEHName = - Mang->makeNameProper(MF->getFunction()->getName() + ".eh", - TAI->getGlobalPrefix()); + return Mang->makeNameProper(MF->getFunction()->getName() + ".eh", + TAI->getGlobalPrefix()); } void AsmPrinter::SetupMachineFunction(MachineFunction &MF) { From isanbard at gmail.com Tue Sep 18 00:28:20 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 18 Sep 2007 05:28:20 -0000 Subject: [llvm-commits] [llvm] r42079 - /llvm/trunk/CREDITS.TXT Message-ID: <200709180528.l8I5SKmb023072@zion.cs.uiuc.edu> Author: void Date: Tue Sep 18 00:28:19 2007 New Revision: 42079 URL: http://llvm.org/viewvc/llvm-project?rev=42079&view=rev Log: Update my entry. Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=42079&r1=42078&r2=42079&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Tue Sep 18 00:28:19 2007 @@ -246,6 +246,6 @@ N: Bill Wendling E: isanbard at gmail.com W: http://web.mac.com/bwendling/ +D: Darwin exception handling D: MMX & SSSE3 instructions D: SPEC2006 support - From tonic at nondot.org Tue Sep 18 00:28:53 2007 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 18 Sep 2007 05:28:53 -0000 Subject: [llvm-commits] [llvm] r42080 - /llvm/branches/release_21/lib/Transforms/Scalar/GVN.cpp Message-ID: <200709180528.l8I5SrWJ023106@zion.cs.uiuc.edu> Author: tbrethou Date: Tue Sep 18 00:28:53 2007 New Revision: 42080 URL: http://llvm.org/viewvc/llvm-project?rev=42080&view=rev Log: Merge from mainline because Owen said so. Modified: llvm/branches/release_21/lib/Transforms/Scalar/GVN.cpp Modified: llvm/branches/release_21/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/Transforms/Scalar/GVN.cpp?rev=42080&r1=42079&r2=42080&view=diff ============================================================================== --- llvm/branches/release_21/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/branches/release_21/lib/Transforms/Scalar/GVN.cpp Tue Sep 18 00:28:53 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 tonic at nondot.org Tue Sep 18 01:05:51 2007 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 18 Sep 2007 06:05:51 -0000 Subject: [llvm-commits] [llvm] r42081 - in /llvm/branches/release_21: include/llvm/Instructions.h lib/Target/CBackend/CBackend.cpp Message-ID: <200709180605.l8I65q4a024496@zion.cs.uiuc.edu> Author: tbrethou Date: Tue Sep 18 01:05:51 2007 New Revision: 42081 URL: http://llvm.org/viewvc/llvm-project?rev=42081&view=rev Log: Merge from mainline: Fix PR1666, SPASS with the CBE and 254.gap with the CBE. Modified: llvm/branches/release_21/include/llvm/Instructions.h llvm/branches/release_21/lib/Target/CBackend/CBackend.cpp Modified: llvm/branches/release_21/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/include/llvm/Instructions.h?rev=42081&r1=42080&r2=42081&view=diff ============================================================================== --- llvm/branches/release_21/include/llvm/Instructions.h (original) +++ llvm/branches/release_21/include/llvm/Instructions.h Tue Sep 18 01:05:51 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/branches/release_21/lib/Target/CBackend/CBackend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/Target/CBackend/CBackend.cpp?rev=42081&r1=42080&r2=42081&view=diff ============================================================================== --- llvm/branches/release_21/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/branches/release_21/lib/Target/CBackend/CBackend.cpp Tue Sep 18 01:05:51 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 : @@ -1245,52 +1245,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 @@ -2262,7 +2244,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; @@ -2278,7 +2260,7 @@ default: cerr << "Invalid icmp predicate!" << I; abort(); } - writeOperandWithCast(I.getOperand(1), I.getPredicate()); + writeOperandWithCast(I.getOperand(1), I); if (NeedsClosingParens) Out << "))"; From tonic at nondot.org Tue Sep 18 01:08:56 2007 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 18 Sep 2007 06:08:56 -0000 Subject: [llvm-commits] [llvm] r42082 - /llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp Message-ID: <200709180608.l8I68vjf024701@zion.cs.uiuc.edu> Author: tbrethou Date: Tue Sep 18 01:08:56 2007 New Revision: 42082 URL: http://llvm.org/viewvc/llvm-project?rev=42082&view=rev Log: Merge from mainline. Modified: llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp Modified: llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp?rev=42082&r1=42081&r2=42082&view=diff ============================================================================== --- llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp Tue Sep 18 01:08:56 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 tonic at nondot.org Tue Sep 18 01:11:27 2007 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 18 Sep 2007 06:11:27 -0000 Subject: [llvm-commits] [llvm] r42083 - /llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp Message-ID: <200709180611.l8I6BRAd024858@zion.cs.uiuc.edu> Author: tbrethou Date: Tue Sep 18 01:11:27 2007 New Revision: 42083 URL: http://llvm.org/viewvc/llvm-project?rev=42083&view=rev Log: Merge from mainline. Modified: llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp Modified: llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp?rev=42083&r1=42082&r2=42083&view=diff ============================================================================== --- llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/branches/release_21/lib/Target/X86/X86AsmPrinter.cpp Tue Sep 18 01:11:27 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 tonic at nondot.org Tue Sep 18 01:15:06 2007 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 18 Sep 2007 06:15:06 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42084 - /llvm-gcc-4.0/branches/release_21/gcc/config/i386/llvm-i386.cpp Message-ID: <200709180615.l8I6F6rO025106@zion.cs.uiuc.edu> Author: tbrethou Date: Tue Sep 18 01:15:05 2007 New Revision: 42084 URL: http://llvm.org/viewvc/llvm-project?rev=42084&view=rev Log: Merge from mainline. Modified: llvm-gcc-4.0/branches/release_21/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.0/branches/release_21/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/branches/release_21/gcc/config/i386/llvm-i386.cpp?rev=42084&r1=42083&r2=42084&view=diff ============================================================================== --- llvm-gcc-4.0/branches/release_21/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.0/branches/release_21/gcc/config/i386/llvm-i386.cpp Tue Sep 18 01:15:05 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 tonic at nondot.org Tue Sep 18 01:22:01 2007 From: tonic at nondot.org (Tanya Lattner) Date: Tue, 18 Sep 2007 06:22:01 -0000 Subject: [llvm-commits] [llvm] r42085 - in /llvm/branches/release_21/utils/TableGen: FileLexer.cpp.cvs FileParser.cpp.cvs FileParser.h.cvs Message-ID: <200709180622.l8I6M19n025681@zion.cs.uiuc.edu> Author: tbrethou Date: Tue Sep 18 01:22:01 2007 New Revision: 42085 URL: http://llvm.org/viewvc/llvm-project?rev=42085&view=rev Log: Merge from mainline. Modified: llvm/branches/release_21/utils/TableGen/FileLexer.cpp.cvs llvm/branches/release_21/utils/TableGen/FileParser.cpp.cvs llvm/branches/release_21/utils/TableGen/FileParser.h.cvs Modified: llvm/branches/release_21/utils/TableGen/FileLexer.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/utils/TableGen/FileLexer.cpp.cvs?rev=42085&r1=42084&r2=42085&view=diff ============================================================================== --- llvm/branches/release_21/utils/TableGen/FileLexer.cpp.cvs (original) +++ llvm/branches/release_21/utils/TableGen/FileLexer.cpp.cvs Tue Sep 18 01:22:01 2007 @@ -21,7 +21,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header$ + * $Header: /cvs/root/flex/flex/skel.c,v 1.2 2004/05/07 00:28:17 jkh Exp $ */ #define FLEX_SCANNER @@ -502,7 +502,7 @@ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 1 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" #define INITIAL 0 /*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===// // @@ -520,7 +520,7 @@ #define YY_NEVER_INTERACTIVE 1 #define comment 1 -#line 30 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 30 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" #include "llvm/Config/config.h" #include "llvm/Support/Streams.h" #include "Record.h" @@ -817,7 +817,7 @@ register char *yy_cp, *yy_bp; register int yy_act; -#line 185 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 185 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" #line 824 "Lexer.cpp" @@ -913,185 +913,185 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 187 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 187 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { /* Ignore comments */ } YY_BREAK case 2: YY_RULE_SETUP -#line 189 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { HandleInclude(yytext); } YY_BREAK case 3: YY_RULE_SETUP -#line 190 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 190 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2); return CODEFRAGMENT; } YY_BREAK case 4: YY_RULE_SETUP -#line 193 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 193 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return INT; } YY_BREAK case 5: YY_RULE_SETUP -#line 194 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 194 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return BIT; } YY_BREAK case 6: YY_RULE_SETUP -#line 195 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 195 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return BITS; } YY_BREAK case 7: YY_RULE_SETUP -#line 196 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 196 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return STRING; } YY_BREAK case 8: YY_RULE_SETUP -#line 197 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 197 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return LIST; } YY_BREAK case 9: YY_RULE_SETUP -#line 198 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 198 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return CODE; } YY_BREAK case 10: YY_RULE_SETUP -#line 199 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 199 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return DAG; } YY_BREAK case 11: YY_RULE_SETUP -#line 201 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 201 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return CLASS; } YY_BREAK case 12: YY_RULE_SETUP -#line 202 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 202 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return DEF; } YY_BREAK case 13: YY_RULE_SETUP -#line 203 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 203 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return DEFM; } YY_BREAK case 14: YY_RULE_SETUP -#line 204 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 204 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return MULTICLASS; } YY_BREAK case 15: YY_RULE_SETUP -#line 205 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 205 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return FIELD; } YY_BREAK case 16: YY_RULE_SETUP -#line 206 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 206 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return LET; } YY_BREAK case 17: YY_RULE_SETUP -#line 207 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 207 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return IN; } YY_BREAK case 18: YY_RULE_SETUP -#line 209 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 209 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return CONCATTOK; } YY_BREAK case 19: YY_RULE_SETUP -#line 210 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return SRATOK; } YY_BREAK case 20: YY_RULE_SETUP -#line 211 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 211 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return SRLTOK; } YY_BREAK case 21: YY_RULE_SETUP -#line 212 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 212 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return SHLTOK; } YY_BREAK case 22: YY_RULE_SETUP -#line 213 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 213 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return STRCONCATTOK; } YY_BREAK case 23: YY_RULE_SETUP -#line 216 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 216 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext, yytext+yyleng); return ID; } YY_BREAK case 24: YY_RULE_SETUP -#line 218 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 218 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng); return VARNAME; } YY_BREAK case 25: YY_RULE_SETUP -#line 221 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 221 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1); return STRVAL; } YY_BREAK case 26: YY_RULE_SETUP -#line 224 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 224 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { Filelval.IntVal = ParseInt(Filetext); return INTVAL; } YY_BREAK case 27: YY_RULE_SETUP -#line 226 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 226 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { /* Ignore whitespace */ } YY_BREAK case 28: YY_RULE_SETUP -#line 229 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 229 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { BEGIN(comment); CommentDepth++; } YY_BREAK case 29: YY_RULE_SETUP -#line 230 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 230 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" {} /* eat anything that's not a '*' or '/' */ YY_BREAK case 30: YY_RULE_SETUP -#line 231 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 231 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" {} /* eat up '*'s not followed by '/'s */ YY_BREAK case 31: YY_RULE_SETUP -#line 232 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 232 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { ++CommentDepth; } YY_BREAK case 32: YY_RULE_SETUP -#line 233 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 233 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" {} /* eat up /'s not followed by *'s */ YY_BREAK case 33: YY_RULE_SETUP -#line 234 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 234 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { if (!--CommentDepth) { BEGIN(INITIAL); } } YY_BREAK case YY_STATE_EOF(comment): -#line 235 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 235 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { err() << "Unterminated comment!\n"; exit(1); } YY_BREAK case 34: YY_RULE_SETUP -#line 237 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 237 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" { return Filetext[0]; } YY_BREAK case 35: YY_RULE_SETUP -#line 239 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK #line 1098 "Lexer.cpp" @@ -1978,6 +1978,6 @@ return 0; } #endif -#line 239 "/Volumes/Wildlings/echeng/llvm/utils/TableGen/FileLexer.l" +#line 239 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l" Modified: llvm/branches/release_21/utils/TableGen/FileParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/utils/TableGen/FileParser.cpp.cvs?rev=42085&r1=42084&r2=42085&view=diff ============================================================================== --- llvm/branches/release_21/utils/TableGen/FileParser.cpp.cvs (original) +++ llvm/branches/release_21/utils/TableGen/FileParser.cpp.cvs Tue Sep 18 01:22:01 2007 @@ -1,134 +1,42 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y + by GNU Bison version 1.28 */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. +#define YYBISON 1 /* Identify Bison output. */ - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.3" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - -/* Substitute the variable and function names. */ #define yyparse Fileparse -#define yylex Filelex +#define yylex Filelex #define yyerror Fileerror -#define yylval Filelval -#define yychar Filechar +#define yylval Filelval +#define yychar Filechar #define yydebug Filedebug #define yynerrs Filenerrs +#define INT 257 +#define BIT 258 +#define STRING 259 +#define BITS 260 +#define LIST 261 +#define CODE 262 +#define DAG 263 +#define CLASS 264 +#define DEF 265 +#define MULTICLASS 266 +#define DEFM 267 +#define FIELD 268 +#define LET 269 +#define IN 270 +#define CONCATTOK 271 +#define SHLTOK 272 +#define SRATOK 273 +#define SRLTOK 274 +#define STRCONCATTOK 275 +#define INTVAL 276 +#define ID 277 +#define VARNAME 278 +#define STRVAL 279 +#define CODEFRAGMENT 280 - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - INT = 258, - BIT = 259, - STRING = 260, - BITS = 261, - LIST = 262, - CODE = 263, - DAG = 264, - CLASS = 265, - DEF = 266, - MULTICLASS = 267, - DEFM = 268, - FIELD = 269, - LET = 270, - IN = 271, - SHLTOK = 272, - SRATOK = 273, - SRLTOK = 274, - STRCONCATTOK = 275, - INTVAL = 276, - ID = 277, - VARNAME = 278, - STRVAL = 279, - CODEFRAGMENT = 280 - }; -#endif -/* Tokens. */ -#define INT 258 -#define BIT 259 -#define STRING 260 -#define BITS 261 -#define LIST 262 -#define CODE 263 -#define DAG 264 -#define CLASS 265 -#define DEF 266 -#define MULTICLASS 267 -#define DEFM 268 -#define FIELD 269 -#define LET 270 -#define IN 271 -#define SHLTOK 272 -#define SRATOK 273 -#define SRLTOK 274 -#define STRCONCATTOK 275 -#define INTVAL 276 -#define ID 277 -#define VARNAME 278 -#define STRVAL 279 -#define CODEFRAGMENT 280 - - - - -/* Copy the first part of user declarations. */ -#line 14 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" +#line 14 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" #include "Record.h" #include "llvm/ADT/StringExtras.h" @@ -324,29 +232,8 @@ using namespace llvm; - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 210 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" -{ +#line 210 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +typedef union { std::string* StrVal; int IntVal; llvm::RecTy* Ty; @@ -358,1195 +245,575 @@ SubClassRefTy* SubClassRef; std::vector* SubClassList; std::vector >* DagValueList; -} -/* Line 193 of yacc.c. */ -#line 364 "FileParser.tab.c" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif +} YYSTYPE; +#include +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif -/* Copy the second part of user declarations. */ +#define YYFINAL 194 +#define YYFLAG -32768 +#define YYNTBASE 42 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 280 ? yytranslate[x] : 91) + +static const char yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 36, + 37, 2, 2, 38, 40, 35, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 39, 41, 27, + 29, 28, 30, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 33, 2, 34, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 31, 2, 32, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 +}; -/* Line 216 of yacc.c. */ -#line 377 "FileParser.tab.c" +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 4, 6, 11, 13, 18, 20, 22, 24, + 25, 27, 28, 31, 33, 35, 37, 39, 41, 43, + 47, 52, 57, 61, 65, 70, 75, 82, 89, 96, + 103, 110, 111, 114, 117, 122, 123, 125, 127, 131, + 134, 138, 144, 149, 151, 152, 156, 157, 159, 161, + 165, 170, 173, 180, 181, 184, 186, 190, 192, 197, + 199, 203, 204, 207, 209, 213, 217, 218, 220, 222, + 223, 225, 227, 229, 230, 234, 235, 236, 243, 247, + 249, 251, 254, 256, 257, 258, 267, 268, 275, 277, + 279, 281, 283, 288, 290, 294, 295, 300, 305, 308, + 310, 313 +}; -#ifdef short -# undef short -#endif +static const short yyrhs[] = { 23, + 0, 5, 0, 4, 0, 6, 27, 22, 28, 0, + 3, 0, 7, 27, 43, 28, 0, 8, 0, 9, + 0, 42, 0, 0, 14, 0, 0, 29, 47, 0, + 23, 0, 46, 0, 22, 0, 25, 0, 26, 0, + 30, 0, 31, 54, 32, 0, 23, 27, 55, 28, + 0, 47, 31, 52, 32, 0, 33, 54, 34, 0, + 47, 35, 23, 0, 36, 46, 50, 37, 0, 47, + 33, 52, 34, 0, 17, 36, 47, 38, 47, 37, + 0, 18, 36, 47, 38, 47, 37, 0, 19, 36, + 47, 38, 47, 37, 0, 20, 36, 47, 38, 47, + 37, 0, 21, 36, 47, 38, 47, 37, 0, 0, + 39, 24, 0, 47, 48, 0, 49, 38, 47, 48, + 0, 0, 49, 0, 22, 0, 22, 40, 22, 0, + 22, 22, 0, 51, 38, 22, 0, 51, 38, 22, + 40, 22, 0, 51, 38, 22, 22, 0, 51, 0, + 0, 31, 52, 32, 0, 0, 55, 0, 47, 0, + 55, 38, 47, 0, 44, 43, 23, 45, 0, 56, + 41, 0, 15, 23, 53, 29, 47, 41, 0, 0, + 58, 57, 0, 41, 0, 31, 58, 32, 0, 42, + 0, 42, 27, 55, 28, 0, 60, 0, 61, 38, + 60, 0, 0, 39, 61, 0, 56, 0, 63, 38, + 56, 0, 27, 63, 28, 0, 0, 64, 0, 23, + 0, 0, 66, 0, 67, 0, 67, 0, 0, 62, + 71, 59, 0, 0, 0, 10, 68, 73, 65, 74, + 70, 0, 11, 69, 70, 0, 75, 0, 76, 0, + 77, 76, 0, 23, 0, 0, 0, 12, 78, 80, + 65, 81, 31, 77, 32, 0, 0, 13, 23, 83, + 39, 60, 41, 0, 72, 0, 75, 0, 79, 0, + 82, 0, 23, 53, 29, 47, 0, 85, 0, 86, + 38, 85, 0, 0, 15, 88, 86, 16, 0, 87, + 31, 89, 32, 0, 87, 84, 0, 84, 0, 89, + 84, 0, 89, 0 +}; -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 246, 268, 270, 272, 274, 276, 278, 280, 282, 286, + 286, 288, 288, 290, 313, 315, 317, 320, 323, 325, + 338, 366, 373, 376, 383, 386, 394, 396, 398, 400, + 402, 406, 409, 413, 418, 424, 427, 430, 433, 446, + 460, 462, 475, 491, 493, 493, 497, 499, 503, 506, + 510, 527, 529, 535, 535, 536, 536, 538, 540, 544, + 549, 554, 557, 561, 564, 569, 570, 570, 572, 572, + 574, 581, 599, 624, 638, 643, 645, 647, 651, 661, + 675, 678, 682, 693, 695, 697, 702, 702, 776, 776, + 777, 777, 779, 784, 784, 787, 787, 790, 793, 797, + 797, 799 +}; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} +static const char * const yytname[] = { "$","error","$undefined.","INT","BIT", +"STRING","BITS","LIST","CODE","DAG","CLASS","DEF","MULTICLASS","DEFM","FIELD", +"LET","IN","CONCATTOK","SHLTOK","SRATOK","SRLTOK","STRCONCATTOK","INTVAL","ID", +"VARNAME","STRVAL","CODEFRAGMENT","'<'","'>'","'='","'?'","'{'","'}'","'['", +"']'","'.'","'('","')'","','","':'","'-'","';'","ClassID","Type","OptPrefix", +"OptValue","IDValue","Value","OptVarName","DagArgListNE","DagArgList","RBitList", +"BitList","OptBitList","ValueList","ValueListNE","Declaration","BodyItem","BodyList", +"Body","SubClassRef","ClassListNE","ClassList","DeclListNE","TemplateArgList", +"OptTemplateArgList","OptID","ObjectName","ClassName","DefName","ObjectBody", +"@1","ClassInst","@2","@3","DefInst","MultiClassDef","MultiClassBody","MultiClassName", +"MultiClassInst","@4","@5","DefMInst","@6","Object","LETItem","LETList","LETCommand", +"@7","ObjectList","File", NULL +}; #endif -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss; - YYSTYPE yyvs; - }; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 27 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 204 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 41 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 50 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 102 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 188 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 280 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 35, 36, 2, 2, 37, 39, 34, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 38, 40, - 26, 28, 27, 29, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 32, 2, 33, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 30, 2, 31, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25 +static const short yyr1[] = { 0, + 42, 43, 43, 43, 43, 43, 43, 43, 43, 44, + 44, 45, 45, 46, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 48, 48, 49, 49, 50, 50, 51, 51, 51, + 51, 51, 51, 52, 53, 53, 54, 54, 55, 55, + 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, + 61, 62, 62, 63, 63, 64, 65, 65, 66, 66, + 67, 68, 69, 71, 70, 73, 74, 72, 75, 76, + 77, 77, 78, 80, 81, 79, 83, 82, 84, 84, + 84, 84, 85, 86, 86, 88, 87, 84, 84, 89, + 89, 90 }; -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 5, 7, 9, 14, 16, 21, 23, - 25, 27, 28, 30, 31, 34, 36, 38, 40, 42, - 44, 46, 50, 55, 60, 64, 68, 73, 78, 85, - 92, 99, 106, 107, 110, 113, 118, 119, 121, 123, - 127, 130, 134, 140, 145, 147, 148, 152, 153, 155, - 157, 161, 166, 169, 176, 177, 180, 182, 186, 188, - 193, 195, 199, 200, 203, 205, 209, 213, 214, 216, - 218, 219, 221, 223, 225, 226, 230, 231, 232, 239, - 243, 245, 247, 250, 252, 253, 254, 263, 264, 271, - 273, 275, 277, 279, 284, 286, 290, 291, 296, 301, - 304, 306, 309 +static const short yyr2[] = { 0, + 1, 1, 1, 4, 1, 4, 1, 1, 1, 0, + 1, 0, 2, 1, 1, 1, 1, 1, 1, 3, + 4, 4, 3, 3, 4, 4, 6, 6, 6, 6, + 6, 0, 2, 2, 4, 0, 1, 1, 3, 2, + 3, 5, 4, 1, 0, 3, 0, 1, 1, 3, + 4, 2, 6, 0, 2, 1, 3, 1, 4, 1, + 3, 0, 2, 1, 3, 3, 0, 1, 1, 0, + 1, 1, 1, 0, 3, 0, 0, 6, 3, 1, + 1, 2, 1, 0, 0, 8, 0, 6, 1, 1, + 1, 1, 4, 1, 3, 0, 4, 4, 2, 1, + 2, 1 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = -{ - 90, 0, -1, 22, -1, 5, -1, 4, -1, 6, - 26, 21, 27, -1, 3, -1, 7, 26, 43, 27, - -1, 8, -1, 9, -1, 42, -1, -1, 14, -1, - -1, 28, 47, -1, 22, -1, 46, -1, 21, -1, - 24, -1, 25, -1, 29, -1, 30, 54, 31, -1, - 22, 26, 55, 27, -1, 47, 30, 52, 31, -1, - 32, 54, 33, -1, 47, 34, 22, -1, 35, 46, - 50, 36, -1, 47, 32, 52, 33, -1, 17, 35, - 47, 37, 47, 36, -1, 18, 35, 47, 37, 47, - 36, -1, 19, 35, 47, 37, 47, 36, -1, 20, - 35, 47, 37, 47, 36, -1, -1, 38, 23, -1, - 47, 48, -1, 49, 37, 47, 48, -1, -1, 49, - -1, 21, -1, 21, 39, 21, -1, 21, 21, -1, - 51, 37, 21, -1, 51, 37, 21, 39, 21, -1, - 51, 37, 21, 21, -1, 51, -1, -1, 30, 52, - 31, -1, -1, 55, -1, 47, -1, 55, 37, 47, - -1, 44, 43, 22, 45, -1, 56, 40, -1, 15, - 22, 53, 28, 47, 40, -1, -1, 58, 57, -1, - 40, -1, 30, 58, 31, -1, 42, -1, 42, 26, - 55, 27, -1, 60, -1, 61, 37, 60, -1, -1, - 38, 61, -1, 56, -1, 63, 37, 56, -1, 26, - 63, 27, -1, -1, 64, -1, 22, -1, -1, 66, - -1, 67, -1, 67, -1, -1, 62, 71, 59, -1, - -1, -1, 10, 68, 73, 65, 74, 70, -1, 11, - 69, 70, -1, 75, -1, 76, -1, 77, 76, -1, - 22, -1, -1, -1, 12, 78, 80, 65, 81, 30, - 77, 31, -1, -1, 13, 22, 83, 38, 60, 40, - -1, 72, -1, 75, -1, 79, -1, 82, -1, 22, - 53, 28, 47, -1, 85, -1, 86, 37, 85, -1, - -1, 15, 88, 86, 16, -1, 87, 30, 89, 31, - -1, 87, 84, -1, 84, -1, 89, 84, -1, 89, - -1 +static const short yydefact[] = { 0, + 70, 70, 0, 0, 96, 89, 90, 91, 92, 100, + 0, 102, 69, 71, 72, 76, 73, 62, 83, 84, + 87, 0, 0, 99, 101, 67, 0, 74, 79, 67, + 0, 45, 94, 0, 0, 10, 68, 77, 1, 58, + 60, 63, 0, 85, 0, 0, 0, 97, 0, 98, + 11, 0, 64, 0, 62, 0, 0, 54, 56, 75, + 0, 0, 38, 44, 0, 0, 95, 5, 3, 2, + 0, 0, 7, 8, 9, 0, 66, 10, 78, 0, + 0, 0, 0, 0, 16, 14, 17, 18, 19, 47, + 47, 0, 15, 49, 0, 61, 10, 0, 88, 40, + 0, 0, 46, 93, 0, 0, 12, 65, 0, 0, + 0, 0, 0, 0, 0, 48, 0, 14, 36, 0, + 0, 0, 59, 0, 0, 57, 0, 55, 80, 81, + 0, 39, 41, 0, 0, 0, 51, 0, 0, 0, + 0, 0, 0, 20, 23, 32, 37, 0, 0, 0, + 24, 50, 45, 52, 86, 82, 43, 0, 4, 6, + 13, 0, 0, 0, 0, 0, 21, 0, 34, 0, + 25, 22, 26, 0, 42, 0, 0, 0, 0, 0, + 33, 32, 0, 27, 28, 29, 30, 31, 35, 0, + 53, 0, 0, 0 }; -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 246, 246, 268, 270, 272, 274, 276, 278, 280, - 282, 286, 286, 288, 288, 290, 313, 315, 317, 320, - 323, 325, 338, 366, 373, 376, 383, 386, 394, 396, - 398, 400, 404, 407, 411, 416, 422, 425, 428, 431, - 444, 458, 460, 473, 489, 491, 491, 495, 497, 501, - 504, 508, 525, 527, 533, 533, 534, 534, 536, 538, - 542, 547, 552, 555, 559, 562, 567, 568, 568, 570, - 570, 572, 579, 597, 622, 622, 641, 643, 641, 649, - 659, 673, 676, 680, 691, 693, 691, 700, 700, 774, - 774, 775, 775, 777, 782, 782, 785, 785, 788, 791, - 795, 795, 797 +static const short yydefgoto[] = { 40, + 76, 52, 137, 93, 94, 169, 147, 148, 64, 65, + 47, 115, 116, 53, 128, 97, 60, 41, 42, 28, + 54, 37, 38, 14, 15, 16, 18, 29, 43, 6, + 26, 55, 7, 130, 131, 20, 8, 30, 61, 9, + 31, 10, 33, 34, 11, 22, 12, 192 }; -#endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "INT", "BIT", "STRING", "BITS", "LIST", - "CODE", "DAG", "CLASS", "DEF", "MULTICLASS", "DEFM", "FIELD", "LET", - "IN", "SHLTOK", "SRATOK", "SRLTOK", "STRCONCATTOK", "INTVAL", "ID", - "VARNAME", "STRVAL", "CODEFRAGMENT", "'<'", "'>'", "'='", "'?'", "'{'", - "'}'", "'['", "']'", "'.'", "'('", "')'", "','", "':'", "'-'", "';'", - "$accept", "ClassID", "Type", "OptPrefix", "OptValue", "IDValue", - "Value", "OptVarName", "DagArgListNE", "DagArgList", "RBitList", - "BitList", "OptBitList", "ValueList", "ValueListNE", "Declaration", - "BodyItem", "BodyList", "Body", "SubClassRef", "ClassListNE", - "ClassList", "DeclListNE", "TemplateArgList", "OptTemplateArgList", - "OptID", "ObjectName", "ClassName", "DefName", "ObjectBody", "@1", - "ClassInst", "@2", "@3", "DefInst", "MultiClassDef", "MultiClassBody", - "MultiClassName", "MultiClassInst", "@4", "@5", "DefMInst", "@6", - "Object", "LETItem", "LETList", "LETCommand", "@7", "ObjectList", "File", 0 +static const short yypact[] = { 147, + -17, -17, 8, 12,-32768,-32768,-32768,-32768,-32768,-32768, + 3, 147,-32768,-32768,-32768,-32768,-32768, -13,-32768,-32768, +-32768, 17, 147,-32768,-32768, 21, 58,-32768,-32768, 21, + 45, 55,-32768, -5, -3, 77,-32768,-32768,-32768, 68, +-32768, 64, -4,-32768, 58, 84, 81,-32768, 17,-32768, +-32768, 16,-32768, 13, -13, 43, 58,-32768,-32768,-32768, + 88, 74, 10, 83, 93, 43,-32768,-32768,-32768,-32768, + 100, 104,-32768,-32768,-32768, 110,-32768, 77,-32768, 117, + 125, 127, 128, 129,-32768, 139,-32768,-32768,-32768, 43, + 43, 132,-32768, 59, 14,-32768, 40, 156,-32768,-32768, + 146, 148,-32768, 59, 149, 16, 140,-32768, 43, 43, + 43, 43, 43, 43, 141, 134, 142,-32768, 43, 84, + 84, 151,-32768, 43, 152,-32768, 136,-32768,-32768,-32768, + 6,-32768, 35, 150, 153, 43,-32768, 70, 76, 85, + 91, 97, 39,-32768,-32768, 54, 144, 143, 154, 145, +-32768, 59, 55,-32768,-32768,-32768,-32768, 161,-32768,-32768, + 59, 43, 43, 43, 43, 43,-32768, 160,-32768, 43, +-32768,-32768,-32768, 158,-32768, 103, 106, 111, 114, 119, +-32768, 54, 43,-32768,-32768,-32768,-32768,-32768,-32768, 47, +-32768, 185, 188,-32768 }; -#endif -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 60, 62, 61, 63, - 123, 125, 91, 93, 46, 40, 41, 44, 58, 45, - 59 +static const short yypgoto[] = { -50, + 86,-32768,-32768, 98, -66, 7,-32768,-32768,-32768, -8, + 38, 102, -55, -48,-32768,-32768,-32768, 26,-32768,-32768, +-32768,-32768, 164,-32768, 193,-32768,-32768, 155,-32768,-32768, +-32768,-32768, -95, 65,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, -7, 157,-32768,-32768,-32768, 174,-32768 }; -# endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 41, 42, 43, 43, 43, 43, 43, 43, 43, - 43, 44, 44, 45, 45, 46, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, - 51, 51, 51, 51, 52, 53, 53, 54, 54, 55, - 55, 56, 57, 57, 58, 58, 59, 59, 60, 60, - 61, 61, 62, 62, 63, 63, 64, 65, 65, 66, - 66, 67, 68, 69, 71, 70, 73, 74, 72, 75, - 76, 77, 77, 78, 80, 81, 79, 83, 82, 84, - 84, 84, 84, 85, 86, 86, 88, 87, 84, 84, - 89, 89, 90 -}; -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 1, 4, 1, 4, 1, 1, - 1, 0, 1, 0, 2, 1, 1, 1, 1, 1, - 1, 3, 4, 4, 3, 3, 4, 4, 6, 6, - 6, 6, 0, 2, 2, 4, 0, 1, 1, 3, - 2, 3, 5, 4, 1, 0, 3, 0, 1, 1, - 3, 4, 2, 6, 0, 2, 1, 3, 1, 4, - 1, 3, 0, 2, 1, 3, 3, 0, 1, 1, - 0, 1, 1, 1, 0, 3, 0, 0, 6, 3, - 1, 1, 2, 1, 0, 0, 8, 0, 6, 1, - 1, 1, 1, 4, 1, 3, 0, 4, 4, 2, - 1, 2, 1 -}; +#define YYLAST 210 -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 70, 70, 0, 0, 96, 89, 90, 91, 92, - 100, 0, 102, 0, 69, 71, 72, 76, 73, 62, - 83, 84, 87, 0, 0, 99, 101, 1, 67, 0, - 74, 79, 67, 0, 45, 94, 0, 0, 11, 68, - 77, 2, 58, 60, 63, 0, 85, 0, 0, 0, - 97, 0, 98, 12, 0, 64, 0, 62, 0, 0, - 54, 56, 75, 0, 0, 38, 44, 0, 0, 95, - 6, 4, 3, 0, 0, 8, 9, 10, 0, 66, - 11, 78, 0, 0, 0, 0, 17, 15, 18, 19, - 20, 47, 47, 0, 16, 49, 0, 61, 11, 0, - 88, 40, 0, 0, 46, 93, 0, 0, 13, 65, - 0, 0, 0, 0, 0, 0, 48, 0, 15, 36, - 0, 0, 0, 59, 0, 0, 57, 0, 55, 80, - 81, 0, 39, 41, 0, 0, 0, 51, 0, 0, - 0, 0, 0, 21, 24, 32, 37, 0, 0, 0, - 25, 50, 45, 52, 86, 82, 43, 0, 5, 7, - 14, 0, 0, 0, 0, 22, 0, 34, 0, 26, - 23, 27, 0, 42, 0, 0, 0, 0, 33, 32, - 0, 28, 29, 30, 31, 35, 0, 53 -}; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 42, 78, 54, 137, 94, 95, 167, 146, 147, - 66, 67, 49, 115, 116, 55, 128, 98, 62, 43, - 44, 30, 56, 39, 40, 15, 16, 17, 19, 31, - 45, 6, 28, 57, 7, 130, 131, 21, 8, 32, - 63, 9, 33, 10, 35, 36, 11, 23, 12, 13 +static const short yytable[] = { 104, + 95, 75, 129, 24, 25, 13, 1, 2, 3, 4, + 48, 5, 1, 2, 3, 4, 2, 5, 68, 69, + 70, 71, 72, 73, 74, 27, 58, 25, 50, 108, + 19, 100, 49, 23, 21, 129, 59, 155, 39, 32, + 77, 123, 138, 139, 140, 141, 142, 36, 127, 101, + 78, 124, 146, 51, 125, 75, 157, 152, 143, 80, + 81, 82, 83, 84, 85, 86, 167, 87, 88, 161, + 62, 126, 89, 90, 158, 91, 124, 120, 92, 121, + 39, 122, 96, 45, 120, 46, 121, 191, 122, 120, + 51, 121, 168, 122, 56, 176, 177, 178, 179, 180, + 120, 57, 121, 182, 122, 63, 120, 162, 121, 66, + 122, 149, 150, 163, 99, 120, 190, 121, 98, 122, + 102, 120, 164, 121, 103, 122, 105, 120, 165, 121, + 106, 122, 107, 120, 166, 121, 120, 122, 121, 184, + 122, 120, 185, 121, 120, 122, 121, 186, 122, 120, + 187, 121, 109, 122, 118, 188, 1, 2, 3, 4, + 110, 5, 111, 112, 113, 114, 2, 132, 136, 133, + 134, 124, 144, 151, 153, 145, 154, 159, 173, 171, + 160, 170, 175, 181, 193, 172, 183, 194, 189, 119, + 174, 135, 117, 44, 17, 156, 35, 0, 0, 0, + 0, 0, 0, 0, 0, 67, 0, 0, 0, 79 }; -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -97 -static const yytype_int16 yypact[] = -{ - 129, 3, 3, 11, 19, -97, -97, -97, -97, -97, - -97, 2, 129, 48, -97, -97, -97, -97, -97, 29, - -97, -97, -97, 31, 129, -97, -97, -97, 43, 56, - -97, -97, 43, 42, 53, -97, -6, -4, 71, -97, - -97, -97, 72, -97, 65, 9, -97, 56, 87, 78, - -97, 31, -97, -97, 15, -97, 13, 29, 41, 56, - -97, -97, -97, 84, 80, 7, 81, 106, 41, -97, - -97, -97, -97, 120, 122, -97, -97, -97, 127, -97, - 71, -97, 115, 116, 117, 118, -97, 128, -97, -97, - -97, 41, 41, 133, -97, 113, 27, -97, 60, 145, - -97, -97, 136, 137, -97, 113, 138, 15, 132, -97, - 41, 41, 41, 41, 41, 130, 125, 131, -97, 41, - 87, 87, 141, -97, 41, 143, -97, 126, -97, -97, - -97, 5, -97, 8, 140, 142, 41, -97, 67, 73, - 79, 85, 45, -97, -97, 54, 134, 139, 146, 135, - -97, 113, 53, -97, -97, -97, -97, 149, -97, -97, - 113, 41, 41, 41, 41, -97, 150, -97, 41, -97, - -97, -97, 144, -97, 91, 94, 99, 102, -97, 54, - 41, -97, -97, -97, -97, -97, 47, -97 +static const short yycheck[] = { 66, + 56, 52, 98, 11, 12, 23, 10, 11, 12, 13, + 16, 15, 10, 11, 12, 13, 11, 15, 3, 4, + 5, 6, 7, 8, 9, 39, 31, 35, 32, 78, + 23, 22, 38, 31, 23, 131, 41, 32, 23, 23, + 28, 28, 109, 110, 111, 112, 113, 27, 97, 40, + 38, 38, 119, 14, 15, 106, 22, 124, 114, 17, + 18, 19, 20, 21, 22, 23, 28, 25, 26, 136, + 45, 32, 30, 31, 40, 33, 38, 31, 36, 33, + 23, 35, 57, 39, 31, 31, 33, 41, 35, 31, + 14, 33, 39, 35, 27, 162, 163, 164, 165, 166, + 31, 38, 33, 170, 35, 22, 31, 38, 33, 29, + 35, 120, 121, 38, 41, 31, 183, 33, 31, 35, + 38, 31, 38, 33, 32, 35, 27, 31, 38, 33, + 27, 35, 23, 31, 38, 33, 31, 35, 33, 37, + 35, 31, 37, 33, 31, 35, 33, 37, 35, 31, + 37, 33, 36, 35, 23, 37, 10, 11, 12, 13, + 36, 15, 36, 36, 36, 27, 11, 22, 29, 22, + 22, 38, 32, 23, 23, 34, 41, 28, 34, 37, + 28, 38, 22, 24, 0, 32, 29, 0, 182, 92, + 153, 106, 91, 30, 2, 131, 23, -1, -1, -1, + -1, -1, -1, -1, -1, 49, -1, -1, -1, 55 }; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/share/bison.simple" +/* This file comes from bison-1.28. */ -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -97, -52, 69, -97, -97, 86, -68, -5, -97, -97, - -97, -31, 26, 88, -57, -46, -97, -97, -97, -21, - -97, -97, -97, -97, 151, -97, 179, -97, -97, 147, - -97, -97, -97, -97, -96, 51, -97, -97, -97, -97, - -97, -97, -97, -7, 148, -97, -97, -97, 160, -97 -}; +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1 -static const yytype_uint8 yytable[] = -{ - 105, 96, 77, 129, 25, 26, 1, 2, 3, 4, - 50, 5, 1, 2, 3, 4, 2, 5, 70, 71, - 72, 73, 74, 75, 76, 14, 64, 52, 101, 156, - 26, 51, 24, 20, 109, 129, 154, 41, 97, 60, - 79, 22, 138, 139, 140, 141, 102, 157, 27, 61, - 80, 145, 127, 34, 123, 77, 151, 142, 82, 83, - 84, 85, 86, 87, 124, 88, 89, 29, 160, 38, - 90, 91, 165, 92, 53, 125, 93, 120, 41, 121, - 47, 122, 124, 48, 120, 53, 121, 187, 122, 148, - 149, 126, 166, 174, 175, 176, 177, 120, 58, 121, - 179, 122, 59, 120, 161, 121, 68, 122, 65, 120, - 162, 121, 186, 122, 99, 120, 163, 121, 103, 122, - 100, 120, 164, 121, 120, 122, 121, 181, 122, 120, - 182, 121, 120, 122, 121, 183, 122, 104, 184, 1, - 2, 3, 4, 120, 5, 121, 106, 122, 107, 108, - 110, 111, 112, 113, 114, 118, 2, 132, 133, 134, - 136, 143, 124, 150, 144, 152, 153, 158, 171, 159, - 173, 168, 180, 178, 185, 169, 135, 170, 172, 119, - 117, 18, 155, 46, 37, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 69, - 0, 0, 0, 0, 81 -}; + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. -static const yytype_int16 yycheck[] = -{ - 68, 58, 54, 99, 11, 12, 10, 11, 12, 13, - 16, 15, 10, 11, 12, 13, 11, 15, 3, 4, - 5, 6, 7, 8, 9, 22, 47, 31, 21, 21, - 37, 37, 30, 22, 80, 131, 31, 22, 59, 30, - 27, 22, 110, 111, 112, 113, 39, 39, 0, 40, - 37, 119, 98, 22, 27, 107, 124, 114, 17, 18, - 19, 20, 21, 22, 37, 24, 25, 38, 136, 26, - 29, 30, 27, 32, 14, 15, 35, 30, 22, 32, - 38, 34, 37, 30, 30, 14, 32, 40, 34, 120, - 121, 31, 38, 161, 162, 163, 164, 30, 26, 32, - 168, 34, 37, 30, 37, 32, 28, 34, 21, 30, - 37, 32, 180, 34, 30, 30, 37, 32, 37, 34, - 40, 30, 37, 32, 30, 34, 32, 36, 34, 30, - 36, 32, 30, 34, 32, 36, 34, 31, 36, 10, - 11, 12, 13, 30, 15, 32, 26, 34, 26, 22, - 35, 35, 35, 35, 26, 22, 11, 21, 21, 21, - 28, 31, 37, 22, 33, 22, 40, 27, 33, 27, - 21, 37, 28, 23, 179, 36, 107, 31, 152, 93, - 92, 2, 131, 32, 24, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, - -1, -1, -1, -1, 57 -}; + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 10, 11, 12, 13, 15, 72, 75, 79, 82, - 84, 87, 89, 90, 22, 66, 67, 68, 67, 69, - 22, 78, 22, 88, 30, 84, 84, 0, 73, 38, - 62, 70, 80, 83, 22, 85, 86, 89, 26, 64, - 65, 22, 42, 60, 61, 71, 65, 38, 30, 53, - 16, 37, 31, 14, 44, 56, 63, 74, 26, 37, - 30, 40, 59, 81, 60, 21, 51, 52, 28, 85, - 3, 4, 5, 6, 7, 8, 9, 42, 43, 27, - 37, 70, 17, 18, 19, 20, 21, 22, 24, 25, - 29, 30, 32, 35, 46, 47, 55, 60, 58, 30, - 40, 21, 39, 37, 31, 47, 26, 26, 22, 56, - 35, 35, 35, 35, 26, 54, 55, 54, 22, 46, - 30, 32, 34, 27, 37, 15, 31, 56, 57, 75, - 76, 77, 21, 21, 21, 43, 28, 45, 47, 47, - 47, 47, 55, 31, 33, 47, 49, 50, 52, 52, - 22, 47, 22, 40, 31, 76, 21, 39, 27, 27, - 47, 37, 37, 37, 37, 27, 38, 48, 37, 36, - 31, 33, 53, 21, 47, 47, 47, 47, 23, 47, - 28, 36, 36, 36, 36, 48, 47, 40 -}; + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA +#include +#else /* not sparc */ +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ +#include +#endif +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include */ + #pragma alloca +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible at ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#endif /* __hpux */ +#endif +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc +#endif + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) +#define YYEMPTY -2 #define YYEOF 0 - #define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ - #define YYFAIL goto yyerrlab - #define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ +#define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ goto yybackup; \ } \ else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) #define YYTERROR 1 #define YYERRCODE 256 - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +#ifndef YYPURE +#define YYLEX yylex() #endif - -/* YYLEX -- calling `yylex' with the right arguments. */ - +#ifdef YYPURE +#ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else -# define YYLEX yylex () +#define YYLEX yylex(&yylval, &yylloc) #endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) #else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; +#define YYLEX yylex(&yylval) #endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; +#endif /* not YYLSP_NEEDED */ #endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ +/* If nonreentrant, generate the variables here */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) -#else -static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); - YYFPRINTF (stderr, "\n"); -} +#ifndef YYPURE -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ #endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); - } -} -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ +/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -/* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -# define YYINITDEPTH 200 +#define YYINITDEPTH 200 #endif -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif #ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 +#define YYMAXDEPTH 10000 #endif - +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + unsigned int count; +{ + register char *f = from; + register char *t = to; + register int i = count; - return yyd - 1; + while (i-- > 0) + *t++ = *f++; } -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif +#else /* __cplusplus */ -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (char *to, char *from, unsigned int count) { - int yyn = yypact[yystate]; - - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; + register char *t = to; + register char *f = from; + register int i = count; - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } + while (i-- > 0) + *t++ = *f++; } -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; #endif -{ - YYUSE (yyvaluep); - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} +#endif +#line 217 "/usr/share/bison.simple" -/* Prevent warnings from -Wmissing-prototypes. */ +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ #ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ + +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ +#ifdef YYPARSE_PARAM +int yyparse (void *); #else -int yyparse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus int yyparse (void); -#else -int yyparse (); #endif -#endif /* ! YYPARSE_PARAM */ - - - -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; +#endif -/* Number of syntax errors so far. */ -int yynerrs; +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ -/*----------. -| yyparse. | -`----------*/ +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; +#define YYPOPSTACK (yyvsp--, yyssp--) #endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) -#else -int -yyparse () + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; + +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; #endif #endif -{ - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ + int yylen; - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - YYDPRINTF ((stderr, "Starting parse\n")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif yystate = 0; yyerrstatus = 0; @@ -1558,665 +825,676 @@ so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; + yyssp = yyss - 1; yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: - yysetstate: - *yyssp = yystate; + *++yyssp = yystate; - if (yyss + yystacksize - 1 <= yyssp) + if (yyssp >= yyss + yystacksize - 1) { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + int size = yyssp - yyss + 1; #ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif + + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif #else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) + if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif #endif /* no yyoverflow */ - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif - if (yyss + yystacksize - 1 <= yyssp) + if (yyssp >= yyss + yystacksize - 1) YYABORT; } - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif goto yybackup; + yybackup: -/*-----------. -| yybackup. | -`-----------*/ -yybackup: +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + /* First try to decide what to do without reference to lookahead token. */ - /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yyn == YYFLAG) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif yychar = YYLEX; } - if (yychar <= YYEOF) + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif } else { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif } - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; + yyn = yytable[yyn]; - if (yyn <= 0) + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) + if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } + else if (yyn == 0) + goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; + /* Shift the lookahead token. */ - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif - /* Discard the shifted token unless it is eof. */ + /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; - yystate = yyn; *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif - goto yynewstate; + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + yystate = yyn; + goto yynewstate; -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ +/* Do the default action for the current state. */ yydefault: + yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; - goto yyreduce; - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ +/* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: - /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. +#if YYDEBUG != 0 + if (yydebug) + { + int i; - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: -#line 246 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + + switch (yyn) { + +case 1: +#line 246 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ if (CurDefmPrefix) { // If CurDefmPrefix is set, we're parsing a defm, which means that this is // actually the name of a multiclass. - MultiClass *MC = MultiClasses[*(yyvsp[(1) - (1)].StrVal)]; + MultiClass *MC = MultiClasses[*yyvsp[0].StrVal]; if (MC == 0) { - err() << "Couldn't find class '" << *(yyvsp[(1) - (1)].StrVal) << "'!\n"; + err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n"; exit(1); } - (yyval.Rec) = &MC->Rec; + yyval.Rec = &MC->Rec; } else { - (yyval.Rec) = Records.getClass(*(yyvsp[(1) - (1)].StrVal)); + yyval.Rec = Records.getClass(*yyvsp[0].StrVal); } - if ((yyval.Rec) == 0) { - err() << "Couldn't find class '" << *(yyvsp[(1) - (1)].StrVal) << "'!\n"; + if (yyval.Rec == 0) { + err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n"; exit(1); } - delete (yyvsp[(1) - (1)].StrVal); - ;} - break; - - case 3: -#line 268 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // string type - (yyval.Ty) = new StringRecTy(); - ;} - break; - - case 4: -#line 270 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // bit type - (yyval.Ty) = new BitRecTy(); - ;} - break; - - case 5: -#line 272 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // bits type - (yyval.Ty) = new BitsRecTy((yyvsp[(3) - (4)].IntVal)); - ;} - break; - - case 6: -#line 274 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // int type - (yyval.Ty) = new IntRecTy(); - ;} - break; - - case 7: -#line 276 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // list type - (yyval.Ty) = new ListRecTy((yyvsp[(3) - (4)].Ty)); - ;} - break; - - case 8: -#line 278 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // code type - (yyval.Ty) = new CodeRecTy(); - ;} - break; - - case 9: -#line 280 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // dag type - (yyval.Ty) = new DagRecTy(); - ;} - break; - - case 10: -#line 282 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { // Record Type - (yyval.Ty) = new RecordRecTy((yyvsp[(1) - (1)].Rec)); - ;} - break; - - case 11: -#line 286 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.IntVal) = 0; ;} - break; - - case 12: -#line 286 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.IntVal) = 1; ;} - break; - - case 13: -#line 288 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.Initializer) = 0; ;} - break; - - case 14: -#line 288 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.Initializer) = (yyvsp[(2) - (2)].Initializer); ;} - break; - - case 15: -#line 290 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - if (const RecordVal *RV = (CurRec ? CurRec->getValue(*(yyvsp[(1) - (1)].StrVal)) : 0)) { - (yyval.Initializer) = new VarInit(*(yyvsp[(1) - (1)].StrVal), RV->getType()); - } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*(yyvsp[(1) - (1)].StrVal))) { - const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*(yyvsp[(1) - (1)].StrVal)); + delete yyvsp[0].StrVal; + ; + break;} +case 2: +#line 268 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // string type + yyval.Ty = new StringRecTy(); + ; + break;} +case 3: +#line 270 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // bit type + yyval.Ty = new BitRecTy(); + ; + break;} +case 4: +#line 272 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // bits type + yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal); + ; + break;} +case 5: +#line 274 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // int type + yyval.Ty = new IntRecTy(); + ; + break;} +case 6: +#line 276 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // list type + yyval.Ty = new ListRecTy(yyvsp[-1].Ty); + ; + break;} +case 7: +#line 278 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // code type + yyval.Ty = new CodeRecTy(); + ; + break;} +case 8: +#line 280 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // dag type + yyval.Ty = new DagRecTy(); + ; + break;} +case 9: +#line 282 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // Record Type + yyval.Ty = new RecordRecTy(yyvsp[0].Rec); + ; + break;} +case 10: +#line 286 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.IntVal = 0; ; + break;} +case 11: +#line 286 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.IntVal = 1; ; + break;} +case 12: +#line 288 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.Initializer = 0; ; + break;} +case 13: +#line 288 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.Initializer = yyvsp[0].Initializer; ; + break;} +case 14: +#line 290 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) { + yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType()); + } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*yyvsp[0].StrVal)) { + const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*yyvsp[0].StrVal); assert(RV && "Template arg doesn't exist??"); - (yyval.Initializer) = new VarInit(CurRec->getName()+":"+*(yyvsp[(1) - (1)].StrVal), RV->getType()); + yyval.Initializer = new VarInit(CurRec->getName()+":"+*yyvsp[0].StrVal, RV->getType()); } else if (CurMultiClass && - CurMultiClass->Rec.isTemplateArg(CurMultiClass->Rec.getName()+"::"+*(yyvsp[(1) - (1)].StrVal))) { - std::string Name = CurMultiClass->Rec.getName()+"::"+*(yyvsp[(1) - (1)].StrVal); + CurMultiClass->Rec.isTemplateArg(CurMultiClass->Rec.getName()+"::"+*yyvsp[0].StrVal)) { + std::string Name = CurMultiClass->Rec.getName()+"::"+*yyvsp[0].StrVal; const RecordVal *RV = CurMultiClass->Rec.getValue(Name); assert(RV && "Template arg doesn't exist??"); - (yyval.Initializer) = new VarInit(Name, RV->getType()); - } else if (Record *D = Records.getDef(*(yyvsp[(1) - (1)].StrVal))) { - (yyval.Initializer) = new DefInit(D); + yyval.Initializer = new VarInit(Name, RV->getType()); + } else if (Record *D = Records.getDef(*yyvsp[0].StrVal)) { + yyval.Initializer = new DefInit(D); } else { - err() << "Variable not defined: '" << *(yyvsp[(1) - (1)].StrVal) << "'!\n"; + err() << "Variable not defined: '" << *yyvsp[0].StrVal << "'!\n"; exit(1); } - delete (yyvsp[(1) - (1)].StrVal); -;} - break; - - case 16: -#line 313 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (yyvsp[(1) - (1)].Initializer); - ;} - break; - - case 17: -#line 315 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new IntInit((yyvsp[(1) - (1)].IntVal)); - ;} - break; - - case 18: -#line 317 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new StringInit(*(yyvsp[(1) - (1)].StrVal)); - delete (yyvsp[(1) - (1)].StrVal); - ;} - break; - - case 19: -#line 320 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new CodeInit(*(yyvsp[(1) - (1)].StrVal)); - delete (yyvsp[(1) - (1)].StrVal); - ;} - break; - - case 20: -#line 323 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new UnsetInit(); - ;} - break; - - case 21: -#line 325 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - BitsInit *Init = new BitsInit((yyvsp[(2) - (3)].FieldList)->size()); - for (unsigned i = 0, e = (yyvsp[(2) - (3)].FieldList)->size(); i != e; ++i) { - struct Init *Bit = (*(yyvsp[(2) - (3)].FieldList))[i]->convertInitializerTo(new BitRecTy()); + delete yyvsp[0].StrVal; +; + break;} +case 15: +#line 313 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = yyvsp[0].Initializer; + ; + break;} +case 16: +#line 315 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new IntInit(yyvsp[0].IntVal); + ; + break;} +case 17: +#line 317 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new StringInit(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + ; + break;} +case 18: +#line 320 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new CodeInit(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + ; + break;} +case 19: +#line 323 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new UnsetInit(); + ; + break;} +case 20: +#line 325 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size()); + for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) { + struct Init *Bit = (*yyvsp[-1].FieldList)[i]->convertInitializerTo(new BitRecTy()); if (Bit == 0) { - err() << "Element #" << i << " (" << *(*(yyvsp[(2) - (3)].FieldList))[i] + err() << "Element #" << i << " (" << *(*yyvsp[-1].FieldList)[i] << ") is not convertable to a bit!\n"; exit(1); } - Init->setBit((yyvsp[(2) - (3)].FieldList)->size()-i-1, Bit); + Init->setBit(yyvsp[-1].FieldList->size()-i-1, Bit); } - (yyval.Initializer) = Init; - delete (yyvsp[(2) - (3)].FieldList); - ;} - break; - - case 22: -#line 338 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + yyval.Initializer = Init; + delete yyvsp[-1].FieldList; + ; + break;} +case 21: +#line 338 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // This is a CLASS expression. This is supposed to synthesize // a new anonymous definition, deriving from CLASS with no // body. - Record *Class = Records.getClass(*(yyvsp[(1) - (4)].StrVal)); + Record *Class = Records.getClass(*yyvsp[-3].StrVal); if (!Class) { - err() << "Expected a class, got '" << *(yyvsp[(1) - (4)].StrVal) << "'!\n"; + err() << "Expected a class, got '" << *yyvsp[-3].StrVal << "'!\n"; exit(1); } - delete (yyvsp[(1) - (4)].StrVal); + delete yyvsp[-3].StrVal; static unsigned AnonCounter = 0; Record *OldRec = CurRec; // Save CurRec. // Create the new record, set it as CurRec temporarily. CurRec = new Record("anonymous.val."+utostr(AnonCounter++)); - addSubClass(Class, *(yyvsp[(3) - (4)].FieldList)); // Add info about the subclass to CurRec. - delete (yyvsp[(3) - (4)].FieldList); // Free up the template args. + addSubClass(Class, *yyvsp[-1].FieldList); // Add info about the subclass to CurRec. + delete yyvsp[-1].FieldList; // Free up the template args. CurRec->resolveReferences(); Records.addDef(CurRec); // The result of the expression is a reference to the new record. - (yyval.Initializer) = new DefInit(CurRec); + yyval.Initializer = new DefInit(CurRec); // Restore the old CurRec CurRec = OldRec; - ;} - break; - - case 23: -#line 366 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (yyvsp[(1) - (4)].Initializer)->convertInitializerBitRange(*(yyvsp[(3) - (4)].BitList)); - if ((yyval.Initializer) == 0) { - err() << "Invalid bit range for value '" << *(yyvsp[(1) - (4)].Initializer) << "'!\n"; + ; + break;} +case 22: +#line 366 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList); + if (yyval.Initializer == 0) { + err() << "Invalid bit range for value '" << *yyvsp[-3].Initializer << "'!\n"; exit(1); } - delete (yyvsp[(3) - (4)].BitList); - ;} - break; - - case 24: -#line 373 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new ListInit(*(yyvsp[(2) - (3)].FieldList)); - delete (yyvsp[(2) - (3)].FieldList); - ;} - break; - - case 25: -#line 376 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - if (!(yyvsp[(1) - (3)].Initializer)->getFieldType(*(yyvsp[(3) - (3)].StrVal))) { - err() << "Cannot access field '" << *(yyvsp[(3) - (3)].StrVal) << "' of value '" << *(yyvsp[(1) - (3)].Initializer) << "!\n"; + delete yyvsp[-1].BitList; + ; + break;} +case 23: +#line 373 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new ListInit(*yyvsp[-1].FieldList); + delete yyvsp[-1].FieldList; + ; + break;} +case 24: +#line 376 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) { + err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n"; exit(1); } - (yyval.Initializer) = new FieldInit((yyvsp[(1) - (3)].Initializer), *(yyvsp[(3) - (3)].StrVal)); - delete (yyvsp[(3) - (3)].StrVal); - ;} - break; - - case 26: -#line 383 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = new DagInit((yyvsp[(2) - (4)].Initializer), *(yyvsp[(3) - (4)].DagValueList)); - delete (yyvsp[(3) - (4)].DagValueList); - ;} - break; - - case 27: -#line 386 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - std::reverse((yyvsp[(3) - (4)].BitList)->begin(), (yyvsp[(3) - (4)].BitList)->end()); - (yyval.Initializer) = (yyvsp[(1) - (4)].Initializer)->convertInitListSlice(*(yyvsp[(3) - (4)].BitList)); - if ((yyval.Initializer) == 0) { - err() << "Invalid list slice for value '" << *(yyvsp[(1) - (4)].Initializer) << "'!\n"; + yyval.Initializer = new FieldInit(yyvsp[-2].Initializer, *yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + ; + break;} +case 25: +#line 383 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = new DagInit(yyvsp[-2].Initializer, *yyvsp[-1].DagValueList); + delete yyvsp[-1].DagValueList; + ; + break;} +case 26: +#line 386 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end()); + yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList); + if (yyval.Initializer == 0) { + err() << "Invalid list slice for value '" << *yyvsp[-3].Initializer << "'!\n"; exit(1); } - delete (yyvsp[(3) - (4)].BitList); - ;} - break; - - case 28: -#line 394 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (new BinOpInit(BinOpInit::SHL, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold(); - ;} - break; - - case 29: -#line 396 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (new BinOpInit(BinOpInit::SRA, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold(); - ;} - break; - - case 30: -#line 398 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (new BinOpInit(BinOpInit::SRL, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold(); - ;} - break; - - case 31: -#line 400 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Initializer) = (new BinOpInit(BinOpInit::STRCONCAT, (yyvsp[(3) - (6)].Initializer), (yyvsp[(5) - (6)].Initializer)))->Fold(); - ;} - break; - - case 32: -#line 404 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.StrVal) = new std::string(); - ;} - break; - - case 33: -#line 407 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); - ;} - break; - - case 34: -#line 411 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.DagValueList) = new std::vector >(); - (yyval.DagValueList)->push_back(std::make_pair((yyvsp[(1) - (2)].Initializer), *(yyvsp[(2) - (2)].StrVal))); - delete (yyvsp[(2) - (2)].StrVal); - ;} - break; - - case 35: -#line 416 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyvsp[(1) - (4)].DagValueList)->push_back(std::make_pair((yyvsp[(3) - (4)].Initializer), *(yyvsp[(4) - (4)].StrVal))); - delete (yyvsp[(4) - (4)].StrVal); - (yyval.DagValueList) = (yyvsp[(1) - (4)].DagValueList); - ;} - break; - - case 36: -#line 422 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.DagValueList) = new std::vector >(); - ;} - break; - - case 37: -#line 425 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.DagValueList) = (yyvsp[(1) - (1)].DagValueList); ;} - break; - - case 38: -#line 428 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.BitList) = new std::vector(); - (yyval.BitList)->push_back((yyvsp[(1) - (1)].IntVal)); - ;} - break; - - case 39: -#line 431 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - if ((yyvsp[(1) - (3)].IntVal) < 0 || (yyvsp[(3) - (3)].IntVal) < 0) { - err() << "Invalid range: " << (yyvsp[(1) - (3)].IntVal) << "-" << (yyvsp[(3) - (3)].IntVal) << "!\n"; + delete yyvsp[-1].BitList; + ; + break;} +case 27: +#line 394 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = (new BinOpInit(BinOpInit::CONCAT, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); + ; + break;} +case 28: +#line 396 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = (new BinOpInit(BinOpInit::SHL, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); + ; + break;} +case 29: +#line 398 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = (new BinOpInit(BinOpInit::SRA, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); + ; + break;} +case 30: +#line 400 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = (new BinOpInit(BinOpInit::SRL, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); + ; + break;} +case 31: +#line 402 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Initializer = (new BinOpInit(BinOpInit::STRCONCAT, yyvsp[-3].Initializer, yyvsp[-1].Initializer))->Fold(); + ; + break;} +case 32: +#line 406 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.StrVal = new std::string(); + ; + break;} +case 33: +#line 409 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.StrVal = yyvsp[0].StrVal; + ; + break;} +case 34: +#line 413 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.DagValueList = new std::vector >(); + yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal)); + delete yyvsp[0].StrVal; + ; + break;} +case 35: +#line 418 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal)); + delete yyvsp[0].StrVal; + yyval.DagValueList = yyvsp[-3].DagValueList; + ; + break;} +case 36: +#line 424 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.DagValueList = new std::vector >(); + ; + break;} +case 37: +#line 427 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.DagValueList = yyvsp[0].DagValueList; ; + break;} +case 38: +#line 430 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.BitList = new std::vector(); + yyval.BitList->push_back(yyvsp[0].IntVal); + ; + break;} +case 39: +#line 433 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n"; exit(1); } - (yyval.BitList) = new std::vector(); - if ((yyvsp[(1) - (3)].IntVal) < (yyvsp[(3) - (3)].IntVal)) { - for (int i = (yyvsp[(1) - (3)].IntVal); i <= (yyvsp[(3) - (3)].IntVal); ++i) - (yyval.BitList)->push_back(i); + yyval.BitList = new std::vector(); + if (yyvsp[-2].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); } else { - for (int i = (yyvsp[(1) - (3)].IntVal); i >= (yyvsp[(3) - (3)].IntVal); --i) - (yyval.BitList)->push_back(i); + for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); } - ;} - break; - - case 40: -#line 444 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyvsp[(2) - (2)].IntVal) = -(yyvsp[(2) - (2)].IntVal); - if ((yyvsp[(1) - (2)].IntVal) < 0 || (yyvsp[(2) - (2)].IntVal) < 0) { - err() << "Invalid range: " << (yyvsp[(1) - (2)].IntVal) << "-" << (yyvsp[(2) - (2)].IntVal) << "!\n"; + ; + break;} +case 40: +#line 446 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyvsp[0].IntVal = -yyvsp[0].IntVal; + if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n"; exit(1); } - (yyval.BitList) = new std::vector(); - if ((yyvsp[(1) - (2)].IntVal) < (yyvsp[(2) - (2)].IntVal)) { - for (int i = (yyvsp[(1) - (2)].IntVal); i <= (yyvsp[(2) - (2)].IntVal); ++i) - (yyval.BitList)->push_back(i); + yyval.BitList = new std::vector(); + if (yyvsp[-1].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); } else { - for (int i = (yyvsp[(1) - (2)].IntVal); i >= (yyvsp[(2) - (2)].IntVal); --i) - (yyval.BitList)->push_back(i); + for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); } - ;} - break; - - case 41: -#line 458 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - ((yyval.BitList)=(yyvsp[(1) - (3)].BitList))->push_back((yyvsp[(3) - (3)].IntVal)); - ;} - break; - - case 42: -#line 460 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - if ((yyvsp[(3) - (5)].IntVal) < 0 || (yyvsp[(5) - (5)].IntVal) < 0) { - err() << "Invalid range: " << (yyvsp[(3) - (5)].IntVal) << "-" << (yyvsp[(5) - (5)].IntVal) << "!\n"; + ; + break;} +case 41: +#line 460 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + (yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal); + ; + break;} +case 42: +#line 462 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n"; exit(1); } - (yyval.BitList) = (yyvsp[(1) - (5)].BitList); - if ((yyvsp[(3) - (5)].IntVal) < (yyvsp[(5) - (5)].IntVal)) { - for (int i = (yyvsp[(3) - (5)].IntVal); i <= (yyvsp[(5) - (5)].IntVal); ++i) - (yyval.BitList)->push_back(i); + yyval.BitList = yyvsp[-4].BitList; + if (yyvsp[-2].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); } else { - for (int i = (yyvsp[(3) - (5)].IntVal); i >= (yyvsp[(5) - (5)].IntVal); --i) - (yyval.BitList)->push_back(i); + for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); } - ;} - break; - - case 43: -#line 473 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyvsp[(4) - (4)].IntVal) = -(yyvsp[(4) - (4)].IntVal); - if ((yyvsp[(3) - (4)].IntVal) < 0 || (yyvsp[(4) - (4)].IntVal) < 0) { - err() << "Invalid range: " << (yyvsp[(3) - (4)].IntVal) << "-" << (yyvsp[(4) - (4)].IntVal) << "!\n"; + ; + break;} +case 43: +#line 475 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyvsp[0].IntVal = -yyvsp[0].IntVal; + if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n"; exit(1); } - (yyval.BitList) = (yyvsp[(1) - (4)].BitList); - if ((yyvsp[(3) - (4)].IntVal) < (yyvsp[(4) - (4)].IntVal)) { - for (int i = (yyvsp[(3) - (4)].IntVal); i <= (yyvsp[(4) - (4)].IntVal); ++i) - (yyval.BitList)->push_back(i); + yyval.BitList = yyvsp[-3].BitList; + if (yyvsp[-1].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); } else { - for (int i = (yyvsp[(3) - (4)].IntVal); i >= (yyvsp[(4) - (4)].IntVal); --i) - (yyval.BitList)->push_back(i); + for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); } - ;} - break; - - case 44: -#line 489 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.BitList) = (yyvsp[(1) - (1)].BitList); std::reverse((yyvsp[(1) - (1)].BitList)->begin(), (yyvsp[(1) - (1)].BitList)->end()); ;} - break; - - case 45: -#line 491 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.BitList) = 0; ;} - break; - - case 46: -#line 491 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.BitList) = (yyvsp[(2) - (3)].BitList); ;} - break; - - case 47: -#line 495 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.FieldList) = new std::vector(); - ;} - break; - - case 48: -#line 497 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.FieldList) = (yyvsp[(1) - (1)].FieldList); - ;} - break; - - case 49: -#line 501 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.FieldList) = new std::vector(); - (yyval.FieldList)->push_back((yyvsp[(1) - (1)].Initializer)); - ;} - break; - - case 50: -#line 504 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - ((yyval.FieldList) = (yyvsp[(1) - (3)].FieldList))->push_back((yyvsp[(3) - (3)].Initializer)); - ;} - break; - - case 51: -#line 508 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - std::string DecName = *(yyvsp[(3) - (4)].StrVal); + ; + break;} +case 44: +#line 491 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ; + break;} +case 45: +#line 493 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.BitList = 0; ; + break;} +case 46: +#line 493 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.BitList = yyvsp[-1].BitList; ; + break;} +case 47: +#line 497 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.FieldList = new std::vector(); + ; + break;} +case 48: +#line 499 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.FieldList = yyvsp[0].FieldList; + ; + break;} +case 49: +#line 503 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.FieldList = new std::vector(); + yyval.FieldList->push_back(yyvsp[0].Initializer); + ; + break;} +case 50: +#line 506 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + (yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer); + ; + break;} +case 51: +#line 510 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + std::string DecName = *yyvsp[-1].StrVal; if (ParsingTemplateArgs) { if (CurRec) { DecName = CurRec->getName() + ":" + DecName; @@ -2227,119 +1505,104 @@ DecName = CurMultiClass->Rec.getName() + "::" + DecName; } - addValue(RecordVal(DecName, (yyvsp[(2) - (4)].Ty), (yyvsp[(1) - (4)].IntVal))); - setValue(DecName, 0, (yyvsp[(4) - (4)].Initializer)); - (yyval.StrVal) = new std::string(DecName); -;} - break; - - case 52: -#line 525 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - delete (yyvsp[(1) - (2)].StrVal); -;} - break; - - case 53: -#line 527 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - setValue(*(yyvsp[(2) - (6)].StrVal), (yyvsp[(3) - (6)].BitList), (yyvsp[(5) - (6)].Initializer)); - delete (yyvsp[(2) - (6)].StrVal); - delete (yyvsp[(3) - (6)].BitList); -;} - break; - - case 58: -#line 536 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.SubClassRef) = new SubClassRefTy((yyvsp[(1) - (1)].Rec), new std::vector()); - ;} - break; - - case 59: -#line 538 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.SubClassRef) = new SubClassRefTy((yyvsp[(1) - (4)].Rec), (yyvsp[(3) - (4)].FieldList)); - ;} - break; - - case 60: -#line 542 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.SubClassList) = new std::vector(); - (yyval.SubClassList)->push_back(*(yyvsp[(1) - (1)].SubClassRef)); - delete (yyvsp[(1) - (1)].SubClassRef); - ;} - break; - - case 61: -#line 547 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - ((yyval.SubClassList)=(yyvsp[(1) - (3)].SubClassList))->push_back(*(yyvsp[(3) - (3)].SubClassRef)); - delete (yyvsp[(3) - (3)].SubClassRef); - ;} - break; - - case 62: -#line 552 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.SubClassList) = new std::vector(); - ;} - break; - - case 63: -#line 555 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.SubClassList) = (yyvsp[(2) - (2)].SubClassList); - ;} - break; - - case 64: -#line 559 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - getActiveRec()->addTemplateArg(*(yyvsp[(1) - (1)].StrVal)); - delete (yyvsp[(1) - (1)].StrVal); -;} - break; - - case 65: -#line 562 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - getActiveRec()->addTemplateArg(*(yyvsp[(3) - (3)].StrVal)); - delete (yyvsp[(3) - (3)].StrVal); -;} - break; - - case 66: -#line 567 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - {;} - break; - - case 69: -#line 570 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} - break; - - case 70: -#line 570 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { (yyval.StrVal) = new std::string(); ;} - break; - - case 71: -#line 572 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + addValue(RecordVal(DecName, yyvsp[-2].Ty, yyvsp[-3].IntVal)); + setValue(DecName, 0, yyvsp[0].Initializer); + yyval.StrVal = new std::string(DecName); +; + break;} +case 52: +#line 527 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + delete yyvsp[-1].StrVal; +; + break;} +case 53: +#line 529 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer); + delete yyvsp[-4].StrVal; + delete yyvsp[-3].BitList; +; + break;} +case 58: +#line 538 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector()); + ; + break;} +case 59: +#line 540 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList); + ; + break;} +case 60: +#line 544 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.SubClassList = new std::vector(); + yyval.SubClassList->push_back(*yyvsp[0].SubClassRef); + delete yyvsp[0].SubClassRef; + ; + break;} +case 61: +#line 549 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + (yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef); + delete yyvsp[0].SubClassRef; + ; + break;} +case 62: +#line 554 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.SubClassList = new std::vector(); + ; + break;} +case 63: +#line 557 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.SubClassList = yyvsp[0].SubClassList; + ; + break;} +case 64: +#line 561 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + getActiveRec()->addTemplateArg(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; +; + break;} +case 65: +#line 564 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + getActiveRec()->addTemplateArg(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; +; + break;} +case 66: +#line 569 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +case 69: +#line 572 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.StrVal = yyvsp[0].StrVal; ; + break;} +case 70: +#line 572 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ yyval.StrVal = new std::string(); ; + break;} +case 71: +#line 574 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ static unsigned AnonCounter = 0; - if ((yyvsp[(1) - (1)].StrVal)->empty()) - *(yyvsp[(1) - (1)].StrVal) = "anonymous."+utostr(AnonCounter++); - (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); -;} - break; - - case 72: -#line 579 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + if (yyvsp[0].StrVal->empty()) + *yyvsp[0].StrVal = "anonymous."+utostr(AnonCounter++); + yyval.StrVal = yyvsp[0].StrVal; +; + break;} +case 72: +#line 581 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // If a class of this name already exists, it must be a forward ref. - if ((CurRec = Records.getClass(*(yyvsp[(1) - (1)].StrVal)))) { + if ((CurRec = Records.getClass(*yyvsp[0].StrVal))) { // If the body was previously defined, this is an error. if (!CurRec->getValues().empty() || !CurRec->getSuperClasses().empty() || @@ -2349,18 +1612,17 @@ } } else { // If this is the first reference to this class, create and add it. - CurRec = new Record(*(yyvsp[(1) - (1)].StrVal)); + CurRec = new Record(*yyvsp[0].StrVal); Records.addClass(CurRec); } - delete (yyvsp[(1) - (1)].StrVal); -;} - break; - - case 73: -#line 597 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - CurRec = new Record(*(yyvsp[(1) - (1)].StrVal)); - delete (yyvsp[(1) - (1)].StrVal); + delete yyvsp[0].StrVal; +; + break;} +case 73: +#line 599 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + CurRec = new Record(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; if (!CurMultiClass) { // Top-level def definition. @@ -2381,18 +1643,17 @@ } CurMultiClass->DefPrototypes.push_back(CurRec); } -;} - break; - - case 74: -#line 622 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - for (unsigned i = 0, e = (yyvsp[(1) - (1)].SubClassList)->size(); i != e; ++i) { - addSubClass((*(yyvsp[(1) - (1)].SubClassList))[i].first, *(*(yyvsp[(1) - (1)].SubClassList))[i].second); +; + break;} +case 74: +#line 624 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) { + addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second); // Delete the template arg values for the class - delete (*(yyvsp[(1) - (1)].SubClassList))[i].second; + delete (*yyvsp[0].SubClassList)[i].second; } - delete (yyvsp[(1) - (1)].SubClassList); // Delete the class list. + delete yyvsp[0].SubClassList; // Delete the class list. // Process any variables on the let stack. for (unsigned i = 0, e = LetStack.size(); i != e; ++i) @@ -2400,129 +1661,115 @@ setValue(LetStack[i][j].Name, LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0, LetStack[i][j].Value); - ;} - break; - - case 75: -#line 636 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Rec) = CurRec; + ; + break;} +case 75: +#line 638 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Rec = CurRec; CurRec = 0; - ;} - break; - - case 76: -#line 641 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 76: +#line 643 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ ParsingTemplateArgs = true; - ;} - break; - - case 77: -#line 643 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 77: +#line 645 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ ParsingTemplateArgs = false; - ;} - break; - - case 78: -#line 645 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Rec) = (yyvsp[(6) - (6)].Rec); - ;} - break; - - case 79: -#line 649 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 78: +#line 647 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Rec = yyvsp[0].Rec; + ; + break;} +case 79: +#line 651 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ if (CurMultiClass == 0) // Def's in multiclasses aren't really defs. - (yyvsp[(3) - (3)].Rec)->resolveReferences(); + yyvsp[0].Rec->resolveReferences(); // If ObjectBody has template arguments, it's an error. - assert((yyvsp[(3) - (3)].Rec)->getTemplateArgs().empty() && "How'd this get template args?"); - (yyval.Rec) = (yyvsp[(3) - (3)].Rec); -;} - break; - - case 80: -#line 659 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.Rec) = (yyvsp[(1) - (1)].Rec); + assert(yyvsp[0].Rec->getTemplateArgs().empty() && "How'd this get template args?"); + yyval.Rec = yyvsp[0].Rec; +; + break;} +case 80: +#line 661 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.Rec = yyvsp[0].Rec; // Copy the template arguments for the multiclass into the def. const std::vector &TArgs = CurMultiClass->Rec.getTemplateArgs(); for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { const RecordVal *RV = CurMultiClass->Rec.getValue(TArgs[i]); assert(RV && "Template arg doesn't exist?"); - (yyval.Rec)->addValue(*RV); + yyval.Rec->addValue(*RV); } -;} - break; - - case 81: -#line 673 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.RecList) = new std::vector(); - (yyval.RecList)->push_back((yyvsp[(1) - (1)].Rec)); -;} - break; - - case 82: -#line 676 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - (yyval.RecList)->push_back((yyvsp[(2) - (2)].Rec)); -;} - break; - - case 83: -#line 680 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - MultiClass *&MCE = MultiClasses[*(yyvsp[(1) - (1)].StrVal)]; +; + break;} +case 81: +#line 675 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.RecList = new std::vector(); + yyval.RecList->push_back(yyvsp[0].Rec); +; + break;} +case 82: +#line 678 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + yyval.RecList->push_back(yyvsp[0].Rec); +; + break;} +case 83: +#line 682 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + MultiClass *&MCE = MultiClasses[*yyvsp[0].StrVal]; if (MCE) { - err() << "multiclass '" << *(yyvsp[(1) - (1)].StrVal) << "' already defined!\n"; + err() << "multiclass '" << *yyvsp[0].StrVal << "' already defined!\n"; exit(1); } - MCE = CurMultiClass = new MultiClass(*(yyvsp[(1) - (1)].StrVal)); - delete (yyvsp[(1) - (1)].StrVal); -;} - break; - - case 84: -#line 691 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + MCE = CurMultiClass = new MultiClass(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; +; + break;} +case 84: +#line 693 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ ParsingTemplateArgs = true; - ;} - break; - - case 85: -#line 693 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 85: +#line 695 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ ParsingTemplateArgs = false; - ;} - break; - - case 86: -#line 695 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 86: +#line 697 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ CurMultiClass = 0; -;} - break; - - case 87: -#line 700 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { CurDefmPrefix = (yyvsp[(2) - (2)].StrVal); ;} - break; - - case 88: -#line 700 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { +; + break;} +case 87: +#line 702 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ CurDefmPrefix = yyvsp[0].StrVal; ; + break;} +case 88: +#line 702 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ // To instantiate a multiclass, we need to first get the multiclass, then // instantiate each def contained in the multiclass with the SubClassRef // template parameters. - MultiClass *MC = MultiClasses[(yyvsp[(5) - (6)].SubClassRef)->first->getName()]; + MultiClass *MC = MultiClasses[yyvsp[-1].SubClassRef->first->getName()]; assert(MC && "Didn't lookup multiclass correctly?"); - std::vector &TemplateVals = *(yyvsp[(5) - (6)].SubClassRef)->second; - delete (yyvsp[(5) - (6)].SubClassRef); + std::vector &TemplateVals = *yyvsp[-1].SubClassRef->second; + delete yyvsp[-1].SubClassRef; // Verify that the correct number of template arguments were specified. const std::vector &TArgs = MC->Rec.getTemplateArgs(); @@ -2537,7 +1784,7 @@ // Add the suffix to the defm name to get the new name. assert(CurRec == 0 && "A def is current?"); - CurRec = new Record(*(yyvsp[(2) - (6)].StrVal) + DefProto->getName()); + CurRec = new Record(*yyvsp[-4].StrVal + DefProto->getName()); addSubClass(DefProto, std::vector()); @@ -2573,7 +1820,7 @@ // Ensure redefinition doesn't happen. if (Records.getDef(CurRec->getName())) { err() << "def '" << CurRec->getName() << "' already defined, " - << "instantiating defm '" << *(yyvsp[(2) - (6)].StrVal) << "' with subdef '" + << "instantiating defm '" << *yyvsp[-4].StrVal << "' with subdef '" << DefProto->getName() << "'!\n"; exit(1); } @@ -2585,279 +1832,275 @@ } delete &TemplateVals; - delete (yyvsp[(2) - (6)].StrVal); + delete yyvsp[-4].StrVal; CurDefmPrefix = 0; -;} - break; - - case 89: -#line 774 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - {;} - break; - - case 90: -#line 774 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - {;} - break; - - case 93: -#line 777 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { - LetStack.back().push_back(LetRecord(*(yyvsp[(1) - (4)].StrVal), (yyvsp[(2) - (4)].BitList), (yyvsp[(4) - (4)].Initializer))); - delete (yyvsp[(1) - (4)].StrVal); delete (yyvsp[(2) - (4)].BitList); -;} - break; - - case 96: -#line 785 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { LetStack.push_back(std::vector()); ;} - break; - - case 98: -#line 788 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { +; + break;} +case 89: +#line 776 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +case 90: +#line 776 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +case 93: +#line 779 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ + LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer)); + delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList; +; + break;} +case 96: +#line 787 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ LetStack.push_back(std::vector()); ; + break;} +case 98: +#line 790 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ LetStack.pop_back(); - ;} - break; - - case 99: -#line 791 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - { + ; + break;} +case 99: +#line 793 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{ LetStack.pop_back(); - ;} - break; - - case 100: -#line 795 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - {;} - break; - - case 101: -#line 795 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" - {;} - break; - + ; + break;} +case 100: +#line 797 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +case 101: +#line 797 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" +{; + break;} +} + /* the action file gets copied in in place of this dollarsign */ +#line 543 "/usr/share/bison.simple" + + yyvsp -= yylen; + yyssp -= yylen; +#ifdef YYLSP_NEEDED + yylsp -= yylen; +#endif -/* Line 1267 of yacc.c. */ -#line 2643 "FileParser.tab.c" - default: break; +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); +#endif *++yyvsp = yyval; +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTOKENS]; + yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; +yyerrlab: /* here on detecting error */ -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ { ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - } - } - - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) - goto yyexhaustedlab; - } - } -#endif - } - +#ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ - - if (yychar <= YYEOF) + if (yyn > YYFLAG && yyn < YYLAST) { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; + int size = 0; + char *msg; + int x, count; + + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); + + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); } else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } +#endif /* YYERROR_VERBOSE */ + yyerror("parse error"); } - /* Else will try to reuse look-ahead token after shifting the error - token. */ goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ + if (yyerrstatus == 3) + { + /* if just tried and failed to reuse lookahead token after an error, discard it. */ -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; + /* return failure if at end of input */ + if (yychar == YYEOF) + YYABORT; +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); +#endif -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yychar = YYEMPTY; + } + + /* Else will try to reuse lookahead token + after shifting the error token. */ + + yyerrstatus = 3; /* Each real token shifted decrements this */ + + goto yyerrhandle; + +yyerrdefault: /* current state does not do anything special for the error token. */ + +#if 0 + /* This is wrong; only states that explicitly want error tokens + should shift them. */ + yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ + if (yyn) goto yydefault; +#endif - for (;;) +yyerrpop: /* pop the current state because it cannot handle the error token */ + + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif + +#if YYDEBUG != 0 + if (yydebug) { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; +yyerrhandle: + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; } + else if (yyn == 0) + goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; - *++yyvsp = yylval; - +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif yystate = yyn; goto yynewstate; + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + } + return 1; } - - -#line 799 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" +#line 801 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileParser.y" int yyerror(const char *ErrorMsg) { err() << "Error parsing: " << ErrorMsg << "\n"; exit(1); } - Modified: llvm/branches/release_21/utils/TableGen/FileParser.h.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/utils/TableGen/FileParser.h.cvs?rev=42085&r1=42084&r2=42085&view=diff ============================================================================== --- llvm/branches/release_21/utils/TableGen/FileParser.h.cvs (original) +++ llvm/branches/release_21/utils/TableGen/FileParser.h.cvs Tue Sep 18 01:22:01 2007 @@ -1,101 +1,4 @@ -/* A Bison parser, made by GNU Bison 2.3. */ - -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - INT = 258, - BIT = 259, - STRING = 260, - BITS = 261, - LIST = 262, - CODE = 263, - DAG = 264, - CLASS = 265, - DEF = 266, - MULTICLASS = 267, - DEFM = 268, - FIELD = 269, - LET = 270, - IN = 271, - SHLTOK = 272, - SRATOK = 273, - SRLTOK = 274, - STRCONCATTOK = 275, - INTVAL = 276, - ID = 277, - VARNAME = 278, - STRVAL = 279, - CODEFRAGMENT = 280 - }; -#endif -/* Tokens. */ -#define INT 258 -#define BIT 259 -#define STRING 260 -#define BITS 261 -#define LIST 262 -#define CODE 263 -#define DAG 264 -#define CLASS 265 -#define DEF 266 -#define MULTICLASS 267 -#define DEFM 268 -#define FIELD 269 -#define LET 270 -#define IN 271 -#define SHLTOK 272 -#define SRATOK 273 -#define SRLTOK 274 -#define STRCONCATTOK 275 -#define INTVAL 276 -#define ID 277 -#define VARNAME 278 -#define STRVAL 279 -#define CODEFRAGMENT 280 - - - - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 210 "/Volumes/Gir/devel/llvm/llvm.src/utils/TableGen/FileParser.y" -{ +typedef union { std::string* StrVal; int IntVal; llvm::RecTy* Ty; @@ -107,14 +10,31 @@ SubClassRefTy* SubClassRef; std::vector* SubClassList; std::vector >* DagValueList; -} -/* Line 1529 of yacc.c. */ -#line 113 "FileParser.tab.h" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif +} YYSTYPE; +#define INT 257 +#define BIT 258 +#define STRING 259 +#define BITS 260 +#define LIST 261 +#define CODE 262 +#define DAG 263 +#define CLASS 264 +#define DEF 265 +#define MULTICLASS 266 +#define DEFM 267 +#define FIELD 268 +#define LET 269 +#define IN 270 +#define CONCATTOK 271 +#define SHLTOK 272 +#define SRATOK 273 +#define SRLTOK 274 +#define STRCONCATTOK 275 +#define INTVAL 276 +#define ID 277 +#define VARNAME 278 +#define STRVAL 279 +#define CODEFRAGMENT 280 -extern YYSTYPE Filelval; +extern YYSTYPE Filelval; From baldrick at free.fr Tue Sep 18 03:52:29 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 18 Sep 2007 10:52:29 +0200 Subject: [llvm-commits] [llvm] r42076 - in /llvm/trunk: Xcode/ Xcode/LLVM.xcodeproj/ examples/BrainF/ include/llvm/Module.h lib/Target/Mips/ test/Transforms/GVN/ In-Reply-To: <200709180209.l8I29YXl011630@zion.cs.uiuc.edu> References: <200709180209.l8I29YXl011630@zion.cs.uiuc.edu> Message-ID: <200709181052.29690.baldrick@free.fr> Hi Gordon, I don't know what xcode is, but I was surprised to see these: > +*.perspective > +*.pbxuser are they right? Thanks, Duncan. From baldrick at free.fr Tue Sep 18 03:49:18 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 18 Sep 2007 10:49:18 +0200 Subject: [llvm-commits] [llvm] r42051 - in /llvm/trunk: lib/VMCore/Verifier.cpp test/CodeGen/Generic/GC/lower_gcroot.ll test/Verifier/gcread-ptrptr.ll test/Verifier/gcroot-alloca.ll test/Verifier/gcroot-meta.ll test/Verifier/gcroot-ptrptr.ll test/Verifier/gcwrite-ptrptr.ll In-Reply-To: <200709172030.l8HKU4QG008512@zion.cs.uiuc.edu> References: <200709172030.l8HKU4QG008512@zion.cs.uiuc.edu> Message-ID: <200709181049.21273.baldrick@free.fr> Hi Gordon, > +static bool HasPtrPtrType(Value *Val) { I think hasPtrPtrType would be more in keeping with the LLVM naming rules (whatever they are). > +static Value *StripBitCasts(Value *Val) { how about using IntrinsicInst::StripPointerCasts instead? > + "llvm.gcroot parameter #1 must be an alloca (or a bitcast).", &CI); "(or a bitcast)" -> "(or a bitcast of one)" > + "llvm.gcroot parameter #2 must be a constant or global.", &CI); how about dropping " or global" since it seems redundant. Ciao, Duncan. From gordonhenriksen at mac.com Tue Sep 18 04:35:56 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 05:35:56 -0400 Subject: [llvm-commits] [llvm] r42076 - in /llvm/trunk: Xcode/ Xcode/LLVM.xcodeproj/ examples/BrainF/ include/llvm/Module.h lib/Target/Mips/ test/Transforms/GVN/ In-Reply-To: <200709181052.29690.baldrick@free.fr> References: <200709180209.l8I29YXl011630@zion.cs.uiuc.edu> <200709181052.29690.baldrick@free.fr> Message-ID: <23603B64-C53D-47D6-B4A9-A39FFEB790E9@mac.com> On Sep 18, 2007, at 04:52, Duncan Sands wrote: > Hi Gordon, I don't know what xcode is, but I was surprised to see > these: > >> +*.perspective >> +*.pbxuser > > are they right? These are user-specific files created by Apple's IDE (http:// www.apple.com/macosx/features/xcode/). They contain critical information such as window positions. :) ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070918/010b8ad3/attachment.html From isanbard at gmail.com Tue Sep 18 04:10:17 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 18 Sep 2007 09:10:17 -0000 Subject: [llvm-commits] [llvm] r42086 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter.cpp Message-ID: <200709180910.l8I9AHpD002949@zion.cs.uiuc.edu> Author: void Date: Tue Sep 18 04:10:16 2007 New Revision: 42086 URL: http://llvm.org/viewvc/llvm-project?rev=42086&view=rev Log: Don't pass back a reference to a temporary. Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h llvm/trunk/lib/CodeGen/AsmPrinter.cpp Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=42086&r1=42085&r2=42086&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Sep 18 04:10:16 2007 @@ -115,7 +115,7 @@ /// getCurrentFunctionEHName - Called to return (and cache) the /// CurrentFnEHName. /// - const std::string &getCurrentFunctionEHName(const MachineFunction *MF); + std::string getCurrentFunctionEHName(const MachineFunction *MF); protected: /// doInitialization - Set up the AsmPrinter when we are working on a new Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=42086&r1=42085&r2=42086&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Tue Sep 18 04:10:16 2007 @@ -160,8 +160,7 @@ return false; } -const std::string & -AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF) { +std::string AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF) { assert(MF && "No machine function?"); return Mang->makeNameProper(MF->getFunction()->getName() + ".eh", TAI->getGlobalPrefix()); From gordonhenriksen at mac.com Tue Sep 18 05:14:31 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 10:14:31 -0000 Subject: [llvm-commits] [llvm] r42087 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <200709181014.l8IAEVVr005355@zion.cs.uiuc.edu> Author: gordon Date: Tue Sep 18 05:14:30 2007 New Revision: 42087 URL: http://llvm.org/viewvc/llvm-project?rev=42087&view=rev Log: Incorporating review feedback for GC verifier patch. Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=42087&r1=42086&r2=42087&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Tue Sep 18 05:14:30 2007 @@ -49,8 +49,7 @@ #include "llvm/ParameterAttributes.h" #include "llvm/DerivedTypes.h" #include "llvm/InlineAsm.h" -#include "llvm/Instructions.h" -#include "llvm/Intrinsics.h" +#include "llvm/IntrinsicInst.h" #include "llvm/PassManager.h" #include "llvm/Analysis/Dominators.h" #include "llvm/CodeGen/ValueTypes.h" @@ -1078,12 +1077,6 @@ return false; } -static Value *StripBitCasts(Value *Val) { - if (BitCastInst *CI = dyn_cast(Val)) - return StripBitCasts(CI->getOperand(0)); - return Val; -} - /// visitIntrinsicFunction - Allow intrinsics to be verified in different ways. /// void Verifier::visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI) { @@ -1101,10 +1094,11 @@ case Intrinsic::gcroot: Assert1(HasPtrPtrType(CI.getOperand(1)), "llvm.gcroot parameter #1 must be a pointer to a pointer.", &CI); - Assert1(isa(StripBitCasts(CI.getOperand(1))), - "llvm.gcroot parameter #1 must be an alloca (or a bitcast).", &CI); + Assert1(isa(IntrinsicInst::StripPointerCasts(CI.getOperand(1))), + "llvm.gcroot parameter #1 must be an alloca (or a bitcast of one).", + &CI); Assert1(isa(CI.getOperand(2)), - "llvm.gcroot parameter #2 must be a constant or global.", &CI); + "llvm.gcroot parameter #2 must be a constant.", &CI); break; case Intrinsic::gcwrite: Assert1(CI.getOperand(3)->getType() From gordonhenriksen at mac.com Tue Sep 18 05:17:00 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 06:17:00 -0400 Subject: [llvm-commits] [llvm] r42051 - in /llvm/trunk: lib/VMCore/Verifier.cpp test/CodeGen/Generic/GC/lower_gcroot.ll test/Verifier/gcread-ptrptr.ll test/Verifier/gcroot-alloca.ll test/Verifier/gcroot-meta.ll test/Verifier/gcroot-ptrptr.ll test/Verifier/gcwrite-ptrptr.ll In-Reply-To: <200709181049.21273.baldrick@free.fr> References: <200709172030.l8HKU4QG008512@zion.cs.uiuc.edu> <200709181049.21273.baldrick@free.fr> Message-ID: <7E45917A-52D7-4AC4-8882-B0B6E3F9FCA5@mac.com> On Sep 18, 2007, at 04:49, Duncan Sands wrote: > Hi Gordon, > >> +static bool HasPtrPtrType(Value *Val) { > > I think hasPtrPtrType would be more in keeping with the LLVM naming > rules (whatever they are). Do you think so? The convention I had gleaned is that local, private, or static (in the C sense) identifiers were usually distinguished by InitialCaps. >> +static Value *StripBitCasts(Value *Val) { > > how about using IntrinsicInst::StripPointerCasts instead? Done. Note that, although there's tantalizing GEP-0 handling in StripPointerCasts, it's still not really possible to use gcroot without bitcasts: %class.Object = { %vtable* } %class.Derived = { %class.Object, ... } declare void @llvm.gcroot(%class.Object* %root, i8* %meta) define void @look_ma_no_casts() { entry: %x_addr = alloca %class.Derived* %tmp0 = getelementptr %x_addr, i32 0, i32 0 ; Invalid! But nice try... call void @llvm.gcroot(%class.Obj* %tmp0, i8* null) ret void } >> + "llvm.gcroot parameter #1 must be an alloca (or a >> bitcast).", &CI); > > "(or a bitcast)" -> "(or a bitcast of one)" Done. >> + "llvm.gcroot parameter #2 must be a constant or >> global.", &CI); > > how about dropping " or global" since it seems redundant. I agree. The manual used that phrasing, I think for clarity to those not quite so familiar with LLVM's type system. Done. Thanks Duncan. http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- Mon-20070917/053633.html ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070918/cf5aeca0/attachment.html From baldrick at free.fr Tue Sep 18 06:44:02 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 18 Sep 2007 13:44:02 +0200 Subject: [llvm-commits] [llvm] r42051 - in /llvm/trunk: lib/VMCore/Verifier.cpp test/CodeGen/Generic/GC/lower_gcroot.ll test/Verifier/gcread-ptrptr.ll test/Verifier/gcroot-alloca.ll test/Verifier/gcroot-meta.ll test/Verifier/gcroot-ptrptr.ll test/Verifier/gcwrite-ptrptr.ll In-Reply-To: <7E45917A-52D7-4AC4-8882-B0B6E3F9FCA5@mac.com> References: <200709172030.l8HKU4QG008512@zion.cs.uiuc.edu> <200709181049.21273.baldrick@free.fr> <7E45917A-52D7-4AC4-8882-B0B6E3F9FCA5@mac.com> Message-ID: <200709181344.04203.baldrick@free.fr> Hi, > >> +static Value *StripBitCasts(Value *Val) { > > > > how about using IntrinsicInst::StripPointerCasts instead? > > Done. Note that, although there's tantalizing GEP-0 handling in > StripPointerCasts, it's still not really possible to use gcroot > without bitcasts: the reason for the GEP handling, is that if you have a constant pointer P to a struct S for which the first field is of type T, and you constant bitcast P to a T*, then the optimizers will turn this into a GEP-0 instead of a bitcast. Thus it is unwise to assume you'll always see a bitcast - it might be that you get passed a GEP instead. > %x_addr = alloca %class.Derived* > %tmp0 = getelementptr %x_addr, i32 0, i32 0 ; Invalid! But nice try... If x_addr pointed to a global variable rather than a local variable, this (or something like it) should be valid. Just to be clear: I'm not suggesting that you can get rid of bitcasts - I'm pointing out that in obscure circumstances you may be passed a GEP rather than a bitcast, even if you always generate bitcasts in the front-end. So you need to handle that, eg by using StripPointerCasts. Ciao, Duncan. From gordonhenriksen at mac.com Tue Sep 18 07:26:18 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 12:26:18 -0000 Subject: [llvm-commits] [llvm] r42090 - in /llvm/trunk: Makefile.config.in bindings/ bindings/ocaml/ bindings/ocaml/Makefile.ocaml test/Makefile Message-ID: <200709181226.l8ICQKvM010467@zion.cs.uiuc.edu> Author: gordon Date: Tue Sep 18 07:26:17 2007 New Revision: 42090 URL: http://llvm.org/viewvc/llvm-project?rev=42090&view=rev Log: (empty) Added: llvm/trunk/bindings/ llvm/trunk/bindings/ocaml/ llvm/trunk/bindings/ocaml/Makefile.ocaml Modified: llvm/trunk/Makefile.config.in llvm/trunk/test/Makefile Modified: llvm/trunk/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.config.in?rev=42090&r1=42089&r2=42090&view=diff ============================================================================== --- llvm/trunk/Makefile.config.in (original) +++ llvm/trunk/Makefile.config.in Tue Sep 18 07:26:17 2007 @@ -156,6 +156,8 @@ ETAGSFLAGS := @ETAGSFLAGS@ GROFF := @GROFF@ GZIP := @GZIP@ +OCAMLC := @OCAMLC@ +OCAMLOPT := @OCAMLOPT@ POD2HTML := @POD2HTML@ POD2MAN := @POD2MAN@ RUNTEST := @RUNTEST@ Added: llvm/trunk/bindings/ocaml/Makefile.ocaml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile.ocaml?rev=42090&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/Makefile.ocaml (added) +++ llvm/trunk/bindings/ocaml/Makefile.ocaml Tue Sep 18 07:26:17 2007 @@ -0,0 +1,265 @@ +##===- tools/ml/Makefile -----------------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file was developed by Gordon Henriksen and is distributed under the +# University of Illinois Open Source License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +# +# An ocaml library is a unique project type in the context of LLVM, so rules are +# here rather than in Makefile.rules. +# +##===----------------------------------------------------------------------===## + +include $(LEVEL)/Makefile.config + +# Find the ocaml stdlib root. /usr/local/lib/ocaml is the default when built +# from source; distros use something like /usr/lib/ocaml/3.10.0. +ifndef OCAML_LIBDIR +OCAML_LIBDIR := $(shell $(OCAMLC) -where) +endif + +# CFLAGS needs to be set before Makefile.rules is included. Yes, ocaml puts its +# includes under its libdir. +CFLAGS += -I$(OCAML_LIBDIR) + +include $(LEVEL)/Makefile.common + +# Intentionally ignore PROJ_prefix here. We want the ocaml stdlib. However, the +# user can override this with OCAML_LIBDIR. +PROJ_libocamldir := $(DESTDIR)$(OCAML_LIBDIR) +OcamlDir := $(LibDir)/ocaml + +# Info from llvm-config and similar +ifdef UsedComponents +UsedLibs = $(shell $(LLVM_CONFIG) --libs $(UsedComponents)) +UsedLibNames = $(shell $(LLVM_CONFIG) --libnames $(UsedComponents)) +endif + +# Tools +OCAMLCFLAGS += -I $(OcamlDir) +OCAMLAFLAGS += $(patsubst %,-cclib %, \ + $(filter-out -L$(LibDir),$(shell $(LLVM_CONFIG) --ldflags)) \ + $(UsedLibs) -l$(LIBRARYNAME)) + +Compile.CMI := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) -o) +Compile.CMO := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) -o) +Archive.CMA := $(strip $(OCAMLC) -a -custom $(OCAMLAFLAGS) -o) + +Compile.CMX := $(strip $(OCAMLOPT) -c $(OCAMLCFLAGS) -o) +Archive.CMXA := $(strip $(OCAMLOPT) -a $(OCAMLAFLAGS) -o) + +# Source files +OcamlSources := $(sort $(wildcard $(PROJ_SRC_DIR)/*.ml)) +OcamlHeaders := $(OcamlSources:.ml=.mli) + +# Output and intermediate files +# The .cmo files are the only intermediates; all others get installed. +BareLibraryA := lib$(LIBRARYNAME).a +LibraryA := $(OcamlDir)/$(BareLibraryA) +LibraryCMA := $(OcamlDir)/$(LIBRARYNAME).cma +LibraryCMXA := $(OcamlDir)/$(LIBRARYNAME).cmxa +ObjectsCMI := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(OcamlDir)/%.cmi) +ObjectsCMO := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(ObjDir)/%.cmo) +ObjectsCMX := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(OcamlDir)/%.cmx) + +# Dependencies +# Punting on ocamldep, since its output is only suitable for builds where +# objects are placed directly adjacent to sources, which is not us. +# Unfortunately, this is subtly incorrect and leads to occasional problems. +# ocamlc/ocamlopt really need an option akin to gcc -M or gcc -MD. +$(ObjectsCMO): $(ObjectsCMI) $(UsedOcamLibs:%=$(OcamlDir)/%.cmi) +$(ObjectsCMX): $(ObjectsCMI) $(UsedOcamLibs:%=$(OcamlDir)/%.cmi) + +# Installation targets +DestA := $(PROJ_libocamldir)/lib$(LIBRARYNAME).a +DestCMA := $(PROJ_libocamldir)/$(LIBRARYNAME).cma +DestCMXA := $(PROJ_libocamldir)/$(LIBRARYNAME).cmxa + + +##===- Build static library from C sources --------------------------------===## + +all-local:: $(LibraryA) +clean-local:: clean-a +install-local:: install-a +uninstall-local:: uninstall-a + +$(LibraryA): $(ObjectsO) $(OcamlDir)/.dir + $(Echo) "Building $(BuildMode) $(notdir $@)" + -$(Verb) $(RM) -f $@ + $(Verb) $(Archive) $@ $(ObjectsO) + $(Verb) $(Ranlib) $@ + +clean-a:: + -$(Verb) $(RM) -f $(LibraryA) + +install-a:: $(LibraryA) + $(Echo) "Installing $(BuildMode) $(DestA)" + $(Verb) $(MKDIR) $(PROJ_libocamldir) + $(Verb) $(LTInstall) $(LibraryA) $(DestA) + $(Verb) + +uninstall-a:: + $(Echo) "Uninstalling $(DestA)" + -$(Verb) $(RM) -f $(DestA) + + +##===- Build ocaml interfaces (.mli's -> .cmi's) --------------------------===## + +all-local:: build-cmis +clean-local:: clean-cmis +install-local:: install-cmis +uninstall-local:: uninstall-cmis + +build-cmis: $(ObjectsCMI) + +$(OcamlDir)/%.cmi: $(PROJ_SRC_DIR)/%.mli $(OcamlDir)/.dir + $(Echo) "Compiling $(notdir $<) for $(BuildMode) build" + $(Verb) $(Compile.CMI) $@ $< + +clean-cmis:: + -$(Verb) $(RM) -f $(ObjectsCMI) + +# Also install the .mli's (headers) as documentation. +install-cmis: $(ObjectsCMI) + $(Verb) $(MKDIR) $(PROJ_libocamldir) + $(Verb) for i in $(patsubst $(OcamlDir)/%,%,$(ObjectsCMI)); do \ + $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ + $(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \ + done + $(Verb) for i in $(patsubst $(PROJ_SRC_DIR)/%,%,$(OcamlHeaders)); do \ + $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ + $(DataInstall) $(PROJ_SRC_DIR)/$$i "$(PROJ_libocamldir)/$$i"; \ + done + +uninstall-cmis:: + $(Verb) for i in $(patsubst $(OcamlDir)/%,%,$(ObjectsCMI)); do \ + $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ + $(RM) -f "$(PROJ_libocamldir)/$$i"; \ + done + $(Verb) for i in $(patsubst $(PROJ_SRC_DIR)/%,%,$(OcamlHeaders)); do \ + $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ + $(RM) -f "$(PROJ_libocamldir)/$$i"; \ + done + + +##===- Build ocaml bytecode archive (.ml's -> .cmo's -> .cma) -------------===## + +all-local:: $(LibraryCMA) +clean-local:: clean-cma +install-local:: install-cma +uninstall-local:: uninstall-cma + +$(LibraryCMA): $(ObjectsCMO) $(OcamlDir)/.dir + $(Echo) "Archiving $(notdir $@) for $(BuildMode) build" + $(Verb) $(Archive.CMA) $@ $(ObjectsCMO) + $(Verb) for i in $(UsedLibNames); do \ + ln -sf "$(LibDir)/$$i" "$(OcamlDir)/$$i"; \ + done + +$(ObjDir)/%.cmo: $(PROJ_SRC_DIR)/%.ml $(OcamlDir)/.dir + $(Echo) "Compiling $(notdir $<) for $(BuildMode) build" + $(Verb) $(Compile.CMO) $@ $< + +clean-cma:: + $(Verb) $(RM) -f $(LibraryCMA) + +install-cma:: $(LibraryCMA) + $(Echo) "Installing $(BuildMode) $(DestCMA)" + $(Verb) $(MKDIR) $(PROJ_libocamldir) + $(Verb) $(DataInstall) $(LibraryCMA) "$(DestCMA)" + $(Verb) for i in $(UsedLibNames); do \ + $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ + ln -sf "$(PROJ_libdir)/$$i" "$(PROJ_libocamldir)/$$i"; \ + done + +uninstall-cma:: + $(Echo) "Uninstalling $(DestCMA)" + -$(Verb) $(RM) -f $(DestCMA) + $(Verb) for i in $(UsedLibNames); do \ + $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ + $(RM) -f "$(PROJ_libocamldir)/$$i"; \ + done + + +##===- Build optimized ocaml archive (.ml's -> .cmx's -> .cmxa, .a) -------===## + +# The ocamlopt compiler is supported on a set of targets disjoint from LLVM's. +# If unavailable, 'configure' will not define OCAMLOPT in Makefile.config. +ifdef OCAMLOPT + +all-local:: $(LibraryCMXA) +clean-local:: clean-cmxa +install-local:: install-cmxa +uninstall-local:: uninstall-cmxa + +$(LibraryCMXA): $(ObjectsCMX) + $(Echo) "Archiving $(notdir $@) for $(BuildMode) build" + $(Verb) $(Archive.CMXA) $@ $(ObjectsCMX) + $(Verb) $(RM) -f $(@:.cmxa=.o) + +$(OcamlDir)/%.cmx: $(PROJ_SRC_DIR)/%.ml + $(Echo) "Compiling optimized $(notdir $<) for $(BuildMode) build" + $(Verb) $(Compile.CMX) $@ $< + +clean-cmxa:: + $(Verb) $(RM) -f $(LibraryCMXA) $(LibraryCMXA:.cmxa=.o) \ + $(LibraryCMXA:.cmxa=.a) $(ObjectsCMX) + +install-cmxa:: $(LibraryCMXA) + $(Verb) $(MKDIR) $(PROJ_libocamldir) + $(Echo) "Installing $(BuildMode) $(DestCMXA)" + $(Verb) $(DataInstall) $(LibraryCMXA) $(DestCMXA) + $(Echo) "Installing $(BuildMode) $(DestCMXA:.cmxa=.a)" + $(Verb) $(DataInstall) $(LibraryCMXA:.cmxa=.a) $(DestCMXA:.cmxa=.a) + $(Verb) for i in $(ObjectsCMX:$(OcamlDir)/%=%); do \ + $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ + $(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \ + done + +uninstall-cmxa:: $(LibraryCMXA) + $(Echo) "Uninstalling $(DestCMXA)" + $(Verb) $(RM) -f $(DestCMXA) + $(Echo) "Uninstalling $(DestCMXA:.cmxa=.a)" + $(Verb) $(RM) -f $(DestCMXA:.cmxa=.a) + $(Verb) for i in $(ObjectsCMX:$(OcamlDir)/%=%); do \ + $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ + $(RM) -f $(PROJ_libocamldir)/$$i; \ + done + +endif + + +##===- Debugging gunk -----------------------------------------------------===## +printvars:: printcamlvars + +printcamlvars:: + $(Echo) "LLVM_CONFIG : " '$(LLVM_CONFIG)' + $(Echo) "OCAMLCFLAGS : " '$(OCAMLCFLAGS)' + $(Echo) "OCAMLAFLAGS : " '$(OCAMLAFLAGS)' + $(Echo) "OCAMLC : " '$(OCAMLC)' + $(Echo) "OCAMLOPT : " '$(OCAMLOPT)' + $(Echo) "Compile.CMI : " '$(Compile.CMI)' + $(Echo) "Compile.CMO : " '$(Compile.CMO)' + $(Echo) "Archive.CMA : " '$(Archive.CMA)' + $(Echo) "Compile.CMX : " '$(Compile.CMX)' + $(Echo) "Archive.CMXA : " '$(Archive.CMXA)' + $(Echo) "CAML_LIBDIR : " '$(CAML_LIBDIR)' + $(Echo) "LibraryCMA : " '$(LibraryCMA)' + $(Echo) "LibraryCMXA : " '$(LibraryCMXA)' + $(Echo) "OcamlSources : " '$(OcamlSources)' + $(Echo) "ObjectsCMI : " '$(ObjectsCMI)' + $(Echo) "ObjectsCMO : " '$(ObjectsCMO)' + $(Echo) "ObjectsCMX : " '$(ObjectsCMX)' + $(Echo) "OCAML_LIBDIR : " '$(OCAML_LIBDIR)' + $(Echo) "DestA : " '$(DestA)' + $(Echo) "DestCMA : " '$(DestCMA)' + $(Echo) "DestCMXA : " '$(DestCMXA)' + $(Echo) "UsedLibs : " '$(UsedLibs)' + $(Echo) "UsedLibNames : " '$(UsedLibNames)' + +.PHONY: printcamlvars build-cmis \ + clean-a clean-cmis clean-cma clean-cmxa \ + install-a install-cmis install-cma install-cmxa \ + uninstall-a uninstall-cmis uninstall-cma uninstall-cmxa Modified: llvm/trunk/test/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile?rev=42090&r1=42089&r2=42090&view=diff ============================================================================== --- llvm/trunk/test/Makefile (original) +++ llvm/trunk/test/Makefile Tue Sep 18 07:26:17 2007 @@ -28,8 +28,18 @@ RUNTESTFLAGS := --tool $(CLEANED_TESTSUITE) endif +IGNORE_TESTS := + ifndef RUNLLVM2CPP -RUNTESTFLAGS += --ignore llvm2cpp.exp +IGNORE_TESTS += llvm2cpp.exp +endif + +ifndef OCAMLC +IGNORE_TESTS += ocaml.exp +endif + +ifdef IGNORE_TESTS +RUNTESTFLAGS += --ignore "$(strip $(IGNORE_TESTS))" endif ifneq ($(RUNTEST),) @@ -89,6 +99,7 @@ @echo 'set llvmgxx "$(LLVMGCC)"' >> site.tmp @echo 'set llvmgccmajvers "$(LLVMGCC_MAJVERS)"' >> site.tmp @echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp + @echo 'set ocamlc "$(OCAMLC) -cc $(CXX) -I $(LibDir)/ocaml"' >> site.tmp @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp @test ! -f site.exp || \ sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp From gordonhenriksen at mac.com Tue Sep 18 07:27:00 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 12:27:00 -0000 Subject: [llvm-commits] [llvm] r42091 - /llvm/trunk/autoconf/configure.ac Message-ID: <200709181227.l8ICR0lk010496@zion.cs.uiuc.edu> Author: gordon Date: Tue Sep 18 07:26:59 2007 New Revision: 42091 URL: http://llvm.org/viewvc/llvm-project?rev=42091&view=rev Log: (empty) Modified: llvm/trunk/autoconf/configure.ac Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=42091&r1=42090&r2=42091&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Tue Sep 18 07:26:59 2007 @@ -532,6 +532,8 @@ AC_PATH_PROG(RUNTEST,[runtest],[echo "Skipped: runtest not found"]) DJ_AC_PATH_TCLSH AC_PATH_PROG(ZIP,[zip],[echo "Skipped: zip not found"]) +AC_PATH_PROG(OCAMLC,[ocamlc],[echo "Skipped: ocamlc not found"]) +AC_PATH_PROG(OCAMLOPT,[ocamlopt],[echo "Skipped: ocamlopt not found"]) dnl Determine if the linker supports the -R option. AC_LINK_USE_R From gordonhenriksen at mac.com Tue Sep 18 07:27:14 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 12:27:14 -0000 Subject: [llvm-commits] [llvm] r42092 - /llvm/trunk/configure Message-ID: <200709181227.l8ICRFkI010517@zion.cs.uiuc.edu> Author: gordon Date: Tue Sep 18 07:27:13 2007 New Revision: 42092 URL: http://llvm.org/viewvc/llvm-project?rev=42092&view=rev Log: Regenerate. Modified: llvm/trunk/configure Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=42092&r1=42091&r2=42092&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Tue Sep 18 07:27:13 2007 @@ -883,6 +883,8 @@ RUNTEST TCLSH ZIP +OCAMLC +OCAMLOPT INSTALL_LTDL_TRUE INSTALL_LTDL_FALSE CONVENIENCE_LTDL_TRUE @@ -7912,6 +7914,88 @@ fi +# Extract the first word of "ocamlc", so it can be a program name with args. +set dummy ocamlc; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_OCAMLC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $OCAMLC in + [\\/]* | ?:[\\/]*) + ac_cv_path_OCAMLC="$OCAMLC" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_OCAMLC="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_OCAMLC" && ac_cv_path_OCAMLC="echo "Skipped: ocamlc not found"" + ;; +esac +fi +OCAMLC=$ac_cv_path_OCAMLC +if test -n "$OCAMLC"; then + { echo "$as_me:$LINENO: result: $OCAMLC" >&5 +echo "${ECHO_T}$OCAMLC" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "ocamlopt", so it can be a program name with args. +set dummy ocamlopt; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_OCAMLOPT+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $OCAMLOPT in + [\\/]* | ?:[\\/]*) + ac_cv_path_OCAMLOPT="$OCAMLOPT" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_OCAMLOPT="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_OCAMLOPT" && ac_cv_path_OCAMLOPT="echo "Skipped: ocamlopt not found"" + ;; +esac +fi +OCAMLOPT=$ac_cv_path_OCAMLOPT +if test -n "$OCAMLOPT"; then + { echo "$as_me:$LINENO: result: $OCAMLOPT" >&5 +echo "${ECHO_T}$OCAMLOPT" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + { echo "$as_me:$LINENO: checking for compiler -Wl,-R option" >&5 echo $ECHO_N "checking for compiler -Wl,-R option... $ECHO_C" >&6; } @@ -10374,7 +10458,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 12605 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14236,11 +14320,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14239: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14323: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14243: \$? = $ac_status" >&5 + echo "$as_me:14327: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14504,11 +14588,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14507: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14591: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14511: \$? = $ac_status" >&5 + echo "$as_me:14595: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14608,11 +14692,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14611: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14695: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14615: \$? = $ac_status" >&5 + echo "$as_me:14699: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17060,7 +17144,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19615: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19535: \$? = $ac_status" >&5 + echo "$as_me:19619: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -19632,11 +19716,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19635: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19719: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19639: \$? = $ac_status" >&5 + echo "$as_me:19723: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21202,11 +21286,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21205: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21289: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21209: \$? = $ac_status" >&5 + echo "$as_me:21293: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -21306,11 +21390,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21309: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21393: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21313: \$? = $ac_status" >&5 + echo "$as_me:21397: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23541,11 +23625,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23544: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23628: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23548: \$? = $ac_status" >&5 + echo "$as_me:23632: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -23809,11 +23893,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23812: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23896: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23816: \$? = $ac_status" >&5 + echo "$as_me:23900: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -23913,11 +23997,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23916: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24000: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:23920: \$? = $ac_status" >&5 + echo "$as_me:24004: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -34869,6 +34953,8 @@ RUNTEST!$RUNTEST$ac_delim TCLSH!$TCLSH$ac_delim ZIP!$ZIP$ac_delim +OCAMLC!$OCAMLC$ac_delim +OCAMLOPT!$OCAMLOPT$ac_delim INSTALL_LTDL_TRUE!$INSTALL_LTDL_TRUE$ac_delim INSTALL_LTDL_FALSE!$INSTALL_LTDL_FALSE$ac_delim CONVENIENCE_LTDL_TRUE!$CONVENIENCE_LTDL_TRUE$ac_delim @@ -34912,7 +34998,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 From gordonhenriksen at mac.com Tue Sep 18 07:29:26 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 08:29:26 -0400 Subject: [llvm-commits] [llvm] r42090 - in /llvm/trunk: Makefile.config.in bindings/ bindings/ocaml/ bindings/ocaml/Makefile.ocaml test/Makefile In-Reply-To: <200709181226.l8ICQKvM010467@zion.cs.uiuc.edu> References: <200709181226.l8ICQKvM010467@zion.cs.uiuc.edu> Message-ID: On Sep 18, 2007, at 08:26, Gordon Henriksen wrote: > Author: gordon > Date: Tue Sep 18 07:26:17 2007 > New Revision: 42090 > > URL: http://llvm.org/viewvc/llvm-project?rev=42090&view=rev > Log: (empty) Oops, forgot to safe my commit message file. I intended to write: Adding ocaml to build infrastructure. - configure tries to find ocamlc and ocamlopt. - Makefile rules for ocaml libs. I put them in a separate file, though. - Tests using ocaml.exp are ignored if ocamlc was not found. - Tests may reference %ocamlc, which expands to something like ocamlc -cc g++ -I llvm/Release/lib/ocaml - Ocaml libs install direct into ocaml's stdlib, found using ocamlc -where, ignoring --prefix. This perhaps should be configurable, but that requires bigger configure cojones than mine. > Added: > llvm/trunk/bindings/ > llvm/trunk/bindings/ocaml/ > llvm/trunk/bindings/ocaml/Makefile.ocaml > Modified: > llvm/trunk/Makefile.config.in > llvm/trunk/test/Makefile > > Modified: llvm/trunk/Makefile.config.in > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/ > Makefile.config.in?rev=42090&r1=42089&r2=42090&view=diff > > ====================================================================== > ======== > --- llvm/trunk/Makefile.config.in (original) > +++ llvm/trunk/Makefile.config.in Tue Sep 18 07:26:17 2007 > @@ -156,6 +156,8 @@ > ETAGSFLAGS := @ETAGSFLAGS@ > GROFF := @GROFF@ > GZIP := @GZIP@ > +OCAMLC := @OCAMLC@ > +OCAMLOPT := @OCAMLOPT@ > POD2HTML := @POD2HTML@ > POD2MAN := @POD2MAN@ > RUNTEST := @RUNTEST@ > > Added: llvm/trunk/bindings/ocaml/Makefile.ocaml > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/ > Makefile.ocaml?rev=42090&view=auto > > ====================================================================== > ======== > --- llvm/trunk/bindings/ocaml/Makefile.ocaml (added) > +++ llvm/trunk/bindings/ocaml/Makefile.ocaml Tue Sep 18 07:26:17 2007 > @@ -0,0 +1,265 @@ > +##===- tools/ml/Makefile -----------------------------------*- > Makefile -*-===## > +# > +# The LLVM Compiler Infrastructure > +# > +# This file was developed by Gordon Henriksen and is distributed > under the > +# University of Illinois Open Source License. See LICENSE.TXT for > details. > +# > +##===---------------------------------------------------------------- > ------===## > +# > +# An ocaml library is a unique project type in the context of > LLVM, so rules are > +# here rather than in Makefile.rules. > +# > +##===---------------------------------------------------------------- > ------===## > + > +include $(LEVEL)/Makefile.config > + > +# Find the ocaml stdlib root. /usr/local/lib/ocaml is the default > when built > +# from source; distros use something like /usr/lib/ocaml/3.10.0. > +ifndef OCAML_LIBDIR > +OCAML_LIBDIR := $(shell $(OCAMLC) -where) > +endif > + > +# CFLAGS needs to be set before Makefile.rules is included. Yes, > ocaml puts its > +# includes under its libdir. > +CFLAGS += -I$(OCAML_LIBDIR) > + > +include $(LEVEL)/Makefile.common > + > +# Intentionally ignore PROJ_prefix here. We want the ocaml stdlib. > However, the > +# user can override this with OCAML_LIBDIR. > +PROJ_libocamldir := $(DESTDIR)$(OCAML_LIBDIR) > +OcamlDir := $(LibDir)/ocaml > + > +# Info from llvm-config and similar > +ifdef UsedComponents > +UsedLibs = $(shell $(LLVM_CONFIG) --libs $(UsedComponents)) > +UsedLibNames = $(shell $(LLVM_CONFIG) --libnames $(UsedComponents)) > +endif > + > +# Tools > +OCAMLCFLAGS += -I $(OcamlDir) > +OCAMLAFLAGS += $(patsubst %,-cclib %, \ > + $(filter-out -L$(LibDir),$(shell $(LLVM_CONFIG) -- > ldflags)) \ > + $(UsedLibs) -l$(LIBRARYNAME)) > + > +Compile.CMI := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) -o) > +Compile.CMO := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) -o) > +Archive.CMA := $(strip $(OCAMLC) -a -custom $(OCAMLAFLAGS) -o) > + > +Compile.CMX := $(strip $(OCAMLOPT) -c $(OCAMLCFLAGS) -o) > +Archive.CMXA := $(strip $(OCAMLOPT) -a $(OCAMLAFLAGS) -o) > + > +# Source files > +OcamlSources := $(sort $(wildcard $(PROJ_SRC_DIR)/*.ml)) > +OcamlHeaders := $(OcamlSources:.ml=.mli) > + > +# Output and intermediate files > +# The .cmo files are the only intermediates; all others get > installed. > +BareLibraryA := lib$(LIBRARYNAME).a > +LibraryA := $(OcamlDir)/$(BareLibraryA) > +LibraryCMA := $(OcamlDir)/$(LIBRARYNAME).cma > +LibraryCMXA := $(OcamlDir)/$(LIBRARYNAME).cmxa > +ObjectsCMI := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(OcamlDir)/ > %.cmi) > +ObjectsCMO := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(ObjDir)/%.cmo) > +ObjectsCMX := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(OcamlDir)/ > %.cmx) > + > +# Dependencies > +# Punting on ocamldep, since its output is only suitable for > builds where > +# objects are placed directly adjacent to sources, which is not us. > +# Unfortunately, this is subtly incorrect and leads to > occasional problems. > +# ocamlc/ocamlopt really need an option akin to gcc -M or gcc -MD. > +$(ObjectsCMO): $(ObjectsCMI) $(UsedOcamLibs:%=$(OcamlDir)/%.cmi) > +$(ObjectsCMX): $(ObjectsCMI) $(UsedOcamLibs:%=$(OcamlDir)/%.cmi) > + > +# Installation targets > +DestA := $(PROJ_libocamldir)/lib$(LIBRARYNAME).a > +DestCMA := $(PROJ_libocamldir)/$(LIBRARYNAME).cma > +DestCMXA := $(PROJ_libocamldir)/$(LIBRARYNAME).cmxa > + > + > +##===- Build static library from C sources > --------------------------------===## > + > +all-local:: $(LibraryA) > +clean-local:: clean-a > +install-local:: install-a > +uninstall-local:: uninstall-a > + > +$(LibraryA): $(ObjectsO) $(OcamlDir)/.dir > + $(Echo) "Building $(BuildMode) $(notdir $@)" > + -$(Verb) $(RM) -f $@ > + $(Verb) $(Archive) $@ $(ObjectsO) > + $(Verb) $(Ranlib) $@ > + > +clean-a:: > + -$(Verb) $(RM) -f $(LibraryA) > + > +install-a:: $(LibraryA) > + $(Echo) "Installing $(BuildMode) $(DestA)" > + $(Verb) $(MKDIR) $(PROJ_libocamldir) > + $(Verb) $(LTInstall) $(LibraryA) $(DestA) > + $(Verb) > + > +uninstall-a:: > + $(Echo) "Uninstalling $(DestA)" > + -$(Verb) $(RM) -f $(DestA) > + > + > +##===- Build ocaml interfaces (.mli's -> .cmi's) > --------------------------===## > + > +all-local:: build-cmis > +clean-local:: clean-cmis > +install-local:: install-cmis > +uninstall-local:: uninstall-cmis > + > +build-cmis: $(ObjectsCMI) > + > +$(OcamlDir)/%.cmi: $(PROJ_SRC_DIR)/%.mli $(OcamlDir)/.dir > + $(Echo) "Compiling $(notdir $<) for $(BuildMode) build" > + $(Verb) $(Compile.CMI) $@ $< > + > +clean-cmis:: > + -$(Verb) $(RM) -f $(ObjectsCMI) > + > +# Also install the .mli's (headers) as documentation. > +install-cmis: $(ObjectsCMI) > + $(Verb) $(MKDIR) $(PROJ_libocamldir) > + $(Verb) for i in $(patsubst $(OcamlDir)/%,%,$(ObjectsCMI)); do \ > + $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ > + $(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \ > + done > + $(Verb) for i in $(patsubst $(PROJ_SRC_DIR)/%,%,$(OcamlHeaders)); > do \ > + $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ > + $(DataInstall) $(PROJ_SRC_DIR)/$$i "$(PROJ_libocamldir)/$$i"; \ > + done > + > +uninstall-cmis:: > + $(Verb) for i in $(patsubst $(OcamlDir)/%,%,$(ObjectsCMI)); do \ > + $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ > + $(RM) -f "$(PROJ_libocamldir)/$$i"; \ > + done > + $(Verb) for i in $(patsubst $(PROJ_SRC_DIR)/%,%,$(OcamlHeaders)); > do \ > + $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ > + $(RM) -f "$(PROJ_libocamldir)/$$i"; \ > + done > + > + > +##===- Build ocaml bytecode archive (.ml's -> .cmo's -> .cma) > -------------===## > + > +all-local:: $(LibraryCMA) > +clean-local:: clean-cma > +install-local:: install-cma > +uninstall-local:: uninstall-cma > + > +$(LibraryCMA): $(ObjectsCMO) $(OcamlDir)/.dir > + $(Echo) "Archiving $(notdir $@) for $(BuildMode) build" > + $(Verb) $(Archive.CMA) $@ $(ObjectsCMO) > + $(Verb) for i in $(UsedLibNames); do \ > + ln -sf "$(LibDir)/$$i" "$(OcamlDir)/$$i"; \ > + done > + > +$(ObjDir)/%.cmo: $(PROJ_SRC_DIR)/%.ml $(OcamlDir)/.dir > + $(Echo) "Compiling $(notdir $<) for $(BuildMode) build" > + $(Verb) $(Compile.CMO) $@ $< > + > +clean-cma:: > + $(Verb) $(RM) -f $(LibraryCMA) > + > +install-cma:: $(LibraryCMA) > + $(Echo) "Installing $(BuildMode) $(DestCMA)" > + $(Verb) $(MKDIR) $(PROJ_libocamldir) > + $(Verb) $(DataInstall) $(LibraryCMA) "$(DestCMA)" > + $(Verb) for i in $(UsedLibNames); do \ > + $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ > + ln -sf "$(PROJ_libdir)/$$i" "$(PROJ_libocamldir)/$$i"; \ > + done > + > +uninstall-cma:: > + $(Echo) "Uninstalling $(DestCMA)" > + -$(Verb) $(RM) -f $(DestCMA) > + $(Verb) for i in $(UsedLibNames); do \ > + $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ > + $(RM) -f "$(PROJ_libocamldir)/$$i"; \ > + done > + > + > +##===- Build optimized ocaml archive (.ml's -> .cmx's - > > .cmxa, .a) -------===## > + > +# The ocamlopt compiler is supported on a set of targets disjoint > from LLVM's. > +# If unavailable, 'configure' will not define OCAMLOPT in > Makefile.config. > +ifdef OCAMLOPT > + > +all-local:: $(LibraryCMXA) > +clean-local:: clean-cmxa > +install-local:: install-cmxa > +uninstall-local:: uninstall-cmxa > + > +$(LibraryCMXA): $(ObjectsCMX) > + $(Echo) "Archiving $(notdir $@) for $(BuildMode) build" > + $(Verb) $(Archive.CMXA) $@ $(ObjectsCMX) > + $(Verb) $(RM) -f $(@:.cmxa=.o) > + > +$(OcamlDir)/%.cmx: $(PROJ_SRC_DIR)/%.ml > + $(Echo) "Compiling optimized $(notdir $<) for $(BuildMode) build" > + $(Verb) $(Compile.CMX) $@ $< > + > +clean-cmxa:: > + $(Verb) $(RM) -f $(LibraryCMXA) $(LibraryCMXA:.cmxa=.o) \ > + $(LibraryCMXA:.cmxa=.a) $(ObjectsCMX) > + > +install-cmxa:: $(LibraryCMXA) > + $(Verb) $(MKDIR) $(PROJ_libocamldir) > + $(Echo) "Installing $(BuildMode) $(DestCMXA)" > + $(Verb) $(DataInstall) $(LibraryCMXA) $(DestCMXA) > + $(Echo) "Installing $(BuildMode) $(DestCMXA:.cmxa=.a)" > + $(Verb) $(DataInstall) $(LibraryCMXA:.cmxa=.a) $(DestCMXA:.cmxa=.a) > + $(Verb) for i in $(ObjectsCMX:$(OcamlDir)/%=%); do \ > + $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ > + $(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \ > + done > + > +uninstall-cmxa:: $(LibraryCMXA) > + $(Echo) "Uninstalling $(DestCMXA)" > + $(Verb) $(RM) -f $(DestCMXA) > + $(Echo) "Uninstalling $(DestCMXA:.cmxa=.a)" > + $(Verb) $(RM) -f $(DestCMXA:.cmxa=.a) > + $(Verb) for i in $(ObjectsCMX:$(OcamlDir)/%=%); do \ > + $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ > + $(RM) -f $(PROJ_libocamldir)/$$i; \ > + done > + > +endif > + > + > +##===- Debugging gunk > -----------------------------------------------------===## > +printvars:: printcamlvars > + > +printcamlvars:: > + $(Echo) "LLVM_CONFIG : " '$(LLVM_CONFIG)' > + $(Echo) "OCAMLCFLAGS : " '$(OCAMLCFLAGS)' > + $(Echo) "OCAMLAFLAGS : " '$(OCAMLAFLAGS)' > + $(Echo) "OCAMLC : " '$(OCAMLC)' > + $(Echo) "OCAMLOPT : " '$(OCAMLOPT)' > + $(Echo) "Compile.CMI : " '$(Compile.CMI)' > + $(Echo) "Compile.CMO : " '$(Compile.CMO)' > + $(Echo) "Archive.CMA : " '$(Archive.CMA)' > + $(Echo) "Compile.CMX : " '$(Compile.CMX)' > + $(Echo) "Archive.CMXA : " '$(Archive.CMXA)' > + $(Echo) "CAML_LIBDIR : " '$(CAML_LIBDIR)' > + $(Echo) "LibraryCMA : " '$(LibraryCMA)' > + $(Echo) "LibraryCMXA : " '$(LibraryCMXA)' > + $(Echo) "OcamlSources : " '$(OcamlSources)' > + $(Echo) "ObjectsCMI : " '$(ObjectsCMI)' > + $(Echo) "ObjectsCMO : " '$(ObjectsCMO)' > + $(Echo) "ObjectsCMX : " '$(ObjectsCMX)' > + $(Echo) "OCAML_LIBDIR : " '$(OCAML_LIBDIR)' > + $(Echo) "DestA : " '$(DestA)' > + $(Echo) "DestCMA : " '$(DestCMA)' > + $(Echo) "DestCMXA : " '$(DestCMXA)' > + $(Echo) "UsedLibs : " '$(UsedLibs)' > + $(Echo) "UsedLibNames : " '$(UsedLibNames)' > + > +.PHONY: printcamlvars build-cmis \ > + clean-a clean-cmis clean-cma clean-cmxa \ > + install-a install-cmis install-cma install-cmxa \ > + uninstall-a uninstall-cmis uninstall-cma uninstall-cmxa > > Modified: llvm/trunk/test/Makefile > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Makefile? > rev=42090&r1=42089&r2=42090&view=diff > > ====================================================================== > ======== > --- llvm/trunk/test/Makefile (original) > +++ llvm/trunk/test/Makefile Tue Sep 18 07:26:17 2007 > @@ -28,8 +28,18 @@ > RUNTESTFLAGS := --tool $(CLEANED_TESTSUITE) > endif > > +IGNORE_TESTS := > + > ifndef RUNLLVM2CPP > -RUNTESTFLAGS += --ignore llvm2cpp.exp > +IGNORE_TESTS += llvm2cpp.exp > +endif > + > +ifndef OCAMLC > +IGNORE_TESTS += ocaml.exp > +endif > + > +ifdef IGNORE_TESTS > +RUNTESTFLAGS += --ignore "$(strip $(IGNORE_TESTS))" > endif > > ifneq ($(RUNTEST),) > @@ -89,6 +99,7 @@ > @echo 'set llvmgxx "$(LLVMGCC)"' >> site.tmp > @echo 'set llvmgccmajvers "$(LLVMGCC_MAJVERS)"' >> site.tmp > @echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp > + @echo 'set ocamlc "$(OCAMLC) -cc $(CXX) -I $(LibDir)/ocaml"' >> > site.tmp > @echo '## All variables above are generated by configure. Do Not > Edit ## ' >>site.tmp > @test ! -f site.exp || \ > sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp > > > _______________________________________________ > 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/20070918/f1e07315/attachment.html From gordonhenriksen at mac.com Tue Sep 18 07:49:41 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 12:49:41 -0000 Subject: [llvm-commits] [llvm] r42093 - in /llvm/trunk: ./ bindings/ bindings/ocaml/ bindings/ocaml/bitwriter/ bindings/ocaml/llvm/ test/Bindings/ test/Bindings/Ocaml/ test/lib/ Message-ID: <200709181249.l8ICngqE011236@zion.cs.uiuc.edu> Author: gordon Date: Tue Sep 18 07:49:39 2007 New Revision: 42093 URL: http://llvm.org/viewvc/llvm-project?rev=42093&view=rev Log: Adding ocaml language bindings for the vmcore and bitwriter libraries. These are built atop the C language bindings, and user programs can link with them as such: # Bytecode ocamlc -cc g++ llvm.cma llvmbitwriter.cma -o example example.ml # Native ocamlopt -cc g++ llvm.cmxa llvmbitwriter.cmxa -o example.opt example.ml The vmcore.ml test exercises most/all of the APIs thus far bound. Unfortunately, they're not yet numerous enough to write hello world. But: $ cat example.ml (* example.ml *) open Llvm open Llvm_bitwriter let _ = let filename = Sys.argv.(1) in let m = create_module filename in let v = make_int_constant i32_type 42 false in let g = define_global "hello_world" v m in if not (write_bitcode_file m filename) then exit 1; dispose_module m; $ ocamlc -cc g++ llvm.cma llvm_bitwriter.cma -o example example.ml File "example.ml", line 11, characters 6-7: Warning Y: unused variable g. $ ./example example.bc $ llvm-dis < example.bc ; ModuleID = '' @hello_world = global i32 42 ; [#uses=0] The ocaml test cases provide effective tests for the C interfaces. Added: llvm/trunk/bindings/Makefile llvm/trunk/bindings/README.txt llvm/trunk/bindings/ocaml/Makefile llvm/trunk/bindings/ocaml/bitwriter/ llvm/trunk/bindings/ocaml/bitwriter/Makefile llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.ml llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli llvm/trunk/bindings/ocaml/llvm/ llvm/trunk/bindings/ocaml/llvm/Makefile llvm/trunk/bindings/ocaml/llvm/llvm.ml llvm/trunk/bindings/ocaml/llvm/llvm.mli llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c llvm/trunk/test/Bindings/ llvm/trunk/test/Bindings/Ocaml/ (with props) llvm/trunk/test/Bindings/Ocaml/bitwriter.ml llvm/trunk/test/Bindings/Ocaml/ocaml.exp llvm/trunk/test/Bindings/Ocaml/vmcore.ml Modified: llvm/trunk/Makefile llvm/trunk/test/lib/llvm.exp Modified: llvm/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile?rev=42093&r1=42092&r2=42093&view=diff ============================================================================== --- llvm/trunk/Makefile (original) +++ llvm/trunk/Makefile Tue Sep 18 07:49:39 2007 @@ -20,7 +20,7 @@ DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \ tools runtime docs -OPTIONAL_DIRS := examples projects +OPTIONAL_DIRS := examples projects bindings EXTRA_DIST := test llvm.spec include win32 Xcode include $(LEVEL)/Makefile.config @@ -46,7 +46,7 @@ # build LLVM. ifeq ($(MAKECMDGOALS),install) DIRS := $(filter-out utils, $(DIRS)) - OPTIONAL_DIRS := + OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS)) endif # Include the main makefile machinery. Added: llvm/trunk/bindings/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/Makefile?rev=42093&view=auto ============================================================================== --- llvm/trunk/bindings/Makefile (added) +++ llvm/trunk/bindings/Makefile Tue Sep 18 07:49:39 2007 @@ -0,0 +1,18 @@ +##===- bindings/Makefile -----------------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file was developed by Gordon Henriksen and is distributed under the +# University of Illinois Open Source License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LEVEL := .. + +include $(LEVEL)/Makefile.config + +ifdef OCAMLC +PARALLEL_DIRS += ocaml +endif + +include $(LEVEL)/Makefile.common Added: llvm/trunk/bindings/README.txt URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/README.txt?rev=42093&view=auto ============================================================================== --- llvm/trunk/bindings/README.txt (added) +++ llvm/trunk/bindings/README.txt Tue Sep 18 07:49:39 2007 @@ -0,0 +1,3 @@ +This directory contains bindings for the LLVM compiler infrastructure to allow +programs written in languages other than C or C++ to take advantage of the LLVM +infrastructure--for instance, a self-hosted compiler front-end. Added: llvm/trunk/bindings/ocaml/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile?rev=42093&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/Makefile (added) +++ llvm/trunk/bindings/ocaml/Makefile Tue Sep 18 07:49:39 2007 @@ -0,0 +1,13 @@ +##===- bindings/ocaml/Makefile -----------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file was developed by Gordon Henriksen and is distributed under the +# University of Illinois Open Source License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## + +LEVEL := ../.. +DIRS = llvm bitwriter + +include $(LEVEL)/Makefile.common Added: llvm/trunk/bindings/ocaml/bitwriter/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitwriter/Makefile?rev=42093&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/bitwriter/Makefile (added) +++ llvm/trunk/bindings/ocaml/bitwriter/Makefile Tue Sep 18 07:49:39 2007 @@ -0,0 +1,23 @@ +##===- bindings/ocaml/llvm/Makefile ------------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file was developed by the LLVM research group and is distributed under +# the University of Illinois Open Source License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +# +# This is the makefile for the llvm-ml interface. Reference materials on +# installing ocaml libraries: +# +# https://fedoraproject.org/wiki/Packaging/OCaml +# http://pkg-ocaml-maint.alioth.debian.org/ocaml_packaging_policy.txt +# +##===----------------------------------------------------------------------===## + +LEVEL := ../../.. +LIBRARYNAME := llvm_bitwriter +DONT_BUILD_RELINKED := 1 +UsedComponents := bitwriter + +include ../Makefile.ocaml Added: llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c?rev=42093&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c (added) +++ llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c Tue Sep 18 07:49:39 2007 @@ -0,0 +1,31 @@ +/*===-- bitwriter_ocaml.c - LLVM Ocaml Glue ---------------------*- C++ -*-===*\ +|* *| +|* The LLVM Compiler Infrastructure *| +|* *| +|* This file was developed by Gordon Henriksen and is distributed under the *| +|* University of Illinois Open Source License. See LICENSE.TXT for details. *| +|* *| +|*===----------------------------------------------------------------------===*| +|* *| +|* This file glues LLVM's ocaml interface to its C interface. These functions *| +|* are by and large transparent wrappers to the corresponding C functions. *| +|* *| +|* Note that these functions intentionally take liberties with the CAMLparamX *| +|* macros, since most of the parameters are not GC heap objects. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#include "llvm-c/BitWriter.h" +#include "llvm-c/Core.h" +#include "caml/alloc.h" +#include "caml/mlvalues.h" +#include "caml/memory.h" + +/*===-- Modules -----------------------------------------------------------===*/ + +/* Llvm.llmodule -> string -> bool */ +CAMLprim value llvm_write_bitcode_file(value M, value Path) { + CAMLparam1(Path); + int res = LLVMWriteBitcodeToFile((LLVMModuleRef) M, String_val(Path)); + CAMLreturn(Val_bool(res == 0)); +} Added: llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.ml?rev=42093&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.ml (added) +++ llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.ml Tue Sep 18 07:49:39 2007 @@ -0,0 +1,18 @@ +(*===-- llvm_bitwriter.ml - LLVM Ocaml Interface ----------------*- C++ -*-===* + * + * The LLVM Compiler Infrastructure + * + * This file was developed by Gordon Henriksen and is distributed under the + * University of Illinois Open Source License. See LICENSE.TXT for details. + * + *===----------------------------------------------------------------------=== + * + * This interface provides an ocaml API for the LLVM intermediate + * representation, the classes in the VMCore library. + * + *===----------------------------------------------------------------------===*) + + +(* Writes the bitcode for module the given path. Returns true if successful. *) +external write_bitcode_file : Llvm.llmodule -> string -> bool + = "llvm_write_bitcode_file" Added: llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli?rev=42093&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli (added) +++ llvm/trunk/bindings/ocaml/bitwriter/llvm_bitwriter.mli Tue Sep 18 07:49:39 2007 @@ -0,0 +1,18 @@ +(*===-- llvm_bitwriter.mli - LLVM Ocaml Interface ---------------*- C++ -*-===* + * + * The LLVM Compiler Infrastructure + * + * This file was developed by Gordon Henriksen and is distributed under the + * University of Illinois Open Source License. See LICENSE.TXT for details. + * + *===----------------------------------------------------------------------=== + * + * This interface provides an ocaml API for the LLVM bitcode writer, the + * classes in the classes in the Bitwriter library. + * + *===----------------------------------------------------------------------===*) + + +(* Writes the bitcode for module the given path. Returns true if successful. *) +external write_bitcode_file : Llvm.llmodule -> string -> bool + = "llvm_write_bitcode_file" Added: llvm/trunk/bindings/ocaml/llvm/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/Makefile?rev=42093&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/Makefile (added) +++ llvm/trunk/bindings/ocaml/llvm/Makefile Tue Sep 18 07:49:39 2007 @@ -0,0 +1,24 @@ +##===- bindings/ocaml/bitwriter/Makefile -------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file was developed by the LLVM research group and is distributed under +# the University of Illinois Open Source License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +# +# This is the makefile for the llvm-ml interface. Reference materials on +# installing ocaml libraries: +# +# https://fedoraproject.org/wiki/Packaging/OCaml +# http://pkg-ocaml-maint.alioth.debian.org/ocaml_packaging_policy.txt +# +##===----------------------------------------------------------------------===## + +LEVEL := ../../.. +LIBRARYNAME := llvm +DONT_BUILD_RELINKED := 1 +UsedComponents := core +UsedOcamLibs := llvm + +include ../Makefile.ocaml Added: llvm/trunk/bindings/ocaml/llvm/llvm.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.ml?rev=42093&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm.ml (added) +++ llvm/trunk/bindings/ocaml/llvm/llvm.ml Tue Sep 18 07:49:39 2007 @@ -0,0 +1,228 @@ +(*===-- tools/ml/llvm.ml - LLVM Ocaml Interface ---------------------------===* + * + * The LLVM Compiler Infrastructure + * + * This file was developed by Gordon Henriksen and is distributed under the + * University of Illinois Open Source License. See LICENSE.TXT for details. + * + *===----------------------------------------------------------------------=== + * + * This interface provides an ocaml API for the LLVM intermediate + * representation, the classes in the VMCore library. + * + *===----------------------------------------------------------------------===*) + + +(* These abstract types correlate directly to the LLVM VMCore classes. *) +type llmodule +type lltype +type llvalue + +type type_kind = + Void_type +| Float_type +| Double_type +| X86fp80_type +| Fp128_type +| Ppc_fp128_type +| Label_type +| Integer_type +| Function_type +| Struct_type +| Array_type +| Pointer_type +| Opaque_type +| Vector_type + +type linkage = + External_linkage +| Link_once_linkage +| Weak_linkage +| Appending_linkage +| Internal_linkage +| Dllimport_linkage +| Dllexport_linkage +| External_weak_linkage +| Ghost_linkage + +type visibility = + Default_visibility +| Hidden_visibility +| Protected_visibility + + +(*===-- Modules -----------------------------------------------------------===*) + +(* Creates a module with the supplied module ID. Modules are not garbage + collected; it is mandatory to call dispose_module to free memory. *) +external create_module : string -> llmodule = "llvm_create_module" + +(* Disposes a module. All references to subordinate objects are invalidated; + referencing them will invoke undefined behavior. *) +external dispose_module : llmodule -> unit = "llvm_dispose_module" + +(* Adds a named type to the module's symbol table. Returns true if successful. + If such a name already exists, then no entry is added and returns false. *) +external add_type_name : string -> lltype -> llmodule -> bool + = "llvm_add_type_name" + + +(*===-- Types -------------------------------------------------------------===*) + +external classify_type : lltype -> type_kind = "llvm_classify_type" +external refine_abstract_type : lltype -> lltype -> unit + = "llvm_refine_abstract_type" + +(*--... Operations on integer types ........................................--*) +external _i1_type : unit -> lltype = "llvm_i1_type" +external _i8_type : unit -> lltype = "llvm_i8_type" +external _i16_type : unit -> lltype = "llvm_i16_type" +external _i32_type : unit -> lltype = "llvm_i32_type" +external _i64_type : unit -> lltype = "llvm_i64_type" + +let i1_type = _i1_type () +let i8_type = _i8_type () +let i16_type = _i16_type () +let i32_type = _i32_type () +let i64_type = _i64_type () + +external make_integer_type : int -> lltype = "llvm_make_integer_type" +external integer_bitwidth : lltype -> int = "llvm_integer_bitwidth" + +(*--... Operations on real types ...........................................--*) +external _float_type : unit -> lltype = "llvm_float_type" +external _double_type : unit -> lltype = "llvm_double_type" +external _x86fp80_type : unit -> lltype = "llvm_x86fp80_type" +external _fp128_type : unit -> lltype = "llvm_fp128_type" +external _ppc_fp128_type : unit -> lltype = "llvm_ppc_fp128_type" + +let float_type = _float_type () +let double_type = _double_type () +let x86fp80_type = _x86fp80_type () +let fp128_type = _fp128_type () +let ppc_fp128_type = _ppc_fp128_type () + +(*--... Operations on function types .......................................--*) +(* FIXME: handle parameter attributes *) +external make_function_type : lltype -> lltype array -> bool -> lltype + = "llvm_make_function_type" +external is_var_arg : lltype -> bool = "llvm_is_var_arg" +external return_type : lltype -> lltype = "llvm_return_type" +external param_types : lltype -> lltype array = "llvm_param_types" + +(*--... Operations on struct types .........................................--*) +external make_struct_type : lltype array -> bool -> lltype + = "llvm_make_struct_type" +external element_types : lltype -> lltype array = "llvm_element_types" +external is_packed : lltype -> bool = "llvm_is_packed" + +(*--... Operations on pointer, vector, and array types .....................--*) +external make_array_type : lltype -> int -> lltype = "llvm_make_array_type" +external make_pointer_type : lltype -> lltype = "llvm_make_pointer_type" +external make_vector_type : lltype -> int -> lltype = "llvm_make_vector_type" + +external element_type : lltype -> lltype = "llvm_element_type" +external array_length : lltype -> int = "llvm_array_length" +external vector_size : lltype -> int = "llvm_vector_size" + +(*--... Operations on other types ..........................................--*) +external make_opaque_type : unit -> lltype = "llvm_make_opaque_type" +external _void_type : unit -> lltype = "llvm_void_type" +external _label_type : unit -> lltype = "llvm_label_type" + +let void_type = _void_type () +let label_type = _label_type () + + +(*===-- Values ------------------------------------------------------------===*) + +external type_of : llvalue -> lltype = "llvm_type_of" +external value_name : llvalue -> string = "llvm_value_name" +external set_value_name : string -> llvalue -> unit = "llvm_set_value_name" + +(*--... Operations on constants of (mostly) any type .......................--*) +external make_null : lltype -> llvalue = "llvm_make_null" +external make_all_ones : lltype -> llvalue = "llvm_make_all_ones" +external make_undef : lltype -> llvalue = "llvm_make_undef" +external is_null : llvalue -> bool = "llvm_is_null" + +(*--... Operations on scalar constants .....................................--*) +external make_int_constant : lltype -> int -> bool -> llvalue + = "llvm_make_int_constant" +external make_real_constant : lltype -> float -> llvalue + = "llvm_make_real_constant" + +(*--... Operations on composite constants ..................................--*) +external make_string_constant : string -> bool -> llvalue + = "llvm_make_string_constant" +external make_array_constant : lltype -> llvalue array -> llvalue + = "llvm_make_array_constant" +external make_struct_constant : llvalue array -> bool -> llvalue + = "llvm_make_struct_constant" +external make_vector_constant : llvalue array -> llvalue + = "llvm_make_vector_constant" + +(*--... Operations on global variables, functions, and aliases (globals) ...--*) +external is_declaration : llvalue -> bool = "llvm_is_declaration" +external linkage : llvalue -> linkage = "llvm_linkage" +external set_linkage : linkage -> llvalue -> unit = "llvm_set_linkage" +external section : llvalue -> string = "llvm_section" +external set_section : string -> llvalue -> unit = "llvm_set_section" +external visibility : llvalue -> visibility = "llvm_visibility" +external set_visibility : visibility -> llvalue -> unit = "llvm_set_visibility" +external alignment : llvalue -> int = "llvm_alignment" +external set_alignment : int -> llvalue -> unit = "llvm_set_alignment" + +(*--... Operations on global variables .....................................--*) +external declare_global : lltype -> string -> llmodule -> llvalue + = "llvm_declare_global" +external define_global : string -> llvalue -> llmodule -> llvalue + = "llvm_define_global" +external delete_global : llvalue -> unit = "llvm_delete_global" +external global_initializer : llvalue -> llvalue = "llvm_global_initializer" +external set_initializer : llvalue -> llvalue -> unit = "llvm_set_initializer" +external remove_initializer : llvalue -> unit = "llvm_remove_initializer" +external is_thread_local : llvalue -> bool = "llvm_is_thread_local" +external set_thread_local : bool -> llvalue -> unit = "llvm_set_thread_local" + + +(*===-- Non-Externs -------------------------------------------------------===*) +(* These functions are built using the externals, so must be declared late. *) + +let concat2 sep arr = + let s = ref "" in + if 0 < Array.length arr then begin + s := !s ^ arr.(0); + for i = 1 to (Array.length arr) - 1 do + s := !s ^ sep ^ arr.(i) + done + end; + !s + +let rec string_of_lltype ty = + match classify_type ty with + Integer_type -> "i" ^ string_of_int (integer_bitwidth ty) + | Pointer_type -> (string_of_lltype (element_type ty)) ^ "*" + | Struct_type -> + let s = "{ " ^ (concat2 ", " ( + Array.map string_of_lltype (element_types ty) + )) ^ " }" in + if is_packed ty + then "<" ^ s ^ ">" + else s + | Array_type -> "[" ^ (string_of_int (array_length ty)) ^ + " x " ^ (string_of_lltype (element_type ty)) ^ "]" + | Vector_type -> "<" ^ (string_of_int (vector_size ty)) ^ + " x " ^ (string_of_lltype (element_type ty)) ^ ">" + | Opaque_type -> "opaque" + | Function_type -> string_of_lltype (return_type ty) ^ + " (" ^ (concat2 ", " ( + Array.map string_of_lltype (param_types ty) + )) ^ ")" + | Label_type -> "label" + | Ppc_fp128_type -> "ppc_fp128" + | Fp128_type -> "fp128" + | X86fp80_type -> "x86_fp80" + | Double_type -> "double" + | Float_type -> "float" + | Void_type -> "void" Added: llvm/trunk/bindings/ocaml/llvm/llvm.mli URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.mli?rev=42093&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm.mli (added) +++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Tue Sep 18 07:49:39 2007 @@ -0,0 +1,170 @@ +(*===-- tools/ml/llvm.ml - LLVM Ocaml Interface ---------------------------===* + * + * The LLVM Compiler Infrastructure + * + * This file was developed by Gordon Henriksen and is distributed under the + * University of Illinois Open Source License. See LICENSE.TXT for details. + * + *===----------------------------------------------------------------------=== + * + * This interface provides an ocaml API for the LLVM intermediate + * representation, the classes in the VMCore library. + * + *===----------------------------------------------------------------------===*) + + +(* These abstract types correlate directly to the LLVM VMCore classes. *) +type llmodule +type lltype +type llvalue + +type type_kind = + Void_type +| Float_type +| Double_type +| X86fp80_type +| Fp128_type +| Ppc_fp128_type +| Label_type +| Integer_type +| Function_type +| Struct_type +| Array_type +| Pointer_type +| Opaque_type +| Vector_type + +type linkage = + External_linkage +| Link_once_linkage +| Weak_linkage +| Appending_linkage +| Internal_linkage +| Dllimport_linkage +| Dllexport_linkage +| External_weak_linkage +| Ghost_linkage + +type visibility = + Default_visibility +| Hidden_visibility +| Protected_visibility + + +(*===-- Modules -----------------------------------------------------------===*) + +(* Creates a module with the supplied module ID. Modules are not garbage + collected; it is mandatory to call dispose_module to free memory. *) +external create_module : string -> llmodule = "llvm_create_module" + +(* Disposes a module. All references to subordinate objects are invalidated; + referencing them will invoke undefined behavior. *) +external dispose_module : llmodule -> unit = "llvm_dispose_module" + +(* Adds a named type to the module's symbol table. Returns true if successful. + If such a name already exists, then no entry is added and returns false. *) +external add_type_name : string -> lltype -> llmodule -> bool + = "llvm_add_type_name" + + +(*===-- Types -------------------------------------------------------------===*) +external classify_type : lltype -> type_kind = "llvm_classify_type" +external refine_abstract_type : lltype -> lltype -> unit + = "llvm_refine_abstract_type" +val string_of_lltype : lltype -> string + +(*--... Operations on integer types ........................................--*) +val i1_type : lltype +val i8_type : lltype +val i16_type : lltype +val i32_type : lltype +val i64_type : lltype +external make_integer_type : int -> lltype = "llvm_make_integer_type" +external integer_bitwidth : lltype -> int = "llvm_integer_bitwidth" + +(*--... Operations on real types ...........................................--*) +val float_type : lltype +val double_type : lltype +val x86fp80_type : lltype +val fp128_type : lltype +val ppc_fp128_type : lltype + +(*--... Operations on function types .......................................--*) +(* FIXME: handle parameter attributes *) +external make_function_type : lltype -> lltype array -> bool -> lltype + = "llvm_make_function_type" +external is_var_arg : lltype -> bool = "llvm_is_var_arg" +external return_type : lltype -> lltype = "llvm_return_type" +external param_types : lltype -> lltype array = "llvm_param_types" + +(*--... Operations on struct types .........................................--*) +external make_struct_type : lltype array -> bool -> lltype + = "llvm_make_struct_type" +external element_types : lltype -> lltype array = "llvm_element_types" +external is_packed : lltype -> bool = "llvm_is_packed" + +(*--... Operations on pointer, vector, and array types .....................--*) +external make_array_type : lltype -> int -> lltype = "llvm_make_array_type" +external make_pointer_type : lltype -> lltype = "llvm_make_pointer_type" +external make_vector_type : lltype -> int -> lltype = "llvm_make_vector_type" + +external element_type : lltype -> lltype = "llvm_element_type" +external array_length : lltype -> int = "llvm_array_length" +external vector_size : lltype -> int = "llvm_vector_size" + +(*--... Operations on other types ..........................................--*) +external make_opaque_type : unit -> lltype = "llvm_make_opaque_type" +val void_type : lltype +val label_type : lltype + + +(*===-- Values ------------------------------------------------------------===*) +external type_of : llvalue -> lltype = "llvm_type_of" +external value_name : llvalue -> string = "llvm_value_name" +external set_value_name : string -> llvalue -> unit = "llvm_set_value_name" + +(*--... Operations on constants of (mostly) any type .......................--*) +external make_null : lltype -> llvalue = "llvm_make_null" +external make_all_ones : lltype -> llvalue = "llvm_make_all_ones" +external make_undef : lltype -> llvalue = "llvm_make_undef" +external is_null : llvalue -> bool = "llvm_is_null" + +(*--... Operations on scalar constants .....................................--*) +external make_int_constant : lltype -> int -> bool -> llvalue + = "llvm_make_int_constant" +external make_real_constant : lltype -> float -> llvalue + = "llvm_make_real_constant" + +(*--... Operations on composite constants ..................................--*) +external make_string_constant : string -> bool -> llvalue + = "llvm_make_string_constant" +external make_array_constant : lltype -> llvalue array -> llvalue + = "llvm_make_array_constant" +external make_struct_constant : llvalue array -> bool -> llvalue + = "llvm_make_struct_constant" +external make_vector_constant : llvalue array -> llvalue + = "llvm_make_vector_constant" + +(*--... Operations on global variables, functions, and aliases (globals) ...--*) +external is_declaration : llvalue -> bool = "llvm_is_declaration" +external linkage : llvalue -> linkage = "llvm_linkage" +external set_linkage : linkage -> llvalue -> unit = "llvm_set_linkage" +external section : llvalue -> string = "llvm_section" +external set_section : string -> llvalue -> unit = "llvm_set_section" +external visibility : llvalue -> visibility = "llvm_visibility" +external set_visibility : visibility -> llvalue -> unit = "llvm_set_visibility" +external alignment : llvalue -> int = "llvm_alignment" +external set_alignment : int -> llvalue -> unit = "llvm_set_alignment" + +(*--... Operations on global variables .....................................--*) +external declare_global : lltype -> string -> llmodule -> llvalue + = "llvm_declare_global" +external define_global : string -> llvalue -> llmodule -> llvalue + = "llvm_define_global" +external delete_global : llvalue -> unit = "llvm_delete_global" +external global_initializer : llvalue -> llvalue = "llvm_global_initializer" +external set_initializer : llvalue -> llvalue -> unit = "llvm_set_initializer" +external remove_initializer : llvalue -> unit = "llvm_remove_initializer" +external is_thread_local : llvalue -> bool = "llvm_is_thread_local" +external set_thread_local : bool -> llvalue -> unit = "llvm_set_thread_local" + Added: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=42093&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (added) +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Tue Sep 18 07:49:39 2007 @@ -0,0 +1,410 @@ +/*===-- llvm_ocaml.h - LLVM Ocaml Glue --------------------------*- C++ -*-===*\ +|* *| +|* The LLVM Compiler Infrastructure *| +|* *| +|* This file was developed by Gordon Henriksen and is distributed under the *| +|* University of Illinois Open Source License. See LICENSE.TXT for details. *| +|* *| +|*===----------------------------------------------------------------------===*| +|* *| +|* This file glues LLVM's ocaml interface to its C interface. These functions *| +|* are by and large transparent wrappers to the corresponding C functions. *| +|* *| +|* Note that these functions intentionally take liberties with the CAMLparamX *| +|* macros, since most of the parameters are not GC heap objects. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#include "llvm-c/Core.h" +#include "caml/alloc.h" +#include "caml/mlvalues.h" +#include "caml/memory.h" +#include "stdio.h" + + +/*===-- Modules -----------------------------------------------------------===*/ + +/* string -> llmodule */ +CAMLprim value llvm_create_module(value ModuleID) { + return (value) LLVMModuleCreateWithName(String_val(ModuleID)); +} + +/* llmodule -> unit */ +CAMLprim value llvm_dispose_module(value M) { + LLVMDisposeModule((LLVMModuleRef) M); + return Val_unit; +} + +/* string -> lltype -> llmodule -> bool */ +CAMLprim value llvm_add_type_name(value Name, value Ty, value M) { + int res = LLVMAddTypeName((LLVMModuleRef) M, + String_val(Name), (LLVMTypeRef) Ty); + return Val_bool(res == 0); +} + + +/*===-- Types -------------------------------------------------------------===*/ + +/* lltype -> type_kind */ +CAMLprim value llvm_classify_type(value Ty) { + return Val_int(LLVMGetTypeKind((LLVMTypeRef) Ty)); +} + +/* lltype -> lltype -> unit */ +CAMLprim value llvm_refine_abstract_type(value ConcreteTy, value AbstractTy) { + LLVMRefineAbstractType((LLVMTypeRef) AbstractTy, (LLVMTypeRef) ConcreteTy); + return (value) Val_unit; +} + +/*--... Operations on integer types ........................................--*/ + +/* unit -> lltype */ +CAMLprim value llvm_i1_type (value Unit) { return (value) LLVMInt1Type(); } +CAMLprim value llvm_i8_type (value Unit) { return (value) LLVMInt8Type(); } +CAMLprim value llvm_i16_type(value Unit) { return (value) LLVMInt16Type(); } +CAMLprim value llvm_i32_type(value Unit) { return (value) LLVMInt32Type(); } +CAMLprim value llvm_i64_type(value Unit) { return (value) LLVMInt64Type(); } + +/* int -> lltype */ +CAMLprim value llvm_make_integer_type(value Width) { + return (value) LLVMCreateIntegerType(Int_val(Width)); +} + +/* lltype -> int */ +CAMLprim value llvm_integer_bitwidth(value IntegerTy) { + return Val_int(LLVMGetIntegerTypeWidth((LLVMTypeRef) IntegerTy)); +} + +/*--... Operations on real types ...........................................--*/ + +/* unit -> lltype */ +CAMLprim value llvm_float_type(value Unit) { + return (value) LLVMFloatType(); +} + +/* unit -> lltype */ +CAMLprim value llvm_double_type(value Unit) { + return (value) LLVMDoubleType(); +} + +/* unit -> lltype */ +CAMLprim value llvm_x86fp80_type(value Unit) { + return (value) LLVMX86FP80Type(); +} + +/* unit -> lltype */ +CAMLprim value llvm_fp128_type(value Unit) { + return (value) LLVMFP128Type(); +} + +/* unit -> lltype */ +CAMLprim value llvm_ppc_fp128_type(value Unit) { + return (value) LLVMPPCFP128Type(); +} + +/*--... Operations on function types .......................................--*/ + +/* lltype -> lltype array -> bool -> lltype */ +CAMLprim value llvm_make_function_type(value RetTy, value ParamTys, + value IsVarArg) { + return (value) LLVMCreateFunctionType((LLVMTypeRef) RetTy, + (LLVMTypeRef *) ParamTys, + Wosize_val(ParamTys), + Bool_val(IsVarArg)); +} + +/* lltype -> bool */ +CAMLprim value llvm_is_var_arg(value FunTy) { + return Val_bool(LLVMIsFunctionVarArg((LLVMTypeRef) FunTy)); +} + +/* lltype -> lltype */ +CAMLprim value llvm_return_type(value FunTy) { + return (value) LLVMGetFunctionReturnType((LLVMTypeRef) FunTy); +} + +/* lltype -> lltype array */ +CAMLprim value llvm_param_types(value FunTy) { + unsigned Count = LLVMGetFunctionParamCount((LLVMTypeRef) FunTy); + LLVMTypeRef *FunTys = alloca(Count * sizeof(LLVMTypeRef)); + + /* copy into an ocaml array */ + unsigned i; + value ParamTys = caml_alloc(Count, 0); + + LLVMGetFunctionParamTypes((LLVMTypeRef) FunTy, FunTys); + for (i = 0; i != Count; ++i) + Store_field(ParamTys, i, (value) FunTys[i]); + + return ParamTys; +} + +/*--... Operations on struct types .........................................--*/ + +/* lltype array -> bool -> lltype */ +CAMLprim value llvm_make_struct_type(value ElementTypes, value Packed) { + return (value) LLVMCreateStructType((LLVMTypeRef *) ElementTypes, + Wosize_val(ElementTypes), + Bool_val(Packed)); +} + +/* lltype -> lltype array */ +CAMLprim value llvm_element_types(value StructTy) { + unsigned Count = LLVMGetStructElementCount((LLVMTypeRef) StructTy); + LLVMTypeRef *Tys = alloca(Count * sizeof(LLVMTypeRef)); + + /* copy into an ocaml array */ + unsigned i; + value ElementTys = caml_alloc(Count, 0); + + LLVMGetStructElementTypes((LLVMTypeRef) StructTy, Tys); + for (i = 0; i != Count; ++i) + Store_field(ElementTys, i, (value) Tys[i]); + + return ElementTys; +} + +CAMLprim value llvm_is_packed(value StructTy) { + return Val_bool(LLVMIsPackedStruct((LLVMTypeRef) StructTy)); +} + +/*--... Operations on array, pointer, and vector types .....................--*/ + +/* lltype -> int -> lltype */ +CAMLprim value llvm_make_array_type(value ElementTy, value Count) { + return (value) LLVMCreateArrayType((LLVMTypeRef) ElementTy, Int_val(Count)); +} + +/* lltype -> lltype */ +CAMLprim value llvm_make_pointer_type(value ElementTy) { + return (value) LLVMCreatePointerType((LLVMTypeRef) ElementTy); +} + +/* lltype -> int -> lltype */ +CAMLprim value llvm_make_vector_type(value ElementTy, value Count) { + return (value) LLVMCreateVectorType((LLVMTypeRef) ElementTy, Int_val(Count)); +} + +/* lltype -> lltype */ +CAMLprim value llvm_element_type(value Ty) { + return (value) LLVMGetElementType((LLVMTypeRef) Ty); +} + +/* lltype -> int */ +CAMLprim value llvm_array_length(value ArrayTy) { + return Val_int(LLVMGetArrayLength((LLVMTypeRef) ArrayTy)); +} + +/* lltype -> int */ +CAMLprim value llvm_vector_size(value VectorTy) { + return Val_int(LLVMGetVectorSize((LLVMTypeRef) VectorTy)); +} + +/*--... Operations on other types ..........................................--*/ + +/* unit -> lltype */ +CAMLprim value llvm_void_type (value Unit) { return (value) LLVMVoidType(); } +CAMLprim value llvm_label_type(value Unit) { return (value) LLVMLabelType(); } + +/* unit -> lltype */ +CAMLprim value llvm_make_opaque_type(value Unit) { + return (value) LLVMCreateOpaqueType(); +} + + +/*===-- VALUES ------------------------------------------------------------===*/ + +/* llvalue -> lltype */ +CAMLprim value llvm_type_of(value Val) { + return (value) LLVMGetTypeOfValue((LLVMValueRef) Val); +} + +/* llvalue -> string */ +CAMLprim value llvm_value_name(value Val) { + return caml_copy_string(LLVMGetValueName((LLVMValueRef) Val)); +} + +/* string -> llvalue -> unit */ +CAMLprim value llvm_set_value_name(value Name, value Val) { + LLVMSetValueName((LLVMValueRef) Val, String_val(Name)); + return Val_unit; +} + +/*--... Operations on constants of (mostly) any type .......................--*/ + +/* lltype -> llvalue */ +CAMLprim value llvm_make_null(value Ty) { + return (value) LLVMGetNull((LLVMTypeRef) Ty); +} + +/* lltype -> llvalue */ +CAMLprim value llvm_make_all_ones(value Ty) { + return (value) LLVMGetAllOnes((LLVMTypeRef) Ty); +} + +/* lltype -> llvalue */ +CAMLprim value llvm_make_undef(value Ty) { + return (value) LLVMGetUndef((LLVMTypeRef) Ty); +} + +/* llvalue -> bool */ +CAMLprim value llvm_is_null(value Val) { + return Val_bool(LLVMIsNull((LLVMValueRef) Val)); +} + +/*--... Operations on scalar constants .....................................--*/ + +/* lltype -> int -> bool -> llvalue */ +CAMLprim value llvm_make_int_constant(value IntTy, value N, value SExt) { + /* GCC warns if we use the ternary operator. */ + unsigned long long N2; + if (Bool_val(SExt)) + N2 = (intnat) Int_val(N); + else + N2 = (uintnat) Int_val(N); + + return (value) LLVMGetIntConstant((LLVMTypeRef) IntTy, N2, Bool_val(SExt)); +} + +/* lltype -> float -> llvalue */ +CAMLprim value llvm_make_real_constant(value RealTy, value N) { + return (value) LLVMGetRealConstant((LLVMTypeRef) RealTy, Double_val(N)); +} + +/*--... Operations on composite constants ..................................--*/ + +/* string -> bool -> llvalue */ +CAMLprim value llvm_make_string_constant(value Str, value NullTerminate) { + return (value) LLVMGetStringConstant(String_val(Str), + Wosize_val(Str), + Bool_val(NullTerminate) == 0); +} + +/* lltype -> llvalue array -> llvalue */ +CAMLprim value llvm_make_array_constant(value ElementTy, value ElementVals) { + return (value) LLVMGetArrayConstant((LLVMTypeRef) ElementTy, + (LLVMValueRef*) Op_val(ElementVals), + Wosize_val(ElementVals)); +} + +/* llvalue array -> bool -> llvalue */ +CAMLprim value llvm_make_struct_constant(value ElementVals, value Packed) { + return (value) LLVMGetStructConstant((LLVMValueRef*) Op_val(ElementVals), + Wosize_val(ElementVals), + Bool_val(Packed)); +} + +/* llvalue array -> llvalue */ +CAMLprim value llvm_make_vector_constant(value ElementVals) { + return (value) LLVMGetVectorConstant((LLVMValueRef*) Op_val(ElementVals), + Wosize_val(ElementVals)); +} + +/*--... Operations on global variables, functions, and aliases (globals) ...--*/ + +/* llvalue -> bool */ +CAMLprim value llvm_is_declaration(value Global) { + return Val_bool(LLVMIsDeclaration((LLVMValueRef) Global)); +} + +/* llvalue -> linkage */ +CAMLprim value llvm_linkage(value Global) { + return Val_int(LLVMGetLinkage((LLVMValueRef) Global)); +} + +/* linkage -> llvalue -> unit */ +CAMLprim value llvm_set_linkage(value Linkage, value Global) { + LLVMSetLinkage((LLVMValueRef) Global, Int_val(Linkage)); + return Val_unit; +} + +/* llvalue -> string */ +CAMLprim value llvm_section(value Global) { + return caml_copy_string(LLVMGetSection((LLVMValueRef) Global)); +} + +/* string -> llvalue -> unit */ +CAMLprim value llvm_set_section(value Section, value Global) { + LLVMSetSection((LLVMValueRef) Global, String_val(Section)); + return Val_unit; +} + +/* llvalue -> visibility */ +CAMLprim value llvm_visibility(value Global) { + return Val_int(LLVMGetVisibility((LLVMValueRef) Global)); +} + +/* visibility -> llvalue -> unit */ +CAMLprim value llvm_set_visibility(value Viz, value Global) { + LLVMSetVisibility((LLVMValueRef) Global, Int_val(Viz)); + return Val_unit; +} + +/* llvalue -> int */ +CAMLprim value llvm_alignment(value Global) { + return Val_int(LLVMGetAlignment((LLVMValueRef) Global)); +} + +/* int -> llvalue -> unit */ +CAMLprim value llvm_set_alignment(value Bytes, value Global) { + LLVMSetAlignment((LLVMValueRef) Global, Int_val(Bytes)); + return Val_unit; +} + +/*--... Operations on global variables .....................................--*/ + +/* lltype -> string -> llmodule -> llvalue */ +CAMLprim value llvm_add_global(value Ty, value Name, value M) { + return (value) LLVMAddGlobal((LLVMModuleRef) M, + (LLVMTypeRef) Ty, String_val(Name)); +} + +/* lltype -> string -> llmodule -> llvalue */ +CAMLprim value llvm_declare_global(value Ty, value Name, value M) { + return (value) LLVMAddGlobal((LLVMModuleRef) M, + (LLVMTypeRef) Ty, String_val(Name)); +} + +/* string -> llvalue -> llmodule -> llvalue */ +CAMLprim value llvm_define_global(value Name, value ConstantVal, value M) { + LLVMValueRef Initializer = (LLVMValueRef) ConstantVal; + LLVMValueRef GlobalVar = LLVMAddGlobal((LLVMModuleRef) M, + LLVMGetTypeOfValue(Initializer), + String_val(Name)); + LLVMSetInitializer(GlobalVar, Initializer); + return (value) GlobalVar; +} + +/* llvalue -> unit */ +CAMLprim value llvm_delete_global(value GlobalVar) { + LLVMDeleteGlobal((LLVMValueRef) GlobalVar); + return Val_unit; +} + +/* llvalue -> llvalue */ +CAMLprim value llvm_global_initializer(value GlobalVar) { + return (value) LLVMGetInitializer((LLVMValueRef) GlobalVar); +} + +/* llvalue -> llvalue -> unit */ +CAMLprim value llvm_set_initializer(value ConstantVal, value GlobalVar) { + LLVMSetInitializer((LLVMValueRef) GlobalVar, (LLVMValueRef) ConstantVal); + return Val_unit; +} + +/* llvalue -> unit */ +CAMLprim value llvm_remove_initializer(value GlobalVar) { + LLVMSetInitializer((LLVMValueRef) GlobalVar, NULL); + return Val_unit; +} + +/* llvalue -> bool */ +CAMLprim value llvm_is_thread_local(value GlobalVar) { + return Val_bool(LLVMIsThreadLocal((LLVMValueRef) GlobalVar)); +} + +/* bool -> llvalue -> unit */ +CAMLprim value llvm_set_thread_local(value IsThreadLocal, value GlobalVar) { + LLVMSetThreadLocal((LLVMValueRef) GlobalVar, Bool_val(IsThreadLocal)); + return Val_unit; +} Propchange: llvm/trunk/test/Bindings/Ocaml/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Tue Sep 18 07:49:39 2007 @@ -0,0 +1,3 @@ +Output +*.cmi +*.cmo Added: llvm/trunk/test/Bindings/Ocaml/bitwriter.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/bitwriter.ml?rev=42093&view=auto ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/bitwriter.ml (added) +++ llvm/trunk/test/Bindings/Ocaml/bitwriter.ml Tue Sep 18 07:49:39 2007 @@ -0,0 +1,16 @@ +(* RUN: %ocamlc llvm.cma llvm_bitwriter.cma %s -o %t + * RUN: ./%t %t.bc + * RUN: llvm-dis < %t.bc | grep caml_int_ty + *) + +(* Note that this takes a moment to link, so it's best to keep the number of + individual tests low. *) + +let test x = if not x then exit 1 else () + +let _ = + let m = Llvm.create_module "ocaml_test_module" in + + ignore (Llvm.add_type_name "caml_int_ty" Llvm.i32_type m); + + test (Llvm_bitwriter.write_bitcode_file m Sys.argv.(1)) Added: llvm/trunk/test/Bindings/Ocaml/ocaml.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/ocaml.exp?rev=42093&view=auto ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/ocaml.exp (added) +++ llvm/trunk/test/Bindings/Ocaml/ocaml.exp Tue Sep 18 07:49:39 2007 @@ -0,0 +1,3 @@ +load_lib llvm.exp + +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr,ml}]] Added: llvm/trunk/test/Bindings/Ocaml/vmcore.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/vmcore.ml?rev=42093&view=auto ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/vmcore.ml (added) +++ llvm/trunk/test/Bindings/Ocaml/vmcore.ml Tue Sep 18 07:49:39 2007 @@ -0,0 +1,233 @@ +(* RUN: %ocamlc llvm.cma llvm_bitwriter.cma %s -o %t + * RUN: ./%t %t.bc + * RUN: llvm-dis < %t.bc > %t.ll + *) + +(* Note: It takes several seconds for ocamlc to link an executable with + libLLVMCore.a, so it's better to write a big test than a bunch of + little ones. *) + +open Llvm +open Llvm_bitwriter + + +(* Tiny unit test framework *) +let exit_status = ref 0 +let case_num = ref 0 + +let all_done () = + prerr_endline ""; + exit !exit_status + +let group name = + prerr_endline ""; + case_num := 0; + prerr_string (" " ^ name ^ "... ") + +let insist cond = + incr case_num; + prerr_char ' '; + if not cond then begin + exit_status := 10; + prerr_char '!' + end; + prerr_int !case_num + +let suite name f = + prerr_endline (name ^ ":"); + f () + + +(*===-- Fixture -----------------------------------------------------------===*) + +let filename = Sys.argv.(1) +let m = create_module filename + + +(*===-- Types -------------------------------------------------------------===*) + +let test_types () = + (* RUN: grep {Ty01.*void} < %t.ll + *) + group "void"; + insist (add_type_name "Ty01" void_type m); + insist (Void_type == classify_type void_type); + + (* RUN: grep {Ty02.*i1} < %t.ll + *) + group "i1"; + insist (add_type_name "Ty02" i1_type m); + insist (Integer_type == classify_type i1_type); + + (* RUN: grep {Ty03.*i32} < %t.ll + *) + group "i32"; + insist (add_type_name "Ty03" i32_type m); + + (* RUN: grep {Ty04.*i42} < %t.ll + *) + group "i42"; + let ty = make_integer_type 42 in + insist (add_type_name "Ty04" ty m); + + (* RUN: grep {Ty05.*float} < %t.ll + *) + group "float"; + insist (add_type_name "Ty05" float_type m); + insist (Float_type == classify_type float_type); + + (* RUN: grep {Ty06.*double} < %t.ll + *) + group "double"; + insist (add_type_name "Ty06" double_type m); + insist (Double_type == classify_type double_type); + + (* RUN: grep {Ty07.*i32.*i1, double} < %t.ll + *) + group "function"; + let ty = make_function_type i32_type [| i1_type; double_type |] false in + insist (add_type_name "Ty07" ty m); + insist (Function_type = classify_type ty); + insist (not (is_var_arg ty)); + insist (i32_type == return_type ty); + insist (double_type == (param_types ty).(1)); + + (* RUN: grep {Ty08.*\.\.\.} < %t.ll + *) + group "vararg"; + let ty = make_function_type void_type [| i32_type |] true in + insist (add_type_name "Ty08" ty m); + insist (is_var_arg ty); + + (* RUN: grep {Ty09.*\\\[7 x i8\\\]} < %t.ll + *) + group "array"; + let ty = make_array_type i8_type 7 in + insist (add_type_name "Ty09" ty m); + insist (7 = array_length ty); + insist (i8_type == element_type ty); + insist (Array_type == classify_type ty); + + (* RUN: grep {Ty10.*float\*} < %t.ll + *) + group "pointer"; + let ty = make_pointer_type float_type in + insist (add_type_name "Ty10" ty m); + insist (float_type == element_type ty); + insist (Pointer_type == classify_type ty); + + (* RUN: grep {Ty11.*\<4 x i16\>} < %t.ll + *) + group "vector"; + let ty = make_vector_type i16_type 4 in + insist (add_type_name "Ty11" ty m); + insist (i16_type == element_type ty); + insist (4 = vector_size ty); + + (* RUN: grep {Ty12.*opaque} < %t.ll + *) + group "opaque"; + let ty = make_opaque_type () in + insist (add_type_name "Ty12" ty m); + insist (ty == ty); + insist (ty <> make_opaque_type ()) + + +(*===-- Global Values -----------------------------------------------------===*) + +let test_global_values () = + let (++) x f = f x; x in + let zero32 = make_null i32_type in + + (* RUN: grep {GVal01} < %t.ll + *) + group "naming"; + let g = define_global "TEMPORARY" zero32 m in + prerr_endline ""; + prerr_endline (value_name g); + insist ("TEMPORARY" = value_name g); + set_value_name "GVal01" g; + insist ("GVal01" = value_name g); + + (* RUN: grep {GVal02.*linkonce} < %t.ll + *) + group "linkage"; + let g = define_global "GVal02" zero32 m ++ + set_linkage Link_once_linkage in + insist (Link_once_linkage = linkage g); + + (* RUN: grep {GVal03.*Hanalei} < %t.ll + *) + group "section"; + let g = define_global "GVal03" zero32 m ++ + set_section "Hanalei" in + insist ("Hanalei" = section g); + + (* RUN: grep {GVal04.*hidden} < %t.ll + *) + group "visibility"; + let g = define_global "GVal04" zero32 m ++ + set_visibility Hidden_visibility in + insist (Hidden_visibility = visibility g); + + (* RUN: grep {GVal05.*align 128} < %t.ll + *) + group "alignment"; + let g = define_global "GVal05" zero32 m ++ + set_alignment 128 in + insist (128 = alignment g) + + +(*===-- Global Variables --------------------------------------------------===*) + +let test_global_variables () = + let (++) x f = f x; x in + let fourty_two32 = make_int_constant i32_type 42 false in + + (* RUN: grep {GVar01.*external} < %t.ll + *) + group "declarations"; + let g = declare_global i32_type "GVar01" m in + insist (is_declaration g); + + (* RUN: grep {GVar02.*42} < %t.ll + * RUN: grep {GVar03.*42} < %t.ll + *) + group "definitions"; + let g = define_global "GVar02" fourty_two32 m in + let g2 = declare_global i32_type "GVar03" m ++ + set_initializer fourty_two32 in + insist (not (is_declaration g)); + insist (not (is_declaration g2)); + insist ((global_initializer g) == (global_initializer g2)); + + (* RUN: grep {GVar04.*thread_local} < %t.ll + *) + group "threadlocal"; + let g = define_global "GVar04" fourty_two32 m ++ + set_thread_local true in + insist (is_thread_local g); + + (* RUN: grep -v {GVar05} < %t.ll + *) + let g = define_global "GVar05" fourty_two32 m in + delete_global g + + +(*===-- Writer ------------------------------------------------------------===*) + +let test_writer () = + group "writer"; + insist (write_bitcode_file m filename); + + dispose_module m + + +(*===-- Driver ------------------------------------------------------------===*) + +let _ = + suite "types" test_types; + suite "global values" test_global_values; + suite "global variables" test_global_variables; + suite "writer" test_writer; + all_done () Modified: llvm/trunk/test/lib/llvm.exp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lib/llvm.exp?rev=42093&r1=42092&r2=42093&view=diff ============================================================================== --- llvm/trunk/test/lib/llvm.exp (original) +++ llvm/trunk/test/lib/llvm.exp Tue Sep 18 07:49:39 2007 @@ -43,7 +43,7 @@ # cases. proc substitute { line test tmpFile } { global srcroot objroot srcdir objdir subdir target_triplet prcontext - global llvmgcc llvmgxx llvmgcc_version llvmgccmajvers + global llvmgcc llvmgxx llvmgcc_version llvmgccmajvers ocamlc global gccpath gxxpath compile_c compile_cxx link shlibext llvmlibsdir set path [file join $srcdir $subdir] @@ -64,6 +64,8 @@ regsub -all {%link} $new_line "$link" new_line #replace %shlibext with shared library extension regsub -all {%shlibext} $new_line "$shlibext" new_line + #replace %ocamlc with ocaml compiler command + regsub -all {%ocamlc} $new_line "$ocamlc" new_line #replace %llvmlibsdir with configure library directory regsub -all {%llvmlibsdir} $new_line "$llvmlibsdir" new_line #replace %p with path to source, From gordonhenriksen at mac.com Tue Sep 18 08:54:49 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 09:54:49 -0400 Subject: [llvm-commits] [llvm] r42051 - in /llvm/trunk: lib/VMCore/Verifier.cpp test/CodeGen/Generic/GC/lower_gcroot.ll test/Verifier/gcread-ptrptr.ll test/Verifier/gcroot-alloca.ll test/Verifier/gcroot-meta.ll test/Verifier/gcroot-ptrptr.ll test/Verifier/gcwrite-ptrptr.ll In-Reply-To: <200709181344.04203.baldrick@free.fr> References: <200709172030.l8HKU4QG008512@zion.cs.uiuc.edu> <200709181049.21273.baldrick@free.fr> <7E45917A-52D7-4AC4-8882-B0B6E3F9FCA5@mac.com> <200709181344.04203.baldrick@free.fr> Message-ID: On Sep 18, 2007, at 07:44, Duncan Sands wrote: > Hi, > >>>> +static Value *StripBitCasts(Value *Val) { >>> >>> how about using IntrinsicInst::StripPointerCasts instead? >> >> Done. Note that, although there's tantalizing GEP-0 handling in >> StripPointerCasts, it's still not really possible to use gcroot >> without bitcasts: > > the reason for the GEP handling, is that if you have a constant > pointer P to a struct S for which the first field is of type T, and > you constant bitcast P to a T*, then the optimizers will turn this > into a GEP-0 instead of a bitcast. Thus it is unwise to assume > you'll always see a bitcast - it might be that you get passed a GEP > instead. This can never occur. This is a pointer to a pointer type, so gep 0 can't be used for casts. >> %x_addr = alloca %class.Derived* >> %tmp0 = getelementptr %x_addr, i32 0, i32 0 ; Invalid! But nice >> try... > > If x_addr pointed to a global variable rather than a local > variable, this (or something like it) should be valid. Just to be > clear: I'm not suggesting that you can get rid of bitcasts - I'm > pointing out that in obscure circumstances you may be passed a GEP > rather than a bitcast, even if you always generate bitcasts in the > front-end. So you need to handle that, eg by using StripPointerCasts. Since gcroot is an annotation of a pointer alloca, this is not applicable. Although gep %alloca, 0 is now accepted, it is also necessarily redundant, and gep %alloca, 0, 0 is invalid by the definition. Thanks, Gordon From djg at cray.com Tue Sep 18 09:02:12 2007 From: djg at cray.com (Dan Gohman) Date: Tue, 18 Sep 2007 09:02:12 -0500 Subject: [llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll Message-ID: <20070918140212.GI10864@village.us.cray.com> > + // If GEP base is NULL then the calculated address used by Store or > + // Load instruction is invalid. Do not promote this value because > + // it may expose load and store instruction that are covered by > + // condition which may not yet folded. > + if (GetElementPtrInst *GEP = dyn_cast(V)) > + if (isa(GEP->getOperand(0))) > + PointerOk = false; > + It looks like there's a larger problem here. The testcase's loop body may never be executed, so it isn't safe for LICM to hoist/sink anything out to an unguarded location, null pointer constants or otherwise. Dan -- Dan Gohman, Cray Inc. From djg at cray.com Tue Sep 18 09:59:15 2007 From: djg at cray.com (Dan Gohman) Date: Tue, 18 Sep 2007 14:59:15 -0000 Subject: [llvm-commits] [llvm] r42094 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200709181459.l8IExFpO015513@zion.cs.uiuc.edu> Author: djg Date: Tue Sep 18 09:59:14 2007 New Revision: 42094 URL: http://llvm.org/viewvc/llvm-project?rev=42094&view=rev Log: Move the entries for 64-bit CMP, IMUL, and a few others into the correct tables so that they are eligible for reload/remat folding. And add entries for JMP and CALL. 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=42094&r1=42093&r2=42094&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Tue Sep 18 09:59:14 2007 @@ -629,10 +629,14 @@ } static const TableEntry OpcodeTable[] = { + { X86::CALL32r, X86::CALL32m }, + { X86::CALL64r, X86::CALL64m }, { X86::CMP16ri, X86::CMP16mi }, { X86::CMP16ri8, X86::CMP16mi8 }, { X86::CMP32ri, X86::CMP32mi }, { X86::CMP32ri8, X86::CMP32mi8 }, + { X86::CMP64ri32, X86::CMP64mi32 }, + { X86::CMP64ri8, X86::CMP64mi8 }, { X86::CMP8ri, X86::CMP8mi }, { X86::DIV16r, X86::DIV16m }, { X86::DIV32r, X86::DIV32m }, @@ -648,6 +652,8 @@ { X86::IMUL32r, X86::IMUL32m }, { X86::IMUL64r, X86::IMUL64m }, { X86::IMUL8r, X86::IMUL8m }, + { X86::JMP32r, X86::JMP32m }, + { X86::JMP64r, X86::JMP64m }, { X86::MOV16ri, X86::MOV16mi }, { X86::MOV16rr, X86::MOV16mr }, { X86::MOV32ri, X86::MOV32mi }, @@ -671,6 +677,9 @@ { X86::MUL32r, X86::MUL32m }, { X86::MUL64r, X86::MUL64m }, { X86::MUL8r, X86::MUL8m }, + { X86::PSHUFDri, X86::PSHUFDmi }, + { X86::PSHUFHWri, X86::PSHUFHWmi }, + { X86::PSHUFLWri, X86::PSHUFLWmi }, { X86::SETAEr, X86::SETAEm }, { X86::SETAr, X86::SETAm }, { X86::SETBEr, X86::SETBEm }, @@ -685,6 +694,7 @@ { X86::SETNSr, X86::SETNSm }, { X86::SETPr, X86::SETPm }, { X86::SETSr, X86::SETSm }, + { X86::TAILJMPr, X86::TAILJMPm }, { X86::TEST16ri, X86::TEST16mi }, { X86::TEST32ri, X86::TEST32mi }, { X86::TEST64ri32, X86::TEST64mi32 }, @@ -702,8 +712,6 @@ static const TableEntry OpcodeTable[] = { { X86::CMP16rr, X86::CMP16rm }, { X86::CMP32rr, X86::CMP32rm }, - { X86::CMP64ri32, X86::CMP64mi32 }, - { X86::CMP64ri8, X86::CMP64mi8 }, { X86::CMP64rr, X86::CMP64rm }, { X86::CMP8rr, X86::CMP8rm }, { X86::CMPPDrri, X86::CMPPDrmi }, @@ -726,7 +734,6 @@ { X86::IMUL16rri8, X86::IMUL16rmi8 }, { X86::IMUL32rri, X86::IMUL32rmi }, { X86::IMUL32rri8, X86::IMUL32rmi8 }, - { X86::IMUL64rr, X86::IMUL64rm }, { X86::IMUL64rri32, X86::IMUL64rmi32 }, { X86::IMUL64rri8, X86::IMUL64rmi8 }, { X86::Int_CMPSDrr, X86::Int_CMPSDrm }, @@ -787,9 +794,6 @@ { X86::MOVZX32rr8, X86::MOVZX32rm8 }, { X86::MOVZX64rr16, X86::MOVZX64rm16 }, { X86::MOVZX64rr8, X86::MOVZX64rm8 }, - { X86::PSHUFDri, X86::PSHUFDmi }, - { X86::PSHUFHWri, X86::PSHUFHWmi }, - { X86::PSHUFLWri, X86::PSHUFLWmi }, { X86::PsMOVZX64rr32, X86::PsMOVZX64rm32 }, { X86::TEST16rr, X86::TEST16rm }, { X86::TEST32rr, X86::TEST32rm }, @@ -881,6 +885,7 @@ { X86::HSUBPSrr, X86::HSUBPSrm }, { X86::IMUL16rr, X86::IMUL16rm }, { X86::IMUL32rr, X86::IMUL32rm }, + { X86::IMUL64rr, X86::IMUL64rm }, { X86::MAXPDrr, X86::MAXPDrm }, { X86::MAXPDrr_Int, X86::MAXPDrm_Int }, { X86::MAXPSrr, X86::MAXPSrm }, From dalej at apple.com Tue Sep 18 12:33:57 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 18 Sep 2007 17:33:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42095 - /llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Message-ID: <200709181733.l8IHXvBg020815@zion.cs.uiuc.edu> Author: johannes Date: Tue Sep 18 12:33:56 2007 New Revision: 42095 URL: http://llvm.org/viewvc/llvm-project?rev=42095&view=rev Log: Enhance assertion to allow x86 long double. 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=42095&r1=42094&r2=42095&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Tue Sep 18 12:33:56 2007 @@ -73,8 +73,13 @@ // Note down LLVM type for GCC tree node. static const Type * llvm_set_type(tree Tr, const Type *Ty) { - assert(!TYPE_SIZE(Tr) || !Ty->isSized() || !isInt64(TYPE_SIZE(Tr), true) || - getInt64(TYPE_SIZE(Tr), true) == getTargetData().getTypeSizeInBits(Ty) + // For x86 long double, llvm records the size of the data (80) while + // gcc's TYPE_SIZE including alignment padding. Compensate. + assert((!TYPE_SIZE(Tr) || !Ty->isSized() || !isInt64(TYPE_SIZE(Tr), true) || + getInt64(TYPE_SIZE(Tr), true) == getTargetData().getTypeSizeInBits(Ty) || + (getTargetData().getTypeSizeInBits(Ty) == 80 && + (getInt64(TYPE_SIZE(Tr), true) == 96 || + getInt64(TYPE_SIZE(Tr), true) == 128))) && "LLVM type size doesn't match GCC type size!"); unsigned &TypeSlot = LTypesMap[Ty]; From dalej at apple.com Tue Sep 18 12:34:30 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 18 Sep 2007 17:34:30 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42096 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200709181734.l8IHYVw6020867@zion.cs.uiuc.edu> Author: johannes Date: Tue Sep 18 12:34:30 2007 New Revision: 42096 URL: http://llvm.org/viewvc/llvm-project?rev=42096&view=rev Log: Enhance assertion to permit x86 long double. 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=42096&r1=42095&r2=42096&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Tue Sep 18 12:34:30 2007 @@ -73,8 +73,13 @@ // Note down LLVM type for GCC tree node. static const Type * llvm_set_type(tree Tr, const Type *Ty) { - assert(!TYPE_SIZE(Tr) || !Ty->isSized() || !isInt64(TYPE_SIZE(Tr), true) || - getInt64(TYPE_SIZE(Tr), true) == getTargetData().getTypeSizeInBits(Ty) + // For x86 long double, llvm records the size of the data (80) while + // gcc's TYPE_SIZE including alignment padding. Compensate. + assert((!TYPE_SIZE(Tr) || !Ty->isSized() || !isInt64(TYPE_SIZE(Tr), true) || + getInt64(TYPE_SIZE(Tr), true) == getTargetData().getTypeSizeInBits(Ty) || + (getTargetData().getTypeSizeInBits(Ty) == 80 && + (getInt64(TYPE_SIZE(Tr), true) == 96 || + getInt64(TYPE_SIZE(Tr), true) == 128))) && "LLVM type size doesn't match GCC type size!"); unsigned &TypeSlot = LTypesMap[Ty]; From dpatel at apple.com Tue Sep 18 12:42:54 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 18 Sep 2007 10:42:54 -0700 Subject: [llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll In-Reply-To: <20070918140212.GI10864@village.us.cray.com> References: <20070918140212.GI10864@village.us.cray.com> Message-ID: On Sep 18, 2007, at 7:02 AM, Dan Gohman wrote: >> + // If GEP base is NULL then the calculated address used by >> Store or >> + // Load instruction is invalid. Do not promote this value >> because >> + // it may expose load and store instruction that are covered >> by >> + // condition which may not yet folded. >> + if (GetElementPtrInst *GEP = dyn_cast(V)) >> + if (isa(GEP->getOperand(0))) >> + PointerOk = false; >> + > > It looks like there's a larger problem here. The testcase's loop body > may never be executed, so it isn't safe for LICM to hoist/sink > anything out to an unguarded location, null pointer constants or > otherwise. We intend to split LICM into three passes - sink, hoist and promote- values. Irrespective of sinking and hoisting, promote-values should not promote values that are unsafe. Avoiding hoisting GEP here will solve this test case, but promote-values bug will be exposed when it is supplied manually hoisted GEP. promote-values is not in business to identify dead loops. And when loop conditionals are runtime dependent it is not possible to determine it at compile time at all. The fix is to check unsafe stores and loads before promoting value. - Devang From dalej at apple.com Tue Sep 18 12:50:34 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 18 Sep 2007 17:50:34 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42097 - /llvm-gcc-4.0/trunk/gcc/config/i386/i386.h Message-ID: <200709181750.l8IHoYSx021721@zion.cs.uiuc.edu> Author: johannes Date: Tue Sep 18 12:50:34 2007 New Revision: 42097 URL: http://llvm.org/viewvc/llvm-project?rev=42097&view=rev Log: Make long doubles 80 bits on x86. This changes the ABI. Modified: llvm-gcc-4.0/trunk/gcc/config/i386/i386.h Modified: llvm-gcc-4.0/trunk/gcc/config/i386/i386.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/i386.h?rev=42097&r1=42096&r2=42097&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/i386/i386.h (original) +++ llvm-gcc-4.0/trunk/gcc/config/i386/i386.h Tue Sep 18 12:50:34 2007 @@ -808,13 +808,7 @@ /* target machine storage layout */ -/* APPLE LOCAL begin LLVM */ -#if defined(ENABLE_LLVM) || defined(__llvm__) -#define LONG_DOUBLE_TYPE_SIZE 64 -#else #define LONG_DOUBLE_TYPE_SIZE 80 -#endif -/* APPLE LOCAL end LLVM */ /* Set the value of FLT_EVAL_METHOD in float.h. When using only the FPU, assume that the fpcw is set to extended precision; when using From dalej at apple.com Tue Sep 18 13:07:38 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 18 Sep 2007 18:07:38 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42100 - /llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Message-ID: <200709181807.l8II7cVc022554@zion.cs.uiuc.edu> Author: johannes Date: Tue Sep 18 13:07:38 2007 New Revision: 42100 URL: http://llvm.org/viewvc/llvm-project?rev=42100&view=rev Log: Make long double 80 bits on x86. This changes the ABI. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Modified: llvm-gcc-4.2/trunk/gcc/config/i386/i386.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/i386.h?rev=42100&r1=42099&r2=42100&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/i386.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/i386.h Tue Sep 18 13:07:38 2007 @@ -565,14 +565,6 @@ /* target machine storage layout */ -/* LLVM LOCAL begin */ -#if defined(ENABLE_LLVM) || defined(__llvm__) -#define LONG_DOUBLE_TYPE_SIZE 64 -#else -#define LONG_DOUBLE_TYPE_SIZE 80 -#endif -/* LLVM LOCAL end */ - /* Set the value of FLT_EVAL_METHOD in float.h. When using only the FPU, assume that the fpcw is set to extended precision; when using only SSE, rounding is correct; when using both SSE and the FPU, From gordonhenriksen at mac.com Tue Sep 18 13:07:52 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 18 Sep 2007 18:07:52 -0000 Subject: [llvm-commits] [llvm] r42101 - in /llvm/trunk: bindings/ocaml/llvm/llvm.ml bindings/ocaml/llvm/llvm.mli bindings/ocaml/llvm/llvm_ocaml.c include/llvm-c/Core.h lib/VMCore/Core.cpp test/Bindings/Ocaml/vmcore.ml Message-ID: <200709181807.l8II7qKe022583@zion.cs.uiuc.edu> Author: gordon Date: Tue Sep 18 13:07:51 2007 New Revision: 42101 URL: http://llvm.org/viewvc/llvm-project?rev=42101&view=rev Log: Tests of the ocaml (and thus C) bindings for constants. Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml llvm/trunk/bindings/ocaml/llvm/llvm.mli llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c llvm/trunk/include/llvm-c/Core.h llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/test/Bindings/Ocaml/vmcore.ml Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.ml?rev=42101&r1=42100&r2=42101&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm.ml (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm.ml Tue Sep 18 13:07:51 2007 @@ -141,14 +141,18 @@ external set_value_name : string -> llvalue -> unit = "llvm_set_value_name" (*--... Operations on constants of (mostly) any type .......................--*) +external is_constant : llvalue -> bool = "llvm_is_constant" external make_null : lltype -> llvalue = "llvm_make_null" -external make_all_ones : lltype -> llvalue = "llvm_make_all_ones" +external make_all_ones : (*int|vec*)lltype -> llvalue = "llvm_make_all_ones" external make_undef : lltype -> llvalue = "llvm_make_undef" external is_null : llvalue -> bool = "llvm_is_null" +external is_undef : llvalue -> bool = "llvm_is_undef" (*--... Operations on scalar constants .....................................--*) external make_int_constant : lltype -> int -> bool -> llvalue = "llvm_make_int_constant" +external make_int64_constant : lltype -> Int64.t -> bool -> llvalue + = "llvm_make_int64_constant" external make_real_constant : lltype -> float -> llvalue = "llvm_make_real_constant" Modified: llvm/trunk/bindings/ocaml/llvm/llvm.mli URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.mli?rev=42101&r1=42100&r2=42101&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm.mli (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Tue Sep 18 13:07:51 2007 @@ -124,14 +124,18 @@ external set_value_name : string -> llvalue -> unit = "llvm_set_value_name" (*--... Operations on constants of (mostly) any type .......................--*) +external is_constant : llvalue -> bool = "llvm_is_constant" external make_null : lltype -> llvalue = "llvm_make_null" -external make_all_ones : lltype -> llvalue = "llvm_make_all_ones" +external make_all_ones : (*int|vec*)lltype -> llvalue = "llvm_make_all_ones" external make_undef : lltype -> llvalue = "llvm_make_undef" external is_null : llvalue -> bool = "llvm_is_null" +external is_undef : llvalue -> bool = "llvm_is_undef" (*--... Operations on scalar constants .....................................--*) external make_int_constant : lltype -> int -> bool -> llvalue = "llvm_make_int_constant" +external make_int64_constant : lltype -> Int64.t -> bool -> llvalue + = "llvm_make_int64_constant" external make_real_constant : lltype -> float -> llvalue = "llvm_make_real_constant" Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=42101&r1=42100&r2=42101&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Tue Sep 18 13:07:51 2007 @@ -248,10 +248,20 @@ } /* llvalue -> bool */ +CAMLprim value llvm_is_constant(value Ty) { + return Val_bool(LLVMIsConstant((LLVMValueRef) Ty)); +} + +/* llvalue -> bool */ CAMLprim value llvm_is_null(value Val) { return Val_bool(LLVMIsNull((LLVMValueRef) Val)); } +/* llvalue -> bool */ +CAMLprim value llvm_is_undef(value Ty) { + return Val_bool(LLVMIsUndef((LLVMValueRef) Ty)); +} + /*--... Operations on scalar constants .....................................--*/ /* lltype -> int -> bool -> llvalue */ @@ -266,6 +276,12 @@ return (value) LLVMGetIntConstant((LLVMTypeRef) IntTy, N2, Bool_val(SExt)); } +/* lltype -> Int64.t -> bool -> llvalue */ +CAMLprim value llvm_make_int64_constant(value IntTy, value N, value SExt) { + return (value) LLVMGetIntConstant((LLVMTypeRef) IntTy, Int64_val(N), + Bool_val(SExt)); +} + /* lltype -> float -> llvalue */ CAMLprim value llvm_make_real_constant(value RealTy, value N) { return (value) LLVMGetRealConstant((LLVMTypeRef) RealTy, Double_val(N)); @@ -276,7 +292,7 @@ /* string -> bool -> llvalue */ CAMLprim value llvm_make_string_constant(value Str, value NullTerminate) { return (value) LLVMGetStringConstant(String_val(Str), - Wosize_val(Str), + caml_string_length(Str), Bool_val(NullTerminate) == 0); } Modified: llvm/trunk/include/llvm-c/Core.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=42101&r1=42100&r2=42101&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/Core.h (original) +++ llvm/trunk/include/llvm-c/Core.h Tue Sep 18 13:07:51 2007 @@ -176,7 +176,9 @@ LLVMValueRef LLVMGetNull(LLVMTypeRef Ty); /* all zeroes */ LLVMValueRef LLVMGetAllOnes(LLVMTypeRef Ty); /* only for int/vector */ LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty); +int LLVMIsConstant(LLVMValueRef Val); int LLVMIsNull(LLVMValueRef Val); +int LLVMIsUndef(LLVMValueRef Val); /* Operations on scalar constants */ LLVMValueRef LLVMGetIntConstant(LLVMTypeRef IntTy, unsigned long long N, Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=42101&r1=42100&r2=42101&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Tue Sep 18 13:07:51 2007 @@ -201,12 +201,20 @@ return wrap(UndefValue::get(unwrap(Ty))); } +int LLVMIsConstant(LLVMValueRef Ty) { + return isa(unwrap(Ty)); +} + int LLVMIsNull(LLVMValueRef Val) { if (Constant *C = dyn_cast(unwrap(Val))) return C->isNullValue(); return false; } +int LLVMIsUndef(LLVMValueRef Val) { + return isa(unwrap(Val)); +} + /*--.. Operations on scalar constants ......................................--*/ LLVMValueRef LLVMGetIntConstant(LLVMTypeRef IntTy, unsigned long long N, Modified: llvm/trunk/test/Bindings/Ocaml/vmcore.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/vmcore.ml?rev=42101&r1=42100&r2=42101&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/vmcore.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/vmcore.ml Tue Sep 18 13:07:51 2007 @@ -11,27 +11,21 @@ open Llvm_bitwriter -(* Tiny unit test framework *) +(* Tiny unit test framework - really just to help find which line is busted *) let exit_status = ref 0 let case_num = ref 0 -let all_done () = - prerr_endline ""; - exit !exit_status - let group name = - prerr_endline ""; case_num := 0; - prerr_string (" " ^ name ^ "... ") + prerr_endline (" " ^ name ^ "...") let insist cond = incr case_num; - prerr_char ' '; - if not cond then begin - exit_status := 10; - prerr_char '!' - end; - prerr_int !case_num + let msg = if cond then " pass " else begin + exit_status := 10; + " FAIL " + end in + prerr_endline (msg ^ (string_of_int !case_num)) let suite name f = prerr_endline (name ^ ":"); @@ -133,6 +127,102 @@ insist (ty <> make_opaque_type ()) +(*===-- Constants ---------------------------------------------------------===*) + +let test_constants () = + (* RUN: grep {Const01.*i32.*-1} < %t.ll + *) + group "int"; + let c = make_int_constant i32_type (-1) true in + ignore (define_global "Const01" c m); + insist (i32_type = type_of c); + insist (is_constant c); + + (* RUN: grep {Const02.*i64.*-1} < %t.ll + *) + group "sext int"; + let c = make_int_constant i64_type (-1) true in + ignore (define_global "Const02" c m); + insist (i64_type = type_of c); + + (* RUN: grep {Const03.*i64.*4294967295} < %t.ll + *) + group "zext int64"; + let c = make_int64_constant i64_type (Int64.of_string "4294967295") false in + ignore (define_global "Const03" c m); + insist (i64_type = type_of c); + + (* RUN: grep {Const04.*"cruel\\\\00world"} < %t.ll + *) + group "string"; + let c = make_string_constant "cruel\x00world" false in + ignore (define_global "Const04" c m); + insist ((make_array_type i8_type 11) = type_of c); + + (* RUN: grep {Const05.*"hi\\\\00again\\\\00"} < %t.ll + *) + group "string w/ null"; + let c = make_string_constant "hi\x00again" true in + ignore (define_global "Const05" c m); + insist ((make_array_type i8_type 9) = type_of c); + + (* RUN: grep {Const06.*3.1459} < %t.ll + *) + group "real"; + let c = make_real_constant double_type 3.1459 in + ignore (define_global "Const06" c m); + insist (double_type = type_of c); + + let one = make_int_constant i16_type 1 true in + let two = make_int_constant i16_type 2 true in + let three = make_int_constant i32_type 3 true in + let four = make_int_constant i32_type 4 true in + + (* RUN: grep {Const07.*\\\[ i32 3, i32 4 \\\]} < %t.ll + *) + group "array"; + let c = make_array_constant i32_type [| three; four |] in + ignore (define_global "Const07" c m); + insist ((make_array_type i32_type 2) = (type_of c)); + + (* RUN: grep {Const08.*< i16 1, i16 2.* >} < %t.ll + *) + group "vector"; + let c = make_vector_constant [| one; two; one; two; + one; two; one; two |] in + ignore (define_global "Const08" c m); + insist ((make_vector_type i16_type 8) = (type_of c)); + + (* RUN: grep {Const09.*\{ i16, i16, i32, i32 \} \{} < %t.ll + *) + group "structure"; + let c = make_struct_constant [| one; two; three; four |] false in + ignore (define_global "Const09" c m); + insist ((make_struct_type [| i16_type; i16_type; i32_type; i32_type |] false) + = (type_of c)); + + (* RUN: grep {Const10.*zeroinit} < %t.ll + *) + group "null"; + let c = make_null (make_struct_type [| i1_type; i8_type; + i64_type; double_type |] true) in + ignore (define_global "Const10" c m); + + (* RUN: grep {Const11.*-1} < %t.ll + *) + group "all ones"; + let c = make_all_ones i64_type in + ignore (define_global "Const11" c m); + + (* RUN: grep {Const12.*undef} < %t.ll + *) + group "undef"; + let c = make_undef i1_type in + ignore (define_global "Const12" c m); + insist (i1_type = type_of c); + insist (is_undef c) + + (*===-- Global Values -----------------------------------------------------===*) let test_global_values () = @@ -143,8 +233,6 @@ *) group "naming"; let g = define_global "TEMPORARY" zero32 m in - prerr_endline ""; - prerr_endline (value_name g); insist ("TEMPORARY" = value_name g); set_value_name "GVal01" g; insist ("GVal01" = value_name g); @@ -210,6 +298,7 @@ (* RUN: grep -v {GVar05} < %t.ll *) + group "delete"; let g = define_global "GVar05" fourty_two32 m in delete_global g @@ -227,7 +316,8 @@ let _ = suite "types" test_types; + suite "constants" test_constants; suite "global values" test_global_values; suite "global variables" test_global_variables; suite "writer" test_writer; - all_done () + exit !exit_status From dalej at apple.com Tue Sep 18 13:37:00 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 18 Sep 2007 18:37:00 -0000 Subject: [llvm-commits] [llvm] r42103 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200709181837.l8IIb0DD023859@zion.cs.uiuc.edu> Author: johannes Date: Tue Sep 18 13:36:59 2007 New Revision: 42103 URL: http://llvm.org/viewvc/llvm-project?rev=42103&view=rev Log: Prevent crash on long double. 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=42103&r1=42102&r2=42103&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 18 13:36:59 2007 @@ -3798,6 +3798,10 @@ SDOperand Tmp; switch (CFP->getValueType(0)) { default: assert(0 && "Unknown FP type"); + case MVT::f80: // We don't do this for these yet. + case MVT::f128: + case MVT::ppcf128: + break; case MVT::f32: if (!AfterLegalize || TLI.isTypeLegal(MVT::i32)) { Tmp = DAG.getConstant((uint32_t)CFP->getValueAPF(). From djg at cray.com Tue Sep 18 15:51:15 2007 From: djg at cray.com (Dan Gohman) Date: Tue, 18 Sep 2007 15:51:15 -0500 Subject: [llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll Message-ID: <20070918205115.GS10864@village.us.cray.com> > We intend to split LICM into three passes - sink, hoist and promote- > values. Irrespective of sinking and hoisting, promote-values should > not promote values that are unsafe. Avoiding hoisting GEP here will > solve this test case, but promote-values bug will be exposed when it > is supplied manually hoisted GEP. > > promote-values is not in business to identify dead loops. And when > loop conditionals are runtime dependent it is not possible to > determine it at compile time at all. The fix is to check unsafe stores > and loads before promoting value. I don't quite follow. For example of what I'm saying, take this testcase, which is only slightly different than the earlier one: define i32 @foo(%struct.decision* %p) { entry: br label %blah.i blah.i: ; preds = %cond_true.i, %entry %tmp3.i = icmp eq %struct.decision* null, null ; [#uses=1] br i1 %tmp3.i, label %clear_modes.exit, label %cond_true.i cond_true.i: ; preds = %blah.i %tmp1.i = getelementptr %struct.decision* %p, i32 0, i32 0 ; [#uses=1] store i8 0, i8* %tmp1.i br label %blah.i clear_modes.exit: ; preds = %blah.i call void @exit( i32 0 ) unreachable } declare void @exit(i32) Even with the latest changes, LICM puts a load of %tmp1.i in the entry block, which isn't safe. Dan -- Dan Gohman, Cray Inc. From clattner at apple.com Tue Sep 18 15:57:04 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 18 Sep 2007 13:57:04 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r42097 - /llvm-gcc-4.0/trunk/gcc/config/i386/i386.h In-Reply-To: <200709181750.l8IHoYSx021721@zion.cs.uiuc.edu> References: <200709181750.l8IHoYSx021721@zion.cs.uiuc.edu> Message-ID: <207C0759-1C5B-44C1-9F1D-B2A64EFBFD62@apple.com> On Sep 18, 2007, at 10:50 AM, Dale Johannesen wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=42097&view=rev > Log: > Make long doubles 80 bits on x86. > This changes the ABI. > Yay! -Chris From ggreif at gmail.com Tue Sep 18 16:42:39 2007 From: ggreif at gmail.com (Gabor Greif) Date: Tue, 18 Sep 2007 21:42:39 -0000 Subject: [llvm-commits] [llvm] r42108 - in /llvm/trunk/test/Transforms/LICM: 2007-09-17-PromoteValue.ll 2007-09-17-PrompteValue.ll Message-ID: <200709182142.l8ILgdpE001356@zion.cs.uiuc.edu> Author: ggreif Date: Tue Sep 18 16:42:39 2007 New Revision: 42108 URL: http://llvm.org/viewvc/llvm-project?rev=42108&view=rev Log: rename test, it is obviously misspelled Added: llvm/trunk/test/Transforms/LICM/2007-09-17-PromoteValue.ll - copied unchanged from r42107, llvm/trunk/test/Transforms/LICM/2007-09-17-PrompteValue.ll Removed: llvm/trunk/test/Transforms/LICM/2007-09-17-PrompteValue.ll Removed: llvm/trunk/test/Transforms/LICM/2007-09-17-PrompteValue.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/2007-09-17-PrompteValue.ll?rev=42107&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LICM/2007-09-17-PrompteValue.ll (original) +++ llvm/trunk/test/Transforms/LICM/2007-09-17-PrompteValue.ll (removed) @@ -1,26 +0,0 @@ -; ModuleID = 'PR1657.bc' -; Do not promote getelementptr because it may exposes load from a null pointer -; and store from a null pointer which are covered by -; icmp eq %struct.decision* null, null condition. -; RUN: llvm-as < %s | opt -licm | llvm-dis | not grep promoted - %struct.decision = type { i8, %struct.decision* } - -define i32 @main() { -entry: - br label %blah.i - -blah.i: ; preds = %cond_true.i, %entry - %tmp3.i = icmp eq %struct.decision* null, null ; [#uses=1] - br i1 %tmp3.i, label %clear_modes.exit, label %cond_true.i - -cond_true.i: ; preds = %blah.i - %tmp1.i = getelementptr %struct.decision* null, i32 0, i32 0 ; [#uses=1] - store i8 0, i8* %tmp1.i - br label %blah.i - -clear_modes.exit: ; preds = %blah.i - call void @exit( i32 0 ) - unreachable -} - -declare void @exit(i32) From evan.cheng at apple.com Tue Sep 18 16:54:37 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 18 Sep 2007 21:54:37 -0000 Subject: [llvm-commits] [llvm] r42111 - in /llvm/trunk: lib/CodeGen/SelectionDAG/DAGCombiner.cpp test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll Message-ID: <200709182154.l8ILsbBC002147@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 18 16:54:37 2007 New Revision: 42111 URL: http://llvm.org/viewvc/llvm-project?rev=42111&view=rev Log: Fix a bogus splat xform: shuffle , , <2, 2, 2, 2> != Added: llvm/trunk/test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll 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=42111&r1=42110&r2=42111&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 18 16:54:37 2007 @@ -4093,8 +4093,7 @@ if (!Base.Val) return N0; for (unsigned i = 0; i != NumElems; ++i) { - if (V->getOperand(i).getOpcode() != ISD::UNDEF && - V->getOperand(i) != Base) { + if (V->getOperand(i) != Base) { AllSame = false; break; } Added: llvm/trunk/test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll?rev=42111&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll Tue Sep 18 16:54:37 2007 @@ -0,0 +1,244 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep 170 + + %struct.XXAlphaTest = type { float, i16, i8, i8 } + %struct.XXArrayRange = type { i8, i8, i8, i8 } + %struct.XXBlendMode = type { i16, i16, i16, i16, %struct.GGC4, i16, i16, i8, i8, i8, i8 } + %struct.XXBufferData = type { i8*, i32, i32, i16, i16, i8, i8, i8, i8 } + %struct.XXBufferRec = type opaque + %struct.XXBufferstate = type { %struct.GLGXfKey, %struct.GLGXfKey, %struct.XXFramebufferAttachment, %struct.XXFramebufferAttachment, i8, i8, i8, i8, [2 x %struct.GLSBuffer], [4 x %struct.GLSBuffer], %struct.GLSBuffer, %struct.GLSBuffer, %struct.GLSBuffer, [4 x %struct.GLSBuffer*], %struct.GLSBuffer*, %struct.GLSBuffer*, %struct.GLSBuffer*, i8, i8 } + %struct.XXClearC = type { double, %struct.GGC4, %struct.GGC4, float, i32 } + %struct.XXClipPlane = type { i32, [6 x %struct.GGC4] } + %struct.XXCBuffer = type { i16, i16, [8 x i16] } + %struct.XXCMatrix = type { [16 x float]*, %struct.XXImagingCScale } + %struct.XXConfig = type { i32, float, %struct.GLGXfKey, %struct.GLGXfKey, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, %struct.XXPixelFormat, %struct.XXPointLineLimits, %struct.XXPointLineLimits, %struct.XXRenderFeatures, %struct.XXVArrayTypes, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.XXTextureLimits, [3 x %struct.XXPipelineProgramLimits], %struct.XXFragmentProgramLimits, %struct.XXVProgramLimits, %struct.XXGeometryShaderLimits, %struct.XXProgramLimits, %struct.XXXfFeedbackLimits, %struct.XXVDescriptor*, %struct.XXVDescriptor*, [3 x i32] } + %struct.XXContextRec = type { float, float, float, float, float, float, float, float, %struct.GGC4, %struct.GGC4, %struct.LLFPContext, [16 x [2 x %struct.PPStreamToken]], %struct.GLGProcessor, %struct._LLConstants*, void (%struct.XXContextRec*, i32, i32, %struct.LLFragmentAttrib*, %struct.LLFragmentAttrib*, i32)*, %struct._LLFunction*, %struct.PPStreamToken*, void (%struct.XXContextRec*, %struct.XXV*)*, void (%struct.XXContextRec*, %struct.XXV*, %struct.XXV*)*, void (%struct.XXContextRec*, %struct.XXV*, %struct.XXV*, %struct.XXV*)*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, [2 x i32], [1 x i32], [1 x i32], float, float, float, i32, i32, %struct.GLSDrawable, %struct.XXFramebufferRec*, %struct.XXRect, %struct.XXFormat, %struct.XXFormat, %struct.XXConfig*, %struct.XXBufferstate, %struct.XXSharedRec*, %struct.XXState*, %struct.XXPluginState*, %struct.GGC4*, %struct.GGC4*, %struct.LLFragmentAttrib*, %struct.LLFragmentAttrib*, %struct.LLFragmentAttrib*, %! struct.XXProgramRec*, %struct.XXPipelineProgramRec*, %struct.LLTextures, { [4 x i8*], i8*, i8*, i8* }, %struct.XXStippleData, i16, i8, i8, i32, i32, %struct.XXQueryRec*, %struct.XXQueryRec*, %struct.XXFallback } + %struct.XXConvolution = type { %struct.GGC4, %struct.XXImagingCScale, i16, i16, float*, i32, i32 } + %struct.XXCurrent16A = type { [8 x %struct.GGC4], [16 x %struct.GGC4], %struct.GGC4, %struct.XXPointLineLimits, float, %struct.XXPointLineLimits, float, [4 x float], %struct.XXPointLineLimits, float, float, float, float, i8, i8, i8, i8 } + %struct.XXDepthTest = type { i16, i16, i8, i8, i8, i8, double, double } + %struct.XXDispatch = type { i8 (i32*, i32*, i32*, i32*) zeroext *, i32 (%struct.GGPixelFormat**, i32*)*, i32 (%struct.GGPixelFormat*)*, i32 (%struct.GGRendererInfo*, i32)*, i32 (%struct.XXSharedRec**)*, i32 (%struct.XXSharedRec*)*, i32 (%struct.XXContextRec**, %struct.GGPixelFormat*, %struct.XXSharedRec*, %struct.XXContextRec*, %struct.XXConfig*, %struct.XXState*, %struct.XXPluginState*)*, i32 (%struct.XXContextRec*)*, void (%struct.XXContextRec*)*, i32 (%struct.XXContextRec*, i32, i8*, i32)*, i32 (%struct.XXContextRec*, i32, i32*)*, i32 (%struct.XXContextRec*, i32, i32*)*, i32 (%struct.XXContextRec*, %struct.XXRenderDispatch*, %struct.XXViewportConfig*)*, i32 (%struct.XXContextRec*, %struct.XXRenderDispatch*, i32*)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec**, %struct.XXTextureState*)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32, i32)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32! , i32, i32, i32, i32, i32, i32, i32)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32, i32, i32*)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32, i8*)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*)*, i8 (%struct.XXContextRec*, %struct.XXTextureRec*) zeroext *, void (%struct.XXContextRec*, %struct.XXTextureRec*)*, void (%struct.XXContextRec*)*, void (%struct.XXContextRec*)*, i8* (%struct.XXContextRec*, i32)*, i32 (%struct.XXContextRec*)*, i8* (%struct.XXContextRec*, i32, i32*)*, void (%struct.XXContextRec*, i8*, i32)*, void (%struct.XXContextRec*, i8*)*, i32 (%struct.XXContextRec*, %struct.XXPipelineProgramRec**, %struct.XXPipelineProgramData*)*, i32 (%struct.XXContextRec*, %struct.XXPipelineProgramRec*, i32)*, i32 (%struct.XXContextRec*, %struct.XXPipelineProgramRec*, i32, i32*)*, i32 (%struct.XXContextRec*, %struct.XXPipelineProgramRec*)*, i32 (%struct.XXContextRec*, %struct.XX! ProgramRec**, %struct.XXProgramData*, %struct.XXPluginProgramD! ata*)*, i32 (%struct.XXContextRec*, %struct.XXProgramRec*)*, i32 (%struct.XXContextRec*, %struct.XXVArrayRec**, %struct.XXVArrayData*, %struct.XXPluginVArrayData*)*, i32 (%struct.XXContextRec*, %struct.XXVArrayRec*)*, i32 (%struct.XXContextRec*, %struct.XXVArrayRec*, i32, i8*, i8 zeroext )*, i32 (%struct.XXContextRec*, %struct.XXVArrayRec*)*, void (%struct.XXContextRec*, %struct.XXVArrayRec*)*, i32 (%struct.XXContextRec*, %struct.XXFenceRec**)*, i32 (%struct.XXContextRec*, %struct.XXFenceRec*)*, i8 (%struct.XXContextRec*, i32, i8*) zeroext *, i32 (%struct.XXContextRec*, i32, i8*)*, i32 (%struct.XXContextRec*, %struct.XXQueryRec**)*, i32 (%struct.XXContextRec*, %struct.XXQueryRec*)*, i32 (%struct.XXContextRec*, %struct.XXQueryRec*, i32, i32*)*, i32 (%struct.XXContextRec*, %struct.XXBufferRec**, %struct.XXBufferData*, %struct.XXPluginBufferData*)*, i32 (%struct.XXContextRec*, %struct.XXBufferRec*)*, void (%struct.XXContextRec*, %struct.XXBufferRec*, i8*, i32)*, void (%struct.XXContext! Rec*, %struct.XXBufferRec*)*, void (%struct.XXContextRec*, %struct.XXBufferRec*)*, void (%struct.XXContextRec*, %struct.XXBufferRec*, i8**)*, void (%struct.XXContextRec*, %struct.XXBufferRec*, i8*)*, void (%struct.XXContextRec*, i8*)*, i8 (%struct.XXContextRec*, i8*) zeroext *, void (%struct.XXContextRec*, i8*)*, i32 (%struct.XXContextRec*, %struct.XXFramebufferRec**, %struct.XXFramebufferData*, %struct.XXPluginFramebufferData*)*, void (%struct.XXContextRec*, %struct.XXFramebufferRec*)*, i32 (%struct.XXContextRec*, %struct.XXFramebufferRec*)*, i32 (%struct.XXContextRec*, i32, i8*, i32, i8 zeroext )*, i32 (%struct.XXContextRec*, i32, i8*, i32, i8*)* } + %struct.XXFallback = type { float*, %struct.XXRenderDispatch*, %struct.XXConfig*, i8*, i8*, i32, i32 } + %struct.XXFenceRec = type opaque + %struct.XXFixedFunctionProgram = type { %struct.PPStreamToken* } + %struct.XXFogMode = type { %struct.GGC4, float, float, float, float, float, i16, i16, i16, i8, i8 } + %struct.XXFormat = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i32, i32, i32 } + %struct.XXFragmentProgramLimits = type { i32, i32, i32, i16, i16, i32 } + %struct.XXFramebufferAttachment = type { i32, i32, i32, i32 } + %struct.XXFramebufferData = type { [10 x %struct.XXFramebufferAttachment], [8 x i16], i16, i16, i16, i8, i8, i32, i32 } + %struct.XXFramebufferRec = type { %struct.XXFramebufferData*, %struct.XXPluginFramebufferData*, %struct.XXPixelFormat, i8, i8, i8, i8 } + %struct.XXGeometryShaderLimits = type { i32, i32, i32, i32, i32, i32, i32 } + %struct.XXHintMode = type { i16, i16, i16, i16, i16, i16, i16, i16, i16, i16 } + %struct.XXHistogram = type { %struct.XXFramebufferAttachment*, i32, i16, i8, i8 } + %struct.XXImagingCScale = type { %struct.GLTCoord2, %struct.GLTCoord2, %struct.GLTCoord2, %struct.GLTCoord2 } + %struct.XXImagingSubset = type { %struct.XXConvolution, %struct.XXConvolution, %struct.XXConvolution, %struct.XXCMatrix, %struct.XXMinmax, %struct.XXHistogram, %struct.XXImagingCScale, %struct.XXImagingCScale, %struct.XXImagingCScale, %struct.XXImagingCScale, i32 } + %struct.XXLight = type { %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.XXPointLineLimits, float, float, float, float, float, %struct.XXPointLineLimits, float, %struct.XXPointLineLimits, float, %struct.XXPointLineLimits, float, float, float, float, float } + %struct.XXLightModel = type { %struct.GGC4, [8 x %struct.XXLight], [2 x %struct.XXMaterial], i32, i16, i16, i16, i8, i8, i8, i8, i8, i8 } + %struct.XXLightProduct = type { %struct.GGC4, %struct.GGC4, %struct.GGC4 } + %struct.XXLineMode = type { float, i32, i16, i16, i8, i8, i8, i8 } + %struct.XXLogicOp = type { i16, i8, i8 } + %struct.XXMaskMode = type { i32, [3 x i32], i8, i8, i8, i8, i8, i8, i8, i8 } + %struct.XXMaterial = type { %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, float, float, float, float, [8 x %struct.XXLightProduct], %struct.GGC4, [6 x i32], [2 x i32] } + %struct.XXMinmax = type { %struct.XXMinmaxTable*, i16, i8, i8 } + %struct.XXMinmaxTable = type { %struct.GGC4, %struct.GGC4 } + %struct.XXMipmaplevel = type { [4 x i32], [4 x i32], [4 x float], [4 x i32], i32, i32, float*, i8*, i16, i16, i16, i16, [2 x float] } + %struct.XXMultisample = type { float, i8, i8, i8, i8, i8, i8, i8, i8 } + %struct.XXPipelineProgramData = type { i16, i8, i8, i32, %struct.PPStreamToken*, i64, %struct.GGC4*, i32 } + %struct.XXPipelineProgramLimits = type { i32, i16, i16, i32, i16, i16, i32, i32 } + %struct.XXPipelineProgramRec = type { %struct.XXPipelineProgramData*, %struct.PPStreamToken*, %struct.XXContextRec*, { %struct._LLFunction*, \2, \2, [20 x i32], [64 x i32], i32, i32, i32 }*, i32, i32 } + %struct.XXPipelineProgramState = type { i8, i8, i8, i8, %struct.GGC4* } + %struct.XXPixelFormat = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 } + %struct.XXPixelMap = type { i32*, float*, float*, float*, float*, float*, float*, float*, float*, i32*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } + %struct.XXPixelMode = type { float, float, %struct.XXPixelStore, %struct.XXPixelTransfer, %struct.XXPixelMap, %struct.XXImagingSubset, i32, i32 } + %struct.XXPixelPack = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8 } + %struct.XXPixelStore = type { %struct.XXPixelPack, %struct.XXPixelPack } + %struct.XXPixelTransfer = type { float, float, float, float, float, float, float, float, float, float, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float } + %struct.XXPluginBufferData = type { i32 } + %struct.XXPluginFramebufferData = type { [10 x %struct.XXTextureRec*], i32, i32 } + %struct.XXPluginProgramData = type { [3 x %struct.XXPipelineProgramRec*], %struct.XXBufferRec**, i32 } + %struct.XXPluginState = type { [16 x [5 x %struct.XXTextureRec*]], [3 x %struct.XXTextureRec*], [3 x %struct.XXPipelineProgramRec*], %struct.XXProgramRec*, %struct.XXVArrayRec*, [16 x %struct.XXBufferRec*], %struct.XXFramebufferRec*, %struct.XXFramebufferRec* } + %struct.XXPluginVArrayData = type { [32 x %struct.XXBufferRec*], %struct.XXBufferRec*, { i64 } } + %struct.XXPointLineLimits = type { float, float, float } + %struct.XXPointMode = type { float, float, float, float, %struct.XXPointLineLimits, float, i8, i8, i8, i8, i16, i16, i32, i16, i16 } + %struct.XXPolygonMode = type { [128 x i8], float, float, i16, i16, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8 } + %struct.XXProgramData = type { i32, i32, i32, i32, %struct.PPStreamToken*, i32*, i32, i32, i32, i32, i8, i8, i8, i8 } + %struct.XXProgramLimits = type { i32, i32, i32 } + %struct.XXProgramRec = type { %struct.XXProgramData*, %struct.XXPluginProgramData*, %struct.GGC4**, i32 } + %struct.XXQueryRec = type { i32, i32, %struct.XXQueryRec* } + %struct.XXRect = type { i32, i32, i32, i32, i32, i32 } + %struct.XXRegisterCombiners = type { i8, i8, i8, i8, i32, [2 x %struct.GGC4], [8 x %struct.XXRegisterCombinersPerStageState], %struct.XXRegisterCombinersFinalStageState } + %struct.XXRegisterCombinersFinalStageState = type { i8, i8, i8, i8, [7 x %struct.XXRegisterCombinersPerVariableState] } + %struct.XXRegisterCombinersPerPortionState = type { [4 x %struct.XXRegisterCombinersPerVariableState], i8, i8, i8, i8, i16, i16, i16, i16, i16, i16 } + %struct.XXRegisterCombinersPerStageState = type { [2 x %struct.XXRegisterCombinersPerPortionState], [2 x %struct.GGC4] } + %struct.XXRegisterCombinersPerVariableState = type { i16, i16, i16, i16 } + %struct.XXRenderDispatch = type { void (%struct.XXContextRec*, i32, float)*, void (%struct.XXContextRec*, i32)*, i8 (%struct.XXContextRec*, i32, i32, i32, i32, i32, i32, i8*, i8 zeroext , %struct.XXBufferRec*) zeroext *, i8 (%struct.XXContextRec*, %struct.XXV*, i32, i32, i32, i32, i8*, i8 zeroext , %struct.XXBufferRec*) zeroext *, void (%struct.XXContextRec*, %struct.XXV*, i32, i32, i32, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32, float, float, i8*, i8 zeroext )*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, ! i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV**, i32)*, void (%struct.XXContextRec*, %struct.XXV**, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV**, i32, i32)*, void (%struct.XXContextRec*, i8*, i32, i32, i32, i32, i8*)*, i8* (%struct.XXContextRec*, i32, i32*)*, void (%struct.XXContextRec*, i32, i32, i32)*, i8* (%struct.XXContextRec*, i32, i32, i32, i32, i32)*, void (%struct.XXContextRec*, i32, i32, i32, i32, i32, i8*)*, void (%struct.XXContextRec*)*, void (%struct.XXContextRec*)*, void (%struct.XXContextRec*)*, void (%struct.XXContextRec*, %struct.XXFenceRec*)*, void (%struct.XXContextRec*, i32, %struct.XXQueryRec*)*, void (%struct.XXContextRec*, %struct.XXQueryRec*)*, i8 (%struct.XXContex! tRec*, i32, i32, i32, i32, i32, i8*, %struct.GGC4*, %struct.XX! Current1 6A*) zeroext *, i8 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32, i32, i32, i32, i32, i32, i32, i32) zeroext *, i8 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8 zeroext , %struct.XXBufferRec*) zeroext *, i8 (%struct.XXContextRec*, %struct.XXTextureRec*, i32) zeroext *, i8 (%struct.XXContextRec*, %struct.XXBufferRec*, i32, i32, i8*) zeroext *, void (%struct.XXContextRec*, i32)*, void (%struct.XXContextRec*)*, void (%struct.XXContextRec*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)* } + %struct.XXRenderFeatures = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 } + %struct.XXScissorTest = type { %struct.XXFramebufferAttachment, i8, i8, i8, i8 } + %struct.XXSharedRec = type { %struct.pthread_mutex_t, i32 } + %struct.XXState = type { i16, i16, i16, i16, i32, i32, [256 x %struct.GGC4], [128 x %struct.GGC4], %struct.XXViewport, %struct.XXXf, %struct.XXLightModel, %struct.XXTextureTargets, %struct.XXAlphaTest, %struct.XXBlendMode, %struct.XXClearC, %struct.XXCBuffer, %struct.XXDepthTest, %struct.XXArrayRange, %struct.XXFogMode, %struct.XXHintMode, %struct.XXLineMode, %struct.XXLogicOp, %struct.XXMaskMode, %struct.XXPixelMode, %struct.XXPointMode, %struct.XXPolygonMode, %struct.XXScissorTest, i32, %struct.XXStencilTest, [8 x %struct.XXTextureMode], [8 x %struct.XXTextureMode], [16 x %struct.XXTextureImageMode], %struct.XXArrayRange, [8 x %struct.XXTextureCoordGen], %struct.XXClipPlane, %struct.XXMultisample, %struct.XXRegisterCombiners, %struct.XXArrayRange, %struct.XXArrayRange, [3 x %struct.XXPipelineProgramState], %struct.XXXfFeedback, i32*, %struct.XXFixedFunctionProgram, [3 x i32] } + %struct.XXStencilTest = type { [3 x { i32, i32, i16, i16, i16, i16 }], i32, [4 x i8] } + %struct.XXStippleData = type { i32, i16, i16, [32 x [32 x i8]] } + %struct.XXTextureCoordGen = type { { i16, i16, %struct.GGC4, %struct.GGC4 }, { i16, i16, %struct.GGC4, %struct.GGC4 }, { i16, i16, %struct.GGC4, %struct.GGC4 }, { i16, i16, %struct.GGC4, %struct.GGC4 }, i8, i8, i8, i8 } + %struct.XXTextureGeomState = type { i16, i16, i16, i16, i16, i8, i8, i8, i8, i16, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, [6 x i16], [6 x i16] } + %struct.XXTextureImageMode = type { float } + %struct.XXTextureLevel = type { i32, i32, i16, i16, i16, i8, i8, i16, i16, i16, i16, i8* } + %struct.XXTextureLimits = type { float, float, i16, i16, i16, i16, i16, i16, i16, i16, i16, i8, i8, [8 x i32], i32 } + %struct.XXTextureMode = type { %struct.GGC4, i32, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, float, float, i16, i16, i16, i16, i16, i16, [4 x i16], i8, i8, i8, i8, [3 x float], [4 x float], float, float } + %struct.XXTextureParamState = type { i16, i16, i16, i16, i16, i16, %struct.GGC4, float, float, float, float, i16, i16, i16, i16, float, i16, i8, i8, i32, i8* } + %struct.XXTextureRec = type { [4 x float], %struct.XXTextureState*, %struct.XXMipmaplevel*, %struct.XXMipmaplevel*, float, float, float, float, i32, i32, i32, i32, i32, i32, i32, [2 x %struct.PPStreamToken] } + %struct.XXTextureState = type { i16, i8, i8, i16, i16, float, i32, %struct.GGSWRSurface*, %struct.XXTextureParamState, %struct.XXTextureGeomState, %struct.XXTextureLevel, [6 x [15 x %struct.XXTextureLevel]] } + %struct.XXTextureTargets = type { i64, i64, i64, i64, i64, i64 } + %struct.XXXf = type { [24 x [16 x float]], [24 x [16 x float]], [16 x float], float, float, float, float, float, i8, i8, i8, i8, i32, i32, i32, i16, i16, i8, i8, i8, i8, i32 } + %struct.XXXfFeedback = type { i8, i8, i8, i8, [16 x i32], [16 x i32] } + %struct.XXXfFeedbackLimits = type { i32, i32, i32, i32, i32 } + %struct.XXV = type { %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.XXPointLineLimits, float, %struct.GGC4, float, float, float, i8, i8, i8, i8, i32, i32, i32, i32, [4 x float], [2 x %struct.XXMaterial*], i32, i32, [8 x %struct.GGC4] } + %struct.XXVArrayData = type { [32 x %struct.XXVArrayElement], { i64 }, { i64 }, i16, i16, i32, i8*, i8, i8, i8, i8 } + %struct.XXVArrayElement = type { i8*, i8*, i32, i16, i8, i8 } + %struct.XXVArrayRec = type opaque + %struct.XXVArrayTypes = type { i16, i16, i16, i16, i16, i16 } + %struct.XXVDescriptor = type { i8, i8, i8, i8, [0 x i32] } + %struct.XXVProgramLimits = type { i16, i16 } + %struct.XXViewport = type { float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, double, double, i32, i32, i32, i32, float, float, float, float } + %struct.XXViewportConfig = type { %struct.GLGXfKey, %struct.GLGXfKey, %struct.GLGXfKey } + %struct.GLEEnableHashObject = type { i32, void (%struct.__GGContextRec*, i32, i32)*, %struct.GLEEnableHashObject*, i8* } + %struct.GLEPContextData = type { %struct.XXContextRec*, %struct.XXConfig, %struct.XXPluginState, %struct.GLEPPlugin*, i32 } + %struct.GLEPPlugin = type { %struct.GLEPPlugin*, [256 x i8], i8*, i32, i32, %struct.XXDispatch } + %struct.GLGCTable = type { i32, i32, i32, i8* } + %struct.GLGOperation = type { i8*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, %struct.GLGCTable, %struct.GLGCTable, %struct.GLGCTable } + %struct.GLGProcessor = type { void (%struct.XXPixelMode*, %struct.GLGOperation*, %struct._GLGFunctionKey*)*, %struct._LLFunction*, %struct._GLGFunctionKey* } + %struct.GLGXfKey = type { i32, i32 } + %struct.GGAttrib = type { %struct.GGAttribPixelMode } + %struct.GGAttribPixelMode = type { float, float, i32, %struct.GGPixelTransfer, %struct.GGPixelMap } + %struct.GGClientAttrib = type { %struct.GGClientAttribVArray } + %struct.GGClientAttribVArray = type { [32 x %struct.GLGCTable], i16, i16, i32, i8*, i32, i32, i32, [32 x i32], i32, i32, i32, i8*, i32, i32, i32, i32 } + %struct.GGC4 = type { float, float, float, float } + %struct.GGPixelFormat = type { %struct.GGPixelFormat*, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i32, i8, i8, i8, i8, i32 } + %struct.GGPixelMap = type { [256 x i32], [256 x float], [256 x float], [256 x float], [256 x float], [256 x float], [256 x float], [256 x float], [256 x float], [256 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8 } + %struct.GGPixelTransfer = type { float, float, float, float, float, float, float, float, float, float, i32, i32 } + %struct.GGRendererInfo = type { %struct.GGRendererInfo*, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i16, i8, i8, i32, i32, i32 } + %struct.GGSWRSurface = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i8*, [4 x i8*], i32 } + %struct.GLSBuffer = type { i8* } + %struct.GLSDrawable = type { %struct.GLSWindowRec* } + %struct.GLSWindowRec = type { %struct.GLGXfKey, %struct.GLGXfKey, i32, i32, %struct.GLSDrawable, [2 x i8*], i8*, i8*, i8*, [4 x i8*], i32, i32, i32, i32, [4 x i32], i16, i16, i16, i8, i8, %struct.XXProgramLimits, i32, i32, i8*, i8* } + %struct.GLTCoord2 = type { float, float } + %struct.LLFPContext = type { float, i32, i32, i32, float, [3 x float] } + %struct.LLFragmentAttrib = type { <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, [8 x <4 x float>] } + %struct.LLProgramData = type { %struct._LLFunction*, %struct.LLProgramData*, %struct.LLProgramData*, [64 x i32], i32, i32 } + %struct.LLSubmitKey = type { %struct.GLGXfKey } + %struct.LLTextures = type { [16 x %struct.XXTextureRec*] } + %struct.LFSStream = type { %struct.LFSStreamChunkList*, { %struct.LFSStreamChunkList*, %struct.LFSStreamChunkList* }, { %struct.LFSStreamChunkList*, %struct.LFSStreamChunkList* }, %struct.LFSStreamChunkList* } + %struct.LFSStreamChunk = type { i8, i8, i8, i8, { %struct.LFSStreamOperation }, i8*, i8* } + %struct.LFSStreamChunkList = type { %struct.LFSStreamChunk*, %struct.LFSStreamChunk*, i32 } + %struct.LFSStreamOperation = type { i32, %struct.XXFramebufferAttachment, [3 x %struct.XXFramebufferAttachment] } + %struct.PPStreamToken = type { { i16, i16, i32 } } + %struct._GLGFunctionKey = type { %struct.LLSubmitKey } + %struct._GLPHashMachine = type opaque + %struct._GLPHashObject = type opaque + %struct._LLConstants = type { <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, float, float, float, float, float, float, float, float, float, float, float, float, [256 x float], [528 x i8] } + %struct._LLFunction = type opaque + %struct.__GGContextRec = type { %struct.__GLconstants16A, %struct.__GLviewport16A, %struct.XXCurrent16A, %struct.__GLlightmodel16A, [8 x i32], [32 x i32], [32 x i32], [32 x i32], [8 x i32], [8 x i32], %struct.XXState, %struct.__GLglobals16A*, [3 x %struct.__GLindexoffsets*], [16 x float]*, %struct.__GLmatrixidentifiers, %struct.GLEEnableHashObject*, %struct.XXPluginBufferData, %struct.XXPluginBufferData, %struct.LLTextures, %struct.GLGProcessor, %struct.__GLVmachine, %struct.__GLVarray, %struct.__GLVarraymachine, %struct.__GLinterpolate, %struct.__GLprimitive, %struct.__GLviewport, i32, %struct.__GLhashobject*, %struct.__GLhashobject*, %struct.__GLhashobject*, %struct.__GLtransform_feedback, %struct.__GLhashobject*, %struct.__GLclipplane, %struct.__GLselect, %struct.__GLfeedback, %struct.XXArrayRange, %struct.XXLogicOp, %struct.__GLmatrixmachine, %struct.__GLattribmachine, %struct.__GLshared*, %struct.__GLtexturemachine, %struct.__GLlistmachine, %struct.__GLpipelineprogram! machine, %struct.__GLshadermachine, %struct.__GLmachineshared, %struct.__GLquerymachine, %struct.__GLcurrentindex, %struct.__GLcmdbufmachine, %struct.__GLclientState, %struct.__GLeval, %struct.__GLmapdata*, %struct.__GLcoefficients*, %struct.__GLdrawpixelsobject, %struct.__GLorphanlist, %struct.__GLorphanlist*, %struct.__GLhashobject*, %struct.__GLhashobject*, %struct.__GLhashobject*, i8*, i8*, %struct.XXRenderDispatch*, i8*, i8*, i16, i8, i8, i32, i32, i32, i32, i32, i32, i32, [1 x i32], %struct.XXContextRec*, %struct.XXConfig*, %struct.XXRenderDispatch, %struct.XXViewportConfig, %struct.XXMinmaxTable, %struct.XXDispatch, i8*, i32, i32, %struct.__GGContextRec*, [4096 x i8], i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, [2 x i32], [0 x %struct.GLEPContextData] } + %struct.__GLarrayelementDrawInfoListType = type { i32, [32 x i8] } + %struct.__GLattriblink = type { i32, %struct.GGAttrib, %struct.__GLattriblink* } + %struct.__GLattribmachine = type { [16 x %struct.__GLattriblink*], %struct.__GLattriblink**, [16 x %struct.__GLclientattriblink*], %struct.__GLclientattriblink**, i32, i32 } + %struct.__GLbufferobjectclient = type { %struct.XXBufferData, i8, i8, i8, i8, i32, i8, i8, i8, i8, %struct.__GLhashobject* } + %struct.__GLclientState = type { %struct.__GLVarrayobjectclient*, %struct.__GLVarrayobjectclient*, %struct.__GLbufferobjectclient*, %struct.__GLbufferobjectclient*, %struct.__GLbufferobjectclient*, %struct.__GLbufferobjectclient*, i16, i16, i32, %struct.XXPixelMode, %struct.__GLmachineshared, %struct.__GLmachineshared, %struct.__GLpagehashuint32* } + %struct.__GLclientattriblink = type { i32, %struct.GGClientAttrib, %struct.__GLclientattriblink* } + %struct.__GLclipplane = type { i32, [6 x i32], i8, i8, i8, i8 } + %struct.__GLcmdbufmachine = type { i32, i32, %struct.__GLcommandbuf*, %struct.__GLcommandbuf*, %struct.__GLcommandbuf* (%struct.__GGContextRec*, i32)*, [32 x %struct.__GLcommandbuf*], i32, i8*, i8*, i8*, i8*, %struct._opaque_pthread_t*, %struct.pthread_mutex_t, %struct.pthread_mutex_t, %struct.pthread_mutex_t, %struct.pthread_mutex_t, %struct.pthread_cond_t, %struct.pthread_cond_t, %struct.pthread_cond_t, %struct.pthread_mutex_t, %struct.pthread_cond_t, i32, i32, i32, i8, i8, i8, i8 } + %struct.__GLcoefficients = type { float, float, i32, i32, i32, i32, [10 x float], [10 x float], [10 x float], [10 x float] } + %struct.__GLcommandbuf = type { %struct.__GLcommandelem*, %struct.__GLcommandelem*, i32, [0 x i8] } + %struct.__GLcommandelem = type { i32 (%struct.__GGContextRec*, i8*)*, i32, [0 x i8] } + %struct.__GLconstants16A = type { [4 x i32], [4 x i32], [4 x float], [4 x i32], [4 x i32], [4 x i32], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], float, float, float, float, float, float, float, float, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, i8*, i8*, i8*, %struct._LLConstants* } + %struct.__GLcurrentindex = type { float, [2 x %struct.XXPointLineLimits] } + %struct.__GLdrawpixelsobject = type { i32, i32, i32, i32, i32, i32, %struct.__GLhashobject**, i8* } + %struct.__GLeval = type { %struct.__GLmapgrid1, %struct.__GLmapgrid2, i32, i32, %struct.__GLarrayelementDrawInfoListType, %struct.__GLarrayelementDrawInfoListType, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 } + %struct.__GLfeedback = type { float*, float*, i32, i32, i8, i8, i8, i8 } + %struct.__GLfragmentprogram = type { %struct.LFSStream*, i32, i16, i16, i16, i16 } + %struct.__GLglobals16A = type { [256 x float], [48 x i8] } + %struct.__GLhashallocation = type { %struct.__GLhashallocation*, i32, i32 } + %struct.__GLhashcommon = type { %struct.__GLhashobject*, i8*, void (%struct.__GGContextRec*, %struct.__GLhashobject*)*, i32, i32, i32 } + %struct.__GLhashobject = type { %struct.__GLhashcommon, { %struct.__GLprogram } } + %struct.__GLindexoffsets = type { [1024 x i16], [256 x i16], [8 x %struct.XXHintMode], [8 x [2 x { i16, i16, i16 }]], [2 x %struct.XXVArrayTypes], [8 x [4 x i16]], [8 x [4 x i16]], [8 x i16], [6 x i16], i16, i16, i16, i16, i16, i16, i16, [24 x [4 x i16]], [24 x [4 x i16]], [24 x [4 x i16]], [24 x [4 x i16]], i16 } + %struct.__GLinterpolate = type { void (%struct.__GGContextRec*, %struct.__GLV*, %struct.__GLV*, %struct.__GLV*, float)*, i8 (%struct.__GGContextRec*, %struct.__GLV*, %struct.__GLV*, %struct.__GLV*, i8 zeroext ) zeroext *, %struct._LLFunction*, %struct._LLFunction*, i32, i32 } + %struct.__GLlight = type { float, float, float, float, float, float, i8, i8, i8, i8, i8, i8, i8, i8, [11 x float], float } + %struct.__GLlightmodel16A = type { [8 x %struct.__GLlight], [2 x %struct.__GLmaterial*], %struct.__GLmaterial*, i32, i8, i8, i8, i8, i32, void (%struct.__GGContextRec*, %struct.GGC4*)*, void (%struct.__GGContextRec*, %struct.__GLV*)*, [2 x void (%struct.__GGContextRec*, %struct.__GLV*, i32)*], [2 x void (%struct.__GGContextRec*, %struct.__GLV**, i32)*] } + %struct.__GLlistmachine = type { %struct.__GLhashobject*, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, %struct.__GLhashobject* } + %struct.__GLmachineshared = type { %struct.__GLhashobject**, %struct.__GLhashallocation*, i32, i32 } + %struct.__GLmap1color = type { i32, float, float, float, [10 x %struct.GGC4] } + %struct.__GLmap1index = type { i32, float, float, float, [10 x float] } + %struct.__GLmap1normal = type { i32, float, float, float, [10 x %struct.XXPointLineLimits] } + %struct.__GLmap1texture1 = type { i32, float, float, float, [10 x %struct.XXTextureImageMode] } + %struct.__GLmap1texture2 = type { i32, float, float, float, [10 x %struct.GLTCoord2] } + %struct.__GLmap1VattribN = type { %struct.__GLmap1color } + %struct.__GLmap2color = type { i32, i32, float, float, float, float, float, float, [100 x %struct.GGC4] } + %struct.__GLmap2index = type { i32, i32, float, float, float, float, float, float, [100 x float] } + %struct.__GLmap2normal = type { i32, i32, float, float, float, float, float, float, [100 x %struct.XXPointLineLimits] } + %struct.__GLmap2texture1 = type { i32, i32, float, float, float, float, float, float, [100 x %struct.XXTextureImageMode] } + %struct.__GLmap2texture2 = type { i32, i32, float, float, float, float, float, float, [100 x %struct.GLTCoord2] } + %struct.__GLmap2VattribN = type { %struct.__GLmap2color } + %struct.__GLmapdata = type { %struct.__GLmap1normal, %struct.__GLmap1color, %struct.__GLmap1normal, %struct.__GLmap1color, %struct.__GLmap1index, %struct.__GLmap1texture1, %struct.__GLmap1texture2, %struct.__GLmap1normal, %struct.__GLmap1color, %struct.__GLmap2normal, %struct.__GLmap2color, %struct.__GLmap2normal, %struct.__GLmap2color, %struct.__GLmap2index, %struct.__GLmap2texture1, %struct.__GLmap2texture2, %struct.__GLmap2normal, %struct.__GLmap2color, [16 x %struct.__GLmap1VattribN], [16 x %struct.__GLmap2VattribN], [16 x i8], [16 x i8] } + %struct.__GLmapgrid1 = type { i32, float, float, float } + %struct.__GLmapgrid2 = type { i32, float, float, float, i32, float, float, float } + %struct.__GLmaterial = type { %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, float, float, float, float, [8 x %struct.XXLightProduct], %struct.GGC4, i32, i32, %struct.__GLsum, %struct.__GLmaterial*, %struct.__GLmaterial* } + %struct.__GLmatrixidentifiers = type { i32, i32, i32, i32, [8 x i32] } + %struct.__GLmatrixmachine = type { [16 x float]*, [16 x float]*, i32*, [24 x i32], i16 (%struct.__GGContextRec*, %struct.__GLV*, i32) zeroext *, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, i16 (%struct.__GGContextRec*, %struct.__GLV*, i32) zeroext *, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, i32, i32, [3 x i32], [3 x i32], i32, i32, [3 x i32], [3 x i32], i32, i32, i32, i8, i8, i8, i8 } + %struct.__GLmemoryobject = type { i8*, i32, i16, i8, i8, i32, [0 x i8*] } + %struct.__GLorphanlist = type { i32, i32, i32, i32, %struct.__GLorphannode*, %struct.__GLorphannode } + %struct.__GLorphannode = type { %struct.__GLorphannode*, %struct.__GLorphannode*, %struct.__GLorphannode*, %struct.__GLorphannode*, %struct.__GLmemoryobject } + %struct.__GLpagehashlistuint32 = type { %struct.__GLpagehashnodeuint32*, %struct.__GLpagehashnodeuint32* } + %struct.__GLpagehashnodeuint32 = type { %struct.__GLpagehashnodeuint32*, %struct.__GLpagehashnodeuint32*, i32, [5 x i32], [0 x i8] } + %struct.__GLpagehashuint32 = type { i32, i32, i32, %struct.__GLpagehashlistuint32** } + %struct.__GLpipelineprogram = type { %struct.__GLpipelineprogramcommon, { %struct.__GLfragmentprogram } } + %struct.__GLpipelineprogramcommon = type { [8 x %struct.XXPipelineProgramRec*], %struct.LLProgramData*, i8*, i32, i32, i32, [32 x i32], i8, i8, i16, i16, i16, i16, i16, i16, i16, %struct.__GLindexoffsets, %struct.XXPipelineProgramData } + %struct.__GLpipelineprogrammachine = type { i8*, i16 (%struct.__GGContextRec*, %struct.__GLV*, i32) zeroext *, %struct._LLFunction*, %struct.PPStreamToken*, %struct.GGC4*, i16 (%struct.__GGContextRec*, %struct.__GLV*, i32) zeroext *, %struct._LLFunction*, %struct.PPStreamToken*, %struct.GGC4*, [3 x %struct.__GLhashobject*], [3 x %struct.__GLhashobject*], [3 x %struct.__GLpipelineprogram*], [3 x %struct._GLPHashMachine*], [3 x %struct._GLPHashObject*], i32, i8, i8, i8, i8, i16, i16, [4 x i8] } + %struct.__GLprimitive = type { [14 x void (%struct.__GGContextRec*)*], void (%struct.__GGContextRec*)*, void (%struct.__GGContextRec*)*, void (%struct.__GGContextRec*)*, i16, i16, i32, i8, i8, i8, i8, i32 } + %struct.__GLprogram = type { [8 x %struct.XXProgramRec*], i8*, %struct.GGC4*, i8*, %struct.__GLhashobject**, [3 x %struct.__GLshadercompilelink], i32, i32, i32, i32, i32, i32, %struct.__GLhashobject**, i32*, %struct.GGC4**, i32, i32, %struct.XXProgramData, i32, i32, i32, i32, i32, i8, i8, i8, i8, i32, i32, %struct.PPStreamToken*, [0 x %struct.XXPluginProgramData] } + %struct.__GLquerymachine = type { %struct.__GLmachineshared, %struct.__GLhashobject*, %struct.__GLhashobject*, %struct.__GLhashobject*, i32, i32, i32 } + %struct.__GLselect = type { i32*, i32*, [128 x i32], i32*, i32*, i32, i32, i8, i8, i8, i8 } + %struct.__GLshadercompilelink = type { i32, i8, i8, i8, i8, i32, [32 x i32], [16 x i32], [16 x i16], %struct.PPStreamToken*, %struct.LLProgramData*, i32*, %struct.XXPipelineProgramData, %struct.__GLindexoffsets } + %struct.__GLshadermachine = type { %struct.__GLhashobject*, float**, float**, i32 } + %struct.__GLshared = type { [8 x %struct.__GLmachineshared], i32, i32, i8, i8, i8, i8, %struct.pthread_mutex_t, [8 x %struct.XXSharedRec*] } + %struct.__GLsum = type { %struct.XXPointLineLimits, i8, i8, i8, i8 } + %struct.__GLtexturemachine = type { [16 x [5 x %struct.__GLhashobject*]], [5 x %struct.__GLhashobject*], [5 x %struct.__GLhashobject*], [3 x %struct.__GLhashobject*], [3 x %struct.__GLhashobject*], i64, i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8 } + %struct.__GLtransform_feedback = type { [16 x %struct.__GLhashobject*], i16, i16 } + %struct.__GLV = type { %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.XXPointLineLimits, float, %struct.GGC4, float, float, float, i8, i8, i8, i8, i32, i32, i32, i32, [4 x float], [2 x %struct.__GLmaterial*], i32, i32, [8 x %struct.GGC4] } + %struct.__GLVarray = type { i8*, i8*, %struct.__GLarrayelementDrawInfoListType*, i8*, %struct.__GLhashobject*, [32 x i8*], i8*, i32, i32, i32, i32, i32, i16, i16, i32, i32 } + %struct.__GLVarraymachine = type { %struct.__GLhashobject*, %struct.__GLhashobject* } + %struct.__GLVarrayobjectclient = type { %struct.__GLbufferobjectclient*, %struct.__GLbufferobjectclient*, [32 x %struct.__GLbufferobjectclient*], i64, i64, %struct.XXVArrayData, %struct.__GLhashobject* } + %struct.__GLVmachine = type { %struct.__GLV*, %struct.__GLV*, %struct.__GLV*, %struct.__GLV*, %struct.__GLV*, i8*, i8*, %struct.__GLV*, %struct.__GLV**, %struct.__GLV**, %struct.__GLV**, %struct.__GLV**, %struct.__GLV**, i32, i32, i32, i32, i32, i16, i16, i16, i16, void (%struct.__GGContextRec*, float, float, float, float, %struct.__GLV*)*, void (%struct.__GGContextRec*, float, float, float, float, %struct.__GLV*)*, void (%struct.__GGContextRec*, i32)*, void (%struct.__GGContextRec*, i32)*, void (%struct.__GGContextRec*, i8*, i8*, i32)*, void (%struct.__GGContextRec*, i8*, i32)*, void (%struct.__GGContextRec*, i32)*, void (%struct.__GGContextRec*, i32)*, void (%struct.__GGContextRec*, i32)*, void (%struct.__GGContextRec*, i32)*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, i32*, i32*, i32*, i32*, i32*, i32*, i32*, i32*, i3! 2*, [32 x i8], [32 x i8], %struct.XXVDescriptor*, %struct.XXVDescriptor* } + %struct.__GLviewport = type { float, float, float, float, float } + %struct.__GLviewport16A = type { float, float, float, float, float, float, float, float, float, float, float, float } + %struct.__darwin_pthread_handler_rec = type { void (i8*)*, i8*, %struct.__darwin_pthread_handler_rec* } + %struct._opaque_pthread_t = type { i32, %struct.__darwin_pthread_handler_rec*, [596 x i8] } + %struct.pthread_cond_t = type { i32, [24 x i8] } + %struct.pthread_mutex_t = type { i32, [40 x i8] } + +define i16 @f(%struct.__GGContextRec* %ctx, %struct.__GLV* %stack, i32 %num_vtx) { +entry: + alloca [4 x <4 x float>] ; <[4 x <4 x float>]*>:0 [#uses=167] + alloca [4 x <4 x float>] ; <[4 x <4 x float>]*>:1 [#uses=170] + alloca [4 x <4 x i32>] ; <[4 x <4 x i32>]*>:2 [#uses=12] + %tmp3 = getelementptr %struct.__GGContextRec* %ctx, i32 0, i32 42, i32 3 ; <%struct.PPStreamToken**> [#uses=1] + %tmp4 = load %struct.PPStreamToken** %tmp3 ; <%struct.PPStreamToken*> [#uses=13] + %.sub6235.i = getelementptr [4 x <4 x float>]* %0, i32 0, i32 0 ; <<4 x float>*> [#uses=76] + %.sub.i = getelementptr [4 x <4 x float>]* %1, i32 0, i32 0 ; <<4 x float>*> [#uses=59] + + %tmp116117.i1061.i = bitcast %struct.PPStreamToken* %tmp4 to <4 x float>* ; <<4 x float>*> [#uses=1] + %tmp124.i1062.i = getelementptr <4 x float>* %tmp116117.i1061.i, i32 63 ; <<4 x float>*> [#uses=1] + %tmp125.i1063.i = load <4 x float>* %tmp124.i1062.i ; <<4 x float>> [#uses=5] + %tmp828.i1077.i = shufflevector <4 x float> %tmp125.i1063.i, <4 x float> undef, <4 x i32> < i32 1, i32 1, i32 1, i32 1 > ; <<4 x float>> [#uses=4] + %tmp704.i1085.i = load <4 x float>* %.sub6235.i ; <<4 x float>> [#uses=1] + %tmp712.i1086.i = call <4 x float> @llvm.x86.sse.max.ps( <4 x float> %tmp704.i1085.i, <4 x float> %tmp828.i1077.i ) ; <<4 x float>> [#uses=1] + store <4 x float> %tmp712.i1086.i, <4 x float>* %.sub.i + + %tmp2587.i1145.gep.i = getelementptr [4 x <4 x float>]* %1, i32 0, i32 0, i32 2 ; [#uses=1] + %tmp5334.i = load float* %tmp2587.i1145.gep.i ; [#uses=5] + %tmp2723.i1170.i = insertelement <4 x float> undef, float %tmp5334.i, i32 2 ; <<4 x float>> [#uses=5] + store <4 x float> %tmp2723.i1170.i, <4 x float>* %.sub6235.i + + %tmp1406.i1367.i = shufflevector <4 x float> %tmp2723.i1170.i, <4 x float> undef, <4 x i32> < i32 2, i32 2, i32 2, i32 2 > ; <<4 x float>> [#uses=1] + %tmp84.i1413.i = load <4 x float>* %.sub6235.i ; <<4 x float>> [#uses=1] + %tmp89.i1415.i = mul <4 x float> %tmp84.i1413.i, %tmp1406.i1367.i ; <<4 x float>> [#uses=1] + store <4 x float> %tmp89.i1415.i, <4 x float>* %.sub.i + ret i16 0 +} + +declare <4 x float> @llvm.x86.sse.max.ps(<4 x float>, <4 x float>) From dpatel at apple.com Tue Sep 18 17:05:02 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 18 Sep 2007 15:05:02 -0700 Subject: [llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll In-Reply-To: <20070918205115.GS10864@village.us.cray.com> References: <20070918205115.GS10864@village.us.cray.com> Message-ID: <54387832-D06D-4208-A9DE-33D01BAE9D84@apple.com> On Sep 18, 2007, at 1:51 PM, Dan Gohman wrote: > I don't quite follow. For example of what I'm saying, take this > testcase, which is only slightly different than the earlier one: > > > define i32 @foo(%struct.decision* %p) { > entry: > br label %blah.i > > blah.i: ; preds = %cond_true.i, %entry > %tmp3.i = icmp eq %struct.decision* null, null ; > [#uses=1] > br i1 %tmp3.i, label %clear_modes.exit, label %cond_true.i > > cond_true.i: ; preds = %blah.i > %tmp1.i = getelementptr %struct.decision* %p, i32 0, i32 > 0 ; [#uses=1] > store i8 0, i8* %tmp1.i > br label %blah.i > > clear_modes.exit: ; preds = %blah.i > call void @exit( i32 0 ) > unreachable > } > > declare void @exit(i32) > > > Even with the latest changes, LICM puts a load of %tmp1.i in the > entry block, which isn't safe. It is not safe, because cond_true.i is a dead basic-block. The question is -- Is it LICM's responsibility to evaluate conditions and identify dead code or let other passes handle this earlier?. For example here, instruction combiner will fold comparison and cfg simplifier will take care of cond_true.i before LICM is executed in standard pass sequence. - Devang From djg at cray.com Tue Sep 18 17:38:06 2007 From: djg at cray.com (Dan Gohman) Date: Tue, 18 Sep 2007 17:38:06 -0500 Subject: [llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll Message-ID: <20070918223806.GY10864@village.us.cray.com> > It is not safe, because cond_true.i is a dead basic-block. The > question is -- Is it LICM's responsibility to evaluate conditions and > identify dead code or let other passes handle this earlier?. For > example here, instruction combiner will fold comparison and cfg > simplifier will take care of cond_true.i before LICM is executed in > standard pass sequence. Ok, so let's tweak the testcase again: define i32 @foo(%struct.decision* %p, %struct.decision* %q) { entry: br label %blah.i blah.i: ; preds = %cond_true.i, %entry %tmp3.i = icmp eq %struct.decision* null, %q ; [#uses=1] br i1 %tmp3.i, label %clear_modes.exit, label %cond_true.i cond_true.i: ; preds = %blah.i %tmp1.i = getelementptr %struct.decision* %p, i32 0, i32 0 ; [#uses=1] store i8 0, i8* %tmp1.i br label %blah.i clear_modes.exit: ; preds = %blah.i call void @exit( i32 0 ) unreachable } declare void @exit(i32) It's no longer possible for any part of the optimizer to prove the loop is dead. LICM is still putting a load of %tmp1.i in the entry block for this test, and that's unsafe. Dan -- Dan Gohman, Cray Inc. From evan.cheng at apple.com Tue Sep 18 17:56:31 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 18 Sep 2007 22:56:31 -0000 Subject: [llvm-commits] [llvm] r42112 - /llvm/trunk/test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll Message-ID: <200709182256.l8IMuWM1004986@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 18 17:56:31 2007 New Revision: 42112 URL: http://llvm.org/viewvc/llvm-project?rev=42112&view=rev Log: Clean up. Modified: llvm/trunk/test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll Modified: llvm/trunk/test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll?rev=42112&r1=42111&r2=42112&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2007-09-18-ShuffleXformBug.ll Tue Sep 18 17:56:31 2007 @@ -1,227 +1,13 @@ ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep 170 - %struct.XXAlphaTest = type { float, i16, i8, i8 } - %struct.XXArrayRange = type { i8, i8, i8, i8 } - %struct.XXBlendMode = type { i16, i16, i16, i16, %struct.GGC4, i16, i16, i8, i8, i8, i8 } - %struct.XXBufferData = type { i8*, i32, i32, i16, i16, i8, i8, i8, i8 } - %struct.XXBufferRec = type opaque - %struct.XXBufferstate = type { %struct.GLGXfKey, %struct.GLGXfKey, %struct.XXFramebufferAttachment, %struct.XXFramebufferAttachment, i8, i8, i8, i8, [2 x %struct.GLSBuffer], [4 x %struct.GLSBuffer], %struct.GLSBuffer, %struct.GLSBuffer, %struct.GLSBuffer, [4 x %struct.GLSBuffer*], %struct.GLSBuffer*, %struct.GLSBuffer*, %struct.GLSBuffer*, i8, i8 } - %struct.XXClearC = type { double, %struct.GGC4, %struct.GGC4, float, i32 } - %struct.XXClipPlane = type { i32, [6 x %struct.GGC4] } - %struct.XXCBuffer = type { i16, i16, [8 x i16] } - %struct.XXCMatrix = type { [16 x float]*, %struct.XXImagingCScale } - %struct.XXConfig = type { i32, float, %struct.GLGXfKey, %struct.GLGXfKey, i8, i8, i8, i8, i8, i8, i8, i8, i32, i32, i32, %struct.XXPixelFormat, %struct.XXPointLineLimits, %struct.XXPointLineLimits, %struct.XXRenderFeatures, %struct.XXVArrayTypes, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.XXTextureLimits, [3 x %struct.XXPipelineProgramLimits], %struct.XXFragmentProgramLimits, %struct.XXVProgramLimits, %struct.XXGeometryShaderLimits, %struct.XXProgramLimits, %struct.XXXfFeedbackLimits, %struct.XXVDescriptor*, %struct.XXVDescriptor*, [3 x i32] } - %struct.XXContextRec = type { float, float, float, float, float, float, float, float, %struct.GGC4, %struct.GGC4, %struct.LLFPContext, [16 x [2 x %struct.PPStreamToken]], %struct.GLGProcessor, %struct._LLConstants*, void (%struct.XXContextRec*, i32, i32, %struct.LLFragmentAttrib*, %struct.LLFragmentAttrib*, i32)*, %struct._LLFunction*, %struct.PPStreamToken*, void (%struct.XXContextRec*, %struct.XXV*)*, void (%struct.XXContextRec*, %struct.XXV*, %struct.XXV*)*, void (%struct.XXContextRec*, %struct.XXV*, %struct.XXV*, %struct.XXV*)*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, [2 x i32], [1 x i32], [1 x i32], float, float, float, i32, i32, %struct.GLSDrawable, %struct.XXFramebufferRec*, %struct.XXRect, %struct.XXFormat, %struct.XXFormat, %struct.XXConfig*, %struct.XXBufferstate, %struct.XXSharedRec*, %struct.XXState*, %struct.XXPluginState*, %struct.GGC4*, %struct.GGC4*, %struct.LLFragmentAttrib*, %struct.LLFragmentAttrib*, %struct.LLFragmentAttrib*, %! struct.XXProgramRec*, %struct.XXPipelineProgramRec*, %struct.LLTextures, { [4 x i8*], i8*, i8*, i8* }, %struct.XXStippleData, i16, i8, i8, i32, i32, %struct.XXQueryRec*, %struct.XXQueryRec*, %struct.XXFallback } - %struct.XXConvolution = type { %struct.GGC4, %struct.XXImagingCScale, i16, i16, float*, i32, i32 } - %struct.XXCurrent16A = type { [8 x %struct.GGC4], [16 x %struct.GGC4], %struct.GGC4, %struct.XXPointLineLimits, float, %struct.XXPointLineLimits, float, [4 x float], %struct.XXPointLineLimits, float, float, float, float, i8, i8, i8, i8 } - %struct.XXDepthTest = type { i16, i16, i8, i8, i8, i8, double, double } - %struct.XXDispatch = type { i8 (i32*, i32*, i32*, i32*) zeroext *, i32 (%struct.GGPixelFormat**, i32*)*, i32 (%struct.GGPixelFormat*)*, i32 (%struct.GGRendererInfo*, i32)*, i32 (%struct.XXSharedRec**)*, i32 (%struct.XXSharedRec*)*, i32 (%struct.XXContextRec**, %struct.GGPixelFormat*, %struct.XXSharedRec*, %struct.XXContextRec*, %struct.XXConfig*, %struct.XXState*, %struct.XXPluginState*)*, i32 (%struct.XXContextRec*)*, void (%struct.XXContextRec*)*, i32 (%struct.XXContextRec*, i32, i8*, i32)*, i32 (%struct.XXContextRec*, i32, i32*)*, i32 (%struct.XXContextRec*, i32, i32*)*, i32 (%struct.XXContextRec*, %struct.XXRenderDispatch*, %struct.XXViewportConfig*)*, i32 (%struct.XXContextRec*, %struct.XXRenderDispatch*, i32*)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec**, %struct.XXTextureState*)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32, i32)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32! , i32, i32, i32, i32, i32, i32, i32)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32, i32, i32*)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32, i8*)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32)*, i32 (%struct.XXContextRec*, %struct.XXTextureRec*)*, i8 (%struct.XXContextRec*, %struct.XXTextureRec*) zeroext *, void (%struct.XXContextRec*, %struct.XXTextureRec*)*, void (%struct.XXContextRec*)*, void (%struct.XXContextRec*)*, i8* (%struct.XXContextRec*, i32)*, i32 (%struct.XXContextRec*)*, i8* (%struct.XXContextRec*, i32, i32*)*, void (%struct.XXContextRec*, i8*, i32)*, void (%struct.XXContextRec*, i8*)*, i32 (%struct.XXContextRec*, %struct.XXPipelineProgramRec**, %struct.XXPipelineProgramData*)*, i32 (%struct.XXContextRec*, %struct.XXPipelineProgramRec*, i32)*, i32 (%struct.XXContextRec*, %struct.XXPipelineProgramRec*, i32, i32*)*, i32 (%struct.XXContextRec*, %struct.XXPipelineProgramRec*)*, i32 (%struct.XXContextRec*, %struct.XX! ProgramRec**, %struct.XXProgramData*, %struct.XXPluginProgramD! ata*)*, i32 (%struct.XXContextRec*, %struct.XXProgramRec*)*, i32 (%struct.XXContextRec*, %struct.XXVArrayRec**, %struct.XXVArrayData*, %struct.XXPluginVArrayData*)*, i32 (%struct.XXContextRec*, %struct.XXVArrayRec*)*, i32 (%struct.XXContextRec*, %struct.XXVArrayRec*, i32, i8*, i8 zeroext )*, i32 (%struct.XXContextRec*, %struct.XXVArrayRec*)*, void (%struct.XXContextRec*, %struct.XXVArrayRec*)*, i32 (%struct.XXContextRec*, %struct.XXFenceRec**)*, i32 (%struct.XXContextRec*, %struct.XXFenceRec*)*, i8 (%struct.XXContextRec*, i32, i8*) zeroext *, i32 (%struct.XXContextRec*, i32, i8*)*, i32 (%struct.XXContextRec*, %struct.XXQueryRec**)*, i32 (%struct.XXContextRec*, %struct.XXQueryRec*)*, i32 (%struct.XXContextRec*, %struct.XXQueryRec*, i32, i32*)*, i32 (%struct.XXContextRec*, %struct.XXBufferRec**, %struct.XXBufferData*, %struct.XXPluginBufferData*)*, i32 (%struct.XXContextRec*, %struct.XXBufferRec*)*, void (%struct.XXContextRec*, %struct.XXBufferRec*, i8*, i32)*, void (%struct.XXContext! Rec*, %struct.XXBufferRec*)*, void (%struct.XXContextRec*, %struct.XXBufferRec*)*, void (%struct.XXContextRec*, %struct.XXBufferRec*, i8**)*, void (%struct.XXContextRec*, %struct.XXBufferRec*, i8*)*, void (%struct.XXContextRec*, i8*)*, i8 (%struct.XXContextRec*, i8*) zeroext *, void (%struct.XXContextRec*, i8*)*, i32 (%struct.XXContextRec*, %struct.XXFramebufferRec**, %struct.XXFramebufferData*, %struct.XXPluginFramebufferData*)*, void (%struct.XXContextRec*, %struct.XXFramebufferRec*)*, i32 (%struct.XXContextRec*, %struct.XXFramebufferRec*)*, i32 (%struct.XXContextRec*, i32, i8*, i32, i8 zeroext )*, i32 (%struct.XXContextRec*, i32, i8*, i32, i8*)* } - %struct.XXFallback = type { float*, %struct.XXRenderDispatch*, %struct.XXConfig*, i8*, i8*, i32, i32 } - %struct.XXFenceRec = type opaque - %struct.XXFixedFunctionProgram = type { %struct.PPStreamToken* } - %struct.XXFogMode = type { %struct.GGC4, float, float, float, float, float, i16, i16, i16, i8, i8 } - %struct.XXFormat = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i32, i32, i32 } - %struct.XXFragmentProgramLimits = type { i32, i32, i32, i16, i16, i32 } - %struct.XXFramebufferAttachment = type { i32, i32, i32, i32 } - %struct.XXFramebufferData = type { [10 x %struct.XXFramebufferAttachment], [8 x i16], i16, i16, i16, i8, i8, i32, i32 } - %struct.XXFramebufferRec = type { %struct.XXFramebufferData*, %struct.XXPluginFramebufferData*, %struct.XXPixelFormat, i8, i8, i8, i8 } - %struct.XXGeometryShaderLimits = type { i32, i32, i32, i32, i32, i32, i32 } - %struct.XXHintMode = type { i16, i16, i16, i16, i16, i16, i16, i16, i16, i16 } - %struct.XXHistogram = type { %struct.XXFramebufferAttachment*, i32, i16, i8, i8 } - %struct.XXImagingCScale = type { %struct.GLTCoord2, %struct.GLTCoord2, %struct.GLTCoord2, %struct.GLTCoord2 } - %struct.XXImagingSubset = type { %struct.XXConvolution, %struct.XXConvolution, %struct.XXConvolution, %struct.XXCMatrix, %struct.XXMinmax, %struct.XXHistogram, %struct.XXImagingCScale, %struct.XXImagingCScale, %struct.XXImagingCScale, %struct.XXImagingCScale, i32 } - %struct.XXLight = type { %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.XXPointLineLimits, float, float, float, float, float, %struct.XXPointLineLimits, float, %struct.XXPointLineLimits, float, %struct.XXPointLineLimits, float, float, float, float, float } - %struct.XXLightModel = type { %struct.GGC4, [8 x %struct.XXLight], [2 x %struct.XXMaterial], i32, i16, i16, i16, i8, i8, i8, i8, i8, i8 } - %struct.XXLightProduct = type { %struct.GGC4, %struct.GGC4, %struct.GGC4 } - %struct.XXLineMode = type { float, i32, i16, i16, i8, i8, i8, i8 } - %struct.XXLogicOp = type { i16, i8, i8 } - %struct.XXMaskMode = type { i32, [3 x i32], i8, i8, i8, i8, i8, i8, i8, i8 } - %struct.XXMaterial = type { %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, float, float, float, float, [8 x %struct.XXLightProduct], %struct.GGC4, [6 x i32], [2 x i32] } - %struct.XXMinmax = type { %struct.XXMinmaxTable*, i16, i8, i8 } - %struct.XXMinmaxTable = type { %struct.GGC4, %struct.GGC4 } - %struct.XXMipmaplevel = type { [4 x i32], [4 x i32], [4 x float], [4 x i32], i32, i32, float*, i8*, i16, i16, i16, i16, [2 x float] } - %struct.XXMultisample = type { float, i8, i8, i8, i8, i8, i8, i8, i8 } - %struct.XXPipelineProgramData = type { i16, i8, i8, i32, %struct.PPStreamToken*, i64, %struct.GGC4*, i32 } - %struct.XXPipelineProgramLimits = type { i32, i16, i16, i32, i16, i16, i32, i32 } - %struct.XXPipelineProgramRec = type { %struct.XXPipelineProgramData*, %struct.PPStreamToken*, %struct.XXContextRec*, { %struct._LLFunction*, \2, \2, [20 x i32], [64 x i32], i32, i32, i32 }*, i32, i32 } - %struct.XXPipelineProgramState = type { i8, i8, i8, i8, %struct.GGC4* } - %struct.XXPixelFormat = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 } - %struct.XXPixelMap = type { i32*, float*, float*, float*, float*, float*, float*, float*, float*, i32*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 } - %struct.XXPixelMode = type { float, float, %struct.XXPixelStore, %struct.XXPixelTransfer, %struct.XXPixelMap, %struct.XXImagingSubset, i32, i32 } - %struct.XXPixelPack = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8 } - %struct.XXPixelStore = type { %struct.XXPixelPack, %struct.XXPixelPack } - %struct.XXPixelTransfer = type { float, float, float, float, float, float, float, float, float, float, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float } - %struct.XXPluginBufferData = type { i32 } - %struct.XXPluginFramebufferData = type { [10 x %struct.XXTextureRec*], i32, i32 } - %struct.XXPluginProgramData = type { [3 x %struct.XXPipelineProgramRec*], %struct.XXBufferRec**, i32 } - %struct.XXPluginState = type { [16 x [5 x %struct.XXTextureRec*]], [3 x %struct.XXTextureRec*], [3 x %struct.XXPipelineProgramRec*], %struct.XXProgramRec*, %struct.XXVArrayRec*, [16 x %struct.XXBufferRec*], %struct.XXFramebufferRec*, %struct.XXFramebufferRec* } - %struct.XXPluginVArrayData = type { [32 x %struct.XXBufferRec*], %struct.XXBufferRec*, { i64 } } - %struct.XXPointLineLimits = type { float, float, float } - %struct.XXPointMode = type { float, float, float, float, %struct.XXPointLineLimits, float, i8, i8, i8, i8, i16, i16, i32, i16, i16 } - %struct.XXPolygonMode = type { [128 x i8], float, float, i16, i16, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8 } - %struct.XXProgramData = type { i32, i32, i32, i32, %struct.PPStreamToken*, i32*, i32, i32, i32, i32, i8, i8, i8, i8 } - %struct.XXProgramLimits = type { i32, i32, i32 } - %struct.XXProgramRec = type { %struct.XXProgramData*, %struct.XXPluginProgramData*, %struct.GGC4**, i32 } - %struct.XXQueryRec = type { i32, i32, %struct.XXQueryRec* } - %struct.XXRect = type { i32, i32, i32, i32, i32, i32 } - %struct.XXRegisterCombiners = type { i8, i8, i8, i8, i32, [2 x %struct.GGC4], [8 x %struct.XXRegisterCombinersPerStageState], %struct.XXRegisterCombinersFinalStageState } - %struct.XXRegisterCombinersFinalStageState = type { i8, i8, i8, i8, [7 x %struct.XXRegisterCombinersPerVariableState] } - %struct.XXRegisterCombinersPerPortionState = type { [4 x %struct.XXRegisterCombinersPerVariableState], i8, i8, i8, i8, i16, i16, i16, i16, i16, i16 } - %struct.XXRegisterCombinersPerStageState = type { [2 x %struct.XXRegisterCombinersPerPortionState], [2 x %struct.GGC4] } - %struct.XXRegisterCombinersPerVariableState = type { i16, i16, i16, i16 } - %struct.XXRenderDispatch = type { void (%struct.XXContextRec*, i32, float)*, void (%struct.XXContextRec*, i32)*, i8 (%struct.XXContextRec*, i32, i32, i32, i32, i32, i32, i8*, i8 zeroext , %struct.XXBufferRec*) zeroext *, i8 (%struct.XXContextRec*, %struct.XXV*, i32, i32, i32, i32, i8*, i8 zeroext , %struct.XXBufferRec*) zeroext *, void (%struct.XXContextRec*, %struct.XXV*, i32, i32, i32, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32, float, float, i8*, i8 zeroext )*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, ! i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV*, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV**, i32)*, void (%struct.XXContextRec*, %struct.XXV**, i32, i32)*, void (%struct.XXContextRec*, %struct.XXV**, i32, i32)*, void (%struct.XXContextRec*, i8*, i32, i32, i32, i32, i8*)*, i8* (%struct.XXContextRec*, i32, i32*)*, void (%struct.XXContextRec*, i32, i32, i32)*, i8* (%struct.XXContextRec*, i32, i32, i32, i32, i32)*, void (%struct.XXContextRec*, i32, i32, i32, i32, i32, i8*)*, void (%struct.XXContextRec*)*, void (%struct.XXContextRec*)*, void (%struct.XXContextRec*)*, void (%struct.XXContextRec*, %struct.XXFenceRec*)*, void (%struct.XXContextRec*, i32, %struct.XXQueryRec*)*, void (%struct.XXContextRec*, %struct.XXQueryRec*)*, i8 (%struct.XXContex! tRec*, i32, i32, i32, i32, i32, i8*, %struct.GGC4*, %struct.XX! Current1 6A*) zeroext *, i8 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32, i32, i32, i32, i32, i32, i32, i32) zeroext *, i8 (%struct.XXContextRec*, %struct.XXTextureRec*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8 zeroext , %struct.XXBufferRec*) zeroext *, i8 (%struct.XXContextRec*, %struct.XXTextureRec*, i32) zeroext *, i8 (%struct.XXContextRec*, %struct.XXBufferRec*, i32, i32, i8*) zeroext *, void (%struct.XXContextRec*, i32)*, void (%struct.XXContextRec*)*, void (%struct.XXContextRec*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)* } - %struct.XXRenderFeatures = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 } - %struct.XXScissorTest = type { %struct.XXFramebufferAttachment, i8, i8, i8, i8 } - %struct.XXSharedRec = type { %struct.pthread_mutex_t, i32 } - %struct.XXState = type { i16, i16, i16, i16, i32, i32, [256 x %struct.GGC4], [128 x %struct.GGC4], %struct.XXViewport, %struct.XXXf, %struct.XXLightModel, %struct.XXTextureTargets, %struct.XXAlphaTest, %struct.XXBlendMode, %struct.XXClearC, %struct.XXCBuffer, %struct.XXDepthTest, %struct.XXArrayRange, %struct.XXFogMode, %struct.XXHintMode, %struct.XXLineMode, %struct.XXLogicOp, %struct.XXMaskMode, %struct.XXPixelMode, %struct.XXPointMode, %struct.XXPolygonMode, %struct.XXScissorTest, i32, %struct.XXStencilTest, [8 x %struct.XXTextureMode], [8 x %struct.XXTextureMode], [16 x %struct.XXTextureImageMode], %struct.XXArrayRange, [8 x %struct.XXTextureCoordGen], %struct.XXClipPlane, %struct.XXMultisample, %struct.XXRegisterCombiners, %struct.XXArrayRange, %struct.XXArrayRange, [3 x %struct.XXPipelineProgramState], %struct.XXXfFeedback, i32*, %struct.XXFixedFunctionProgram, [3 x i32] } - %struct.XXStencilTest = type { [3 x { i32, i32, i16, i16, i16, i16 }], i32, [4 x i8] } - %struct.XXStippleData = type { i32, i16, i16, [32 x [32 x i8]] } - %struct.XXTextureCoordGen = type { { i16, i16, %struct.GGC4, %struct.GGC4 }, { i16, i16, %struct.GGC4, %struct.GGC4 }, { i16, i16, %struct.GGC4, %struct.GGC4 }, { i16, i16, %struct.GGC4, %struct.GGC4 }, i8, i8, i8, i8 } - %struct.XXTextureGeomState = type { i16, i16, i16, i16, i16, i8, i8, i8, i8, i16, i16, i16, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, [6 x i16], [6 x i16] } - %struct.XXTextureImageMode = type { float } - %struct.XXTextureLevel = type { i32, i32, i16, i16, i16, i8, i8, i16, i16, i16, i16, i8* } - %struct.XXTextureLimits = type { float, float, i16, i16, i16, i16, i16, i16, i16, i16, i16, i8, i8, [8 x i32], i32 } - %struct.XXTextureMode = type { %struct.GGC4, i32, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, float, float, i16, i16, i16, i16, i16, i16, [4 x i16], i8, i8, i8, i8, [3 x float], [4 x float], float, float } - %struct.XXTextureParamState = type { i16, i16, i16, i16, i16, i16, %struct.GGC4, float, float, float, float, i16, i16, i16, i16, float, i16, i8, i8, i32, i8* } - %struct.XXTextureRec = type { [4 x float], %struct.XXTextureState*, %struct.XXMipmaplevel*, %struct.XXMipmaplevel*, float, float, float, float, i32, i32, i32, i32, i32, i32, i32, [2 x %struct.PPStreamToken] } - %struct.XXTextureState = type { i16, i8, i8, i16, i16, float, i32, %struct.GGSWRSurface*, %struct.XXTextureParamState, %struct.XXTextureGeomState, %struct.XXTextureLevel, [6 x [15 x %struct.XXTextureLevel]] } - %struct.XXTextureTargets = type { i64, i64, i64, i64, i64, i64 } - %struct.XXXf = type { [24 x [16 x float]], [24 x [16 x float]], [16 x float], float, float, float, float, float, i8, i8, i8, i8, i32, i32, i32, i16, i16, i8, i8, i8, i8, i32 } - %struct.XXXfFeedback = type { i8, i8, i8, i8, [16 x i32], [16 x i32] } - %struct.XXXfFeedbackLimits = type { i32, i32, i32, i32, i32 } - %struct.XXV = type { %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.XXPointLineLimits, float, %struct.GGC4, float, float, float, i8, i8, i8, i8, i32, i32, i32, i32, [4 x float], [2 x %struct.XXMaterial*], i32, i32, [8 x %struct.GGC4] } - %struct.XXVArrayData = type { [32 x %struct.XXVArrayElement], { i64 }, { i64 }, i16, i16, i32, i8*, i8, i8, i8, i8 } - %struct.XXVArrayElement = type { i8*, i8*, i32, i16, i8, i8 } - %struct.XXVArrayRec = type opaque - %struct.XXVArrayTypes = type { i16, i16, i16, i16, i16, i16 } - %struct.XXVDescriptor = type { i8, i8, i8, i8, [0 x i32] } - %struct.XXVProgramLimits = type { i16, i16 } - %struct.XXViewport = type { float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, double, double, i32, i32, i32, i32, float, float, float, float } - %struct.XXViewportConfig = type { %struct.GLGXfKey, %struct.GLGXfKey, %struct.GLGXfKey } - %struct.GLEEnableHashObject = type { i32, void (%struct.__GGContextRec*, i32, i32)*, %struct.GLEEnableHashObject*, i8* } - %struct.GLEPContextData = type { %struct.XXContextRec*, %struct.XXConfig, %struct.XXPluginState, %struct.GLEPPlugin*, i32 } - %struct.GLEPPlugin = type { %struct.GLEPPlugin*, [256 x i8], i8*, i32, i32, %struct.XXDispatch } - %struct.GLGCTable = type { i32, i32, i32, i8* } - %struct.GLGOperation = type { i8*, i8*, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, %struct.GLGCTable, %struct.GLGCTable, %struct.GLGCTable } - %struct.GLGProcessor = type { void (%struct.XXPixelMode*, %struct.GLGOperation*, %struct._GLGFunctionKey*)*, %struct._LLFunction*, %struct._GLGFunctionKey* } - %struct.GLGXfKey = type { i32, i32 } - %struct.GGAttrib = type { %struct.GGAttribPixelMode } - %struct.GGAttribPixelMode = type { float, float, i32, %struct.GGPixelTransfer, %struct.GGPixelMap } - %struct.GGClientAttrib = type { %struct.GGClientAttribVArray } - %struct.GGClientAttribVArray = type { [32 x %struct.GLGCTable], i16, i16, i32, i8*, i32, i32, i32, [32 x i32], i32, i32, i32, i8*, i32, i32, i32, i32 } - %struct.GGC4 = type { float, float, float, float } - %struct.GGPixelFormat = type { %struct.GGPixelFormat*, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i32, i8, i8, i8, i8, i32 } - %struct.GGPixelMap = type { [256 x i32], [256 x float], [256 x float], [256 x float], [256 x float], [256 x float], [256 x float], [256 x float], [256 x float], [256 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8 } - %struct.GGPixelTransfer = type { float, float, float, float, float, float, float, float, float, float, i32, i32 } - %struct.GGRendererInfo = type { %struct.GGRendererInfo*, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i16, i8, i8, i32, i32, i32 } - %struct.GGSWRSurface = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8*, i8*, i8*, [4 x i8*], i32 } - %struct.GLSBuffer = type { i8* } - %struct.GLSDrawable = type { %struct.GLSWindowRec* } - %struct.GLSWindowRec = type { %struct.GLGXfKey, %struct.GLGXfKey, i32, i32, %struct.GLSDrawable, [2 x i8*], i8*, i8*, i8*, [4 x i8*], i32, i32, i32, i32, [4 x i32], i16, i16, i16, i8, i8, %struct.XXProgramLimits, i32, i32, i8*, i8* } - %struct.GLTCoord2 = type { float, float } - %struct.LLFPContext = type { float, i32, i32, i32, float, [3 x float] } - %struct.LLFragmentAttrib = type { <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, [8 x <4 x float>] } - %struct.LLProgramData = type { %struct._LLFunction*, %struct.LLProgramData*, %struct.LLProgramData*, [64 x i32], i32, i32 } - %struct.LLSubmitKey = type { %struct.GLGXfKey } - %struct.LLTextures = type { [16 x %struct.XXTextureRec*] } - %struct.LFSStream = type { %struct.LFSStreamChunkList*, { %struct.LFSStreamChunkList*, %struct.LFSStreamChunkList* }, { %struct.LFSStreamChunkList*, %struct.LFSStreamChunkList* }, %struct.LFSStreamChunkList* } - %struct.LFSStreamChunk = type { i8, i8, i8, i8, { %struct.LFSStreamOperation }, i8*, i8* } - %struct.LFSStreamChunkList = type { %struct.LFSStreamChunk*, %struct.LFSStreamChunk*, i32 } - %struct.LFSStreamOperation = type { i32, %struct.XXFramebufferAttachment, [3 x %struct.XXFramebufferAttachment] } - %struct.PPStreamToken = type { { i16, i16, i32 } } - %struct._GLGFunctionKey = type { %struct.LLSubmitKey } - %struct._GLPHashMachine = type opaque - %struct._GLPHashObject = type opaque - %struct._LLConstants = type { <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, float, float, float, float, float, float, float, float, float, float, float, float, [256 x float], [528 x i8] } - %struct._LLFunction = type opaque - %struct.__GGContextRec = type { %struct.__GLconstants16A, %struct.__GLviewport16A, %struct.XXCurrent16A, %struct.__GLlightmodel16A, [8 x i32], [32 x i32], [32 x i32], [32 x i32], [8 x i32], [8 x i32], %struct.XXState, %struct.__GLglobals16A*, [3 x %struct.__GLindexoffsets*], [16 x float]*, %struct.__GLmatrixidentifiers, %struct.GLEEnableHashObject*, %struct.XXPluginBufferData, %struct.XXPluginBufferData, %struct.LLTextures, %struct.GLGProcessor, %struct.__GLVmachine, %struct.__GLVarray, %struct.__GLVarraymachine, %struct.__GLinterpolate, %struct.__GLprimitive, %struct.__GLviewport, i32, %struct.__GLhashobject*, %struct.__GLhashobject*, %struct.__GLhashobject*, %struct.__GLtransform_feedback, %struct.__GLhashobject*, %struct.__GLclipplane, %struct.__GLselect, %struct.__GLfeedback, %struct.XXArrayRange, %struct.XXLogicOp, %struct.__GLmatrixmachine, %struct.__GLattribmachine, %struct.__GLshared*, %struct.__GLtexturemachine, %struct.__GLlistmachine, %struct.__GLpipelineprogram! machine, %struct.__GLshadermachine, %struct.__GLmachineshared, %struct.__GLquerymachine, %struct.__GLcurrentindex, %struct.__GLcmdbufmachine, %struct.__GLclientState, %struct.__GLeval, %struct.__GLmapdata*, %struct.__GLcoefficients*, %struct.__GLdrawpixelsobject, %struct.__GLorphanlist, %struct.__GLorphanlist*, %struct.__GLhashobject*, %struct.__GLhashobject*, %struct.__GLhashobject*, i8*, i8*, %struct.XXRenderDispatch*, i8*, i8*, i16, i8, i8, i32, i32, i32, i32, i32, i32, i32, [1 x i32], %struct.XXContextRec*, %struct.XXConfig*, %struct.XXRenderDispatch, %struct.XXViewportConfig, %struct.XXMinmaxTable, %struct.XXDispatch, i8*, i32, i32, %struct.__GGContextRec*, [4096 x i8], i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, [2 x i32], [0 x %struct.GLEPContextData] } - %struct.__GLarrayelementDrawInfoListType = type { i32, [32 x i8] } - %struct.__GLattriblink = type { i32, %struct.GGAttrib, %struct.__GLattriblink* } - %struct.__GLattribmachine = type { [16 x %struct.__GLattriblink*], %struct.__GLattriblink**, [16 x %struct.__GLclientattriblink*], %struct.__GLclientattriblink**, i32, i32 } - %struct.__GLbufferobjectclient = type { %struct.XXBufferData, i8, i8, i8, i8, i32, i8, i8, i8, i8, %struct.__GLhashobject* } - %struct.__GLclientState = type { %struct.__GLVarrayobjectclient*, %struct.__GLVarrayobjectclient*, %struct.__GLbufferobjectclient*, %struct.__GLbufferobjectclient*, %struct.__GLbufferobjectclient*, %struct.__GLbufferobjectclient*, i16, i16, i32, %struct.XXPixelMode, %struct.__GLmachineshared, %struct.__GLmachineshared, %struct.__GLpagehashuint32* } - %struct.__GLclientattriblink = type { i32, %struct.GGClientAttrib, %struct.__GLclientattriblink* } - %struct.__GLclipplane = type { i32, [6 x i32], i8, i8, i8, i8 } - %struct.__GLcmdbufmachine = type { i32, i32, %struct.__GLcommandbuf*, %struct.__GLcommandbuf*, %struct.__GLcommandbuf* (%struct.__GGContextRec*, i32)*, [32 x %struct.__GLcommandbuf*], i32, i8*, i8*, i8*, i8*, %struct._opaque_pthread_t*, %struct.pthread_mutex_t, %struct.pthread_mutex_t, %struct.pthread_mutex_t, %struct.pthread_mutex_t, %struct.pthread_cond_t, %struct.pthread_cond_t, %struct.pthread_cond_t, %struct.pthread_mutex_t, %struct.pthread_cond_t, i32, i32, i32, i8, i8, i8, i8 } - %struct.__GLcoefficients = type { float, float, i32, i32, i32, i32, [10 x float], [10 x float], [10 x float], [10 x float] } - %struct.__GLcommandbuf = type { %struct.__GLcommandelem*, %struct.__GLcommandelem*, i32, [0 x i8] } - %struct.__GLcommandelem = type { i32 (%struct.__GGContextRec*, i8*)*, i32, [0 x i8] } - %struct.__GLconstants16A = type { [4 x i32], [4 x i32], [4 x float], [4 x i32], [4 x i32], [4 x i32], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], [4 x float], float, float, float, float, float, float, float, float, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, <4 x float>, i8*, i8*, i8*, %struct._LLConstants* } - %struct.__GLcurrentindex = type { float, [2 x %struct.XXPointLineLimits] } - %struct.__GLdrawpixelsobject = type { i32, i32, i32, i32, i32, i32, %struct.__GLhashobject**, i8* } - %struct.__GLeval = type { %struct.__GLmapgrid1, %struct.__GLmapgrid2, i32, i32, %struct.__GLarrayelementDrawInfoListType, %struct.__GLarrayelementDrawInfoListType, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 } - %struct.__GLfeedback = type { float*, float*, i32, i32, i8, i8, i8, i8 } - %struct.__GLfragmentprogram = type { %struct.LFSStream*, i32, i16, i16, i16, i16 } - %struct.__GLglobals16A = type { [256 x float], [48 x i8] } - %struct.__GLhashallocation = type { %struct.__GLhashallocation*, i32, i32 } - %struct.__GLhashcommon = type { %struct.__GLhashobject*, i8*, void (%struct.__GGContextRec*, %struct.__GLhashobject*)*, i32, i32, i32 } - %struct.__GLhashobject = type { %struct.__GLhashcommon, { %struct.__GLprogram } } - %struct.__GLindexoffsets = type { [1024 x i16], [256 x i16], [8 x %struct.XXHintMode], [8 x [2 x { i16, i16, i16 }]], [2 x %struct.XXVArrayTypes], [8 x [4 x i16]], [8 x [4 x i16]], [8 x i16], [6 x i16], i16, i16, i16, i16, i16, i16, i16, [24 x [4 x i16]], [24 x [4 x i16]], [24 x [4 x i16]], [24 x [4 x i16]], i16 } - %struct.__GLinterpolate = type { void (%struct.__GGContextRec*, %struct.__GLV*, %struct.__GLV*, %struct.__GLV*, float)*, i8 (%struct.__GGContextRec*, %struct.__GLV*, %struct.__GLV*, %struct.__GLV*, i8 zeroext ) zeroext *, %struct._LLFunction*, %struct._LLFunction*, i32, i32 } - %struct.__GLlight = type { float, float, float, float, float, float, i8, i8, i8, i8, i8, i8, i8, i8, [11 x float], float } - %struct.__GLlightmodel16A = type { [8 x %struct.__GLlight], [2 x %struct.__GLmaterial*], %struct.__GLmaterial*, i32, i8, i8, i8, i8, i32, void (%struct.__GGContextRec*, %struct.GGC4*)*, void (%struct.__GGContextRec*, %struct.__GLV*)*, [2 x void (%struct.__GGContextRec*, %struct.__GLV*, i32)*], [2 x void (%struct.__GGContextRec*, %struct.__GLV**, i32)*] } - %struct.__GLlistmachine = type { %struct.__GLhashobject*, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, %struct.__GLhashobject* } - %struct.__GLmachineshared = type { %struct.__GLhashobject**, %struct.__GLhashallocation*, i32, i32 } - %struct.__GLmap1color = type { i32, float, float, float, [10 x %struct.GGC4] } - %struct.__GLmap1index = type { i32, float, float, float, [10 x float] } - %struct.__GLmap1normal = type { i32, float, float, float, [10 x %struct.XXPointLineLimits] } - %struct.__GLmap1texture1 = type { i32, float, float, float, [10 x %struct.XXTextureImageMode] } - %struct.__GLmap1texture2 = type { i32, float, float, float, [10 x %struct.GLTCoord2] } - %struct.__GLmap1VattribN = type { %struct.__GLmap1color } - %struct.__GLmap2color = type { i32, i32, float, float, float, float, float, float, [100 x %struct.GGC4] } - %struct.__GLmap2index = type { i32, i32, float, float, float, float, float, float, [100 x float] } - %struct.__GLmap2normal = type { i32, i32, float, float, float, float, float, float, [100 x %struct.XXPointLineLimits] } - %struct.__GLmap2texture1 = type { i32, i32, float, float, float, float, float, float, [100 x %struct.XXTextureImageMode] } - %struct.__GLmap2texture2 = type { i32, i32, float, float, float, float, float, float, [100 x %struct.GLTCoord2] } - %struct.__GLmap2VattribN = type { %struct.__GLmap2color } - %struct.__GLmapdata = type { %struct.__GLmap1normal, %struct.__GLmap1color, %struct.__GLmap1normal, %struct.__GLmap1color, %struct.__GLmap1index, %struct.__GLmap1texture1, %struct.__GLmap1texture2, %struct.__GLmap1normal, %struct.__GLmap1color, %struct.__GLmap2normal, %struct.__GLmap2color, %struct.__GLmap2normal, %struct.__GLmap2color, %struct.__GLmap2index, %struct.__GLmap2texture1, %struct.__GLmap2texture2, %struct.__GLmap2normal, %struct.__GLmap2color, [16 x %struct.__GLmap1VattribN], [16 x %struct.__GLmap2VattribN], [16 x i8], [16 x i8] } - %struct.__GLmapgrid1 = type { i32, float, float, float } - %struct.__GLmapgrid2 = type { i32, float, float, float, i32, float, float, float } - %struct.__GLmaterial = type { %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, float, float, float, float, [8 x %struct.XXLightProduct], %struct.GGC4, i32, i32, %struct.__GLsum, %struct.__GLmaterial*, %struct.__GLmaterial* } - %struct.__GLmatrixidentifiers = type { i32, i32, i32, i32, [8 x i32] } - %struct.__GLmatrixmachine = type { [16 x float]*, [16 x float]*, i32*, [24 x i32], i16 (%struct.__GGContextRec*, %struct.__GLV*, i32) zeroext *, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, i16 (%struct.__GGContextRec*, %struct.__GLV*, i32) zeroext *, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, void (%struct.__GGContextRec*, %struct.__GLV*, i32)*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, i32, i32, [3 x i32], [3 x i32], i32, i32, [3 x i32], [3 x i32], i32, i32, i32, i8, i8, i8, i8 } - %struct.__GLmemoryobject = type { i8*, i32, i16, i8, i8, i32, [0 x i8*] } - %struct.__GLorphanlist = type { i32, i32, i32, i32, %struct.__GLorphannode*, %struct.__GLorphannode } - %struct.__GLorphannode = type { %struct.__GLorphannode*, %struct.__GLorphannode*, %struct.__GLorphannode*, %struct.__GLorphannode*, %struct.__GLmemoryobject } - %struct.__GLpagehashlistuint32 = type { %struct.__GLpagehashnodeuint32*, %struct.__GLpagehashnodeuint32* } - %struct.__GLpagehashnodeuint32 = type { %struct.__GLpagehashnodeuint32*, %struct.__GLpagehashnodeuint32*, i32, [5 x i32], [0 x i8] } - %struct.__GLpagehashuint32 = type { i32, i32, i32, %struct.__GLpagehashlistuint32** } - %struct.__GLpipelineprogram = type { %struct.__GLpipelineprogramcommon, { %struct.__GLfragmentprogram } } - %struct.__GLpipelineprogramcommon = type { [8 x %struct.XXPipelineProgramRec*], %struct.LLProgramData*, i8*, i32, i32, i32, [32 x i32], i8, i8, i16, i16, i16, i16, i16, i16, i16, %struct.__GLindexoffsets, %struct.XXPipelineProgramData } - %struct.__GLpipelineprogrammachine = type { i8*, i16 (%struct.__GGContextRec*, %struct.__GLV*, i32) zeroext *, %struct._LLFunction*, %struct.PPStreamToken*, %struct.GGC4*, i16 (%struct.__GGContextRec*, %struct.__GLV*, i32) zeroext *, %struct._LLFunction*, %struct.PPStreamToken*, %struct.GGC4*, [3 x %struct.__GLhashobject*], [3 x %struct.__GLhashobject*], [3 x %struct.__GLpipelineprogram*], [3 x %struct._GLPHashMachine*], [3 x %struct._GLPHashObject*], i32, i8, i8, i8, i8, i16, i16, [4 x i8] } - %struct.__GLprimitive = type { [14 x void (%struct.__GGContextRec*)*], void (%struct.__GGContextRec*)*, void (%struct.__GGContextRec*)*, void (%struct.__GGContextRec*)*, i16, i16, i32, i8, i8, i8, i8, i32 } - %struct.__GLprogram = type { [8 x %struct.XXProgramRec*], i8*, %struct.GGC4*, i8*, %struct.__GLhashobject**, [3 x %struct.__GLshadercompilelink], i32, i32, i32, i32, i32, i32, %struct.__GLhashobject**, i32*, %struct.GGC4**, i32, i32, %struct.XXProgramData, i32, i32, i32, i32, i32, i8, i8, i8, i8, i32, i32, %struct.PPStreamToken*, [0 x %struct.XXPluginProgramData] } - %struct.__GLquerymachine = type { %struct.__GLmachineshared, %struct.__GLhashobject*, %struct.__GLhashobject*, %struct.__GLhashobject*, i32, i32, i32 } - %struct.__GLselect = type { i32*, i32*, [128 x i32], i32*, i32*, i32, i32, i8, i8, i8, i8 } - %struct.__GLshadercompilelink = type { i32, i8, i8, i8, i8, i32, [32 x i32], [16 x i32], [16 x i16], %struct.PPStreamToken*, %struct.LLProgramData*, i32*, %struct.XXPipelineProgramData, %struct.__GLindexoffsets } - %struct.__GLshadermachine = type { %struct.__GLhashobject*, float**, float**, i32 } - %struct.__GLshared = type { [8 x %struct.__GLmachineshared], i32, i32, i8, i8, i8, i8, %struct.pthread_mutex_t, [8 x %struct.XXSharedRec*] } - %struct.__GLsum = type { %struct.XXPointLineLimits, i8, i8, i8, i8 } - %struct.__GLtexturemachine = type { [16 x [5 x %struct.__GLhashobject*]], [5 x %struct.__GLhashobject*], [5 x %struct.__GLhashobject*], [3 x %struct.__GLhashobject*], [3 x %struct.__GLhashobject*], i64, i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8 } - %struct.__GLtransform_feedback = type { [16 x %struct.__GLhashobject*], i16, i16 } - %struct.__GLV = type { %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.GGC4, %struct.XXPointLineLimits, float, %struct.GGC4, float, float, float, i8, i8, i8, i8, i32, i32, i32, i32, [4 x float], [2 x %struct.__GLmaterial*], i32, i32, [8 x %struct.GGC4] } - %struct.__GLVarray = type { i8*, i8*, %struct.__GLarrayelementDrawInfoListType*, i8*, %struct.__GLhashobject*, [32 x i8*], i8*, i32, i32, i32, i32, i32, i16, i16, i32, i32 } - %struct.__GLVarraymachine = type { %struct.__GLhashobject*, %struct.__GLhashobject* } - %struct.__GLVarrayobjectclient = type { %struct.__GLbufferobjectclient*, %struct.__GLbufferobjectclient*, [32 x %struct.__GLbufferobjectclient*], i64, i64, %struct.XXVArrayData, %struct.__GLhashobject* } - %struct.__GLVmachine = type { %struct.__GLV*, %struct.__GLV*, %struct.__GLV*, %struct.__GLV*, %struct.__GLV*, i8*, i8*, %struct.__GLV*, %struct.__GLV**, %struct.__GLV**, %struct.__GLV**, %struct.__GLV**, %struct.__GLV**, i32, i32, i32, i32, i32, i16, i16, i16, i16, void (%struct.__GGContextRec*, float, float, float, float, %struct.__GLV*)*, void (%struct.__GGContextRec*, float, float, float, float, %struct.__GLV*)*, void (%struct.__GGContextRec*, i32)*, void (%struct.__GGContextRec*, i32)*, void (%struct.__GGContextRec*, i8*, i8*, i32)*, void (%struct.__GGContextRec*, i8*, i32)*, void (%struct.__GGContextRec*, i32)*, void (%struct.__GGContextRec*, i32)*, void (%struct.__GGContextRec*, i32)*, void (%struct.__GGContextRec*, i32)*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, %struct._LLFunction*, i32*, i32*, i32*, i32*, i32*, i32*, i32*, i32*, i3! 2*, [32 x i8], [32 x i8], %struct.XXVDescriptor*, %struct.XXVDescriptor* } - %struct.__GLviewport = type { float, float, float, float, float } - %struct.__GLviewport16A = type { float, float, float, float, float, float, float, float, float, float, float, float } - %struct.__darwin_pthread_handler_rec = type { void (i8*)*, i8*, %struct.__darwin_pthread_handler_rec* } - %struct._opaque_pthread_t = type { i32, %struct.__darwin_pthread_handler_rec*, [596 x i8] } - %struct.pthread_cond_t = type { i32, [24 x i8] } - %struct.pthread_mutex_t = type { i32, [40 x i8] } - -define i16 @f(%struct.__GGContextRec* %ctx, %struct.__GLV* %stack, i32 %num_vtx) { +define i16 @f(<4 x float>* %tmp116117.i1061.i) { entry: alloca [4 x <4 x float>] ; <[4 x <4 x float>]*>:0 [#uses=167] alloca [4 x <4 x float>] ; <[4 x <4 x float>]*>:1 [#uses=170] alloca [4 x <4 x i32>] ; <[4 x <4 x i32>]*>:2 [#uses=12] - %tmp3 = getelementptr %struct.__GGContextRec* %ctx, i32 0, i32 42, i32 3 ; <%struct.PPStreamToken**> [#uses=1] - %tmp4 = load %struct.PPStreamToken** %tmp3 ; <%struct.PPStreamToken*> [#uses=13] %.sub6235.i = getelementptr [4 x <4 x float>]* %0, i32 0, i32 0 ; <<4 x float>*> [#uses=76] %.sub.i = getelementptr [4 x <4 x float>]* %1, i32 0, i32 0 ; <<4 x float>*> [#uses=59] - %tmp116117.i1061.i = bitcast %struct.PPStreamToken* %tmp4 to <4 x float>* ; <<4 x float>*> [#uses=1] %tmp124.i1062.i = getelementptr <4 x float>* %tmp116117.i1061.i, i32 63 ; <<4 x float>*> [#uses=1] %tmp125.i1063.i = load <4 x float>* %tmp124.i1062.i ; <<4 x float>> [#uses=5] %tmp828.i1077.i = shufflevector <4 x float> %tmp125.i1063.i, <4 x float> undef, <4 x i32> < i32 1, i32 1, i32 1, i32 1 > ; <<4 x float>> [#uses=4] From dpatel at apple.com Tue Sep 18 17:59:45 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 18 Sep 2007 15:59:45 -0700 Subject: [llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll In-Reply-To: <20070918223806.GY10864@village.us.cray.com> References: <20070918223806.GY10864@village.us.cray.com> Message-ID: <88BE3A66-AC64-417B-AC95-3D9F1B40C81B@apple.com> On Sep 18, 2007, at 3:38 PM, Dan Gohman wrote: > Ok, so let's tweak the testcase again: > > define i32 @foo(%struct.decision* %p, %struct.decision* %q) { > entry: > br label %blah.i > > blah.i: ; preds = %cond_true.i, %entry > %tmp3.i = icmp eq %struct.decision* null, %q ; > [#uses=1] > br i1 %tmp3.i, label %clear_modes.exit, label %cond_true.i > > cond_true.i: ; preds = %blah.i > %tmp1.i = getelementptr %struct.decision* %p, i32 0, i32 > 0 ; [#uses=1] > store i8 0, i8* %tmp1.i > br label %blah.i > > clear_modes.exit: ; preds = %blah.i > call void @exit( i32 0 ) > unreachable > } > > declare void @exit(i32) > > > It's no longer possible for any part of the optimizer to prove the > loop > is dead. LICM is still putting a load of %tmp1.i in the entry block > for > this test, and that's unsafe. Exactly, that's what I meant to say when I said "when loop conditionals are runtime dependent". To ensure safety in PromoteValuesInLoop(), one needs to prove that basic-block is executed at least once. The question is how ? - Devang From dpatel at apple.com Tue Sep 18 18:58:14 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 18 Sep 2007 23:58:14 -0000 Subject: [llvm-commits] [llvm] r42118 - /llvm/trunk/lib/Analysis/LoopPass.cpp Message-ID: <200709182358.l8INwEn1007997@zion.cs.uiuc.edu> Author: dpatel Date: Tue Sep 18 18:58:14 2007 New Revision: 42118 URL: http://llvm.org/viewvc/llvm-project?rev=42118&view=rev Log: ooops... Modified: llvm/trunk/lib/Analysis/LoopPass.cpp Modified: llvm/trunk/lib/Analysis/LoopPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=42118&r1=42117&r2=42118&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopPass.cpp (original) +++ llvm/trunk/lib/Analysis/LoopPass.cpp Tue Sep 18 18:58:14 2007 @@ -222,7 +222,7 @@ StartPassTimer(P); LoopPass *LP = dynamic_cast(P); assert (LP && "Invalid LPPassManager member"); - LP->runOnLoop(CurrentLoop, *this); + Changed |= LP->runOnLoop(CurrentLoop, *this); StopPassTimer(P); if (Changed) From dpatel at apple.com Tue Sep 18 19:08:14 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 19 Sep 2007 00:08:14 -0000 Subject: [llvm-commits] [llvm] r42119 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709190008.l8J08ELR008628@zion.cs.uiuc.edu> Author: dpatel Date: Tue Sep 18 19:08:13 2007 New Revision: 42119 URL: http://llvm.org/viewvc/llvm-project?rev=42119&view=rev Log: Work is incomplete. Loop is not modified at all right now. 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=42119&r1=42118&r2=42119&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Tue Sep 18 19:08:13 2007 @@ -868,7 +868,7 @@ updateLoopBounds(Op0); updateLoopBounds(Op1); // Update CFG - return true; + return false; } From dpatel at apple.com Tue Sep 18 19:11:06 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 19 Sep 2007 00:11:06 -0000 Subject: [llvm-commits] [llvm] r42120 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709190011.l8J0B6Be008881@zion.cs.uiuc.edu> Author: dpatel Date: Tue Sep 18 19:11:01 2007 New Revision: 42120 URL: http://llvm.org/viewvc/llvm-project?rev=42120&view=rev Log: Bail out early, before modifying anything. 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=42120&r1=42119&r2=42120&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Tue Sep 18 19:11:01 2007 @@ -542,6 +542,11 @@ if (!safeSplitCondition(SD)) return false; + BasicBlock *Latch = L->getLoopLatch(); + BranchInst *BR = dyn_cast(Latch->getTerminator()); + if (!BR) + return false; + // Update CFG. // Replace index variable with split value in loop body. Loop body is executed @@ -549,11 +554,7 @@ IndVar->replaceAllUsesWith(SD.SplitValue); // Remove Latch to Header edge. - BasicBlock *Latch = L->getLoopLatch(); BasicBlock *LatchSucc = NULL; - BranchInst *BR = dyn_cast(Latch->getTerminator()); - if (!BR) - return false; Header->removePredecessor(Latch); for (succ_iterator SI = succ_begin(Latch), E = succ_end(Latch); SI != E; ++SI) { From dpatel at apple.com Tue Sep 18 19:15:16 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 19 Sep 2007 00:15:16 -0000 Subject: [llvm-commits] [llvm] r42121 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709190015.l8J0FG9T009077@zion.cs.uiuc.edu> Author: dpatel Date: Tue Sep 18 19:15:16 2007 New Revision: 42121 URL: http://llvm.org/viewvc/llvm-project?rev=42121&view=rev Log: Filter loops where split condition's false branch is not empty. For example for (int i = 0; i < N; ++i) { if (i == somevalue) dosomething(); else dosomethingelse(); } 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=42121&r1=42120&r2=42121&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Tue Sep 18 19:15:16 2007 @@ -528,6 +528,10 @@ if (!safeExitingBlock(SD, ExitCondition->getParent())) return false; + // Filter loops where split condition's false branch is not empty. + if (ExitCondition->getParent() != Header->getTerminator()->getSuccessor(1)) + return false; + // If split condition is not safe then do not process this loop. // For example, // for(int i = 0; i < N; i++) { From dpatel at apple.com Tue Sep 18 19:28:48 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 19 Sep 2007 00:28:48 -0000 Subject: [llvm-commits] [llvm] r42122 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709190028.l8J0SmRh009630@zion.cs.uiuc.edu> Author: dpatel Date: Tue Sep 18 19:28:47 2007 New Revision: 42122 URL: http://llvm.org/viewvc/llvm-project?rev=42122&view=rev Log: Relax loop ExitCondition predicate restriction. 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=42122&r1=42121&r2=42122&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Tue Sep 18 19:28:47 2007 @@ -356,11 +356,7 @@ return; // FIXME - 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 + if (CI->getPredicate() == ICmpInst::ICMP_EQ || CI->getPredicate() == ICmpInst::ICMP_NE) return; @@ -1015,6 +1011,12 @@ Value *AEV = SD.SplitValue; Value *BSV = SD.SplitValue; + if (ExitCondition->getPredicate() == ICmpInst::ICMP_SGT + || ExitCondition->getPredicate() == ICmpInst::ICMP_UGT + || ExitCondition->getPredicate() == ICmpInst::ICMP_SGE + || ExitCondition->getPredicate() == ICmpInst::ICMP_UGE) + ExitCondition->swapOperands(); + switch (ExitCondition->getPredicate()) { case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_UGT: From evan.cheng at apple.com Tue Sep 18 20:35:01 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 19 Sep 2007 01:35:01 -0000 Subject: [llvm-commits] [llvm] r42123 - in /llvm/trunk: include/llvm/Target/MRegisterInfo.h lib/Target/Target.td utils/TableGen/CodeGenRegisters.h utils/TableGen/CodeGenTarget.cpp utils/TableGen/RegisterInfoEmitter.cpp Message-ID: <200709190135.l8J1Z2Q4013548@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 18 20:35:01 2007 New Revision: 42123 URL: http://llvm.org/viewvc/llvm-project?rev=42123&view=rev Log: Add CopyCost to TargetRegisterClass. This specifies the cost of copying a value between two registers in the specific class. Modified: llvm/trunk/include/llvm/Target/MRegisterInfo.h llvm/trunk/lib/Target/Target.td llvm/trunk/utils/TableGen/CodeGenRegisters.h llvm/trunk/utils/TableGen/CodeGenTarget.cpp llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Modified: llvm/trunk/include/llvm/Target/MRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/MRegisterInfo.h?rev=42123&r1=42122&r2=42123&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/MRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/MRegisterInfo.h Tue Sep 18 20:35:01 2007 @@ -70,6 +70,7 @@ const sc_iterator SubRegClasses; const sc_iterator SuperRegClasses; const unsigned RegSize, Alignment; // Size & Alignment of register in bytes + const int CopyCost; const iterator RegsBegin, RegsEnd; public: TargetRegisterClass(unsigned id, @@ -78,10 +79,11 @@ const TargetRegisterClass * const *supcs, const TargetRegisterClass * const *subregcs, const TargetRegisterClass * const *superregcs, - unsigned RS, unsigned Al, iterator RB, iterator RE) + unsigned RS, unsigned Al, int CC, + iterator RB, iterator RE) : ID(id), VTs(vts), SubClasses(subcs), SuperClasses(supcs), SubRegClasses(subregcs), SuperRegClasses(superregcs), - RegSize(RS), Alignment(Al), RegsBegin(RB), RegsEnd(RE) {} + RegSize(RS), Alignment(Al), CopyCost(CC), RegsBegin(RB), RegsEnd(RE) {} virtual ~TargetRegisterClass() {} // Allow subclasses /// getID() - Return the register class ID number. @@ -258,6 +260,10 @@ /// getAlignment - Return the minimum required alignment for a register of /// this class. unsigned getAlignment() const { return Alignment; } + + /// getCopyCost - Return the cost of copying a value between two registers in + /// this class. + int getCopyCost() const { return CopyCost; } }; Modified: llvm/trunk/lib/Target/Target.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Target.td?rev=42123&r1=42122&r2=42123&view=diff ============================================================================== --- llvm/trunk/lib/Target/Target.td (original) +++ llvm/trunk/lib/Target/Target.td Tue Sep 18 20:35:01 2007 @@ -104,6 +104,12 @@ // int Alignment = alignment; + // CopyCost - This value is used to specify the cost of copying a value + // between two registers in this register class. The default value is one + // meaning it takes a single instruction to perform the copying. A negative + // value means copying is extremely expensive or impossible. + int CopyCost = 1; + // MemberList - Specify which registers are in this class. If the // allocation_order_* method are not specified, this also defines the order of // allocation used by the register allocator. Modified: llvm/trunk/utils/TableGen/CodeGenRegisters.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenRegisters.h?rev=42123&r1=42122&r2=42123&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenRegisters.h (original) +++ llvm/trunk/utils/TableGen/CodeGenRegisters.h Tue Sep 18 20:35:01 2007 @@ -38,6 +38,7 @@ std::vector VTs; unsigned SpillSize; unsigned SpillAlignment; + int CopyCost; std::vector SubRegClasses; std::string MethodProtos, MethodBodies; Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=42123&r1=42122&r2=42123&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Tue Sep 18 20:35:01 2007 @@ -221,6 +221,7 @@ Namespace = R->getValueAsString("Namespace"); SpillSize = Size ? Size : MVT::getSizeInBits(VTs[0]); SpillAlignment = R->getValueAsInt("Alignment"); + CopyCost = R->getValueAsInt("CopyCost"); MethodBodies = R->getValueAsCode("MethodBodies"); MethodProtos = R->getValueAsCode("MethodProtos"); } Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=42123&r1=42122&r2=42123&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Tue Sep 18 20:35:01 2007 @@ -384,8 +384,10 @@ << RC.getName() + "SubRegClasses" << ", " << RC.getName() + "SuperRegClasses" << ", " << RC.SpillSize/8 << ", " - << RC.SpillAlignment/8 << ", " << RC.getName() << ", " - << RC.getName() << " + " << RC.Elements.size() << ") {}\n"; + << RC.SpillAlignment/8 << ", " + << RC.CopyCost << ", " + << RC.getName() << ", " << RC.getName() << " + " << RC.Elements.size() + << ") {}\n"; } OS << "}\n"; From evan.cheng at apple.com Tue Sep 18 20:36:39 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 19 Sep 2007 01:36:39 -0000 Subject: [llvm-commits] [llvm] r42124 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.td Message-ID: <200709190136.l8J1adxw013649@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 18 20:36:39 2007 New Revision: 42124 URL: http://llvm.org/viewvc/llvm-project?rev=42124&view=rev Log: Set CCR (EFLAGS) copy cost to -1, i.e. extremely expensive to copy. 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=42124&r1=42123&r2=42124&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.td Tue Sep 18 20:36:39 2007 @@ -521,4 +521,6 @@ } // Status flags registers. -def CCR : RegisterClass<"X86", [i32], 32, [EFLAGS]>; +def CCR : RegisterClass<"X86", [i32], 32, [EFLAGS]> { + let CopyCost = -1; // Don't allow copying of status registers. +} From evan.cheng at apple.com Tue Sep 18 20:38:40 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 19 Sep 2007 01:38:40 -0000 Subject: [llvm-commits] [llvm] r42125 - in /llvm/trunk: include/llvm/CodeGen/ScheduleDAG.h lib/CodeGen/SelectionDAG/ScheduleDAG.cpp lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200709190138.l8J1ceh9013772@zion.cs.uiuc.edu> Author: evancheng Date: Tue Sep 18 20:38:40 2007 New Revision: 42125 URL: http://llvm.org/viewvc/llvm-project?rev=42125&view=rev Log: Use struct SDep instead of std::pair for SUnit pred and succ lists. First step in tracking physical register output dependencies. Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=42125&r1=42124&r2=42125&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Tue Sep 18 20:38:40 2007 @@ -22,6 +22,7 @@ namespace llvm { struct InstrStage; + struct SUnit; class MachineConstantPool; class MachineModuleInfo; class MachineInstr; @@ -74,7 +75,18 @@ virtual void EmitNoop() { } }; - + + /// SDep - Scheduling dependency. It keeps track of dependent nodes, + /// cost of the depdenency, etc. + struct SDep { + SUnit *Dep; // Dependent - either a predecessor or a successor. + bool isCtrl; // True iff it's a control dependency. + unsigned PhyReg; // If non-zero, this dep is a phy register dependency. + int Cost; // Cost of the dependency. + SDep(SUnit *d, bool c, unsigned r, int t) + : Dep(d), isCtrl(c), PhyReg(r), Cost(t) {} + }; + /// SUnit - Scheduling unit. It's an wrapper around either a single SDNode or /// a group of nodes flagged together. struct SUnit { @@ -83,15 +95,13 @@ // Preds/Succs - The SUnits before/after us in the graph. The boolean value // is true if the edge is a token chain edge, false if it is a value edge. - SmallVector, 4> Preds; // All sunit predecessors. - SmallVector, 4> Succs; // All sunit successors. + SmallVector Preds; // All sunit predecessors. + SmallVector Succs; // All sunit successors. - typedef SmallVector, 4>::iterator pred_iterator; - typedef SmallVector, 4>::iterator succ_iterator; - typedef SmallVector, 4>::const_iterator - const_pred_iterator; - typedef SmallVector, 4>::const_iterator - const_succ_iterator; + typedef SmallVector::iterator pred_iterator; + typedef SmallVector::iterator succ_iterator; + typedef SmallVector::const_iterator const_pred_iterator; + typedef SmallVector::const_iterator const_succ_iterator; short NumPreds; // # of preds. short NumSuccs; // # of sucss. @@ -121,21 +131,21 @@ /// addPred - This adds the specified node as a pred of the current node if /// not already. This returns true if this is a new pred. - bool addPred(SUnit *N, bool isChain) { + bool addPred(SUnit *N, bool isCtrl, unsigned PhyReg = 0, int Cost = 1) { for (unsigned i = 0, e = Preds.size(); i != e; ++i) - if (Preds[i].first == N && Preds[i].second == isChain) + if (Preds[i].Dep == N && Preds[i].isCtrl == isCtrl) return false; - Preds.push_back(std::make_pair(N, isChain)); + Preds.push_back(SDep(N, isCtrl, PhyReg, Cost)); return true; } /// addSucc - This adds the specified node as a succ of the current node if /// not already. This returns true if this is a new succ. - bool addSucc(SUnit *N, bool isChain) { + bool addSucc(SUnit *N, bool isCtrl, unsigned PhyReg = 0, int Cost = 1) { for (unsigned i = 0, e = Succs.size(); i != e; ++i) - if (Succs[i].first == N && Succs[i].second == isChain) + if (Succs[i].Dep == N && Succs[i].isCtrl == isCtrl) return false; - Succs.push_back(std::make_pair(N, isChain)); + Succs.push_back(SDep(N, isCtrl, PhyReg, Cost)); return true; } @@ -340,7 +350,7 @@ } pointer operator*() const { - return Node->Preds[Operand].first; + return Node->Preds[Operand].Dep; } pointer operator->() const { return operator*(); } @@ -359,7 +369,7 @@ unsigned getOperand() const { return Operand; } const SUnit *getNode() const { return Node; } - bool isChain() const { return Node->Preds[Operand].second; } + bool isCtrlDep() const { return Node->Preds[Operand].isCtrl; } }; template <> struct GraphTraits { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=42125&r1=42124&r2=42125&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Tue Sep 18 20:38:40 2007 @@ -193,7 +193,7 @@ SU->Depth = Depth; for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); I != E; ++I) - WorkList.push_back(std::make_pair(I->first, Depth+1)); + WorkList.push_back(std::make_pair(I->Dep, Depth+1)); } } } @@ -211,7 +211,7 @@ SU->Height = Height; for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E; ++I) - WorkList.push_back(std::make_pair(I->first, Height+1)); + WorkList.push_back(std::make_pair(I->Dep, Height+1)); } } } @@ -865,22 +865,22 @@ cerr << " Predecessors:\n"; for (SUnit::const_succ_iterator I = Preds.begin(), E = Preds.end(); I != E; ++I) { - if (I->second) + if (I->isCtrl) cerr << " ch #"; else cerr << " val #"; - cerr << I->first << " - SU(" << I->first->NodeNum << ")\n"; + cerr << I->Dep << " - SU(" << I->Dep->NodeNum << ")\n"; } } if (Succs.size() != 0) { cerr << " Successors:\n"; for (SUnit::const_succ_iterator I = Succs.begin(), E = Succs.end(); I != E; ++I) { - if (I->second) + if (I->isCtrl) cerr << " ch #"; else cerr << " val #"; - cerr << I->first << " - SU(" << I->first->NodeNum << ")\n"; + cerr << I->Dep << " - SU(" << I->Dep->NodeNum << ")\n"; } } cerr << "\n"; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp?rev=42125&r1=42124&r2=42125&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp Tue Sep 18 20:38:40 2007 @@ -134,9 +134,9 @@ // If this is a token edge, we don't need to wait for the latency of the // preceeding instruction (e.g. a long-latency load) unless there is also // some other data dependence. - SUnit &Pred = *I->first; + SUnit &Pred = *I->Dep; unsigned PredDoneCycle = Pred.Cycle; - if (!I->second) + if (!I->isCtrl) PredDoneCycle += Pred.Latency; else if (Pred.Latency) PredDoneCycle += 1; @@ -161,7 +161,7 @@ // Bottom up: release successors. for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); I != E; ++I) - ReleaseSucc(I->first, I->second); + ReleaseSucc(I->Dep, I->isCtrl); } /// ListScheduleTopDown - The main loop of list scheduling for top-down @@ -436,7 +436,7 @@ int MaxSuccLatency = 0; for (SUnit::const_succ_iterator I = SU.Succs.begin(), E = SU.Succs.end(); I != E; ++I) - MaxSuccLatency = std::max(MaxSuccLatency, CalcLatency(*I->first)); + MaxSuccLatency = std::max(MaxSuccLatency, CalcLatency(*I->Dep)); return Latency = MaxSuccLatency + SU.Latency; } @@ -456,7 +456,7 @@ SUnit *OnlyAvailablePred = 0; for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E; ++I) { - SUnit &Pred = *I->first; + SUnit &Pred = *I->Dep; if (!Pred.isScheduled) { // We found an available, but not scheduled, predecessor. If it's the // only one we have found, keep track of it... otherwise give up. @@ -475,7 +475,7 @@ unsigned NumNodesBlocking = 0; for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); I != E; ++I) - if (getSingleUnscheduledPred(I->first) == SU) + if (getSingleUnscheduledPred(I->Dep) == SU) ++NumNodesBlocking; NumNodesSolelyBlocking[SU->NodeNum] = NumNodesBlocking; @@ -490,7 +490,7 @@ void LatencyPriorityQueue::ScheduledNode(SUnit *SU) { for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); I != E; ++I) - AdjustPriorityOfUnscheduledPreds(I->first); + AdjustPriorityOfUnscheduledPreds(I->Dep); } /// AdjustPriorityOfUnscheduledPreds - One of the predecessors of SU was just Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=42125&r1=42124&r2=42125&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Tue Sep 18 20:38:40 2007 @@ -157,8 +157,8 @@ for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E; ++I) { - if (!I->second) - OperandSeen.insert(I->first); + if (!I->isCtrl) + OperandSeen.insert(I->Dep); } } } @@ -214,7 +214,7 @@ // Bottom up: release predecessors for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E; ++I) - ReleasePred(I->first, I->second, CurCycle); + ReleasePred(I->Dep, I->isCtrl, CurCycle); SU->isScheduled = true; } @@ -325,7 +325,7 @@ // Top down: release successors for (SUnit::succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); I != E; ++I) - ReleaseSucc(I->first, I->second, CurCycle); + ReleaseSucc(I->Dep, I->isCtrl, CurCycle); SU->isScheduled = true; } @@ -584,11 +584,11 @@ unsigned MaxCycle = 0; for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); I != E; ++I) { - unsigned Cycle = I->first->Cycle; + unsigned Cycle = I->Dep->Cycle; // If there are bunch of CopyToRegs stacked up, they should be considered // to be at the same position. - if (I->first->Node->getOpcode() == ISD::CopyToReg) - Cycle = closestSucc(I->first)+1; + if (I->Dep->Node->getOpcode() == ISD::CopyToReg) + Cycle = closestSucc(I->Dep)+1; if (Cycle > MaxCycle) MaxCycle = Cycle; } @@ -602,14 +602,14 @@ unsigned Scratches = 0; for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E; ++I) { - if (I->second) continue; // ignore chain preds - if (I->first->Node->getOpcode() != ISD::CopyFromReg) + if (I->isCtrl) continue; // ignore chain preds + if (I->Dep->Node->getOpcode() != ISD::CopyFromReg) Scratches++; } for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); I != E; ++I) { - if (I->second) continue; // ignore chain succs - if (I->first->Node->getOpcode() != ISD::CopyToReg) + if (I->isCtrl) continue; // ignore chain succs + if (I->Dep->Node->getOpcode() != ISD::CopyToReg) Scratches += 10; } return Scratches; @@ -691,7 +691,7 @@ for (SUnit::pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E; ++I) - isReachable(I->first, TargetSU, Visited, Reached); + isReachable(I->Dep, TargetSU, Visited, Reached); } static bool isReachable(SUnit *SU, SUnit *TargetSU) { @@ -744,8 +744,8 @@ if (!DUSU) continue; for (SUnit::succ_iterator I = DUSU->Succs.begin(),E = DUSU->Succs.end(); I != E; ++I) { - if (I->second) continue; - SUnit *SuccSU = I->first; + if (I->isCtrl) continue; + SUnit *SuccSU = I->Dep; if (SuccSU != SU && (!canClobber(SuccSU, DUSU) || (!SU->isCommutable && SuccSU->isCommutable))){ @@ -776,13 +776,13 @@ unsigned Extra = 0; for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E; ++I) { - if (I->second) continue; // ignore chain preds - SUnit *PredSU = I->first; + if (I->isCtrl) continue; // ignore chain preds + SUnit *PredSU = I->Dep; unsigned PredSethiUllman = CalcNodeSethiUllmanNumber(PredSU); if (PredSethiUllman > SethiUllmanNumber) { SethiUllmanNumber = PredSethiUllman; Extra = 0; - } else if (PredSethiUllman == SethiUllmanNumber && !I->second) + } else if (PredSethiUllman == SethiUllmanNumber && !I->isCtrl) Extra++; } @@ -808,10 +808,10 @@ unsigned Sum = 0; for (SUnit::const_succ_iterator I = SU->Succs.begin(), E = SU->Succs.end(); I != E; ++I) { - SUnit *SuccSU = I->first; + SUnit *SuccSU = I->Dep; for (SUnit::const_pred_iterator II = SuccSU->Preds.begin(), EE = SuccSU->Preds.end(); II != EE; ++II) { - SUnit *PredSU = II->first; + SUnit *PredSU = II->Dep; if (!PredSU->isScheduled) Sum++; } @@ -899,13 +899,13 @@ int Extra = 0; for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); I != E; ++I) { - if (I->second) continue; // ignore chain preds - SUnit *PredSU = I->first; + if (I->isCtrl) continue; // ignore chain preds + SUnit *PredSU = I->Dep; unsigned PredSethiUllman = CalcNodeSethiUllmanNumber(PredSU); if (PredSethiUllman > SethiUllmanNumber) { SethiUllmanNumber = PredSethiUllman; Extra = 0; - } else if (PredSethiUllman == SethiUllmanNumber && !I->second) + } else if (PredSethiUllman == SethiUllmanNumber && !I->isCtrl) Extra++; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=42125&r1=42124&r2=42125&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Tue Sep 18 20:38:40 2007 @@ -264,7 +264,7 @@ /// edge, override this method. template static std::string getEdgeAttributes(const void *Node, EdgeIter EI) { - if (EI.isChain()) + if (EI.isCtrlDep()) return "color=blue,style=dashed"; return ""; } From tonic at nondot.org Wed Sep 19 00:29:27 2007 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 19 Sep 2007 05:29:27 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42127 - /llvm-gcc-4.0/branches/release_21/README.LLVM Message-ID: <200709190529.l8J5TRTi022505@zion.cs.uiuc.edu> Author: tbrethou Date: Wed Sep 19 00:29:26 2007 New Revision: 42127 URL: http://llvm.org/viewvc/llvm-project?rev=42127&view=rev Log: Merge from mainline (suggest program prefix) Modified: llvm-gcc-4.0/branches/release_21/README.LLVM Modified: llvm-gcc-4.0/branches/release_21/README.LLVM URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/branches/release_21/README.LLVM?rev=42127&r1=42126&r2=42127&view=diff ============================================================================== --- llvm-gcc-4.0/branches/release_21/README.LLVM (original) +++ llvm-gcc-4.0/branches/release_21/README.LLVM Wed Sep 19 00:29:26 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 baldrick at free.fr Wed Sep 19 02:43:18 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Sep 2007 07:43:18 -0000 Subject: [llvm-commits] [llvm] r42128 - /llvm/trunk/test/CFrontend/2007-09-17-WeakRef.c Message-ID: <200709190743.l8J7hIrf001808@zion.cs.uiuc.edu> Author: baldrick Date: Wed Sep 19 02:43:17 2007 New Revision: 42128 URL: http://llvm.org/viewvc/llvm-project?rev=42128&view=rev Log: Testcase for PR1678. Added: llvm/trunk/test/CFrontend/2007-09-17-WeakRef.c Added: llvm/trunk/test/CFrontend/2007-09-17-WeakRef.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-09-17-WeakRef.c?rev=42128&view=auto ============================================================================== --- llvm/trunk/test/CFrontend/2007-09-17-WeakRef.c (added) +++ llvm/trunk/test/CFrontend/2007-09-17-WeakRef.c Wed Sep 19 02:43:17 2007 @@ -0,0 +1,10 @@ +// RUN: %llvmgcc -O1 -S %s -o - | grep icmp +// PR1678 + +extern void B (void); +static __typeof(B) A __attribute__ ((__weakref__("B"))); +int active (void) +{ + static void *const p = __extension__ (void *) &A; + return p != 0; +} From ggreif at gmail.com Wed Sep 19 04:29:59 2007 From: ggreif at gmail.com (Gabor Greif) Date: Wed, 19 Sep 2007 09:29:59 -0000 Subject: [llvm-commits] [llvm] r42129 - /llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Message-ID: <200709190930.l8J9U0AX005480@zion.cs.uiuc.edu> Author: ggreif Date: Wed Sep 19 04:29:58 2007 New Revision: 42129 URL: http://llvm.org/viewvc/llvm-project?rev=42129&view=rev Log: include alloca.h if available. this helps Solaris, but intnat and uintnat types are still undefined, causing errors Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=42129&r1=42128&r2=42129&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Wed Sep 19 04:29:58 2007 @@ -19,7 +19,11 @@ #include "caml/alloc.h" #include "caml/mlvalues.h" #include "caml/memory.h" -#include "stdio.h" +#include "llvm/Config/config.h" +#include +#ifdef HAVE_ALLOCA_H +#include +#endif /*===-- Modules -----------------------------------------------------------===*/ From baldrick at free.fr Wed Sep 19 05:10:33 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Sep 2007 10:10:33 -0000 Subject: [llvm-commits] [llvm] r42130 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200709191010.l8JAAZSB006724@zion.cs.uiuc.edu> Author: baldrick Date: Wed Sep 19 05:10:31 2007 New Revision: 42130 URL: http://llvm.org/viewvc/llvm-project?rev=42130&view=rev Log: A global variable with external weak linkage can be null, while an alias could alias such a global variable. 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=42130&r1=42129&r2=42130&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Sep 19 05:10:31 2007 @@ -8936,8 +8936,12 @@ /// specified pointer, we do a quick local scan of the basic block containing /// ScanFrom, to determine if the address is already accessed. static bool isSafeToLoadUnconditionally(Value *V, Instruction *ScanFrom) { - // If it is an alloca or global variable, it is always safe to load from. - if (isa(V) || isa(V)) return true; + // If it is an alloca it is always safe to load from. + if (isa(V)) return true; + + // Don't try to evaluate aliases. External weak GV can be null. + if (const GlobalValue *GV = dyn_cast(V)) + return !isa(GV) && !GV->hasExternalWeakLinkage(); // Otherwise, be a little bit agressive by scanning the local block where we // want to check to see if the pointer is already being loaded or stored From baldrick at free.fr Wed Sep 19 05:16:18 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Sep 2007 10:16:18 -0000 Subject: [llvm-commits] [llvm] r42131 - /llvm/trunk/lib/VMCore/ConstantFold.cpp Message-ID: <200709191016.l8JAGIq7006852@zion.cs.uiuc.edu> Author: baldrick Date: Wed Sep 19 05:16:17 2007 New Revision: 42131 URL: http://llvm.org/viewvc/llvm-project?rev=42131&view=rev Log: Partial fix for PR1678: correct some parts of constant fold that were missed in the fix for PR1646. Probably this null/not-null logic should be factorized somewhere. 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=42131&r1=42130&r2=42131&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Wed Sep 19 05:16:17 2007 @@ -1124,7 +1124,8 @@ // icmp eq/ne(null,GV) -> false/true if (C1->isNullValue()) { if (const GlobalValue *GV = dyn_cast(C2)) - if (!GV->hasExternalWeakLinkage()) // External weak GV can be null + // Don't try to evaluate aliases. External weak GV can be null. + if (!isa(GV) && !GV->hasExternalWeakLinkage()) if (pred == ICmpInst::ICMP_EQ) return ConstantInt::getFalse(); else if (pred == ICmpInst::ICMP_NE) @@ -1132,7 +1133,8 @@ // icmp eq/ne(GV,null) -> false/true } else if (C2->isNullValue()) { if (const GlobalValue *GV = dyn_cast(C1)) - if (!GV->hasExternalWeakLinkage()) // External weak GV can be null + // Don't try to evaluate aliases. External weak GV can be null. + if (!isa(GV) && !GV->hasExternalWeakLinkage()) if (pred == ICmpInst::ICMP_EQ) return ConstantInt::getFalse(); else if (pred == ICmpInst::ICMP_NE) From gordonhenriksen at mac.com Wed Sep 19 05:21:24 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Wed, 19 Sep 2007 06:21:24 -0400 Subject: [llvm-commits] [llvm] r42129 - /llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c In-Reply-To: <200709190930.l8J9U0AX005480@zion.cs.uiuc.edu> References: <200709190930.l8J9U0AX005480@zion.cs.uiuc.edu> Message-ID: <3EA384D7-DC8C-4F64-AB36-64F232218DE4@mac.com> Hi Gabor, I'll get rid of the allocas. The uintnat and intnat types should come from the ocaml headers. May I ask what version of ocaml do you have installed? ocamlc -version As an immediate workaround, if you delete OCAMLC := ... from Makefile.config, the bindings and tests will be skipped. (Probably configuring --without-ocamlc or something would do the job, too. Maybe.) On 2007-09-19, at 05:29, Gabor Greif wrote: > Author: ggreif > Date: Wed Sep 19 04:29:58 2007 > New Revision: 42129 > > URL: http://llvm.org/viewvc/llvm-project?rev=42129&view=rev > Log: > include alloca.h if available. this helps Solaris, but intnat and > uintnat types are still undefined, causing errors > > Modified: > llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c > > Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/ > llvm/llvm_ocaml.c?rev=42129&r1=42128&r2=42129&view=diff > > ====================================================================== > ======== > --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) > +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Wed Sep 19 04:29:58 > 2007 > @@ -19,7 +19,11 @@ > #include "caml/alloc.h" > #include "caml/mlvalues.h" > #include "caml/memory.h" > -#include "stdio.h" > +#include "llvm/Config/config.h" > +#include > +#ifdef HAVE_ALLOCA_H > +#include > +#endif > > > /*===-- Modules > -----------------------------------------------------------===*/ > > > _______________________________________________ > 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/20070919/05d3d167/attachment.html From baldrick at free.fr Wed Sep 19 05:25:40 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Sep 2007 10:25:40 -0000 Subject: [llvm-commits] [llvm] r42132 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200709191025.l8JAPfkg007119@zion.cs.uiuc.edu> Author: baldrick Date: Wed Sep 19 05:25:38 2007 New Revision: 42132 URL: http://llvm.org/viewvc/llvm-project?rev=42132&view=rev Log: Improve comment. 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=42132&r1=42131&r2=42132&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Sep 19 05:25:38 2007 @@ -8939,8 +8939,9 @@ // If it is an alloca it is always safe to load from. if (isa(V)) return true; - // Don't try to evaluate aliases. External weak GV can be null. + // If it is a global variable it is mostly safe to load from. if (const GlobalValue *GV = dyn_cast(V)) + // Don't try to evaluate aliases. External weak GV can be null. return !isa(GV) && !GV->hasExternalWeakLinkage(); // Otherwise, be a little bit agressive by scanning the local block where we From dalej at apple.com Wed Sep 19 09:22:59 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Sep 2007 14:22:59 -0000 Subject: [llvm-commits] [llvm] r42133 - /llvm/trunk/lib/VMCore/ConstantFold.cpp Message-ID: <200709191422.l8JEMxNc013421@zion.cs.uiuc.edu> Author: johannes Date: Wed Sep 19 09:22:58 2007 New Revision: 42133 URL: http://llvm.org/viewvc/llvm-project?rev=42133&view=rev Log: Fix some long double issues. 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=42133&r1=42132&r2=42133&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Wed Sep 19 09:22:58 2007 @@ -178,30 +178,28 @@ case Instruction::FPTrunc: case Instruction::FPExt: if (const ConstantFP *FPC = dyn_cast(V)) { - APFloat Val = FPC->getValueAPF(); - Val.convert(DestTy==Type::FloatTy ? APFloat::IEEEsingle : - APFloat::IEEEdouble, + APFloat Val = FPC->getValueAPF(); + Val.convert(DestTy == Type::FloatTy ? APFloat::IEEEsingle : + DestTy == Type::DoubleTy ? APFloat::IEEEdouble : + DestTy == Type::X86_FP80Ty ? APFloat::x87DoubleExtended : + DestTy == Type::FP128Ty ? APFloat::IEEEquad : + APFloat::Bogus, APFloat::rmNearestTiesToEven); return ConstantFP::get(DestTy, Val); } return 0; // Can't fold. case Instruction::FPToUI: - if (const ConstantFP *FPC = dyn_cast(V)) { - APFloat V = FPC->getValueAPF(); - bool isDouble = &V.getSemantics()==&APFloat::IEEEdouble; - uint32_t DestBitWidth = cast(DestTy)->getBitWidth(); - APInt Val(APIntOps::RoundDoubleToAPInt(isDouble ? V.convertToDouble() : - (double)V.convertToFloat(), DestBitWidth)); - return ConstantInt::get(Val); - } - return 0; // Can't fold. case Instruction::FPToSI: if (const ConstantFP *FPC = dyn_cast(V)) { APFloat V = FPC->getValueAPF(); - bool isDouble = &V.getSemantics()==&APFloat::IEEEdouble; + uint64_t x[2]; uint32_t DestBitWidth = cast(DestTy)->getBitWidth(); - APInt Val(APIntOps::RoundDoubleToAPInt(isDouble ? V.convertToDouble() : - (double)V.convertToFloat(), DestBitWidth)); + APFloat::opStatus status = V.convertToInteger(x, DestBitWidth, + opc==Instruction::FPToSI, + APFloat::rmNearestTiesToEven); + if (status!=APFloat::opOK && status!=APFloat::opInexact) + return 0; // give up + APInt Val(DestBitWidth, 2, x); return ConstantInt::get(Val); } return 0; // Can't fold. @@ -215,11 +213,13 @@ return 0; // Other pointer types cannot be casted case Instruction::UIToFP: if (const ConstantInt *CI = dyn_cast(V)) { + double d = CI->getValue().signedRoundToDouble(); if (DestTy==Type::FloatTy) - return ConstantFP::get(DestTy, - APFloat((float)CI->getValue().roundToDouble())); + return ConstantFP::get(DestTy, APFloat((float)d)); + else if (DestTy==Type::DoubleTy) + return ConstantFP::get(DestTy, APFloat(d)); else - return ConstantFP::get(DestTy, APFloat(CI->getValue().roundToDouble())); + return 0; // FIXME do this for long double } return 0; case Instruction::SIToFP: @@ -227,8 +227,10 @@ double d = CI->getValue().signedRoundToDouble(); if (DestTy==Type::FloatTy) return ConstantFP::get(DestTy, APFloat((float)d)); - else + else if (DestTy==Type::DoubleTy) return ConstantFP::get(DestTy, APFloat(d)); + else + return 0; // FIXME do this for long double } return 0; case Instruction::ZExt: From dalej at apple.com Wed Sep 19 09:31:45 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Sep 2007 14:31:45 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42134 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Message-ID: <200709191431.l8JEVjsH013695@zion.cs.uiuc.edu> Author: johannes Date: Wed Sep 19 09:31:45 2007 New Revision: 42134 URL: http://llvm.org/viewvc/llvm-project?rev=42134&view=rev Log: Fix some long double issues. 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=42134&r1=42133&r2=42134&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Wed Sep 19 09:31:45 2007 @@ -4339,9 +4339,10 @@ Result = Builder.CreateIntCast(Result, DestTy, "cast"); return true; } + case BUILT_IN_SQRTL: + return false; // treat long double as normal call case BUILT_IN_SQRT: case BUILT_IN_SQRTF: - case BUILT_IN_SQRTL: // If errno math has been disabled, expand these to llvm.sqrt calls. if (!flag_errno_math) { Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0); @@ -4350,9 +4351,10 @@ return true; } break; + case BUILT_IN_POWIL: + return false; // treat long double as normal call case BUILT_IN_POWI: case BUILT_IN_POWIF: - case BUILT_IN_POWIL: Result = EmitBuiltinPOWI(exp); return true; case BUILT_IN_FFS: // These GCC builtins always return int. From baldrick at free.fr Wed Sep 19 09:34:29 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Sep 2007 16:34:29 +0200 Subject: [llvm-commits] [llvm-gcc-4.0] r42134 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <200709191431.l8JEVjsH013695@zion.cs.uiuc.edu> References: <200709191431.l8JEVjsH013695@zion.cs.uiuc.edu> Message-ID: <200709191634.31491.baldrick@free.fr> Hi Dale, > + case BUILT_IN_SQRTL: > + return false; // treat long double as normal call > case BUILT_IN_SQRT: > case BUILT_IN_SQRTF: > - case BUILT_IN_SQRTL: > // If errno math has been disabled, expand these to llvm.sqrt calls. what's the problem here? Thanks, Duncan. From dalej at apple.com Wed Sep 19 09:42:46 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Sep 2007 07:42:46 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r42134 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <200709191634.31491.baldrick@free.fr> References: <200709191431.l8JEVjsH013695@zion.cs.uiuc.edu> <200709191634.31491.baldrick@free.fr> Message-ID: <47B22360-914E-42B1-AE74-07B238D11522@apple.com> On Sep 19, 2007, at 7:34 AM, Duncan Sands wrote: > Hi Dale, > >> + case BUILT_IN_SQRTL: >> + return false; // treat long double as normal call >> case BUILT_IN_SQRT: >> case BUILT_IN_SQRTF: >> - case BUILT_IN_SQRTL: >> // If errno math has been disabled, expand these to llvm.sqrt >> calls. > > what's the problem here? Code downstream, starting with EmitBuiltinUnaryFPOp, is not ready for long double functions. This is not the best or a permanent fix, but correct for the moment. From ghenriksen at carbonite.com Wed Sep 19 09:44:53 2007 From: ghenriksen at carbonite.com (Gordon Henriksen) Date: Wed, 19 Sep 2007 10:44:53 -0400 Subject: [llvm-commits] [llvm] r42129 - /llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c In-Reply-To: <3EA384D7-DC8C-4F64-AB36-64F232218DE4@mac.com> References: <200709190930.l8J9U0AX005480@zion.cs.uiuc.edu> <3EA384D7-DC8C-4F64-AB36-64F232218DE4@mac.com> Message-ID: <6FD4CF2A-580E-440F-9196-853FD3FC3B4D@carbonite.com> On 2007-09-19, at 06:21, Gordon Henriksen wrote: > Probably configuring --without-ocamlc or something would do the > job, too. Maybe.) Well, no it won't. ./configure OCAMLC= works, but if ocamlc is in your path, there's no way to not find it, from hacking the Makefile.config output. I'll try to get over my crippling fear of autoconf and provide --dis-/--enable-bindings and --dis-/-- enable-ocaml-bindings options. ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070919/70913c58/attachment.html From baldrick at free.fr Wed Sep 19 09:46:18 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 19 Sep 2007 16:46:18 +0200 Subject: [llvm-commits] [llvm-gcc-4.0] r42134 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <47B22360-914E-42B1-AE74-07B238D11522@apple.com> References: <200709191431.l8JEVjsH013695@zion.cs.uiuc.edu> <200709191634.31491.baldrick@free.fr> <47B22360-914E-42B1-AE74-07B238D11522@apple.com> Message-ID: <200709191646.19272.baldrick@free.fr> > Code downstream, starting with EmitBuiltinUnaryFPOp, is not ready for > long double functions. This is not the best or a permanent fix, but > correct for the moment. I see - thanks. By the way, how do you plan to handle constant folding of sqrt and friends when the host doesn't handle long doubles? Best wishes, Duncan. From dalej at apple.com Wed Sep 19 09:51:09 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Sep 2007 07:51:09 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r42134 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <200709191646.19272.baldrick@free.fr> References: <200709191431.l8JEVjsH013695@zion.cs.uiuc.edu> <200709191634.31491.baldrick@free.fr> <47B22360-914E-42B1-AE74-07B238D11522@apple.com> <200709191646.19272.baldrick@free.fr> Message-ID: <92C73088-FB80-4337-817A-759CF0AC80DD@apple.com> On Sep 19, 2007, at 7:46 AM, Duncan Sands wrote: >> Code downstream, starting with EmitBuiltinUnaryFPOp, is not ready for >> long double functions. This is not the best or a permanent fix, but >> correct for the moment. > > I see - thanks. By the way, how do you plan to handle constant > folding > of sqrt and friends when the host doesn't handle long doubles? It can be done by emulation in APFloat, but it's not a high priority for me (I'm not a numerics expert, but this is the sort of thing you can look up). In the short term that just won't be done. From dalej at apple.com Wed Sep 19 09:56:38 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Sep 2007 14:56:38 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42135 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200709191456.l8JEucKv014369@zion.cs.uiuc.edu> Author: johannes Date: Wed Sep 19 09:56:38 2007 New Revision: 42135 URL: http://llvm.org/viewvc/llvm-project?rev=42135&view=rev Log: Fix some long double issues. 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=42135&r1=42134&r2=42135&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Sep 19 09:56:38 2007 @@ -3919,9 +3919,10 @@ Result = Builder.CreateIntCast(Result, DestTy, "cast"); return true; } + case BUILT_IN_SQRTL: + return false; // treat long double as normal call case BUILT_IN_SQRT: case BUILT_IN_SQRTF: - case BUILT_IN_SQRTL: // If errno math has been disabled, expand these to llvm.sqrt calls. if (!flag_errno_math) { Value *Amt = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0); @@ -3930,9 +3931,10 @@ return true; } break; + case BUILT_IN_POWIL: + return false; // treat long double as normal call case BUILT_IN_POWI: case BUILT_IN_POWIF: - case BUILT_IN_POWIL: Result = EmitBuiltinPOWI(exp); return true; case BUILT_IN_FFS: // These GCC builtins always return int. From asl at math.spbu.ru Wed Sep 19 11:13:48 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 19 Sep 2007 16:13:48 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42136 - /llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Message-ID: <200709191613.l8JGDmL3017317@zion.cs.uiuc.edu> Author: asl Date: Wed Sep 19 11:13:48 2007 New Revision: 42136 URL: http://llvm.org/viewvc/llvm-project?rev=42136&view=rev Log: Use proper value in the map instead of one being deleted. This fixes PR1685 Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp 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=42136&r1=42135&r2=42136&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Wed Sep 19 11:13:48 2007 @@ -806,6 +806,7 @@ AttributeUsedGlobals.remove(GV); AttributeUsedGlobals.insert(NGV); } + changeLLVMValue(GV, NGV); delete GV; SET_DECL_LLVM(decl, NGV); GV = NGV; From resistor at mac.com Wed Sep 19 11:13:57 2007 From: resistor at mac.com (Owen Anderson) Date: Wed, 19 Sep 2007 16:13:57 -0000 Subject: [llvm-commits] [llvm] r42137 - in /llvm/trunk: include/llvm/Analysis/MemoryDependenceAnalysis.h lib/Analysis/MemoryDependenceAnalysis.cpp Message-ID: <200709191613.l8JGDv57017332@zion.cs.uiuc.edu> Author: resistor Date: Wed Sep 19 11:13:57 2007 New Revision: 42137 URL: http://llvm.org/viewvc/llvm-project?rev=42137&view=rev Log: Add a flag to mark a dirty cache entry. This is not yet used, but will eventually help non-local memdep caching. Modified: llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Modified: llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h?rev=42137&r1=42136&r2=42137&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h (original) +++ llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h Wed Sep 19 11:13:57 2007 @@ -59,6 +59,10 @@ // Special marker indicating that the query has no dependency at all static Instruction* const None; + + // Special marker indicating a dirty cache entry + static Instruction* const Dirty; + static char ID; // Class identification, replacement for typeinfo MemoryDependenceAnalysis() : FunctionPass((intptr_t)&ID) {} Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=42137&r1=42136&r2=42137&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Wed Sep 19 11:13:57 2007 @@ -34,6 +34,7 @@ Instruction* const MemoryDependenceAnalysis::NonLocal = (Instruction*)-3; Instruction* const MemoryDependenceAnalysis::None = (Instruction*)-4; +Instruction* const MemoryDependenceAnalysis::Dirty = (Instruction*)-5; // Register this pass... static RegisterPass X("memdep", From asl at math.spbu.ru Wed Sep 19 11:17:07 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 19 Sep 2007 16:17:07 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42138 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200709191617.l8JGH7MW017485@zion.cs.uiuc.edu> Author: asl Date: Wed Sep 19 11:17:06 2007 New Revision: 42138 URL: http://llvm.org/viewvc/llvm-project?rev=42138&view=rev Log: Forward port of PR42136: properly update map if global is deleted Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=42138&r1=42137&r2=42138&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Sep 19 11:17:06 2007 @@ -817,6 +817,7 @@ AttributeUsedGlobals.remove(GV); AttributeUsedGlobals.insert(NGV); } + changeLLVMValue(GV, NGV); delete GV; SET_DECL_LLVM(decl, NGV); GV = NGV; From djg at cray.com Wed Sep 19 11:49:14 2007 From: djg at cray.com (Dan Gohman) Date: Wed, 19 Sep 2007 11:49:14 -0500 Subject: [llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll Message-ID: <20070919164914.GF10864@village.us.cray.com> > Exactly, that's what I meant to say when I said "when loop > conditionals are runtime dependent". To ensure safety in > PromoteValuesInLoop(), one needs to prove that basic-block is executed > at least once. The question is how ? The most general way to do this is to convert loops like this: while (x) { body; } to this: if (x) { do { body; } while (x); } In the second form, code hoisted/sunk/promoted out of the loop will still be under the guard of the if. Also see tree-ssa-loop-ch.c in GCC, for example. Dan -- Dan Gohman, Cray Inc. From sabre at nondot.org Wed Sep 19 12:14:45 2007 From: sabre at nondot.org (Chris Lattner) Date: Wed, 19 Sep 2007 17:14:45 -0000 Subject: [llvm-commits] [llvm] r42140 - /llvm/trunk/lib/VMCore/Verifier.cpp Message-ID: <200709191714.l8JHEjRl020038@zion.cs.uiuc.edu> Author: lattner Date: Wed Sep 19 12:14:45 2007 New Revision: 42140 URL: http://llvm.org/viewvc/llvm-project?rev=42140&view=rev Log: reject things like "declare internal @foo" Modified: llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=42140&r1=42139&r2=42140&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Wed Sep 19 12:14:45 2007 @@ -310,10 +310,15 @@ } void Verifier::visitGlobalVariable(GlobalVariable &GV) { - if (GV.hasInitializer()) + if (GV.hasInitializer()) { Assert1(GV.getInitializer()->getType() == GV.getType()->getElementType(), "Global variable initializer type does not match global " "variable type!", &GV); + } else { + Assert1(GV.hasExternalLinkage() || GV.hasDLLImportLinkage() || + GV.hasExternalWeakLinkage(), + "invalid linkage type for global declaration", &GV); + } visitGlobalValue(GV); } @@ -467,7 +472,11 @@ "Functions cannot take aggregates as arguments by value!", I); } - if (!F.isDeclaration()) { + if (F.isDeclaration()) { + Assert1(F.hasExternalLinkage() || F.hasDLLImportLinkage() || + F.hasExternalWeakLinkage(), + "invalid linkage type for function declaration", &F); + } else { // Verify that this function (which has a body) is not named "llvm.*". It // is not legal to define intrinsics. if (F.getName().size() >= 5) From dalej at apple.com Wed Sep 19 12:26:19 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Sep 2007 17:26:19 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42141 - in /llvm-gcc-4.0/trunk/gcc: llvm-convert.cpp llvm-internal.h Message-ID: <200709191726.l8JHQJxs020495@zion.cs.uiuc.edu> Author: johannes Date: Wed Sep 19 12:26:19 2007 New Revision: 42141 URL: http://llvm.org/viewvc/llvm-project?rev=42141&view=rev Log: Handle fabsl. Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp llvm-gcc-4.0/trunk/gcc/llvm-internal.h 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=42141&r1=42140&r2=42141&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Wed Sep 19 12:26:19 2007 @@ -3207,7 +3207,7 @@ return Builder.CreateSelect(Cmp, Op, OpN, "abs"); } else { // Turn FP abs into fabs/fabsf. - return EmitBuiltinUnaryFPOp(Op, "fabsf", "fabs"); + return EmitBuiltinUnaryFPOp(Op, "fabsf", "fabs", "fabsl"); } } @@ -4416,13 +4416,17 @@ } Value *TreeToLLVM::EmitBuiltinUnaryFPOp(Value *Amt, const char *F32Name, - const char *F64Name) { + const char *F64Name, + const char *LongDoubleName) { const char *Name = 0; switch (Amt->getType()->getTypeID()) { default: assert(0 && "Unknown FP type!"); case Type::FloatTyID: Name = F32Name; break; case Type::DoubleTyID: Name = F64Name; break; + case Type::X86_FP80TyID: + case Type::PPC_FP128TyID: + case Type::FP128TyID: Name = LongDoubleName; break; } return Builder.CreateCall(cast( 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=42141&r1=42140&r2=42141&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-internal.h Wed Sep 19 12:26:19 2007 @@ -558,7 +558,7 @@ Value *EmitBuiltinUnaryFPOp(Value *Amt, Intrinsic::ID F32ID, Intrinsic::ID F64ID); Value *EmitBuiltinUnaryFPOp(Value *InVal, const char *F32Name, - const char *F64Name); + const char *F64Name, const char *LongDoubleName); Value *EmitBuiltinPOWI(tree_node *exp); bool EmitBuiltinConstantP(tree_node *exp, Value *&Result); From dalej at apple.com Wed Sep 19 12:44:07 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Sep 2007 17:44:07 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42142 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-internal.h Message-ID: <200709191744.l8JHi7Ls021278@zion.cs.uiuc.edu> Author: johannes Date: Wed Sep 19 12:44:07 2007 New Revision: 42142 URL: http://llvm.org/viewvc/llvm-project?rev=42142&view=rev Log: Handle fabsl. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-internal.h 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=42142&r1=42141&r2=42142&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Sep 19 12:44:07 2007 @@ -2734,7 +2734,7 @@ return Builder.CreateSelect(Cmp, Op, OpN, "abs"); } else { // Turn FP abs into fabs/fabsf. - return EmitBuiltinUnaryFPOp(Op, "fabsf", "fabs"); + return EmitBuiltinUnaryFPOp(Op, "fabsf", "fabs", "fabsl"); } } @@ -3998,13 +3998,17 @@ } Value *TreeToLLVM::EmitBuiltinUnaryFPOp(Value *Amt, const char *F32Name, - const char *F64Name) { + const char *F64Name, + const char *LongDoubleName) { const char *Name = 0; switch (Amt->getType()->getTypeID()) { default: assert(0 && "Unknown FP type!"); case Type::FloatTyID: Name = F32Name; break; case Type::DoubleTyID: Name = F64Name; break; + case Type::X86_FP80TyID: + case Type::PPC_FP128TyID: + case Type::FP128TyID: Name = LongDoubleName; break; } return Builder.CreateCall(cast( 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=42142&r1=42141&r2=42142&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Wed Sep 19 12:44:07 2007 @@ -502,7 +502,7 @@ Value *EmitBuiltinUnaryFPOp(Value *Amt, Intrinsic::ID F32ID, Intrinsic::ID F64ID); Value *EmitBuiltinUnaryFPOp(Value *InVal, const char *F32Name, - const char *F64Name); + const char *F64Name, const char *LongDoubleName); Value *EmitBuiltinPOWI(tree_node *exp); bool EmitBuiltinConstantP(tree_node *exp, Value *&Result); From dpatel at apple.com Wed Sep 19 12:49:51 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 19 Sep 2007 10:49:51 -0700 Subject: [llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll In-Reply-To: <20070919164914.GF10864@village.us.cray.com> References: <20070919164914.GF10864@village.us.cray.com> Message-ID: <61042774-0422-47C1-9FBC-CFDEC989F2C5@apple.com> On Sep 19, 2007, at 9:49 AM, Dan Gohman wrote: >> Exactly, that's what I meant to say when I said "when loop >> conditionals are runtime dependent". To ensure safety in >> PromoteValuesInLoop(), one needs to prove that basic-block is >> executed >> at least once. The question is how ? > > The most general way to do this is to convert loops like this: > > while (x) { > body; > } > > to this: > > if (x) { > do { > body; > } while (x); > } > > In the second form, code hoisted/sunk/promoted out of the loop will > still be under the guard of the if. Also see tree-ssa-loop-ch.c in > GCC, > for example. In llvm, loop-rotation pass does this. However, what if LICM input is not processed by loop rotation pass ? One conservative approach is to check whether StoreInst and LoadInst in question dominates loop exit(s) or not. I'll try it and see if it affects performance for nightly tester benchmarks or not. - Devang From dalej at apple.com Wed Sep 19 12:53:26 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Sep 2007 17:53:26 -0000 Subject: [llvm-commits] [llvm] r42143 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200709191753.l8JHrQoK021609@zion.cs.uiuc.edu> Author: johannes Date: Wed Sep 19 12:53:26 2007 New Revision: 42143 URL: http://llvm.org/viewvc/llvm-project?rev=42143&view=rev Log: Fix longdouble -> uint conversion. 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=42143&r1=42142&r2=42143&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Sep 19 12:53:26 2007 @@ -3211,8 +3211,9 @@ SDOperand True, False; MVT::ValueType VT = Node->getOperand(0).getValueType(); MVT::ValueType NVT = Node->getValueType(0); - unsigned ShiftAmt = MVT::getSizeInBits(Node->getValueType(0))-1; - Tmp2 = DAG.getConstantFP((double)(1ULL << ShiftAmt), VT); + unsigned ShiftAmt = MVT::getSizeInBits(NVT)-1; + Tmp2 = DAG.getConstantFP(APFloat(APInt(MVT::getSizeInBits(VT), + 1ULL << ShiftAmt)), VT); Tmp3 = DAG.getSetCC(TLI.getSetCCResultTy(), Node->getOperand(0), Tmp2, ISD::SETLT); True = DAG.getNode(ISD::FP_TO_SINT, NVT, Node->getOperand(0)); From clattner at apple.com Wed Sep 19 12:58:33 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 19 Sep 2007 10:58:33 -0700 Subject: [llvm-commits] [llvm] r42075 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PrompteValue.ll In-Reply-To: <61042774-0422-47C1-9FBC-CFDEC989F2C5@apple.com> References: <20070919164914.GF10864@village.us.cray.com> <61042774-0422-47C1-9FBC-CFDEC989F2C5@apple.com> Message-ID: <2953F0FD-5CBD-4C49-BC6D-99CCB7A910B2@apple.com> On Sep 19, 2007, at 10:49 AM, Devang Patel wrote: >> >> In the second form, code hoisted/sunk/promoted out of the loop will >> still be under the guard of the if. Also see tree-ssa-loop-ch.c in >> GCC, >> for example. > > In llvm, loop-rotation pass does this. However, what if LICM input is > not processed by loop rotation pass ? One conservative approach is to > check whether StoreInst and LoadInst in question dominates loop > exit(s) or not. I'll try it and see if it affects performance for > nightly tester benchmarks or not. LICM should verify that the loop is in the right form and disable the xform if not. We should arrange for the optimizer to run loop rotate before licm (as we currently do), but it's not always profitable to rotate the loop (e.g. if the condition is large). -Chris From evan.cheng at apple.com Wed Sep 19 14:02:48 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 19 Sep 2007 19:02:48 -0000 Subject: [llvm-commits] [llvm] r42147 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200709191902.l8JJ2mqL025825@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 19 14:02:47 2007 New Revision: 42147 URL: http://llvm.org/viewvc/llvm-project?rev=42147&view=rev Log: PSHUFDmi, etc. are actually folding a load, not a store. 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=42147&r1=42146&r2=42147&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Wed Sep 19 14:02:47 2007 @@ -677,9 +677,6 @@ { X86::MUL32r, X86::MUL32m }, { X86::MUL64r, X86::MUL64m }, { X86::MUL8r, X86::MUL8m }, - { X86::PSHUFDri, X86::PSHUFDmi }, - { X86::PSHUFHWri, X86::PSHUFHWmi }, - { X86::PSHUFLWri, X86::PSHUFLWmi }, { X86::SETAEr, X86::SETAEm }, { X86::SETAr, X86::SETAm }, { X86::SETBEr, X86::SETBEm }, @@ -794,6 +791,9 @@ { X86::MOVZX32rr8, X86::MOVZX32rm8 }, { X86::MOVZX64rr16, X86::MOVZX64rm16 }, { X86::MOVZX64rr8, X86::MOVZX64rm8 }, + { X86::PSHUFDri, X86::PSHUFDmi }, + { X86::PSHUFHWri, X86::PSHUFHWmi }, + { X86::PSHUFLWri, X86::PSHUFLWmi }, { X86::PsMOVZX64rr32, X86::PsMOVZX64rm32 }, { X86::TEST16rr, X86::TEST16rm }, { X86::TEST32rr, X86::TEST32rm }, From dpatel at apple.com Wed Sep 19 15:18:53 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 19 Sep 2007 20:18:53 -0000 Subject: [llvm-commits] [llvm] r42149 - in /llvm/trunk: lib/Transforms/Scalar/LICM.cpp test/Transforms/LICM/2007-09-17-PromoteValue.ll Message-ID: <200709192018.l8JKIrl9029619@zion.cs.uiuc.edu> Author: dpatel Date: Wed Sep 19 15:18:51 2007 New Revision: 42149 URL: http://llvm.org/viewvc/llvm-project?rev=42149&view=rev Log: Avoid unsafe promotion. Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp llvm/trunk/test/Transforms/LICM/2007-09-17-PromoteValue.ll Modified: llvm/trunk/lib/Transforms/Scalar/LICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LICM.cpp?rev=42149&r1=42148&r2=42149&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LICM.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LICM.cpp Wed Sep 19 15:18:51 2007 @@ -759,15 +759,24 @@ } /// FindPromotableValuesInLoop - Check the current loop for stores to definite -/// pointers, which are not loaded and stored through may aliases. If these are -/// found, create an alloca for the value, add it to the PromotedValues list, -/// and keep track of the mapping from value to alloca. -/// +/// pointers, which are not loaded and stored through may aliases and are safe +/// for promotion. If these are found, create an alloca for the value, add it +/// to the PromotedValues list, and keep track of the mapping from value to +/// alloca. void LICM::FindPromotableValuesInLoop( std::vector > &PromotedValues, std::map &ValueToAllocaMap) { Instruction *FnStart = CurLoop->getHeader()->getParent()->begin()->begin(); + SmallVector LoopExits; + SmallVector Blocks; + CurLoop->getExitingBlocks(Blocks); + for (SmallVector::iterator BI = Blocks.begin(), + BE = Blocks.end(); BI != BE; ++BI) { + BasicBlock *BB = *BI; + LoopExits.push_back(BB->getTerminator()); + } + // Loop over all of the alias sets in the tracker object. for (AliasSetTracker::iterator I = CurAST->begin(), E = CurAST->end(); I != E; ++I) { @@ -791,14 +800,37 @@ break; } - // If GEP base is NULL then the calculated address used by Store or - // Load instruction is invalid. Do not promote this value because - // it may expose load and store instruction that are covered by - // condition which may not yet folded. - if (GetElementPtrInst *GEP = dyn_cast(V)) + if (GetElementPtrInst *GEP = dyn_cast(V)) { + // If GEP base is NULL then the calculated address used by Store or + // Load instruction is invalid. Do not promote this value because + // it may expose load and store instruction that are covered by + // condition which may not yet folded. if (isa(GEP->getOperand(0))) PointerOk = false; + // If GEP is use is not dominating loop exit then promoting + // GEP may expose unsafe load and store instructions unconditinally. + if (PointerOk) + for(Value::use_iterator UI = V->use_begin(), UE = V->use_end(); + UI != UE && PointerOk; ++UI) { + Instruction *Use = dyn_cast(*UI); + if (!Use) + continue; + for (SmallVector::iterator + ExitI = LoopExits.begin(), ExitE = LoopExits.end(); + ExitI != ExitE; ++ExitI) { + Instruction *Ex = *ExitI; + if (!DT->dominates(Use, Ex)){ + PointerOk = false; + break; + } + } + + if (!PointerOk) + break; + } + } + if (PointerOk) { const Type *Ty = cast(V->getType())->getElementType(); AllocaInst *AI = new AllocaInst(Ty, 0, V->getName()+".tmp", FnStart); Modified: llvm/trunk/test/Transforms/LICM/2007-09-17-PromoteValue.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LICM/2007-09-17-PromoteValue.ll?rev=42149&r1=42148&r2=42149&view=diff ============================================================================== --- llvm/trunk/test/Transforms/LICM/2007-09-17-PromoteValue.ll (original) +++ llvm/trunk/test/Transforms/LICM/2007-09-17-PromoteValue.ll Wed Sep 19 15:18:51 2007 @@ -23,4 +23,39 @@ unreachable } +define i32 @f(i8* %ptr) { +entry: + br label %loop.head + +loop.head: ; preds = %cond.true, %entry + %x = phi i8* [ %ptr, %entry ], [ %ptr.i, %cond.true ] ; [#uses=1] + %tmp3.i = icmp ne i8* %ptr, %x ; [#uses=1] + br i1 %tmp3.i, label %cond.true, label %exit + +cond.true: ; preds = %loop.head + %ptr.i = getelementptr i8* %ptr, i32 0 ; [#uses=2] + store i8 0, i8* %ptr.i + br label %loop.head + +exit: ; preds = %loop.head + ret i32 0 +} + +define i32 @f2(i8* %p, i8* %q) { +entry: + br label %loop.head + +loop.head: ; preds = %cond.true, %entry + %tmp3.i = icmp eq i8* null, %q ; [#uses=1] + br i1 %tmp3.i, label %exit, label %cond.true + +cond.true: ; preds = %loop.head + %ptr.i = getelementptr i8* %p, i32 0 ; [#uses=2] + store i8 0, i8* %ptr.i + br label %loop.head + +exit: ; preds = %loop.head + ret i32 0 +} + declare void @exit(i32) From gabor at mac.com Wed Sep 19 15:47:55 2007 From: gabor at mac.com (Gabor Greif) Date: Wed, 19 Sep 2007 22:47:55 +0200 Subject: [llvm-commits] [llvm] r42129 - /llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Message-ID: <65313633-0755-4F5F-A3B4-FDCD28CFCAE7@mac.com> Hi Gordon, I have no OCaml on those machines. Do you think OCaml is by default installed on machines nowadays? Otherwise --without-ocamlc should be the default to be overridden with --with-ocamlc. What do you think? Gabor From kremenek at apple.com Wed Sep 19 16:26:49 2007 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 19 Sep 2007 21:26:49 -0000 Subject: [llvm-commits] [llvm] r42151 - /llvm/trunk/include/llvm/Support/GraphWriter.h Message-ID: <200709192126.l8JLQnQO032733@zion.cs.uiuc.edu> Author: kremenek Date: Wed Sep 19 16:26:49 2007 New Revision: 42151 URL: http://llvm.org/viewvc/llvm-project?rev=42151&view=rev Log: Previously GraphWriter assumed operator*() for node_iterator always returned a reference type. This patch allows operator*() to return a non-reference type while still maintaining the old behavior when it does return a reference type. This patch was motivated when I tried to use "df_iterator" (see llvm/ADT/DepthFirstIterator.h) as a "node_iterator", as df_iterator does not return a reference type and thus we would get a compilation error when trying to take the address of a temporary. Modified: llvm/trunk/include/llvm/Support/GraphWriter.h Modified: llvm/trunk/include/llvm/Support/GraphWriter.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/GraphWriter.h?rev=42151&r1=42150&r2=42151&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/GraphWriter.h (original) +++ llvm/trunk/include/llvm/Support/GraphWriter.h Wed Sep 19 16:26:49 2007 @@ -101,7 +101,11 @@ // Loop over the graph, printing it out... for (node_iterator I = GTraits::nodes_begin(G), E = GTraits::nodes_end(G); I != E; ++I) - writeNode(&*I); + writeNode(*I); + } + + void writeNode(NodeType& Node) { + writeNode(&Node); } void writeNode(NodeType *const *Node) { From evan.cheng at apple.com Wed Sep 19 16:48:07 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 19 Sep 2007 21:48:07 -0000 Subject: [llvm-commits] [llvm] r42153 - /llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Message-ID: <200709192148.l8JLm8EW001057@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 19 16:48:07 2007 New Revision: 42153 URL: http://llvm.org/viewvc/llvm-project?rev=42153&view=rev Log: Avoid referencing deleted instruction. Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Modified: llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=42153&r1=42152&r2=42153&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Wed Sep 19 16:48:07 2007 @@ -317,7 +317,9 @@ /// => /// ldmdb rn!, static bool mergeBaseUpdateLSMultiple(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MBBI) { + MachineBasicBlock::iterator MBBI, + bool &Advance, + MachineBasicBlock::iterator &I) { MachineInstr *MI = MBBI; unsigned Base = MI->getOperand(0).getReg(); unsigned Bytes = getLSMultipleTransferSize(MI); @@ -358,11 +360,19 @@ if ((Mode == ARM_AM::ia || Mode == ARM_AM::ib) && isMatchingIncrement(NextMBBI, Base, Bytes, Pred, PredReg)) { MI->getOperand(1).setImm(ARM_AM::getAM4ModeImm(Mode, true)); + if (NextMBBI == I) { + Advance = true; + ++I; + } MBB.erase(NextMBBI); return true; } else if ((Mode == ARM_AM::da || Mode == ARM_AM::db) && isMatchingDecrement(NextMBBI, Base, Bytes, Pred, PredReg)) { MI->getOperand(1).setImm(ARM_AM::getAM4ModeImm(Mode, true)); + if (NextMBBI == I) { + Advance = true; + ++I; + } MBB.erase(NextMBBI); return true; } @@ -389,6 +399,10 @@ if (Mode == ARM_AM::ia && isMatchingIncrement(NextMBBI, Base, Bytes, Pred, PredReg)) { MI->getOperand(1).setImm(ARM_AM::getAM5Opc(ARM_AM::ia, true, Offset)); + if (NextMBBI == I) { + Advance = true; + ++I; + } MBB.erase(NextMBBI); } return true; @@ -428,7 +442,9 @@ /// register into the LDR/STR/FLD{D|S}/FST{D|S} op when possible: static bool mergeBaseUpdateLoadStore(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, - const TargetInstrInfo *TII) { + const TargetInstrInfo *TII, + bool &Advance, + MachineBasicBlock::iterator &I) { MachineInstr *MI = MBBI; unsigned Base = MI->getOperand(1).getReg(); bool BaseKill = MI->getOperand(1).isKill(); @@ -475,8 +491,13 @@ DoMerge = true; NewOpc = getPostIndexedLoadStoreOpcode(Opcode); } - if (DoMerge) + if (DoMerge) { + if (NextMBBI == I) { + Advance = true; + ++I; + } MBB.erase(NextMBBI); + } } if (!DoMerge) @@ -668,7 +689,7 @@ // Try folding preceeding/trailing base inc/dec into the generated // LDM/STM ops. for (unsigned i = 0, e = MBBII.size(); i < e; ++i) - if (mergeBaseUpdateLSMultiple(MBB, MBBII[i])) + if (mergeBaseUpdateLSMultiple(MBB, MBBII[i], Advance, MBBI)) NumMerges++; NumMerges += MBBII.size(); @@ -676,7 +697,7 @@ // that were not merged to form LDM/STM ops. for (unsigned i = 0; i != NumMemOps; ++i) if (!MemOps[i].Merged) - if (mergeBaseUpdateLoadStore(MBB, MemOps[i].MBBI, TII)) + if (mergeBaseUpdateLoadStore(MBB, MemOps[i].MBBI, TII,Advance,MBBI)) NumMerges++; // RS may be pointing to an instruction that's deleted. From evan.cheng at apple.com Wed Sep 19 17:07:01 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 19 Sep 2007 22:07:01 -0000 Subject: [llvm-commits] [llvm] r42154 - /llvm/branches/release_21/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Message-ID: <200709192207.l8JM71LO001958@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 19 17:07:00 2007 New Revision: 42154 URL: http://llvm.org/viewvc/llvm-project?rev=42154&view=rev Log: Merge -r42152:42153 svn/llvm-project/llvm/trunk Modified: llvm/branches/release_21/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Modified: llvm/branches/release_21/lib/Target/ARM/ARMLoadStoreOptimizer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/Target/ARM/ARMLoadStoreOptimizer.cpp?rev=42154&r1=42153&r2=42154&view=diff ============================================================================== --- llvm/branches/release_21/lib/Target/ARM/ARMLoadStoreOptimizer.cpp (original) +++ llvm/branches/release_21/lib/Target/ARM/ARMLoadStoreOptimizer.cpp Wed Sep 19 17:07:00 2007 @@ -317,7 +317,9 @@ /// => /// ldmdb rn!, static bool mergeBaseUpdateLSMultiple(MachineBasicBlock &MBB, - MachineBasicBlock::iterator MBBI) { + MachineBasicBlock::iterator MBBI, + bool &Advance, + MachineBasicBlock::iterator &I) { MachineInstr *MI = MBBI; unsigned Base = MI->getOperand(0).getReg(); unsigned Bytes = getLSMultipleTransferSize(MI); @@ -358,11 +360,19 @@ if ((Mode == ARM_AM::ia || Mode == ARM_AM::ib) && isMatchingIncrement(NextMBBI, Base, Bytes, Pred, PredReg)) { MI->getOperand(1).setImm(ARM_AM::getAM4ModeImm(Mode, true)); + if (NextMBBI == I) { + Advance = true; + ++I; + } MBB.erase(NextMBBI); return true; } else if ((Mode == ARM_AM::da || Mode == ARM_AM::db) && isMatchingDecrement(NextMBBI, Base, Bytes, Pred, PredReg)) { MI->getOperand(1).setImm(ARM_AM::getAM4ModeImm(Mode, true)); + if (NextMBBI == I) { + Advance = true; + ++I; + } MBB.erase(NextMBBI); return true; } @@ -389,6 +399,10 @@ if (Mode == ARM_AM::ia && isMatchingIncrement(NextMBBI, Base, Bytes, Pred, PredReg)) { MI->getOperand(1).setImm(ARM_AM::getAM5Opc(ARM_AM::ia, true, Offset)); + if (NextMBBI == I) { + Advance = true; + ++I; + } MBB.erase(NextMBBI); } return true; @@ -428,7 +442,9 @@ /// register into the LDR/STR/FLD{D|S}/FST{D|S} op when possible: static bool mergeBaseUpdateLoadStore(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, - const TargetInstrInfo *TII) { + const TargetInstrInfo *TII, + bool &Advance, + MachineBasicBlock::iterator &I) { MachineInstr *MI = MBBI; unsigned Base = MI->getOperand(1).getReg(); bool BaseKill = MI->getOperand(1).isKill(); @@ -475,8 +491,13 @@ DoMerge = true; NewOpc = getPostIndexedLoadStoreOpcode(Opcode); } - if (DoMerge) + if (DoMerge) { + if (NextMBBI == I) { + Advance = true; + ++I; + } MBB.erase(NextMBBI); + } } if (!DoMerge) @@ -668,7 +689,7 @@ // Try folding preceeding/trailing base inc/dec into the generated // LDM/STM ops. for (unsigned i = 0, e = MBBII.size(); i < e; ++i) - if (mergeBaseUpdateLSMultiple(MBB, MBBII[i])) + if (mergeBaseUpdateLSMultiple(MBB, MBBII[i], Advance, MBBI)) NumMerges++; NumMerges += MBBII.size(); @@ -676,7 +697,7 @@ // that were not merged to form LDM/STM ops. for (unsigned i = 0; i != NumMemOps; ++i) if (!MemOps[i].Merged) - if (mergeBaseUpdateLoadStore(MBB, MemOps[i].MBBI, TII)) + if (mergeBaseUpdateLoadStore(MBB, MemOps[i].MBBI, TII,Advance,MBBI)) NumMerges++; // RS may be pointing to an instruction that's deleted. From gordonhenriksen at mac.com Wed Sep 19 17:33:18 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Wed, 19 Sep 2007 18:33:18 -0400 Subject: [llvm-commits] [llvm] r42129 - /llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c In-Reply-To: <65313633-0755-4F5F-A3B4-FDCD28CFCAE7@mac.com> References: <65313633-0755-4F5F-A3B4-FDCD28CFCAE7@mac.com> Message-ID: Hello again Gabor, On Sep 19, 2007, at 16:47, Gabor Greif wrote: > Hi Gordon, > > I have no OCaml on those machines. Those directories are skipped if ocamlc is not found. Can you attach your Makefile.config? > Do you think OCaml is by default installed on machines nowadays? Perhaps some Linux distros. > Otherwise --without-ocamlc should be the default to be overridden > with --with-ocamlc. > > What do you think? I think it should build if ocaml is present?which is what I implemented. :) ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070919/95dd3804/attachment.html From dalej at apple.com Wed Sep 19 18:55:37 2007 From: dalej at apple.com (Dale Johannesen) Date: Wed, 19 Sep 2007 23:55:37 -0000 Subject: [llvm-commits] [llvm] r42155 - in /llvm/trunk: include/llvm/CodeGen/RuntimeLibcalls.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/TargetLowering.cpp lib/Target/X86/X86CallingConv.td lib/Target/X86/X86ISelLowering.cpp Message-ID: <200709192355.l8JNtc4E005144@zion.cs.uiuc.edu> Author: johannes Date: Wed Sep 19 18:55:34 2007 New Revision: 42155 URL: http://llvm.org/viewvc/llvm-project?rev=42155&view=rev Log: More long double fixes. x86_64 should build now. Modified: llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/trunk/lib/Target/X86/X86CallingConv.td llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h?rev=42155&r1=42154&r2=42155&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h (original) +++ llvm/trunk/include/llvm/CodeGen/RuntimeLibcalls.h Wed Sep 19 18:55:34 2007 @@ -70,14 +70,18 @@ FPTOSINT_F32_I64, FPTOSINT_F64_I32, FPTOSINT_F64_I64, + FPTOSINT_LD_I64, FPTOUINT_F32_I32, FPTOUINT_F32_I64, FPTOUINT_F64_I32, FPTOUINT_F64_I64, + FPTOUINT_LD_I32, + FPTOUINT_LD_I64, SINTTOFP_I32_F32, SINTTOFP_I32_F64, SINTTOFP_I64_F32, SINTTOFP_I64_F64, + SINTTOFP_I64_LD, UINTTOFP_I32_F32, UINTTOFP_I32_F64, UINTTOFP_I64_F32, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=42155&r1=42154&r2=42155&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Sep 19 18:55:34 2007 @@ -3212,8 +3212,11 @@ MVT::ValueType VT = Node->getOperand(0).getValueType(); MVT::ValueType NVT = Node->getValueType(0); unsigned ShiftAmt = MVT::getSizeInBits(NVT)-1; - Tmp2 = DAG.getConstantFP(APFloat(APInt(MVT::getSizeInBits(VT), - 1ULL << ShiftAmt)), VT); + const uint64_t zero[] = {0, 0}; + APFloat apf = APFloat(APInt(MVT::getSizeInBits(VT), 2, zero)); + uint64_t x = 1ULL << ShiftAmt; + (void)apf.convertFromInteger(&x, 1, false, APFloat::rmTowardZero); + Tmp2 = DAG.getConstantFP(apf, VT); Tmp3 = DAG.getSetCC(TLI.getSetCCResultTy(), Node->getOperand(0), Tmp2, ISD::SETLT); True = DAG.getNode(ISD::FP_TO_SINT, NVT, Node->getOperand(0)); @@ -3235,22 +3238,34 @@ MVT::ValueType VT = Op.getValueType(); RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL; switch (Node->getOpcode()) { - case ISD::FP_TO_SINT: - if (Node->getOperand(0).getValueType() == MVT::f32) + case ISD::FP_TO_SINT: { + MVT::ValueType OVT = Node->getOperand(0).getValueType(); + if (OVT == MVT::f32) LC = (VT == MVT::i32) ? RTLIB::FPTOSINT_F32_I32 : RTLIB::FPTOSINT_F32_I64; - else + else if (OVT == MVT::f64) LC = (VT == MVT::i32) ? RTLIB::FPTOSINT_F64_I32 : RTLIB::FPTOSINT_F64_I64; + else if (OVT == MVT::f80 || OVT == MVT::f128 || OVT == MVT::ppcf128) { + assert(VT == MVT::i64); + LC = RTLIB::FPTOSINT_LD_I64; + } break; - case ISD::FP_TO_UINT: - if (Node->getOperand(0).getValueType() == MVT::f32) + } + case ISD::FP_TO_UINT: { + MVT::ValueType OVT = Node->getOperand(0).getValueType(); + if (OVT == MVT::f32) LC = (VT == MVT::i32) ? RTLIB::FPTOUINT_F32_I32 : RTLIB::FPTOSINT_F32_I64; - else + else if (OVT == MVT::f64) LC = (VT == MVT::i32) ? RTLIB::FPTOUINT_F64_I32 : RTLIB::FPTOSINT_F64_I64; + else if (OVT == MVT::f80 || OVT == MVT::f128 || OVT == MVT::ppcf128) { + LC = (VT == MVT::i32) + ? RTLIB::FPTOUINT_LD_I32 : RTLIB::FPTOUINT_LD_I64; + } break; + } default: assert(0 && "Unreachable!"); } SDOperand Dummy; @@ -4767,8 +4782,7 @@ if (DestVT == MVT::f32) FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx, NULL, 0); else { - assert(DestVT == MVT::f64 && "Unexpected conversion"); - FudgeInReg = LegalizeOp(DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, + FudgeInReg = LegalizeOp(DAG.getExtLoad(ISD::EXTLOAD, DestVT, DAG.getEntryNode(), CPIdx, NULL, 0, MVT::f32)); } @@ -5350,8 +5364,10 @@ RTLIB::Libcall LC; if (Node->getOperand(0).getValueType() == MVT::f32) LC = RTLIB::FPTOSINT_F32_I64; - else + else if (Node->getOperand(0).getValueType() == MVT::f64) LC = RTLIB::FPTOSINT_F64_I64; + else + LC = RTLIB::FPTOSINT_LD_I64; Lo = ExpandLibCall(TLI.getLibcallName(LC), Node, false/*sign irrelevant*/, Hi); break; @@ -5730,8 +5746,12 @@ if (Node->getOperand(0).getValueType() == MVT::i64) { if (VT == MVT::f32) LC = isSigned ? RTLIB::SINTTOFP_I64_F32 : RTLIB::UINTTOFP_I64_F32; - else + else if (VT == MVT::f64) LC = isSigned ? RTLIB::SINTTOFP_I64_F64 : RTLIB::UINTTOFP_I64_F64; + else if (VT == MVT::f80 || VT == MVT::f128 || VT == MVT::ppcf128) { + assert(isSigned); + LC = RTLIB::SINTTOFP_I64_LD; + } } else { if (VT == MVT::f32) LC = isSigned ? RTLIB::SINTTOFP_I32_F32 : RTLIB::UINTTOFP_I32_F32; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=42155&r1=42154&r2=42155&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Sep 19 18:55:34 2007 @@ -1591,8 +1591,14 @@ case ISD::ANY_EXTEND: case ISD::ZERO_EXTEND: return getConstant(Val, VT); case ISD::TRUNCATE: return getConstant(Val, VT); - case ISD::SINT_TO_FP: return getConstantFP(C->getSignExtended(), VT); - case ISD::UINT_TO_FP: return getConstantFP(C->getValue(), VT); + case ISD::UINT_TO_FP: + case ISD::SINT_TO_FP: { + const uint64_t zero[] = {0, 0}; + APFloat apf = APFloat(APInt(MVT::getSizeInBits(VT), 2, zero)); + (void)apf.convertFromInteger(&Val, 1, Opcode==ISD::SINT_TO_FP, + APFloat::rmTowardZero); + return getConstantFP(apf, VT); + } case ISD::BIT_CONVERT: if (VT == MVT::f32 && C->getValueType(0) == MVT::i32) return getConstantFP(BitsToFloat(Val), VT); @@ -1669,8 +1675,12 @@ case ISD::FP_EXTEND: // This can return overflow, underflow, or inexact; we don't care. // FIXME need to be more flexible about rounding mode. + // FIXME need to be more flexible about rounding mode. (void) V.convert(VT==MVT::f32 ? APFloat::IEEEsingle : - APFloat::IEEEdouble, + VT==MVT::f64 ? APFloat::IEEEdouble : + VT==MVT::f80 ? APFloat::x87DoubleExtended : + VT==MVT::f128 ? APFloat::IEEEquad : + APFloat::Bogus, APFloat::rmNearestTiesToEven); return getConstantFP(V, VT); case ISD::FP_TO_SINT: Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=42155&r1=42154&r2=42155&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed Sep 19 18:55:34 2007 @@ -69,14 +69,18 @@ Names[RTLIB::FPTOSINT_F32_I64] = "__fixsfdi"; Names[RTLIB::FPTOSINT_F64_I32] = "__fixdfsi"; Names[RTLIB::FPTOSINT_F64_I64] = "__fixdfdi"; + Names[RTLIB::FPTOSINT_LD_I64] = "__fixxfdi"; Names[RTLIB::FPTOUINT_F32_I32] = "__fixunssfsi"; Names[RTLIB::FPTOUINT_F32_I64] = "__fixunssfdi"; Names[RTLIB::FPTOUINT_F64_I32] = "__fixunsdfsi"; Names[RTLIB::FPTOUINT_F64_I64] = "__fixunsdfdi"; + Names[RTLIB::FPTOUINT_LD_I32] = "__fixunsxfsi"; + Names[RTLIB::FPTOUINT_LD_I64] = "__fixunsxfdi"; Names[RTLIB::SINTTOFP_I32_F32] = "__floatsisf"; Names[RTLIB::SINTTOFP_I32_F64] = "__floatsidf"; Names[RTLIB::SINTTOFP_I64_F32] = "__floatdisf"; Names[RTLIB::SINTTOFP_I64_F64] = "__floatdidf"; + Names[RTLIB::SINTTOFP_I64_LD] = "__floatdixf"; Names[RTLIB::UINTTOFP_I32_F32] = "__floatunsisf"; Names[RTLIB::UINTTOFP_I32_F64] = "__floatunsidf"; Names[RTLIB::UINTTOFP_I64_F32] = "__floatundisf"; Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=42155&r1=42154&r2=42155&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CallingConv.td (original) +++ llvm/trunk/lib/Target/X86/X86CallingConv.td Wed Sep 19 18:55:34 2007 @@ -118,8 +118,10 @@ // 8-byte aligned if there are no more registers to hold them. CCIfType<[i32, i64, f32, f64], CCAssignToStack<8, 8>>, + // Long doubles get 16-byte stack slots that are 16-byte aligned. // Vectors get 16-byte stack slots that are 16-byte aligned. - CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], CCAssignToStack<16, 16>>, + CCIfType<[f80, v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], + CCAssignToStack<16, 16>>, // __m64 vectors get 8-byte stack slots that are 8-byte aligned. CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToStack<8, 8>> Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=42155&r1=42154&r2=42155&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Sep 19 18:55:34 2007 @@ -108,11 +108,10 @@ setOperationAction(ISD::SINT_TO_FP , MVT::i32 , Custom); } - if (!Subtarget->is64Bit()) { - // Custom lower SINT_TO_FP and FP_TO_SINT from/to i64 in 32-bit mode. - setOperationAction(ISD::SINT_TO_FP , MVT::i64 , Custom); - setOperationAction(ISD::FP_TO_SINT , MVT::i64 , Custom); - } + // In 32-bit mode these are custom lowered. In 64-bit mode F32 and F64 + // are Legal, f80 is custom lowered. + setOperationAction(ISD::FP_TO_SINT , MVT::i64 , Custom); + setOperationAction(ISD::SINT_TO_FP , MVT::i64 , Custom); // Promote i1/i8 FP_TO_SINT to larger FP_TO_SINTS's, as X86 doesn't have // this operation. @@ -3343,6 +3342,9 @@ // These are really Legal; caller falls through into that case. if (SrcVT==MVT::i32 && Op.getValueType() != MVT::f80 && X86ScalarSSE) return Result; + if (SrcVT==MVT::i64 && Op.getValueType() != MVT::f80 && + Subtarget->is64Bit()) + return Result; // Build the FILD SDVTList Tys; @@ -3397,6 +3399,10 @@ if (Op.getValueType() == MVT::i32 && X86ScalarSSE && Op.getOperand(0).getValueType() != MVT::f80) return Result; + if (Subtarget->is64Bit() && + Op.getValueType() == MVT::i64 && + Op.getOperand(0).getValueType() != MVT::f80) + return Result; unsigned Opc; switch (Op.getValueType()) { From evan.cheng at apple.com Wed Sep 19 19:48:22 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 20 Sep 2007 00:48:22 -0000 Subject: [llvm-commits] [llvm] r42156 - /llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Message-ID: <200709200048.l8K0mNSC007397@zion.cs.uiuc.edu> Author: evancheng Date: Wed Sep 19 19:48:22 2007 New Revision: 42156 URL: http://llvm.org/viewvc/llvm-project?rev=42156&view=rev Log: Enable if-conversion for ARM by default. Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Modified: llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp?rev=42156&r1=42155&r2=42156&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMTargetMachine.cpp Wed Sep 19 19:48:22 2007 @@ -25,8 +25,8 @@ static cl::opt DisableLdStOpti("disable-arm-loadstore-opti", cl::Hidden, cl::desc("Disable load store optimization pass")); -static cl::opt EnableIfConversion("enable-arm-if-conversion", cl::Hidden, - cl::desc("Enable if-conversion pass")); +static cl::opt DisableIfConversion("disable-arm-if-conversion",cl::Hidden, + cl::desc("Disable if-conversion pass")); namespace { // Register the target. @@ -127,7 +127,7 @@ if (!Fast && !DisableLdStOpti && !Subtarget.isThumb()) PM.add(createARMLoadStoreOptimizationPass()); - if (!Fast && EnableIfConversion && !Subtarget.isThumb()) + if (!Fast && !DisableIfConversion && !Subtarget.isThumb()) PM.add(createIfConverterPass()); PM.add(createARMConstantIslandPass()); From nicholas at mxc.ca Wed Sep 19 19:48:37 2007 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 20 Sep 2007 00:48:37 -0000 Subject: [llvm-commits] [llvm] r42157 - in /llvm/trunk: lib/Transforms/Scalar/PredicateSimplifier.cpp test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll Message-ID: <200709200048.l8K0mbv1007415@zion.cs.uiuc.edu> Author: nicholas Date: Wed Sep 19 19:48:36 2007 New Revision: 42157 URL: http://llvm.org/viewvc/llvm-project?rev=42157&view=rev Log: Fix optimization. %x = sub %x, %y does not imply that %y is zero. Added: llvm/trunk/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Modified: llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp?rev=42157&r1=42156&r2=42157&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/PredicateSimplifier.cpp Wed Sep 19 19:48:36 2007 @@ -2001,7 +2001,7 @@ if (!isRelatedBy(Known, Zero, ICmpInst::ICMP_NE)) break; // otherwise, fall-through. case Instruction::Sub: - if (Unknown == Op1) break; + if (Unknown == Op0) break; // otherwise, fall-through. case Instruction::Xor: case Instruction::Add: Added: llvm/trunk/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll?rev=42157&view=auto ============================================================================== --- llvm/trunk/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll (added) +++ llvm/trunk/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll Wed Sep 19 19:48:36 2007 @@ -0,0 +1,102 @@ +; RUN: llvm-as < %s | opt -predsimplify | llvm-dis | grep -v unreachable +; PR1683 + + at .str = internal constant [13 x i8] c"c36174a.adb\00\00" ; <[13 x i8]*> [#uses=1] + +define void @_ada_c36174a() { +entry: + %tmp3 = call i8* @llvm.stacksave( ) ; [#uses=1] + %tmp4 = invoke i32 @report__ident_int( i32 6 ) + to label %invcont unwind label %entry.lpad_crit_edge ; [#uses=7] + +entry.lpad_crit_edge: ; preds = %entry + br label %lpad + +invcont: ; preds = %entry + %tmp6 = icmp slt i32 %tmp4, 1 ; [#uses=1] + br i1 %tmp6, label %bb, label %bb9 + +bb: ; preds = %invcont + invoke void @__gnat_rcheck_07( i8* getelementptr ([13 x i8]* @.str, i32 0, i32 0), i32 10 ) + to label %invcont8 unwind label %bb.lpad_crit_edge + +bb.lpad_crit_edge: ; preds = %bb + br label %lpad + +invcont8: ; preds = %bb + unreachable + +bb9: ; preds = %invcont + %tmp51 = add i32 %tmp4, 6 ; [#uses=2] + %tmp56 = icmp sgt i32 %tmp4, %tmp51 ; [#uses=1] + br i1 %tmp56, label %bb9.bb76_crit_edge, label %bb9.bb61_crit_edge + +bb9.bb61_crit_edge: ; preds = %bb9 + br label %bb61 + +bb9.bb76_crit_edge: ; preds = %bb9 + br label %bb76 + +bb61: ; preds = %bb73, %bb9.bb61_crit_edge + %J4b.0 = phi i32 [ %tmp75, %bb73 ], [ %tmp4, %bb9.bb61_crit_edge ] ; [#uses=2] + %tmp70 = icmp eq i32 %tmp51, %J4b.0 ; [#uses=1] + br i1 %tmp70, label %bb61.bb76_crit_edge, label %bb73 + +bb61.bb76_crit_edge: ; preds = %bb61 + br label %bb76 + +bb73: ; preds = %bb61 + %tmp75 = add i32 %J4b.0, 1 ; [#uses=1] + br label %bb61 + +bb76: ; preds = %bb61.bb76_crit_edge, %bb9.bb76_crit_edge + %tmp78 = icmp ne i32 %tmp4, 6 ; [#uses=1] + %tmp81 = add i32 %tmp4, 6 ; [#uses=1] + %tmp8182 = sext i32 %tmp81 to i64 ; [#uses=1] + %tmp8384 = sext i32 %tmp4 to i64 ; [#uses=1] + %tmp85 = sub i64 %tmp8182, %tmp8384 ; [#uses=1] + %tmp86 = icmp ne i64 %tmp85, 6 ; [#uses=1] + %tmp90 = or i1 %tmp78, %tmp86 ; [#uses=1] + br i1 %tmp90, label %bb93, label %bb76.bb99_crit_edge + +bb76.bb99_crit_edge: ; preds = %bb76 + br label %bb99 + +bb93: ; preds = %bb76 + invoke void @abort( ) + to label %bb93.bb99_crit_edge unwind label %bb93.lpad_crit_edge + +bb93.lpad_crit_edge: ; preds = %bb93 + br label %lpad + +bb93.bb99_crit_edge: ; preds = %bb93 + br label %bb99 + +bb99: ; preds = %bb93.bb99_crit_edge, %bb76.bb99_crit_edge + ret void + +lpad: ; preds = %bb93.lpad_crit_edge, %bb.lpad_crit_edge, %entry.lpad_crit_edge + %eh_ptr = call i8* @llvm.eh.exception( ) ; [#uses=2] + %eh_select102 = call i32 (i8*, i8*, ...)* @llvm.eh.selector.i32( i8* %eh_ptr, i8* bitcast (i32 (...)* @__gnat_eh_personality to i8*), i32 0 ) ; [#uses=0] + call void @llvm.stackrestore( i8* %tmp3 ) + call i32 (...)* @_Unwind_Resume( i8* %eh_ptr ) ; :0 [#uses=0] + unreachable +} + +declare i8* @llvm.stacksave() + +declare i32 @report__ident_int(i32) + +declare void @__gnat_rcheck_07(i8*, i32) + +declare void @abort() + +declare i8* @llvm.eh.exception() + +declare i32 @llvm.eh.selector.i32(i8*, i8*, ...) + +declare i32 @__gnat_eh_personality(...) + +declare i32 @_Unwind_Resume(...) + +declare void @llvm.stackrestore(i8*) From nicholas at mxc.ca Wed Sep 19 19:57:00 2007 From: nicholas at mxc.ca (Nick Lewycky) Date: Thu, 20 Sep 2007 00:57:00 -0000 Subject: [llvm-commits] [llvm] r42158 - /llvm/trunk/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll Message-ID: <200709200057.l8K0v0b0007717@zion.cs.uiuc.edu> Author: nicholas Date: Wed Sep 19 19:57:00 2007 New Revision: 42158 URL: http://llvm.org/viewvc/llvm-project?rev=42158&view=rev Log: Excuse me. Modified: llvm/trunk/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll Modified: llvm/trunk/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll?rev=42158&r1=42157&r2=42158&view=diff ============================================================================== --- llvm/trunk/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll (original) +++ llvm/trunk/test/Transforms/PredicateSimplifier/2007-09-19-Subtract.ll Wed Sep 19 19:57:00 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | opt -predsimplify | llvm-dis | grep -v unreachable +; RUN: llvm-as < %s | opt -predsimplify | llvm-dis | grep unreachable | count 2 ; PR1683 @.str = internal constant [13 x i8] c"c36174a.adb\00\00" ; <[13 x i8]*> [#uses=1] From dalej at apple.com Wed Sep 19 20:27:55 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 20 Sep 2007 01:27:55 -0000 Subject: [llvm-commits] [llvm] r42159 - /llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Message-ID: <200709200127.l8K1RtNb008655@zion.cs.uiuc.edu> Author: johannes Date: Wed Sep 19 20:27:54 2007 New Revision: 42159 URL: http://llvm.org/viewvc/llvm-project?rev=42159&view=rev Log: another long double buglet 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=42159&r1=42158&r2=42159&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original) +++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Wed Sep 19 20:27:54 2007 @@ -619,6 +619,7 @@ MI->getOpcode() == X86::ISTT_Fp16m64 || MI->getOpcode() == X86::ISTT_Fp32m64 || MI->getOpcode() == X86::ISTT_Fp64m64 || + MI->getOpcode() == X86::IST_Fp64m80 || MI->getOpcode() == X86::ISTT_Fp16m80 || MI->getOpcode() == X86::ISTT_Fp32m80 || MI->getOpcode() == X86::ISTT_Fp64m80 || From gabor at mac.com Thu Sep 20 04:52:28 2007 From: gabor at mac.com (Gabor Greif) Date: Thu, 20 Sep 2007 11:52:28 +0200 Subject: [llvm-commits] [llvm] r42129 - /llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c References: 65313633-0755-4F5F-A3B4-FDCD28CFCAE7@mac.com Message-ID: <46F242DC.7010606@mac.com> Hi Gordon, I have to correct myself, there *is* an OCaml on this system. ggreif at my [!293] ocamlc -version 3.08.3 I have grepped for intnat: find /opt/exp/lib/ocaml/caml | xargs grep intnat Nothing! Where is this supposed to live? I have these: ggreif at my [!296] find /opt/exp/lib/ocaml/caml /opt/exp/lib/ocaml/caml /opt/exp/lib/ocaml/caml/compatibility.h /opt/exp/lib/ocaml/caml/alloc.h /opt/exp/lib/ocaml/caml/bigarray.h /opt/exp/lib/ocaml/caml/callback.h /opt/exp/lib/ocaml/caml/config.h /opt/exp/lib/ocaml/caml/custom.h /opt/exp/lib/ocaml/caml/fail.h /opt/exp/lib/ocaml/caml/intext.h /opt/exp/lib/ocaml/caml/memory.h /opt/exp/lib/ocaml/caml/misc.h /opt/exp/lib/ocaml/caml/mlvalues.h /opt/exp/lib/ocaml/caml/printexc.h /opt/exp/lib/ocaml/caml/signals.h Gabor From ggreif at gmail.com Thu Sep 20 05:20:34 2007 From: ggreif at gmail.com (Gabor Greif) Date: Thu, 20 Sep 2007 10:20:34 -0000 Subject: [llvm-commits] [llvm] r42160 - /llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Message-ID: <200709201020.l8KAKY7P032411@zion.cs.uiuc.edu> Author: ggreif Date: Thu Sep 20 05:20:34 2007 New Revision: 42160 URL: http://llvm.org/viewvc/llvm-project?rev=42160&view=rev Log: use typenames equivalent to (u)intval, because latter are not present in older caml/mlvalues.h (e.g. 2004/07/07, 1.48.6.1) Using this as a workaround for now, until --without-ocaml works or we settle on a better solution Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=42160&r1=42159&r2=42160&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Thu Sep 20 05:20:34 2007 @@ -273,9 +273,9 @@ /* GCC warns if we use the ternary operator. */ unsigned long long N2; if (Bool_val(SExt)) - N2 = (intnat) Int_val(N); + N2 = (value) Int_val(N); else - N2 = (uintnat) Int_val(N); + N2 = (mlsize_t) Int_val(N); return (value) LLVMGetIntConstant((LLVMTypeRef) IntTy, N2, Bool_val(SExt)); } From gordonhenriksen at mac.com Thu Sep 20 06:42:12 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Thu, 20 Sep 2007 07:42:12 -0400 Subject: [llvm-commits] [llvm] r42129 - /llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c In-Reply-To: <46F242DC.7010606@mac.com> References: <65313633-0755-4F5F-A3B4-FDCD28CFCAE7@mac.com> <46F242DC.7010606@mac.com> Message-ID: <5E7803A3-EC06-40A2-BBD6-3E95C739288A@mac.com> On 2007-09-20, at 05:52, Gabor Greif wrote: > I have grepped for intnat: > > find /opt/exp/lib/ocaml/caml | xargs grep intnat > > Nothing! > > Where is this supposed to live? v3.09 and later, apparently. :) I'll retarget one of my dev systems a more primitive version for a bit. ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070920/a1f0b652/attachment.html From djg at cray.com Thu Sep 20 09:17:21 2007 From: djg at cray.com (Dan Gohman) Date: Thu, 20 Sep 2007 14:17:21 -0000 Subject: [llvm-commits] [llvm] r42162 - in /llvm/trunk: lib/Target/X86/X86RegisterInfo.cpp test/CodeGen/X86/sse_reload_fold.ll Message-ID: <200709201417.l8KEHLTF008094@zion.cs.uiuc.edu> Author: djg Date: Thu Sep 20 09:17:21 2007 New Revision: 42162 URL: http://llvm.org/viewvc/llvm-project?rev=42162&view=rev Log: Fix several more entries in the x86 reload/remat folding tables. Added: llvm/trunk/test/CodeGen/X86/sse_reload_fold.ll 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=42162&r1=42161&r2=42162&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Sep 20 09:17:21 2007 @@ -711,10 +711,6 @@ { X86::CMP32rr, X86::CMP32rm }, { X86::CMP64rr, X86::CMP64rm }, { X86::CMP8rr, X86::CMP8rm }, - { X86::CMPPDrri, X86::CMPPDrmi }, - { X86::CMPPSrri, X86::CMPPSrmi }, - { X86::CMPSDrr, X86::CMPSDrm }, - { X86::CMPSSrr, X86::CMPSSrm }, { X86::CVTSD2SSrr, X86::CVTSD2SSrm }, { X86::CVTSI2SD64rr, X86::CVTSI2SD64rm }, { X86::CVTSI2SDrr, X86::CVTSI2SDrm }, @@ -795,6 +791,20 @@ { X86::PSHUFHWri, X86::PSHUFHWmi }, { X86::PSHUFLWri, X86::PSHUFLWmi }, { X86::PsMOVZX64rr32, X86::PsMOVZX64rm32 }, + { X86::RCPPSr, X86::RCPPSm }, + { X86::RCPPSr_Int, X86::RCPPSm_Int }, + { X86::RSQRTPSr, X86::RSQRTPSm }, + { X86::RSQRTPSr_Int, X86::RSQRTPSm_Int }, + { X86::RSQRTSSr, X86::RSQRTSSm }, + { X86::RSQRTSSr_Int, X86::RSQRTSSm_Int }, + { X86::SQRTPDr, X86::SQRTPDm }, + { X86::SQRTPDr_Int, X86::SQRTPDm_Int }, + { X86::SQRTPSr, X86::SQRTPSm }, + { X86::SQRTPSr_Int, X86::SQRTPSm_Int }, + { X86::SQRTSDr, X86::SQRTSDm }, + { X86::SQRTSDr_Int, X86::SQRTSDm_Int }, + { X86::SQRTSSr, X86::SQRTSSm }, + { X86::SQRTSSr_Int, X86::SQRTSSm_Int }, { X86::TEST16rr, X86::TEST16rm }, { X86::TEST32rr, X86::TEST32rm }, { X86::TEST64rr, X86::TEST64rm }, @@ -875,6 +885,10 @@ { X86::CMOVS16rr, X86::CMOVS16rm }, { X86::CMOVS32rr, X86::CMOVS32rm }, { X86::CMOVS64rr, X86::CMOVS64rm }, + { X86::CMPPDrri, X86::CMPPDrmi }, + { X86::CMPPSrri, X86::CMPPSrmi }, + { X86::CMPSDrr, X86::CMPSDrm }, + { X86::CMPSSrr, X86::CMPSSrm }, { X86::DIVPDrr, X86::DIVPDrm }, { X86::DIVPSrr, X86::DIVPSrm }, { X86::DIVSDrr, X86::DIVSDrm }, @@ -965,24 +979,10 @@ { X86::PUNPCKLQDQrr, X86::PUNPCKLQDQrm }, { X86::PUNPCKLWDrr, X86::PUNPCKLWDrm }, { X86::PXORrr, X86::PXORrm }, - { X86::RCPPSr, X86::RCPPSm }, - { X86::RCPPSr_Int, X86::RCPPSm_Int }, - { X86::RSQRTPSr, X86::RSQRTPSm }, - { X86::RSQRTPSr_Int, X86::RSQRTPSm_Int }, - { X86::RSQRTSSr, X86::RSQRTSSm }, - { X86::RSQRTSSr_Int, X86::RSQRTSSm_Int }, { X86::SBB32rr, X86::SBB32rm }, { X86::SBB64rr, X86::SBB64rm }, { X86::SHUFPDrri, X86::SHUFPDrmi }, { X86::SHUFPSrri, X86::SHUFPSrmi }, - { X86::SQRTPDr, X86::SQRTPDm }, - { X86::SQRTPDr_Int, X86::SQRTPDm_Int }, - { X86::SQRTPSr, X86::SQRTPSm }, - { X86::SQRTPSr_Int, X86::SQRTPSm_Int }, - { X86::SQRTSDr, X86::SQRTSDm }, - { X86::SQRTSDr_Int, X86::SQRTSDm_Int }, - { X86::SQRTSSr, X86::SQRTSSm }, - { X86::SQRTSSr_Int, X86::SQRTSSm_Int }, { X86::SUB16rr, X86::SUB16rm }, { X86::SUB32rr, X86::SUB32rm }, { X86::SUB64rr, X86::SUB64rm }, Added: llvm/trunk/test/CodeGen/X86/sse_reload_fold.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/sse_reload_fold.ll?rev=42162&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/sse_reload_fold.ll (added) +++ llvm/trunk/test/CodeGen/X86/sse_reload_fold.ll Thu Sep 20 09:17:21 2007 @@ -0,0 +1,124 @@ +; RUN: llvm-as < %s | \ +; RUN: llc -march=x86-64 -mattr=+64bit,+sse3 -print-failed-fuse-candidates |& \ +; RUN: grep fail | count 1 + +declare void @bar() +declare <4 x float> @qux() +declare <2 x double> @pin() +declare float @llvm.sqrt.f32(float) +declare double @llvm.sqrt.f64(double) + +declare <4 x float> @llvm.x86.sse.rsqrt.ps(<4 x float>) +declare <4 x float> @llvm.x86.sse.sqrt.ps(<4 x float>) +declare <4 x float> @llvm.x86.sse.rcp.ps(<4 x float>) +declare <4 x float> @llvm.x86.sse.min.ps(<4 x float>, <4 x float>) +declare <4 x float> @llvm.x86.sse.max.ps(<4 x float>, <4 x float>) +declare <4 x float> @llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, i8) +declare <4 x float> @llvm.x86.sse3.addsub.ps(<4 x float>, <4 x float>) +declare <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float>, <4 x float>) +declare <4 x float> @llvm.x86.sse3.hsub.ps(<4 x float>, <4 x float>) +declare <2 x double> @llvm.x86.sse2.sqrt.pd(<2 x double>) +declare <2 x double> @llvm.x86.sse2.min.pd(<2 x double>, <2 x double>) +declare <2 x double> @llvm.x86.sse2.max.pd(<2 x double>, <2 x double>) +declare <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double>, <2 x double>, i8) +declare <2 x double> @llvm.x86.sse3.addsub.pd(<2 x double>, <2 x double>) +declare <2 x double> @llvm.x86.sse3.hadd.pd(<2 x double>, <2 x double>) +declare <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double>, <2 x double>) + +define float @foo(float %f) { + call void @bar() + %t = call float @llvm.sqrt.f32(float %f) + ret float %t +} +define double @doo(double %f) { + call void @bar() + %t = call double @llvm.sqrt.f64(double %f) + ret double %t +} +define <4 x float> @a0(<4 x float> %f) { + call void @bar() + %t = call <4 x float> @llvm.x86.sse.rsqrt.ps(<4 x float> %f) + ret <4 x float> %t +} +define <4 x float> @a1(<4 x float> %f) { + call void @bar() + %t = call <4 x float> @llvm.x86.sse.sqrt.ps(<4 x float> %f) + ret <4 x float> %t +} +define <4 x float> @a2(<4 x float> %f) { + call void @bar() + %t = call <4 x float> @llvm.x86.sse.rcp.ps(<4 x float> %f) + ret <4 x float> %t +} +define <4 x float> @b3(<4 x float> %f) { + %y = call <4 x float> @qux() + %t = call <4 x float> @llvm.x86.sse.min.ps(<4 x float> %y, <4 x float> %f) + ret <4 x float> %t +} +define <4 x float> @b4(<4 x float> %f) { + %y = call <4 x float> @qux() + %t = call <4 x float> @llvm.x86.sse.max.ps(<4 x float> %y, <4 x float> %f) + ret <4 x float> %t +} +define <4 x float> @b5(<4 x float> %f) { + %y = call <4 x float> @qux() + %t = call <4 x float> @llvm.x86.sse.cmp.ps(<4 x float> %y, <4 x float> %f, i8 7) + ret <4 x float> %t +} +define <4 x float> @b6(<4 x float> %f) { + %y = call <4 x float> @qux() + %t = call <4 x float> @llvm.x86.sse3.addsub.ps(<4 x float> %y, <4 x float> %f) + ret <4 x float> %t +} +define <4 x float> @b7(<4 x float> %f) { + %y = call <4 x float> @qux() + %t = call <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %y, <4 x float> %f) + ret <4 x float> %t +} +define <4 x float> @b8(<4 x float> %f) { + %y = call <4 x float> @qux() + %t = call <4 x float> @llvm.x86.sse3.hsub.ps(<4 x float> %y, <4 x float> %f) + ret <4 x float> %t +} +define <2 x double> @c1(<2 x double> %f) { + call void @bar() + %t = call <2 x double> @llvm.x86.sse2.sqrt.pd(<2 x double> %f) + ret <2 x double> %t +} +define <2 x double> @d3(<2 x double> %f) { + %y = call <2 x double> @pin() + %t = call <2 x double> @llvm.x86.sse2.min.pd(<2 x double> %y, <2 x double> %f) + ret <2 x double> %t +} +define <2 x double> @d4(<2 x double> %f) { + %y = call <2 x double> @pin() + %t = call <2 x double> @llvm.x86.sse2.max.pd(<2 x double> %y, <2 x double> %f) + ret <2 x double> %t +} +define <2 x double> @d5(<2 x double> %f) { + %y = call <2 x double> @pin() + %t = call <2 x double> @llvm.x86.sse2.cmp.pd(<2 x double> %y, <2 x double> %f, i8 7) + ret <2 x double> %t +} +define <2 x double> @d6(<2 x double> %f) { + %y = call <2 x double> @pin() + %t = call <2 x double> @llvm.x86.sse3.addsub.pd(<2 x double> %y, <2 x double> %f) + ret <2 x double> %t +} +define <2 x double> @d7(<2 x double> %f) { + %y = call <2 x double> @pin() + %t = call <2 x double> @llvm.x86.sse3.hadd.pd(<2 x double> %y, <2 x double> %f) + ret <2 x double> %t +} +define <2 x double> @d8(<2 x double> %f) { + %y = call <2 x double> @pin() + %t = call <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double> %y, <2 x double> %f) + ret <2 x double> %t +} + +; This one should fail to fuse. +define <2 x double> @z0(<2 x double> %f) { + %y = call <2 x double> @pin() + %t = call <2 x double> @llvm.x86.sse3.hsub.pd(<2 x double> %f, <2 x double> %y) + ret <2 x double> %t +} From gordonhenriksen at mac.com Thu Sep 20 11:47:42 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Thu, 20 Sep 2007 16:47:42 -0000 Subject: [llvm-commits] [llvm] r42163 - in /llvm/trunk: Makefile.config.in autoconf/configure.ac bindings/ocaml/Makefile.ocaml bindings/ocaml/bitwriter/ bindings/ocaml/bitwriter/bitwriter_ocaml.c bindings/ocaml/llvm/ bindings/ocaml/llvm/llvm_ocaml.c test/Bindings/ test/Bindings/Ocaml/vmcore.ml Message-ID: <200709201647.l8KGlgwd014808@zion.cs.uiuc.edu> Author: gordon Date: Thu Sep 20 11:47:41 2007 New Revision: 42163 URL: http://llvm.org/viewvc/llvm-project?rev=42163&view=rev Log: Incorporating review feedback for GC verifier patch. Modified: llvm/trunk/Makefile.config.in llvm/trunk/autoconf/configure.ac llvm/trunk/bindings/ocaml/Makefile.ocaml llvm/trunk/bindings/ocaml/bitwriter/ (props changed) llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c llvm/trunk/bindings/ocaml/llvm/ (props changed) llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c llvm/trunk/test/Bindings/ (props changed) llvm/trunk/test/Bindings/Ocaml/vmcore.ml Modified: llvm/trunk/Makefile.config.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile.config.in?rev=42163&r1=42162&r2=42163&view=diff ============================================================================== --- llvm/trunk/Makefile.config.in (original) +++ llvm/trunk/Makefile.config.in Thu Sep 20 11:47:41 2007 @@ -158,6 +158,7 @@ GZIP := @GZIP@ OCAMLC := @OCAMLC@ OCAMLOPT := @OCAMLOPT@ +OCAMLDEP := @OCAMLDEP@ POD2HTML := @POD2HTML@ POD2MAN := @POD2MAN@ RUNTEST := @RUNTEST@ Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=42163&r1=42162&r2=42163&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Thu Sep 20 11:47:41 2007 @@ -534,6 +534,7 @@ AC_PATH_PROG(ZIP,[zip],[echo "Skipped: zip not found"]) AC_PATH_PROG(OCAMLC,[ocamlc],[echo "Skipped: ocamlc not found"]) AC_PATH_PROG(OCAMLOPT,[ocamlopt],[echo "Skipped: ocamlopt not found"]) +AC_PATH_PROG(OCAMLDEP,[ocamldep],[echo "Skipped: ocamldep not found"]) dnl Determine if the linker supports the -R option. AC_LINK_USE_R Modified: llvm/trunk/bindings/ocaml/Makefile.ocaml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile.ocaml?rev=42163&r1=42162&r2=42163&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/Makefile.ocaml (original) +++ llvm/trunk/bindings/ocaml/Makefile.ocaml Thu Sep 20 11:47:41 2007 @@ -38,7 +38,7 @@ endif # Tools -OCAMLCFLAGS += -I $(OcamlDir) +OCAMLCFLAGS += -I $(OcamlDir) -I $(ObjDir) OCAMLAFLAGS += $(patsubst %,-cclib %, \ $(filter-out -L$(LibDir),$(shell $(LLVM_CONFIG) --ldflags)) \ $(UsedLibs) -l$(LIBRARYNAME)) @@ -51,26 +51,26 @@ Archive.CMXA := $(strip $(OCAMLOPT) -a $(OCAMLAFLAGS) -o) # Source files -OcamlSources := $(sort $(wildcard $(PROJ_SRC_DIR)/*.ml)) -OcamlHeaders := $(OcamlSources:.ml=.mli) +OcamlSources1 := $(sort $(wildcard $(PROJ_SRC_DIR)/*.ml)) +OcamlHeaders1 := $(OcamlSources1:.ml=.mli) -# Output and intermediate files -# The .cmo files are the only intermediates; all others get installed. -BareLibraryA := lib$(LIBRARYNAME).a -LibraryA := $(OcamlDir)/$(BareLibraryA) -LibraryCMA := $(OcamlDir)/$(LIBRARYNAME).cma -LibraryCMXA := $(OcamlDir)/$(LIBRARYNAME).cmxa -ObjectsCMI := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(OcamlDir)/%.cmi) -ObjectsCMO := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(ObjDir)/%.cmo) -ObjectsCMX := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(OcamlDir)/%.cmx) - -# Dependencies -# Punting on ocamldep, since its output is only suitable for builds where -# objects are placed directly adjacent to sources, which is not us. -# Unfortunately, this is subtly incorrect and leads to occasional problems. -# ocamlc/ocamlopt really need an option akin to gcc -M or gcc -MD. -$(ObjectsCMO): $(ObjectsCMI) $(UsedOcamLibs:%=$(OcamlDir)/%.cmi) -$(ObjectsCMX): $(ObjectsCMI) $(UsedOcamLibs:%=$(OcamlDir)/%.cmi) +OcamlSources := $(OcamlSources1:$(PROJ_SRC_DIR)/%=$(ObjDir)/%) +OcamlHeaders := $(OcamlHeaders1:$(PROJ_SRC_DIR)/%=$(ObjDir)/%) + +# Intermediate files +LibraryCMA := $(ObjDir)/$(LIBRARYNAME).cma +LibraryCMXA := $(ObjDir)/$(LIBRARYNAME).cmxa +ObjectsCMI := $(OcamlSources:%.ml=%.cmi) +ObjectsCMO := $(OcamlSources:%.ml=%.cmo) +ObjectsCMX := $(OcamlSources:%.ml=%.cmx) + +# Output files +# The .cmo files are the only intermediates; all others are to be installed. +LibraryA := $(OcamlDir)/lib$(LIBRARYNAME).a +OutputCMA := $(LibraryCMA:$(ObjDir)/%.cma=$(OcamlDir)/%.cma) +OutputCMXA := $(LibraryCMXA:$(ObjDir)/%.cmxa=$(OcamlDir)/%.cmxa) +OutputsCMI := $(ObjectsCMI:$(ObjDir)/%.cmi=$(OcamlDir)/%.cmi) +OutputsCMX := $(ObjectsCMX:$(ObjDir)/%.cmx=$(OcamlDir)/%.cmx) # Installation targets DestA := $(PROJ_libocamldir)/lib$(LIBRARYNAME).a @@ -78,6 +78,22 @@ DestCMXA := $(PROJ_libocamldir)/$(LIBRARYNAME).cmxa +##===- Dependencies -------------------------------------------------------===## +# Copy the sources into the intermediate directory because older ocamlc doesn't +# support -o except when linking (outputs are placed next to inputs). + +$(ObjDir)/%.mli: $(PROJ_SRC_DIR)/%.mli $(ObjDir)/.dir + $(Verb) $(CP) -f $< $@ + +$(ObjDir)/%.ml: $(PROJ_SRC_DIR)/%.ml $(ObjDir)/.dir + $(Verb) $(CP) -f $< $@ + +$(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) + $(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeader) > $@ + +-include $(ObjDir)/$(LIBRARYNAME).ocamldep + + ##===- Build static library from C sources --------------------------------===## all-local:: $(LibraryA) @@ -112,33 +128,36 @@ install-local:: install-cmis uninstall-local:: uninstall-cmis -build-cmis: $(ObjectsCMI) +build-cmis: $(OutputsCMI) + +$(OcamlDir)/%.cmi: $(ObjDir)/%.cmi $(OcamlDir)/.dir + $(Verb) $(CP) -f $< $@ -$(OcamlDir)/%.cmi: $(PROJ_SRC_DIR)/%.mli $(OcamlDir)/.dir +$(ObjDir)/%.cmi: $(ObjDir)/%.mli $(ObjDir)/.dir $(Echo) "Compiling $(notdir $<) for $(BuildMode) build" $(Verb) $(Compile.CMI) $@ $< clean-cmis:: - -$(Verb) $(RM) -f $(ObjectsCMI) + -$(Verb) $(RM) -f $(OutputsCMI) # Also install the .mli's (headers) as documentation. -install-cmis: $(ObjectsCMI) +install-cmis: $(OutputsCMI) $(OcamlHeaders) $(Verb) $(MKDIR) $(PROJ_libocamldir) - $(Verb) for i in $(patsubst $(OcamlDir)/%,%,$(ObjectsCMI)); do \ + $(Verb) for i in $(OutputsCMI:$(OcamlDir)/%=%); do \ $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ $(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \ done - $(Verb) for i in $(patsubst $(PROJ_SRC_DIR)/%,%,$(OcamlHeaders)); do \ + $(Verb) for i in $(OcamlHeaders:$(ObjDir)/%=%); do \ $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ - $(DataInstall) $(PROJ_SRC_DIR)/$$i "$(PROJ_libocamldir)/$$i"; \ + $(DataInstall) $(ObjDir)/$$i "$(PROJ_libocamldir)/$$i"; \ done uninstall-cmis:: - $(Verb) for i in $(patsubst $(OcamlDir)/%,%,$(ObjectsCMI)); do \ + $(Verb) for i in $(OutputsCMI:$(OcamlDir)/%=%); do \ $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ $(RM) -f "$(PROJ_libocamldir)/$$i"; \ done - $(Verb) for i in $(patsubst $(PROJ_SRC_DIR)/%,%,$(OcamlHeaders)); do \ + $(Verb) for i in $(OcamlHeaders:$(ObjDir)/%=%); do \ $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ $(RM) -f "$(PROJ_libocamldir)/$$i"; \ done @@ -146,11 +165,14 @@ ##===- Build ocaml bytecode archive (.ml's -> .cmo's -> .cma) -------------===## -all-local:: $(LibraryCMA) +all-local:: $(OutputCMA) clean-local:: clean-cma install-local:: install-cma uninstall-local:: uninstall-cma +$(OutputCMA): $(LibraryCMA) $(OcamlDir)/.dir + $(Verb) $(CP) -f $< $@ + $(LibraryCMA): $(ObjectsCMO) $(OcamlDir)/.dir $(Echo) "Archiving $(notdir $@) for $(BuildMode) build" $(Verb) $(Archive.CMA) $@ $(ObjectsCMO) @@ -158,17 +180,17 @@ ln -sf "$(LibDir)/$$i" "$(OcamlDir)/$$i"; \ done -$(ObjDir)/%.cmo: $(PROJ_SRC_DIR)/%.ml $(OcamlDir)/.dir +$(ObjDir)/%.cmo: $(ObjDir)/%.ml $(Echo) "Compiling $(notdir $<) for $(BuildMode) build" $(Verb) $(Compile.CMO) $@ $< clean-cma:: - $(Verb) $(RM) -f $(LibraryCMA) + $(Verb) $(RM) -f $(OutputCMA) $(UsedLibNames:%=$(OcamlDir)/%) -install-cma:: $(LibraryCMA) +install-cma:: $(OutputCMA) $(Echo) "Installing $(BuildMode) $(DestCMA)" $(Verb) $(MKDIR) $(PROJ_libocamldir) - $(Verb) $(DataInstall) $(LibraryCMA) "$(DestCMA)" + $(Verb) $(DataInstall) $(OutputCMA) "$(DestCMA)" $(Verb) for i in $(UsedLibNames); do \ $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ ln -sf "$(PROJ_libdir)/$$i" "$(PROJ_libocamldir)/$$i"; \ @@ -189,41 +211,47 @@ # If unavailable, 'configure' will not define OCAMLOPT in Makefile.config. ifdef OCAMLOPT -all-local:: $(LibraryCMXA) +all-local:: $(OutputCMXA) $(OutputsCMX) clean-local:: clean-cmxa install-local:: install-cmxa uninstall-local:: uninstall-cmxa +$(OutputCMXA): $(LibraryCMXA) + $(Verb) $(CP) -f $< $@ + $(Verb) $(CP) -f $(<:.cmxa=.a) $(@:.cmxa=.a) + +$(OcamlDir)/%.cmx: $(ObjDir)/%.cmx + $(Verb) $(CP) -f $< $@ + $(LibraryCMXA): $(ObjectsCMX) $(Echo) "Archiving $(notdir $@) for $(BuildMode) build" $(Verb) $(Archive.CMXA) $@ $(ObjectsCMX) $(Verb) $(RM) -f $(@:.cmxa=.o) -$(OcamlDir)/%.cmx: $(PROJ_SRC_DIR)/%.ml +$(ObjDir)/%.cmx: $(ObjDir)/%.ml $(Echo) "Compiling optimized $(notdir $<) for $(BuildMode) build" $(Verb) $(Compile.CMX) $@ $< clean-cmxa:: - $(Verb) $(RM) -f $(LibraryCMXA) $(LibraryCMXA:.cmxa=.o) \ - $(LibraryCMXA:.cmxa=.a) $(ObjectsCMX) + $(Verb) $(RM) -f $(OutputCMXA) $(OutputCMXA:.cmxa=.o) $(OutputsCMX) -install-cmxa:: $(LibraryCMXA) +install-cmxa:: $(OutputCMXA) $(OutputsCMX) $(Verb) $(MKDIR) $(PROJ_libocamldir) $(Echo) "Installing $(BuildMode) $(DestCMXA)" - $(Verb) $(DataInstall) $(LibraryCMXA) $(DestCMXA) + $(Verb) $(DataInstall) $(OutputCMXA) $(DestCMXA) $(Echo) "Installing $(BuildMode) $(DestCMXA:.cmxa=.a)" - $(Verb) $(DataInstall) $(LibraryCMXA:.cmxa=.a) $(DestCMXA:.cmxa=.a) - $(Verb) for i in $(ObjectsCMX:$(OcamlDir)/%=%); do \ + $(Verb) $(DataInstall) $(OutputCMXA:.cmxa=.a) $(DestCMXA:.cmxa=.a) + $(Verb) for i in $(OutputsCMX:$(OcamlDir)/%=%); do \ $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ $(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \ done -uninstall-cmxa:: $(LibraryCMXA) +uninstall-cmxa:: $(Echo) "Uninstalling $(DestCMXA)" $(Verb) $(RM) -f $(DestCMXA) $(Echo) "Uninstalling $(DestCMXA:.cmxa=.a)" $(Verb) $(RM) -f $(DestCMXA:.cmxa=.a) - $(Verb) for i in $(ObjectsCMX:$(OcamlDir)/%=%); do \ + $(Verb) for i in $(OutputsCMX:$(OcamlDir)/%=%); do \ $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ $(RM) -f $(PROJ_libocamldir)/$$i; \ done @@ -240,6 +268,7 @@ $(Echo) "OCAMLAFLAGS : " '$(OCAMLAFLAGS)' $(Echo) "OCAMLC : " '$(OCAMLC)' $(Echo) "OCAMLOPT : " '$(OCAMLOPT)' + $(Echo) "OCAMLDEP : " '$(OCAMLDEP)' $(Echo) "Compile.CMI : " '$(Compile.CMI)' $(Echo) "Compile.CMO : " '$(Compile.CMO)' $(Echo) "Archive.CMA : " '$(Archive.CMA)' @@ -248,7 +277,9 @@ $(Echo) "CAML_LIBDIR : " '$(CAML_LIBDIR)' $(Echo) "LibraryCMA : " '$(LibraryCMA)' $(Echo) "LibraryCMXA : " '$(LibraryCMXA)' + $(Echo) "OcamlSources1: " '$(OcamlSources1)' $(Echo) "OcamlSources : " '$(OcamlSources)' + $(Echo) "OcamlHeaders : " '$(OcamlHeaders)' $(Echo) "ObjectsCMI : " '$(ObjectsCMI)' $(Echo) "ObjectsCMO : " '$(ObjectsCMO)' $(Echo) "ObjectsCMX : " '$(ObjectsCMX)' Propchange: llvm/trunk/bindings/ocaml/bitwriter/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Thu Sep 20 11:47:41 2007 @@ -0,0 +1,2 @@ +Debug +Release Modified: llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c?rev=42163&r1=42162&r2=42163&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c Thu Sep 20 11:47:41 2007 @@ -25,7 +25,6 @@ /* Llvm.llmodule -> string -> bool */ CAMLprim value llvm_write_bitcode_file(value M, value Path) { - CAMLparam1(Path); int res = LLVMWriteBitcodeToFile((LLVMModuleRef) M, String_val(Path)); - CAMLreturn(Val_bool(res == 0)); + return Val_bool(res == 0); } Propchange: llvm/trunk/bindings/ocaml/llvm/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Thu Sep 20 11:47:41 2007 @@ -0,0 +1,2 @@ +Debug +Release Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=42163&r1=42162&r2=42163&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Thu Sep 20 11:47:41 2007 @@ -134,7 +134,7 @@ /* copy into an ocaml array */ unsigned i; - value ParamTys = caml_alloc(Count, 0); + value ParamTys = alloc(Count, 0); LLVMGetFunctionParamTypes((LLVMTypeRef) FunTy, FunTys); for (i = 0; i != Count; ++i) @@ -159,7 +159,7 @@ /* copy into an ocaml array */ unsigned i; - value ElementTys = caml_alloc(Count, 0); + value ElementTys = alloc(Count, 0); LLVMGetStructElementTypes((LLVMTypeRef) StructTy, Tys); for (i = 0; i != Count; ++i) @@ -225,7 +225,7 @@ /* llvalue -> string */ CAMLprim value llvm_value_name(value Val) { - return caml_copy_string(LLVMGetValueName((LLVMValueRef) Val)); + return copy_string(LLVMGetValueName((LLVMValueRef) Val)); } /* string -> llvalue -> unit */ @@ -296,7 +296,7 @@ /* string -> bool -> llvalue */ CAMLprim value llvm_make_string_constant(value Str, value NullTerminate) { return (value) LLVMGetStringConstant(String_val(Str), - caml_string_length(Str), + string_length(Str), Bool_val(NullTerminate) == 0); } @@ -340,7 +340,7 @@ /* llvalue -> string */ CAMLprim value llvm_section(value Global) { - return caml_copy_string(LLVMGetSection((LLVMValueRef) Global)); + return copy_string(LLVMGetSection((LLVMValueRef) Global)); } /* string -> llvalue -> unit */ Propchange: llvm/trunk/test/Bindings/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Thu Sep 20 11:47:41 2007 @@ -0,0 +1,2 @@ +*.log +*.sum Modified: llvm/trunk/test/Bindings/Ocaml/vmcore.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/vmcore.ml?rev=42163&r1=42162&r2=42163&view=diff ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/vmcore.ml (original) +++ llvm/trunk/test/Bindings/Ocaml/vmcore.ml Thu Sep 20 11:47:41 2007 @@ -155,14 +155,17 @@ (* RUN: grep {Const04.*"cruel\\\\00world"} < %t.ll *) group "string"; - let c = make_string_constant "cruel\x00world" false in + let c = make_string_constant "cruel\000world" false in ignore (define_global "Const04" c m); insist ((make_array_type i8_type 11) = type_of c); (* RUN: grep {Const05.*"hi\\\\00again\\\\00"} < %t.ll *) group "string w/ null"; - let c = make_string_constant "hi\x00again" true in + let c = make_string_constant "hi\000again" true in + prerr_string "====> "; + prerr_int (array_length (type_of c)); + prerr_endline " <===="; ignore (define_global "Const05" c m); insist ((make_array_type i8_type 9) = type_of c); From gordonhenriksen at mac.com Thu Sep 20 11:48:18 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Thu, 20 Sep 2007 16:48:18 -0000 Subject: [llvm-commits] [llvm] r42164 - /llvm/trunk/configure Message-ID: <200709201648.l8KGmIqO014858@zion.cs.uiuc.edu> Author: gordon Date: Thu Sep 20 11:48:18 2007 New Revision: 42164 URL: http://llvm.org/viewvc/llvm-project?rev=42164&view=rev Log: Regenerate. Modified: llvm/trunk/configure Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=42164&r1=42163&r2=42164&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Thu Sep 20 11:48:18 2007 @@ -885,6 +885,7 @@ ZIP OCAMLC OCAMLOPT +OCAMLDEP INSTALL_LTDL_TRUE INSTALL_LTDL_FALSE CONVENIENCE_LTDL_TRUE @@ -7996,6 +7997,47 @@ fi +# Extract the first word of "ocamldep", so it can be a program name with args. +set dummy ocamldep; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_OCAMLDEP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $OCAMLDEP in + [\\/]* | ?:[\\/]*) + ac_cv_path_OCAMLDEP="$OCAMLDEP" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_OCAMLDEP="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + test -z "$ac_cv_path_OCAMLDEP" && ac_cv_path_OCAMLDEP="echo "Skipped: ocamldep not found"" + ;; +esac +fi +OCAMLDEP=$ac_cv_path_OCAMLDEP +if test -n "$OCAMLDEP"; then + { echo "$as_me:$LINENO: result: $OCAMLDEP" >&5 +echo "${ECHO_T}$OCAMLDEP" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + { echo "$as_me:$LINENO: checking for compiler -Wl,-R option" >&5 echo $ECHO_N "checking for compiler -Wl,-R option... $ECHO_C" >&6; } @@ -10458,7 +10500,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 12647 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14320,11 +14362,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14323: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14365: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14327: \$? = $ac_status" >&5 + echo "$as_me:14369: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14588,11 +14630,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14591: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14633: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14595: \$? = $ac_status" >&5 + echo "$as_me:14637: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -14692,11 +14734,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:14695: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14737: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14699: \$? = $ac_status" >&5 + echo "$as_me:14741: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17144,7 +17186,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:19657: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19619: \$? = $ac_status" >&5 + echo "$as_me:19661: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -19716,11 +19758,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:19719: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19761: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19723: \$? = $ac_status" >&5 + echo "$as_me:19765: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -21286,11 +21328,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21289: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21331: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21293: \$? = $ac_status" >&5 + echo "$as_me:21335: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -21390,11 +21432,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:21393: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21435: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21397: \$? = $ac_status" >&5 + echo "$as_me:21439: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -23625,11 +23667,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23628: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23670: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23632: \$? = $ac_status" >&5 + echo "$as_me:23674: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -23893,11 +23935,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:23896: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23938: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23900: \$? = $ac_status" >&5 + echo "$as_me:23942: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -23997,11 +24039,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:24000: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24042: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:24004: \$? = $ac_status" >&5 + echo "$as_me:24046: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -34955,6 +34997,7 @@ ZIP!$ZIP$ac_delim OCAMLC!$OCAMLC$ac_delim OCAMLOPT!$OCAMLOPT$ac_delim +OCAMLDEP!$OCAMLDEP$ac_delim INSTALL_LTDL_TRUE!$INSTALL_LTDL_TRUE$ac_delim INSTALL_LTDL_FALSE!$INSTALL_LTDL_FALSE$ac_delim CONVENIENCE_LTDL_TRUE!$CONVENIENCE_LTDL_TRUE$ac_delim @@ -34998,7 +35041,7 @@ LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 74; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 From gordonhenriksen at mac.com Thu Sep 20 11:47:55 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Thu, 20 Sep 2007 12:47:55 -0400 Subject: [llvm-commits] [llvm] r42163 - in /llvm/trunk: Makefile.config.in autoconf/configure.ac bindings/ocaml/Makefile.ocaml bindings/ocaml/bitwriter/ bindings/ocaml/bitwriter/bitwriter_ocaml.c bindings/ocaml/llvm/ bindings/ocaml/llvm/llvm_ocaml.c test/Bindings/ test/Bindings/Ocaml/vmcore.ml In-Reply-To: <200709201647.l8KGlgwd014808@zion.cs.uiuc.edu> References: <200709201647.l8KGlgwd014808@zion.cs.uiuc.edu> Message-ID: <59864EA7-6EEF-4D29-AC61-72E6EA1FB59B@mac.com> On Sep 20, 2007, at 12:47, Gordon Henriksen wrote: > Author: gordon > Date: Thu Sep 20 11:47:41 2007 > New Revision: 42163 > > URL: http://llvm.org/viewvc/llvm-project?rev=42163&view=rev > Log: > Incorporating review feedback for GC verifier patch. Grr. Providing compatibility with ocaml back to at least 3.06 (vintage 2002). In downrev versions: - Function names do not have the 'caml_' prefix. Later versions provide compatibility macros. - The intnat and uintnat types are not defined. - ocamlc supports -o only for linking and archiving. This also gets ocaml's automatic dependency generator working. > Modified: > llvm/trunk/Makefile.config.in > llvm/trunk/autoconf/configure.ac > llvm/trunk/bindings/ocaml/Makefile.ocaml > llvm/trunk/bindings/ocaml/bitwriter/ (props changed) > llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c > llvm/trunk/bindings/ocaml/llvm/ (props changed) > llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c > llvm/trunk/test/Bindings/ (props changed) > llvm/trunk/test/Bindings/Ocaml/vmcore.ml > > Modified: llvm/trunk/Makefile.config.in > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/ > Makefile.config.in?rev=42163&r1=42162&r2=42163&view=diff > > ====================================================================== > ======== > --- llvm/trunk/Makefile.config.in (original) > +++ llvm/trunk/Makefile.config.in Thu Sep 20 11:47:41 2007 > @@ -158,6 +158,7 @@ > GZIP := @GZIP@ > OCAMLC := @OCAMLC@ > OCAMLOPT := @OCAMLOPT@ > +OCAMLDEP := @OCAMLDEP@ > POD2HTML := @POD2HTML@ > POD2MAN := @POD2MAN@ > RUNTEST := @RUNTEST@ > > Modified: llvm/trunk/autoconf/configure.ac > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/ > configure.ac?rev=42163&r1=42162&r2=42163&view=diff > > ====================================================================== > ======== > --- llvm/trunk/autoconf/configure.ac (original) > +++ llvm/trunk/autoconf/configure.ac Thu Sep 20 11:47:41 2007 > @@ -534,6 +534,7 @@ > AC_PATH_PROG(ZIP,[zip],[echo "Skipped: zip not found"]) > AC_PATH_PROG(OCAMLC,[ocamlc],[echo "Skipped: ocamlc not found"]) > AC_PATH_PROG(OCAMLOPT,[ocamlopt],[echo "Skipped: ocamlopt not > found"]) > +AC_PATH_PROG(OCAMLDEP,[ocamldep],[echo "Skipped: ocamldep not > found"]) > > dnl Determine if the linker supports the -R option. > AC_LINK_USE_R > > Modified: llvm/trunk/bindings/ocaml/Makefile.ocaml > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/ > Makefile.ocaml?rev=42163&r1=42162&r2=42163&view=diff > > ====================================================================== > ======== > --- llvm/trunk/bindings/ocaml/Makefile.ocaml (original) > +++ llvm/trunk/bindings/ocaml/Makefile.ocaml Thu Sep 20 11:47:41 2007 > @@ -38,7 +38,7 @@ > endif > > # Tools > -OCAMLCFLAGS += -I $(OcamlDir) > +OCAMLCFLAGS += -I $(OcamlDir) -I $(ObjDir) > OCAMLAFLAGS += $(patsubst %,-cclib %, \ > $(filter-out -L$(LibDir),$(shell $(LLVM_CONFIG) -- > ldflags)) \ > $(UsedLibs) -l$(LIBRARYNAME)) > @@ -51,26 +51,26 @@ > Archive.CMXA := $(strip $(OCAMLOPT) -a $(OCAMLAFLAGS) -o) > > # Source files > -OcamlSources := $(sort $(wildcard $(PROJ_SRC_DIR)/*.ml)) > -OcamlHeaders := $(OcamlSources:.ml=.mli) > +OcamlSources1 := $(sort $(wildcard $(PROJ_SRC_DIR)/*.ml)) > +OcamlHeaders1 := $(OcamlSources1:.ml=.mli) > > -# Output and intermediate files > -# The .cmo files are the only intermediates; all others get > installed. > -BareLibraryA := lib$(LIBRARYNAME).a > -LibraryA := $(OcamlDir)/$(BareLibraryA) > -LibraryCMA := $(OcamlDir)/$(LIBRARYNAME).cma > -LibraryCMXA := $(OcamlDir)/$(LIBRARYNAME).cmxa > -ObjectsCMI := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(OcamlDir)/ > %.cmi) > -ObjectsCMO := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(ObjDir)/%.cmo) > -ObjectsCMX := $(OcamlSources:$(PROJ_SRC_DIR)/%.ml=$(OcamlDir)/ > %.cmx) > - > -# Dependencies > -# Punting on ocamldep, since its output is only suitable for > builds where > -# objects are placed directly adjacent to sources, which is not us. > -# Unfortunately, this is subtly incorrect and leads to > occasional problems. > -# ocamlc/ocamlopt really need an option akin to gcc -M or gcc -MD. > -$(ObjectsCMO): $(ObjectsCMI) $(UsedOcamLibs:%=$(OcamlDir)/%.cmi) > -$(ObjectsCMX): $(ObjectsCMI) $(UsedOcamLibs:%=$(OcamlDir)/%.cmi) > +OcamlSources := $(OcamlSources1:$(PROJ_SRC_DIR)/%=$(ObjDir)/%) > +OcamlHeaders := $(OcamlHeaders1:$(PROJ_SRC_DIR)/%=$(ObjDir)/%) > + > +# Intermediate files > +LibraryCMA := $(ObjDir)/$(LIBRARYNAME).cma > +LibraryCMXA := $(ObjDir)/$(LIBRARYNAME).cmxa > +ObjectsCMI := $(OcamlSources:%.ml=%.cmi) > +ObjectsCMO := $(OcamlSources:%.ml=%.cmo) > +ObjectsCMX := $(OcamlSources:%.ml=%.cmx) > + > +# Output files > +# The .cmo files are the only intermediates; all others are to > be installed. > +LibraryA := $(OcamlDir)/lib$(LIBRARYNAME).a > +OutputCMA := $(LibraryCMA:$(ObjDir)/%.cma=$(OcamlDir)/%.cma) > +OutputCMXA := $(LibraryCMXA:$(ObjDir)/%.cmxa=$(OcamlDir)/%.cmxa) > +OutputsCMI := $(ObjectsCMI:$(ObjDir)/%.cmi=$(OcamlDir)/%.cmi) > +OutputsCMX := $(ObjectsCMX:$(ObjDir)/%.cmx=$(OcamlDir)/%.cmx) > > # Installation targets > DestA := $(PROJ_libocamldir)/lib$(LIBRARYNAME).a > @@ -78,6 +78,22 @@ > DestCMXA := $(PROJ_libocamldir)/$(LIBRARYNAME).cmxa > > > +##===- Dependencies > -------------------------------------------------------===## > +# Copy the sources into the intermediate directory because older > ocamlc doesn't > +# support -o except when linking (outputs are placed next to inputs). > + > +$(ObjDir)/%.mli: $(PROJ_SRC_DIR)/%.mli $(ObjDir)/.dir > + $(Verb) $(CP) -f $< $@ > + > +$(ObjDir)/%.ml: $(PROJ_SRC_DIR)/%.ml $(ObjDir)/.dir > + $(Verb) $(CP) -f $< $@ > + > +$(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) > + $(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeader) > > $@ > + > +-include $(ObjDir)/$(LIBRARYNAME).ocamldep > + > + > ##===- Build static library from C sources > --------------------------------===## > > all-local:: $(LibraryA) > @@ -112,33 +128,36 @@ > install-local:: install-cmis > uninstall-local:: uninstall-cmis > > -build-cmis: $(ObjectsCMI) > +build-cmis: $(OutputsCMI) > + > +$(OcamlDir)/%.cmi: $(ObjDir)/%.cmi $(OcamlDir)/.dir > + $(Verb) $(CP) -f $< $@ > > -$(OcamlDir)/%.cmi: $(PROJ_SRC_DIR)/%.mli $(OcamlDir)/.dir > +$(ObjDir)/%.cmi: $(ObjDir)/%.mli $(ObjDir)/.dir > $(Echo) "Compiling $(notdir $<) for $(BuildMode) build" > $(Verb) $(Compile.CMI) $@ $< > > clean-cmis:: > - -$(Verb) $(RM) -f $(ObjectsCMI) > + -$(Verb) $(RM) -f $(OutputsCMI) > > # Also install the .mli's (headers) as documentation. > -install-cmis: $(ObjectsCMI) > +install-cmis: $(OutputsCMI) $(OcamlHeaders) > $(Verb) $(MKDIR) $(PROJ_libocamldir) > - $(Verb) for i in $(patsubst $(OcamlDir)/%,%,$(ObjectsCMI)); do \ > + $(Verb) for i in $(OutputsCMI:$(OcamlDir)/%=%); do \ > $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ > $(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \ > done > - $(Verb) for i in $(patsubst $(PROJ_SRC_DIR)/%,%,$(OcamlHeaders)); > do \ > + $(Verb) for i in $(OcamlHeaders:$(ObjDir)/%=%); do \ > $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ > - $(DataInstall) $(PROJ_SRC_DIR)/$$i "$(PROJ_libocamldir)/$$i"; \ > + $(DataInstall) $(ObjDir)/$$i "$(PROJ_libocamldir)/$$i"; \ > done > > uninstall-cmis:: > - $(Verb) for i in $(patsubst $(OcamlDir)/%,%,$(ObjectsCMI)); do \ > + $(Verb) for i in $(OutputsCMI:$(OcamlDir)/%=%); do \ > $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ > $(RM) -f "$(PROJ_libocamldir)/$$i"; \ > done > - $(Verb) for i in $(patsubst $(PROJ_SRC_DIR)/%,%,$(OcamlHeaders)); > do \ > + $(Verb) for i in $(OcamlHeaders:$(ObjDir)/%=%); do \ > $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ > $(RM) -f "$(PROJ_libocamldir)/$$i"; \ > done > @@ -146,11 +165,14 @@ > > ##===- Build ocaml bytecode archive (.ml's -> .cmo's -> .cma) > -------------===## > > -all-local:: $(LibraryCMA) > +all-local:: $(OutputCMA) > clean-local:: clean-cma > install-local:: install-cma > uninstall-local:: uninstall-cma > > +$(OutputCMA): $(LibraryCMA) $(OcamlDir)/.dir > + $(Verb) $(CP) -f $< $@ > + > $(LibraryCMA): $(ObjectsCMO) $(OcamlDir)/.dir > $(Echo) "Archiving $(notdir $@) for $(BuildMode) build" > $(Verb) $(Archive.CMA) $@ $(ObjectsCMO) > @@ -158,17 +180,17 @@ > ln -sf "$(LibDir)/$$i" "$(OcamlDir)/$$i"; \ > done > > -$(ObjDir)/%.cmo: $(PROJ_SRC_DIR)/%.ml $(OcamlDir)/.dir > +$(ObjDir)/%.cmo: $(ObjDir)/%.ml > $(Echo) "Compiling $(notdir $<) for $(BuildMode) build" > $(Verb) $(Compile.CMO) $@ $< > > clean-cma:: > - $(Verb) $(RM) -f $(LibraryCMA) > + $(Verb) $(RM) -f $(OutputCMA) $(UsedLibNames:%=$(OcamlDir)/%) > > -install-cma:: $(LibraryCMA) > +install-cma:: $(OutputCMA) > $(Echo) "Installing $(BuildMode) $(DestCMA)" > $(Verb) $(MKDIR) $(PROJ_libocamldir) > - $(Verb) $(DataInstall) $(LibraryCMA) "$(DestCMA)" > + $(Verb) $(DataInstall) $(OutputCMA) "$(DestCMA)" > $(Verb) for i in $(UsedLibNames); do \ > $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ > ln -sf "$(PROJ_libdir)/$$i" "$(PROJ_libocamldir)/$$i"; \ > @@ -189,41 +211,47 @@ > # If unavailable, 'configure' will not define OCAMLOPT in > Makefile.config. > ifdef OCAMLOPT > > -all-local:: $(LibraryCMXA) > +all-local:: $(OutputCMXA) $(OutputsCMX) > clean-local:: clean-cmxa > install-local:: install-cmxa > uninstall-local:: uninstall-cmxa > > +$(OutputCMXA): $(LibraryCMXA) > + $(Verb) $(CP) -f $< $@ > + $(Verb) $(CP) -f $(<:.cmxa=.a) $(@:.cmxa=.a) > + > +$(OcamlDir)/%.cmx: $(ObjDir)/%.cmx > + $(Verb) $(CP) -f $< $@ > + > $(LibraryCMXA): $(ObjectsCMX) > $(Echo) "Archiving $(notdir $@) for $(BuildMode) build" > $(Verb) $(Archive.CMXA) $@ $(ObjectsCMX) > $(Verb) $(RM) -f $(@:.cmxa=.o) > > -$(OcamlDir)/%.cmx: $(PROJ_SRC_DIR)/%.ml > +$(ObjDir)/%.cmx: $(ObjDir)/%.ml > $(Echo) "Compiling optimized $(notdir $<) for $(BuildMode) build" > $(Verb) $(Compile.CMX) $@ $< > > clean-cmxa:: > - $(Verb) $(RM) -f $(LibraryCMXA) $(LibraryCMXA:.cmxa=.o) \ > - $(LibraryCMXA:.cmxa=.a) $(ObjectsCMX) > + $(Verb) $(RM) -f $(OutputCMXA) $(OutputCMXA:.cmxa=.o) $(OutputsCMX) > > -install-cmxa:: $(LibraryCMXA) > +install-cmxa:: $(OutputCMXA) $(OutputsCMX) > $(Verb) $(MKDIR) $(PROJ_libocamldir) > $(Echo) "Installing $(BuildMode) $(DestCMXA)" > - $(Verb) $(DataInstall) $(LibraryCMXA) $(DestCMXA) > + $(Verb) $(DataInstall) $(OutputCMXA) $(DestCMXA) > $(Echo) "Installing $(BuildMode) $(DestCMXA:.cmxa=.a)" > - $(Verb) $(DataInstall) $(LibraryCMXA:.cmxa=.a) $(DestCMXA:.cmxa=.a) > - $(Verb) for i in $(ObjectsCMX:$(OcamlDir)/%=%); do \ > + $(Verb) $(DataInstall) $(OutputCMXA:.cmxa=.a) $(DestCMXA:.cmxa=.a) > + $(Verb) for i in $(OutputsCMX:$(OcamlDir)/%=%); do \ > $(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \ > $(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \ > done > > -uninstall-cmxa:: $(LibraryCMXA) > +uninstall-cmxa:: > $(Echo) "Uninstalling $(DestCMXA)" > $(Verb) $(RM) -f $(DestCMXA) > $(Echo) "Uninstalling $(DestCMXA:.cmxa=.a)" > $(Verb) $(RM) -f $(DestCMXA:.cmxa=.a) > - $(Verb) for i in $(ObjectsCMX:$(OcamlDir)/%=%); do \ > + $(Verb) for i in $(OutputsCMX:$(OcamlDir)/%=%); do \ > $(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \ > $(RM) -f $(PROJ_libocamldir)/$$i; \ > done > @@ -240,6 +268,7 @@ > $(Echo) "OCAMLAFLAGS : " '$(OCAMLAFLAGS)' > $(Echo) "OCAMLC : " '$(OCAMLC)' > $(Echo) "OCAMLOPT : " '$(OCAMLOPT)' > + $(Echo) "OCAMLDEP : " '$(OCAMLDEP)' > $(Echo) "Compile.CMI : " '$(Compile.CMI)' > $(Echo) "Compile.CMO : " '$(Compile.CMO)' > $(Echo) "Archive.CMA : " '$(Archive.CMA)' > @@ -248,7 +277,9 @@ > $(Echo) "CAML_LIBDIR : " '$(CAML_LIBDIR)' > $(Echo) "LibraryCMA : " '$(LibraryCMA)' > $(Echo) "LibraryCMXA : " '$(LibraryCMXA)' > + $(Echo) "OcamlSources1: " '$(OcamlSources1)' > $(Echo) "OcamlSources : " '$(OcamlSources)' > + $(Echo) "OcamlHeaders : " '$(OcamlHeaders)' > $(Echo) "ObjectsCMI : " '$(ObjectsCMI)' > $(Echo) "ObjectsCMO : " '$(ObjectsCMO)' > $(Echo) "ObjectsCMX : " '$(ObjectsCMX)' > > Propchange: llvm/trunk/bindings/ocaml/bitwriter/ > > ---------------------------------------------------------------------- > -------- > --- svn:ignore (added) > +++ svn:ignore Thu Sep 20 11:47:41 2007 > @@ -0,0 +1,2 @@ > +Debug > +Release > > Modified: llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/ > bitwriter/bitwriter_ocaml.c?rev=42163&r1=42162&r2=42163&view=diff > > ====================================================================== > ======== > --- llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c (original) > +++ llvm/trunk/bindings/ocaml/bitwriter/bitwriter_ocaml.c Thu Sep > 20 11:47:41 2007 > @@ -25,7 +25,6 @@ > > /* Llvm.llmodule -> string -> bool */ > CAMLprim value llvm_write_bitcode_file(value M, value Path) { > - CAMLparam1(Path); > int res = LLVMWriteBitcodeToFile((LLVMModuleRef) M, String_val > (Path)); > - CAMLreturn(Val_bool(res == 0)); > + return Val_bool(res == 0); > } > > Propchange: llvm/trunk/bindings/ocaml/llvm/ > > ---------------------------------------------------------------------- > -------- > --- svn:ignore (added) > +++ svn:ignore Thu Sep 20 11:47:41 2007 > @@ -0,0 +1,2 @@ > +Debug > +Release > > Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/ > llvm/llvm_ocaml.c?rev=42163&r1=42162&r2=42163&view=diff > > ====================================================================== > ======== > --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) > +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Thu Sep 20 11:47:41 > 2007 > @@ -134,7 +134,7 @@ > > /* copy into an ocaml array */ > unsigned i; > - value ParamTys = caml_alloc(Count, 0); > + value ParamTys = alloc(Count, 0); > > LLVMGetFunctionParamTypes((LLVMTypeRef) FunTy, FunTys); > for (i = 0; i != Count; ++i) > @@ -159,7 +159,7 @@ > > /* copy into an ocaml array */ > unsigned i; > - value ElementTys = caml_alloc(Count, 0); > + value ElementTys = alloc(Count, 0); > > LLVMGetStructElementTypes((LLVMTypeRef) StructTy, Tys); > for (i = 0; i != Count; ++i) > @@ -225,7 +225,7 @@ > > /* llvalue -> string */ > CAMLprim value llvm_value_name(value Val) { > - return caml_copy_string(LLVMGetValueName((LLVMValueRef) Val)); > + return copy_string(LLVMGetValueName((LLVMValueRef) Val)); > } > > /* string -> llvalue -> unit */ > @@ -296,7 +296,7 @@ > /* string -> bool -> llvalue */ > CAMLprim value llvm_make_string_constant(value Str, value > NullTerminate) { > return (value) LLVMGetStringConstant(String_val(Str), > - caml_string_length(Str), > + string_length(Str), > Bool_val(NullTerminate) == 0); > } > > @@ -340,7 +340,7 @@ > > /* llvalue -> string */ > CAMLprim value llvm_section(value Global) { > - return caml_copy_string(LLVMGetSection((LLVMValueRef) Global)); > + return copy_string(LLVMGetSection((LLVMValueRef) Global)); > } > > /* string -> llvalue -> unit */ > > Propchange: llvm/trunk/test/Bindings/ > > ---------------------------------------------------------------------- > -------- > --- svn:ignore (added) > +++ svn:ignore Thu Sep 20 11:47:41 2007 > @@ -0,0 +1,2 @@ > +*.log > +*.sum > > Modified: llvm/trunk/test/Bindings/Ocaml/vmcore.ml > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/ > Ocaml/vmcore.ml?rev=42163&r1=42162&r2=42163&view=diff > > ====================================================================== > ======== > --- llvm/trunk/test/Bindings/Ocaml/vmcore.ml (original) > +++ llvm/trunk/test/Bindings/Ocaml/vmcore.ml Thu Sep 20 11:47:41 2007 > @@ -155,14 +155,17 @@ > (* RUN: grep {Const04.*"cruel\\\\00world"} < %t.ll > *) > group "string"; > - let c = make_string_constant "cruel\x00world" false in > + let c = make_string_constant "cruel\000world" false in > ignore (define_global "Const04" c m); > insist ((make_array_type i8_type 11) = type_of c); > > (* RUN: grep {Const05.*"hi\\\\00again\\\\00"} < %t.ll > *) > group "string w/ null"; > - let c = make_string_constant "hi\x00again" true in > + let c = make_string_constant "hi\000again" true in > + prerr_string "====> "; > + prerr_int (array_length (type_of c)); > + prerr_endline " <===="; > ignore (define_global "Const05" c m); > insist ((make_array_type i8_type 9) = type_of c); > > > > _______________________________________________ > 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/20070920/c1672d56/attachment.html From dalej at apple.com Thu Sep 20 11:50:21 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 20 Sep 2007 16:50:21 -0000 Subject: [llvm-commits] [llvm] r42165 - /llvm/trunk/lib/VMCore/ConstantFold.cpp Message-ID: <200709201650.l8KGoLJc015031@zion.cs.uiuc.edu> Author: johannes Date: Thu Sep 20 11:50:21 2007 New Revision: 42165 URL: http://llvm.org/viewvc/llvm-project?rev=42165&view=rev Log: Fix dumb regression in constant folding (Regression/C/casts) 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=42165&r1=42164&r2=42165&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Thu Sep 20 11:50:21 2007 @@ -213,7 +213,7 @@ return 0; // Other pointer types cannot be casted case Instruction::UIToFP: if (const ConstantInt *CI = dyn_cast(V)) { - double d = CI->getValue().signedRoundToDouble(); + double d = CI->getValue().roundToDouble(); if (DestTy==Type::FloatTy) return ConstantFP::get(DestTy, APFloat((float)d)); else if (DestTy==Type::DoubleTy) From gordonhenriksen at mac.com Thu Sep 20 12:12:27 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Thu, 20 Sep 2007 13:12:27 -0400 Subject: [llvm-commits] [llvm] r42160 - /llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c In-Reply-To: <200709201020.l8KAKY7P032411@zion.cs.uiuc.edu> References: <200709201020.l8KAKY7P032411@zion.cs.uiuc.edu> Message-ID: <9656D2E7-A176-45C7-BE93-72829F369B13@mac.com> This patch is fine. I've tested with an earlier version (2.06), too. You should be able to compile cleanly now. On Sep 20, 2007, at 06:20, Gabor Greif wrote: > Author: ggreif > Date: Thu Sep 20 05:20:34 2007 > New Revision: 42160 > > URL: http://llvm.org/viewvc/llvm-project?rev=42160&view=rev > Log: > use typenames equivalent to > (u)intval, because latter are not > present in older caml/mlvalues.h > (e.g. 2004/07/07, 1.48.6.1) > > Using this as a workaround for now, > until --without-ocaml works > or we settle on a better solution > > Modified: > llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c > > Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/ > llvm/llvm_ocaml.c?rev=42160&r1=42159&r2=42160&view=diff > > ====================================================================== > ======== > --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original) > +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Thu Sep 20 05:20:34 > 2007 > @@ -273,9 +273,9 @@ > /* GCC warns if we use the ternary operator. */ > unsigned long long N2; > if (Bool_val(SExt)) > - N2 = (intnat) Int_val(N); > + N2 = (value) Int_val(N); > else > - N2 = (uintnat) Int_val(N); > + N2 = (mlsize_t) Int_val(N); > > return (value) LLVMGetIntConstant((LLVMTypeRef) IntTy, N2, > Bool_val(SExt)); > } > > > _______________________________________________ > 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/20070920/79880a33/attachment.html From dpatel at apple.com Thu Sep 20 12:50:05 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 20 Sep 2007 17:50:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42166 - /llvm-gcc-4.0/trunk/gcc/config/darwin.c Message-ID: <200709201750.l8KHo5pF018532@zion.cs.uiuc.edu> Author: dpatel Date: Thu Sep 20 12:50:05 2007 New Revision: 42166 URL: http://llvm.org/viewvc/llvm-project?rev=42166&view=rev Log: Fix darwin objective-c sections. Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.c Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/darwin.c?rev=42166&r1=42165&r2=42166&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/darwin.c (original) +++ llvm-gcc-4.0/trunk/gcc/config/darwin.c Thu Sep 20 12:50:05 2007 @@ -1425,7 +1425,9 @@ else if (!strncmp (name, "CATEGORY_", 9)) return "__OBJC,__category,regular,no_dead_strip"; else if (!strncmp (name, "SELECTOR_REFERENCES", 19)) - return "__OBJC,__message_refs,literal_pointers,no_dead_strip"; + return (flag_objc_abi == 1 ? + "__OBJC,__message_refs,literal_pointers,no_dead_strip" : + "__DATA, __objc_selrefs, regular, no_dead_strip"); else if (!strncmp (name, "SELECTOR_FIXUP", 14)) return "__OBJC,__sel_fixup,regular";/*,no_dead_strip";*/ else if (!strncmp (name, "SYMBOLS", 7)) @@ -1433,7 +1435,9 @@ else if (!strncmp (name, "MODULES", 7)) return "__OBJC,__module_info,regular,no_dead_strip"; else if (!strncmp (name, "IMAGE_INFO", 10)) - return "__OBJC,__image_info,regular";/*,no_dead_strip";*/ + return (flag_objc_abi == 1 ? + "__OBJC,__image_info,regular" /*,no_dead_strip";*/ : + "__DATA, __objc_imageinfo, regular, no_dead_strip"); else if (!strncmp (name, "PROTOCOL_INSTANCE_METHODS_", 26)) return "__OBJC,__cat_inst_meth,regular,no_dead_strip"; else if (!strncmp (name, "PROTOCOL_CLASS_METHODS_", 23)) @@ -1442,7 +1446,28 @@ return "__OBJC,__cat_cls_meth,regular,no_dead_strip"; else if (!strncmp (name, "PROTOCOL_", 9)) return "__OBJC,__protocol,regular,no_dead_strip"; - else + else if (flag_objc_abi == 2) { + if (!strncmp (name, "CLASSLIST_REFERENCES_", 21)) + return "__DATA, __objc_classrefs, regular, no_dead_strip"; + else if (!strncmp (name, "CLASSLIST_SUP_REFS_", 19)) + return "__DATA, __objc_superrefs, regular, no_dead_strip"; + else if (!strncmp (name, "MESSAGE_REF", 11)) + return "__DATA, __objc_msgrefs, regular, no_dead_strip"; + else if (!strncmp (name, "LABEL_CLASS_", 12)) + return "__DATA, __objc_classlist, regular, no_dead_strip"; + else if (!strncmp (name, "LABEL_PROTOCOL_", 15)) + return "__DATA, __objc_protolist, regular, no_dead_strip"; + else if (!strncmp (name, "LABEL_CATEGORY_", 15)) + return "__DATA, __objc_catlist, regular, no_dead_strip"; + else if (!strncmp (name, "LABEL_NONLAZY_CLASS_", 20)) + return "__DATA, __objc_nlclslist, regular, no_dead_strip"; + else if (!strncmp (name, "LABEL_NONLAZY_CAGEGORY_", 23)) + return "__DATA, __objc_nlcatlist, regular, no_dead_strip"; + else if (!strncmp (name, "PROTOCOL_REFERENCE_", 19)) + return "__DATA, __objc_protorefs, regular, no_dead_strip"; + else + return 0; + } else return 0; } #endif From dpatel at apple.com Thu Sep 20 12:52:49 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 20 Sep 2007 17:52:49 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42167 - /llvm-gcc-4.2/trunk/gcc/config/darwin.c Message-ID: <200709201752.l8KHqo9o018680@zion.cs.uiuc.edu> Author: dpatel Date: Thu Sep 20 12:52:49 2007 New Revision: 42167 URL: http://llvm.org/viewvc/llvm-project?rev=42167&view=rev Log: Fix darwin objective-c sections. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.c?rev=42167&r1=42166&r2=42167&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.c Thu Sep 20 12:52:49 2007 @@ -1522,7 +1522,9 @@ else if (!strncmp (name, "CATEGORY_", 9)) return "__OBJC,__category,regular,no_dead_strip"; else if (!strncmp (name, "SELECTOR_REFERENCES", 19)) - return "__OBJC,__message_refs,literal_pointers,no_dead_strip"; + return (flag_objc_abi == 1 ? + "__OBJC,__message_refs,literal_pointers,no_dead_strip" : + "__DATA, __objc_selrefs, regular, no_dead_strip"); else if (!strncmp (name, "SELECTOR_FIXUP", 14)) return "__OBJC,__sel_fixup,regular";/*,no_dead_strip";*/ else if (!strncmp (name, "SYMBOLS", 7)) @@ -1530,7 +1532,9 @@ else if (!strncmp (name, "MODULES", 7)) return "__OBJC,__module_info,regular,no_dead_strip"; else if (!strncmp (name, "IMAGE_INFO", 10)) - return "__OBJC,__image_info,regular";/*,no_dead_strip";*/ + return (flag_objc_abi == 1 ? + "__OBJC,__image_info,regular" /*,no_dead_strip";*/ : + "__DATA, __objc_imageinfo, regular, no_dead_strip"); else if (!strncmp (name, "PROTOCOL_INSTANCE_METHODS_", 26)) return "__OBJC,__cat_inst_meth,regular,no_dead_strip"; else if (!strncmp (name, "PROTOCOL_CLASS_METHODS_", 23)) @@ -1539,7 +1543,28 @@ return "__OBJC,__cat_cls_meth,regular,no_dead_strip"; else if (!strncmp (name, "PROTOCOL_", 9)) return "__OBJC,__protocol,regular,no_dead_strip"; - else + else if (flag_objc_abi == 2) { + if (!strncmp (name, "CLASSLIST_REFERENCES_", 21)) + return "__DATA, __objc_classrefs, regular, no_dead_strip"; + else if (!strncmp (name, "CLASSLIST_SUP_REFS_", 19)) + return "__DATA, __objc_superrefs, regular, no_dead_strip"; + else if (!strncmp (name, "MESSAGE_REF", 11)) + return "__DATA, __objc_msgrefs, regular, no_dead_strip"; + else if (!strncmp (name, "LABEL_CLASS_", 12)) + return "__DATA, __objc_classlist, regular, no_dead_strip"; + else if (!strncmp (name, "LABEL_PROTOCOL_", 15)) + return "__DATA, __objc_protolist, regular, no_dead_strip"; + else if (!strncmp (name, "LABEL_CATEGORY_", 15)) + return "__DATA, __objc_catlist, regular, no_dead_strip"; + else if (!strncmp (name, "LABEL_NONLAZY_CLASS_", 20)) + return "__DATA, __objc_nlclslist, regular, no_dead_strip"; + else if (!strncmp (name, "LABEL_NONLAZY_CAGEGORY_", 23)) + return "__DATA, __objc_nlcatlist, regular, no_dead_strip"; + else if (!strncmp (name, "PROTOCOL_REFERENCE_", 19)) + return "__DATA, __objc_protorefs, regular, no_dead_strip"; + else + return 0; + } else return 0; } #endif From evan.cheng at apple.com Thu Sep 20 13:03:23 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 20 Sep 2007 18:03:23 -0000 Subject: [llvm-commits] [llvm] r42169 - in /llvm/trunk/test/CodeGen/ARM: ifcvt1.ll ifcvt2.ll ifcvt3.ll ifcvt4.ll ifcvt5.ll ifcvt6.ll ifcvt7.ll ifcvt8.ll Message-ID: <200709201803.l8KI3Na5019372@zion.cs.uiuc.edu> Author: evancheng Date: Thu Sep 20 13:03:23 2007 New Revision: 42169 URL: http://llvm.org/viewvc/llvm-project?rev=42169&view=rev Log: -enable-arm-if-conversion is gone. Modified: llvm/trunk/test/CodeGen/ARM/ifcvt1.ll llvm/trunk/test/CodeGen/ARM/ifcvt2.ll llvm/trunk/test/CodeGen/ARM/ifcvt3.ll llvm/trunk/test/CodeGen/ARM/ifcvt4.ll llvm/trunk/test/CodeGen/ARM/ifcvt5.ll llvm/trunk/test/CodeGen/ARM/ifcvt6.ll llvm/trunk/test/CodeGen/ARM/ifcvt7.ll llvm/trunk/test/CodeGen/ARM/ifcvt8.ll Modified: llvm/trunk/test/CodeGen/ARM/ifcvt1.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ifcvt1.ll?rev=42169&r1=42168&r2=42169&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/ifcvt1.ll (original) +++ llvm/trunk/test/CodeGen/ARM/ifcvt1.ll Thu Sep 20 13:03:23 2007 @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion | grep bx | count 1 +; RUN: llvm-as < %s | llc -march=arm +; RUN: llvm-as < %s | llc -march=arm | grep bx | count 1 define i32 @t1(i32 %a, i32 %b) { %tmp2 = icmp eq i32 %a, 0 Modified: llvm/trunk/test/CodeGen/ARM/ifcvt2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ifcvt2.ll?rev=42169&r1=42168&r2=42169&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/ifcvt2.ll (original) +++ llvm/trunk/test/CodeGen/ARM/ifcvt2.ll Thu Sep 20 13:03:23 2007 @@ -1,7 +1,7 @@ -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion | grep bxlt | count 1 -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion | grep bxgt | count 1 -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion | grep bxge | count 1 +; RUN: llvm-as < %s | llc -march=arm +; RUN: llvm-as < %s | llc -march=arm | grep bxlt | count 1 +; RUN: llvm-as < %s | llc -march=arm | grep bxgt | count 1 +; RUN: llvm-as < %s | llc -march=arm | grep bxge | count 1 define i32 @t1(i32 %a, i32 %b, i32 %c, i32 %d) { %tmp2 = icmp sgt i32 %c, 10 Modified: llvm/trunk/test/CodeGen/ARM/ifcvt3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ifcvt3.ll?rev=42169&r1=42168&r2=42169&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/ifcvt3.ll (original) +++ llvm/trunk/test/CodeGen/ARM/ifcvt3.ll Thu Sep 20 13:03:23 2007 @@ -1,6 +1,6 @@ -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion | grep cmpne | count 1 -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion | grep bx | count 2 +; RUN: llvm-as < %s | llc -march=arm +; RUN: llvm-as < %s | llc -march=arm | grep cmpne | count 1 +; RUN: llvm-as < %s | llc -march=arm | grep bx | count 2 define i32 @t1(i32 %a, i32 %b, i32 %c, i32 %d) { switch i32 %c, label %cond_next [ Modified: llvm/trunk/test/CodeGen/ARM/ifcvt4.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ifcvt4.ll?rev=42169&r1=42168&r2=42169&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/ifcvt4.ll (original) +++ llvm/trunk/test/CodeGen/ARM/ifcvt4.ll Thu Sep 20 13:03:23 2007 @@ -1,6 +1,6 @@ -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion | grep subgt | count 1 -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion | grep suble | count 1 +; RUN: llvm-as < %s | llc -march=arm +; RUN: llvm-as < %s | llc -march=arm | grep subgt | count 1 +; RUN: llvm-as < %s | llc -march=arm | grep suble | count 1 ; FIXME: Check for # of unconditional branch after adding branch folding post ifcvt. define i32 @t(i32 %a, i32 %b) { Modified: llvm/trunk/test/CodeGen/ARM/ifcvt5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ifcvt5.ll?rev=42169&r1=42168&r2=42169&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/ifcvt5.ll (original) +++ llvm/trunk/test/CodeGen/ARM/ifcvt5.ll Thu Sep 20 13:03:23 2007 @@ -1,5 +1,5 @@ -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion -; RUN: llvm-as < %s | llc -march=arm -enable-arm-if-conversion | grep blge | count 1 +; RUN: llvm-as < %s | llc -march=arm +; RUN: llvm-as < %s | llc -march=arm | grep blge | count 1 @x = external global i32* ; [#uses=1] Modified: llvm/trunk/test/CodeGen/ARM/ifcvt6.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ifcvt6.ll?rev=42169&r1=42168&r2=42169&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/ifcvt6.ll (original) +++ llvm/trunk/test/CodeGen/ARM/ifcvt6.ll Thu Sep 20 13:03:23 2007 @@ -1,10 +1,10 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -march=arm -mtriple=arm-apple-darwin -enable-arm-if-conversion +; RUN: llc -march=arm -mtriple=arm-apple-darwin ; RUN: llvm-as < %s | \ -; RUN: llc -march=arm -mtriple=arm-apple-darwin -enable-arm-if-conversion | \ +; RUN: llc -march=arm -mtriple=arm-apple-darwin | \ ; RUN: grep cmpne | count 1 ; RUN: llvm-as < %s | \ -; RUN: llc -march=arm -mtriple=arm-apple-darwin -enable-arm-if-conversion | \ +; RUN: llc -march=arm -mtriple=arm-apple-darwin | \ ; RUN: grep ldmhi | count 1 define void @foo(i32 %X, i32 %Y) { Modified: llvm/trunk/test/CodeGen/ARM/ifcvt7.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ifcvt7.ll?rev=42169&r1=42168&r2=42169&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/ifcvt7.ll (original) +++ llvm/trunk/test/CodeGen/ARM/ifcvt7.ll Thu Sep 20 13:03:23 2007 @@ -1,13 +1,13 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -march=arm -mtriple=arm-apple-darwin -enable-arm-if-conversion +; RUN: llc -march=arm -mtriple=arm-apple-darwin ; RUN: llvm-as < %s | \ -; RUN: llc -march=arm -mtriple=arm-apple-darwin -enable-arm-if-conversion | \ +; RUN: llc -march=arm -mtriple=arm-apple-darwin | \ ; RUN: grep cmpeq | count 1 ; RUN: llvm-as < %s | \ -; RUN: llc -march=arm -mtriple=arm-apple-darwin -enable-arm-if-conversion | \ +; RUN: llc -march=arm -mtriple=arm-apple-darwin | \ ; RUN: grep moveq | count 1 ; RUN: llvm-as < %s | \ -; RUN: llc -march=arm -mtriple=arm-apple-darwin -enable-arm-if-conversion | \ +; RUN: llc -march=arm -mtriple=arm-apple-darwin | \ ; RUN: grep ldmeq | count 1 ; FIXME: Need post-ifcvt branch folding to get rid of the extra br at end of BB1. Modified: llvm/trunk/test/CodeGen/ARM/ifcvt8.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/ifcvt8.ll?rev=42169&r1=42168&r2=42169&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/ifcvt8.ll (original) +++ llvm/trunk/test/CodeGen/ARM/ifcvt8.ll Thu Sep 20 13:03:23 2007 @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | \ -; RUN: llc -march=arm -mtriple=arm-apple-darwin -enable-arm-if-conversion +; RUN: llc -march=arm -mtriple=arm-apple-darwin ; RUN: llvm-as < %s | \ -; RUN: llc -march=arm -mtriple=arm-apple-darwin -enable-arm-if-conversion | \ +; RUN: llc -march=arm -mtriple=arm-apple-darwin | \ ; RUN: grep ldmne | count 1 %struct.SString = type { i8*, i32, i32 } From evan.cheng at apple.com Thu Sep 20 13:06:22 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 20 Sep 2007 18:06:22 -0000 Subject: [llvm-commits] [llvm] r42170 - /llvm/trunk/test/CodeGen/ARM/branch.ll Message-ID: <200709201806.l8KI6MHj019535@zion.cs.uiuc.edu> Author: evancheng Date: Thu Sep 20 13:06:22 2007 New Revision: 42170 URL: http://llvm.org/viewvc/llvm-project?rev=42170&view=rev Log: Disable if-conversion for this test. Modified: llvm/trunk/test/CodeGen/ARM/branch.ll Modified: llvm/trunk/test/CodeGen/ARM/branch.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/branch.ll?rev=42170&r1=42169&r2=42170&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/ARM/branch.ll (original) +++ llvm/trunk/test/CodeGen/ARM/branch.ll Thu Sep 20 13:06:22 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm > %t +; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm -disable-arm-if-conversion > %t ; RUN: grep bne %t ; RUN: grep bge %t ; RUN: grep bhs %t From baldrick at free.fr Thu Sep 20 13:56:25 2007 From: baldrick at free.fr (Duncan Sands) Date: Thu, 20 Sep 2007 18:56:25 -0000 Subject: [llvm-commits] [llvm] r42171 - /llvm/trunk/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll Message-ID: <200709201856.l8KIuPnp011246@zion.cs.uiuc.edu> Author: baldrick Date: Thu Sep 20 13:56:24 2007 New Revision: 42171 URL: http://llvm.org/viewvc/llvm-project?rev=42171&view=rev Log: Testcase for PR1678. Added: llvm/trunk/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll Added: llvm/trunk/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll?rev=42171&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2007-09-17-AliasConstFold2.ll Thu Sep 20 13:56:24 2007 @@ -0,0 +1,14 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep icmp +; PR1678 + + at A = alias weak void ()* @B ; [#uses=1] + +declare extern_weak void @B() + +define i32 @active() { +entry: + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + %tmp1 = icmp ne void ()* @A, null ; [#uses=1] + %tmp12 = zext i1 %tmp1 to i32 ; [#uses=1] + ret i32 %tmp12 +} From dpatel at apple.com Thu Sep 20 18:01:51 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 20 Sep 2007 23:01:51 -0000 Subject: [llvm-commits] [llvm] r42178 - /llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Message-ID: <200709202301.l8KN1poZ018114@zion.cs.uiuc.edu> Author: dpatel Date: Thu Sep 20 18:01:50 2007 New Revision: 42178 URL: http://llvm.org/viewvc/llvm-project?rev=42178&view=rev Log: Don't increment invalid iterator. 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=42178&r1=42177&r2=42178&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Thu Sep 20 18:01:50 2007 @@ -928,8 +928,9 @@ while (!WorkList.empty()) { BasicBlock *BB = WorkList.back(); WorkList.pop_back(); for(BasicBlock::iterator BBI = BB->begin(), BBE = BB->end(); - BBI != BBE; ++BBI) { + BBI != BBE; ) { Instruction *I = BBI; + ++BBI; I->replaceAllUsesWith(UndefValue::get(I->getType())); I->eraseFromParent(); } From dpatel at apple.com Thu Sep 20 18:07:38 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 20 Sep 2007 23:07:38 -0000 Subject: [llvm-commits] [llvm] r42179 - /llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200709202307.l8KN7cAS019467@zion.cs.uiuc.edu> Author: dpatel Date: Thu Sep 20 18:07:37 2007 New Revision: 42179 URL: http://llvm.org/viewvc/llvm-project?rev=42179&view=rev Log: Do not override user specified section. Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=42179&r1=42178&r2=42179&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Thu Sep 20 18:07:37 2007 @@ -911,9 +911,9 @@ unsigned Align = TD->getPreferredAlignmentLog(I); if (C->isNullValue() && /* FIXME: Verify correct */ + !I->hasSection() && (I->hasInternalLinkage() || I->hasWeakLinkage() || - I->hasLinkOnceLinkage() || - (I->hasExternalLinkage() && !I->hasSection()))) { + I->hasLinkOnceLinkage() || I->hasExternalLinkage())) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (I->hasExternalLinkage()) { O << "\t.globl " << name << '\n'; From dpatel at apple.com Thu Sep 20 18:45:51 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 20 Sep 2007 23:45:51 -0000 Subject: [llvm-commits] [llvm] r42180 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200709202345.l8KNjpTP021023@zion.cs.uiuc.edu> Author: dpatel Date: Thu Sep 20 18:45:50 2007 New Revision: 42180 URL: http://llvm.org/viewvc/llvm-project?rev=42180&view=rev Log: Update aux. info associated with an instruction before erasing instruction. Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=42180&r1=42179&r2=42180&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Sep 20 18:45:50 2007 @@ -583,8 +583,8 @@ // insert the new conditional branch. EmitPreheaderBranchOnCondition(Cond, Val, NewExit, NewPH, OrigPH->getTerminator()); - OrigPH->getTerminator()->eraseFromParent(); LPM->deleteSimpleAnalysisValue(OrigPH->getTerminator(), L); + OrigPH->getTerminator()->eraseFromParent(); // We need to reprocess this loop, it could be unswitched again. redoLoop = true; @@ -759,8 +759,8 @@ // Emit the new branch that selects between the two versions of this loop. EmitPreheaderBranchOnCondition(LIC, Val, NewBlocks[0], LoopBlocks[0], OldBR); - OldBR->eraseFromParent(); LPM->deleteSimpleAnalysisValue(OldBR, L); + OldBR->eraseFromParent(); // Update dominator info if (DF && DT) { @@ -859,10 +859,10 @@ for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; ++UI) Worklist.push_back(cast(*UI)); - I->replaceAllUsesWith(V); - I->eraseFromParent(); LPM->deleteSimpleAnalysisValue(I, L); RemoveFromWorklist(I, Worklist); + I->replaceAllUsesWith(V); + I->eraseFromParent(); ++NumSimplify; } @@ -889,8 +889,8 @@ // Remove the branch from the latch to the header block, this makes // the header dead, which will make the latch dead (because the header // dominates the latch). - Pred->getTerminator()->eraseFromParent(); LPM->deleteSimpleAnalysisValue(Pred->getTerminator(), L); + Pred->getTerminator()->eraseFromParent(); new UnreachableInst(Pred); // The loop is now broken, remove it from LI. @@ -947,8 +947,8 @@ Succs.erase(std::unique(Succs.begin(), Succs.end()), Succs.end()); // Remove the basic block, including all of the instructions contained in it. - BB->eraseFromParent(); LPM->deleteSimpleAnalysisValue(BB, L); + BB->eraseFromParent(); // Remove successor blocks here that are not dead, so that we know we only // have dead blocks in this list. Nondead blocks have a way of becoming dead, // then getting removed before we revisit them, which is badness. @@ -1050,10 +1050,10 @@ Instruction* OldTerm = Old->getTerminator(); new BranchInst(Split, SI->getSuccessor(i), ConstantInt::getTrue(), OldTerm); - + + LPM->deleteSimpleAnalysisValue(Old->getTerminator(), L); Old->getTerminator()->eraseFromParent(); - PHINode *PN; for (BasicBlock::iterator II = SI->getSuccessor(i)->begin(); (PN = dyn_cast(II)); ++II) { @@ -1103,9 +1103,9 @@ for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) if (Instruction *Use = dyn_cast(I->getOperand(i))) Worklist.push_back(Use); - I->eraseFromParent(); LPM->deleteSimpleAnalysisValue(I, L); RemoveFromWorklist(I, Worklist); + I->eraseFromParent(); ++NumSimplify; continue; } @@ -1166,8 +1166,8 @@ // Move all of the successor contents from Succ to Pred. Pred->getInstList().splice(BI, Succ->getInstList(), Succ->begin(), Succ->end()); - BI->eraseFromParent(); LPM->deleteSimpleAnalysisValue(BI, L); + BI->eraseFromParent(); RemoveFromWorklist(BI, Worklist); // If Succ has any successors with PHI nodes, update them to have @@ -1176,8 +1176,8 @@ // Remove Succ from the loop tree. LI->removeBlock(Succ); - Succ->eraseFromParent(); LPM->deleteSimpleAnalysisValue(Succ, L); + Succ->eraseFromParent(); ++NumSimplify; } else if (ConstantInt *CB = dyn_cast(BI->getCondition())){ // Conditional branch. Turn it into an unconditional branch, then @@ -1189,8 +1189,8 @@ BasicBlock *LiveSucc = BI->getSuccessor(!CB->getZExtValue()); DeadSucc->removePredecessor(BI->getParent(), true); Worklist.push_back(new BranchInst(LiveSucc, BI)); - BI->eraseFromParent(); LPM->deleteSimpleAnalysisValue(BI, L); + BI->eraseFromParent(); RemoveFromWorklist(BI, Worklist); ++NumSimplify; From dalej at apple.com Thu Sep 20 18:47:58 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 20 Sep 2007 23:47:58 -0000 Subject: [llvm-commits] [llvm] r42181 - /llvm/trunk/lib/Support/APFloat.cpp Message-ID: <200709202347.l8KNlxXN021072@zion.cs.uiuc.edu> Author: johannes Date: Thu Sep 20 18:47:58 2007 New Revision: 42181 URL: http://llvm.org/viewvc/llvm-project?rev=42181&view=rev Log: Fix PR 1688. See comments there. 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=42181&r1=42180&r2=42181&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Thu Sep 20 18:47:58 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, true }; + const fltSemantics APFloat::Bogus = { 0, 0, 0, false }; } /* Put a bunch of private, handy routines in an anonymous namespace. */ @@ -339,8 +339,7 @@ unsigned int APFloat::partCount() const { - return partCountForBits(semantics->precision + - semantics->implicitIntegerBit ? 1 : 0); + return partCountForBits(semantics->precision + 1); } unsigned int @@ -1324,7 +1323,11 @@ newPartCount = partCountForBits(toSemantics.precision + 1); /* If our new form is wider, re-allocate our bit pattern into wider - storage. */ + storage. + If we're narrowing from multiple words to 1 words, copy to the single + word. If we are losing information by doing this, we would have to + worry about rounding; right now the only case is f80 -> shorter + conversion, and we are keeping all 64 significant bits, so it's OK. */ if(newPartCount > partCount()) { integerPart *newParts; @@ -1333,6 +1336,13 @@ APInt::tcAssign(newParts, significandParts(), partCount()); freeSignificand(); significand.parts = newParts; + } else if (newPartCount==1 && newPartCount < partCount()) { + integerPart newPart; + + APInt::tcSet(&newPart, 0, newPartCount); + APInt::tcAssign(&newPart, significandParts(), partCount()); + freeSignificand(); + significand.part = newPart; } if(category == fcNormal) { @@ -1588,22 +1598,22 @@ // Conversion from APFloat to/from host float/double. It may eventually be // possible to eliminate these and have everybody deal with APFloats, but that // will take a while. This approach will not easily extend to long double. -// Current implementation requires partCount()==1, which is correct at the -// moment but could be made more general. +// Current implementation requires integerPartWidth==64, which is correct at +// the moment but could be made more general. // Denormals have exponent minExponent in APFloat, but minExponent-1 in -// the actual IEEE respresentation. We compensate for that here. +// the actual IEEE respresentations. We compensate for that here. APInt APFloat::convertF80LongDoubleAPFloatToAPInt() const { assert(semantics == (const llvm::fltSemantics* const)&x87DoubleExtended); - assert (partCount()==1); + assert (partCount()==2); uint64_t myexponent, mysignificand; if (category==fcNormal) { myexponent = exponent+16383; //bias - mysignificand = *significandParts(); + mysignificand = significandParts()[0]; if (myexponent==1 && !(mysignificand & 0x8000000000000000ULL)) myexponent = 0; // denormal } else if (category==fcZero) { @@ -1614,7 +1624,7 @@ mysignificand = 0x8000000000000000ULL; } else if (category==fcNaN) { myexponent = 0x7fff; - mysignificand = *significandParts(); + mysignificand = significandParts()[0]; } else assert(0); @@ -1727,7 +1737,7 @@ (i2 & 0xffff); initialize(&APFloat::x87DoubleExtended); - assert(partCount()==1); + assert(partCount()==2); sign = i1>>63; if (myexponent==0 && mysignificand==0) { @@ -1739,11 +1749,13 @@ } else if (myexponent==0x7fff && mysignificand!=0x8000000000000000ULL) { // exponent meaningless category = fcNaN; - *significandParts() = mysignificand; + significandParts()[0] = mysignificand; + significandParts()[1] = 0; } else { category = fcNormal; exponent = myexponent - 16383; - *significandParts() = mysignificand; + significandParts()[0] = mysignificand; + significandParts()[1] = 0; if (myexponent==0) // denormal exponent = -16382; } From evan.cheng at apple.com Thu Sep 20 19:41:19 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 21 Sep 2007 00:41:19 -0000 Subject: [llvm-commits] [llvm] r42182 - in /llvm/trunk/lib/Target: ARM/ARMAsmPrinter.cpp PowerPC/PPCAsmPrinter.cpp X86/X86AsmPrinter.cpp Message-ID: <200709210041.l8L0fJJu022986@zion.cs.uiuc.edu> Author: evancheng Date: Thu Sep 20 19:41:19 2007 New Revision: 42182 URL: http://llvm.org/viewvc/llvm-project?rev=42182&view=rev Log: Honor user-defined section specification of a global, ignores whether its initializer is null. Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=42182&r1=42181&r2=42182&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Thu Sep 20 19:41:19 2007 @@ -835,7 +835,7 @@ if (Subtarget->isTargetELF()) O << "\t.type " << name << ",%object\n"; - if (C->isNullValue()) { + if (C->isNullValue() && !I->hasSection()) { if (I->hasExternalLinkage()) { if (const char *Directive = TAI->getZeroFillDirective()) { O << "\t.globl\t" << name << "\n"; @@ -845,9 +845,8 @@ } } - if (!I->hasSection() && - (I->hasInternalLinkage() || I->hasWeakLinkage() || - I->hasLinkOnceLinkage())) { + if (I->hasInternalLinkage() || I->hasWeakLinkage() || + I->hasLinkOnceLinkage()) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (!NoZerosInBSS && TAI->getBSSSection()) SwitchToDataSection(TAI->getBSSSection(), I); Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=42182&r1=42181&r2=42182&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Thu Sep 20 19:41:19 2007 @@ -661,9 +661,9 @@ unsigned Align = TD->getPreferredAlignmentLog(I); if (C->isNullValue() && /* FIXME: Verify correct */ + !I->hasSection() && (I->hasInternalLinkage() || I->hasWeakLinkage() || - I->hasLinkOnceLinkage() || - (I->hasExternalLinkage() && !I->hasSection()))) { + I->hasLinkOnceLinkage() || I->hasExternalLinkage())) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. if (I->hasExternalLinkage()) { O << "\t.global " << name << '\n'; Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=42182&r1=42181&r2=42182&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Thu Sep 20 19:41:19 2007 @@ -170,7 +170,7 @@ if (Subtarget->isTargetELF()) O << "\t.type\t" << name << ", at object\n"; - if (C->isNullValue()) { + if (C->isNullValue() && !I->hasSection()) { if (I->hasExternalLinkage()) { if (const char *Directive = TAI->getZeroFillDirective()) { O << "\t.globl\t" << name << "\n"; @@ -180,7 +180,7 @@ } } - if (!I->hasSection() && !I->isThreadLocal() && + if (!I->isThreadLocal() && (I->hasInternalLinkage() || I->hasWeakLinkage() || I->hasLinkOnceLinkage())) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. From isanbard at gmail.com Thu Sep 20 20:14:38 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 21 Sep 2007 01:14:38 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42183 - /llvm-gcc-4.0/tags/llvm-gcc-1200-15/ Message-ID: <200709210114.l8L1EcVk023941@zion.cs.uiuc.edu> Author: void Date: Thu Sep 20 20:14:37 2007 New Revision: 42183 URL: http://llvm.org/viewvc/llvm-project?rev=42183&view=rev Log: Creating llvm-gcc-1200-15 branch Added: llvm-gcc-4.0/tags/llvm-gcc-1200-15/ - copied from r42182, llvm-gcc-4.0/trunk/ From isanbard at gmail.com Thu Sep 20 20:14:44 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 21 Sep 2007 01:14:44 -0000 Subject: [llvm-commits] [llvm] r42184 - /llvm/tags/Apple/llvm-1200-15/ Message-ID: <200709210114.l8L1Eins023953@zion.cs.uiuc.edu> Author: void Date: Thu Sep 20 20:14:44 2007 New Revision: 42184 URL: http://llvm.org/viewvc/llvm-project?rev=42184&view=rev Log: Creating llvm-1200-15 branch Added: llvm/tags/Apple/llvm-1200-15/ - copied from r42183, llvm/trunk/ From echristo at apple.com Thu Sep 20 21:46:07 2007 From: echristo at apple.com (Eric Christopher) Date: Thu, 20 Sep 2007 19:46:07 -0700 Subject: [llvm-commits] [patch] add gcroot attribute, test Message-ID: <0933E6F8-DCA7-42ED-8BA1-F909C11F82AB@apple.com> Here are a pair of patches to add an attribute to automatically gcroot things based on type. It currently works for pointers to structures only because a) that's all I need, and b) I think that's all that makes sense really. I could remove the restriction if someone can come up with a good use case for other types. Note that we're also zeroing out automatic variables as well so if we do a collection before they're initialized we don't end up following garbage. Tested on x86-darwin. -eric -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: gcroot.diff.txt Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070920/7ab7ca89/attachment.txt -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: llvm.diff.txt Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070920/7ab7ca89/attachment-0001.txt From clattner at apple.com Thu Sep 20 21:58:14 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 20 Sep 2007 19:58:14 -0700 Subject: [llvm-commits] [patch] add gcroot attribute, test In-Reply-To: <0933E6F8-DCA7-42ED-8BA1-F909C11F82AB@apple.com> References: <0933E6F8-DCA7-42ED-8BA1-F909C11F82AB@apple.com> Message-ID: <9916D16C-29D2-4018-BF09-30620C24CB6D@apple.com> On Sep 20, 2007, at 7:46 PM, Eric Christopher wrote: > Here are a pair of patches to add an attribute to automatically > gcroot things based on type. It currently works for pointers to > structures only because a) that's all I need, and b) I think that's > all that makes sense really. I could remove the restriction if > someone can come up with a good use case for other types. Note that > we're also zeroing out automatic variables as well so if we do a > collection before they're initialized we don't end up following > garbage. Hi Eric, The patch looks great. The only problem I have is this: @@ -1732,6 +1734,8 @@ struct tree_type GTY(()) unsigned packed_flag : 1; unsigned restrict_flag : 1; unsigned contains_placeholder_bits : 2; + /* APPLE LOCAL LLVM */ + unsigned gcroot_flag : 1; unsigned lang_flag_0 : 1; unsigned lang_flag_1 : 1; GCC carefully packs these bitfields so that there are exactly 32 of them. With this addition, you'll push over and require an extra word for every tree. Would it be possible to record the gcroot flag in the attributes list somehow? This tradeoff seems worthwhile, because almost no structs will be marked as GCable. Your testcase patch looks great, one suggested tweak: +// RUN: %llvmgxx -c -emit-llvm %s -o - | llvm-dis | grep llvm.gcroot +// RUN: %llvmgxx -c -emit-llvm %s -o - | llvm-dis | grep llvm.gcroot | count 6 I'd suggest changing these into: +// RUN: %llvmgxx -S -emit-llvm %s -o - | grep llvm.gcroot +// RUN: %llvmgxx -S -emit-llvm %s -o - | grep llvm.gcroot | count 6 ... which removes an extra command invocation. Thanks Eric! -Chris > Tested on x86-darwin. > > -eric > > > From resistor at mac.com Thu Sep 20 22:53:53 2007 From: resistor at mac.com (Owen Anderson) Date: Fri, 21 Sep 2007 03:53:53 -0000 Subject: [llvm-commits] [llvm] r42185 - in /llvm/trunk/lib: Analysis/MemoryDependenceAnalysis.cpp Transforms/Scalar/GVN.cpp Message-ID: <200709210353.l8L3rrW0028320@zion.cs.uiuc.edu> Author: resistor Date: Thu Sep 20 22:53:52 2007 New Revision: 42185 URL: http://llvm.org/viewvc/llvm-project?rev=42185&view=rev Log: Add partial caching of non-local memory dependence queries. This provides a modest speedup for GVN. Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=42185&r1=42184&r2=42185&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Thu Sep 20 22:53:52 2007 @@ -135,6 +135,13 @@ DenseMap& resp) { // Set of blocks that we've already visited in our DFS SmallPtrSet visited; + // If we're updating a dirtied cache entry, we don't need to reprocess + // already computed entries. + for (DenseMap::iterator I = resp.begin(), + E = resp.end(); I != E; ++I) + if (I->second != Dirty) + visited.insert(I->first); + // Current stack of the DFS SmallVector stack; stack.push_back(block); @@ -211,8 +218,28 @@ void MemoryDependenceAnalysis::getNonLocalDependency(Instruction* query, DenseMap& resp) { if (depGraphNonLocal.count(query)) { - resp = depGraphNonLocal[query]; + DenseMap& cached = depGraphNonLocal[query]; NumCacheNonlocal++; + + SmallVector dirtied; + for (DenseMap::iterator I = cached.begin(), + E = cached.end(); I != E; ++I) + if (I->second == Dirty) + dirtied.push_back(I->first); + + for (SmallVector::iterator I = dirtied.begin(), + E = dirtied.end(); I != E; ++I) { + Instruction* localDep = getDependency(query, 0, *I); + if (localDep != NonLocal) + cached[*I] = localDep; + else { + cached.erase(*I); + nonLocalHelper(query, *I, cached); + } + } + + resp = cached; + return; } else NumUncacheNonlocal++; @@ -430,7 +457,11 @@ SmallPtrSet& set = reverseDepNonLocal[rem]; for (SmallPtrSet::iterator I = set.begin(), E = set.end(); I != E; ++I) - depGraphNonLocal.erase(*I); + for (DenseMap::iterator DI = + depGraphNonLocal[*I].begin(), DE = depGraphNonLocal[*I].end(); + DI != DE; ++DI) + if (DI->second == rem) + DI->second = Dirty; reverseDepNonLocal.erase(rem); } Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=42185&r1=42184&r2=42185&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Thu Sep 20 22:53:52 2007 @@ -834,7 +834,7 @@ return false; } else if (I->second == MemoryDependenceAnalysis::NonLocal) { continue; - }else if (StoreInst* S = dyn_cast(I->second)) { + } else if (StoreInst* S = dyn_cast(I->second)) { if (S->getPointerOperand() == L->getPointerOperand()) repl[I->first] = S->getOperand(0); else From sabre at nondot.org Thu Sep 20 22:54:09 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 21 Sep 2007 03:54:09 -0000 Subject: [llvm-commits] [llvm] r42186 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200709210354.l8L3sA8S028346@zion.cs.uiuc.edu> Author: lattner Date: Thu Sep 20 22:54:09 2007 New Revision: 42186 URL: http://llvm.org/viewvc/llvm-project?rev=42186&view=rev Log: Initial hack at 2.1 release notes. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=42186&r1=42185&r2=42186&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Thu Sep 20 22:54:09 2007 @@ -4,11 +4,11 @@ - LLVM 2.0 Release Notes + LLVM 2.1 Release Notes -
LLVM 2.0 Release Notes
+
LLVM 2.1 Release Notes
  1. Introduction
  2. @@ -32,7 +32,7 @@

    This document contains the release notes for the LLVM compiler -infrastructure, release 2.0. Here we describe the status of LLVM, including +infrastructure, release 2.1. Here we describe the status of LLVM, including major improvements from the previous release and any known problems. All LLVM releases may be downloaded from the LLVM releases web site.

    @@ -44,10 +44,9 @@ list is a good place to send them.

    Note that if you are reading this file from a Subversion checkout or the -main LLVM web page, -this document applies to the next release, not the current one. To see -the release notes for the current or previous releases, see the releases page.

    +main LLVM web page, this document applies to the next release, not the +current one. To see the release notes for a specific releases, please see the +releases page.

    @@ -59,416 +58,197 @@
    -

    This is the eleventh public release of the LLVM Compiler Infrastructure. -Being the first major release since 1.0, this release is different in several -ways from our previous releases:

    - -
      -
    1. We took this as an opportunity to -break backwards compatibility with the LLVM 1.x bytecode and .ll file format. -If you have LLVM 1.9 .ll files that you would like to upgrade to LLVM 2.x, we -recommend the use of the stand alone llvm-upgrade -tool (which is included with 2.0). We intend to keep compatibility with .ll -and .bc formats within the 2.x release series, like we did within the 1.x -series.
    2. -
    3. There are several significant change to the LLVM IR and internal APIs, such - as a major overhaul of the type system, the completely new bitcode file - format, etc (described below).
    4. -
    5. We designed the release around a 6 month release cycle instead of the usual - 3-month cycle. This gave us extra time to develop and test some of the - more invasive features in this release.
    6. -
    7. LLVM 2.0 no longer supports the llvm-gcc3 front-end. Users are required to - upgrade to llvm-gcc4. llvm-gcc4 includes many features over - llvm-gcc3, is faster, and is much easier to - build from source.
    8. -
    - -

    Note that while this is a major version bump, this release has been - extensively tested on a wide range of software. It is easy to say that this - is our best release yet, in terms of both features and correctness. This is - the first LLVM release to correctly compile and optimize major software like - LLVM itself, Mozilla/Seamonkey, Qt 4.3rc1, kOffice, etc out of the box on - linux/x86. -

    +

    This is the twelfth public release of the LLVM Compiler Infrastructure. +It includes many features and refinements from LLVM 2.0.

    - -
    -

    Changes to the LLVM IR itself:

    - -
      - -
    • Integer types are now completely signless. This means that we - have types like i8/i16/i32 instead of ubyte/sbyte/short/ushort/int - etc. LLVM operations that depend on sign have been split up into - separate instructions (PR950). This - eliminates cast instructions that just change the sign of the operands (e.g. - int -> uint), which reduces the size of the IR and makes optimizers - simpler to write.
    • +

      LLVM 2.1 brings two new beta C front-ends. First, Duncan, Anton and Devang +start syncing up llvm-gcc with GCC 4.2, yielding "llvm-gcc 4.2" (creative, +huh?). llvm-gcc 4.2 has the promise to bring much better FORTRAN and Ada +support to LLVM as well as features like atomic builtins, OpenMP, and many other +things. Check it out!

      -
    • Integer types with arbitrary bitwidths (e.g. i13, i36, i42, i1057, etc) are - now supported in the LLVM IR and optimizations (PR1043). However, neither llvm-gcc - (PR1284) nor the native code generators - (PR1270) support non-standard width - integers yet.
    • +

      Second, LLVM now includes its own native C and Objective-C front-end (C++ is +in progress, but is not very far along) code named "clang". This front-end has a number of great +features, primarily aimed at source-level analysis and speeding up compile-time. +At this point though, the LLVM Code Generator component is still very early in +development, so it's mostly useful for people looking to build source-level +analysis tools or source-to-source translators.

      -
    • 'Type planes' have been removed (PR411). - It is no longer possible to have two values with the same name in the - same symbol table. This simplifies LLVM internals, allowing significant - speedups.
    • - -
    • Global variables and functions in .ll files are now prefixed with - @ instead of % (PR645).
    • +
    -
  3. The LLVM 1.x "bytecode" format has been replaced with a - completely new binary representation, named 'bitcode'. The Bitcode Format brings a - number of advantages to the LLVM over the old bytecode format: it is denser - (files are smaller), more extensible, requires less memory to read, - is easier to keep backwards compatible (so LLVM 2.5 will read 2.0 .bc - files), and has many other nice features.
  4. + + -
  5. Load and store instructions now track the alignment of their pointer - (PR400). This allows the IR to - express loads that are not sufficiently aligned (e.g. due to '#pragma - packed') or to capture extra alignment information.
  6. - +
    -

    Major new features:

    +

    Some of the most noticable improvements this release have been in the +optimizer, speeding it up and making it more aggressive

      -
    • A number of ELF features are now supported by LLVM, including 'visibility', - extern weak linkage, Thread Local Storage (TLS) with the __thread - keyword, and symbol aliases. - Among other things, this means that many of the special options needed to - configure llvm-gcc on linux are no longer needed, and special hacks to build - large C++ libraries like Qt are not needed.
    • - -
    • LLVM now has a new MSIL backend. llc -march=msil will now turn LLVM - into MSIL (".net") bytecode. This is still fairly early development - with a number of limitations.
    • +
    • Owen DSE and MemDep analysis
    • +
    • Owen GVN
    • +
    • Owen GVN-PRE, not in llvm-gcc
    • +
    • Devang merged ETForest and DomTree into a single easier to use data +structure.
    • +
    • Nick Lewycky improved loop trip count analysis to handle many more common +cases.
    • -
    • A new llvm-upgrade tool - exists to migrates LLVM 1.9 .ll files to LLVM 2.0 syntax.
    + + - -
    -

    New features include: -

    + +

    foo

      -
    • Precompiled Headers (PCH) are now supported.
    • -
    • "#pragma packed" is now supported, as are the various features - described above (visibility, extern weak linkage, __thread, aliases, - etc).
    • +
    • Dale finished up the Tail Merging optimization in the code generator, +enabling it by default. This produces smaller code that is also faster in some +cases.
    • + +
    • Dan Gohman changed the way we represent vectors before legalization, +significantly simplifying the SelectionDAG representation for these and making +the code generator faster for vector code.
    • -
    • Tracking function parameter/result attributes is now possible.
    • +
    • Evan remat rewrite (coallesced intervals + folding of remat'd loads) and +live intervals improvements.
    • -
    • Many internal enhancements have been added, such as improvements to - NON_LVALUE_EXPR, arrays with non-zero base, structs with variable sized - fields, VIEW_CONVERT_EXPR, CEIL_DIV_EXPR, nested functions, and many other - things. This is primarily to supports non-C GCC front-ends, like Ada.
    • +
    • Dan Gohman contributed support for better alignment and volatility handling +in the code generator, and significantly enhanced alignment analysis for SSE +load/store instructions.
    • -
    • It is simpler to configure llvm-gcc for linux.
    • +
    • Christopher Lamb virtual register sub-register support, better truncates and +extends on X86.
    • + +
    • Duraid Madina contributed a new "bigblock" register allocator, and Roman +Levenstein contributed several big improvements. BigBlock is optimized for code +that uses very large basic blocks. It is slightly slower than the "local" +allocator, but produces much better code.
    • + +
    • David Greene refactored the register allocator to split coallescing out from +allocation, making coallescers pluggable.
    - +
    - - + + +

    New features include:

      -
    • The pass manager has been entirely - rewritten, making it significantly smaller, simpler, and more extensible. - Support has been added to run FunctionPasses interlaced with - CallGraphSCCPasses, we now support loop transformations - explicitly with LoopPass, and ModulePasses may now use the - result of FunctionPasses.
    • - -
    • LLVM 2.0 includes a new loop rotation pass, which converts "for loops" into - "do/while loops", where the condition is at the bottom of the loop.
    • - -
    • The Loop Strength Reduction pass has been improved, and we now support - sinking expressions across blocks to reduce register pressure.
    • - -
    • The -scalarrepl pass can now promote unions containing FP values - into a register, it can also handle unions of vectors of the same - size.
    • - -
    • The [Post]DominatorSet classes have been removed from LLVM and clients - switched to use the more-efficient ETForest class instead.
    • - -
    • The ImmediateDominator class has also been removed, and clients have been - switched to use DominatorTree instead.
    • - -
    • The predicate simplifier pass has been improved, making it able to do - simple value range propagation and eliminate more conditionals. However, - note that predsimplify is not enabled by default in llvm-gcc.
    • - +
    • Bruno Cardoso Lopes contributed initial MIPS support.
    • +
    • Bill Wendling added SSSE3 support.
    • +
    • New Target independent if converter, ARM uses it so far
    • +
    • Nicholas Geoffray contributed improved linux/ppc ABI and JIT support.
    • +
    • Dale Johannesen rewrote handling of 32-bit float values in the X86 backend +when using the floating point stack, fixing several nasty bugs.
    • +
    • Dan contributed rematerialization support for the X86 backend.
    - - - -
    -

    -New features include: -

    - -
      - -
    • LLVM now supports software floating point, which allows LLVM to target - chips that don't have hardware FPUs (e.g. ARM thumb mode).
    • -
    • A new register scavenger has been implemented, which is useful for - finding free registers after register allocation. This is useful when - rewriting frame references on RISC targets, for example.
    • - -
    • Heuristics have been added to avoid coalescing vregs with very large live - ranges to physregs. This was bad because it effectively pinned the physical - register for the entire lifetime of the virtual register (PR711).
    • - -
    • Support now exists for very simple (but still very useful) - rematerialization the register allocator, enough to move - instructions like "load immediate" and constant pool loads.
    • - -
    • Switch statement lowering is significantly better, improving codegen for - sparse switches that have dense subregions, and implemented support - for the shift/and trick.
    • - -
    • LLVM now supports tracking physreg sub-registers and super-registers - in the code generator, and includes extensive register - allocator changes to track them.
    • - -
    • There is initial support for virtreg sub-registers - (PR1350).
    • - -
    + + -

    -Other improvements include: +

    +

    New features include:

      +
    • Duncan and Anton exception handling in llvm-gcc 4.0/4.2
    • -
    • Inline assembly support is much more solid that before. - The two primary features still missing are support for 80-bit floating point - stack registers on X86 (PR879), and - support for inline asm in the C backend (PR802).
    • +
    • Devang and Duncan: Bitfields, pragma pack
    • -
    • DWARF debug information generation has been improved. LLVM now passes - most of the GDB testsuite on MacOS and debug info is more dense.
    • +
    • Tanya implemented support for __attribute__((noinline)) in llvm-gcc, and +added support for generic variable annotations which are propagated into the +LLVM IR, e.g. "int X __attribute__((annotate("myproperty")));".
    • -
    • Codegen support for Zero-cost DWARF exception handling has been added (PR592). It is mostly - complete and just in need of continued bug fixes and optimizations at - this point. However, support in llvm-g++ is disabled with an - #ifdef for the 2.0 release (PR870).
    • +
    • Sheng Zhou and Christopher Lamb implemented alias analysis support for +'restrict' arguments to functions.
    • -
    • The code generator now has more accurate and general hooks for - describing addressing modes ("isLegalAddressingMode") to - optimizations like loop strength reduction and code sinking.
    • - -
    • Progress has been made on a direct Mach-o .o file writer. Many small - apps work, but it is still not quite complete.
    • +
    • Duncan contributed support for trampolines (pointers to nested functions), +currently only supported on x86 target.
    + +
    -

    In addition, the LLVM target description format has itself been extended in - several ways:

    - -
      -
    • TargetData now supports better target parameterization in - the .ll/.bc files, eliminating the 'pointersize/endianness' attributes - in the files (PR761).
    • - -
    • TargetData was generalized for finer grained alignment handling, - handling of vector alignment, and handling of preferred alignment
    • - -
    • LLVM now supports describing target calling conventions - explicitly in .td files, reducing the amount of C++ code that needs - to be written for a port.
    • - -
    + + - - -
    - -

    X86-specific Code Generator Enhancements: +

    New features include:

      -
    • The MMX instruction set is now supported through intrinsics.
    • -
    • The scheduler was improved to better reduce register pressure on - X86 and other targets that are register pressure sensitive.
    • -
    • Linux/x86-64 support is much better.
    • -
    • PIC support for linux/x86 has been added.
    • -
    • The X86 backend now supports the GCC regparm attribute.
    • -
    • LLVM now supports inline asm with multiple constraint letters per operand - (like "mri") which is common in X86 inline asms.
    • -
    - -

    ARM-specific Code Generator Enhancements:

    - -
      -
    • The ARM code generator is now stable and fully supported.
    • - -
    • There are major new features, including support for ARM - v4-v6 chips, vfp support, soft float point support, pre/postinc support, - load/store multiple generation, constant pool entry motion (to support - large functions), inline asm support, weak linkage support, static - ctor/dtor support and many bug fixes.
    • - -
    • Added support for Thumb code generation (llc -march=thumb).
    • - -
    • The ARM backend now supports the ARM AAPCS/EABI ABI and PIC codegen on - arm/linux.
    • - -
    • Several bugs were fixed for DWARF debug info generation on arm/linux.
    • - -
    - -

    PowerPC-specific Code Generator Enhancements:

    - -
      -
    • The PowerPC 64 JIT now supports addressing code loaded above the 2G - boundary.
    • +
    • Neil Booth APFloat, foundation for long double support that will be wrapped +up in 2.2. Dale contributed most of long double support, will be enabled in +2.2.
    • -
    • Improved support for the Linux/ppc ABI and the linux/ppc JIT is fully - functional now. llvm-gcc and static compilation are not fully supported - yet though.
    • +
    • LLVM now provides an LLVMBuilder class which makes it significantly easier +to create LLVM IR instructions.
    • -
    • Many PowerPC 64 bug fixes.
    • +
    • Reid contributed support for intrinsics that take arbitrary integer typed +arguments, Dan Gohman and Chandler extended it to support FP and vectors.
    • +
    - +
    - - - -
    - -

    More specific changes include:

    - -
      -
    • LLVM no longer relies on static destructors to shut itself down. Instead, - it lazily initializes itself and shuts down when llvm_shutdown() is - explicitly called.
    • - -
    • LLVM now has significantly fewer static constructors, reducing startup time. -
    • - -
    • Several classes have been refactored to reduce the amount of code that - gets linked into apps that use the JIT.
    • - -
    • Construction of intrinsic function declarations has been simplified.
    • - -
    • The gccas/gccld tools have been replaced with small shell scripts.
    • - -
    • Support has been added to llvm-test for running on low-memory - or slow machines (make SMALL_PROBLEM_SIZE=1).
    • - -
    + + - -
    - -

    LLVM 2.0 contains a revamp of the type system and several other significant -internal changes. If you are programming to the C++ API, be aware of the -following major changes:

    +

    New features include: +

      -
    • Pass registration is slightly different in LLVM 2.0 (you now need an - intptr_t in your constructor), as explained in the Writing an LLVM Pass - document.
    • - -
    • ConstantBool, ConstantIntegral and ConstantInt - classes have been merged together, we now just have - ConstantInt.
    • - -
    • Type::IntTy, Type::UIntTy, Type::SByteTy, ... are - replaced by Type::Int8Ty, Type::Int16Ty, etc. LLVM types - have always corresponded to fixed size types - (e.g. long was always 64-bits), but the type system no longer includes - information about the sign of the type. Also, the - Type::isPrimitiveType() method now returns false for integers.
    • +
    • BrainF frontend by Sterling Stein.
    • -
    • Several classes (CallInst, GetElementPtrInst, - ConstantArray, etc), that once took std::vector as - arguments now take ranges instead. For example, you can create a - GetElementPtrInst with code like: - -
      -      Value *Ops[] = { Op1, Op2, Op3 };
      -      GEP = new GetElementPtrInst(BasePtr, Ops, 3);
      -    
      - - This avoids creation of a temporary vector (and a call to malloc/free). If - you have an std::vector, use code like this: -
      -      std::vector<Value*> Ops = ...;
      -      GEP = new GetElementPtrInst(BasePtr, &Ops[0], Ops.size());
      -    
      +
    • David Green contributed a new --enable-expensive-checks configure option +which enables STL checking, and fixed several bugs exposed by it.
    • - - -
    • CastInst is now abstract and its functionality is split into - several parts, one for each of the new - cast instructions.
    • - -
    • Instruction::getNext()/getPrev() are now private (along with - BasicBlock::getNext, etc), for efficiency reasons (they are now no - longer just simple pointers). Please use BasicBlock::iterator, etc - instead.
    • -
    • Module::getNamedFunction() is now called - Module::getFunction().
    • - -
    • SymbolTable.h has been split into ValueSymbolTable.h and -TypeSymbolTable.h.
    +
    -
    Portability and Supported Platforms From echristo at apple.com Fri Sep 21 03:49:25 2007 From: echristo at apple.com (Eric Christopher) Date: Fri, 21 Sep 2007 01:49:25 -0700 Subject: [llvm-commits] [patch] add gcroot attribute, test In-Reply-To: <9916D16C-29D2-4018-BF09-30620C24CB6D@apple.com> References: <0933E6F8-DCA7-42ED-8BA1-F909C11F82AB@apple.com> <9916D16C-29D2-4018-BF09-30620C24CB6D@apple.com> Message-ID: > > GCC carefully packs these bitfields so that there are exactly 32 of > them. With this addition, you'll push over and require an extra > word for every tree. Would it be possible to record the gcroot flag > in the attributes list somehow? This tradeoff seems worthwhile, > because almost no structs will be marked as GCable. Sure. Here's the new patch. I removed any dependence on RECORD_TYPE, but make sure we have a pointer at least to gcroot from. -eric -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: llvm-gcc.diff.txt Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070921/b3a4be0c/attachment.txt -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: llvm.diff.txt Url: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070921/b3a4be0c/attachment-0001.txt From baldrick at free.fr Fri Sep 21 09:30:12 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 21 Sep 2007 14:30:12 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42187 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200709211430.l8LEUCVK024899@zion.cs.uiuc.edu> Author: baldrick Date: Fri Sep 21 09:30:11 2007 New Revision: 42187 URL: http://llvm.org/viewvc/llvm-project?rev=42187&view=rev Log: If TYPE_SIZE is null (in which case we almost certainly never get here), then bail out conservatively rather than optimistically. Likewise if TYPE_SIZE is negative. 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=42187&r1=42186&r2=42187&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Sep 21 09:30:11 2007 @@ -547,13 +547,14 @@ // If the type does not overlap, don't bother checking below. if (!TYPE_SIZE(type)) - return false; + // C-style variable length array? Be conservative. + return true; - if (!isInt64(TYPE_SIZE(type), false)) - // Variable sized or huge - be conservative. + if (!isInt64(TYPE_SIZE(type), true)) + // Negative size (!) or huge - be conservative. return true; - if (!getInt64(TYPE_SIZE(type), false) || + if (!getInt64(TYPE_SIZE(type), true) || PadStartBits >= (int64_t)getInt64(TYPE_SIZE(type), false) || PadStartBits+PadSizeBits <= 0) return false; From baldrick at free.fr Fri Sep 21 09:30:47 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 21 Sep 2007 14:30:47 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42188 - /llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Message-ID: <200709211430.l8LEUlSG024924@zion.cs.uiuc.edu> Author: baldrick Date: Fri Sep 21 09:30:46 2007 New Revision: 42188 URL: http://llvm.org/viewvc/llvm-project?rev=42188&view=rev Log: If TYPE_SIZE is null (in which case we almost certainly never get here), then bail out conservatively rather than optimistically. Likewise if TYPE_SIZE is negative. 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=42188&r1=42187&r2=42188&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Fri Sep 21 09:30:46 2007 @@ -536,13 +536,14 @@ // If the type does not overlap, don't bother checking below. if (!TYPE_SIZE(type)) - return false; + // C-style variable length array? Be conservative. + return true; - if (!isInt64(TYPE_SIZE(type), false)) - // Variable sized or huge - be conservative. + if (!isInt64(TYPE_SIZE(type), true)) + // Negative size (!) or huge - be conservative. return true; - if (!getInt64(TYPE_SIZE(type), false) || + if (!getInt64(TYPE_SIZE(type), true) || PadStartBits >= (int64_t)getInt64(TYPE_SIZE(type), false) || PadStartBits+PadSizeBits <= 0) return false; From gordonhenriksen at mac.com Fri Sep 21 09:49:33 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Fri, 21 Sep 2007 10:49:33 -0400 Subject: [llvm-commits] [patch] add gcroot attribute, test In-Reply-To: References: <0933E6F8-DCA7-42ED-8BA1-F909C11F82AB@apple.com> <9916D16C-29D2-4018-BF09-30620C24CB6D@apple.com> Message-ID: <916F719E-1A02-41EE-BF17-9E5DBEFA1513@mac.com> Hi Eric, On Sep 21, 2007, at 04:49, Eric Christopher wrote: > Here are a pair of patches to add an attribute to automatically > gcroot things based on type. It currently works for pointers to > structures only because a) that's all I need, and b) I think that's > all that makes sense really. I could remove the restriction if > someone can come up with a good use case for other types. Very cool. > Note that we're also zeroing out automatic variables as well so if > we do a collection before they're initialized we don't end up > following garbage. @@ -1581,6 +1605,17 @@ void TreeToLLVM::EmitAutomaticVariableDe // Handle annotate attributes if (DECL_ATTRIBUTES(decl)) EmitAnnotateIntrinsic(AI, decl); + + // Handle gcroot attribute + if (POINTER_TYPE_P(TREE_TYPE (decl)) + && TYPE_GCROOT(TREE_TYPE (decl))) + { + // We should null out local variables so that a stack crawl + // before initialization doesn't get garbage results to follow. + const Type *T = cast(AI->getType())- >getElementType(); + EmitTypeGcroot(AI, decl); + Builder.CreateStore(Constant::getNullValue(T), AI); + } if (TheDebugInfo) { if (DECL_NAME(decl)) { This is redundant; LLVM does it for you. See thread starting here: http://www.mail-archive.com/llvm-commits at cs.uiuc.edu/msg23987.html The upshot is that the collector knows whether it is necessary to initialize roots or not, and does so on the program's behalf iff necessary. However, if the source language requires null initialization semantics, then the front-end should emit explicit null initializers (as the variable comes into scope). +// Emits code to do something for a type attribute +void TreeToLLVM::EmitTypeGcroot(Value *V, tree decl) { + + Function *gcrootFun = Intrinsic::getDeclaration(TheModule, + Intrinsic::gcroot); + + // The idea is that it's a pointer to type "Value" + // which is opaque* but the routine expects i8** and i8*. + const PointerType *Ty = PointerType::get(Type::Int8Ty); + V = Builder.CreateBitCast(V, PointerType::get(Ty), "tmp"); The llvm.gcroot intrinsic can be declared to take any types you care to give it in the module, so long as its eventual type is like void (**, *). But since you don't have a parent type to use, what you've done probably makes as much sense as anything. ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070921/a227703e/attachment.html From rafael.espindola at gmail.com Fri Sep 21 09:55:38 2007 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Fri, 21 Sep 2007 14:55:38 -0000 Subject: [llvm-commits] [llvm] r42189 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200709211455.l8LEtdYQ025846@zion.cs.uiuc.edu> Author: rafael Date: Fri Sep 21 09:55:38 2007 New Revision: 42189 URL: http://llvm.org/viewvc/llvm-project?rev=42189&view=rev Log: small cleanup: use LowerMemArgument in LowerFastCCArguments also Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=42189&r1=42188&r2=42189&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Sep 21 09:55:38 2007 @@ -1022,12 +1022,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)); } } From djg at cray.com Fri Sep 21 10:24:00 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 21 Sep 2007 15:24:00 -0000 Subject: [llvm-commits] [llvm] r42190 - /llvm/trunk/include/llvm/IntrinsicsX86.td Message-ID: <200709211524.l8LFO0J8027154@zion.cs.uiuc.edu> Author: djg Date: Fri Sep 21 10:24:00 2007 New Revision: 42190 URL: http://llvm.org/viewvc/llvm-project?rev=42190&view=rev Log: There is no {rsqrt,rcp}{p,s}d. Modified: llvm/trunk/include/llvm/IntrinsicsX86.td Modified: llvm/trunk/include/llvm/IntrinsicsX86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=42190&r1=42189&r2=42190&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) +++ llvm/trunk/include/llvm/IntrinsicsX86.td Fri Sep 21 10:24:00 2007 @@ -185,18 +185,6 @@ def int_x86_sse2_sqrt_pd : GCCBuiltin<"__builtin_ia32_sqrtpd">, Intrinsic<[llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>; - def int_x86_sse2_rcp_sd : GCCBuiltin<"__builtin_ia32_rcpsd">, - Intrinsic<[llvm_v2f64_ty, llvm_v2f64_ty], - [IntrNoMem]>; - def int_x86_sse2_rcp_pd : GCCBuiltin<"__builtin_ia32_rcppd">, - Intrinsic<[llvm_v2f64_ty, llvm_v2f64_ty], - [IntrNoMem]>; - def int_x86_sse2_rsqrt_sd : GCCBuiltin<"__builtin_ia32_rsqrtsd">, - Intrinsic<[llvm_v2f64_ty, llvm_v2f64_ty], - [IntrNoMem]>; - def int_x86_sse2_rsqrt_pd : GCCBuiltin<"__builtin_ia32_rsqrtpd">, - Intrinsic<[llvm_v2f64_ty, llvm_v2f64_ty], - [IntrNoMem]>; def int_x86_sse2_min_sd : GCCBuiltin<"__builtin_ia32_minsd">, Intrinsic<[llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty], [IntrNoMem]>; From rafael.espindola at gmail.com Fri Sep 21 10:50:22 2007 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Fri, 21 Sep 2007 15:50:22 -0000 Subject: [llvm-commits] [llvm] r42192 - in /llvm/trunk: lib/Target/TargetData.cpp lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/byval2.ll Message-ID: <200709211550.l8LFoMut028361@zion.cs.uiuc.edu> Author: rafael Date: Fri Sep 21 10:50:22 2007 New Revision: 42192 URL: http://llvm.org/viewvc/llvm-project?rev=42192&view=rev Log: Don't add a default STACK_ALIGN (use the generic ABI alignment) Implement calls to functions with byval arguments on X86 Modified: llvm/trunk/lib/Target/TargetData.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/test/CodeGen/X86/byval2.ll Modified: llvm/trunk/lib/Target/TargetData.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=42192&r1=42191&r2=42192&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetData.cpp (original) +++ llvm/trunk/lib/Target/TargetData.cpp Fri Sep 21 10:50:22 2007 @@ -182,7 +182,6 @@ setAlignment(VECTOR_ALIGN, 8, 8, 64); // v2i32 setAlignment(VECTOR_ALIGN, 16, 16, 128); // v16i8, v8i16, v4i32, ... setAlignment(AGGREGATE_ALIGN, 0, 8, 0); // struct, union, class, ... - setAlignment(STACK_ALIGN, 0, 8, 0); // objects on the stack while (!temp.empty()) { std::string token = getToken(temp, "-"); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=42192&r1=42191&r2=42192&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Sep 21 10:50:22 2007 @@ -859,9 +859,9 @@ assert(VA.isMemLoc()); if (StackPtr.Val == 0) StackPtr = DAG.getRegister(getStackPtrReg(), getPointerTy()); - SDOperand PtrOff = DAG.getConstant(VA.getLocMemOffset(), getPointerTy()); - PtrOff = DAG.getNode(ISD::ADD, getPointerTy(), StackPtr, PtrOff); - MemOpChains.push_back(DAG.getStore(Chain, Arg, PtrOff, NULL, 0)); + + MemOpChains.push_back(LowerMemOpCallTo(Op, DAG, StackPtr, VA, Chain, + Arg)); } } @@ -1064,7 +1064,6 @@ unsigned Align = 1 << ((Flags & ISD::ParamFlags::ByValAlign) >> ISD::ParamFlags::ByValAlignOffs); - assert (Align >= 8); unsigned Size = (Flags & ISD::ParamFlags::ByValSize) >> ISD::ParamFlags::ByValSizeOffs; @@ -1133,9 +1132,9 @@ assert(VA.isMemLoc()); if (StackPtr.Val == 0) StackPtr = DAG.getRegister(getStackPtrReg(), getPointerTy()); - SDOperand PtrOff = DAG.getConstant(VA.getLocMemOffset(), getPointerTy()); - PtrOff = DAG.getNode(ISD::ADD, getPointerTy(), StackPtr, PtrOff); - MemOpChains.push_back(DAG.getStore(Chain, Arg, PtrOff, NULL, 0)); + + MemOpChains.push_back(LowerMemOpCallTo(Op, DAG, StackPtr, VA, Chain, + Arg)); } } Modified: llvm/trunk/test/CodeGen/X86/byval2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/byval2.ll?rev=42192&r1=42191&r2=42192&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/byval2.ll (original) +++ llvm/trunk/test/CodeGen/X86/byval2.ll Fri Sep 21 10:50:22 2007 @@ -1,4 +1,5 @@ ; RUN: llvm-as < %s | llc -march=x86-64 | grep rep.movsl | count 2 +; RUN: llvm-as < %s | llc -march=x86 | grep rep.movsl | count 2 %struct.s = type { i64, i64, i64 } From gabor at mac.com Fri Sep 21 11:18:45 2007 From: gabor at mac.com (Gabor Greif) Date: Fri, 21 Sep 2007 18:18:45 +0200 Subject: [llvm-commits] [llvm] r42186 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <46F3EEE5.6050401@mac.com> My feedback: handling of 32-bit float values -??-> handling of 80-bit float values typos: 3x coalles --> coales Many of the sentences do not seem to be finished, such as "Owen DSE and MemDep analysis". sloppyness: remat -> rematerialization Cheers, Gabor From sabre at nondot.org Fri Sep 21 12:06:39 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 21 Sep 2007 17:06:39 -0000 Subject: [llvm-commits] [llvm] r42193 - /llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Message-ID: <200709211706.l8LH6dmf031985@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 21 12:06:39 2007 New Revision: 42193 URL: http://llvm.org/viewvc/llvm-project?rev=42193&view=rev Log: initialize SetCCResultContents, fixing PR1693 Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=42193&r1=42192&r2=42193&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri Sep 21 12:06:39 2007 @@ -161,6 +161,7 @@ StackPointerRegisterToSaveRestore = 0; ExceptionPointerRegister = 0; ExceptionSelectorRegister = 0; + SetCCResultContents = UndefinedSetCCResult; SchedPreferenceInfo = SchedulingForLatency; JumpBufSize = 0; JumpBufAlignment = 0; From clattner at apple.com Fri Sep 21 12:24:48 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 21 Sep 2007 10:24:48 -0700 Subject: [llvm-commits] [patch] add gcroot attribute, test In-Reply-To: <916F719E-1A02-41EE-BF17-9E5DBEFA1513@mac.com> References: <0933E6F8-DCA7-42ED-8BA1-F909C11F82AB@apple.com> <9916D16C-29D2-4018-BF09-30620C24CB6D@apple.com> <916F719E-1A02-41EE-BF17-9E5DBEFA1513@mac.com> Message-ID: <393177A5-E535-4838-A652-B315866214B5@apple.com> >> Note that we're also zeroing out automatic variables as well so if >> we do a collection before they're initialized we don't end up >> following garbage. > > @@ -1581,6 +1605,17 @@ void TreeToLLVM::EmitAutomaticVariableDe > // Handle annotate attributes > if (DECL_ATTRIBUTES(decl)) > EmitAnnotateIntrinsic(AI, decl); > + > + // Handle gcroot attribute > + if (POINTER_TYPE_P(TREE_TYPE (decl)) > + && TYPE_GCROOT(TREE_TYPE (decl))) > + { > + // We should null out local variables so that a stack crawl > + // before initialization doesn't get garbage results to follow. > + const Type *T = cast(AI->getType())- > >getElementType(); > + EmitTypeGcroot(AI, decl); > + Builder.CreateStore(Constant::getNullValue(T), AI); > + } > > if (TheDebugInfo) { > if (DECL_NAME(decl)) { > > This is redundant; LLVM does it for you. See thread starting here: > http://www.mail-archive.com/llvm-commits at cs.uiuc.edu/msg23987.html I don't think so: the patch makes it so that llvm.gcroot *doesn't* implicitly null out the root. This means the front-end *does* need to explicitly emit the null init if it wants it, right? > The upshot is that the collector knows whether it is necessary to > initialize roots or not, and does so on the program's behalf iff > necessary. I don't think the collector wants to be in the business of nulling out pointers. The important thing is that when the collector runs, it doesn't want a root with garbage in it. > However, if the source language requires null initialization > semantics, then the front-end should emit explicit null > initializers (as the variable comes into scope). Even if the language doesn't require it, for GC roots, it seems very dangerous to hand the collector a root with random garbage in it, agree? > +// Emits code to do something for a type attribute > +void TreeToLLVM::EmitTypeGcroot(Value *V, tree decl) { > + > + Function *gcrootFun = Intrinsic::getDeclaration(TheModule, > + Intrinsic::gcroot); > + > + // The idea is that it's a pointer to type "Value" > + // which is opaque* but the routine expects i8** and i8*. > + const PointerType *Ty = PointerType::get(Type::Int8Ty); > + V = Builder.CreateBitCast(V, PointerType::get(Ty), "tmp"); > > The llvm.gcroot intrinsic can be declared to take any types you > care to give it in the module, so long as its eventual type is like > void(**, *). Actually no, I need to update the langref.html document to make this explicit, thanks for reminding me. The issue is that if you link two modules with different 's, the two different intrinsics would have to be merged somehow. By forcing the intrinsic to a specific type this problem doesn't happen. -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070921/bdc20053/attachment.html From sabre at nondot.org Fri Sep 21 12:30:40 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 21 Sep 2007 17:30:40 -0000 Subject: [llvm-commits] [llvm] r42194 - in /llvm/trunk/docs: GarbageCollection.html LangRef.html index.html Message-ID: <200709211730.l8LHUeE9001007@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 21 12:30:40 2007 New Revision: 42194 URL: http://llvm.org/viewvc/llvm-project?rev=42194&view=rev Log: gcroot must take concrete types, not arbitrary types. clean up intrinsic descriptions in langref a bit. Modified: llvm/trunk/docs/GarbageCollection.html llvm/trunk/docs/LangRef.html llvm/trunk/docs/index.html Modified: llvm/trunk/docs/GarbageCollection.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GarbageCollection.html?rev=42194&r1=42193&r2=42194&view=diff ============================================================================== --- llvm/trunk/docs/GarbageCollection.html (original) +++ llvm/trunk/docs/GarbageCollection.html Fri Sep 21 12:30:40 2007 @@ -159,7 +159,7 @@
    - void %llvm.gcroot(<ty>** %ptrloc, <ty2>* %metadata) + void %llvm.gcroot(i8** %ptrloc, i8* %metadata)

    @@ -200,7 +200,8 @@ ;; Initialize the object, telling LLVM that it is now live. ;; Java has type-tags on objects, so it doesn't need any ;; metadata. - call void %llvm.gcroot(%Object** %X, sbyte* null) + %tmp = bitcast %Object** %X to i8** + call void %llvm.gcroot(i8** %tmp, i8* null) ... ;; As the pointer goes out of scope, store a null value into @@ -219,7 +220,7 @@

    - sbyte *%llvm_gc_allocate(unsigned %Size) + void *%llvm_gc_allocate(unsigned %Size)

    The llvm_gc_allocate function is a global function defined by the @@ -236,8 +237,8 @@

    - sbyte *%llvm.gcread(sbyte *, sbyte **)
    - void %llvm.gcwrite(sbyte*, sbyte*, sbyte**) + i8 *%llvm.gcread(i8 *, i8 **)
    + void %llvm.gcwrite(i8*, i8*, i8**)

    Several of the more interesting garbage collectors (e.g., generational Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=42194&r1=42193&r2=42194&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Fri Sep 21 12:30:40 2007 @@ -3923,7 +3923,7 @@

    Syntax:
    -  declare void @llvm.gcroot(<ty>** %ptrloc, <ty2>* %metadata)
    +  declare void @llvm.gcroot(i8** %ptrloc, i8* %metadata)
     
    Overview:
    @@ -3957,7 +3957,7 @@
    Syntax:
    -  declare i8 * @llvm.gcread(i8 * %ObjPtr, i8 ** %Ptr)
    +  declare i8* @llvm.gcread(i8* %ObjPtr, i8** %Ptr)
     
    Overview:
    @@ -3992,7 +3992,7 @@
    Syntax:
    -  declare void @llvm.gcwrite(i8 * %P1, i8 * %Obj, i8 ** %P2)
    +  declare void @llvm.gcwrite(i8* %P1, i8* %Obj, i8** %P2)
     
    Overview:
    @@ -4085,7 +4085,7 @@
    Syntax:
    -  declare i8  *@llvm.frameaddress(i32 <level>)
    +  declare i8 *@llvm.frameaddress(i32 <level>)
     
    Overview:
    @@ -4128,7 +4128,7 @@
    Syntax:
    -  declare i8  *@llvm.stacksave()
    +  declare i8 *@llvm.stacksave()
     
    Overview:
    @@ -4194,8 +4194,7 @@
    Syntax:
    -  declare void @llvm.prefetch(i8  * <address>,
    -                                i32 <rw>, i32 <locality>)
    +  declare void @llvm.prefetch(i8* <address>, i32 <rw>, i32 <locality>)
     
    Overview:
    @@ -4239,7 +4238,7 @@
    Syntax:
    -  declare void @llvm.pcmarker( i32 <id> )
    +  declare void @llvm.pcmarker(i32 <id>)
     
    Overview:
    Modified: llvm/trunk/docs/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/index.html?rev=42194&r1=42193&r2=42194&view=diff ============================================================================== --- llvm/trunk/docs/index.html (original) +++ llvm/trunk/docs/index.html Fri Sep 21 12:30:40 2007 @@ -271,3 +271,4 @@ Last modified: $Date$ + From tonic at nondot.org Fri Sep 21 12:41:37 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 21 Sep 2007 17:41:37 -0000 Subject: [llvm-commits] [llvm] r42195 - /llvm/branches/release_21/test/Transforms/LoopIndexSplit/ Message-ID: <200709211741.l8LHfb0u001607@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 21 12:41:37 2007 New Revision: 42195 URL: http://llvm.org/viewvc/llvm-project?rev=42195&view=rev Log: Remove loop index split test cases for release. Removed: llvm/branches/release_21/test/Transforms/LoopIndexSplit/ From sabre at nondot.org Fri Sep 21 12:43:53 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 21 Sep 2007 17:43:53 -0000 Subject: [llvm-commits] [llvm] r42196 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200709211743.l8LHhrN3001764@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 21 12:43:52 2007 New Revision: 42196 URL: http://llvm.org/viewvc/llvm-project?rev=42196&view=rev Log: I cannot spell coalesce :) Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=42196&r1=42195&r2=42196&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Fri Sep 21 12:43:52 2007 @@ -129,7 +129,7 @@ significantly simplifying the SelectionDAG representation for these and making the code generator faster for vector code. -
  7. Evan remat rewrite (coallesced intervals + folding of remat'd loads) and +
  8. Evan remat rewrite (coalesced intervals + folding of remat'd loads) and live intervals improvements.
  9. Dan Gohman contributed support for better alignment and volatility handling @@ -144,8 +144,8 @@ that uses very large basic blocks. It is slightly slower than the "local" allocator, but produces much better code.
  10. -
  11. David Greene refactored the register allocator to split coallescing out from -allocation, making coallescers pluggable.
  12. +
  13. David Greene refactored the register allocator to split coalescing out from +allocation, making coalescers pluggable.
  14. From clattner at apple.com Fri Sep 21 12:44:29 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 21 Sep 2007 10:44:29 -0700 Subject: [llvm-commits] [llvm] r42186 - /llvm/trunk/docs/ReleaseNotes.html In-Reply-To: <46F3EEE5.6050401@mac.com> References: <46F3EEE5.6050401@mac.com> Message-ID: <91144B1F-76CC-4805-83EC-B4AB24FF51AF@apple.com> On Sep 21, 2007, at 9:18 AM, Gabor Greif wrote: > My feedback: > > handling of 32-bit float values -??-> handling of 80-bit float values This is right. > typos: 3x coalles --> coales Doh, fixed. > Many of the sentences do not seem to be finished, > such as "Owen DSE and MemDep analysis". > > sloppyness: remat -> rematerialization This is not even nearly close to being final. I'm hoping that others will jump in and expand on their contributions. If you'd like to help word things, please just go for it :) -Chris From clattner at apple.com Fri Sep 21 12:46:10 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 21 Sep 2007 10:46:10 -0700 Subject: [llvm-commits] [llvm] r42190 - /llvm/trunk/include/llvm/IntrinsicsX86.td In-Reply-To: <200709211524.l8LFO0J8027154@zion.cs.uiuc.edu> References: <200709211524.l8LFO0J8027154@zion.cs.uiuc.edu> Message-ID: > URL: http://llvm.org/viewvc/llvm-project?rev=42190&view=rev > Log: > There is no {rsqrt,rcp}{p,s}d. Huh, crazy. nice catch :) -Chris From sabre at nondot.org Fri Sep 21 12:48:28 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 21 Sep 2007 17:48:28 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42197 - in /llvm-gcc-4.0/trunk/gcc: c-common.c llvm-convert.cpp llvm-internal.h Message-ID: <200709211748.l8LHmSB9002044@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 21 12:48:28 2007 New Revision: 42197 URL: http://llvm.org/viewvc/llvm-project?rev=42197&view=rev Log: Add support for a new gcroot attribute. Patch contributed by Eric Christopher. See test/CFrontend/2007-09-20-GcrootAttribute.c for an example of use. Modified: llvm-gcc-4.0/trunk/gcc/c-common.c llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp llvm-gcc-4.0/trunk/gcc/llvm-internal.h Modified: llvm-gcc-4.0/trunk/gcc/c-common.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/c-common.c?rev=42197&r1=42196&r2=42197&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/c-common.c (original) +++ llvm-gcc-4.0/trunk/gcc/c-common.c Fri Sep 21 12:48:28 2007 @@ -663,6 +663,7 @@ /* APPLE LOCAL begin LLVM */ #ifdef ENABLE_LLVM static tree handle_annotate_attribute (tree*, tree, tree, int, bool *); +static tree handle_gcroot_attribute (tree *, tree, tree, int, bool *); #endif /* APPLE LOCAL end LLVM */ @@ -757,6 +758,8 @@ #ifdef ENABLE_LLVM { "annotate", 0, -1, true, false, false, handle_annotate_attribute }, + { "gcroot", 0, 0, false, true, false, + handle_gcroot_attribute }, #endif /* APPLE LOCAL end LLVM */ { NULL, 0, 0, false, false, false, NULL } @@ -5812,6 +5815,21 @@ return NULL_TREE; } + +/* Handle the "gcroot" attribute */ +static tree +handle_gcroot_attribute (tree *node, tree name, tree ARG_UNUSED(args), + int ARG_UNUSED(flags), bool *ARG_UNUSED(no_add_attrs)) +{ + if (!TYPE_P (*node) + || !POINTER_TYPE_P (*node)) + { + warning ("%qs attribute ignored", IDENTIFIER_POINTER (name)); + *no_add_attrs = true; + } + + return NULL_TREE; +} #endif /* APPLE LOCAL end LLVM */ 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=42197&r1=42196&r2=42197&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Fri Sep 21 12:48:28 2007 @@ -655,6 +655,11 @@ // Emit annotate intrinsic if arg has annotate attr if (DECL_ATTRIBUTES(Args)) EmitAnnotateIntrinsic(Tmp, Args); + + // Emit gcroot intrinsic if arg has attribute + if (POINTER_TYPE_P(TREE_TYPE(Args)) + && lookup_attribute ("gcroot", TYPE_ATTRIBUTES(TREE_TYPE(Args)))) + EmitTypeGcroot(Tmp, Args); Client.setName(Name); Client.setLocation(Tmp); @@ -1420,6 +1425,25 @@ BranchFixups.push_back(BranchFixup(BI, isExceptionEdge)); } +// Emits code to do something for a type attribute +void TreeToLLVM::EmitTypeGcroot(Value *V, tree decl) { + + Function *gcrootFun = Intrinsic::getDeclaration(TheModule, + Intrinsic::gcroot); + + // The idea is that it's a pointer to type "Value" + // which is opaque* but the routine expects i8** and i8*. + const PointerType *Ty = PointerType::get(Type::Int8Ty); + V = Builder.CreateBitCast(V, PointerType::get(Ty), "tmp"); + + Value *Ops[2] = { + V, + ConstantPointerNull::get(Ty) + }; + + Builder.CreateCall(gcrootFun, Ops, Ops+2); +} + // Emits annotate intrinsic if the decl has the annotate attribute set. void TreeToLLVM::EmitAnnotateIntrinsic(Value *V, tree decl) { @@ -1581,6 +1605,17 @@ // Handle annotate attributes if (DECL_ATTRIBUTES(decl)) EmitAnnotateIntrinsic(AI, decl); + + // Handle gcroot attribute + if (POINTER_TYPE_P(TREE_TYPE (decl)) + && lookup_attribute("gcroot", TYPE_ATTRIBUTES(TREE_TYPE (decl)))) + { + // We should null out local variables so that a stack crawl + // before initialization doesn't get garbage results to follow. + const Type *T = cast(AI->getType())->getElementType(); + EmitTypeGcroot(AI, decl); + Builder.CreateStore(Constant::getNullValue(T), AI); + } if (TheDebugInfo) { if (DECL_NAME(decl)) { 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=42197&r1=42196&r2=42197&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-internal.h Fri Sep 21 12:48:28 2007 @@ -472,7 +472,9 @@ /// EmitAnnotateIntrinsic - Emits call to annotate attr intrinsic void EmitAnnotateIntrinsic(Value *V, tree_node *decl); - + + /// EmitTypeGcroot - Emits call to make type a gcroot + void EmitTypeGcroot(Value *V, tree_node *decl); private: /// GatherTypeInfo - Walk through the expression gathering all the /// typeinfos that are used. From sabre at nondot.org Fri Sep 21 12:48:40 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 21 Sep 2007 17:48:40 -0000 Subject: [llvm-commits] [llvm] r42198 - /llvm/trunk/test/CFrontend/2007-09-20-GcrootAttribute.c Message-ID: <200709211748.l8LHmeNn002062@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 21 12:48:39 2007 New Revision: 42198 URL: http://llvm.org/viewvc/llvm-project?rev=42198&view=rev Log: gcroot testcase, patch by Eric Christopher. Added: llvm/trunk/test/CFrontend/2007-09-20-GcrootAttribute.c Added: llvm/trunk/test/CFrontend/2007-09-20-GcrootAttribute.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-09-20-GcrootAttribute.c?rev=42198&view=auto ============================================================================== --- llvm/trunk/test/CFrontend/2007-09-20-GcrootAttribute.c (added) +++ llvm/trunk/test/CFrontend/2007-09-20-GcrootAttribute.c Fri Sep 21 12:48:39 2007 @@ -0,0 +1,28 @@ +// RUN: %llvmgxx -S -emit-llvm %s -o - | grep llvm.gcroot +// RUN: %llvmgxx -S -emit-llvm %s -o - | grep llvm.gcroot | count 6 + +typedef struct foo_s +{ + int a; +} foo, __attribute__ ((gcroot)) *foo_p; + +foo my_foo; + +int alpha () +{ + foo my_foo2 = my_foo; + + return my_foo2.a; +} + +int bar (foo a) +{ + foo_p b; + return b->a; +} + +foo_p baz (foo_p a, foo_p b, foo_p *c) +{ + a = b = *c; + return a; +} From sabre at nondot.org Fri Sep 21 12:49:57 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 21 Sep 2007 17:49:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42199 - in /llvm-gcc-4.2/trunk/gcc: c-common.c llvm-convert.cpp llvm-internal.h Message-ID: <200709211749.l8LHnv9Q002151@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 21 12:49:57 2007 New Revision: 42199 URL: http://llvm.org/viewvc/llvm-project?rev=42199&view=rev Log: Add supprot for a new gcroot attribute, patch by Eric Christopher Modified: llvm-gcc-4.2/trunk/gcc/c-common.c llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-internal.h Modified: llvm-gcc-4.2/trunk/gcc/c-common.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-common.c?rev=42199&r1=42198&r2=42199&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-common.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-common.c Fri Sep 21 12:49:57 2007 @@ -630,6 +630,7 @@ /* LLVM LOCAL begin */ #ifdef ENABLE_LLVM static tree handle_annotate_attribute (tree*, tree, tree, int, bool *); +static tree handle_gcroot_attribute (tree *, tree, tree, int, bool *); #endif /* LLVM LOCAL end */ @@ -738,6 +739,8 @@ #ifdef ENABLE_LLVM { "annotate", 0, -1, true, false, false, handle_annotate_attribute }, + { "gcroot", 0, 0, false, true, false, + handle_gcroot_attribute }, #endif /* LLVM LOCAL end */ { NULL, 0, 0, false, false, false, NULL } @@ -6068,6 +6071,21 @@ return NULL_TREE; } + +/* Handle the "gcroot" attribute */ +static tree +handle_gcroot_attribute (tree *node, tree name, tree ARG_UNUSED(args), + int ARG_UNUSED(flags), bool *ARG_UNUSED(no_add_attrs)) +{ + if (!TYPE_P (*node) + || !POINTER_TYPE_P (*node)) + { + warning ("%qs attribute ignored", IDENTIFIER_POINTER (name)); + *no_add_attrs = true; + } + + return NULL_TREE; +} #endif /* LLVM LOCAL end */ 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=42199&r1=42198&r2=42199&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Sep 21 12:49:57 2007 @@ -683,6 +683,11 @@ // Emit annotate intrinsic if arg has annotate attr if (DECL_ATTRIBUTES(Args)) EmitAnnotateIntrinsic(Tmp, Args); + + // Emit gcroot intrinsic if arg has attribute + if (POINTER_TYPE_P(TREE_TYPE(Args)) + && lookup_attribute ("gcroot", TYPE_ATTRIBUTES(TREE_TYPE(Args)))) + EmitTypeGcroot(Tmp, Args); Client.setName(Name); Client.setLocation(Tmp); @@ -1366,6 +1371,25 @@ } +// Emits code to do something for a type attribute +void TreeToLLVM::EmitTypeGcroot(Value *V, tree decl) { + + Function *gcrootFun = Intrinsic::getDeclaration(TheModule, + Intrinsic::gcroot); + + // The idea is that it's a pointer to type "Value" + // which is opaque* but the routine expects i8** and i8*. + const PointerType *Ty = PointerType::get(Type::Int8Ty); + V = Builder.CreateBitCast(V, PointerType::get(Ty), "tmp"); + + Value *Ops[2] = { + V, + ConstantPointerNull::get(Ty) + }; + + Builder.CreateCall(gcrootFun, Ops, Ops+2); +} + // Emits annotate intrinsic if the decl has the annotate attribute set. void TreeToLLVM::EmitAnnotateIntrinsic(Value *V, tree decl) { @@ -1527,6 +1551,17 @@ // Handle annotate attributes if (DECL_ATTRIBUTES(decl)) EmitAnnotateIntrinsic(AI, decl); + + // Handle gcroot attribute + if (POINTER_TYPE_P(TREE_TYPE (decl)) + && lookup_attribute("gcroot", TYPE_ATTRIBUTES(TREE_TYPE (decl)))) + { + // We should null out local variables so that a stack crawl + // before initialization doesn't get garbage results to follow. + const Type *T = cast(AI->getType())->getElementType(); + EmitTypeGcroot(AI, decl); + Builder.CreateStore(Constant::getNullValue(T), AI); + } if (TheDebugInfo) { if (DECL_NAME(decl)) { 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=42199&r1=42198&r2=42199&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Fri Sep 21 12:49:57 2007 @@ -435,7 +435,9 @@ /// EmitAnnotateIntrinsic - Emits call to annotate attr intrinsic void EmitAnnotateIntrinsic(Value *V, tree_node *decl); - + + /// EmitTypeGcroot - Emits call to make type a gcroot + void EmitTypeGcroot(Value *V, tree_node *decl); private: // Emit* - These are delegates from Emit, and have the same parameter From tonic at nondot.org Fri Sep 21 12:50:28 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 21 Sep 2007 17:50:28 -0000 Subject: [llvm-commits] [llvm] r42200 - /llvm/branches/release_21/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200709211750.l8LHoSDJ002212@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 21 12:50:28 2007 New Revision: 42200 URL: http://llvm.org/viewvc/llvm-project?rev=42200&view=rev Log: Merge into release for PR1690. Modified: llvm/branches/release_21/lib/Transforms/Scalar/LoopUnswitch.cpp Modified: llvm/branches/release_21/lib/Transforms/Scalar/LoopUnswitch.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=42200&r1=42199&r2=42200&view=diff ============================================================================== --- llvm/branches/release_21/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/branches/release_21/lib/Transforms/Scalar/LoopUnswitch.cpp Fri Sep 21 12:50:28 2007 @@ -583,8 +583,8 @@ // insert the new conditional branch. EmitPreheaderBranchOnCondition(Cond, Val, NewExit, NewPH, OrigPH->getTerminator()); - OrigPH->getTerminator()->eraseFromParent(); LPM->deleteSimpleAnalysisValue(OrigPH->getTerminator(), L); + OrigPH->getTerminator()->eraseFromParent(); // We need to reprocess this loop, it could be unswitched again. redoLoop = true; @@ -759,8 +759,8 @@ // Emit the new branch that selects between the two versions of this loop. EmitPreheaderBranchOnCondition(LIC, Val, NewBlocks[0], LoopBlocks[0], OldBR); - OldBR->eraseFromParent(); LPM->deleteSimpleAnalysisValue(OldBR, L); + OldBR->eraseFromParent(); // Update dominator info if (DF && DT) { @@ -859,10 +859,10 @@ for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; ++UI) Worklist.push_back(cast(*UI)); - I->replaceAllUsesWith(V); - I->eraseFromParent(); LPM->deleteSimpleAnalysisValue(I, L); RemoveFromWorklist(I, Worklist); + I->replaceAllUsesWith(V); + I->eraseFromParent(); ++NumSimplify; } @@ -889,8 +889,8 @@ // Remove the branch from the latch to the header block, this makes // the header dead, which will make the latch dead (because the header // dominates the latch). - Pred->getTerminator()->eraseFromParent(); LPM->deleteSimpleAnalysisValue(Pred->getTerminator(), L); + Pred->getTerminator()->eraseFromParent(); new UnreachableInst(Pred); // The loop is now broken, remove it from LI. @@ -947,8 +947,8 @@ Succs.erase(std::unique(Succs.begin(), Succs.end()), Succs.end()); // Remove the basic block, including all of the instructions contained in it. - BB->eraseFromParent(); LPM->deleteSimpleAnalysisValue(BB, L); + BB->eraseFromParent(); // Remove successor blocks here that are not dead, so that we know we only // have dead blocks in this list. Nondead blocks have a way of becoming dead, // then getting removed before we revisit them, which is badness. @@ -1050,10 +1050,10 @@ Instruction* OldTerm = Old->getTerminator(); new BranchInst(Split, SI->getSuccessor(i), ConstantInt::getTrue(), OldTerm); - + + LPM->deleteSimpleAnalysisValue(Old->getTerminator(), L); Old->getTerminator()->eraseFromParent(); - PHINode *PN; for (BasicBlock::iterator II = SI->getSuccessor(i)->begin(); (PN = dyn_cast(II)); ++II) { @@ -1103,9 +1103,9 @@ for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) if (Instruction *Use = dyn_cast(I->getOperand(i))) Worklist.push_back(Use); - I->eraseFromParent(); LPM->deleteSimpleAnalysisValue(I, L); RemoveFromWorklist(I, Worklist); + I->eraseFromParent(); ++NumSimplify; continue; } @@ -1166,8 +1166,8 @@ // Move all of the successor contents from Succ to Pred. Pred->getInstList().splice(BI, Succ->getInstList(), Succ->begin(), Succ->end()); - BI->eraseFromParent(); LPM->deleteSimpleAnalysisValue(BI, L); + BI->eraseFromParent(); RemoveFromWorklist(BI, Worklist); // If Succ has any successors with PHI nodes, update them to have @@ -1176,8 +1176,8 @@ // Remove Succ from the loop tree. LI->removeBlock(Succ); - Succ->eraseFromParent(); LPM->deleteSimpleAnalysisValue(Succ, L); + Succ->eraseFromParent(); ++NumSimplify; } else if (ConstantInt *CB = dyn_cast(BI->getCondition())){ // Conditional branch. Turn it into an unconditional branch, then @@ -1189,8 +1189,8 @@ BasicBlock *LiveSucc = BI->getSuccessor(!CB->getZExtValue()); DeadSucc->removePredecessor(BI->getParent(), true); Worklist.push_back(new BranchInst(LiveSucc, BI)); - BI->eraseFromParent(); LPM->deleteSimpleAnalysisValue(BI, L); + BI->eraseFromParent(); RemoveFromWorklist(BI, Worklist); ++NumSimplify; From clattner at apple.com Fri Sep 21 12:50:24 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 21 Sep 2007 10:50:24 -0700 Subject: [llvm-commits] [patch] add gcroot attribute, test In-Reply-To: References: <0933E6F8-DCA7-42ED-8BA1-F909C11F82AB@apple.com> <9916D16C-29D2-4018-BF09-30620C24CB6D@apple.com> Message-ID: On Sep 21, 2007, at 1:49 AM, Eric Christopher wrote: >> >> GCC carefully packs these bitfields so that there are exactly 32 >> of them. With this addition, you'll push over and require an >> extra word for every tree. Would it be possible to record the >> gcroot flag in the attributes list somehow? This tradeoff seems >> worthwhile, because almost no structs will be marked as GCable. > > Sure. Here's the new patch. I removed any dependence on > RECORD_TYPE, but make sure we have a pointer at least to gcroot from. Applied, thanks Eric! http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- Mon-20070917/053744.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- Mon-20070917/053746.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- Mon-20070917/053745.html -Chris From tonic at nondot.org Fri Sep 21 12:52:24 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 21 Sep 2007 17:52:24 -0000 Subject: [llvm-commits] [llvm] r42201 - /llvm/branches/release_21/lib/CodeGen/SelectionDAG/TargetLowering.cpp Message-ID: <200709211752.l8LHqOVa002322@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 21 12:52:24 2007 New Revision: 42201 URL: http://llvm.org/viewvc/llvm-project?rev=42201&view=rev Log: Merge from mainline for PR1693. Modified: llvm/branches/release_21/lib/CodeGen/SelectionDAG/TargetLowering.cpp Modified: llvm/branches/release_21/lib/CodeGen/SelectionDAG/TargetLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_21/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=42201&r1=42200&r2=42201&view=diff ============================================================================== --- llvm/branches/release_21/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original) +++ llvm/branches/release_21/lib/CodeGen/SelectionDAG/TargetLowering.cpp Fri Sep 21 12:52:24 2007 @@ -157,6 +157,7 @@ StackPointerRegisterToSaveRestore = 0; ExceptionPointerRegister = 0; ExceptionSelectorRegister = 0; + SetCCResultContents = UndefinedSetCCResult; SchedPreferenceInfo = SchedulingForLatency; JumpBufSize = 0; JumpBufAlignment = 0; From dpatel at apple.com Fri Sep 21 13:02:24 2007 From: dpatel at apple.com (Devang Patel) Date: Fri, 21 Sep 2007 18:02:24 -0000 Subject: [llvm-commits] [llvm] r42202 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200709211802.l8LI2ONa002863@zion.cs.uiuc.edu> Author: dpatel Date: Fri Sep 21 13:02:24 2007 New Revision: 42202 URL: http://llvm.org/viewvc/llvm-project?rev=42202&view=rev Log: Add missing entry. Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=42202&r1=42201&r2=42202&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Fri Sep 21 13:02:24 2007 @@ -71,7 +71,7 @@

    LLVM 2.1 brings two new beta C front-ends. First, Duncan, Anton and Devang -start syncing up llvm-gcc with GCC 4.2, yielding "llvm-gcc 4.2" (creative, +has started syncing up llvm-gcc with GCC 4.2, yielding "llvm-gcc 4.2" (creative, huh?). llvm-gcc 4.2 has the promise to bring much better FORTRAN and Ada support to LLVM as well as features like atomic builtins, OpenMP, and many other things. Check it out!

    @@ -117,8 +117,6 @@
    -

    foo

    -
    • Dale finished up the Tail Merging optimization in the code generator, @@ -198,6 +196,8 @@
    • Duncan contributed support for trampolines (pointers to nested functions), currently only supported on x86 target.
    • +
    • Lauro Ramos Venancio contributed support to encode alignment info in +load and store instructions.
    From sabre at nondot.org Fri Sep 21 13:25:53 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 21 Sep 2007 18:25:53 -0000 Subject: [llvm-commits] [llvm] r42204 - /llvm/trunk/lib/CodeGen/DwarfWriter.cpp Message-ID: <200709211825.l8LIPrFT004150@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 21 13:25:53 2007 New Revision: 42204 URL: http://llvm.org/viewvc/llvm-project?rev=42204&view=rev Log: don't read Block after it is freed. This fixes PR1684 Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=42204&r1=42203&r2=42204&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Fri Sep 21 13:25:53 2007 @@ -1301,7 +1301,9 @@ ValuesSet.InsertNode(Value, Where); Values.push_back(Value); } else { + // Already exists, reuse the previous one. delete Block; + Block = cast(Value); } Die->AddValue(Attribute, Block->BestForm(), Value); From sabre at nondot.org Fri Sep 21 13:30:39 2007 From: sabre at nondot.org (Chris Lattner) Date: Fri, 21 Sep 2007 18:30:39 -0000 Subject: [llvm-commits] [llvm] r42205 - /llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp Message-ID: <200709211830.l8LIUdN4004389@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 21 13:30:39 2007 New Revision: 42205 URL: http://llvm.org/viewvc/llvm-project?rev=42205&view=rev Log: #ifdef out unsafe tracing code, which fixes PR1689 Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp?rev=42205&r1=42204&r2=42205&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/Interpreter/Execution.cpp Fri Sep 21 13:30:39 2007 @@ -1338,20 +1338,6 @@ StackFrame.VarArgs.assign(ArgVals.begin()+i, ArgVals.end()); } -static void PrintGenericValue(const GenericValue &Val, const Type* Ty) { - switch (Ty->getTypeID()) { - default: assert(0 && "Invalid GenericValue Type"); - case Type::VoidTyID: DOUT << "void"; break; - case Type::FloatTyID: DOUT << "float " << Val.FloatVal; break; - case Type::DoubleTyID: DOUT << "double " << Val.DoubleVal; break; - case Type::PointerTyID: DOUT << "void* " << intptr_t(Val.PointerVal); break; - case Type::IntegerTyID: - DOUT << "i" << Val.IntVal.getBitWidth() << " " - << Val.IntVal.toStringUnsigned(10) - << " (0x" << Val.IntVal.toStringUnsigned(16) << ")\n"; - break; - } -} void Interpreter::run() { while (!ECStack.empty()) { @@ -1364,12 +1350,28 @@ DOUT << "About to interpret: " << I; visit(I); // Dispatch to one of the visit* methods... +#if 0 + // This is not safe, as visiting the instruction could lower it and free I. #ifndef NDEBUG if (!isa(I) && !isa(I) && I.getType() != Type::VoidTy) { DOUT << " --> "; - PrintGenericValue(SF.Values[&I], I.getType()); + const GenericValue &Val = SF.Values[&I]; + switch (I.getType()->getTypeID()) { + default: assert(0 && "Invalid GenericValue Type"); + case Type::VoidTyID: DOUT << "void"; break; + case Type::FloatTyID: DOUT << "float " << Val.FloatVal; break; + case Type::DoubleTyID: DOUT << "double " << Val.DoubleVal; break; + case Type::PointerTyID: DOUT << "void* " << intptr_t(Val.PointerVal); + break; + case Type::IntegerTyID: + DOUT << "i" << Val.IntVal.getBitWidth() << " " + << Val.IntVal.toStringUnsigned(10) + << " (0x" << Val.IntVal.toStringUnsigned(16) << ")\n"; + break; + } } #endif +#endif } } From dalej at apple.com Fri Sep 21 15:33:42 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 21 Sep 2007 20:33:42 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42206 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200709212033.l8LKXgqW017860@zion.cs.uiuc.edu> Author: johannes Date: Fri Sep 21 15:33:42 2007 New Revision: 42206 URL: http://llvm.org/viewvc/llvm-project?rev=42206&view=rev Log: Make x87 long double work on big endian host cross 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=42206&r1=42205&r2=42206&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Sep 21 15:33:42 2007 @@ -5238,20 +5238,16 @@ 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]; + long RealArr[4]; + uint64_t UArr[2]; + REAL_VALUE_TO_TARGET_LONG_DOUBLE(TREE_REAL_CST(exp), RealArr); + + 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 From dalej at apple.com Fri Sep 21 15:35:14 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 21 Sep 2007 20:35:14 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42207 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Message-ID: <200709212035.l8LKZEei017951@zion.cs.uiuc.edu> Author: johannes Date: Fri Sep 21 15:35:14 2007 New Revision: 42207 URL: http://llvm.org/viewvc/llvm-project?rev=42207&view=rev Log: Make x87 long double work on big endian host cross build. 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=42207&r1=42206&r2=42207&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Fri Sep 21 15:35:14 2007 @@ -5646,25 +5646,16 @@ 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]; + long RealArr[4]; + uint64_t UArr[2]; + REAL_VALUE_TO_TARGET_LONG_DOUBLE(TREE_REAL_CST(exp), RealArr); + + 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 From resistor at mac.com Fri Sep 21 15:55:54 2007 From: resistor at mac.com (Owen Anderson) Date: Fri, 21 Sep 2007 20:55:54 -0000 Subject: [llvm-commits] [llvm] r42208 - /llvm/trunk/include/llvm/ADT/DenseMap.h Message-ID: <200709212055.l8LKtsQ5018658@zion.cs.uiuc.edu> Author: resistor Date: Fri Sep 21 15:55:54 2007 New Revision: 42208 URL: http://llvm.org/viewvc/llvm-project?rev=42208&view=rev Log: Fix CopyFrom for non-POD data types. 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=42208&r1=42207&r2=42208&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) +++ llvm/trunk/include/llvm/ADT/DenseMap.h Fri Sep 21 15:55:54 2007 @@ -210,7 +210,7 @@ new (Buckets[i].first) KeyT(other.Buckets[i].first); if (Buckets[i].first != getEmptyKey() && Buckets[i].first != getTombstoneKey()) - new (Buckets[i].second) ValueT(other.Buckets[i].second); + new (&Buckets[i].second) ValueT(other.Buckets[i].second); } NumBuckets = other.NumBuckets; } From dpatel at apple.com Fri Sep 21 16:18:20 2007 From: dpatel at apple.com (Devang Patel) Date: Fri, 21 Sep 2007 21:18:20 -0000 Subject: [llvm-commits] [llvm] r42209 - in /llvm/trunk: lib/Transforms/Scalar/LoopIndexSplit.cpp test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll Message-ID: <200709212118.l8LLILgl032528@zion.cs.uiuc.edu> Author: dpatel Date: Fri Sep 21 16:18:19 2007 New Revision: 42209 URL: http://llvm.org/viewvc/llvm-project?rev=42209&view=rev Log: Fix PR1692 Added: llvm/trunk/test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.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=42209&r1=42208&r2=42209&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopIndexSplit.cpp Fri Sep 21 16:18:19 2007 @@ -1181,15 +1181,17 @@ // values in original loop's preheader. // A_ExitValue = min(SplitValue, OrignalLoopExitValue) // B_StartValue = max(SplitValue, OriginalLoopStartValue) + Instruction *InsertPt = L->getHeader()->getFirstNonPHI(); Value *C1 = new ICmpInst(Sign ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT, AEV, ExitCondition->getOperand(ExitValueNum), - "lsplit.ev", PHTerminator); + "lsplit.ev", InsertPt); + SD.A_ExitValue = new SelectInst(C1, AEV, ExitCondition->getOperand(ExitValueNum), - "lsplit.ev", PHTerminator); - + "lsplit.ev", InsertPt); + Value *C2 = new ICmpInst(Sign ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT, BSV, StartValue, "lsplit.sv", Added: llvm/trunk/test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll?rev=42209&view=auto ============================================================================== --- llvm/trunk/test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll (added) +++ llvm/trunk/test/Transforms/LoopIndexSplit/2007-09-21-LoopBound.ll Fri Sep 21 16:18:19 2007 @@ -0,0 +1,63 @@ +; PR1692 +; RUN: llvm-as < %s | opt -loop-index-split -disable-output + %struct.CLAUSE_HELP = type { i32, i32, i32, i32, i32*, i32, %struct.LIST_NODE*, %struct.LIST_NODE*, i32, i32, %struct.LITERAL_HELP**, i32, i32, i32, i32 } + %struct.LIST_NODE = type { %struct.LIST_NODE*, i8* } + %struct.LITERAL_HELP = type { i32, i32, i32, %struct.CLAUSE_HELP*, %struct.term* } + %struct.anon = type { %struct.LIST_NODE* } + %struct.st = type { %struct.subst*, %struct.LIST_NODE*, %struct.LIST_NODE*, i16, i16 } + %struct.subst = type { %struct.subst*, i32, %struct.term* } + %struct.term = type { i32, %struct.anon, %struct.LIST_NODE*, i32, i32 } + +define %struct.LIST_NODE* @inf_HyperResolvents(%struct.CLAUSE_HELP* %Clause, %struct.subst* %Subst, %struct.LIST_NODE* %Restlits, i32 %GlobalMaxVar, %struct.LIST_NODE* %FoundMap, i32 %StrictlyMaximal, { %struct.st*, [3001 x %struct.term*], [4000 x %struct.term*], i32 }* %Index, i32* %Flags, i32* %Precedence) { +entry: + br i1 false, label %cond_next44, label %bb37 + +bb37: ; preds = %entry + ret %struct.LIST_NODE* null + +cond_next44: ; preds = %entry + br i1 false, label %bb29.i, label %bb.i31 + +bb.i31: ; preds = %cond_next44 + ret %struct.LIST_NODE* null + +bb29.i: ; preds = %cond_next44 + br i1 false, label %cond_next89.i, label %bb34.i + +bb34.i: ; preds = %bb29.i + ret %struct.LIST_NODE* null + +cond_next89.i: ; preds = %bb29.i + br i1 false, label %clause_LiteralGetIndex.exit70.i, label %bb.i59.i + +bb.i59.i: ; preds = %cond_next89.i + ret %struct.LIST_NODE* null + +clause_LiteralGetIndex.exit70.i: ; preds = %cond_next89.i + br label %bb3.i.i + +bb3.i.i: ; preds = %bb3.i.i, %clause_LiteralGetIndex.exit70.i + br i1 false, label %bb40.i.i, label %bb3.i.i + +subst_Apply.exit.i.i: ; preds = %bb40.i.i + %tmp21.i.i = icmp sgt i32 %j.0.i.i, 0 ; [#uses=1] + br i1 %tmp21.i.i, label %cond_false.i47.i, label %cond_true24.i.i + +cond_true24.i.i: ; preds = %subst_Apply.exit.i.i + br label %cond_next37.i.i + +cond_false.i47.i: ; preds = %subst_Apply.exit.i.i + br label %cond_next37.i.i + +cond_next37.i.i: ; preds = %cond_false.i47.i, %cond_true24.i.i + %tmp39.i.i = add i32 %j.0.i.i, 1 ; [#uses=1] + br label %bb40.i.i + +bb40.i.i: ; preds = %cond_next37.i.i, %bb3.i.i + %j.0.i.i = phi i32 [ %tmp39.i.i, %cond_next37.i.i ], [ 0, %bb3.i.i ] ; [#uses=3] + %tmp43.i.i = icmp sgt i32 %j.0.i.i, 0 ; [#uses=1] + br i1 %tmp43.i.i, label %inf_CopyHyperElectron.exit.i, label %subst_Apply.exit.i.i + +inf_CopyHyperElectron.exit.i: ; preds = %bb40.i.i + ret %struct.LIST_NODE* null +} From dalej at apple.com Fri Sep 21 17:09:37 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 21 Sep 2007 22:09:37 -0000 Subject: [llvm-commits] [llvm] r42210 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/ExecutionEngine/ExecutionEngine.cpp lib/Support/APFloat.cpp lib/Support/APInt.cpp Message-ID: <200709212209.l8LM9bRf017742@zion.cs.uiuc.edu> Author: johannes Date: Fri Sep 21 17:09:37 2007 New Revision: 42210 URL: http://llvm.org/viewvc/llvm-project?rev=42210&view=rev Log: Change APFloat::convertFromInteger to take the incoming bit width instead of number of words allocated, which makes it actually work for int->APF conversions. Adjust callers. Add const to one of the APInt constructors to prevent surprising match when called with const argument. Modified: llvm/trunk/include/llvm/ADT/APInt.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp llvm/trunk/lib/Support/APFloat.cpp llvm/trunk/lib/Support/APInt.cpp Modified: llvm/trunk/include/llvm/ADT/APInt.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=42210&r1=42209&r2=42210&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APInt.h (original) +++ llvm/trunk/include/llvm/ADT/APInt.h Fri Sep 21 17:09:37 2007 @@ -172,7 +172,7 @@ /// @param numWords the number of words in bigVal /// @param bigVal a sequence of words to form the initial value of the APInt /// @brief Construct an APInt of numBits width, initialized as bigVal[]. - APInt(uint32_t numBits, uint32_t numWords, uint64_t bigVal[]); + APInt(uint32_t numBits, uint32_t numWords, const uint64_t bigVal[]); /// This constructor interprets Val as a string in the given radix. The /// interpretation stops when the first charater that is not suitable for the Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=42210&r1=42209&r2=42210&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Sep 21 17:09:37 2007 @@ -3215,7 +3215,8 @@ const uint64_t zero[] = {0, 0}; APFloat apf = APFloat(APInt(MVT::getSizeInBits(VT), 2, zero)); uint64_t x = 1ULL << ShiftAmt; - (void)apf.convertFromInteger(&x, 1, false, APFloat::rmTowardZero); + (void)apf.convertFromInteger(&x, MVT::getSizeInBits(NVT), false, + APFloat::rmTowardZero); Tmp2 = DAG.getConstantFP(apf, VT); Tmp3 = DAG.getSetCC(TLI.getSetCCResultTy(), Node->getOperand(0), Tmp2, ISD::SETLT); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=42210&r1=42209&r2=42210&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Sep 21 17:09:37 2007 @@ -1595,8 +1595,10 @@ case ISD::SINT_TO_FP: { const uint64_t zero[] = {0, 0}; APFloat apf = APFloat(APInt(MVT::getSizeInBits(VT), 2, zero)); - (void)apf.convertFromInteger(&Val, 1, Opcode==ISD::SINT_TO_FP, - APFloat::rmTowardZero); + (void)apf.convertFromInteger(&Val, + MVT::getSizeInBits(Operand.getValueType()), + Opcode==ISD::SINT_TO_FP, + APFloat::rmTowardZero); return getConstantFP(apf, VT); } case ISD::BIT_CONVERT: Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=42210&r1=42209&r2=42210&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Fri Sep 21 17:09:37 2007 @@ -393,10 +393,11 @@ GV.FloatVal = float(GV.IntVal.roundToDouble()); else if (CE->getType() == Type::DoubleTy) GV.DoubleVal = GV.IntVal.roundToDouble(); - else if (CE->getType() == Type::X86_FP80Ty) { + else if (CE->getType() == Type::X86_FP80Ty) { const uint64_t zero[] = {0, 0}; APFloat apf = APFloat(APInt(80, 2, zero)); - (void)apf.convertFromInteger(GV.IntVal.getRawData(), 2, false, + (void)apf.convertFromInteger(GV.IntVal.getRawData(), + GV.IntVal.getBitWidth(), false, APFloat::rmTowardZero); GV.IntVal = apf.convertToAPInt(); } @@ -411,7 +412,8 @@ else if (CE->getType() == Type::X86_FP80Ty) { const uint64_t zero[] = { 0, 0}; APFloat apf = APFloat(APInt(80, 2, zero)); - (void)apf.convertFromInteger(GV.IntVal.getRawData(), 2, true, + (void)apf.convertFromInteger(GV.IntVal.getRawData(), + GV.IntVal.getBitWidth(), true, APFloat::rmTowardZero); GV.IntVal = apf.convertToAPInt(); } Modified: llvm/trunk/lib/Support/APFloat.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=42210&r1=42209&r2=42210&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Fri Sep 21 17:09:37 2007 @@ -1180,7 +1180,8 @@ if (fs==opInvalidOp) return fs; - fs = V.convertFromInteger(x, parts, true, rmNearestTiesToEven); + fs = V.convertFromInteger(x, parts * integerPartWidth, true, + rmNearestTiesToEven); assert(fs==opOK); // should always work fs = V.multiply(rhs, rounding_mode); @@ -1459,28 +1460,30 @@ } APFloat::opStatus -APFloat::convertFromInteger(const integerPart *parts, - unsigned int partCount, bool isSigned, - roundingMode rounding_mode) +APFloat::convertFromInteger(const integerPart *parts, unsigned int width, + bool isSigned, roundingMode rounding_mode) { - unsigned int width; + unsigned int partCount = partCountForBits(width); opStatus status; - integerPart *copy; - - copy = new integerPart[partCount]; - APInt::tcAssign(copy, parts, partCount); - - width = partCount * integerPartWidth; + APInt api = APInt(width, partCount, parts); + integerPart *copy = new integerPart[partCount]; sign = false; - if(isSigned && APInt::tcExtractBit(parts, width - 1)) { - sign = true; - APInt::tcNegate(copy, partCount); + if(isSigned) { + if (APInt::tcExtractBit(parts, width - 1)) { + sign = true; + if (width < partCount * integerPartWidth) + api = api.sext(partCount * integerPartWidth); + } + else if (width < partCount * integerPartWidth) + api = api.zext(partCount * integerPartWidth); + } else { + if (width < partCount * integerPartWidth) + api = api.zext(partCount * integerPartWidth); } + APInt::tcAssign(copy, api.getRawData(), partCount); status = convertFromUnsignedInteger(copy, partCount, rounding_mode); - delete [] copy; - return status; } Modified: llvm/trunk/lib/Support/APInt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=42210&r1=42209&r2=42210&view=diff ============================================================================== --- llvm/trunk/lib/Support/APInt.cpp (original) +++ llvm/trunk/lib/Support/APInt.cpp Fri Sep 21 17:09:37 2007 @@ -58,7 +58,7 @@ clearUnusedBits(); } -APInt::APInt(uint32_t numBits, uint32_t numWords, uint64_t bigVal[]) +APInt::APInt(uint32_t numBits, uint32_t numWords, const uint64_t bigVal[]) : BitWidth(numBits), VAL(0) { assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small"); assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large"); From tonic at nondot.org Fri Sep 21 17:59:12 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 21 Sep 2007 22:59:12 -0000 Subject: [llvm-commits] [llvm] r42211 - in /llvm/trunk: docs/LangRef.html include/llvm/Intrinsics.td Message-ID: <200709212259.l8LMxCt0018558@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 21 17:59:12 2007 New Revision: 42211 URL: http://llvm.org/viewvc/llvm-project?rev=42211&view=rev Log: Adding support for __builtin_annotation with an intrinsic called llvm.annotation. This is similar to llvm.var.annotation but is applied to expressions. Modified: llvm/trunk/docs/LangRef.html llvm/trunk/include/llvm/Intrinsics.td Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=42211&r1=42210&r2=42211&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Fri Sep 21 17:59:12 2007 @@ -210,6 +210,10 @@
  15. llvm.var.annotation' Intrinsic
+
    +
  1. + llvm.annotation' Intrinsic
  2. +
@@ -5263,6 +5267,39 @@ generation and optimization. + + + +
+ +
Syntax:
+
+  declare i32 @llvm.annotation(i32 <val>, i8* <str>, i8* <str>, i32  <int> )
+
+ +
Overview:
+

This is an overloaded intrinsic. You can use 'llvm.annotation' on +any integer bit width. Not all targets support all bit widths however. +

+ +
Arguments:
+ +

+The first argument is an integer value (result of some expression), +the second is a pointer to a global string, the third is a pointer to a global +string which is the source file name, and the last argument is the line number. +

+ +
Semantics:
+ +

+This intrinsic allows annotations to be put on arbitrary expressions +with arbitrary strings. This can be useful for special purpose optimizations +that want to look for these annotations. These have no other defined use, they +are ignored by code generation and optimization. +


Modified: llvm/trunk/include/llvm/Intrinsics.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Intrinsics.td?rev=42211&r1=42210&r2=42211&view=diff ============================================================================== --- llvm/trunk/include/llvm/Intrinsics.td (original) +++ llvm/trunk/include/llvm/Intrinsics.td Fri Sep 21 17:59:12 2007 @@ -240,6 +240,10 @@ def int_var_annotation : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty, llvm_i32_ty], [], "llvm.var.annotation">; + +def int_annotation : Intrinsic<[llvm_anyint_ty, LLVMMatchType<0>, llvm_ptr_ty, + llvm_ptr_ty, llvm_i32_ty], + [], "llvm.annotation">; //===------------------------ Trampoline Intrinsics -----------------------===// // From tonic at nondot.org Fri Sep 21 18:01:00 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 21 Sep 2007 23:01:00 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42212 - in /llvm-gcc-4.0/trunk/gcc: builtin-types.def builtins.def llvm-convert.cpp Message-ID: <200709212301.l8LN100P018624@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 21 18:01:00 2007 New Revision: 42212 URL: http://llvm.org/viewvc/llvm-project?rev=42212&view=rev Log: Adding support for __builtin_annotation with an intrinsic called llvm.annotation. This is similar to llvm.var.annotation but is applied to expressions. Modified: llvm-gcc-4.0/trunk/gcc/builtin-types.def llvm-gcc-4.0/trunk/gcc/builtins.def llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.0/trunk/gcc/builtin-types.def URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/builtin-types.def?rev=42212&r1=42211&r2=42212&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/builtin-types.def (original) +++ llvm-gcc-4.0/trunk/gcc/builtin-types.def Fri Sep 21 18:01:00 2007 @@ -244,6 +244,10 @@ DEF_FUNCTION_TYPE_2 (BT_FN_VOID_PTR_PTR, BT_VOID, BT_PTR, BT_PTR) DEF_FUNCTION_TYPE_2 (BT_FN_INT_CONST_STRING_PTR_CONST_STRING, BT_INT, BT_CONST_STRING, BT_PTR_CONST_STRING) +/* APPLE LOCAL begin LLVM */ +DEF_FUNCTION_TYPE_2 (BT_FN_UINT_UINT_CONST_STRING, + BT_UINT, BT_UINT, BT_CONST_STRING) +/* APPLE LOCAL end LLVM */ /* APPLE LOCAL mainline */ DEF_FUNCTION_TYPE_2 (BT_FN_SIZE_CONST_PTR_INT, BT_SIZE, BT_CONST_PTR, BT_INT) 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=42212&r1=42211&r2=42212&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/builtins.def (original) +++ llvm-gcc-4.0/trunk/gcc/builtins.def Fri Sep 21 18:01:00 2007 @@ -633,6 +633,10 @@ DEF_EXT_LIB_BUILTIN (BUILT_IN__EXIT, "_exit", BT_FN_VOID_INT, ATTR_NORETURN_NOTHROW_LIST) DEF_C99_BUILTIN (BUILT_IN__EXIT2, "_Exit", BT_FN_VOID_INT, ATTR_NORETURN_NOTHROW_LIST) +/* APPLE LOCAL begin LLVM */ +DEF_GCC_BUILTIN (BUILT_IN_ANNOTATION, "_annotation", BT_FN_UINT_UINT_CONST_STRING, ATTR_NULL) +/* APPLE LOCAL end LLVM */ + /* Implementing nested functions. */ DEF_BUILTIN_STUB (BUILT_IN_INIT_TRAMPOLINE, "__builtin_init_trampoline") /* LLVM local deleted 1 line */ 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=42212&r1=42211&r2=42212&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Fri Sep 21 18:01:00 2007 @@ -4409,7 +4409,36 @@ return true; } - + // Convert annotation built-in to llvm.annotation intrinsic. + case BUILT_IN_ANNOTATION: { + + // Get file and line number + location_t locus = EXPR_LOCATION (exp); + Constant *lineNo = ConstantInt::get(Type::Int32Ty, locus.line); + Constant *file = ConvertMetadataStringToGV(locus.file); + const Type *SBP= PointerType::get(Type::Int8Ty); + file = ConstantExpr::getBitCast(file, SBP); + + // Get arguments. + tree arglist = TREE_OPERAND(exp, 1); + Value *ExprVal = Emit(TREE_VALUE(arglist), 0); + const Type *Ty = ExprVal->getType(); + Value *StrVal = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0); + + SmallVector Args; + Args.push_back(ExprVal); + Args.push_back(StrVal); + Args.push_back(file); + Args.push_back(lineNo); + + assert(Ty && "llvm.annotation arg type may not be null"); + Result = Builder.CreateCall(Intrinsic::getDeclaration(TheModule, + Intrinsic::annotation, + &Ty, + 1), + Args.begin(), Args.end()); + return true; + } #undef HANDLE_UNARY_FP #if 1 // FIXME: Should handle these GCC extensions eventually. From dpatel at apple.com Fri Sep 21 18:15:24 2007 From: dpatel at apple.com (Devang Patel) Date: Fri, 21 Sep 2007 23:15:24 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42213 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200709212315.l8LNFPPn019118@zion.cs.uiuc.edu> Author: dpatel Date: Fri Sep 21 18:15:24 2007 New Revision: 42213 URL: http://llvm.org/viewvc/llvm-project?rev=42213&view=rev Log: Now, DECL_SECTION_NAME is not appropriate for const_decl. This fixes PR1653 crash. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=42213&r1=42212&r2=42213&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Fri Sep 21 18:15:24 2007 @@ -855,7 +855,7 @@ } // Set the section for the global. - if (TREE_CODE(decl) == VAR_DECL || TREE_CODE(decl) == CONST_DECL) { + if (TREE_CODE(decl) == VAR_DECL) { if (DECL_SECTION_NAME(decl)) { GV->setSection(TREE_STRING_POINTER(DECL_SECTION_NAME(decl))); #ifdef LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION @@ -864,6 +864,15 @@ GV->setSection(Section); #endif } +#ifdef LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION + else if (TREE_CODE(decl) == CONST_DECL) { + if (const char *Section = + LLVM_IMPLICIT_TARGET_GLOBAL_VAR_SECTION(decl)) { + GV->setSection(Section); + } + } +#endif + // Set the alignment for the global if one of the following condition is met // 1) DECL_ALIGN_UNIT does not match alignment as per ABI specification From tonic at nondot.org Fri Sep 21 18:56:29 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 21 Sep 2007 23:56:29 -0000 Subject: [llvm-commits] [llvm] r42214 - /llvm/trunk/docs/LangRef.html Message-ID: <200709212356.l8LNuTXs024521@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 21 18:56:27 2007 New Revision: 42214 URL: http://llvm.org/viewvc/llvm-project?rev=42214&view=rev Log: Update annotation intrinsic with more details. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=42214&r1=42213&r2=42214&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Fri Sep 21 18:56:27 2007 @@ -208,7 +208,7 @@
  • General intrinsics
    1. - llvm.var.annotation' Intrinsic
    2. + llvm.var.annotation.*' Intrinsic
    1. @@ -5275,13 +5275,22 @@
      Syntax:
      +

      This is an overloaded intrinsic. You can use 'llvm.annotation' on +any integer bit width. +

         declare i32 @llvm.annotation(i32 <val>, i8* <str>, i8* <str>, i32  <int> )
      +  declare i8 llvm.annotation(i8 <val>, i8* <str>, i8* <str>, i32  <int> )
      +  declare i16 llvm.annotation(i16 <val>, i8* <str>, i8* <str>, i32  <int> )
      +  declare i32 @llvm.annotation(i32 <val>, i8* <str>, i8* <str>, i32  <int> )
      +  declare i64 @llvm.annotation(i64 <val>, i8* <str>, i8* <str>, i32  <int> )
      +  declare i256 @llvm.annotation(i256 <val>, i8* <str>, i8* <str>, i32  <int> )
       
      Overview:
      -

      This is an overloaded intrinsic. You can use 'llvm.annotation' on -any integer bit width. Not all targets support all bit widths however. + +

      +The 'llvm.annotation' intrinsic.

      Arguments:
      @@ -5290,6 +5299,7 @@ The first argument is an integer value (result of some expression), the second is a pointer to a global string, the third is a pointer to a global string which is the source file name, and the last argument is the line number. +It returns the value of the first argument.

      Semantics:
      From tonic at nondot.org Fri Sep 21 18:57:05 2007 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 21 Sep 2007 23:57:05 -0000 Subject: [llvm-commits] [llvm] r42215 - /llvm/trunk/docs/LangRef.html Message-ID: <200709212357.l8LNv5ef024675@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 21 18:57:04 2007 New Revision: 42215 URL: http://llvm.org/viewvc/llvm-project?rev=42215&view=rev Log: Fix silly typo. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=42215&r1=42214&r2=42215&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Fri Sep 21 18:57:04 2007 @@ -5279,9 +5279,8 @@ any integer bit width.

      -  declare i32 @llvm.annotation(i32 <val>, i8* <str>, i8* <str>, i32  <int> )
      -  declare i8 llvm.annotation(i8 <val>, i8* <str>, i8* <str>, i32  <int> )
      -  declare i16 llvm.annotation(i16 <val>, i8* <str>, i8* <str>, i32  <int> )
      +  declare i8 @llvm.annotation(i8 <val>, i8* <str>, i8* <str>, i32  <int> )
      +  declare i16 @llvm.annotation(i16 <val>, i8* <str>, i8* <str>, i32  <int> )
         declare i32 @llvm.annotation(i32 <val>, i8* <str>, i8* <str>, i32  <int> )
         declare i64 @llvm.annotation(i64 <val>, i8* <str>, i8* <str>, i32  <int> )
         declare i256 @llvm.annotation(i256 <val>, i8* <str>, i8* <str>, i32  <int> )
      
      
      
      
      From tonic at nondot.org  Fri Sep 21 18:57:59 2007
      From: tonic at nondot.org (Tanya Lattner)
      Date: Fri, 21 Sep 2007 23:57:59 -0000
      Subject: [llvm-commits] [llvm] r42216 - /llvm/trunk/docs/LangRef.html
      Message-ID: <200709212357.l8LNvxjZ025073@zion.cs.uiuc.edu>
      
      Author: tbrethou
      Date: Fri Sep 21 18:57:59 2007
      New Revision: 42216
      
      URL: http://llvm.org/viewvc/llvm-project?rev=42216&view=rev
      Log:
      One last fix to get name correct.
      
      Modified:
          llvm/trunk/docs/LangRef.html
      
      Modified: llvm/trunk/docs/LangRef.html
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=42216&r1=42215&r2=42216&view=diff
      
      ==============================================================================
      --- llvm/trunk/docs/LangRef.html (original)
      +++ llvm/trunk/docs/LangRef.html Fri Sep 21 18:57:59 2007
      @@ -5269,7 +5269,7 @@
       
       
       
       
       
      From tonic at nondot.org Fri Sep 21 19:01:27 2007 From: tonic at nondot.org (Tanya Lattner) Date: Sat, 22 Sep 2007 00:01:27 -0000 Subject: [llvm-commits] [llvm] r42217 - /llvm/trunk/docs/LangRef.html Message-ID: <200709220001.l8M01RpG026108@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 21 19:01:26 2007 New Revision: 42217 URL: http://llvm.org/viewvc/llvm-project?rev=42217&view=rev Log: Fix typo. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=42217&r1=42216&r2=42217&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Fri Sep 21 19:01:26 2007 @@ -208,11 +208,11 @@
    2. General intrinsics
      1. - llvm.var.annotation.*' Intrinsic
      2. + llvm.var.annotation' Intrinsic
      1. - llvm.annotation' Intrinsic
      2. + llvm.annotation.*' Intrinsic
    From tonic at nondot.org Fri Sep 21 19:03:01 2007 From: tonic at nondot.org (Tanya Lattner) Date: Sat, 22 Sep 2007 00:03:01 -0000 Subject: [llvm-commits] [llvm] r42219 - /llvm/trunk/docs/LangRef.html Message-ID: <200709220003.l8M031f3026594@zion.cs.uiuc.edu> Author: tbrethou Date: Fri Sep 21 19:03:01 2007 New Revision: 42219 URL: http://llvm.org/viewvc/llvm-project?rev=42219&view=rev Log: Correct names. Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=42219&r1=42218&r2=42219&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Fri Sep 21 19:03:01 2007 @@ -5279,11 +5279,11 @@ any integer bit width.

    -  declare i8 @llvm.annotation(i8 <val>, i8* <str>, i8* <str>, i32  <int> )
    -  declare i16 @llvm.annotation(i16 <val>, i8* <str>, i8* <str>, i32  <int> )
    -  declare i32 @llvm.annotation(i32 <val>, i8* <str>, i8* <str>, i32  <int> )
    -  declare i64 @llvm.annotation(i64 <val>, i8* <str>, i8* <str>, i32  <int> )
    -  declare i256 @llvm.annotation(i256 <val>, i8* <str>, i8* <str>, i32  <int> )
    +  declare i8 @llvm.annotation.i8(i8 <val>, i8* <str>, i8* <str>, i32  <int> )
    +  declare i16 @llvm.annotation.i16(i16 <val>, i8* <str>, i8* <str>, i32  <int> )
    +  declare i32 @llvm.annotation.i32(i32 <val>, i8* <str>, i8* <str>, i32  <int> )
    +  declare i64 @llvm.annotation.i64(i64 <val>, i8* <str>, i8* <str>, i32  <int> )
    +  declare i256 @llvm.annotation.i256(i256 <val>, i8* <str>, i8* <str>, i32  <int> )
     
    Overview:
    From isanbard at gmail.com Fri Sep 21 19:18:57 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 21 Sep 2007 17:18:57 -0700 Subject: [llvm-commits] [llvm] r42214 - /llvm/trunk/docs/LangRef.html In-Reply-To: <200709212356.l8LNuTXs024521@zion.cs.uiuc.edu> References: <200709212356.l8LNuTXs024521@zion.cs.uiuc.edu> Message-ID: <16e5fdf90709211718y6c9d03d1p9407436ffbf9a768@mail.gmail.com> On 9/21/07, Tanya Lattner wrote: > declare i32 @llvm.annotation(i32 <val>, i8* <str>, i8* <str>, i32 <int> ) > + declare i8 llvm.annotation(i8 <val>, i8* <str>, i8* <str>, i32 <int> ) > + declare i16 llvm.annotation(i16 <val>, i8* <str>, i8* <str>, i32 <int> ) Do these get '@' too? -bw From isanbard at gmail.com Fri Sep 21 19:20:55 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 21 Sep 2007 17:20:55 -0700 Subject: [llvm-commits] [llvm] r42215 - /llvm/trunk/docs/LangRef.html In-Reply-To: <200709212357.l8LNv5ef024675@zion.cs.uiuc.edu> References: <200709212357.l8LNv5ef024675@zion.cs.uiuc.edu> Message-ID: <16e5fdf90709211720m1a45065cnfaf3adaa6e5be74a@mail.gmail.com> doh! Sorry... -bw On 9/21/07, Tanya Lattner wrote: > Author: tbrethou > Date: Fri Sep 21 18:57:04 2007 > New Revision: 42215 > > URL: http://llvm.org/viewvc/llvm-project?rev=42215&view=rev > Log: > Fix silly typo. > From neil at daikokuya.co.uk Fri Sep 21 21:56:20 2007 From: neil at daikokuya.co.uk (Neil Booth) Date: Sat, 22 Sep 2007 02:56:20 -0000 Subject: [llvm-commits] [llvm] r42220 - /llvm/trunk/lib/Support/APFloat.cpp Message-ID: <200709220256.l8M2uKCG005285@zion.cs.uiuc.edu> Author: neil Date: Fri Sep 21 21:56:19 2007 New Revision: 42220 URL: http://llvm.org/viewvc/llvm-project?rev=42220&view=rev Log: Handle storage complications of float->float conversions. 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=42220&r1=42219&r2=42220&view=diff ============================================================================== --- llvm/trunk/lib/Support/APFloat.cpp (original) +++ llvm/trunk/lib/Support/APFloat.cpp Fri Sep 21 21:56:19 2007 @@ -1318,39 +1318,44 @@ APFloat::convert(const fltSemantics &toSemantics, roundingMode rounding_mode) { - unsigned int newPartCount; + lostFraction lostFraction; + unsigned int newPartCount, oldPartCount; opStatus fs; - + + lostFraction = lfExactlyZero; newPartCount = partCountForBits(toSemantics.precision + 1); + oldPartCount = partCount(); - /* If our new form is wider, re-allocate our bit pattern into wider - storage. - If we're narrowing from multiple words to 1 words, copy to the single - word. If we are losing information by doing this, we would have to - worry about rounding; right now the only case is f80 -> shorter - conversion, and we are keeping all 64 significant bits, so it's OK. */ - if(newPartCount > partCount()) { + /* Handle storage complications. If our new form is wider, + re-allocate our bit pattern into wider storage. If it is + narrower, we ignore the excess parts, but if narrowing to a + single part we need to free the old storage. */ + if (newPartCount > oldPartCount) { integerPart *newParts; newParts = new integerPart[newPartCount]; APInt::tcSet(newParts, 0, newPartCount); - APInt::tcAssign(newParts, significandParts(), partCount()); + APInt::tcAssign(newParts, significandParts(), oldPartCount); freeSignificand(); significand.parts = newParts; - } else if (newPartCount==1 && newPartCount < partCount()) { - integerPart newPart; - - APInt::tcSet(&newPart, 0, newPartCount); - APInt::tcAssign(&newPart, significandParts(), partCount()); - freeSignificand(); - significand.part = newPart; + } else if (newPartCount < oldPartCount) { + /* Capture any lost fraction through truncation of parts so we get + correct rounding whilst normalizing. */ + lostFraction = lostFractionThroughTruncation + (significandParts(), oldPartCount, toSemantics.precision); + if (newPartCount == 1) + { + integerPart newPart = significandParts()[0]; + freeSignificand(); + significand.part = newPart; + } } if(category == fcNormal) { /* Re-interpret our bit-pattern. */ exponent += toSemantics.precision - semantics->precision; semantics = &toSemantics; - fs = normalize(rounding_mode, lfExactlyZero); + fs = normalize(rounding_mode, lostFraction); } else { semantics = &toSemantics; fs = opOK; From sabre at nondot.org Fri Sep 21 22:17:54 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 22 Sep 2007 03:17:54 -0000 Subject: [llvm-commits] [llvm] r42221 - /llvm/trunk/docs/LangRef.html Message-ID: <200709220317.l8M3Huam005831@zion.cs.uiuc.edu> Author: lattner Date: Fri Sep 21 22:17:52 2007 New Revision: 42221 URL: http://llvm.org/viewvc/llvm-project?rev=42221&view=rev Log: fix bugs in the manual Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=42221&r1=42220&r2=42221&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Fri Sep 21 22:17:52 2007 @@ -3122,14 +3122,10 @@ towards zero) unsigned integer value. If the value cannot fit in ty2, the results are undefined.

    -

    When converting to i1, the conversion is done as a comparison against -zero. If the value was zero, the i1 result will be false. -If the value was non-zero, the i1 result will be true.

    -
    Example:
       %X = fptoui double 123.0 to i32      ; yields i32:123
    -  %Y = fptoui float 1.0E+300 to i1     ; yields i1:true
    +  %Y = fptoui float 1.0E+300 to i1     ; yields undefined:1
       %X = fptoui float 1.04E+17 to i8     ; yields undefined:1
     
    @@ -3162,14 +3158,10 @@ towards zero) signed integer value. If the value cannot fit in ty2, the results are undefined.

    -

    When converting to i1, the conversion is done as a comparison against -zero. If the value was zero, the i1 result will be false. -If the value was non-zero, the i1 result will be true.

    -
    Example:
       %X = fptosi double -123.0 to i32      ; yields i32:-123
    -  %Y = fptosi float 1.0E-247 to i1      ; yields i1:true
    +  %Y = fptosi float 1.0E-247 to i1      ; yields undefined:1
       %X = fptosi float 1.04E+17 to i8      ; yields undefined:1
     
    From clattner at apple.com Sat Sep 22 00:21:21 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 21 Sep 2007 22:21:21 -0700 Subject: [llvm-commits] [llvm] r42220 - /llvm/trunk/lib/Support/APFloat.cpp In-Reply-To: <200709220256.l8M2uKCG005285@zion.cs.uiuc.edu> References: <200709220256.l8M2uKCG005285@zion.cs.uiuc.edu> Message-ID: <5430B40D-ED37-4D82-AAC3-1AFCAF2DD67D@apple.com> On Sep 21, 2007, at 7:56 PM, Neil Booth wrote: > + } else if (newPartCount < oldPartCount) { > + /* Capture any lost fraction through truncation of parts so we > get > + correct rounding whilst normalizing. */ > + lostFraction = lostFractionThroughTruncation > + (significandParts(), oldPartCount, toSemantics.precision); > + if (newPartCount == 1) > + { > + integerPart newPart = significandParts()[0]; > + freeSignificand(); > + significand.part = newPart; > + } Hi Neil, Please watch out for tabs :) -Chris From baldrick at free.fr Sat Sep 22 01:47:51 2007 From: baldrick at free.fr (Duncan Sands) Date: Sat, 22 Sep 2007 08:47:51 +0200 Subject: [llvm-commits] [llvm-gcc-4.0] r42212 - in /llvm-gcc-4.0/trunk/gcc: builtin-types.def builtins.def llvm-convert.cpp In-Reply-To: <200709212301.l8LN100P018624@zion.cs.uiuc.edu> References: <200709212301.l8LN100P018624@zion.cs.uiuc.edu> Message-ID: <200709220847.52935.baldrick@free.fr> > Adding support for __builtin_annotation with an intrinsic called llvm.annotation. This is similar to llvm.var.annotation but is applied to expressions. Please also apply to llvm-gcc-4.2. Duncan. From sabre at nondot.org Sat Sep 22 02:02:13 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 22 Sep 2007 07:02:13 -0000 Subject: [llvm-commits] [llvm] r42222 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Message-ID: <200709220702.l8M72DPW010731@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 22 02:02:12 2007 New Revision: 42222 URL: http://llvm.org/viewvc/llvm-project?rev=42222&view=rev Log: initialize isstore/isload fields in ctor, fixing PR1695 Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp?rev=42222&r1=42221&r2=42222&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGSimple.cpp Sat Sep 22 02:02:12 2007 @@ -125,6 +125,8 @@ , StageEnd(NULL) , Latency(0) , IsCall(false) + , IsLoad(false) + , IsStore(false) , Slot(0) , Group(NULL) #ifndef NDEBUG From isanbard at gmail.com Sat Sep 22 02:50:35 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 00:50:35 -0700 Subject: [llvm-commits] [llvm] r42093 - in /llvm/trunk: ./ bindings/ bindings/ocaml/ bindings/ocaml/bitwriter/ bindings/ocaml/llvm/ test/Bindings/ test/Bindings/Ocaml/ test/lib/ In-Reply-To: <200709181249.l8ICngqE011236@zion.cs.uiuc.edu> References: <200709181249.l8ICngqE011236@zion.cs.uiuc.edu> Message-ID: <411A1F12-0745-4D79-B044-A7B346C10C7B@gmail.com> Hi Gordon, > ====================================================================== > ======== > --- llvm/trunk/bindings/ocaml/bitwriter/Makefile (added) > +++ llvm/trunk/bindings/ocaml/bitwriter/Makefile Tue Sep 18 > 07:49:39 2007 > @@ -0,0 +1,23 @@ > +##===- bindings/ocaml/llvm/Makefile ------------------------*- > Makefile -*-===## > +# > +# The LLVM Compiler Infrastructure > +# > +# This file was developed by the LLVM research group and is > distributed under > +# the University of Illinois Open Source License. See LICENSE.TXT > for details. > +# > +##===---------------------------------------------------------------- > ------===## > +# > +# This is the makefile for the llvm-ml interface. Reference > materials on > +# installing ocaml libraries: > +# > +# https://fedoraproject.org/wiki/Packaging/OCaml > +# http://pkg-ocaml-maint.alioth.debian.org/ > ocaml_packaging_policy.txt > +# > +##===---------------------------------------------------------------- > ------===## > + > +LEVEL := ../../.. > +LIBRARYNAME := llvm_bitwriter > +DONT_BUILD_RELINKED := 1 > +UsedComponents := bitwriter > + > +include ../Makefile.ocaml > This won't work if source dir != obj directory. It won't find the Makefile.ocaml unless it's also copied over... > ====================================================================== > ======== > --- llvm/trunk/bindings/ocaml/llvm/Makefile (added) > +++ llvm/trunk/bindings/ocaml/llvm/Makefile Tue Sep 18 07:49:39 2007 > @@ -0,0 +1,24 @@ > +##===- bindings/ocaml/bitwriter/Makefile -------------------*- > Makefile -*-===## > +# > +# The LLVM Compiler Infrastructure > +# > +# This file was developed by the LLVM research group and is > distributed under > +# the University of Illinois Open Source License. See LICENSE.TXT > for details. > +# > +##===---------------------------------------------------------------- > ------===## > +# > +# This is the makefile for the llvm-ml interface. Reference > materials on > +# installing ocaml libraries: > +# > +# https://fedoraproject.org/wiki/Packaging/OCaml > +# http://pkg-ocaml-maint.alioth.debian.org/ > ocaml_packaging_policy.txt > +# > +##===---------------------------------------------------------------- > ------===## > + > +LEVEL := ../../.. > +LIBRARYNAME := llvm > +DONT_BUILD_RELINKED := 1 > +UsedComponents := core > +UsedOcamLibs := llvm > + > +include ../Makefile.ocaml > > Added: llvm/trunk/bindings/ocaml/llvm/llvm.ml > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/ > llvm/llvm.ml?rev=42093&view=auto > > ====================================================================== > ======== > --- llvm/trunk/bindings/ocaml/llvm/llvm.ml (added) > +++ llvm/trunk/bindings/ocaml/llvm/llvm.ml Tue Sep 18 07:49:39 2007 > @@ -0,0 +1,228 @@ > +(*===-- tools/ml/llvm.ml - LLVM Ocaml Interface > ---------------------------===* > + * > + * The LLVM Compiler Infrastructure > + * > + * This file was developed by Gordon Henriksen and is distributed > under the > + * University of Illinois Open Source License. See LICENSE.TXT for > details. > + * > + > *===------------------------------------------------------------------ > ----=== > + * > + * This interface provides an ocaml API for the LLVM intermediate > + * representation, the classes in the VMCore library. > + * > + > *===------------------------------------------------------------------ > ----===*) > + > + > +(* These abstract types correlate directly to the LLVM VMCore > classes. *) > +type llmodule > +type lltype > +type llvalue > + > +type type_kind = > + Void_type > +| Float_type > +| Double_type > +| X86fp80_type > +| Fp128_type > +| Ppc_fp128_type > +| Label_type > +| Integer_type > +| Function_type > +| Struct_type > +| Array_type > +| Pointer_type > +| Opaque_type > +| Vector_type > + > +type linkage = > + External_linkage > +| Link_once_linkage > +| Weak_linkage > +| Appending_linkage > +| Internal_linkage > +| Dllimport_linkage > +| Dllexport_linkage > +| External_weak_linkage > +| Ghost_linkage > + > +type visibility = > + Default_visibility > +| Hidden_visibility > +| Protected_visibility > + > + > +(*===-- Modules > -----------------------------------------------------------===*) > + > +(* Creates a module with the supplied module ID. Modules are not > garbage > + collected; it is mandatory to call dispose_module to free > memory. *) > +external create_module : string -> llmodule = "llvm_create_module" > + > +(* Disposes a module. All references to subordinate objects are > invalidated; > + referencing them will invoke undefined behavior. *) > +external dispose_module : llmodule -> unit = "llvm_dispose_module" > + > +(* Adds a named type to the module's symbol table. Returns true if > successful. > + If such a name already exists, then no entry is added and > returns false. *) > +external add_type_name : string -> lltype -> llmodule -> bool > + = "llvm_add_type_name" > + > + > +(*===-- Types > -------------------------------------------------------------===*) > + > +external classify_type : lltype -> type_kind = "llvm_classify_type" > +external refine_abstract_type : lltype -> lltype -> unit > + = "llvm_refine_abstract_type" > + > +(*--... Operations on integer > types ........................................--*) > +external _i1_type : unit -> lltype = "llvm_i1_type" > +external _i8_type : unit -> lltype = "llvm_i8_type" > +external _i16_type : unit -> lltype = "llvm_i16_type" > +external _i32_type : unit -> lltype = "llvm_i32_type" > +external _i64_type : unit -> lltype = "llvm_i64_type" > + > +let i1_type = _i1_type () > +let i8_type = _i8_type () > +let i16_type = _i16_type () > +let i32_type = _i32_type () > +let i64_type = _i64_type () > + > +external make_integer_type : int -> lltype = "llvm_make_integer_type" > +external integer_bitwidth : lltype -> int = "llvm_integer_bitwidth" > + > +(*--... Operations on real > types ...........................................--*) > +external _float_type : unit -> lltype = "llvm_float_type" > +external _double_type : unit -> lltype = "llvm_double_type" > +external _x86fp80_type : unit -> lltype = "llvm_x86fp80_type" > +external _fp128_type : unit -> lltype = "llvm_fp128_type" > +external _ppc_fp128_type : unit -> lltype = "llvm_ppc_fp128_type" > + > +let float_type = _float_type () > +let double_type = _double_type () > +let x86fp80_type = _x86fp80_type () > +let fp128_type = _fp128_type () > +let ppc_fp128_type = _ppc_fp128_type () > + > +(*--... Operations on function > types .......................................--*) > +(* FIXME: handle parameter attributes *) > +external make_function_type : lltype -> lltype array -> bool -> > lltype > + = "llvm_make_function_type" > +external is_var_arg : lltype -> bool = "llvm_is_var_arg" > +external return_type : lltype -> lltype = "llvm_return_type" > +external param_types : lltype -> lltype array = "llvm_param_types" > + > +(*--... Operations on struct > types .........................................--*) > +external make_struct_type : lltype array -> bool -> lltype > + = "llvm_make_struct_type" > +external element_types : lltype -> lltype array = > "llvm_element_types" > +external is_packed : lltype -> bool = "llvm_is_packed" > + > +(*--... Operations on pointer, vector, and array > types .....................--*) > +external make_array_type : lltype -> int -> lltype = > "llvm_make_array_type" > +external make_pointer_type : lltype -> lltype = > "llvm_make_pointer_type" > +external make_vector_type : lltype -> int -> lltype = > "llvm_make_vector_type" > + > +external element_type : lltype -> lltype = "llvm_element_type" > +external array_length : lltype -> int = "llvm_array_length" > +external vector_size : lltype -> int = "llvm_vector_size" > + > +(*--... Operations on other > types ..........................................--*) > +external make_opaque_type : unit -> lltype = "llvm_make_opaque_type" > +external _void_type : unit -> lltype = "llvm_void_type" > +external _label_type : unit -> lltype = "llvm_label_type" > + > +let void_type = _void_type () > +let label_type = _label_type () > + > + > +(*===-- Values > ------------------------------------------------------------===*) > + > +external type_of : llvalue -> lltype = "llvm_type_of" > +external value_name : llvalue -> string = "llvm_value_name" > +external set_value_name : string -> llvalue -> unit = > "llvm_set_value_name" > + > +(*--... Operations on constants of (mostly) any > type .......................--*) > +external make_null : lltype -> llvalue = "llvm_make_null" > +external make_all_ones : lltype -> llvalue = "llvm_make_all_ones" > +external make_undef : lltype -> llvalue = "llvm_make_undef" > +external is_null : llvalue -> bool = "llvm_is_null" > + > +(*--... Operations on scalar > constants .....................................--*) > +external make_int_constant : lltype -> int -> bool -> llvalue > + = "llvm_make_int_constant" > +external make_real_constant : lltype -> float -> llvalue > + = "llvm_make_real_constant" > + > +(*--... Operations on composite > constants ..................................--*) > +external make_string_constant : string -> bool -> llvalue > + = "llvm_make_string_constant" > +external make_array_constant : lltype -> llvalue array -> llvalue > + = "llvm_make_array_constant" > +external make_struct_constant : llvalue array -> bool -> llvalue > + = "llvm_make_struct_constant" > +external make_vector_constant : llvalue array -> llvalue > + = "llvm_make_vector_constant" > + > +(*--... Operations on global variables, functions, and aliases > (globals) ...--*) > +external is_declaration : llvalue -> bool = "llvm_is_declaration" > +external linkage : llvalue -> linkage = "llvm_linkage" > +external set_linkage : linkage -> llvalue -> unit = > "llvm_set_linkage" > +external section : llvalue -> string = "llvm_section" > +external set_section : string -> llvalue -> unit = "llvm_set_section" > +external visibility : llvalue -> visibility = "llvm_visibility" > +external set_visibility : visibility -> llvalue -> unit = > "llvm_set_visibility" > +external alignment : llvalue -> int = "llvm_alignment" > +external set_alignment : int -> llvalue -> unit = > "llvm_set_alignment" > + > +(*--... Operations on global > variables .....................................--*) > +external declare_global : lltype -> string -> llmodule -> llvalue > + = "llvm_declare_global" > +external define_global : string -> llvalue -> llmodule -> llvalue > + = "llvm_define_global" > +external delete_global : llvalue -> unit = "llvm_delete_global" > +external global_initializer : llvalue -> llvalue = > "llvm_global_initializer" > +external set_initializer : llvalue -> llvalue -> unit = > "llvm_set_initializer" > +external remove_initializer : llvalue -> unit = > "llvm_remove_initializer" > +external is_thread_local : llvalue -> bool = "llvm_is_thread_local" > +external set_thread_local : bool -> llvalue -> unit = > "llvm_set_thread_local" > + > + > +(*===-- Non-Externs > -------------------------------------------------------===*) > +(* These functions are built using the externals, so must be > declared late. *) > + > +let concat2 sep arr = > + let s = ref "" in > + if 0 < Array.length arr then begin > + s := !s ^ arr.(0); > + for i = 1 to (Array.length arr) - 1 do > + s := !s ^ sep ^ arr.(i) > + done > + end; > + !s > + > +let rec string_of_lltype ty = > + match classify_type ty with > + Integer_type -> "i" ^ string_of_int (integer_bitwidth ty) > + | Pointer_type -> (string_of_lltype (element_type ty)) ^ "*" > + | Struct_type -> > + let s = "{ " ^ (concat2 ", " ( > + Array.map string_of_lltype (element_types ty) > + )) ^ " }" in > + if is_packed ty > + then "<" ^ s ^ ">" > + else s > + | Array_type -> "[" ^ (string_of_int (array_length ty)) ^ > + " x " ^ (string_of_lltype (element_type ty)) ^ "]" > + | Vector_type -> "<" ^ (string_of_int (vector_size ty)) ^ > + " x " ^ (string_of_lltype (element_type ty)) ^ ">" > + | Opaque_type -> "opaque" > + | Function_type -> string_of_lltype (return_type ty) ^ > + " (" ^ (concat2 ", " ( > + Array.map string_of_lltype (param_types ty) > + )) ^ ")" > + | Label_type -> "label" > + | Ppc_fp128_type -> "ppc_fp128" > + | Fp128_type -> "fp128" > + | X86fp80_type -> "x86_fp80" > + | Double_type -> "double" > + | Float_type -> "float" > + | Void_type -> "void" > > Added: llvm/trunk/bindings/ocaml/llvm/llvm.mli > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/ > llvm/llvm.mli?rev=42093&view=auto > > ====================================================================== > ======== > --- llvm/trunk/bindings/ocaml/llvm/llvm.mli (added) > +++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Tue Sep 18 07:49:39 2007 > @@ -0,0 +1,170 @@ > +(*===-- tools/ml/llvm.ml - LLVM Ocaml Interface > ---------------------------===* > + * > + * The LLVM Compiler Infrastructure > + * > + * This file was developed by Gordon Henriksen and is distributed > under the > + * University of Illinois Open Source License. See LICENSE.TXT for > details. > + * > + > *===------------------------------------------------------------------ > ----=== > + * > + * This interface provides an ocaml API for the LLVM intermediate > + * representation, the classes in the VMCore library. > + * > + > *===------------------------------------------------------------------ > ----===*) > + > + > +(* These abstract types correlate directly to the LLVM VMCore > classes. *) > +type llmodule > +type lltype > +type llvalue > + > +type type_kind = > + Void_type > +| Float_type > +| Double_type > +| X86fp80_type > +| Fp128_type > +| Ppc_fp128_type > +| Label_type > +| Integer_type > +| Function_type > +| Struct_type > +| Array_type > +| Pointer_type > +| Opaque_type > +| Vector_type > + > +type linkage = > + External_linkage > +| Link_once_linkage > +| Weak_linkage > +| Appending_linkage > +| Internal_linkage > +| Dllimport_linkage > +| Dllexport_linkage > +| External_weak_linkage > +| Ghost_linkage > + > +type visibility = > + Default_visibility > +| Hidden_visibility > +| Protected_visibility > + > + > +(*===-- Modules > -----------------------------------------------------------===*) > + > +(* Creates a module with the supplied module ID. Modules are not > garbage > + collected; it is mandatory to call dispose_module to free > memory. *) > +external create_module : string -> llmodule = "llvm_create_module" > + > +(* Disposes a module. All references to subordinate objects are > invalidated; > + referencing them will invoke undefined behavior. *) > +external dispose_module : llmodule -> unit = "llvm_dispose_module" > + > +(* Adds a named type to the module's symbol table. Returns true if > successful. > + If such a name already exists, then no entry is added and > returns false. *) > +external add_type_name : string -> lltype -> llmodule -> bool > + = "llvm_add_type_name" > + > + > +(*===-- Types > -------------------------------------------------------------===*) > +external classify_type : lltype -> type_kind = "llvm_classify_type" > +external refine_abstract_type : lltype -> lltype -> unit > + = "llvm_refine_abstract_type" > +val string_of_lltype : lltype -> string > + > +(*--... Operations on integer > types ........................................--*) > +val i1_type : lltype > +val i8_type : lltype > +val i16_type : lltype > +val i32_type : lltype > +val i64_type : lltype > +external make_integer_type : int -> lltype = "llvm_make_integer_type" > +external integer_bitwidth : lltype -> int = "llvm_integer_bitwidth" > + > +(*--... Operations on real > types ...........................................--*) > +val float_type : lltype > +val double_type : lltype > +val x86fp80_type : lltype > +val fp128_type : lltype > +val ppc_fp128_type : lltype > + > +(*--... Operations on function > types .......................................--*) > +(* FIXME: handle parameter > attributes *) > +external make_function_type : lltype -> lltype array -> bool -> > lltype > + = "llvm_make_function_type" > +external is_var_arg : lltype -> bool = "llvm_is_var_arg" > +external return_type : lltype -> lltype = "llvm_return_type" > +external param_types : lltype -> lltype array = "llvm_param_types" > + > +(*--... Operations on struct > types .........................................--*) > +external make_struct_type : lltype array -> bool -> lltype > + = "llvm_make_struct_type" > +external element_types : lltype -> lltype array = > "llvm_element_types" > +external is_packed : lltype -> bool = "llvm_is_packed" > + > +(*--... Operations on pointer, vector, and array > types .....................--*) > +external make_array_type : lltype -> int -> lltype = > "llvm_make_array_type" > +external make_pointer_type : lltype -> lltype = > "llvm_make_pointer_type" > +external make_vector_type : lltype -> int -> lltype = > "llvm_make_vector_type" > + > +external element_type : lltype -> lltype = "llvm_element_type" > +external array_length : lltype -> int = "llvm_array_length" > +external vector_size : lltype -> int = "llvm_vector_size" > + > +(*--... Operations on other > types ..........................................--*) > +external make_opaque_type : unit -> lltype = "llvm_make_opaque_type" > +val void_type : lltype > +val label_type : lltype > + > + > +(*===-- Values > ------------------------------------------------------------===*) > +external type_of : llvalue -> lltype = "llvm_type_of" > +external value_name : llvalue -> string = "llvm_value_name" > +external set_value_name : string -> llvalue -> unit = > "llvm_set_value_name" > + > +(*--... Operations on constants of (mostly) any > type .......................--*) > +external make_null : lltype -> llvalue = "llvm_make_null" > +external make_all_ones : lltype -> llvalue = "llvm_make_all_ones" > +external make_undef : lltype -> llvalue = "llvm_make_undef" > +external is_null : llvalue -> bool = "llvm_is_null" > + > +(*--... Operations on scalar > constants .....................................--*) > +external make_int_constant : lltype -> int -> bool -> llvalue > + = "llvm_make_int_constant" > +external make_real_constant : lltype -> float -> llvalue > + = "llvm_make_real_constant" > + > +(*--... Operations on composite > constants ..................................--*) > +external make_string_constant : string -> bool -> llvalue > + = "llvm_make_string_constant" > +external make_array_constant : lltype -> llvalue array -> llvalue > + = "llvm_make_array_constant" > +external make_struct_constant : llvalue array -> bool -> llvalue > + = "llvm_make_struct_constant" > +external make_vector_constant : llvalue array -> llvalue > + = "llvm_make_vector_constant" > + > +(*--... Operations on global variables, functions, and aliases > (globals) ...--*) > +external is_declaration : llvalue -> bool = "llvm_is_declaration" > +external linkage : llvalue -> linkage = "llvm_linkage" > +external set_linkage : linkage -> llvalue -> unit = > "llvm_set_linkage" > +external section : llvalue -> string = "llvm_section" > +external set_section : string -> llvalue -> unit = "llvm_set_section" > +external visibility : llvalue -> visibility = "llvm_visibility" > +external set_visibility : visibility -> llvalue -> unit = > "llvm_set_visibility" > +external alignment : llvalue -> int = "llvm_alignment" > +external set_alignment : int -> llvalue -> unit = > "llvm_set_alignment" > + > +(*--... Operations on global > variables .....................................--*) > +external declare_global : lltype -> string -> llmodule -> llvalue > + = "llvm_declare_global" > +external define_global : string -> llvalue -> llmodule -> llvalue > + = "llvm_define_global" > +external delete_global : llvalue -> unit = "llvm_delete_global" > +external global_initializer : llvalue -> llvalue = > "llvm_global_initializer" > +external set_initializer : llvalue -> llvalue -> unit = > "llvm_set_initializer" > +external remove_initializer : llvalue -> unit = > "llvm_remove_initializer" > +external is_thread_local : llvalue -> bool = "llvm_is_thread_local" > +external set_thread_local : bool -> llvalue -> unit = > "llvm_set_thread_local" > + > > Added: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/ > llvm/llvm_ocaml.c?rev=42093&view=auto > > ====================================================================== > ======== > --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (added) > +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Tue Sep 18 07:49:39 > 2007 > @@ -0,0 +1,410 @@ > +/*===-- llvm_ocaml.h - LLVM Ocaml Glue -------------------------- > *- C++ -*-===*\ > +| > * > *| > +|* The LLVM Compiler > Infrastructure *| > +| > * > *| > +|* This file was developed by Gordon Henriksen and is distributed > under the *| > +|* University of Illinois Open Source License. See LICENSE.TXT for > details. *| > +| > * > *| > +| > *===------------------------------------------------------------------ > ----===*| > +| > * > *| > +|* This file glues LLVM's ocaml interface to its C interface. > These functions *| > +|* are by and large transparent wrappers to the corresponding C > functions. *| > +| > * > *| > +|* Note that these functions intentionally take liberties with the > CAMLparamX *| > +|* macros, since most of the parameters are not GC heap > objects. *| > +| > * > *| > + > \*===----------------------------------------------------------------- > -----===*/ > + > +#include "llvm-c/Core.h" > +#include "caml/alloc.h" > +#include "caml/mlvalues.h" > +#include "caml/memory.h" > +#include "stdio.h" > + > + > +/*===-- Modules > -----------------------------------------------------------===*/ > + > +/* string -> llmodule */ > +CAMLprim value llvm_create_module(value ModuleID) { > + return (value) LLVMModuleCreateWithName(String_val(ModuleID)); > +} > + > +/* llmodule -> unit */ > +CAMLprim value llvm_dispose_module(value M) { > + LLVMDisposeModule((LLVMModuleRef) M); > + return Val_unit; > +} > + > +/* string -> lltype -> llmodule -> bool */ > +CAMLprim value llvm_add_type_name(value Name, value Ty, value M) { > + int res = LLVMAddTypeName((LLVMModuleRef) M, > + String_val(Name), (LLVMTypeRef) Ty); > + return Val_bool(res == 0); > +} > + > + > +/*===-- Types > -------------------------------------------------------------===*/ > + > +/* lltype -> type_kind */ > +CAMLprim value llvm_classify_type(value Ty) { > + return Val_int(LLVMGetTypeKind((LLVMTypeRef) Ty)); > +} > + > +/* lltype -> lltype -> unit */ > +CAMLprim value llvm_refine_abstract_type(value ConcreteTy, value > AbstractTy) { > + LLVMRefineAbstractType((LLVMTypeRef) AbstractTy, (LLVMTypeRef) > ConcreteTy); > + return (value) Val_unit; > +} > + > +/*--... Operations on integer > types ........................................--*/ > + > +/* unit -> lltype */ > +CAMLprim value llvm_i1_type (value Unit) { return (value) > LLVMInt1Type(); } > +CAMLprim value llvm_i8_type (value Unit) { return (value) > LLVMInt8Type(); } > +CAMLprim value llvm_i16_type(value Unit) { return (value) > LLVMInt16Type(); } > +CAMLprim value llvm_i32_type(value Unit) { return (value) > LLVMInt32Type(); } > +CAMLprim value llvm_i64_type(value Unit) { return (value) > LLVMInt64Type(); } > + > +/* int -> lltype */ > +CAMLprim value llvm_make_integer_type(value Width) { > + return (value) LLVMCreateIntegerType(Int_val(Width)); > +} > + > +/* lltype -> int */ > +CAMLprim value llvm_integer_bitwidth(value IntegerTy) { > + return Val_int(LLVMGetIntegerTypeWidth((LLVMTypeRef) IntegerTy)); > +} > + > +/*--... Operations on real > types ...........................................--*/ > + > +/* unit -> lltype */ > +CAMLprim value llvm_float_type(value Unit) { > + return (value) LLVMFloatType(); > +} > + > +/* unit -> lltype */ > +CAMLprim value llvm_double_type(value Unit) { > + return (value) LLVMDoubleType(); > +} > + > +/* unit -> lltype */ > +CAMLprim value llvm_x86fp80_type(value Unit) { > + return (value) LLVMX86FP80Type(); > +} > + > +/* unit -> lltype */ > +CAMLprim value llvm_fp128_type(value Unit) { > + return (value) LLVMFP128Type(); > +} > + > +/* unit -> lltype */ > +CAMLprim value llvm_ppc_fp128_type(value Unit) { > + return (value) LLVMPPCFP128Type(); > +} > + > +/*--... Operations on function > types .......................................--*/ > + > +/* lltype -> lltype array -> bool -> lltype */ > +CAMLprim value llvm_make_function_type(value RetTy, value ParamTys, > + value IsVarArg) { > + return (value) LLVMCreateFunctionType((LLVMTypeRef) RetTy, > + (LLVMTypeRef *) ParamTys, > + Wosize_val(ParamTys), > + Bool_val(IsVarArg)); > +} > + > +/* lltype -> bool */ > +CAMLprim value llvm_is_var_arg(value FunTy) { > + return Val_bool(LLVMIsFunctionVarArg((LLVMTypeRef) FunTy)); > +} > + > +/* lltype -> lltype */ > +CAMLprim value llvm_return_type(value FunTy) { > + return (value) LLVMGetFunctionReturnType((LLVMTypeRef) FunTy); > +} > + > +/* lltype -> lltype array */ > +CAMLprim value llvm_param_types(value FunTy) { > + unsigned Count = LLVMGetFunctionParamCount((LLVMTypeRef) FunTy); > + LLVMTypeRef *FunTys = alloca(Count * sizeof(LLVMTypeRef)); > + > + /* copy into an ocaml array */ > + unsigned i; > + value ParamTys = caml_alloc(Count, 0); > + > + LLVMGetFunctionParamTypes((LLVMTypeRef) FunTy, FunTys); > + for (i = 0; i != Count; ++i) > + Store_field(ParamTys, i, (value) FunTys[i]); > + > + return ParamTys; > +} > + > +/*--... Operations on struct > types .........................................--*/ > + > +/* lltype array -> bool -> lltype */ > +CAMLprim value llvm_make_struct_type(value ElementTypes, value > Packed) { > + return (value) LLVMCreateStructType((LLVMTypeRef *) ElementTypes, > + Wosize_val(ElementTypes), > + Bool_val(Packed)); > +} > + > +/* lltype -> lltype array */ > +CAMLprim value llvm_element_types(value StructTy) { > + unsigned Count = LLVMGetStructElementCount((LLVMTypeRef) StructTy); > + LLVMTypeRef *Tys = alloca(Count * sizeof(LLVMTypeRef)); > + > + /* copy into an ocaml array */ > + unsigned i; > + value ElementTys = caml_alloc(Count, 0); > + > + LLVMGetStructElementTypes((LLVMTypeRef) StructTy, Tys); > + for (i = 0; i != Count; ++i) > + Store_field(ElementTys, i, (value) Tys[i]); > + > + return ElementTys; > +} > + > +CAMLprim value llvm_is_packed(value StructTy) { > + return Val_bool(LLVMIsPackedStruct((LLVMTypeRef) StructTy)); > +} > + > +/*--... Operations on array, pointer, and vector > types .....................--*/ > + > +/* lltype -> int -> lltype */ > +CAMLprim value llvm_make_array_type(value ElementTy, value Count) { > + return (value) LLVMCreateArrayType((LLVMTypeRef) ElementTy, > Int_val(Count)); > +} > + > +/* lltype -> lltype */ > +CAMLprim value llvm_make_pointer_type(value ElementTy) { > + return (value) LLVMCreatePointerType((LLVMTypeRef) ElementTy); > +} > + > +/* lltype -> int -> lltype */ > +CAMLprim value llvm_make_vector_type(value ElementTy, value Count) { > + return (value) LLVMCreateVectorType((LLVMTypeRef) ElementTy, > Int_val(Count)); > +} > + > +/* lltype -> lltype */ > +CAMLprim value llvm_element_type(value Ty) { > + return (value) LLVMGetElementType((LLVMTypeRef) Ty); > +} > + > +/* lltype -> int */ > +CAMLprim value llvm_array_length(value ArrayTy) { > + return Val_int(LLVMGetArrayLength((LLVMTypeRef) ArrayTy)); > +} > + > +/* lltype -> int */ > +CAMLprim value llvm_vector_size(value VectorTy) { > + return Val_int(LLVMGetVectorSize((LLVMTypeRef) VectorTy)); > +} > + > +/*--... Operations on other > types ..........................................--*/ > + > +/* unit -> lltype */ > +CAMLprim value llvm_void_type (value Unit) { return (value) > LLVMVoidType(); } > +CAMLprim value llvm_label_type(value Unit) { return (value) > LLVMLabelType(); } > + > +/* unit -> lltype */ > +CAMLprim value llvm_make_opaque_type(value Unit) { > + return (value) LLVMCreateOpaqueType(); > +} > + > + > +/*===-- VALUES > ------------------------------------------------------------===*/ > + > +/* llvalue -> lltype */ > +CAMLprim value llvm_type_of(value Val) { > + return (value) LLVMGetTypeOfValue((LLVMValueRef) Val); > +} > + > +/* llvalue -> string */ > +CAMLprim value llvm_value_name(value Val) { > + return caml_copy_string(LLVMGetValueName((LLVMValueRef) Val)); > +} > + > +/* string -> llvalue -> unit */ > +CAMLprim value llvm_set_value_name(value Name, value Val) { > + LLVMSetValueName((LLVMValueRef) Val, String_val(Name)); > + return Val_unit; > +} > + > +/*--... Operations on constants of (mostly) any > type .......................--*/ > + > +/* lltype -> llvalue */ > +CAMLprim value llvm_make_null(value Ty) { > + return (value) LLVMGetNull((LLVMTypeRef) Ty); > +} > + > +/* lltype -> llvalue */ > +CAMLprim value llvm_make_all_ones(value Ty) { > + return (value) LLVMGetAllOnes((LLVMTypeRef) Ty); > +} > + > +/* lltype -> llvalue */ > +CAMLprim value llvm_make_undef(value Ty) { > + return (value) LLVMGetUndef((LLVMTypeRef) Ty); > +} > + > +/* llvalue -> bool */ > +CAMLprim value llvm_is_null(value Val) { > + return Val_bool(LLVMIsNull((LLVMValueRef) Val)); > +} > + > +/*--... Operations on scalar > constants .....................................--*/ > + > +/* lltype -> int -> bool -> llvalue */ > +CAMLprim value llvm_make_int_constant(value IntTy, value N, value > SExt) { > + /* GCC warns if we use the ternary operator. */ > + unsigned long long N2; > + if (Bool_val(SExt)) > + N2 = (intnat) Int_val(N); > + else > + N2 = (uintnat) Int_val(N); > + > + return (value) LLVMGetIntConstant((LLVMTypeRef) IntTy, N2, > Bool_val(SExt)); > +} > + > +/* lltype -> float -> llvalue */ > +CAMLprim value llvm_make_real_constant(value RealTy, value N) { > + return (value) LLVMGetRealConstant((LLVMTypeRef) RealTy, > Double_val(N)); > +} > + > +/*--... Operations on composite > constants ..................................--*/ > + > +/* string -> bool -> llvalue */ > +CAMLprim value llvm_make_string_constant(value Str, value > NullTerminate) { > + return (value) LLVMGetStringConstant(String_val(Str), > + Wosize_val(Str), > + Bool_val(NullTerminate) == 0); > +} > + > +/* lltype -> llvalue array -> llvalue */ > +CAMLprim value llvm_make_array_constant(value ElementTy, value > ElementVals) { > + return (value) LLVMGetArrayConstant((LLVMTypeRef) ElementTy, > + (LLVMValueRef*) Op_val > (ElementVals), > + Wosize_val(ElementVals)); > +} > + > +/* llvalue array -> bool -> llvalue */ > +CAMLprim value llvm_make_struct_constant(value ElementVals, value > Packed) { > + return (value) LLVMGetStructConstant((LLVMValueRef*) Op_val > (ElementVals), > + Wosize_val(ElementVals), > + Bool_val(Packed)); > +} > + > +/* llvalue array -> llvalue */ > +CAMLprim value llvm_make_vector_constant(value ElementVals) { > + return (value) LLVMGetVectorConstant((LLVMValueRef*) Op_val > (ElementVals), > + Wosize_val(ElementVals)); > +} > + > +/*--... Operations on global variables, functions, and aliases > (globals) ...--*/ > + > +/* llvalue -> bool */ > +CAMLprim value llvm_is_declaration(value Global) { > + return Val_bool(LLVMIsDeclaration((LLVMValueRef) Global)); > +} > + > +/* llvalue -> linkage */ > +CAMLprim value llvm_linkage(value Global) { > + return Val_int(LLVMGetLinkage((LLVMValueRef) Global)); > +} > + > +/* linkage -> llvalue -> unit */ > +CAMLprim value llvm_set_linkage(value Linkage, value Global) { > + LLVMSetLinkage((LLVMValueRef) Global, Int_val(Linkage)); > + return Val_unit; > +} > + > +/* llvalue -> string */ > +CAMLprim value llvm_section(value Global) { > + return caml_copy_string(LLVMGetSection((LLVMValueRef) Global)); > +} > + > +/* string -> llvalue -> unit */ > +CAMLprim value llvm_set_section(value Section, value Global) { > + LLVMSetSection((LLVMValueRef) Global, String_val(Section)); > + return Val_unit; > +} > + > +/* llvalue -> visibility */ > +CAMLprim value llvm_visibility(value Global) { > + return Val_int(LLVMGetVisibility((LLVMValueRef) Global)); > +} > + > +/* visibility -> llvalue -> unit */ > +CAMLprim value llvm_set_visibility(value Viz, value Global) { > + LLVMSetVisibility((LLVMValueRef) Global, Int_val(Viz)); > + return Val_unit; > +} > + > +/* llvalue -> int */ > +CAMLprim value llvm_alignment(value Global) { > + return Val_int(LLVMGetAlignment((LLVMValueRef) Global)); > +} > + > +/* int -> llvalue -> unit */ > +CAMLprim value llvm_set_alignment(value Bytes, value Global) { > + LLVMSetAlignment((LLVMValueRef) Global, Int_val(Bytes)); > + return Val_unit; > +} > + > +/*--... Operations on global > variables .....................................--*/ > + > +/* lltype -> string -> llmodule -> llvalue */ > +CAMLprim value llvm_add_global(value Ty, value Name, value M) { > + return (value) LLVMAddGlobal((LLVMModuleRef) M, > + (LLVMTypeRef) Ty, String_val(Name)); > +} > + > +/* lltype -> string -> llmodule -> llvalue */ > +CAMLprim value llvm_declare_global(value Ty, value Name, value M) { > + return (value) LLVMAddGlobal((LLVMModuleRef) M, > + (LLVMTypeRef) Ty, String_val(Name)); > +} > + > +/* string -> llvalue -> llmodule -> llvalue */ > +CAMLprim value llvm_define_global(value Name, value ConstantVal, > value M) { > + LLVMValueRef Initializer = (LLVMValueRef) ConstantVal; > + LLVMValueRef GlobalVar = LLVMAddGlobal((LLVMModuleRef) M, > + LLVMGetTypeOfValue > (Initializer), > + String_val(Name)); > + LLVMSetInitializer(GlobalVar, Initializer); > + return (value) GlobalVar; > +} > + > +/* llvalue -> unit */ > +CAMLprim value llvm_delete_global(value GlobalVar) { > + LLVMDeleteGlobal((LLVMValueRef) GlobalVar); > + return Val_unit; > +} > + > +/* llvalue -> llvalue */ > +CAMLprim value llvm_global_initializer(value GlobalVar) { > + return (value) LLVMGetInitializer((LLVMValueRef) GlobalVar); > +} > + > +/* llvalue -> llvalue -> unit */ > +CAMLprim value llvm_set_initializer(value ConstantVal, value > GlobalVar) { > + LLVMSetInitializer((LLVMValueRef) GlobalVar, (LLVMValueRef) > ConstantVal); > + return Val_unit; > +} > + > +/* llvalue -> unit */ > +CAMLprim value llvm_remove_initializer(value GlobalVar) { > + LLVMSetInitializer((LLVMValueRef) GlobalVar, NULL); > + return Val_unit; > +} > + > +/* llvalue -> bool */ > +CAMLprim value llvm_is_thread_local(value GlobalVar) { > + return Val_bool(LLVMIsThreadLocal((LLVMValueRef) GlobalVar)); > +} > + > +/* bool -> llvalue -> unit */ > +CAMLprim value llvm_set_thread_local(value IsThreadLocal, value > GlobalVar) { > + LLVMSetThreadLocal((LLVMValueRef) GlobalVar, Bool_val > (IsThreadLocal)); > + return Val_unit; > +} > > Propchange: llvm/trunk/test/Bindings/Ocaml/ > > ---------------------------------------------------------------------- > -------- > --- svn:ignore (added) > +++ svn:ignore Tue Sep 18 07:49:39 2007 > @@ -0,0 +1,3 @@ > +Output > +*.cmi > +*.cmo > > Added: llvm/trunk/test/Bindings/Ocaml/bitwriter.ml > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/ > Ocaml/bitwriter.ml?rev=42093&view=auto > > ====================================================================== > ======== > --- llvm/trunk/test/Bindings/Ocaml/bitwriter.ml (added) > +++ llvm/trunk/test/Bindings/Ocaml/bitwriter.ml Tue Sep 18 07:49:39 > 2007 > @@ -0,0 +1,16 @@ > +(* RUN: %ocamlc llvm.cma llvm_bitwriter.cma %s -o %t > + * RUN: ./%t %t.bc > + * RUN: llvm-dis < %t.bc | grep caml_int_ty > + *) > + > +(* Note that this takes a moment to link, so it's best to keep the > number of > + individual tests low. *) > + > +let test x = if not x then exit 1 else () > + > +let _ = > + let m = Llvm.create_module "ocaml_test_module" in > + > + ignore (Llvm.add_type_name "caml_int_ty" Llvm.i32_type m); > + > + test (Llvm_bitwriter.write_bitcode_file m Sys.argv.(1)) > > Added: llvm/trunk/test/Bindings/Ocaml/ocaml.exp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/ > Ocaml/ocaml.exp?rev=42093&view=auto > > ====================================================================== > ======== > --- llvm/trunk/test/Bindings/Ocaml/ocaml.exp (added) > +++ llvm/trunk/test/Bindings/Ocaml/ocaml.exp Tue Sep 18 07:49:39 2007 > @@ -0,0 +1,3 @@ > +load_lib llvm.exp > + > +RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*. > {ll,llx,c,cpp,tr,ml}]] > > Added: llvm/trunk/test/Bindings/Ocaml/vmcore.ml > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/ > Ocaml/vmcore.ml?rev=42093&view=auto > > ====================================================================== > ======== > --- llvm/trunk/test/Bindings/Ocaml/vmcore.ml (added) > +++ llvm/trunk/test/Bindings/Ocaml/vmcore.ml Tue Sep 18 07:49:39 2007 > @@ -0,0 +1,233 @@ > +(* RUN: %ocamlc llvm.cma llvm_bitwriter.cma %s -o %t > + * RUN: ./%t %t.bc > + * RUN: llvm-dis < %t.bc > %t.ll > + *) > + > +(* Note: It takes several seconds for ocamlc to link an executable > with > + libLLVMCore.a, so it's better to write a big test than a > bunch of > + little ones. *) > + > +open Llvm > +open Llvm_bitwriter > + > + > +(* Tiny unit test framework *) > +let exit_status = ref 0 > +let case_num = ref 0 > + > +let all_done () = > + prerr_endline ""; > + exit !exit_status > + > +let group name = > + prerr_endline ""; > + case_num := 0; > + prerr_string (" " ^ name ^ "... ") > + > +let insist cond = > + incr case_num; > + prerr_char ' '; > + if not cond then begin > + exit_status := 10; > + prerr_char '!' > + end; > + prerr_int !case_num > + > +let suite name f = > + prerr_endline (name ^ ":"); > + f () > + > + > +(*===-- Fixture > -----------------------------------------------------------===*) > + > +let filename = Sys.argv.(1) > +let m = create_module filename > + > + > +(*===-- Types > -------------------------------------------------------------===*) > + > +let test_types () = > + (* RUN: grep {Ty01.*void} < %t.ll > + *) > + group "void"; > + insist (add_type_name "Ty01" void_type m); > + insist (Void_type == classify_type void_type); > + > + (* RUN: grep {Ty02.*i1} < %t.ll > + *) > + group "i1"; > + insist (add_type_name "Ty02" i1_type m); > + insist (Integer_type == classify_type i1_type); > + > + (* RUN: grep {Ty03.*i32} < %t.ll > + *) > + group "i32"; > + insist (add_type_name "Ty03" i32_type m); > + > + (* RUN: grep {Ty04.*i42} < %t.ll > + *) > + group "i42"; > + let ty = make_integer_type 42 in > + insist (add_type_name "Ty04" ty m); > + > + (* RUN: grep {Ty05.*float} < %t.ll > + *) > + group "float"; > + insist (add_type_name "Ty05" float_type m); > + insist (Float_type == classify_type float_type); > + > + (* RUN: grep {Ty06.*double} < %t.ll > + *) > + group "double"; > + insist (add_type_name "Ty06" double_type m); > + insist (Double_type == classify_type double_type); > + > + (* RUN: grep {Ty07.*i32.*i1, double} < %t.ll > + *) > + group "function"; > + let ty = make_function_type i32_type [| i1_type; double_type |] > false in > + insist (add_type_name "Ty07" ty m); > + insist (Function_type = classify_type ty); > + insist (not (is_var_arg ty)); > + insist (i32_type == return_type ty); > + insist (double_type == (param_types ty).(1)); > + > + (* RUN: grep {Ty08.*\.\.\.} < %t.ll > + *) > + group "vararg"; > + let ty = make_function_type void_type [| i32_type |] true in > + insist (add_type_name "Ty08" ty m); > + insist (is_var_arg ty); > + > + (* RUN: grep {Ty09.*\\\[7 x i8\\\]} < %t.ll > + *) > + group "array"; > + let ty = make_array_type i8_type 7 in > + insist (add_type_name "Ty09" ty m); > + insist (7 = array_length ty); > + insist (i8_type == element_type ty); > + insist (Array_type == classify_type ty); > + > + (* RUN: grep {Ty10.*float\*} < %t.ll > + *) > + group "pointer"; > + let ty = make_pointer_type float_type in > + insist (add_type_name "Ty10" ty m); > + insist (float_type == element_type ty); > + insist (Pointer_type == classify_type ty); > + > + (* RUN: grep {Ty11.*\<4 x i16\>} < %t.ll > + *) > + group "vector"; > + let ty = make_vector_type i16_type 4 in > + insist (add_type_name "Ty11" ty m); > + insist (i16_type == element_type ty); > + insist (4 = vector_size ty); > + > + (* RUN: grep {Ty12.*opaque} < %t.ll > + *) > + group "opaque"; > + let ty = make_opaque_type () in > + insist (add_type_name "Ty12" ty m); > + insist (ty == ty); > + insist (ty <> make_opaque_type ()) > + > + > +(*===-- Global Values > -----------------------------------------------------===*) > + > +let test_global_values () = > + let (++) x f = f x; x in > + let zero32 = make_null i32_type in > + > + (* RUN: grep {GVal01} < %t.ll > + *) > + group "naming"; > + let g = define_global "TEMPORARY" zero32 m in > + prerr_endline ""; > + prerr_endline (value_name g); > + insist ("TEMPORARY" = value_name g); > + set_value_name "GVal01" g; > + insist ("GVal01" = value_name g); > + > + (* RUN: grep {GVal02.*linkonce} < %t.ll > + *) > + group "linkage"; > + let g = define_global "GVal02" zero32 m ++ > + set_linkage Link_once_linkage in > + insist (Link_once_linkage = linkage g); > + > + (* RUN: grep {GVal03.*Hanalei} < %t.ll > + *) > + group "section"; > + let g = define_global "GVal03" zero32 m ++ > + set_section "Hanalei" in > + insist ("Hanalei" = section g); > + > + (* RUN: grep {GVal04.*hidden} < %t.ll > + *) > + group "visibility"; > + let g = define_global "GVal04" zero32 m ++ > + set_visibility Hidden_visibility in > + insist (Hidden_visibility = visibility g); > + > + (* RUN: grep {GVal05.*align 128} < %t.ll > + *) > + group "alignment"; > + let g = define_global "GVal05" zero32 m ++ > + set_alignment 128 in > + insist (128 = alignment g) > + > + > +(*===-- Global Variables > --------------------------------------------------===*) > + > +let test_global_variables () = > + let (++) x f = f x; x in > + let fourty_two32 = make_int_constant i32_type 42 false in > + > + (* RUN: grep {GVar01.*external} < %t.ll > + *) > + group "declarations"; > + let g = declare_global i32_type "GVar01" m in > + insist (is_declaration g); > + > + (* RUN: grep {GVar02.*42} < %t.ll > + * RUN: grep {GVar03.*42} < %t.ll > + *) > + group "definitions"; > + let g = define_global "GVar02" fourty_two32 m in > + let g2 = declare_global i32_type "GVar03" m ++ > + set_initializer fourty_two32 in > + insist (not (is_declaration g)); > + insist (not (is_declaration g2)); > + insist ((global_initializer g) == (global_initializer g2)); > + > + (* RUN: grep {GVar04.*thread_local} < %t.ll > + *) > + group "threadlocal"; > + let g = define_global "GVar04" fourty_two32 m ++ > + set_thread_local true in > + insist (is_thread_local g); > + > + (* RUN: grep -v {GVar05} < %t.ll > + *) > + let g = define_global "GVar05" fourty_two32 m in > + delete_global g > + > + > +(*===-- Writer > ------------------------------------------------------------===*) > + > +let test_writer () = > + group "writer"; > + insist (write_bitcode_file m filename); > + > + dispose_module m > + > + > +(*===-- Driver > ------------------------------------------------------------===*) > + > +let _ = > + suite "types" test_types; > + suite "global values" test_global_values; > + suite "global variables" test_global_variables; > + suite "writer" test_writer; > + all_done () > > Modified: llvm/trunk/test/lib/llvm.exp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/lib/ > llvm.exp?rev=42093&r1=42092&r2=42093&view=diff > > ====================================================================== > ======== > --- llvm/trunk/test/lib/llvm.exp (original) > +++ llvm/trunk/test/lib/llvm.exp Tue Sep 18 07:49:39 2007 > @@ -43,7 +43,7 @@ > # cases. > proc substitute { line test tmpFile } { > global srcroot objroot srcdir objdir subdir target_triplet > prcontext > - global llvmgcc llvmgxx llvmgcc_version llvmgccmajvers > + global llvmgcc llvmgxx llvmgcc_version llvmgccmajvers ocamlc > global gccpath gxxpath compile_c compile_cxx link shlibext > llvmlibsdir > set path [file join $srcdir $subdir] > > @@ -64,6 +64,8 @@ > regsub -all {%link} $new_line "$link" new_line > #replace %shlibext with shared library extension > regsub -all {%shlibext} $new_line "$shlibext" new_line > + #replace %ocamlc with ocaml compiler command > + regsub -all {%ocamlc} $new_line "$ocamlc" new_line > #replace %llvmlibsdir with configure library directory > regsub -all {%llvmlibsdir} $new_line "$llvmlibsdir" new_line > #replace %p with path to source, > > > _______________________________________________ > 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 22 04:16:45 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 09:16:45 -0000 Subject: [llvm-commits] [llvm] r42223 - /llvm/trunk/docs/TestingGuide.html Message-ID: <200709220916.l8M9GjkV022469@zion.cs.uiuc.edu> Author: void Date: Sat Sep 22 04:16:44 2007 New Revision: 42223 URL: http://llvm.org/viewvc/llvm-project?rev=42223&view=rev Log: Formatting changes. Modified: llvm/trunk/docs/TestingGuide.html Modified: llvm/trunk/docs/TestingGuide.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TestingGuide.html?rev=42223&r1=42222&r2=42223&view=diff ============================================================================== --- llvm/trunk/docs/TestingGuide.html (original) +++ llvm/trunk/docs/TestingGuide.html Sat Sep 22 04:16:44 2007 @@ -116,20 +116,30 @@ Alternatively, you can configure the test-suite module manually.

    To run all of the simple tests in LLVM using DejaGNU, use the master Makefile in the llvm/test directory:

    + +
     % gmake -C llvm/test
     
    -or
    +
    + +

    or

    + +
     % gmake check
     
    +

    To run only a subdirectory of tests in llvm/test using DejaGNU (ie. Regression/Transforms), just set the TESTSUITE variable to the path of the subdirectory (relative to llvm/test):

    + +
     % gmake -C llvm/test TESTSUITE=Regression/Transforms
     
    +

    Note: If you are running the tests with objdir != subdir, you must have run the complete testsuite before you can specify a @@ -138,6 +148,7 @@

    To run the comprehensive test suite (tests that compile and execute whole programs), run the llvm-test tests:

    +
     % cd llvm/projects
     % svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
    @@ -145,6 +156,7 @@
     % ./configure --with-llvmsrc=$LLVM_SRC_ROOT --with-llvmobj=$LLVM_OBJ_ROOT
     % gmake
     
    +
    @@ -324,11 +336,14 @@

    Below is an example of legal RUN lines in a .ll file:

    -
    -  ; RUN: llvm-as < %s | llvm-dis > %t1
    -  ; RUN: llvm-dis < %s.bc-13 > %t2
    -  ; RUN: diff %t1 %t2
    -  
    + +
    +
    +; RUN: llvm-as < %s | llvm-dis > %t1
    +; RUN: llvm-dis < %s.bc-13 > %t2
    +; RUN: diff %t1 %t2
    +
    +

    As with a Unix shell, the RUN: lines permit pipelines and I/O redirection to be used. However, the usage is slightly different than for Bash. To check @@ -351,43 +366,66 @@

    There are some quoting rules that you must pay attention to when writing your RUN lines. In general nothing needs to be quoted. Tcl won't strip off any ' or " so they will get passed to the invoked program. For example:

    -
    -     ... | grep 'find this string'
    -  
    + +
    +
    +... | grep 'find this string'
    +
    +
    +

    This will fail because the ' characters are passed to grep. This would instruction grep to look for 'find in the files this and string'. To avoid this use curly braces to tell Tcl that it should treat everything enclosed as one value. So our example would become:

    -
    -     ... | grep {find this string}
    -  
    + +
    +
    +... | grep {find this string}
    +
    +
    +

    Additionally, the characters [ and ] are treated specially by Tcl. They tell Tcl to interpret the content as a command to execute. Since these characters are often used in regular expressions this can have disastrous results and cause the entire test run in a directory to fail. For example, a common idiom is to look for some basicblock number:

    -
    -     ... | grep bb[2-8]
    -  
    + +
    +
    +... | grep bb[2-8]
    +
    +
    +

    This, however, will cause Tcl to fail because its going to try to execute a program named "2-8". Instead, what you want is this:

    -
    -     ... | grep {bb\[2-8\]}
    -  
    + +
    +
    +... | grep {bb\[2-8\]}
    +
    +
    +

    Finally, if you need to pass the \ character down to a program, then it must be doubled. This is another Tcl special character. So, suppose you had: -

    -     ... | grep 'i32\*'
    -  
    + +
    +
    +... | grep 'i32\*'
    +
    +
    +

    This will fail to match what you want (a pointer to i32). First, the ' do not get stripped off. Second, the \ gets stripped off by Tcl so what grep sees is: 'i32*'. That's not likely to match anything. To resolve this you must use \\ and the {}, like this:

    -
    -     ... | grep {i32\\*}
    -  
    + +
    +
    +... | grep {i32\\*}
    +
    +
    @@ -404,36 +442,47 @@

    Here are the available variable names. The alternate syntax is listed in parentheses.

    +
    $test (%s)
    The full path to the test case's source. This is suitable for passing on the command line as the input to an llvm tool.
    +
    $srcdir
    The source directory from where the "make check" was run.
    +
    objdir
    The object directory that corresponds to the $srcdir.
    +
    subdir
    A partial path from the test directory that contains the sub-directory that contains the test source being executed.
    +
    srcroot
    The root directory of the LLVM src tree.
    +
    objroot
    The root directory of the LLVM object tree. This could be the same as the srcroot.
    +
    path
    The path to the directory that contains the test case source. This is for locating any supporting files that are not generated by the test, but used by the test.
    +
    tmp
    The path to a temporary file name that could be used for this test case. The file name won't conflict with other test cases. You can append to it if you need multiple temporaries. This is useful as the destination of some redirected output.
    +
    llvmlibsdir (%llvmlibsdir)
    The directory where the LLVM libraries are located.
    +
    target_triplet (%target_triplet)
    The target triplet that corresponds to the current host machine (the one running the test cases). This should probably be called "host".
    +
    prcontext (%prcontext)
    Path to the prcontext tcl script that prints some context around a line that matches a pattern. This isn't strictly necessary as the test suite @@ -441,31 +490,41 @@ the prcontext script is located. Note that this script is similar to grep -C but you should use the prcontext script because not all platforms support grep -C.
    +
    llvmgcc (%llvmgcc)
    The full path to the llvm-gcc executable as specified in the configured LLVM environment
    +
    llvmgxx (%llvmgxx)
    The full path to the llvm-gxx executable as specified in the configured LLVM environment
    +
    llvmgcc_version (%llvmgcc_version)
    The full version number of the llvm-gcc executable.
    +
    llvmgccmajvers (%llvmgccmajvers)
    The major version number of the llvm-gcc executable.
    +
    gccpath
    The full path to the C compiler used to build LLVM. Note that this might not be gcc.
    +
    gxxpath
    The full path to the C++ compiler used to build LLVM. Note that this might not be g++.
    +
    compile_c (%compile_c)
    The full command line used to compile LLVM C source code. This has all the configured -I, -D and optimization options.
    +
    compile_cxx (%compile_cxx)
    The full command used to compile LLVM C++ source code. This has all the configured -I, -D and optimization options.
    +
    link (%link)
    This full link command used to link LLVM executables. This has all the configured -I, -L and -l options.
    +
    shlibext (%shlibext)
    The suffix for the host platforms share library (dll) files. This includes the period as the first character.
    @@ -491,6 +550,7 @@ non-zero result will cause the test to fail. This script overcomes that issue and nicely documents that the test case is purposefully ignoring the result code of the tool +
    not
    This script runs its arguments and then inverts the result code from it. Zero result codes become 1. Non-zero result codes become 0. This is @@ -511,9 +571,12 @@ succeed. To XFAIL everywhere just specify XFAIL: *. When matching the llvm-gcc version, you can specify the major (e.g. 3) or full version (i.e. 3.4) number. Here is an example of an XFAIL line:

    -
    -   ; XFAIL: darwin,sun,llvmgcc4
    -  
    + +
    +
    +; XFAIL: darwin,sun,llvmgcc4
    +
    +

    To make the output more useful, the llvm_runtest function wil scan the lines of the test case for ones that contain a pattern that matches @@ -573,12 +636,14 @@ uses the default value /home/vadve/shared/benchmarks/speccpu2000/benchspec.

    +

    --enable-spec95
    --enable-spec95=<directory>
    Enable the use of SPEC95 when testing LLVM. It is similar to the --enable-spec2000 option.

    +

    --enable-povray
    --enable-povray=<directory>
    @@ -598,12 +663,12 @@ are not executed inside of the LLVM source tree. This is because the test suite creates temporary files during execution.

    -

    The master Makefile in llvm/test is capable of running only the DejaGNU -driven tests. By default, it will run all of these tests.

    +

    The master Makefile in llvm/test is capable of running only the +DejaGNU driven tests. By default, it will run all of these tests.

    To run only the DejaGNU driven tests, run gmake at the command line in llvm/test. To run a specific directory of tests, use -the TESTSUITE variable. +the TESTSUITE variable.

    For example, to run the Regression tests, type @@ -613,40 +678,71 @@ llvm/test/Regression. You must use DejaGNU from the llvm/test directory to run them.

    -

    To run the llvm-test suite, you need to use the following steps: -

    +

    To run the llvm-test suite, you need to use the following steps:

    +
      -
    1. cd into the llvm/projects directory
    2. -
    3. check out the test-suite module with:
      - svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
      - This will get the test suite into llvm/projects/llvm-test
    4. -
    5. configure the test suite. You can do this one of two ways: +
    6. cd into the llvm/projects directory
    7. + +
    8. Check out the test-suite module with:

      + +
      +
      +% svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
      +
      +
      + +

      This will get the test suite into llvm/projects/llvm-test

      + +
    9. Configure the test suite. You can do this one of two ways:

      +
        -
      1. Use the regular llvm configure:
        - cd $LLVM_OBJ_ROOT ; $LLVM_SRC_ROOT/configure
        - This will ensure that the projects/llvm-test directory is also - properly configured.
      2. -
      3. Use the configure script found in the llvm-test source - directory:
        - $LLVM_SRC_ROOT/projects/llvm-test/configure - --with-llvmsrc=$LLVM_SRC_ROOT --with-llvmobj=$LLVM_OBJ_ROOT +
      4. Use the regular llvm configure:

        + +
        +
        +% cd $LLVM_OBJ_ROOT ; $LLVM_SRC_ROOT/configure
        +
        +
        + +

        This will ensure that the projects/llvm-test directory is + also properly configured.

      5. + +
      6. Use the configure script found in the llvm-test + source directory:

        + +
        +
        +% $LLVM_SRC_ROOT/projects/llvm-test/configure \
        +  --with-llvmsrc=$LLVM_SRC_ROOT               \
        +  --with-llvmobj=$LLVM_OBJ_ROOT
        +
        +
      -
    10. gmake
    11. +
    12. gmake

    Note that the second and third steps only need to be done once. After you have the suite checked out and configured, you don't need to do it again (unless the test code or configure script changes).

    To make a specialized test (use one of the -llvm-test/TEST.<type>.Makefiles), just run:
    -gmake TEST=<type> test
    For example, you could run the -nightly tester tests using the following commands:

    +llvm-test/TEST.<type>.Makefiles), just run:

    + +
    +
    +% gmake TEST=<type> test
    +
    +
    +

    For example, you could run the nightly tester tests using the following +commands:

    + +
    - % cd llvm/projects/llvm-test
    - % gmake TEST=nightly test
    +% cd llvm/projects/llvm-test
    +% gmake TEST=nightly test
     
    +

    Regardless of which test you're running, the results are printed on standard output and standard error. You can redirect these results to a file if you From isanbard at gmail.com Sat Sep 22 04:20:08 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 09:20:08 -0000 Subject: [llvm-commits] [llvm] r42224 - /llvm/trunk/docs/TestingGuide.html Message-ID: <200709220920.l8M9K8sM022609@zion.cs.uiuc.edu> Author: void Date: Sat Sep 22 04:20:07 2007 New Revision: 42224 URL: http://llvm.org/viewvc/llvm-project?rev=42224&view=rev Log: Validation fixes Modified: llvm/trunk/docs/TestingGuide.html Modified: llvm/trunk/docs/TestingGuide.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/TestingGuide.html?rev=42224&r1=42223&r2=42224&view=diff ============================================================================== --- llvm/trunk/docs/TestingGuide.html (original) +++ llvm/trunk/docs/TestingGuide.html Sat Sep 22 04:20:07 2007 @@ -232,7 +232,8 @@

    This directory contains a large array of small tests that exercise various features of LLVM and to ensure that regressions do not occur. The directory is broken into several sub-directories, each focused on - a particular area of LLVM. A few of the important ones are:

      + a particular area of LLVM. A few of the important ones are:

      +
      • Analysis: checks Analysis passes.
      • Archive: checks the Archive library.
      • Assembler: checks Assembly reader/writer functionality.
      • @@ -243,7 +244,7 @@
      • Transforms: tests each of the scalar, IPO, and utility transforms to ensure they make the right transformations.
      • Verifier: tests the IR verifier.
      • -

      +

    Typically when a bug is found in LLVM, a regression test containing just enough code to reproduce the problem should be written and placed somewhere underneath this directory. In most cases, this will be a small @@ -440,7 +441,7 @@ library, certain names can be accessed with an alternate syntax: a % prefix. These alternates are deprecated and may go away in a future version.

    - Here are the available variable names. The alternate syntax is listed in +

    Here are the available variable names. The alternate syntax is listed in parentheses.

    @@ -452,7 +453,7 @@
    The source directory from where the "make check" was run.
    objdir
    -
    The object directory that corresponds to the $srcdir.
    +
    The object directory that corresponds to the $srcdir.
    subdir
    A partial path from the test directory that contains the From isanbard at gmail.com Sat Sep 22 04:23:55 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 09:23:55 -0000 Subject: [llvm-commits] [llvm] r42225 - /llvm/trunk/docs/LangRef.html Message-ID: <200709220923.l8M9Ntbe022756@zion.cs.uiuc.edu> Author: void Date: Sat Sep 22 04:23:55 2007 New Revision: 42225 URL: http://llvm.org/viewvc/llvm-project?rev=42225&view=rev Log: Validation fixes Modified: llvm/trunk/docs/LangRef.html Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=42225&r1=42224&r2=42225&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Sat Sep 22 04:23:55 2007 @@ -5160,16 +5160,15 @@

    For example, if the function is 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: + pointer has signature i32 (i32, i32)*. It can be created as follows:

       %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 ). -

    +

    The call %val = call i32 %fp( i32 %x, i32 %y ) is then equivalent + to %val = call i32 %f( i8* %nval, i32 %x, i32 %y ).

    From isanbard at gmail.com Sat Sep 22 04:39:19 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 09:39:19 -0000 Subject: [llvm-commits] [llvm] r42226 - /llvm/trunk/docs/GettingStartedVS.html Message-ID: <200709220939.l8M9dJCe024134@zion.cs.uiuc.edu> Author: void Date: Sat Sep 22 04:39:19 2007 New Revision: 42226 URL: http://llvm.org/viewvc/llvm-project?rev=42226&view=rev Log: Validation fixes Modified: llvm/trunk/docs/GettingStartedVS.html Modified: llvm/trunk/docs/GettingStartedVS.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GettingStartedVS.html?rev=42226&r1=42225&r2=42226&view=diff ============================================================================== --- llvm/trunk/docs/GettingStartedVS.html (original) +++ llvm/trunk/docs/GettingStartedVS.html Sat Sep 22 04:39:19 2007 @@ -86,7 +86,7 @@
    1. Read the documentation.
    2. -
    3. Read the documentation.
    4. +
    5. Seriously, read the documentation.
    6. Remember that you were warned twice about reading the documentation.
    7. Get the Source Code @@ -203,17 +203,13 @@ All these paths are absolute:

      -
      SRC_ROOT -
      - This is the top level directory of the LLVM source tree. -

      - -

      OBJ_ROOT -
      - This is the top level directory of the LLVM object tree (i.e. the - tree where object files and compiled programs will be placed. It - is fixed at SRC_ROOT/win32). -

      +

      SRC_ROOT
      +

      This is the top level directory of the LLVM source tree.

      + +
      OBJ_ROOT
      +

      This is the top level directory of the LLVM object tree (i.e. the + tree where object files and compiled programs will be placed. It is + fixed at SRC_ROOT/win32).

      @@ -227,12 +223,12 @@

      The object files are placed under OBJ_ROOT/Debug for debug builds and OBJ_ROOT/Release for release (optimized) builds. These include - both executables and libararies that your application can link against. + both executables and libararies that your application can link against.

      The files that configure would create when building on Unix are created by the Configure project and placed in OBJ_ROOT/llvm. You application must have OBJ_ROOT in its include - search path just before SRC_ROOT/include. + search path just before SRC_ROOT/include.

      @@ -245,57 +241,83 @@
        -
      1. First, create a simple C file, name it 'hello.c': -
        -   #include <stdio.h>
        -   int main() {
        -     printf("hello world\n");
        -     return 0;
        -   }
        -       
      2. +
      3. First, create a simple C file, name it 'hello.c':

        + +
        +
        +#include <stdio.h>
        +int main() {
        +  printf("hello world\n");
        +  return 0;
        +}
        +
      4. Next, compile the C file into a LLVM bitcode file:

        -

        % llvm-gcc -c hello.c -emit-llvm -o hello.bc

        -

        This will create the result file hello.bc which is the LLVM - bitcode that corresponds the the compiled program and the library - facilities that it required. You can execute this file directly using - lli tool, compile it to native assembly with the llc, - optimize or analyze it further with the opt tool, etc.

        +
        +
        +% llvm-gcc -c hello.c -emit-llvm -o hello.bc
        +
        +
        + +

        This will create the result file hello.bc which is the LLVM + bitcode that corresponds the the compiled program and the library + facilities that it required. You can execute this file directly using + lli tool, compile it to native assembly with the llc, + optimize or analyze it further with the opt tool, etc.

        Note: while you cannot do this step on Windows, you can do it on a - Unix system and transfer hello.bc to Windows. Important: - transfer as a binary file!

      5. + Unix system and transfer hello.bc to Windows. Important: + transfer as a binary file!

      6. Run the program using the just-in-time compiler:

        -

        % lli hello.bc

      7. +
        +
        +% lli hello.bc
        +
        +

        Note: this will only work for trivial C programs. Non-trivial programs - (and any C++ program) will have dependencies on the GCC runtime that - won't be satisfied by the Microsoft runtime libraries.

        + (and any C++ program) will have dependencies on the GCC runtime that + won't be satisfied by the Microsoft runtime libraries.

      8. Use the llvm-dis utility to take a look at the LLVM assembly code:

        -

        % llvm-dis < hello.bc | more

      9. +
        +
        +% llvm-dis < hello.bc | more
        +
        +
      10. Compile the program to C using the LLC code generator:

        -

        % llc -march=c hello.bc

      11. +
        +
        +% llc -march=c hello.bc
        +
        +
      12. Compile to binary using Microsoft C:

        -

        % cl hello.cbe.c

      13. +
        +
        +% cl hello.cbe.c
        +
        +

        Note: this will only work for trivial C programs. Non-trivial programs (and any C++ program) will have dependencies on the GCC runtime that - won't be satisfied by the Microsoft runtime libraries.

        + won't be satisfied by the Microsoft runtime libraries.

      14. Execute the native code program:

        -

        % hello.cbe.exe

      15. - +
        +
        +% hello.cbe.exe
        +
        +
      @@ -332,7 +354,7 @@
    8. LLVM homepage
    9. LLVM doxygen tree
    10. Starting a Project - that Uses LLVM
    11. + that Uses LLVM From isanbard at gmail.com Sat Sep 22 04:54:47 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 09:54:47 -0000 Subject: [llvm-commits] [llvm] r42227 - /llvm/trunk/docs/FAQ.html Message-ID: <200709220954.l8M9slur025028@zion.cs.uiuc.edu> Author: void Date: Sat Sep 22 04:54:47 2007 New Revision: 42227 URL: http://llvm.org/viewvc/llvm-project?rev=42227&view=rev Log: Validation fixes Modified: llvm/trunk/docs/FAQ.html Modified: llvm/trunk/docs/FAQ.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/FAQ.html?rev=42227&r1=42226&r2=42227&view=diff ============================================================================== --- llvm/trunk/docs/FAQ.html (original) +++ llvm/trunk/docs/FAQ.html Sat Sep 22 04:54:47 2007 @@ -53,7 +53,7 @@
    12. After Subversion update, rebuilding gives the error "No rule to make target".
    13. The llvmc program gives me errors/doesn't - work.
    14. + work.
  • Source Languages @@ -182,14 +182,12 @@

    Some porting problems may exist in the following areas:

      -
    • The GCC front end code is not as portable as the LLVM suite, so it may not - compile as well on unsupported platforms.
    • + compile as well on unsupported platforms.
    • The LLVM build system relies heavily on UNIX shell tools, like the Bourne - Shell and sed. Porting to systems without these tools (MacOS 9, Plan 9) will - require more effort.
    • - + Shell and sed. Porting to systems without these tools (MacOS 9, Plan 9) + will require more effort.
    @@ -227,21 +225,23 @@ it:

      -
    1. Adjust your PATH environment variable so that the correct - program appears first in the PATH. This may work, but may not be - convenient when you want them first in your path for other - work.

    2. + program appears first in the PATH. This may work, but may not be + convenient when you want them first in your path for other + work.

    3. Run configure with an alternative PATH that is - correct. In a Borne compatible shell, the syntax would be:

      - -

      PATH=[the path without the bad program] ./configure ...

      + correct. In a Borne compatible shell, the syntax would be:

      + +
      +
      +% PATH=[the path without the bad program] ./configure ...
      +
      +

      This is still somewhat inconvenient, but it allows configure - to do its work without having to adjust your PATH - permanently.

    4. - + to do its work without having to adjust your PATH + permanently.

    @@ -257,8 +257,8 @@
    -

    I've updated my source tree from Subversion, and now my build is trying to - use a file/directory that doesn't exist.

    +

    I've updated my source tree from Subversion, and now my build is trying to +use a file/directory that doesn't exist.

    @@ -273,12 +273,13 @@
    -

    If the Makefile already exists in your object tree, you can just run the following command in the top level directory of your object tree:

    -

    ./config.status <relative path to Makefile>

    +

    +
    % ./config.status <relative path to Makefile>
    +

    If the Makefile is new, you will have to modify the configure script to copy it over.

    @@ -314,9 +315,7 @@

    For example, if you built LLVM with the command:

    -
    -% gmake ENABLE_PROFILING=1
    -
    +
    % gmake ENABLE_PROFILING=1

    ...then you must run the tests with the following commands:

    @@ -354,12 +353,12 @@

    This is a bug in GCC, and - affects projects other than LLVM. Try upgrading or downgrading your GCC.

    +affects projects other than LLVM. Try upgrading or downgrading your GCC.

    -

    After Subversion update, rebuilding gives the error - "No rule to make target".

    +

    After Subversion update, rebuilding gives the error "No rule to make +target".

    @@ -389,14 +388,13 @@ rebuilding.

    -
    - The llvmc program gives me errors/doesn't - work.

    +
    -

    llvmc is experimental and isn't really supported. We suggest - using llvm-gcc instead.

    +

    llvmc is experimental and isn't really supported. We suggest +using llvm-gcc instead.

    @@ -417,8 +415,8 @@

    The PyPy developers are working on integrating LLVM into the PyPy backend so that PyPy language can translate to LLVM.

    -
  • + Instruction.

    @@ -533,7 +530,7 @@

    Use commands like this:

      -
    1. Compile your program as normal with llvm-g++:

    2. +
    3. Compile your program as normal with llvm-g++:

      @@ -541,7 +538,7 @@
       
      -

      or:

      +

      or:

      @@ -551,47 +548,44 @@
       
      -

      With llvm-gcc3, this will generate program and program.bc. The .bc file is -the LLVM version of the program all linked together.

      +

      With llvm-gcc3, this will generate program and program.bc. The .bc + file is the LLVM version of the program all linked together.

    4. -
    5. Convert the LLVM code to C code, using the LLC tool with the C -backend:

    6. +
    7. Convert the LLVM code to C code, using the LLC tool with the C + backend:

       % llc -march=c program.bc -o program.c
       
      -
      +
    8. -
    9. Finally, compile the c file:

    10. +
    11. Finally, compile the C file:

       % cc x.c
       
      -
      +
    -

    Note that, by default, the C backend does not support exception handling. -If you want/need it for a certain program, you can enable it by passing -"-enable-correct-eh-support" to the llc program. The resultant code will -use setjmp/longjmp to implement exception support that is correct but -relatively slow. -

    - -

    Also note: this specific sequence of commands won't work if you use a -function defined in the C++ runtime library (or any other C++ library). To -access an external C++ library, you must manually -compile libstdc++ to LLVM bitcode, statically link it into your program, then -use the commands above to convert the whole result into C code. Alternatively, -you can compile the libraries and your application into two different chunks -of C code and link them.

    +

    Note that, by default, the C backend does not support exception handling. If +you want/need it for a certain program, you can enable it by passing +"-enable-correct-eh-support" to the llc program. The resultant code will use +setjmp/longjmp to implement exception support that is correct but relatively +slow.

    + +

    Also note: this specific sequence of commands won't work if you use a +function defined in the C++ runtime library (or any other C++ library). To +access an external C++ library, you must manually compile libstdc++ to LLVM +bitcode, statically link it into your program, then use the commands above to +convert the whole result into C code. Alternatively, you can compile the +libraries and your application into two different chunks of C code and link +them.

    - -
    Questions about code generated by the GCC front-end From isanbard at gmail.com Sat Sep 22 04:56:28 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 09:56:28 -0000 Subject: [llvm-commits] [llvm] r42228 - /llvm/trunk/docs/ReleaseNotes.html Message-ID: <200709220956.l8M9uSWc025096@zion.cs.uiuc.edu> Author: void Date: Sat Sep 22 04:56:28 2007 New Revision: 42228 URL: http://llvm.org/viewvc/llvm-project?rev=42228&view=rev Log: Validation fixes Modified: llvm/trunk/docs/ReleaseNotes.html Modified: llvm/trunk/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ReleaseNotes.html?rev=42228&r1=42227&r2=42228&view=diff ============================================================================== --- llvm/trunk/docs/ReleaseNotes.html (original) +++ llvm/trunk/docs/ReleaseNotes.html Sat Sep 22 04:56:28 2007 @@ -222,8 +222,6 @@
  • Reid contributed support for intrinsics that take arbitrary integer typed arguments, Dan Gohman and Chandler extended it to support FP and vectors.
  • - -
    @@ -242,9 +240,6 @@
  • David Green contributed a new --enable-expensive-checks configure option which enables STL checking, and fixed several bugs exposed by it.
  • - - - From isanbard at gmail.com Sat Sep 22 05:03:26 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 10:03:26 -0000 Subject: [llvm-commits] [llvm] r42229 - /llvm/trunk/docs/CodingStandards.html Message-ID: <200709221003.l8MA3Q0w025417@zion.cs.uiuc.edu> Author: void Date: Sat Sep 22 05:03:25 2007 New Revision: 42229 URL: http://llvm.org/viewvc/llvm-project?rev=42229&view=rev Log: Validation fixes Modified: llvm/trunk/docs/CodingStandards.html Modified: llvm/trunk/docs/CodingStandards.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodingStandards.html?rev=42229&r1=42228&r2=42229&view=diff ============================================================================== --- llvm/trunk/docs/CodingStandards.html (original) +++ llvm/trunk/docs/CodingStandards.html Sat Sep 22 05:03:25 2007 @@ -512,7 +512,8 @@ more pressure on the VM system on low-memory machines. - +
    +
    @@ -553,19 +554,21 @@ - - +stream is cnull.
    Old Way
    llvm::StringStream
    void print(std::ostream &Out);
    +      
    void print(std::ostream &Out);
     // ...
     print(std::cerr);
    void print(std::ostream &Out);
    +      
    void print(std::ostream &Out);
     void print(std::ostream *Out) { if (Out) print(*Out) }
     // ...
     print(llvm::cerr);
    -
      N.B. The second print method is called by the print +
      +N.B. The second print method is called by the print expression. It prevents the execution of the first print method if the -stream is cnull.
    + From isanbard at gmail.com Sat Sep 22 05:07:00 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 10:07:00 -0000 Subject: [llvm-commits] [llvm] r42230 - /llvm/trunk/docs/ExtendingLLVM.html Message-ID: <200709221007.l8MA70m9025643@zion.cs.uiuc.edu> Author: void Date: Sat Sep 22 05:07:00 2007 New Revision: 42230 URL: http://llvm.org/viewvc/llvm-project?rev=42230&view=rev Log: Validation fixes Modified: llvm/trunk/docs/ExtendingLLVM.html Modified: llvm/trunk/docs/ExtendingLLVM.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ExtendingLLVM.html?rev=42230&r1=42229&r2=42230&view=diff ============================================================================== --- llvm/trunk/docs/ExtendingLLVM.html (original) +++ llvm/trunk/docs/ExtendingLLVM.html Sat Sep 22 05:07:00 2007 @@ -107,19 +107,17 @@
    Add support to the C backend in lib/Target/CBackend/
    Depending on the intrinsic, there are a few ways to implement this. For -most intrinsics, it makes sense to add code to lower your intrinsic in -LowerIntrinsicCall in lib/CodeGen/IntrinsicLowering.cpp. -Second, if it makes sense to lower the intrinsic to an expanded sequence of C -code in all cases, just emit the expansion in visitCallInst in -Writer.cpp. If the intrinsic has some way to express it with GCC -(or any other compiler) extensions, it can be conditionally supported based on -the compiler compiling the CBE output (see llvm.prefetch for an -example). -Third, if the intrinsic really has no way to be lowered, just have the code -generator emit code that prints an error message and calls abort if executed. -
    + most intrinsics, it makes sense to add code to lower your intrinsic in + LowerIntrinsicCall in lib/CodeGen/IntrinsicLowering.cpp. + Second, if it makes sense to lower the intrinsic to an expanded sequence of + C code in all cases, just emit the expansion in visitCallInst in + Writer.cpp. If the intrinsic has some way to express it with GCC + (or any other compiler) extensions, it can be conditionally supported based + on the compiler compiling the CBE output (see llvm.prefetch for an + example). Third, if the intrinsic really has no way to be lowered, just + have the code generator emit code that prints an error message and calls + abort if executed. -
    Add support to the .td file for the target(s) of your choice in lib/Target/*/*.td.
    @@ -127,6 +125,7 @@ the intrinsic, though it may obviously require adding the instructions you want to generate as well. There are lots of examples in the PowerPC and X86 backend to follow. +
    From isanbard at gmail.com Sat Sep 22 05:13:39 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 10:13:39 -0000 Subject: [llvm-commits] [llvm] r42231 - /llvm/trunk/docs/Stacker.html Message-ID: <200709221013.l8MADdjY026037@zion.cs.uiuc.edu> Author: void Date: Sat Sep 22 05:13:39 2007 New Revision: 42231 URL: http://llvm.org/viewvc/llvm-project?rev=42231&view=rev Log: Validation fixes Modified: llvm/trunk/docs/Stacker.html Modified: llvm/trunk/docs/Stacker.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Stacker.html?rev=42231&r1=42230&r2=42231&view=diff ============================================================================== --- llvm/trunk/docs/Stacker.html (original) +++ llvm/trunk/docs/Stacker.html Sat Sep 22 05:13:39 2007 @@ -1296,19 +1296,26 @@ +

    The source code, test programs, and sample programs can all be found in the LLVM repository named llvm-stacker This should be checked out to the projects directory so that it will auto-configure. To do that, make sure you have the llvm sources in llvm (see Getting Started) and then use these -commands:

    -    svn co http://llvm.org/svn/llvm-project/llvm-top/trunk llvm-top
    -    cd llvm-top
    -    make build MODULE=stacker
    -

    +commands:

    + +
    +
    +% svn co http://llvm.org/svn/llvm-project/llvm-top/trunk llvm-top
    +% cd llvm-top
    +% make build MODULE=stacker
    +
    +
    +

    Under the projects/llvm-stacker directory you will find the implementation of the Stacker compiler, as follows:

    +
    • lib - contains most of the source code
        @@ -1323,11 +1330,14 @@
      • sample - contains the sample programs
    +
    The Lexer
    +

    See projects/llvm-stacker/lib/compiler/Lexer.l

    +
    The Parser
    From isanbard at gmail.com Sat Sep 22 05:17:08 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 10:17:08 -0000 Subject: [llvm-commits] [llvm] r42232 - /llvm/trunk/docs/ExceptionHandling.html Message-ID: <200709221017.l8MAH8cA026240@zion.cs.uiuc.edu> Author: void Date: Sat Sep 22 05:17:08 2007 New Revision: 42232 URL: http://llvm.org/viewvc/llvm-project?rev=42232&view=rev Log: Validation fixes Modified: llvm/trunk/docs/ExceptionHandling.html Modified: llvm/trunk/docs/ExceptionHandling.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/ExceptionHandling.html?rev=42232&r1=42231&r2=42232&view=diff ============================================================================== --- llvm/trunk/docs/ExceptionHandling.html (original) +++ llvm/trunk/docs/ExceptionHandling.html Sat Sep 22 05:17:08 2007 @@ -72,21 +72,20 @@

    Exception handling for most programming languages is designed to recover from conditions that rarely occur during general use of an application. To that end, exception handling should not interfere with the main flow of an -application's algorithm by performing checkpointing tasks such as saving +application's algorithm by performing checkpointing tasks such as saving the current pc or register state.

    The Itanium ABI Exception Handling Specification defines a methodology for providing outlying data in the form of exception tables without inlining -speculative exception handling code in the flow of an application's main +speculative exception handling code in the flow of an application's main algorithm. Thus, the specification is said to add "zero-cost" to the normal execution of an application.

    A more complete description of the Itanium ABI exception handling runtime support of can be found at Itanium C++ ABI: -Exception Handling. A description of the exception frame format can be -found at Exception Frames, with details of the Dwarf specification at Dwarf 3 Standard. A description for the C++ exception table formats can be found at @@ -243,7 +242,7 @@

    Finally, the entry and exit of catch code is bracketed with calls to __cxa_begin_catch and __cxa_end_catch. __cxa_begin_catch takes a exception structure reference as an argument -and returns the value of the exception object. __cxa_end_catch +and returns the value of the exception object. __cxa_end_catch takes a exception structure reference as an argument. This function clears the exception from the exception space. Note: a rethrow from within the catch may replace this call with a __cxa_rethrow.

    @@ -438,7 +437,7 @@

    An exception table contains information about what actions to take when an -exception is thrown in a particular part of a function's code. There is +exception is thrown in a particular part of a function's code. There is one exception table per function except leaf routines and functions that have only calls to non-throwing functions will not need an exception table.

    @@ -455,7 +454,7 @@
      -
    1. Testing/Testing/Testing.

    2. +
    3. Testing/Testing/Testing.

    From gordonhenriksen at mac.com Sat Sep 22 11:43:29 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sat, 22 Sep 2007 12:43:29 -0400 Subject: [llvm-commits] [patch] add gcroot attribute, test In-Reply-To: <393177A5-E535-4838-A652-B315866214B5@apple.com> References: <0933E6F8-DCA7-42ED-8BA1-F909C11F82AB@apple.com> <9916D16C-29D2-4018-BF09-30620C24CB6D@apple.com> <916F719E-1A02-41EE-BF17-9E5DBEFA1513@mac.com> <393177A5-E535-4838-A652-B315866214B5@apple.com> Message-ID: Hi Chris, > On Sep 21, 2007, at 13:24, Chris Lattner wrote: > >> On Sep 21, 2007, at 10:49, Gordon Henriksen wrote: >> >> This is redundant; LLVM does it for you. See thread starting here: >> http://www.mail-archive.com/llvm-commits at cs.uiuc.edu/msg23987.html > > I don't think so: the patch makes it so that llvm.gcroot *doesn't* > implicitly null out the root. This means the front-end *does* need > to explicitly emit the null init if it wants it, right? Yes, you're right about the current behavior. At some point, I misread the 'shadowStackEntry.roots[num].root = NULL;' StoreInst in LowerGC.cpp as a redundant 'root = NULL;' on entry. Else I would've reserved this comment until after my patches were in. ShadowStackCollector in my tree (attached) is somewhat different than LowerGC. It doesn't sacrifice portability, but reduces per-gcroot overhead to 1 store?or, better, zero overhead if an initializer is already present. This compares to n+2 stores per gcroot for top-of-tree LowerGC. n is the number of times llvm.gcroot is dynamically executed. That could be commonly reduced to n+1, but that is still strictly worse than the worst-case of 1 for ShadowStackCollector. >> The upshot is that the collector knows whether it is necessary to >> initialize roots or not, and does so on the program's behalf iff >> necessary. > > I don't think the collector wants to be in the business of nulling > out pointers. Hm. I disagree. As I see it, using the back-end to emit initializers: ? is trivial ? makes front-ends and source programs marginally simpler, as I've already pointed out ? reduces coupling between the front-end compiler and GC back-end (see below) ? better allows optimizations (see below) By contrast, the only potential benefit I see to relying on front-end initialization is that it micro-optimizes LowerGC in some cases.[1] But this benefit is specious; the best way to optimize LowerGC is to replace it. > The important thing is that when the collector runs, it doesn't > want a root with garbage in it. Yes. And I'd argue that the collector back-end is best positioned to guarantee that. Consider reference counting. Stores to the stack slot must be transformed as such: if (*slot != null) release(*slot); if (value != null) retain(value); *slot = value; Slot initialization (or flow analysis potentially degrading to slot initialization) is always necessary to avoid 'release(garbage)' on first assignment. But initialization is not equivalent to 'store null -> slot', which would get expanded. Furthermore, there's no flow- sensitive way to differentiate store-as-an-initializer from store- with-reference-counting; llvm.gcroot could be in a loop. Liveness-accurate stack maps have a similar characteristic, but in such a case, no initializer may be necessary at all. >> However, if the source language requires null initialization >> semantics, then the front-end should emit explicit null >> initializers (as the variable comes into scope). > > Even if the language doesn't require it, for GC roots, it seems > very dangerous to hand the collector a root with random garbage in > it, agree? I don't, actually. gcroot doesn't get handed a value, but rather a variable. As you've point out, it's an annotation, not an instruction. The difference is quite significant for transformations. Consider inlining if we rely on front-end initializers. The initializers have to be hoisted into the destination's entry block for a stack mapping collector.[2] Worse, the entry block may not dominate the live-in value, and null initializers may need to be *added* by the inliner. This is a mess?and the required and optimal behaviors are coupled to the collector. But with the back-end providing initialization, no changes are necessary to the inliner, and there is no coupling. Consider also that dead store elimination applied to stack roots is liable to make erroneous transformations if we rely on front-end initialization. GC shouldn't logically inhibit DSE on stack roots. Relying on front-end initialization seems to generally complicate or inhibit optimizations; back-end initialization seems to allow them to operate more or less freely. I just don't see any upsides for front-end initialization. Am I missing something? >> The llvm.gcroot intrinsic can be declared to take any types you >> care to give it in the module, so long as its eventual type is >> like void(**, *). > > Actually no, I need to update the langref.html document to make > this explicit, thanks for reminding me. The issue is that if you > link two modules with different 's, the two different > intrinsics would have to be merged somehow. By forcing the > intrinsic to a specific type this problem doesn't happen. I wondered about that. I'll have to fix several tests and the Verifier. Are these the blessed prototypes? void @llvm.gcroot(i8**, i8*) i8* @llvm.gcread(i8*, i8**) void @llvm.gcwrite(i8*, i8*, i8**) ? Gordon [1] Using front-end initialization, LowerGC can skip the initializers for code like this: void foo(bool flag) { if (flag) { Object x, y, z; ... } } [2] LowerGC doesn't pose any inlining problem, but that's due to the 'n' in its per-gcroot costs. -------------- next part -------------- A non-text attachment was scrubbed... Name: ShadowStackCollector.cpp Type: application/octet-stream Size: 16888 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070922/a4b82c9d/attachment.obj From tonic at nondot.org Sat Sep 22 12:25:02 2007 From: tonic at nondot.org (Tanya Lattner) Date: Sat, 22 Sep 2007 17:25:02 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r42233 - /llvm-gcc-4.0/branches/release_21/README.LLVM Message-ID: <200709221725.l8MHP20o010914@zion.cs.uiuc.edu> Author: tbrethou Date: Sat Sep 22 12:25:02 2007 New Revision: 42233 URL: http://llvm.org/viewvc/llvm-project?rev=42233&view=rev Log: Fix symlink directions. Modified: llvm-gcc-4.0/branches/release_21/README.LLVM Modified: llvm-gcc-4.0/branches/release_21/README.LLVM URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/branches/release_21/README.LLVM?rev=42233&r1=42232&r2=42233&view=diff ============================================================================== --- llvm-gcc-4.0/branches/release_21/README.LLVM (original) +++ llvm-gcc-4.0/branches/release_21/README.LLVM Sat Sep 22 12:25:02 2007 @@ -128,12 +128,12 @@ executables have been compiled with llvm-gcc itself), replace "make" with "make bootstrap". -Finally, add symlinks for llvm-gcc and llvm-g++ to your path: +Finally, add symlinks for llvm-gcc and llvm-g++ to your path (optional): $ su $ cd /usr/local/bin -$ ln -s /install/bin/gcc llvm-gcc -$ ln -s /install/bin/g++ llvm-g++ +$ ln -s /install/bin/llvm-gcc llvm-gcc +$ ln -s /install/bin/llvm-g++ llvm-g++ $ exit You should now have something like: From sabre at nondot.org Sat Sep 22 15:16:51 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 22 Sep 2007 20:16:51 -0000 Subject: [llvm-commits] [llvm] r42239 - /llvm/trunk/lib/Target/CBackend/CBackend.cpp Message-ID: <200709222016.l8MKGpQ7017586@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 22 15:16:48 2007 New Revision: 42239 URL: http://llvm.org/viewvc/llvm-project?rev=42239&view=rev Log: Fix PR1679, by printing GEP indices as signed values instead of unsigned. 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=42239&r1=42238&r2=42239&view=diff ============================================================================== --- llvm/trunk/lib/Target/CBackend/CBackend.cpp (original) +++ llvm/trunk/lib/Target/CBackend/CBackend.cpp Sat Sep 22 15:16:48 2007 @@ -1238,6 +1238,7 @@ shouldCast = true; castIsSigned = false; break; + case Instruction::GetElementPtr: case Instruction::AShr: case Instruction::SDiv: case Instruction::SRem: // Cast to signed first @@ -2859,7 +2860,7 @@ Out << ".field" << cast(I.getOperand())->getZExtValue(); } else { Out << '['; - writeOperand(I.getOperand()); + writeOperandWithCast(I.getOperand(), Instruction::GetElementPtr); Out << ']'; } } From gordonhenriksen at mac.com Sat Sep 22 16:36:22 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sat, 22 Sep 2007 21:36:22 -0000 Subject: [llvm-commits] [llvm] r42240 - /llvm/trunk/autoconf/configure.ac Message-ID: <200709222136.l8MLaM71019410@zion.cs.uiuc.edu> Author: gordon Date: Sat Sep 22 16:36:22 2007 New Revision: 42240 URL: http://llvm.org/viewvc/llvm-project?rev=42240&view=rev Log: Fix for srcdir <> objdir builds. Thanks Bill. Modified: llvm/trunk/autoconf/configure.ac Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=42240&r1=42239&r2=42240&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Sat Sep 22 16:36:22 2007 @@ -905,6 +905,8 @@ AC_CONFIG_MAKEFILE(tools/Makefile) AC_CONFIG_MAKEFILE(utils/Makefile) AC_CONFIG_MAKEFILE(projects/Makefile) +AC_CONFIG_MAKEFILE(bindings/Makefile) +AC_CONFIG_MAKEFILE(bindings/ocaml/Makefile.ocaml) dnl Finally, crank out the output AC_OUTPUT From gordonhenriksen at mac.com Sat Sep 22 16:36:59 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sat, 22 Sep 2007 21:36:59 -0000 Subject: [llvm-commits] [llvm] r42241 - /llvm/trunk/configure Message-ID: <200709222136.l8MLaxhC019436@zion.cs.uiuc.edu> Author: gordon Date: Sat Sep 22 16:36:59 2007 New Revision: 42241 URL: http://llvm.org/viewvc/llvm-project?rev=42241&view=rev Log: Regenerate. Modified: llvm/trunk/configure Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=42241&r1=42240&r2=42241&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Sat Sep 22 16:36:59 2007 @@ -34181,6 +34181,12 @@ ac_config_commands="$ac_config_commands projects/Makefile" +ac_config_commands="$ac_config_commands bindings/Makefile" + + +ac_config_commands="$ac_config_commands bindings/ocaml/Makefile.ocaml" + + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -34765,6 +34771,8 @@ "tools/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS tools/Makefile" ;; "utils/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS utils/Makefile" ;; "projects/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS projects/Makefile" ;; + "bindings/Makefile") CONFIG_COMMANDS="$CONFIG_COMMANDS bindings/Makefile" ;; + "bindings/ocaml/Makefile.ocaml") CONFIG_COMMANDS="$CONFIG_COMMANDS bindings/ocaml/Makefile.ocaml" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} @@ -35464,6 +35472,10 @@ ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/utils/Makefile utils/Makefile ;; "projects/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname projects/Makefile` ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/projects/Makefile projects/Makefile ;; + "bindings/Makefile":C) ${llvm_src}/autoconf/mkinstalldirs `dirname bindings/Makefile` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/bindings/Makefile bindings/Makefile ;; + "bindings/ocaml/Makefile.ocaml":C) ${llvm_src}/autoconf/mkinstalldirs `dirname bindings/ocaml/Makefile.ocaml` + ${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/bindings/ocaml/Makefile.ocaml bindings/ocaml/Makefile.ocaml ;; esac done # for ac_tag From gordonhenriksen at mac.com Sat Sep 22 16:39:04 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sat, 22 Sep 2007 17:39:04 -0400 Subject: [llvm-commits] [llvm] r42093 - in /llvm/trunk: ./ bindings/ bindings/ocaml/ bindings/ocaml/bitwriter/ bindings/ocaml/llvm/ test/Bindings/ test/Bindings/Ocaml/ test/lib/ In-Reply-To: <411A1F12-0745-4D79-B044-A7B346C10C7B@gmail.com> References: <200709181249.l8ICngqE011236@zion.cs.uiuc.edu> <411A1F12-0745-4D79-B044-A7B346C10C7B@gmail.com> Message-ID: <74743EFE-7763-4617-85E0-9BBAEB8060FF@mac.com> On Sep 22, 2007, at 03:50, Bill Wendling wrote: > Hi Gordon, > >> +include ../Makefile.ocaml > > This won't work if source dir != obj directory. It won't find the > Makefile.ocaml unless it's also copied over... Bill, Please try this: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- Mon-20070917/053787.html http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- Mon-20070917/053788.html ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070922/e1cc8aef/attachment.html From gordonhenriksen at mac.com Sat Sep 22 18:25:38 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sat, 22 Sep 2007 19:25:38 -0400 Subject: [llvm-commits] [llvm] r42194 - in /llvm/trunk/docs: GarbageCollection.html LangRef.html index.html In-Reply-To: <200709211730.l8LHUeE9001007@zion.cs.uiuc.edu> References: <200709211730.l8LHUeE9001007@zion.cs.uiuc.edu> Message-ID: <46E82DCA-777A-4A35-9EBC-0C649046FA32@mac.com> Chris, On 2007-09-21, at 13:30, Chris Lattner wrote: > + void *%llvm_gc_allocate(unsigned %Size) Do you want C or LLVM syntax here? ? Gordon -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070922/b8493b30/attachment.html From clattner at apple.com Sat Sep 22 18:40:39 2007 From: clattner at apple.com (Chris Lattner) Date: Sat, 22 Sep 2007 16:40:39 -0700 Subject: [llvm-commits] [llvm] r42194 - in /llvm/trunk/docs: GarbageCollection.html LangRef.html index.html In-Reply-To: <46E82DCA-777A-4A35-9EBC-0C649046FA32@mac.com> References: <200709211730.l8LHUeE9001007@zion.cs.uiuc.edu> <46E82DCA-777A-4A35-9EBC-0C649046FA32@mac.com> Message-ID: <7CB0E5A7-8831-4BAA-A937-C69694A794C6@apple.com> On Sep 22, 2007, at 4:25 PM, Gordon Henriksen wrote: > Chris, > > On 2007-09-21, at 13:30, Chris Lattner wrote: > >> + void *%llvm_gc_allocate(unsigned %Size) > > Do you want C or LLVM syntax here? You don't like a mix of both? :) Will fix, -Chris From sabre at nondot.org Sat Sep 22 18:41:15 2007 From: sabre at nondot.org (Chris Lattner) Date: Sat, 22 Sep 2007 23:41:15 -0000 Subject: [llvm-commits] [llvm] r42242 - /llvm/trunk/docs/GarbageCollection.html Message-ID: <200709222341.l8MNfFNa021964@zion.cs.uiuc.edu> Author: lattner Date: Sat Sep 22 18:41:15 2007 New Revision: 42242 URL: http://llvm.org/viewvc/llvm-project?rev=42242&view=rev Log: fix syntax Modified: llvm/trunk/docs/GarbageCollection.html Modified: llvm/trunk/docs/GarbageCollection.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GarbageCollection.html?rev=42242&r1=42241&r2=42242&view=diff ============================================================================== --- llvm/trunk/docs/GarbageCollection.html (original) +++ llvm/trunk/docs/GarbageCollection.html Sat Sep 22 18:41:15 2007 @@ -220,7 +220,7 @@
    - void *%llvm_gc_allocate(unsigned %Size) + void *llvm_gc_allocate(unsigned Size)

    The llvm_gc_allocate function is a global function defined by the From isanbard at gmail.com Sat Sep 22 19:15:34 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sat, 22 Sep 2007 17:15:34 -0700 Subject: [llvm-commits] [llvm] r42093 - in /llvm/trunk: ./ bindings/ bindings/ocaml/ bindings/ocaml/bitwriter/ bindings/ocaml/llvm/ test/Bindings/ test/Bindings/Ocaml/ test/lib/ In-Reply-To: <74743EFE-7763-4617-85E0-9BBAEB8060FF@mac.com> References: <200709181249.l8ICngqE011236@zion.cs.uiuc.edu> <411A1F12-0745-4D79-B044-A7B346C10C7B@gmail.com> <74743EFE-7763-4617-85E0-9BBAEB8060FF@mac.com> Message-ID: <6A955558-B3F6-406C-BFBE-0E36188E8144@gmail.com> On Sep 22, 2007, at 2:39 PM, Gordon Henriksen wrote: > > On Sep 22, 2007, at 03:50, Bill Wendling wrote: > >> Hi Gordon, >> >>> +include ../Makefile.ocaml >> >> This won't work if source dir != obj directory. It won't find the >> Makefile.ocaml unless it's also copied over... > > Bill, > > Please try this: > > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- > Mon-20070917/053787.html > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- > Mon-20070917/053788.html > I got farther. But now it's doing this: llvm[4]: ======= Finished Linking Debug Executable Sample Bad -I option: /Users/wendling/llvm/llvm.obj/Debug/lib/ocaml: No such file or directory make[3]: *** [/Users/wendling/llvm/llvm.obj/bindings/ocaml/llvm/Debug/ llvm.ocamldep] Error 2 make[2]: *** [all] Error 1 make[1]: *** [ocaml/.makeall] Error 2 make: *** [all] Error 1 -bw -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070922/147cec4f/attachment.html From baldrick at free.fr Sun Sep 23 03:02:12 2007 From: baldrick at free.fr (Duncan Sands) Date: Sun, 23 Sep 2007 08:02:12 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42243 - in /llvm-gcc-4.2/trunk/gcc: llvm-abi.h llvm-convert.cpp llvm-internal.h llvm-types.cpp Message-ID: <200709230802.l8N82CcL008125@zion.cs.uiuc.edu> Author: baldrick Date: Sun Sep 23 03:02:11 2007 New Revision: 42243 URL: http://llvm.org/viewvc/llvm-project?rev=42243&view=rev Log: Remove arrayLength, which calculated the length of a possibly variable-sized array type as a gcc tree. The problem is that we determine whether an array type corresponds to an LLVM array (essentially whether it is of constant length) using TYPE_SIZE, but calculate the length from the difference between the upper and lower bounds using arrayLength. The implicit assumption in this is that arrayLength will return a constant if TYPE_SIZE is constant. This worked fine in llvm-gcc-4.0, but 4.2 does TYPE_SIZE optimizations and sometimes reduces it to a constant in cases where fold cannot deduce that the upper and lower array bounds differ by a constant, leading to a bunch of compile failures in the Ada testsuite. Instead, deduce the array length from TYPE_SIZE. The only downside to this is that a fixed-length array of zero-sized elements now always maps to a zero-length LLVM array, but I think this is acceptable. Also, fix a bug in which DECL_SIZE was being ignored for variable length arrays allocated on the stack. Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-internal.h llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=42243&r1=42242&r2=42243&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Sun Sep 23 03:02:11 2007 @@ -110,10 +110,8 @@ } return FoundField ? isSingleElementStructOrArray(FoundField) : 0; case ARRAY_TYPE: - if (!isArrayCompatible(type)) - return 0; - tree length = arrayLength(type); - if (!length || !integer_onep(length)) + const ArrayType *Ty = dyn_cast(ConvertType(type)); + if (!Ty || Ty->getNumElements() != 1) return 0; return isSingleElementStructOrArray(TREE_TYPE(type)); } 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=42243&r1=42242&r2=42243&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sun Sep 23 03:02:11 2007 @@ -1510,15 +1510,17 @@ DECL_USER_ALIGN(decl) = 0; Alignment = DECL_ALIGN(decl)/8; } else { - tree length; - // Dynamic-size object: must push space on the stack. - if (TREE_CODE(type) == ARRAY_TYPE && - isSequentialCompatible(type) && - (length = arrayLength(type))) { + if (TREE_CODE(type) == ARRAY_TYPE + && isSequentialCompatible(type) + && TYPE_SIZE(type) == DECL_SIZE(decl)) { Ty = ConvertType(TREE_TYPE(type)); // Get array element type. // Compute the number of elements in the array. - Size = Emit(length, 0); + Size = Emit(DECL_SIZE(decl), 0); + assert(!integer_zerop(TYPE_SIZE(TREE_TYPE(type))) + && "Array of positive size with elements of zero size!"); + Value *EltSize = Emit(TYPE_SIZE(TREE_TYPE(type)), 0); + Size = Builder.CreateUDiv(Size, EltSize, "len"); } else { // Compute the variable's size in bytes. Size = Emit(DECL_SIZE_UNIT(decl), 0); 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=42243&r1=42242&r2=42243&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Sun Sep 23 03:02:11 2007 @@ -213,10 +213,6 @@ /// corresponds to an LLVM array type. bool isArrayCompatible(tree_node *type); -/// arrayLength - Return a tree expressing the number of elements in an array -/// of the specified type, or NULL if the type does not specify the length. -tree_node *arrayLength(tree_node *type); - /// ValidateRegisterVariable - Check that a static "asm" variable is /// well-formed. If not, emit error messages and return true. If so, return /// false. 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=42243&r1=42242&r2=42243&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sun Sep 23 03:02:11 2007 @@ -299,9 +299,9 @@ /// type and the corresponding LLVM SequentialType lay out their components /// identically in memory. bool isSequentialCompatible(tree_node *type) { - assert((TREE_CODE (type) == ARRAY_TYPE || - TREE_CODE (type) == POINTER_TYPE || - TREE_CODE (type) == REFERENCE_TYPE) && "not a sequential type!"); + assert((TREE_CODE(type) == ARRAY_TYPE || + TREE_CODE(type) == POINTER_TYPE || + TREE_CODE(type) == REFERENCE_TYPE) && "not a sequential type!"); // This relies on gcc types with constant size mapping to LLVM types with the // same size. return isInt64(TYPE_SIZE(TREE_TYPE(type)), true); @@ -310,13 +310,13 @@ /// isArrayCompatible - Return true if the specified gcc array or pointer type /// corresponds to an LLVM array type. bool isArrayCompatible(tree_node *type) { - assert((TREE_CODE (type) == ARRAY_TYPE || - TREE_CODE (type) == POINTER_TYPE || - TREE_CODE (type) == REFERENCE_TYPE) && "not a sequential type!"); + assert((TREE_CODE(type) == ARRAY_TYPE || + TREE_CODE(type) == POINTER_TYPE || + TREE_CODE(type) == REFERENCE_TYPE) && "not a sequential type!"); return - (TREE_CODE (type) == ARRAY_TYPE) && ( + (TREE_CODE(type) == ARRAY_TYPE) && ( // Arrays with no size are fine as long as their components are layed out - // the same way in memory by LLVM. For example "int X[]" -> "[0 x int]". + // the same way in memory by LLVM. For example 'int X[]' -> '[0 x i32]'. (!TYPE_SIZE(type) && isSequentialCompatible(type)) || // Arrays with constant size map to LLVM arrays. If the array has zero @@ -328,21 +328,6 @@ ); } -/// arrayLength - Return a tree expressing the number of elements in an array -/// of the specified type, or NULL if the type does not specify the length. -tree_node *arrayLength(tree_node *type) { - tree Domain = TYPE_DOMAIN(type); - - if (!Domain || !TYPE_MAX_VALUE(Domain)) - return NULL; - - tree length = fold_convert(sizetype, TYPE_MAX_VALUE(Domain)); - if (TYPE_MIN_VALUE(Domain)) - length = size_binop (MINUS_EXPR, length, - fold_convert(sizetype, TYPE_MIN_VALUE(Domain))); - return size_binop (PLUS_EXPR, length, size_one_node); -} - /// refine_type_to - Cause all users of the opaque type old_type to switch /// to the more concrete type new_type. void refine_type_to(tree old_type, tree new_type) @@ -579,7 +564,7 @@ case ARRAY_TYPE: { unsigned EltSizeBits = TREE_INT_CST_LOW(TYPE_SIZE(TREE_TYPE(type))); - unsigned NumElts = getInt64(arrayLength(type), true); + unsigned NumElts = cast(ConvertType(type))->getNumElements(); unsigned OverlapElt = (unsigned)PadStartBits/EltSizeBits; // Check each element for overlap. This is inelegant, but effective. @@ -849,25 +834,32 @@ if (isArrayCompatible(type)) { uint64_t NumElements; - tree length = arrayLength(type); - if (!length) { - // We get here if we have something that is globally declared as an - // array with no dimension, this becomes just a zero size array of the - // element type so that: int X[] becomes '%X = external global [0x i32]' + if (!TYPE_SIZE(type)) { + // We get here if we have something that is declared to be an array with + // no dimension. This just becomes a zero length array of the element + // type, so 'int X[]' becomes '%X = external global [0 x i32]'. // - // Note that this also affects new expressions, which return a pointer + // Note that this also affects new expressions, which return a pointer // to an unsized array of elements. NumElements = 0; - } else if (!isInt64(length, true)) { - // A variable length array where the element type has size zero. Turn - // it into a zero length array of the element type. - assert(integer_zerop(TYPE_SIZE(TREE_TYPE(type))) - && "variable length array has constant size!"); + } else if (integer_zerop(TYPE_SIZE(type))) { + // An array of zero length, or with an element type of zero size. + // Turn it into a zero length array of the element type. NumElements = 0; } else { - // Normal array. - NumElements = getInt64(length, true); + // Normal constant-size array. + NumElements = getInt64(TYPE_SIZE(type), true); + + assert(isInt64(TYPE_SIZE(TREE_TYPE(type)), true) + && "Array of constant size with elements of variable size!"); + uint64_t ElementSize = getInt64(TYPE_SIZE(TREE_TYPE(type)), true); + assert(ElementSize + && "Array of positive size with elements of zero size!"); + assert(!(NumElements % ElementSize) + && "Array size is not a multiple of the element size!"); + + NumElements /= ElementSize; } return TypeDB.setType(type, ArrayType::get(ConvertType(TREE_TYPE(type)), From baldrick at free.fr Sun Sep 23 03:05:10 2007 From: baldrick at free.fr (Duncan Sands) Date: Sun, 23 Sep 2007 08:05:10 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r42244 - /llvm-gcc-4.2/trunk/gcc/ada/a-numaux-x86.ads Message-ID: <200709230805.l8N85AKe008260@zion.cs.uiuc.edu> Author: baldrick Date: Sun Sep 23 03:05:10 2007 New Revision: 42244 URL: http://llvm.org/viewvc/llvm-project?rev=42244&view=rev Log: I forgot to pull in the math libraries when I added math library calls to work around missing asm support for the x86 floating point stack. Modified: llvm-gcc-4.2/trunk/gcc/ada/a-numaux-x86.ads Modified: llvm-gcc-4.2/trunk/gcc/ada/a-numaux-x86.ads URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ada/a-numaux-x86.ads?rev=42244&r1=42243&r2=42244&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/ada/a-numaux-x86.ads (original) +++ llvm-gcc-4.2/trunk/gcc/ada/a-numaux-x86.ads Sun Sep 23 03:05:10 2007 @@ -44,6 +44,8 @@ package Ada.Numerics.Aux is pragma Pure; + pragma Linker_Options ("-lm"); + type Double is new Long_Long_Float; function Sin (X : Double) return Double; From gordonhenriksen at mac.com Sun Sep 23 08:37:44 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 23 Sep 2007 13:37:44 -0000 Subject: [llvm-commits] [llvm] r42245 - /llvm/trunk/bindings/ocaml/Makefile.ocaml Message-ID: <200709231337.l8NDbje9003332@zion.cs.uiuc.edu> Author: gordon Date: Sun Sep 23 08:37:44 2007 New Revision: 42245 URL: http://llvm.org/viewvc/llvm-project?rev=42245&view=rev Log: Fix srcdir <> objdir builds with ocaml 2.10. Downrev versions don't care whether 'dir' exists in 'ocamldep -I dir ...', but recent ones demand that it actually exists. Modified: llvm/trunk/bindings/ocaml/Makefile.ocaml Modified: llvm/trunk/bindings/ocaml/Makefile.ocaml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile.ocaml?rev=42245&r1=42244&r2=42245&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/Makefile.ocaml (original) +++ llvm/trunk/bindings/ocaml/Makefile.ocaml Sun Sep 23 08:37:44 2007 @@ -88,7 +88,8 @@ $(ObjDir)/%.ml: $(PROJ_SRC_DIR)/%.ml $(ObjDir)/.dir $(Verb) $(CP) -f $< $@ -$(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) +$(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) \ + $(OcamlDir)/.dir $(ObjDir)/.dir $(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeader) > $@ -include $(ObjDir)/$(LIBRARYNAME).ocamldep From gordonhenriksen at mac.com Sun Sep 23 08:40:35 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 23 Sep 2007 09:40:35 -0400 Subject: [llvm-commits] [llvm] r42093 - in /llvm/trunk: ./ bindings/ bindings/ocaml/ bindings/ocaml/bitwriter/ bindings/ocaml/llvm/ test/Bindings/ test/Bindings/Ocaml/ test/lib/ In-Reply-To: <6A955558-B3F6-406C-BFBE-0E36188E8144@gmail.com> References: <200709181249.l8ICngqE011236@zion.cs.uiuc.edu> <411A1F12-0745-4D79-B044-A7B346C10C7B@gmail.com> <74743EFE-7763-4617-85E0-9BBAEB8060FF@mac.com> <6A955558-B3F6-406C-BFBE-0E36188E8144@gmail.com> Message-ID: <59C89206-600D-4176-8B88-8039AC691848@mac.com> On Sep 22, 2007, at 20:15, Bill Wendling wrote: > I got farther. But now it's doing this: > > llvm[4]: ======= Finished Linking Debug Executable Sample > Bad -I option: /Users/wendling/llvm/llvm.obj/Debug/lib/ocaml: No > such file or directory > make[3]: *** [/Users/wendling/llvm/llvm.obj/bindings/ocaml/llvm/ > Debug/llvm.ocamldep] Error 2 > make[2]: *** [all] Error 1 > make[1]: *** [ocaml/.makeall] Error 2 > make: *** [all] Error 1 Nice. I'd tested the objdir != srcdir build on a machine with ocaml 2.06, where ocamldep doesn't produce that helpful diagnostic. After this patch, the ocaml 2.10cvs works too: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- Mon-20070917/053796.html ? Gordon From dalej at apple.com Sun Sep 23 09:52:20 2007 From: dalej at apple.com (Dale Johannesen) Date: Sun, 23 Sep 2007 14:52:20 -0000 Subject: [llvm-commits] [llvm] r42246 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/Target/Alpha/AlphaISelLowering.cpp lib/Target/IA64/IA64ISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrFPStack.td lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrSSE.td Message-ID: <200709231452.l8NEqK2o007269@zion.cs.uiuc.edu> Author: johannes Date: Sun Sep 23 09:52:20 2007 New Revision: 42246 URL: http://llvm.org/viewvc/llvm-project?rev=42246&view=rev Log: Fix PR 1681. When X86 target uses +sse -sse2, keep f32 in SSE registers and f64 in x87. This is effectively a new codegen mode. Change addLegalFPImmediate to permit float and double variants to do different things. Adjust callers. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86InstrFPStack.td llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=42246&r1=42245&r2=42246&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Sun Sep 23 09:52:20 2007 @@ -783,17 +783,7 @@ /// addLegalFPImmediate - Indicate that this target can instruction select /// the specified FP immediate natively. void addLegalFPImmediate(const APFloat& Imm) { - // Incoming constants are expected to be double. We also add - // the float version. It is expected that all constants are exactly - // representable as floats. - assert(&Imm.getSemantics() == &APFloat::IEEEdouble); - APFloat Immf = APFloat(Imm); - // Rounding mode is not supposed to matter here... - if (Immf.convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven) != - APFloat::opOK) - assert(0); LegalFPImmediates.push_back(Imm); - LegalFPImmediates.push_back(Immf); } /// setTargetDAGCombine - Targets should invoke this method for each target Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=42246&r1=42245&r2=42246&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Sun Sep 23 09:52:20 2007 @@ -140,7 +140,9 @@ setOperationAction(ISD::ConstantFP, MVT::f64, Expand); setOperationAction(ISD::ConstantFP, MVT::f32, Expand); addLegalFPImmediate(APFloat(+0.0)); //F31 + addLegalFPImmediate(APFloat(+0.0f)); //F31 addLegalFPImmediate(APFloat(-0.0)); //-F31 + addLegalFPImmediate(APFloat(-0.0f)); //-F31 setJumpBufSize(272); setJumpBufAlignment(16); Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=42246&r1=42245&r2=42246&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Sun Sep 23 09:52:20 2007 @@ -120,7 +120,9 @@ setOperationAction(ISD::ConstantFP, MVT::f64, Expand); addLegalFPImmediate(APFloat(+0.0)); + addLegalFPImmediate(APFloat(+0.0f)); addLegalFPImmediate(APFloat(+1.0)); + addLegalFPImmediate(APFloat(+1.0f)); } const char *IA64TargetLowering::getTargetNodeName(unsigned Opcode) const { Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=42246&r1=42245&r2=42246&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Sep 23 09:52:20 2007 @@ -40,7 +40,8 @@ X86TargetLowering::X86TargetLowering(TargetMachine &TM) : TargetLowering(TM) { Subtarget = &TM.getSubtarget(); - X86ScalarSSE = Subtarget->hasSSE2(); + X86ScalarSSEf64 = Subtarget->hasSSE2(); + X86ScalarSSEf32 = Subtarget->hasSSE1(); X86StackPtr = Subtarget->is64Bit() ? X86::RSP : X86::ESP; RegInfo = TM.getRegisterInfo(); @@ -87,7 +88,7 @@ setOperationAction(ISD::UINT_TO_FP , MVT::i64 , Expand); setOperationAction(ISD::UINT_TO_FP , MVT::i32 , Promote); } else { - if (X86ScalarSSE) + if (X86ScalarSSEf64) // If SSE i64 SINT_TO_FP is not available, expand i32 UINT_TO_FP. setOperationAction(ISD::UINT_TO_FP , MVT::i32 , Expand); else @@ -99,7 +100,7 @@ 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 (X86ScalarSSEf32) { setOperationAction(ISD::SINT_TO_FP , MVT::i16 , Promote); // f32 and f64 cases are Legal, f80 case is not setOperationAction(ISD::SINT_TO_FP , MVT::i32 , Custom); @@ -118,7 +119,7 @@ setOperationAction(ISD::FP_TO_SINT , MVT::i1 , Promote); setOperationAction(ISD::FP_TO_SINT , MVT::i8 , Promote); - if (X86ScalarSSE) { + if (X86ScalarSSEf32) { 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); @@ -137,7 +138,7 @@ setOperationAction(ISD::FP_TO_UINT , MVT::i64 , Expand); setOperationAction(ISD::FP_TO_UINT , MVT::i32 , Promote); } else { - if (X86ScalarSSE && !Subtarget->hasSSE3()) + if (X86ScalarSSEf32 && !Subtarget->hasSSE3()) // Expand FP_TO_UINT into a select. // FIXME: We would like to use a Custom expander here eventually to do // the optimal thing for SSE vs. the default expansion in the legalizer. @@ -148,7 +149,7 @@ } // TODO: when we have SSE, these could be more efficient, by using movd/movq. - if (!X86ScalarSSE) { + if (!X86ScalarSSEf64) { setOperationAction(ISD::BIT_CONVERT , MVT::f32 , Expand); setOperationAction(ISD::BIT_CONVERT , MVT::i32 , Expand); } @@ -271,7 +272,8 @@ else setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32, Expand); - if (X86ScalarSSE) { + if (X86ScalarSSEf64) { + // f32 and f64 use SSE. // Set up the FP register classes. addRegisterClass(MVT::f32, X86::FR32RegisterClass); addRegisterClass(MVT::f64, X86::FR64RegisterClass); @@ -300,7 +302,8 @@ // cases we handle. setOperationAction(ISD::ConstantFP, MVT::f64, Expand); setOperationAction(ISD::ConstantFP, MVT::f32, Expand); - addLegalFPImmediate(APFloat(+0.0)); // xorps / xorpd + addLegalFPImmediate(APFloat(+0.0)); // xorpd + addLegalFPImmediate(APFloat(+0.0f)); // xorps // Conversions to long double (in X87) go through memory. setConvertAction(MVT::f32, MVT::f80, Expand); @@ -309,7 +312,55 @@ // Conversions from long double (in X87) go through memory. setConvertAction(MVT::f80, MVT::f32, Expand); setConvertAction(MVT::f80, MVT::f64, Expand); + } else if (X86ScalarSSEf32) { + // Use SSE for f32, x87 for f64. + // Set up the FP register classes. + addRegisterClass(MVT::f32, X86::FR32RegisterClass); + addRegisterClass(MVT::f64, X86::RFP64RegisterClass); + + // Use ANDPS to simulate FABS. + setOperationAction(ISD::FABS , MVT::f32, Custom); + + // Use XORP to simulate FNEG. + setOperationAction(ISD::FNEG , MVT::f32, Custom); + + setOperationAction(ISD::UNDEF, MVT::f64, Expand); + + // Use ANDPS and ORPS to simulate FCOPYSIGN. + setOperationAction(ISD::FCOPYSIGN, MVT::f64, Expand); + setOperationAction(ISD::FCOPYSIGN, MVT::f32, Custom); + + // We don't support sin/cos/fmod + setOperationAction(ISD::FSIN , MVT::f32, Expand); + setOperationAction(ISD::FCOS , MVT::f32, Expand); + setOperationAction(ISD::FREM , MVT::f32, Expand); + + // Expand FP immediates into loads from the stack, except for the special + // cases we handle. + setOperationAction(ISD::ConstantFP, MVT::f64, Expand); + setOperationAction(ISD::ConstantFP, MVT::f32, Expand); + addLegalFPImmediate(APFloat(+0.0f)); // xorps + addLegalFPImmediate(APFloat(+0.0)); // FLD0 + addLegalFPImmediate(APFloat(+1.0)); // FLD1 + addLegalFPImmediate(APFloat(-0.0)); // FLD0/FCHS + addLegalFPImmediate(APFloat(-1.0)); // FLD1/FCHS + + // SSE->x87 conversions go through memory. + setConvertAction(MVT::f32, MVT::f64, Expand); + setConvertAction(MVT::f32, MVT::f80, Expand); + + // x87->SSE truncations need to go through memory. + setConvertAction(MVT::f80, MVT::f32, Expand); + setConvertAction(MVT::f64, MVT::f32, Expand); + // And x87->x87 truncations also. + setConvertAction(MVT::f80, MVT::f64, Expand); + + if (!UnsafeFPMath) { + setOperationAction(ISD::FSIN , MVT::f64 , Expand); + setOperationAction(ISD::FCOS , MVT::f64 , Expand); + } } else { + // f32 and f64 in x87. // Set up the FP register classes. addRegisterClass(MVT::f64, X86::RFP64RegisterClass); addRegisterClass(MVT::f32, X86::RFP32RegisterClass); @@ -335,6 +386,10 @@ addLegalFPImmediate(APFloat(+1.0)); // FLD1 addLegalFPImmediate(APFloat(-0.0)); // FLD0/FCHS addLegalFPImmediate(APFloat(-1.0)); // FLD1/FCHS + addLegalFPImmediate(APFloat(+0.0f)); // FLD0 + addLegalFPImmediate(APFloat(+1.0f)); // FLD1 + addLegalFPImmediate(APFloat(-0.0f)); // FLD0/FCHS + addLegalFPImmediate(APFloat(-1.0f)); // FLD1/FCHS } // Long double always uses X87. @@ -583,7 +638,8 @@ // If this is an FP return with ScalarSSE, we need to move the value from // an XMM register onto the fp-stack. - if (X86ScalarSSE) { + if ((X86ScalarSSEf32 && RVLocs[0].getValVT()==MVT::f32) || + (X86ScalarSSEf64 && RVLocs[0].getValVT()==MVT::f64)) { SDOperand MemLoc; // If this is a load into a scalarsse value, don't store the loaded value @@ -659,7 +715,8 @@ // If we are using ScalarSSE, store ST(0) to the stack and reload it into // an XMM register. - if (X86ScalarSSE) { + if ((X86ScalarSSEf32 && RVLocs[0].getValVT() == MVT::f32) || + (X86ScalarSSEf64 && RVLocs[0].getValVT() == MVT::f64)) { // FIXME: Currently the FST is flagged to the FP_GET_RESULT. This // shouldn't be necessary except that RFP cannot be live across // multiple blocks. When stackifier is fixed, they can be uncoupled. @@ -3334,7 +3391,9 @@ StackSlot, NULL, 0); // These are really Legal; caller falls through into that case. - if (SrcVT==MVT::i32 && Op.getValueType() != MVT::f80 && X86ScalarSSE) + if (SrcVT==MVT::i32 && Op.getValueType() == MVT::f32 && X86ScalarSSEf32) + return Result; + if (SrcVT==MVT::i32 && Op.getValueType() == MVT::f64 && X86ScalarSSEf64) return Result; if (SrcVT==MVT::i64 && Op.getValueType() != MVT::f80 && Subtarget->is64Bit()) @@ -3342,7 +3401,8 @@ // Build the FILD SDVTList Tys; - bool useSSE = X86ScalarSSE && Op.getValueType() != MVT::f80; + bool useSSE = (X86ScalarSSEf32 && Op.getValueType() == MVT::f32) || + (X86ScalarSSEf64 && Op.getValueType() == MVT::f64); if (useSSE) Tys = DAG.getVTList(MVT::f64, MVT::Other, MVT::Flag); else @@ -3390,8 +3450,11 @@ SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy()); // These are really Legal. - if (Op.getValueType() == MVT::i32 && X86ScalarSSE && - Op.getOperand(0).getValueType() != MVT::f80) + if (Op.getValueType() == MVT::i32 && + X86ScalarSSEf32 && Op.getOperand(0).getValueType() == MVT::f32) + return Result; + if (Op.getValueType() == MVT::i32 && + X86ScalarSSEf64 && Op.getOperand(0).getValueType() == MVT::f64) return Result; if (Subtarget->is64Bit() && Op.getValueType() == MVT::i64 && @@ -3408,7 +3471,8 @@ SDOperand Chain = DAG.getEntryNode(); SDOperand Value = Op.getOperand(0); - if (X86ScalarSSE && Op.getOperand(0).getValueType() != MVT::f80) { + if ((X86ScalarSSEf32 && Op.getOperand(0).getValueType() == MVT::f32) || + (X86ScalarSSEf64 && Op.getOperand(0).getValueType() == MVT::f64)) { 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); @@ -3620,8 +3684,9 @@ // pressure reason)? SDOperand Cmp = Cond.getOperand(1); unsigned Opc = Cmp.getOpcode(); - bool IllegalFPCMov = !X86ScalarSSE && - MVT::isFloatingPoint(Op.getValueType()) && + bool IllegalFPCMov = + ! ((X86ScalarSSEf32 && Op.getValueType()==MVT::f32) || + (X86ScalarSSEf64 && Op.getValueType()==MVT::f64)) && !hasFPCMov(cast(CC)->getSignExtended()); if ((Opc == X86ISD::CMP || Opc == X86ISD::COMI || Opc == X86ISD::UCOMI) && !IllegalFPCMov) { Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=42246&r1=42245&r2=42246&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Sun Sep 23 09:52:20 2007 @@ -373,8 +373,12 @@ /// X86StackPtr - X86 physical register used as stack ptr. unsigned X86StackPtr; - /// X86ScalarSSE - Select between SSE2 or x87 floating point ops. - bool X86ScalarSSE; + /// X86ScalarSSEf32, X86ScalarSSEf64 - Select between SSE or x87 + /// floating point ops. + /// When SSE is available, use it for f32 operations. + /// When SSE2 is available, use it for f64 operations. + bool X86ScalarSSEf32; + bool X86ScalarSSEf64; SDNode *LowerCallResult(SDOperand Chain, SDOperand InFlag, SDNode*TheCall, unsigned CallingConv, SelectionDAG &DAG); Modified: llvm/trunk/lib/Target/X86/X86InstrFPStack.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFPStack.td?rev=42246&r1=42245&r2=42246&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFPStack.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFPStack.td Sun Sep 23 09:52:20 2007 @@ -152,30 +152,33 @@ [(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_ -// not this predicate. -class FpI pattern> : - FpI_, Requires<[FPStack]>; +// FpIf32, FpIf64 - Floating Point Psuedo Instruction template. +// f32 instructions can use SSE1 and are predicated on FPStackf32 == !SSE1. +// f64 instructions can use SSE2 and are predicated on FPStackf64 == !SSE2. +// f80 instructions cannot use SSE and use neither of these. +class FpIf32 pattern> : + FpI_, Requires<[FPStackf32]>; +class FpIf64 pattern> : + FpI_, Requires<[FPStackf64]>; // Register copies. Just copies, the shortening ones do not truncate. -def MOV_Fp3232 : FpI<(outs RFP32:$dst), (ins RFP32:$src), SpecialFP, []>; -def MOV_Fp3264 : FpI<(outs RFP64:$dst), (ins RFP32:$src), SpecialFP, []>; -def MOV_Fp6432 : FpI<(outs RFP32:$dst), (ins RFP64:$src), SpecialFP, []>; -def MOV_Fp6464 : FpI<(outs RFP64:$dst), (ins RFP64:$src), SpecialFP, []>; -def MOV_Fp8032 : FpI<(outs RFP32:$dst), (ins RFP80:$src), SpecialFP, []>; -def MOV_Fp3280 : FpI<(outs RFP80:$dst), (ins RFP32:$src), SpecialFP, []>; -def MOV_Fp8064 : FpI<(outs RFP64:$dst), (ins RFP80:$src), SpecialFP, []>; -def MOV_Fp6480 : FpI<(outs RFP80:$dst), (ins RFP64:$src), SpecialFP, []>; +def MOV_Fp3232 : FpIf32<(outs RFP32:$dst), (ins RFP32:$src), SpecialFP, []>; +def MOV_Fp3264 : FpIf32<(outs RFP64:$dst), (ins RFP32:$src), SpecialFP, []>; +def MOV_Fp6432 : FpIf32<(outs RFP32:$dst), (ins RFP64:$src), SpecialFP, []>; +def MOV_Fp6464 : FpIf64<(outs RFP64:$dst), (ins RFP64:$src), SpecialFP, []>; +def MOV_Fp8032 : FpIf32<(outs RFP32:$dst), (ins RFP80:$src), SpecialFP, []>; +def MOV_Fp3280 : FpIf32<(outs RFP80:$dst), (ins RFP32:$src), SpecialFP, []>; +def MOV_Fp8064 : FpIf64<(outs RFP64:$dst), (ins RFP80:$src), SpecialFP, []>; +def MOV_Fp6480 : FpIf64<(outs RFP80:$dst), (ins RFP64:$src), SpecialFP, []>; def MOV_Fp8080 : FpI_<(outs RFP80:$dst), (ins RFP80:$src), SpecialFP, []>; // Factoring for arithmetic. multiclass FPBinary_rr { // Register op register -> register // These are separated out because they have no reversed form. -def _Fp32 : FpI<(outs RFP32:$dst), (ins RFP32:$src1, RFP32:$src2), TwoArgFP, +def _Fp32 : FpIf32<(outs RFP32:$dst), (ins RFP32:$src1, RFP32:$src2), TwoArgFP, [(set RFP32:$dst, (OpNode RFP32:$src1, RFP32:$src2))]>; -def _Fp64 : FpI<(outs RFP64:$dst), (ins RFP64:$src1, RFP64:$src2), TwoArgFP, +def _Fp64 : FpIf64<(outs RFP64:$dst), (ins RFP64:$src1, RFP64:$src2), TwoArgFP, [(set RFP64:$dst, (OpNode RFP64:$src1, RFP64:$src2))]>; def _Fp80 : FpI_<(outs RFP80:$dst), (ins RFP80:$src1, RFP80:$src2), TwoArgFP, [(set RFP80:$dst, (OpNode RFP80:$src1, RFP80:$src2))]>; @@ -185,13 +188,13 @@ // These instructions cannot address 80-bit memory. multiclass FPBinary { // ST(0) = ST(0) + [mem] -def _Fp32m : FpI<(outs RFP32:$dst), (ins RFP32:$src1, f32mem:$src2), OneArgFPRW, +def _Fp32m : FpIf32<(outs RFP32:$dst), (ins RFP32:$src1, f32mem:$src2), OneArgFPRW, [(set RFP32:$dst, (OpNode RFP32:$src1, (loadf32 addr:$src2)))]>; -def _Fp64m : FpI<(outs RFP64:$dst), (ins RFP64:$src1, f64mem:$src2), OneArgFPRW, +def _Fp64m : FpIf64<(outs RFP64:$dst), (ins RFP64:$src1, f64mem:$src2), OneArgFPRW, [(set RFP64:$dst, (OpNode RFP64:$src1, (loadf64 addr:$src2)))]>; -def _Fp64m32: FpI<(outs RFP64:$dst), (ins RFP64:$src1, f32mem:$src2), OneArgFPRW, +def _Fp64m32: FpIf64<(outs RFP64:$dst), (ins RFP64:$src1, f32mem:$src2), OneArgFPRW, [(set RFP64:$dst, (OpNode RFP64:$src1, (f64 (extloadf32 addr:$src2))))]>; def _Fp80m32: FpI_<(outs RFP80:$dst), (ins RFP80:$src1, f32mem:$src2), OneArgFPRW, @@ -205,16 +208,16 @@ def _F64m : FPI<0xDC, fp, (outs), (ins f64mem:$src), !strconcat("f", !strconcat(asmstring, "{l}\t$src"))>; // ST(0) = ST(0) + [memint] -def _FpI16m32 : FpI<(outs RFP32:$dst), (ins RFP32:$src1, i16mem:$src2), OneArgFPRW, +def _FpI16m32 : FpIf32<(outs RFP32:$dst), (ins RFP32:$src1, i16mem:$src2), OneArgFPRW, [(set RFP32:$dst, (OpNode RFP32:$src1, (X86fild addr:$src2, i16)))]>; -def _FpI32m32 : FpI<(outs RFP32:$dst), (ins RFP32:$src1, i32mem:$src2), OneArgFPRW, +def _FpI32m32 : FpIf32<(outs RFP32:$dst), (ins RFP32:$src1, i32mem:$src2), OneArgFPRW, [(set RFP32:$dst, (OpNode RFP32:$src1, (X86fild addr:$src2, i32)))]>; -def _FpI16m64 : FpI<(outs RFP64:$dst), (ins RFP64:$src1, i16mem:$src2), OneArgFPRW, +def _FpI16m64 : FpIf64<(outs RFP64:$dst), (ins RFP64:$src1, i16mem:$src2), OneArgFPRW, [(set RFP64:$dst, (OpNode RFP64:$src1, (X86fild addr:$src2, i16)))]>; -def _FpI32m64 : FpI<(outs RFP64:$dst), (ins RFP64:$src1, i32mem:$src2), OneArgFPRW, +def _FpI32m64 : FpIf64<(outs RFP64:$dst), (ins RFP64:$src1, i32mem:$src2), OneArgFPRW, [(set RFP64:$dst, (OpNode RFP64:$src1, (X86fild addr:$src2, i32)))]>; def _FpI16m80 : FpI_<(outs RFP80:$dst), (ins RFP80:$src1, i16mem:$src2), OneArgFPRW, @@ -271,9 +274,9 @@ // Unary operations. multiclass FPUnary opcode, string asmstring> { -def _Fp32 : FpI<(outs RFP32:$dst), (ins RFP32:$src), OneArgFPRW, +def _Fp32 : FpIf32<(outs RFP32:$dst), (ins RFP32:$src), OneArgFPRW, [(set RFP32:$dst, (OpNode RFP32:$src))]>; -def _Fp64 : FpI<(outs RFP64:$dst), (ins RFP64:$src), OneArgFPRW, +def _Fp64 : FpIf64<(outs RFP64:$dst), (ins RFP64:$src), OneArgFPRW, [(set RFP64:$dst, (OpNode RFP64:$src))]>; def _Fp80 : FpI_<(outs RFP80:$dst), (ins RFP80:$src), OneArgFPRW, [(set RFP80:$dst, (OpNode RFP80:$src))]>; @@ -286,9 +289,9 @@ defm SIN : FPUnary; defm COS : FPUnary; -def TST_Fp32 : FpI<(outs), (ins RFP32:$src), OneArgFP, +def TST_Fp32 : FpIf32<(outs), (ins RFP32:$src), OneArgFP, []>; -def TST_Fp64 : FpI<(outs), (ins RFP64:$src), OneArgFP, +def TST_Fp64 : FpIf64<(outs), (ins RFP64:$src), OneArgFP, []>; def TST_Fp80 : FpI_<(outs), (ins RFP80:$src), OneArgFP, []>; @@ -296,10 +299,10 @@ // Floating point cmovs. multiclass FPCMov { - def _Fp32 : FpI<(outs RFP32:$dst), (ins RFP32:$src1, RFP32:$src2), CondMovFP, + def _Fp32 : FpIf32<(outs RFP32:$dst), (ins RFP32:$src1, RFP32:$src2), CondMovFP, [(set RFP32:$dst, (X86cmov RFP32:$src1, RFP32:$src2, cc))]>; - def _Fp64 : FpI<(outs RFP64:$dst), (ins RFP64:$src1, RFP64:$src2), CondMovFP, + def _Fp64 : FpIf64<(outs RFP64:$dst), (ins RFP64:$src1, RFP64:$src2), CondMovFP, [(set RFP64:$dst, (X86cmov RFP64:$src1, RFP64:$src2, cc))]>; def _Fp80 : FpI_<(outs RFP80:$dst), (ins RFP80:$src1, RFP80:$src2), CondMovFP, @@ -337,30 +340,30 @@ // Floating point loads & stores. let isLoad = 1 in { -def LD_Fp32m : FpI<(outs RFP32:$dst), (ins f32mem:$src), ZeroArgFP, +def LD_Fp32m : FpIf32<(outs RFP32:$dst), (ins f32mem:$src), ZeroArgFP, [(set RFP32:$dst, (loadf32 addr:$src))]>; -def LD_Fp64m : FpI<(outs RFP64:$dst), (ins f64mem:$src), ZeroArgFP, +def LD_Fp64m : FpIf64<(outs RFP64:$dst), (ins f64mem:$src), ZeroArgFP, [(set RFP64:$dst, (loadf64 addr:$src))]>; def LD_Fp80m : FpI_<(outs RFP80:$dst), (ins f80mem:$src), ZeroArgFP, [(set RFP80:$dst, (loadf80 addr:$src))]>; } -def LD_Fp32m64 : FpI<(outs RFP64:$dst), (ins f32mem:$src), ZeroArgFP, +def LD_Fp32m64 : FpIf64<(outs RFP64:$dst), (ins f32mem:$src), ZeroArgFP, [(set RFP64:$dst, (f64 (extloadf32 addr:$src)))]>; def LD_Fp64m80 : FpI_<(outs RFP80:$dst), (ins f64mem:$src), ZeroArgFP, [(set RFP80:$dst, (f80 (extloadf64 addr:$src)))]>; def LD_Fp32m80 : FpI_<(outs RFP80:$dst), (ins f32mem:$src), ZeroArgFP, [(set RFP80:$dst, (f80 (extloadf32 addr:$src)))]>; -def ILD_Fp16m32: FpI<(outs RFP32:$dst), (ins i16mem:$src), ZeroArgFP, +def ILD_Fp16m32: FpIf32<(outs RFP32:$dst), (ins i16mem:$src), ZeroArgFP, [(set RFP32:$dst, (X86fild addr:$src, i16))]>; -def ILD_Fp32m32: FpI<(outs RFP32:$dst), (ins i32mem:$src), ZeroArgFP, +def ILD_Fp32m32: FpIf32<(outs RFP32:$dst), (ins i32mem:$src), ZeroArgFP, [(set RFP32:$dst, (X86fild addr:$src, i32))]>; -def ILD_Fp64m32: FpI<(outs RFP32:$dst), (ins i64mem:$src), ZeroArgFP, +def ILD_Fp64m32: FpIf32<(outs RFP32:$dst), (ins i64mem:$src), ZeroArgFP, [(set RFP32:$dst, (X86fild addr:$src, i64))]>; -def ILD_Fp16m64: FpI<(outs RFP64:$dst), (ins i16mem:$src), ZeroArgFP, +def ILD_Fp16m64: FpIf64<(outs RFP64:$dst), (ins i16mem:$src), ZeroArgFP, [(set RFP64:$dst, (X86fild addr:$src, i16))]>; -def ILD_Fp32m64: FpI<(outs RFP64:$dst), (ins i32mem:$src), ZeroArgFP, +def ILD_Fp32m64: FpIf64<(outs RFP64:$dst), (ins i32mem:$src), ZeroArgFP, [(set RFP64:$dst, (X86fild addr:$src, i32))]>; -def ILD_Fp64m64: FpI<(outs RFP64:$dst), (ins i64mem:$src), ZeroArgFP, +def ILD_Fp64m64: FpIf64<(outs RFP64:$dst), (ins i64mem:$src), ZeroArgFP, [(set RFP64:$dst, (X86fild addr:$src, i64))]>; def ILD_Fp16m80: FpI_<(outs RFP80:$dst), (ins i16mem:$src), ZeroArgFP, [(set RFP80:$dst, (X86fild addr:$src, i16))]>; @@ -369,11 +372,11 @@ def ILD_Fp64m80: FpI_<(outs RFP80:$dst), (ins i64mem:$src), ZeroArgFP, [(set RFP80:$dst, (X86fild addr:$src, i64))]>; -def ST_Fp32m : FpI<(outs), (ins f32mem:$op, RFP32:$src), OneArgFP, +def ST_Fp32m : FpIf32<(outs), (ins f32mem:$op, RFP32:$src), OneArgFP, [(store RFP32:$src, addr:$op)]>; -def ST_Fp64m32 : FpI<(outs), (ins f32mem:$op, RFP64:$src), OneArgFP, +def ST_Fp64m32 : FpIf64<(outs), (ins f32mem:$op, RFP64:$src), OneArgFP, [(truncstoref32 RFP64:$src, addr:$op)]>; -def ST_Fp64m : FpI<(outs), (ins f64mem:$op, RFP64:$src), OneArgFP, +def ST_Fp64m : FpIf64<(outs), (ins f64mem:$op, RFP64:$src), OneArgFP, [(store RFP64:$src, addr:$op)]>; def ST_Fp80m32 : FpI_<(outs), (ins f32mem:$op, RFP80:$src), OneArgFP, [(truncstoref32 RFP80:$src, addr:$op)]>; @@ -381,19 +384,19 @@ [(truncstoref64 RFP80:$src, addr:$op)]>; // FST does not support 80-bit memory target; FSTP must be used. -def ST_FpP32m : FpI<(outs), (ins f32mem:$op, RFP32:$src), OneArgFP, []>; -def ST_FpP64m32 : FpI<(outs), (ins f32mem:$op, RFP64:$src), OneArgFP, []>; -def ST_FpP64m : FpI<(outs), (ins f64mem:$op, RFP64:$src), OneArgFP, []>; -def ST_FpP80m32 : FpI<(outs), (ins f32mem:$op, RFP80:$src), OneArgFP, []>; -def ST_FpP80m64 : FpI<(outs), (ins f64mem:$op, RFP80:$src), OneArgFP, []>; +def ST_FpP32m : FpIf32<(outs), (ins f32mem:$op, RFP32:$src), OneArgFP, []>; +def ST_FpP64m32 : FpIf64<(outs), (ins f32mem:$op, RFP64:$src), OneArgFP, []>; +def ST_FpP64m : FpIf64<(outs), (ins f64mem:$op, RFP64:$src), OneArgFP, []>; +def ST_FpP80m32 : FpI_<(outs), (ins f32mem:$op, RFP80:$src), OneArgFP, []>; +def ST_FpP80m64 : FpI_<(outs), (ins f64mem:$op, RFP80:$src), OneArgFP, []>; def ST_FpP80m : FpI_<(outs), (ins f80mem:$op, RFP80:$src), OneArgFP, [(store RFP80:$src, addr:$op)]>; -def IST_Fp16m32 : FpI<(outs), (ins i16mem:$op, RFP32:$src), OneArgFP, []>; -def IST_Fp32m32 : FpI<(outs), (ins i32mem:$op, RFP32:$src), OneArgFP, []>; -def IST_Fp64m32 : FpI<(outs), (ins i64mem:$op, RFP32:$src), OneArgFP, []>; -def IST_Fp16m64 : FpI<(outs), (ins i16mem:$op, RFP64:$src), OneArgFP, []>; -def IST_Fp32m64 : FpI<(outs), (ins i32mem:$op, RFP64:$src), OneArgFP, []>; -def IST_Fp64m64 : FpI<(outs), (ins i64mem:$op, RFP64:$src), OneArgFP, []>; +def IST_Fp16m32 : FpIf32<(outs), (ins i16mem:$op, RFP32:$src), OneArgFP, []>; +def IST_Fp32m32 : FpIf32<(outs), (ins i32mem:$op, RFP32:$src), OneArgFP, []>; +def IST_Fp64m32 : FpIf32<(outs), (ins i64mem:$op, RFP32:$src), OneArgFP, []>; +def IST_Fp16m64 : FpIf64<(outs), (ins i16mem:$op, RFP64:$src), OneArgFP, []>; +def IST_Fp32m64 : FpIf64<(outs), (ins i32mem:$op, RFP64:$src), OneArgFP, []>; +def IST_Fp64m64 : FpIf64<(outs), (ins i64mem:$op, RFP64:$src), OneArgFP, []>; def IST_Fp16m80 : FpI_<(outs), (ins i16mem:$op, RFP80:$src), OneArgFP, []>; def IST_Fp32m80 : FpI_<(outs), (ins i32mem:$op, RFP80:$src), OneArgFP, []>; def IST_Fp64m80 : FpI_<(outs), (ins i64mem:$op, RFP80:$src), OneArgFP, []>; @@ -456,13 +459,13 @@ // Floating point constant loads. let isReMaterializable = 1 in { -def LD_Fp032 : FpI<(outs RFP32:$dst), (ins), ZeroArgFP, +def LD_Fp032 : FpIf32<(outs RFP32:$dst), (ins), ZeroArgFP, [(set RFP32:$dst, fpimm0)]>; -def LD_Fp132 : FpI<(outs RFP32:$dst), (ins), ZeroArgFP, +def LD_Fp132 : FpIf32<(outs RFP32:$dst), (ins), ZeroArgFP, [(set RFP32:$dst, fpimm1)]>; -def LD_Fp064 : FpI<(outs RFP64:$dst), (ins), ZeroArgFP, +def LD_Fp064 : FpIf64<(outs RFP64:$dst), (ins), ZeroArgFP, [(set RFP64:$dst, fpimm0)]>; -def LD_Fp164 : FpI<(outs RFP64:$dst), (ins), ZeroArgFP, +def LD_Fp164 : FpIf64<(outs RFP64:$dst), (ins), ZeroArgFP, [(set RFP64:$dst, fpimm1)]>; def LD_Fp080 : FpI_<(outs RFP80:$dst), (ins), ZeroArgFP, [(set RFP80:$dst, fpimm0)]>; @@ -475,13 +478,13 @@ // Floating point compares. -def UCOM_Fpr32 : FpI<(outs), (ins RFP32:$lhs, RFP32:$rhs), CompareFP, +def UCOM_Fpr32 : FpIf32<(outs), (ins RFP32:$lhs, RFP32:$rhs), CompareFP, []>; // FPSW = cmp ST(0) with ST(i) -def UCOM_FpIr32: FpI<(outs), (ins RFP32:$lhs, RFP32:$rhs), CompareFP, +def UCOM_FpIr32: FpIf32<(outs), (ins RFP32:$lhs, RFP32:$rhs), CompareFP, [(X86cmp RFP32:$lhs, RFP32:$rhs)]>; // CC = ST(0) cmp ST(i) -def UCOM_Fpr64 : FpI<(outs), (ins RFP64:$lhs, RFP64:$rhs), CompareFP, +def UCOM_Fpr64 : FpIf64<(outs), (ins RFP64:$lhs, RFP64:$rhs), CompareFP, []>; // FPSW = cmp ST(0) with ST(i) -def UCOM_FpIr64: FpI<(outs), (ins RFP64:$lhs, RFP64:$rhs), CompareFP, +def UCOM_FpIr64: FpIf64<(outs), (ins RFP64:$lhs, RFP64:$rhs), CompareFP, [(X86cmp RFP64:$lhs, RFP64:$rhs)]>; // CC = ST(0) cmp ST(i) def UCOM_Fpr80 : FpI_<(outs), (ins RFP80:$lhs, RFP80:$rhs), CompareFP, []>; // FPSW = cmp ST(0) with ST(i) @@ -535,16 +538,16 @@ def : Pat<(X86fst RFP80:$src, addr:$op, f80), (ST_FpP80m addr:$op, RFP80:$src)>; // Floating point constant -0.0 and -1.0 -def : Pat<(f32 fpimmneg0), (CHS_Fp32 (LD_Fp032))>, Requires<[FPStack]>; -def : Pat<(f32 fpimmneg1), (CHS_Fp32 (LD_Fp132))>, Requires<[FPStack]>; -def : Pat<(f64 fpimmneg0), (CHS_Fp64 (LD_Fp064))>, Requires<[FPStack]>; -def : Pat<(f64 fpimmneg1), (CHS_Fp64 (LD_Fp164))>, Requires<[FPStack]>; +def : Pat<(f32 fpimmneg0), (CHS_Fp32 (LD_Fp032))>, Requires<[FPStackf32]>; +def : Pat<(f32 fpimmneg1), (CHS_Fp32 (LD_Fp132))>, Requires<[FPStackf32]>; +def : Pat<(f64 fpimmneg0), (CHS_Fp64 (LD_Fp064))>, Requires<[FPStackf64]>; +def : Pat<(f64 fpimmneg1), (CHS_Fp64 (LD_Fp164))>, Requires<[FPStackf64]>; def : Pat<(f80 fpimmneg0), (CHS_Fp80 (LD_Fp080))>; def : Pat<(f80 fpimmneg1), (CHS_Fp80 (LD_Fp180))>; // Used to conv. i64 to f64 since there isn't a SSE version. def : Pat<(X86fildflag addr:$src, i64), (ILD_Fp64m64 addr:$src)>; -def : Pat<(f64 (fextend RFP32:$src)), (MOV_Fp3264 RFP32:$src)>, Requires<[FPStack]>; -def : Pat<(f80 (fextend RFP32:$src)), (MOV_Fp3280 RFP32:$src)>, Requires<[FPStack]>; -def : Pat<(f80 (fextend RFP64:$src)), (MOV_Fp6480 RFP64:$src)>, Requires<[FPStack]>; +def : Pat<(f64 (fextend RFP32:$src)), (MOV_Fp3264 RFP32:$src)>, Requires<[FPStackf32]>; +def : Pat<(f80 (fextend RFP32:$src)), (MOV_Fp3280 RFP32:$src)>, Requires<[FPStackf32]>; +def : Pat<(f80 (fextend RFP64:$src)), (MOV_Fp6480 RFP64:$src)>, Requires<[FPStackf64]>; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=42246&r1=42245&r2=42246&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Sun Sep 23 09:52:20 2007 @@ -160,7 +160,8 @@ def HasSSE2 : Predicate<"Subtarget->hasSSE2()">; def HasSSE3 : Predicate<"Subtarget->hasSSE3()">; def HasSSSE3 : Predicate<"Subtarget->hasSSSE3()">; -def FPStack : Predicate<"!Subtarget->hasSSE2()">; +def FPStackf32 : Predicate<"!Subtarget->hasSSE1()">; +def FPStackf64 : Predicate<"!Subtarget->hasSSE2()">; def In32BitMode : Predicate<"!Subtarget->is64Bit()">; def In64BitMode : Predicate<"Subtarget->is64Bit()">; def HasLow4G : Predicate<"Subtarget->hasLow4GUserSpaceAddress()">; Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=42246&r1=42245&r2=42246&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Sun Sep 23 09:52:20 2007 @@ -50,7 +50,7 @@ Requires<[HasSSE1]>; def IMPLICIT_DEF_FR32 : I<0, Pseudo, (outs FR32:$dst), (ins), "#IMPLICIT_DEF $dst", - [(set FR32:$dst, (undef))]>, Requires<[HasSSE2]>; + [(set FR32:$dst, (undef))]>, Requires<[HasSSE1]>; def IMPLICIT_DEF_FR64 : I<0, Pseudo, (outs FR64:$dst), (ins), "#IMPLICIT_DEF $dst", [(set FR64:$dst, (undef))]>, Requires<[HasSSE2]>; From dalej at apple.com Sun Sep 23 09:58:15 2007 From: dalej at apple.com (Dale Johannesen) Date: Sun, 23 Sep 2007 14:58:15 -0000 Subject: [llvm-commits] [llvm] r42247 - /llvm/trunk/test/CodeGen/X86/fabs.ll Message-ID: <200709231458.l8NEwFsH007606@zion.cs.uiuc.edu> Author: johannes Date: Sun Sep 23 09:58:14 2007 New Revision: 42247 URL: http://llvm.org/viewvc/llvm-project?rev=42247&view=rev Log: Implementation of +sse -sse2 has changed; add -sse to preserve intent of this test. Modified: llvm/trunk/test/CodeGen/X86/fabs.ll Modified: llvm/trunk/test/CodeGen/X86/fabs.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fabs.ll?rev=42247&r1=42246&r2=42247&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/fabs.ll (original) +++ llvm/trunk/test/CodeGen/X86/fabs.ll Sun Sep 23 09:58:14 2007 @@ -1,8 +1,8 @@ ; Make sure this testcase codegens to the fabs instruction, not a call to fabsf -; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=-sse2,-sse3 | \ +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=-sse2,-sse3,-sse | \ ; RUN: grep fabs\$ | count 1 ; RUN: llvm-upgrade < %s | llvm-as | \ -; RUN: llc -march=x86 -mattr=-sse2,-sse3 -enable-unsafe-fp-math | \ +; RUN: llc -march=x86 -mattr=-sse,-sse2,-sse3 -enable-unsafe-fp-math | \ ; RUN: grep fabs\$ | count 2 target endian = little From clattner at apple.com Sun Sep 23 13:39:33 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 23 Sep 2007 11:39:33 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r42134 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <92C73088-FB80-4337-817A-759CF0AC80DD@apple.com> References: <200709191431.l8JEVjsH013695@zion.cs.uiuc.edu> <200709191634.31491.baldrick@free.fr> <47B22360-914E-42B1-AE74-07B238D11522@apple.com> <200709191646.19272.baldrick@free.fr> <92C73088-FB80-4337-817A-759CF0AC80DD@apple.com> Message-ID: <9953485F-A442-46AD-B296-722B1260B6E1@apple.com> On Sep 19, 2007, at 7:51 AM, Dale Johannesen wrote: > On Sep 19, 2007, at 7:46 AM, Duncan Sands wrote: >>> Code downstream, starting with EmitBuiltinUnaryFPOp, is not ready >>> for >>> long double functions. This is not the best or a permanent fix, but >>> correct for the moment. >> >> I see - thanks. By the way, how do you plan to handle constant >> folding of sqrt and friends when the host doesn't handle long >> doubles? > > It can be done by emulation in APFloat, but it's not a high priority > for me (I'm not a numerics expert, but this is the sort of thing you > can look up). In the short term that just won't be done. To elaborate a bit more: one of the nice features of APFloat is that we never do FP constant folding with host arithmetic operations (everything is done with 'softfloat'). This ensures we get deterministic results, as powerpc long double and x86 long double are very different. We also do this for float and double since they have similar problems (just not on any architectures we support now) so we might as well handle them for uniformity and to make sure the code is well tested. One problem Dale: @@ -4350,9 +4351,10 @@ + case BUILT_IN_POWIL: + return false; // treat long double as normal call case BUILT_IN_POWI: case BUILT_IN_POWIF: - case BUILT_IN_POWIL: Result = EmitBuiltinPOWI(exp); return true; I don't think this works. There is no "powil" function for llvm-gcc to fall back on. Not handling this builtin will result in a call to __builtin_powil, which will fail at link-time. I had to handle these explicitly here because "fold" produces these operations in some cases. Try long double X*X*X with -ffast-math. -Chris From resistor at mac.com Sun Sep 23 16:31:45 2007 From: resistor at mac.com (Owen Anderson) Date: Sun, 23 Sep 2007 21:31:45 -0000 Subject: [llvm-commits] [llvm] r42248 - in /llvm/trunk: include/llvm/Analysis/Dominators.h include/llvm/Analysis/PostDominators.h lib/VMCore/DominatorCalculation.h lib/VMCore/Dominators.cpp Message-ID: <200709232131.l8NLVj7d021367@zion.cs.uiuc.edu> Author: resistor Date: Sun Sep 23 16:31:44 2007 New Revision: 42248 URL: http://llvm.org/viewvc/llvm-project?rev=42248&view=rev Log: Factor the dominator tree calculation details out into DominatorCalculation.h. This change is not useful in and of itself, but it lays the groundwork for combining the dominator and postdominator implementations. Also, factor a few methods that are common to DominatorTree and PostDominatorTree into DominatorTreeBase. Again, this will make merging the two calculation methods simpler in the future. Added: llvm/trunk/lib/VMCore/DominatorCalculation.h Modified: llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/include/llvm/Analysis/PostDominators.h llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=42248&r1=42247&r2=42248&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Sun Sep 23 16:31:44 2007 @@ -129,6 +129,7 @@ // Info - Collection of information used during the computation of idoms. DenseMap Info; + unsigned DFSPass(BasicBlock *V, unsigned N); public: DominatorTreeBase(intptr_t ID, bool isPostDom) @@ -278,6 +279,13 @@ /// updateDFSNumbers - Assign In and Out numbers to the nodes while walking /// dominator tree in dfs order. void updateDFSNumbers(); + + DomTreeNode *getNodeForBlock(BasicBlock *BB); + + inline BasicBlock *getIDom(BasicBlock *BB) const { + DenseMap::const_iterator I = IDoms.find(BB); + return I != IDoms.end() ? I->second : 0; + } }; //===------------------------------------- @@ -304,17 +312,13 @@ /// BB is split and now it has one successor. Update dominator tree to /// reflect this change. void splitBlock(BasicBlock *BB); + private: - void calculate(Function& F); - DomTreeNode *getNodeForBlock(BasicBlock *BB); - unsigned DFSPass(BasicBlock *V, unsigned N); - void Compress(BasicBlock *V); - BasicBlock *Eval(BasicBlock *v); - void Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo); - inline BasicBlock *getIDom(BasicBlock *BB) const { - DenseMap::const_iterator I = IDoms.find(BB); - return I != IDoms.end() ? I->second : 0; - } + friend void DTcalculate(DominatorTree& DT, Function& F); + friend void DTCompress(DominatorTree& DT, BasicBlock *VIn); + friend BasicBlock *DTEval(DominatorTree& DT, BasicBlock *v); + friend void DTLink(DominatorTree& DT, BasicBlock *V, + BasicBlock *W, InfoRec &WInfo); }; //===------------------------------------- Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=42248&r1=42247&r2=42248&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/PostDominators.h (original) +++ llvm/trunk/include/llvm/Analysis/PostDominators.h Sun Sep 23 16:31:44 2007 @@ -38,16 +38,10 @@ } private: void calculate(Function &F); - DomTreeNode *getNodeForBlock(BasicBlock *BB); unsigned DFSPass(BasicBlock *V, unsigned N); void Compress(BasicBlock *V, InfoRec &VInfo); BasicBlock *Eval(BasicBlock *V); void Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo); - - inline BasicBlock *getIDom(BasicBlock *BB) const { - DenseMap::const_iterator I = IDoms.find(BB); - return I != IDoms.end() ? I->second : 0; - } }; Added: llvm/trunk/lib/VMCore/DominatorCalculation.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/DominatorCalculation.h?rev=42248&view=auto ============================================================================== --- llvm/trunk/lib/VMCore/DominatorCalculation.h (added) +++ llvm/trunk/lib/VMCore/DominatorCalculation.h Sun Sep 23 16:31:44 2007 @@ -0,0 +1,213 @@ +//==- llvm/VMCore/DominatorCalculation.h - Dominator Calculation -*- C++ -*-==// +// +// 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. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_VMCORE_DOMINATOR_CALCULATION_H +#define LLVM_VMCORE_DOMINATOR_CALCULATION_H + +#include "llvm/Analysis/Dominators.h" + +//===----------------------------------------------------------------------===// +// +// DominatorTree construction - This pass constructs immediate dominator +// information for a flow-graph based on the algorithm described in this +// document: +// +// A Fast Algorithm for Finding Dominators in a Flowgraph +// T. Lengauer & R. Tarjan, ACM TOPLAS July 1979, pgs 121-141. +// +// This implements both the O(n*ack(n)) and the O(n*log(n)) versions of EVAL and +// LINK, but it turns out that the theoretically slower O(n*log(n)) +// implementation is actually faster than the "efficient" algorithm (even for +// large CFGs) because the constant overheads are substantially smaller. The +// lower-complexity version can be enabled with the following #define: +// +#define BALANCE_IDOM_TREE 0 +// +//===----------------------------------------------------------------------===// + +namespace llvm { + +void DTCompress(DominatorTree& DT, BasicBlock *VIn) { + + std::vector Work; + SmallPtrSet Visited; + BasicBlock *VInAncestor = DT.Info[VIn].Ancestor; + DominatorTree::InfoRec &VInVAInfo = DT.Info[VInAncestor]; + + if (VInVAInfo.Ancestor != 0) + Work.push_back(VIn); + + while (!Work.empty()) { + BasicBlock *V = Work.back(); + DominatorTree::InfoRec &VInfo = DT.Info[V]; + BasicBlock *VAncestor = VInfo.Ancestor; + DominatorTree::InfoRec &VAInfo = DT.Info[VAncestor]; + + // Process Ancestor first + if (Visited.insert(VAncestor) && + VAInfo.Ancestor != 0) { + Work.push_back(VAncestor); + continue; + } + Work.pop_back(); + + // Update VInfo based on Ancestor info + if (VAInfo.Ancestor == 0) + continue; + BasicBlock *VAncestorLabel = VAInfo.Label; + BasicBlock *VLabel = VInfo.Label; + if (DT.Info[VAncestorLabel].Semi < DT.Info[VLabel].Semi) + VInfo.Label = VAncestorLabel; + VInfo.Ancestor = VAInfo.Ancestor; + } +} + +BasicBlock *DTEval(DominatorTree& DT, BasicBlock *V) { + DominatorTree::InfoRec &VInfo = DT.Info[V]; +#if !BALANCE_IDOM_TREE + // Higher-complexity but faster implementation + if (VInfo.Ancestor == 0) + return V; + DTCompress(DT, V); + return VInfo.Label; +#else + // Lower-complexity but slower implementation + if (VInfo.Ancestor == 0) + return VInfo.Label; + DTCompress(DT, V); + BasicBlock *VLabel = VInfo.Label; + + BasicBlock *VAncestorLabel = DT.Info[VInfo.Ancestor].Label; + if (DT.Info[VAncestorLabel].Semi >= DT.Info[VLabel].Semi) + return VLabel; + else + return VAncestorLabel; +#endif +} + +void DTLink(DominatorTree& DT, BasicBlock *V, BasicBlock *W, + DominatorTree::InfoRec &WInfo) { +#if !BALANCE_IDOM_TREE + // Higher-complexity but faster implementation + WInfo.Ancestor = V; +#else + // Lower-complexity but slower implementation + BasicBlock *WLabel = WInfo.Label; + unsigned WLabelSemi = Info[WLabel].Semi; + BasicBlock *S = W; + InfoRec *SInfo = &Info[S]; + + BasicBlock *SChild = SInfo->Child; + InfoRec *SChildInfo = &Info[SChild]; + + while (WLabelSemi < Info[SChildInfo->Label].Semi) { + BasicBlock *SChildChild = SChildInfo->Child; + if (SInfo->Size+Info[SChildChild].Size >= 2*SChildInfo->Size) { + SChildInfo->Ancestor = S; + SInfo->Child = SChild = SChildChild; + SChildInfo = &Info[SChild]; + } else { + SChildInfo->Size = SInfo->Size; + S = SInfo->Ancestor = SChild; + SInfo = SChildInfo; + SChild = SChildChild; + SChildInfo = &Info[SChild]; + } + } + + InfoRec &VInfo = Info[V]; + SInfo->Label = WLabel; + + assert(V != W && "The optimization here will not work in this case!"); + unsigned WSize = WInfo.Size; + unsigned VSize = (VInfo.Size += WSize); + + if (VSize < 2*WSize) + std::swap(S, VInfo.Child); + + while (S) { + SInfo = &Info[S]; + SInfo->Ancestor = V; + S = SInfo->Child; + } +#endif +} + +void DTcalculate(DominatorTree& DT, Function &F) { + BasicBlock* Root = DT.Roots[0]; + + // Add a node for the root... + DT.DomTreeNodes[Root] = DT.RootNode = new DomTreeNode(Root, 0); + + DT.Vertex.push_back(0); + + // Step #1: Number blocks in depth-first order and initialize variables used + // in later stages of the algorithm. + unsigned N = DT.DFSPass(Root, 0); + + for (unsigned i = N; i >= 2; --i) { + BasicBlock *W = DT.Vertex[i]; + DominatorTree::InfoRec &WInfo = DT.Info[W]; + + // Step #2: Calculate the semidominators of all vertices + for (pred_iterator PI = pred_begin(W), E = pred_end(W); PI != E; ++PI) + if (DT.Info.count(*PI)) { // Only if this predecessor is reachable! + unsigned SemiU = DT.Info[DTEval(DT, *PI)].Semi; + if (SemiU < WInfo.Semi) + WInfo.Semi = SemiU; + } + + DT.Info[DT.Vertex[WInfo.Semi]].Bucket.push_back(W); + + BasicBlock *WParent = WInfo.Parent; + DTLink(DT, WParent, W, WInfo); + + // Step #3: Implicitly define the immediate dominator of vertices + std::vector &WParentBucket = DT.Info[WParent].Bucket; + while (!WParentBucket.empty()) { + BasicBlock *V = WParentBucket.back(); + WParentBucket.pop_back(); + BasicBlock *U = DTEval(DT, V); + DT.IDoms[V] = DT.Info[U].Semi < DT.Info[V].Semi ? U : WParent; + } + } + + // Step #4: Explicitly define the immediate dominator of each vertex + for (unsigned i = 2; i <= N; ++i) { + BasicBlock *W = DT.Vertex[i]; + BasicBlock *&WIDom = DT.IDoms[W]; + if (WIDom != DT.Vertex[DT.Info[W].Semi]) + WIDom = DT.IDoms[WIDom]; + } + + // Loop over all of the reachable blocks in the function... + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) + if (BasicBlock *ImmDom = DT.getIDom(I)) { // Reachable block. + DomTreeNode *BBNode = DT.DomTreeNodes[I]; + if (BBNode) continue; // Haven't calculated this node yet? + + // Get or calculate the node for the immediate dominator + DomTreeNode *IDomNode = DT.getNodeForBlock(ImmDom); + + // Add a new tree node for this BasicBlock, and link it as a child of + // IDomNode + DomTreeNode *C = new DomTreeNode(I, IDomNode); + DT.DomTreeNodes[I] = IDomNode->addChild(C); + } + + // Free temporary memory used to construct idom's + DT.Info.clear(); + DT.IDoms.clear(); + std::vector().swap(DT.Vertex); + + DT.updateDFSNumbers(); +} + +} +#endif \ No newline at end of file Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=42248&r1=42247&r2=42248&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Sun Sep 23 16:31:44 2007 @@ -23,6 +23,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Instructions.h" #include "llvm/Support/Streams.h" +#include "DominatorCalculation.h" #include using namespace llvm; @@ -43,20 +44,8 @@ // DominatorTree Implementation //===----------------------------------------------------------------------===// // -// DominatorTree construction - This pass constructs immediate dominator -// information for a flow-graph based on the algorithm described in this -// document: -// -// A Fast Algorithm for Finding Dominators in a Flowgraph -// T. Lengauer & R. Tarjan, ACM TOPLAS July 1979, pgs 121-141. -// -// This implements both the O(n*ack(n)) and the O(n*log(n)) versions of EVAL and -// LINK, but it turns out that the theoretically slower O(n*log(n)) -// implementation is actually faster than the "efficient" algorithm (even for -// large CFGs) because the constant overheads are substantially smaller. The -// lower-complexity version can be enabled with the following #define: -// -#define BALANCE_IDOM_TREE 0 +// Provide public access to DominatorTree information. Implementation details +// can be found in DominatorCalculation.h. // //===----------------------------------------------------------------------===// @@ -64,6 +53,68 @@ static RegisterPass E("domtree", "Dominator Tree Construction", true); +unsigned DominatorTreeBase::DFSPass(BasicBlock *V, unsigned N) { + // This is more understandable as a recursive algorithm, but we can't use the + // recursive algorithm due to stack depth issues. Keep it here for + // documentation purposes. +#if 0 + InfoRec &VInfo = Info[Roots[i]]; + VInfo.Semi = ++N; + VInfo.Label = V; + + Vertex.push_back(V); // Vertex[n] = V; + //Info[V].Ancestor = 0; // Ancestor[n] = 0 + //Info[V].Child = 0; // Child[v] = 0 + VInfo.Size = 1; // Size[v] = 1 + + for (succ_iterator SI = succ_begin(V), E = succ_end(V); SI != E; ++SI) { + InfoRec &SuccVInfo = Info[*SI]; + if (SuccVInfo.Semi == 0) { + SuccVInfo.Parent = V; + N = DFSPass(*SI, N); + } + } +#else + std::vector > Worklist; + Worklist.push_back(std::make_pair(V, 0U)); + while (!Worklist.empty()) { + BasicBlock *BB = Worklist.back().first; + unsigned NextSucc = Worklist.back().second; + + // First time we visited this BB? + if (NextSucc == 0) { + InfoRec &BBInfo = Info[BB]; + BBInfo.Semi = ++N; + BBInfo.Label = BB; + + Vertex.push_back(BB); // Vertex[n] = V; + //BBInfo[V].Ancestor = 0; // Ancestor[n] = 0 + //BBInfo[V].Child = 0; // Child[v] = 0 + BBInfo.Size = 1; // Size[v] = 1 + } + + // If we are done with this block, remove it from the worklist. + if (NextSucc == BB->getTerminator()->getNumSuccessors()) { + Worklist.pop_back(); + continue; + } + + // Otherwise, increment the successor number for the next time we get to it. + ++Worklist.back().second; + + // Visit the successor next, if it isn't already visited. + BasicBlock *Succ = BB->getTerminator()->getSuccessor(NextSucc); + + InfoRec &SuccVInfo = Info[Succ]; + if (SuccVInfo.Semi == 0) { + SuccVInfo.Parent = BB; + Worklist.push_back(std::make_pair(Succ, 0U)); + } + } +#endif + return N; +} + // NewBB is split and now it has one successor. Update dominator tree to // reflect this change. void DominatorTree::splitBlock(BasicBlock *NewBB) { @@ -146,243 +197,6 @@ } } -unsigned DominatorTree::DFSPass(BasicBlock *V, unsigned N) { - // This is more understandable as a recursive algorithm, but we can't use the - // recursive algorithm due to stack depth issues. Keep it here for - // documentation purposes. -#if 0 - InfoRec &VInfo = Info[Roots[i]]; - VInfo.Semi = ++N; - VInfo.Label = V; - - Vertex.push_back(V); // Vertex[n] = V; - //Info[V].Ancestor = 0; // Ancestor[n] = 0 - //Info[V].Child = 0; // Child[v] = 0 - VInfo.Size = 1; // Size[v] = 1 - - for (succ_iterator SI = succ_begin(V), E = succ_end(V); SI != E; ++SI) { - InfoRec &SuccVInfo = Info[*SI]; - if (SuccVInfo.Semi == 0) { - SuccVInfo.Parent = V; - N = DFSPass(*SI, N); - } - } -#else - std::vector > Worklist; - Worklist.push_back(std::make_pair(V, 0U)); - while (!Worklist.empty()) { - BasicBlock *BB = Worklist.back().first; - unsigned NextSucc = Worklist.back().second; - - // First time we visited this BB? - if (NextSucc == 0) { - InfoRec &BBInfo = Info[BB]; - BBInfo.Semi = ++N; - BBInfo.Label = BB; - - Vertex.push_back(BB); // Vertex[n] = V; - //BBInfo[V].Ancestor = 0; // Ancestor[n] = 0 - //BBInfo[V].Child = 0; // Child[v] = 0 - BBInfo.Size = 1; // Size[v] = 1 - } - - // If we are done with this block, remove it from the worklist. - if (NextSucc == BB->getTerminator()->getNumSuccessors()) { - Worklist.pop_back(); - continue; - } - - // Otherwise, increment the successor number for the next time we get to it. - ++Worklist.back().second; - - // Visit the successor next, if it isn't already visited. - BasicBlock *Succ = BB->getTerminator()->getSuccessor(NextSucc); - - InfoRec &SuccVInfo = Info[Succ]; - if (SuccVInfo.Semi == 0) { - SuccVInfo.Parent = BB; - Worklist.push_back(std::make_pair(Succ, 0U)); - } - } -#endif - return N; -} - -void DominatorTree::Compress(BasicBlock *VIn) { - - std::vector Work; - SmallPtrSet Visited; - BasicBlock *VInAncestor = Info[VIn].Ancestor; - InfoRec &VInVAInfo = Info[VInAncestor]; - - if (VInVAInfo.Ancestor != 0) - Work.push_back(VIn); - - while (!Work.empty()) { - BasicBlock *V = Work.back(); - InfoRec &VInfo = Info[V]; - BasicBlock *VAncestor = VInfo.Ancestor; - InfoRec &VAInfo = Info[VAncestor]; - - // Process Ancestor first - if (Visited.insert(VAncestor) && - VAInfo.Ancestor != 0) { - Work.push_back(VAncestor); - continue; - } - Work.pop_back(); - - // Update VInfo based on Ancestor info - if (VAInfo.Ancestor == 0) - continue; - BasicBlock *VAncestorLabel = VAInfo.Label; - BasicBlock *VLabel = VInfo.Label; - if (Info[VAncestorLabel].Semi < Info[VLabel].Semi) - VInfo.Label = VAncestorLabel; - VInfo.Ancestor = VAInfo.Ancestor; - } -} - -BasicBlock *DominatorTree::Eval(BasicBlock *V) { - InfoRec &VInfo = Info[V]; -#if !BALANCE_IDOM_TREE - // Higher-complexity but faster implementation - if (VInfo.Ancestor == 0) - return V; - Compress(V); - return VInfo.Label; -#else - // Lower-complexity but slower implementation - if (VInfo.Ancestor == 0) - return VInfo.Label; - Compress(V); - BasicBlock *VLabel = VInfo.Label; - - BasicBlock *VAncestorLabel = Info[VInfo.Ancestor].Label; - if (Info[VAncestorLabel].Semi >= Info[VLabel].Semi) - return VLabel; - else - return VAncestorLabel; -#endif -} - -void DominatorTree::Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo){ -#if !BALANCE_IDOM_TREE - // Higher-complexity but faster implementation - WInfo.Ancestor = V; -#else - // Lower-complexity but slower implementation - BasicBlock *WLabel = WInfo.Label; - unsigned WLabelSemi = Info[WLabel].Semi; - BasicBlock *S = W; - InfoRec *SInfo = &Info[S]; - - BasicBlock *SChild = SInfo->Child; - InfoRec *SChildInfo = &Info[SChild]; - - while (WLabelSemi < Info[SChildInfo->Label].Semi) { - BasicBlock *SChildChild = SChildInfo->Child; - if (SInfo->Size+Info[SChildChild].Size >= 2*SChildInfo->Size) { - SChildInfo->Ancestor = S; - SInfo->Child = SChild = SChildChild; - SChildInfo = &Info[SChild]; - } else { - SChildInfo->Size = SInfo->Size; - S = SInfo->Ancestor = SChild; - SInfo = SChildInfo; - SChild = SChildChild; - SChildInfo = &Info[SChild]; - } - } - - InfoRec &VInfo = Info[V]; - SInfo->Label = WLabel; - - assert(V != W && "The optimization here will not work in this case!"); - unsigned WSize = WInfo.Size; - unsigned VSize = (VInfo.Size += WSize); - - if (VSize < 2*WSize) - std::swap(S, VInfo.Child); - - while (S) { - SInfo = &Info[S]; - SInfo->Ancestor = V; - S = SInfo->Child; - } -#endif -} - -void DominatorTree::calculate(Function &F) { - BasicBlock* Root = Roots[0]; - - // Add a node for the root... - DomTreeNodes[Root] = RootNode = new DomTreeNode(Root, 0); - - Vertex.push_back(0); - - // Step #1: Number blocks in depth-first order and initialize variables used - // in later stages of the algorithm. - unsigned N = DFSPass(Root, 0); - - for (unsigned i = N; i >= 2; --i) { - BasicBlock *W = Vertex[i]; - InfoRec &WInfo = Info[W]; - - // Step #2: Calculate the semidominators of all vertices - for (pred_iterator PI = pred_begin(W), E = pred_end(W); PI != E; ++PI) - if (Info.count(*PI)) { // Only if this predecessor is reachable! - unsigned SemiU = Info[Eval(*PI)].Semi; - if (SemiU < WInfo.Semi) - WInfo.Semi = SemiU; - } - - Info[Vertex[WInfo.Semi]].Bucket.push_back(W); - - BasicBlock *WParent = WInfo.Parent; - Link(WParent, W, WInfo); - - // Step #3: Implicitly define the immediate dominator of vertices - std::vector &WParentBucket = Info[WParent].Bucket; - while (!WParentBucket.empty()) { - BasicBlock *V = WParentBucket.back(); - WParentBucket.pop_back(); - BasicBlock *U = Eval(V); - IDoms[V] = Info[U].Semi < Info[V].Semi ? U : WParent; - } - } - - // Step #4: Explicitly define the immediate dominator of each vertex - for (unsigned i = 2; i <= N; ++i) { - BasicBlock *W = Vertex[i]; - BasicBlock *&WIDom = IDoms[W]; - if (WIDom != Vertex[Info[W].Semi]) - WIDom = IDoms[WIDom]; - } - - // Loop over all of the reachable blocks in the function... - for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) - if (BasicBlock *ImmDom = getIDom(I)) { // Reachable block. - DomTreeNode *BBNode = DomTreeNodes[I]; - if (BBNode) continue; // Haven't calculated this node yet? - - // Get or calculate the node for the immediate dominator - DomTreeNode *IDomNode = getNodeForBlock(ImmDom); - - // Add a new tree node for this BasicBlock, and link it as a child of - // IDomNode - DomTreeNode *C = new DomTreeNode(I, IDomNode); - DomTreeNodes[I] = IDomNode->addChild(C); - } - - // Free temporary memory used to construct idom's - Info.clear(); - IDoms.clear(); - std::vector().swap(Vertex); - - updateDFSNumbers(); -} - void DominatorTreeBase::updateDFSNumbers() { unsigned DFSNum = 0; @@ -462,6 +276,21 @@ RootNode = 0; } +DomTreeNode *DominatorTreeBase::getNodeForBlock(BasicBlock *BB) { + if (DomTreeNode *BBNode = DomTreeNodes[BB]) + return BBNode; + + // Haven't calculated this node yet? Get or calculate the node for the + // immediate dominator. + BasicBlock *IDom = getIDom(BB); + DomTreeNode *IDomNode = getNodeForBlock(IDom); + + // Add a new tree node for this BasicBlock, and link it as a child of + // IDomNode + DomTreeNode *C = new DomTreeNode(BB, IDomNode); + return DomTreeNodes[BB] = IDomNode->addChild(C); +} + /// findNearestCommonDominator - Find nearest common dominator basic block /// for basic block A and B. If there is no such block then return NULL. BasicBlock *DominatorTreeBase::findNearestCommonDominator(BasicBlock *A, @@ -525,21 +354,6 @@ } } -DomTreeNode *DominatorTree::getNodeForBlock(BasicBlock *BB) { - if (DomTreeNode *BBNode = DomTreeNodes[BB]) - return BBNode; - - // Haven't calculated this node yet? Get or calculate the node for the - // immediate dominator. - BasicBlock *IDom = getIDom(BB); - DomTreeNode *IDomNode = getNodeForBlock(IDom); - - // Add a new tree node for this BasicBlock, and link it as a child of - // IDomNode - DomTreeNode *C = new DomTreeNode(BB, IDomNode); - return DomTreeNodes[BB] = IDomNode->addChild(C); -} - static std::ostream &operator<<(std::ostream &o, const DomTreeNode *Node) { if (Node->getBlock()) WriteAsOperand(o, Node->getBlock(), false); @@ -599,7 +413,7 @@ bool DominatorTree::runOnFunction(Function &F) { reset(); // Reset from the last time we were run... Roots.push_back(&F.getEntryBlock()); - calculate(F); + DTcalculate(*this, F); return false; } From resistor at mac.com Sun Sep 23 16:32:55 2007 From: resistor at mac.com (Owen Anderson) Date: Sun, 23 Sep 2007 21:32:55 -0000 Subject: [llvm-commits] [llvm] r42249 - /llvm/trunk/lib/VMCore/DominatorCalculation.h Message-ID: <200709232132.l8NLWtWm021424@zion.cs.uiuc.edu> Author: resistor Date: Sun Sep 23 16:32:55 2007 New Revision: 42249 URL: http://llvm.org/viewvc/llvm-project?rev=42249&view=rev Log: Fix header. Modified: llvm/trunk/lib/VMCore/DominatorCalculation.h Modified: llvm/trunk/lib/VMCore/DominatorCalculation.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/DominatorCalculation.h?rev=42249&r1=42248&r2=42249&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/DominatorCalculation.h (original) +++ llvm/trunk/lib/VMCore/DominatorCalculation.h Sun Sep 23 16:32:55 2007 @@ -1,4 +1,4 @@ -//==- llvm/VMCore/DominatorCalculation.h - Dominator Calculation -*- C++ -*-==// +//==- DominatorCalculation.h - Dominator Calculation -------------*- C++ -*-==// // // The LLVM Compiler Infrastructure // From dalej at apple.com Sun Sep 23 16:36:33 2007 From: dalej at apple.com (Dale Johannesen) Date: Sun, 23 Sep 2007 14:36:33 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r42134 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: <9953485F-A442-46AD-B296-722B1260B6E1@apple.com> References: <200709191431.l8JEVjsH013695@zion.cs.uiuc.edu> <200709191634.31491.baldrick@free.fr> <47B22360-914E-42B1-AE74-07B238D11522@apple.com> <200709191646.19272.baldrick@free.fr> <92C73088-FB80-4337-817A-759CF0AC80DD@apple.com> <9953485F-A442-46AD-B296-722B1260B6E1@apple.com> Message-ID: On Sep 23, 2007, at 11:39 AM, Chris Lattner wrote: > One problem Dale: > > @@ -4350,9 +4351,10 @@ > + case BUILT_IN_POWIL: > + return false; // treat long double as normal call > case BUILT_IN_POWI: > case BUILT_IN_POWIF: > - case BUILT_IN_POWIL: > Result = EmitBuiltinPOWI(exp); > return true; > > I don't think this works. There is no "powil" function for llvm-gcc > to fall back on. Not handling this builtin will result in a call to > __builtin_powil, which will fail at link-time. I had to handle these > explicitly here because "fold" produces these operations in some > cases. Try long double X*X*X with -ffast-math. You're right. A quick one: is changing the Intrinsics definitions going to affect the bitcode format? From resistor at mac.com Sun Sep 23 17:16:39 2007 From: resistor at mac.com (Owen Anderson) Date: Sun, 23 Sep 2007 22:16:39 -0000 Subject: [llvm-commits] [llvm] r42250 - in /llvm/trunk: include/llvm/Analysis/Dominators.h lib/VMCore/Dominators.cpp Message-ID: <200709232216.l8NMGdU0022829@zion.cs.uiuc.edu> Author: resistor Date: Sun Sep 23 17:16:38 2007 New Revision: 42250 URL: http://llvm.org/viewvc/llvm-project?rev=42250&view=rev Log: Move DFSPass back down into DominatorTree. I need to figure out what the difference is between it and the PostDomTree version first. Modified: llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/lib/VMCore/Dominators.cpp Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=42250&r1=42249&r2=42250&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Sun Sep 23 17:16:38 2007 @@ -129,7 +129,6 @@ // Info - Collection of information used during the computation of idoms. DenseMap Info; - unsigned DFSPass(BasicBlock *V, unsigned N); public: DominatorTreeBase(intptr_t ID, bool isPostDom) @@ -319,6 +318,8 @@ friend BasicBlock *DTEval(DominatorTree& DT, BasicBlock *v); friend void DTLink(DominatorTree& DT, BasicBlock *V, BasicBlock *W, InfoRec &WInfo); + + unsigned DFSPass(BasicBlock *V, unsigned N); }; //===------------------------------------- Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=42250&r1=42249&r2=42250&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Sun Sep 23 17:16:38 2007 @@ -53,7 +53,7 @@ static RegisterPass E("domtree", "Dominator Tree Construction", true); -unsigned DominatorTreeBase::DFSPass(BasicBlock *V, unsigned N) { +unsigned DominatorTree::DFSPass(BasicBlock *V, unsigned N) { // This is more understandable as a recursive algorithm, but we can't use the // recursive algorithm due to stack depth issues. Keep it here for // documentation purposes. From clattner at apple.com Sun Sep 23 17:16:40 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 23 Sep 2007 15:16:40 -0700 Subject: [llvm-commits] [llvm-gcc-4.0] r42134 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp In-Reply-To: References: <200709191431.l8JEVjsH013695@zion.cs.uiuc.edu> <200709191634.31491.baldrick@free.fr> <47B22360-914E-42B1-AE74-07B238D11522@apple.com> <200709191646.19272.baldrick@free.fr> <92C73088-FB80-4337-817A-759CF0AC80DD@apple.com> <9953485F-A442-46AD-B296-722B1260B6E1@apple.com> Message-ID: On Sep 23, 2007, at 2:36 PM, Dale Johannesen wrote: > > On Sep 23, 2007, at 11:39 AM, Chris Lattner wrote: >> One problem Dale: >> >> @@ -4350,9 +4351,10 @@ >> + case BUILT_IN_POWIL: >> + return false; // treat long double as normal call >> case BUILT_IN_POWI: >> case BUILT_IN_POWIF: >> - case BUILT_IN_POWIL: >> Result = EmitBuiltinPOWI(exp); >> return true; >> >> I don't think this works. There is no "powil" function for llvm-gcc >> to fall back on. Not handling this builtin will result in a call to >> __builtin_powil, which will fail at link-time. I had to handle these >> explicitly here because "fold" produces these operations in some >> cases. Try long double X*X*X with -ffast-math. > > You're right. A quick one: is changing the Intrinsics definitions > going to affect the bitcode format? It depends on how you change it. One thing that you may be able to do is change this: let Properties = [IntrNoMem] in { .. def int_powi_f32 : Intrinsic<[llvm_float_ty, llvm_float_ty, llvm_i32_ty]>; def int_powi_f64 : Intrinsic<[llvm_double_ty, llvm_double_ty, llvm_i32_ty]>; } to: let Properties = [IntrNoMem] in { .. def int_powi : Intrinsic<[llvm_anyfloat_ty, LLVMMatchType<0>, llvm_i32_ty]>; } I don't think this changes the .ll or .bc syntax for f32/f64, but allows any fp type to be used with powi. Calls to Intrinsic::getDeclaration(powi) will have to change though. -Chris From resistor at mac.com Sun Sep 23 17:21:01 2007 From: resistor at mac.com (Owen Anderson) Date: Sun, 23 Sep 2007 22:21:01 -0000 Subject: [llvm-commits] [llvm] r42251 - in /llvm/trunk: include/llvm/Analysis/PostDominators.h lib/Analysis/PostDominatorCalculation.h lib/Analysis/PostDominators.cpp Message-ID: <200709232221.l8NML1aD022977@zion.cs.uiuc.edu> Author: resistor Date: Sun Sep 23 17:21:00 2007 New Revision: 42251 URL: http://llvm.org/viewvc/llvm-project?rev=42251&view=rev Log: Factor the calculation details for PostDomTree out of PostDominators.cpp and into a separate header file. Next step: merging PostDominatorCalculation.h with DominatorCalculation.h. Added: llvm/trunk/lib/Analysis/PostDominatorCalculation.h Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h llvm/trunk/lib/Analysis/PostDominators.cpp Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=42251&r1=42250&r2=42251&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/PostDominators.h (original) +++ llvm/trunk/include/llvm/Analysis/PostDominators.h Sun Sep 23 17:21:00 2007 @@ -29,7 +29,7 @@ virtual bool runOnFunction(Function &F) { reset(); // Reset from the last time we were run... - calculate(F); + PDTcalculate(*this, F); return false; } @@ -37,11 +37,13 @@ AU.setPreservesAll(); } private: - void calculate(Function &F); unsigned DFSPass(BasicBlock *V, unsigned N); - void Compress(BasicBlock *V, InfoRec &VInfo); - BasicBlock *Eval(BasicBlock *V); - void Link(BasicBlock *V, BasicBlock *W, InfoRec &WInfo); + friend void PDTcalculate(PostDominatorTree& PDT, Function &F); + friend void PDTCompress(PostDominatorTree& PDT, BasicBlock *V, + InfoRec &VInfo); + friend BasicBlock *PDTEval(PostDominatorTree& PDT, BasicBlock *V); + friend void PDTLink(PostDominatorTree& PDT,BasicBlock *V, + BasicBlock *W, InfoRec &WInfo); }; Added: llvm/trunk/lib/Analysis/PostDominatorCalculation.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominatorCalculation.h?rev=42251&view=auto ============================================================================== --- llvm/trunk/lib/Analysis/PostDominatorCalculation.h (added) +++ llvm/trunk/lib/Analysis/PostDominatorCalculation.h Sun Sep 23 17:21:00 2007 @@ -0,0 +1,148 @@ +//==- PostDominatorCalculation.h - Post-Dominator Calculation ----*- C++ -*-==// +// +// 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. +// +//===----------------------------------------------------------------------===// +// +// PostDominatorTree calculation implementation. +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ANALYSIS_POST_DOMINATOR_CALCULATION_H +#define LLVM_ANALYSIS_POST_DOMINATOR_CALCULATION_H + +#include "llvm/Analysis/PostDominators.h" + +namespace llvm { + +void PDTCompress(PostDominatorTree& PDT, BasicBlock *V, + PostDominatorTree::InfoRec &VInfo) { + BasicBlock *VAncestor = VInfo.Ancestor; + PostDominatorTree::InfoRec &VAInfo = PDT.Info[VAncestor]; + if (VAInfo.Ancestor == 0) + return; + + PDTCompress(PDT, VAncestor, VAInfo); + + BasicBlock *VAncestorLabel = VAInfo.Label; + BasicBlock *VLabel = VInfo.Label; + if (PDT.Info[VAncestorLabel].Semi < PDT.Info[VLabel].Semi) + VInfo.Label = VAncestorLabel; + + VInfo.Ancestor = VAInfo.Ancestor; +} + +BasicBlock *PDTEval(PostDominatorTree& PDT, BasicBlock *V) { + PostDominatorTree::InfoRec &VInfo = PDT.Info[V]; + + // Higher-complexity but faster implementation + if (VInfo.Ancestor == 0) + return V; + PDTCompress(PDT, V, VInfo); + return VInfo.Label; +} + +void PDTLink(PostDominatorTree& PDT, BasicBlock *V, BasicBlock *W, + PostDominatorTree::InfoRec &WInfo) { + // Higher-complexity but faster implementation + WInfo.Ancestor = V; +} + +void PDTcalculate(PostDominatorTree& PDT, Function &F) { + // Step #0: Scan the function looking for the root nodes of the post-dominance + // relationships. These blocks, which have no successors, end with return and + // unwind instructions. + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { + TerminatorInst *Insn = I->getTerminator(); + if (Insn->getNumSuccessors() == 0) { + // Unreachable block is not a root node. + if (!isa(Insn)) + PDT.Roots.push_back(I); + } + + // Prepopulate maps so that we don't get iterator invalidation issues later. + PDT.IDoms[I] = 0; + PDT.DomTreeNodes[I] = 0; + } + + PDT.Vertex.push_back(0); + + // Step #1: Number blocks in depth-first order and initialize variables used + // in later stages of the algorithm. + unsigned N = 0; + for (unsigned i = 0, e = PDT.Roots.size(); i != e; ++i) + N = PDT.DFSPass(PDT.Roots[i], N); + + for (unsigned i = N; i >= 2; --i) { + BasicBlock *W = PDT.Vertex[i]; + PostDominatorTree::InfoRec &WInfo = PDT.Info[W]; + + // Step #2: Calculate the semidominators of all vertices + for (succ_iterator SI = succ_begin(W), SE = succ_end(W); SI != SE; ++SI) + if (PDT.Info.count(*SI)) { // Only if this predecessor is reachable! + unsigned SemiU = PDT.Info[PDTEval(PDT, *SI)].Semi; + if (SemiU < WInfo.Semi) + WInfo.Semi = SemiU; + } + + PDT.Info[PDT.Vertex[WInfo.Semi]].Bucket.push_back(W); + + BasicBlock *WParent = WInfo.Parent; + PDTLink(PDT, WParent, W, WInfo); + + // Step #3: Implicitly define the immediate dominator of vertices + std::vector &WParentBucket = PDT.Info[WParent].Bucket; + while (!WParentBucket.empty()) { + BasicBlock *V = WParentBucket.back(); + WParentBucket.pop_back(); + BasicBlock *U = PDTEval(PDT, V); + PDT.IDoms[V] = PDT.Info[U].Semi < PDT.Info[V].Semi ? U : WParent; + } + } + + // Step #4: Explicitly define the immediate dominator of each vertex + for (unsigned i = 2; i <= N; ++i) { + BasicBlock *W = PDT.Vertex[i]; + BasicBlock *&WIDom = PDT.IDoms[W]; + if (WIDom != PDT.Vertex[PDT.Info[W].Semi]) + WIDom = PDT.IDoms[WIDom]; + } + + if (PDT.Roots.empty()) return; + + // Add a node for the root. This node might be the actual root, if there is + // one exit block, or it may be the virtual exit (denoted by (BasicBlock *)0) + // which postdominates all real exits if there are multiple exit blocks. + BasicBlock *Root = PDT.Roots.size() == 1 ? PDT.Roots[0] : 0; + PDT.DomTreeNodes[Root] = PDT.RootNode = new DomTreeNode(Root, 0); + + // Loop over all of the reachable blocks in the function... + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) + if (BasicBlock *ImmPostDom = PDT.getIDom(I)) { // Reachable block. + DomTreeNode *&BBNode = PDT.DomTreeNodes[I]; + if (!BBNode) { // Haven't calculated this node yet? + // Get or calculate the node for the immediate dominator + DomTreeNode *IPDomNode = PDT.getNodeForBlock(ImmPostDom); + + // Add a new tree node for this BasicBlock, and link it as a child of + // IDomNode + DomTreeNode *C = new DomTreeNode(I, IPDomNode); + PDT.DomTreeNodes[I] = C; + BBNode = IPDomNode->addChild(C); + } + } + + // Free temporary memory used to construct idom's + PDT.IDoms.clear(); + PDT.Info.clear(); + std::vector().swap(PDT.Vertex); + + // Start out with the DFS numbers being invalid. Let them be computed if + // demanded. + PDT.DFSInfoValid = false; +} + +} +#endif \ No newline at end of file Modified: llvm/trunk/lib/Analysis/PostDominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominators.cpp?rev=42251&r1=42250&r2=42251&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/PostDominators.cpp (original) +++ llvm/trunk/lib/Analysis/PostDominators.cpp Sun Sep 23 17:21:00 2007 @@ -16,6 +16,7 @@ #include "llvm/Support/CFG.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SetOperations.h" +#include "PostDominatorCalculation.h" using namespace llvm; //===----------------------------------------------------------------------===// @@ -72,148 +73,6 @@ return N; } -void PostDominatorTree::Compress(BasicBlock *V, InfoRec &VInfo) { - BasicBlock *VAncestor = VInfo.Ancestor; - InfoRec &VAInfo = Info[VAncestor]; - if (VAInfo.Ancestor == 0) - return; - - Compress(VAncestor, VAInfo); - - BasicBlock *VAncestorLabel = VAInfo.Label; - BasicBlock *VLabel = VInfo.Label; - if (Info[VAncestorLabel].Semi < Info[VLabel].Semi) - VInfo.Label = VAncestorLabel; - - VInfo.Ancestor = VAInfo.Ancestor; -} - -BasicBlock *PostDominatorTree::Eval(BasicBlock *V) { - InfoRec &VInfo = Info[V]; - - // Higher-complexity but faster implementation - if (VInfo.Ancestor == 0) - return V; - Compress(V, VInfo); - return VInfo.Label; -} - -void PostDominatorTree::Link(BasicBlock *V, BasicBlock *W, - InfoRec &WInfo) { - // Higher-complexity but faster implementation - WInfo.Ancestor = V; -} - -void PostDominatorTree::calculate(Function &F) { - // Step #0: Scan the function looking for the root nodes of the post-dominance - // relationships. These blocks, which have no successors, end with return and - // unwind instructions. - for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) { - TerminatorInst *Insn = I->getTerminator(); - if (Insn->getNumSuccessors() == 0) { - // Unreachable block is not a root node. - if (!isa(Insn)) - Roots.push_back(I); - } - - // Prepopulate maps so that we don't get iterator invalidation issues later. - IDoms[I] = 0; - DomTreeNodes[I] = 0; - } - - Vertex.push_back(0); - - // Step #1: Number blocks in depth-first order and initialize variables used - // in later stages of the algorithm. - unsigned N = 0; - for (unsigned i = 0, e = Roots.size(); i != e; ++i) - N = DFSPass(Roots[i], N); - - for (unsigned i = N; i >= 2; --i) { - BasicBlock *W = Vertex[i]; - InfoRec &WInfo = Info[W]; - - // Step #2: Calculate the semidominators of all vertices - for (succ_iterator SI = succ_begin(W), SE = succ_end(W); SI != SE; ++SI) - if (Info.count(*SI)) { // Only if this predecessor is reachable! - unsigned SemiU = Info[Eval(*SI)].Semi; - if (SemiU < WInfo.Semi) - WInfo.Semi = SemiU; - } - - Info[Vertex[WInfo.Semi]].Bucket.push_back(W); - - BasicBlock *WParent = WInfo.Parent; - Link(WParent, W, WInfo); - - // Step #3: Implicitly define the immediate dominator of vertices - std::vector &WParentBucket = Info[WParent].Bucket; - while (!WParentBucket.empty()) { - BasicBlock *V = WParentBucket.back(); - WParentBucket.pop_back(); - BasicBlock *U = Eval(V); - IDoms[V] = Info[U].Semi < Info[V].Semi ? U : WParent; - } - } - - // Step #4: Explicitly define the immediate dominator of each vertex - for (unsigned i = 2; i <= N; ++i) { - BasicBlock *W = Vertex[i]; - BasicBlock *&WIDom = IDoms[W]; - if (WIDom != Vertex[Info[W].Semi]) - WIDom = IDoms[WIDom]; - } - - if (Roots.empty()) return; - - // Add a node for the root. This node might be the actual root, if there is - // one exit block, or it may be the virtual exit (denoted by (BasicBlock *)0) - // which postdominates all real exits if there are multiple exit blocks. - BasicBlock *Root = Roots.size() == 1 ? Roots[0] : 0; - DomTreeNodes[Root] = RootNode = new DomTreeNode(Root, 0); - - // Loop over all of the reachable blocks in the function... - for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) - if (BasicBlock *ImmPostDom = getIDom(I)) { // Reachable block. - DomTreeNode *&BBNode = DomTreeNodes[I]; - if (!BBNode) { // Haven't calculated this node yet? - // Get or calculate the node for the immediate dominator - DomTreeNode *IPDomNode = getNodeForBlock(ImmPostDom); - - // Add a new tree node for this BasicBlock, and link it as a child of - // IDomNode - DomTreeNode *C = new DomTreeNode(I, IPDomNode); - DomTreeNodes[I] = C; - BBNode = IPDomNode->addChild(C); - } - } - - // Free temporary memory used to construct idom's - IDoms.clear(); - Info.clear(); - std::vector().swap(Vertex); - - // Start out with the DFS numbers being invalid. Let them be computed if - // demanded. - DFSInfoValid = false; -} - - -DomTreeNode *PostDominatorTree::getNodeForBlock(BasicBlock *BB) { - DomTreeNode *&BBNode = DomTreeNodes[BB]; - if (BBNode) return BBNode; - - // Haven't calculated this node yet? Get or calculate the node for the - // immediate postdominator. - BasicBlock *IPDom = getIDom(BB); - DomTreeNode *IPDomNode = getNodeForBlock(IPDom); - - // Add a new tree node for this BasicBlock, and link it as a child of - // IDomNode - DomTreeNode *C = new DomTreeNode(BB, IPDomNode); - return DomTreeNodes[BB] = IPDomNode->addChild(C); -} - //===----------------------------------------------------------------------===// // PostDominanceFrontier Implementation //===----------------------------------------------------------------------===// From gordonhenriksen at mac.com Sun Sep 23 19:14:24 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Sun, 23 Sep 2007 20:14:24 -0400 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: <140F2559-0287-4B4B-8F43-A3498929BA1F@mac.com> Here's a current copy of this work, based on revision 42251. The biggest differences from the last patch set are: ? GarbageCollection.html has been updated to reflect the state of implementation ? ShadowStackCollector now uses static metadata, back-end initialization, and "aggregate replacement of scalars" to achieve significant reductions in overhead ? Gordon //===-- gc-0-docs.patch (+1170 -241) --------------------------===// runtime/GC/SemiSpace/README.txt (+5) docs/llvm.css (+1 -1) docs/Lexicon.html (+76 -3) docs/GarbageCollection.html (+1088 -237) GarbageCollection.html is expanded to encompass the new capabilities. This is a major rewrite and is easier to read en toto rather than patchwise: http://homepage.mac.com/malichus/GarbageCollection.html This patch is independent. //===-- gc-1-registry.patch (+300) ----------------------------===// include/llvm/Support/Registry.h (+243) include/llvm/CodeGen/Collectors.h (+36) lib/CodeGen/Collectors.cpp (+21) My previous Registry.h header, as well as Collectors.h, which is the registry for dynamically-loaded garbage collectors. This patch is independent. //===-- gc-2-metadata.patch (+383) ----------------------------===// include/llvm/CodeGen/CollectorMetadata.h (+198) lib/CodeGen/CollectorMetadata.cpp (+185) CollectorMetadata is the data structure populated by back-ends during code-generation. This patch is independent. //===-- gc-3-collector.patch (+531) ---------------------------===// include/llvm/CodeGen/Collector.h (+134) lib/CodeGen/Collector.cpp (+359) lib/CodeGen/README.txt (+38) Collector is the base class for garbage collector code generators. This version enhances the previous patch to add root initialization as discussed here: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- Mon-20070910/053455.html Collector gives its subclasses control over generic algorithms: unsigned NeededSafePoints; //< Bitmask of required safe points. bool CustomReadBarriers; //< Default is to insert loads. bool CustomWriteBarriers; //< Default is to insert stores. bool CustomRoots; //< Default is to pass through to backend. bool InitRoots; //< If set, roots are nulled during lowering. It also has callbacks which collectors can hook: /// If any of the actions are set to Custom, this is expected to /// be overriden to create a transform to lower those actions to /// LLVM IR. virtual Pass *createCustomLoweringPass() const; /// beginAssembly/finishAssembly - Emit module metadata as /// assembly code. virtual void beginAssembly(Module &M, std::ostream &OS, AsmPrinter &AP, const TargetAsmInfo &TAI) const; virtual void finishAssembly(Module &M, CollectorModuleMetadata &CMM, std::ostream &OS, AsmPrinter &AP, const TargetAsmInfo &TAI) const; Various other independent algorithms could be implemented, but were not necessary for the initial two collectors. Some examples are listed here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-August/010500.html This patch depends on gc-2-metadata. //===-- gc-4-integration.patch (+116 -17) ---------------------===// include/llvm/CodeGen/LinkAllCodegenComponents.h (+4) include/llvm/CodeGen/SelectionDAGISel.h (+3 -1) include/llvm/CodeGen/AsmPrinter.h (+4) tools/llc/llc.cpp (+13) lib/CodeGen/LLVMTargetMachine.cpp (+28 -4) lib/CodeGen/AsmPrinter.cpp (+15) lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (+41 -9) lib/Target/ARM/ARMAsmPrinter.cpp (+1) lib/Target/X86/X86AsmPrinter.h (+1 -1) lib/Target/CBackend/CBackend.cpp (+3 -1) lib/Target/MSIL/MSILWriter.cpp (+3 -1) In this patch, Collector winds its tendrils throughout the compiler. Overhead should be minimal when disabled. I would particularly appreciate any feedback on this interface. The primary item of concern to me is that I exposed the desired collector to the compiler using a global. I have not decided on a better approach. In the meantime, it works and is simple. Less concretely, I am not convinced that Collector is well-factored in its interaction with TargetMachine et al. Collector and TargetMachine have no way of sniffing their respective capabilities and requirements. So llc -march=c -gc=ocaml with silently do the wrong thing; likewise the JIT, object writers, and MSIL backend. Finally, the -gc option is mandatory if collector intrinsics are used. This is somewhat sensible since there is no default collector runtime (excluding the MSIL target), but I would rather stuff any necessary information inside the LLVM representation somehow so that the .bc/.ll remain self-contained. This patch depends on gc-1-registry and gc-3-collector. //===-- gc-5-shadowstack.patch (+481 -358) --------------------===// test/CodeGen/Generic/GC/alloc_loop.ll (+1 -1) test/CodeGen/Generic/GC/lower_gcroot.ll (+1 -1) test/CodeGen/Generic/GC/redundant_init.ll (+17) include/llvm/LinkAllPasses.h (-1) include/llvm/Transforms/Scalar.h (-7) lib/CodeGen/ShadowStackCollector.cpp (+462) lib/Transforms/Scalar/LowerGC.cpp (-348) With this patch, the LowerGC transformation becomes the ShadowStackCollector, which additionally has reduced overhead with no sacrifice in portability. This patch depends on gc-4-integration. Considering a function @fun with 8 loop-local roots, ShadowStackCollector introduces the following overhead (x86): ; shadowstack prologue movl L_llvm_gc_root_chain$non_lazy_ptr, %eax movl (%eax), %ecx movl $___gc_fun, 20(%esp) movl $0, 24(%esp) movl $0, 28(%esp) movl $0, 32(%esp) movl $0, 36(%esp) movl $0, 40(%esp) movl $0, 44(%esp) movl $0, 48(%esp) movl $0, 52(%esp) movl %ecx, 16(%esp) leal 16(%esp), %ecx movl %ecx, (%eax) ; shadowstack loop overhead (none) ; shadowstack epilogue movl 48(%esp), %edx movl %edx, (%ecx) ; shadowstack metadata .align 3 ___gc_fun: # __gc_fun .long 8 .space 4 In comparison to LowerGC: ; lowergc prologue movl L_llvm_gc_root_chain$non_lazy_ptr, %eax movl (%eax), %ecx movl %ecx, 48(%esp) movl $8, 52(%esp) movl $0, 60(%esp) movl $0, 56(%esp) movl $0, 68(%esp) movl $0, 64(%esp) movl $0, 76(%esp) movl $0, 72(%esp) movl $0, 84(%esp) movl $0, 80(%esp) movl $0, 92(%esp) movl $0, 88(%esp) movl $0, 100(%esp) movl $0, 96(%esp) movl $0, 108(%esp) movl $0, 104(%esp) movl $0, 116(%esp) movl $0, 112(%esp) ; lowergc loop overhead leal 44(%esp), %eax movl %eax, 56(%esp) leal 40(%esp), %eax movl %eax, 64(%esp) leal 36(%esp), %eax movl %eax, 72(%esp) leal 32(%esp), %eax movl %eax, 80(%esp) leal 28(%esp), %eax movl %eax, 88(%esp) leal 24(%esp), %eax movl %eax, 96(%esp) leal 20(%esp), %eax movl %eax, 104(%esp) leal 16(%esp), %eax movl %eax, 112(%esp) ; lowergc epilogue movl 48(%esp), %edx movl %edx, (%ecx) ; lowergc metadata (none) //===-- gc-6-ocaml-collector.patch (+219) ---------------------===// test/CodeGen/Generic/GC/simple_ocaml.ll (+42) test/CodeGen/Generic/GC/frame_size.ll (+13) lib/CodeGen/OcamlCollector.cpp (+164) The new OcamlCollector emits the Ocaml frametable data structure and related symbols. This patch depends on gc-4-integration. $ llvm-as -o simple_ocaml.bc simple_ocaml.ll $ llc -gc=ocaml -asm-verbose -o - simple_ocaml.bc .text _camlSimple_ocaml__code_begin: .data _camlSimple_ocaml__data_begin: .text .align 4,0x90 .globl _fun _fun: subl $12, %esp movl $0, 4(%esp) movl $0, 8(%esp) movl 16(%esp), %eax movl %eax, 4(%esp) LBB1_1: # bb.loop movl 4(%esp), %eax movl 4(%eax), %eax testl %eax, %eax je LBB1_1 # bb.loop LBB1_2: # bb.end movl $8, (%esp) call L_malloc$stub Llabel1: movl %eax, 8(%esp) movl 4(%esp), %ecx movl %ecx, 4(%ecx) addl $12, %esp ret .section __IMPORT,__jump_table,symbol_stubs,self_modifying_code +pure_instructions,5 L_malloc$stub: .indirect_symbol _malloc hlt ; hlt ; hlt ; hlt ; hlt .subsections_via_symbols .text _camlSimple_ocaml__code_end: .data _camlSimple_ocaml__data_end: .long 0 _camlSimple_ocaml__frametable: # live roots for fun .long Llabel1 # call return address .short 0xc # stack frame size .short 0x2 # live root count .word 4 # stack offset .word 8 # stack offset .align 2 -------------- next part -------------- A non-text attachment was scrubbed... Name: gc.4.zip Type: application/zip Size: 53329 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20070923/50f822fd/attachment.zip From dalej at apple.com Sun Sep 23 19:32:46 2007 From: dalej at apple.com (Dale Johannesen) Date: Mon, 24 Sep 2007 00:32:46 -0000 Subject: [llvm-commits] [llvm] r42254 - /llvm/trunk/lib/VMCore/ConstantFold.cpp Message-ID: <200709240032.l8O0Wk1t025647@zion.cs.uiuc.edu> Author: johannes Date: Sun Sep 23 19:32:45 2007 New Revision: 42254 URL: http://llvm.org/viewvc/llvm-project?rev=42254&view=rev Log: Just use APFloat for const / const. Fixes -1. / -0. 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=42254&r1=42253&r2=42254&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Sun Sep 23 19:32:45 2007 @@ -699,23 +699,6 @@ (void)C3V.multiply(C2V, APFloat::rmNearestTiesToEven); return ConstantFP::get(CFP1->getType(), C3V); case Instruction::FDiv: - // FIXME better to look at the return code - if (C2V.isZero()) - if (C1V.isZero()) - // IEEE 754, Section 7.1, #4 - return ConstantFP::get(CFP1->getType(), isDouble ? - APFloat(std::numeric_limits::quiet_NaN()) : - APFloat(std::numeric_limits::quiet_NaN())); - else if (C2V.isNegZero() || C1V.isNegative()) - // IEEE 754, Section 7.2, negative infinity case - return ConstantFP::get(CFP1->getType(), isDouble ? - APFloat(-std::numeric_limits::infinity()) : - APFloat(-std::numeric_limits::infinity())); - else - // IEEE 754, Section 7.2, positive infinity case - return ConstantFP::get(CFP1->getType(), isDouble ? - APFloat(std::numeric_limits::infinity()) : - APFloat(std::numeric_limits::infinity())); (void)C3V.divide(C2V, APFloat::rmNearestTiesToEven); return ConstantFP::get(CFP1->getType(), C3V); case Instruction::FRem: From resistor at mac.com Sun Sep 23 21:29:29 2007 From: resistor at mac.com (Owen Anderson) Date: Mon, 24 Sep 2007 02:29:29 -0000 Subject: [llvm-commits] [llvm] r42255 - in /llvm/trunk: include/llvm/Analysis/Dominators.h include/llvm/Analysis/PostDominators.h lib/Analysis/PostDominatorCalculation.h lib/VMCore/DominatorCalculation.h lib/VMCore/DominatorInternals.cpp Message-ID: <200709240229.l8O2TTe4027961@zion.cs.uiuc.edu> Author: resistor Date: Sun Sep 23 21:29:29 2007 New Revision: 42255 URL: http://llvm.org/viewvc/llvm-project?rev=42255&view=rev Log: Merge significant portions of the DomTree and PostDomTree implementations. The two remaining unmerged parts are DFSPass, and the Calculate(). Added: llvm/trunk/lib/VMCore/DominatorInternals.cpp Modified: llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/include/llvm/Analysis/PostDominators.h llvm/trunk/lib/Analysis/PostDominatorCalculation.h llvm/trunk/lib/VMCore/DominatorCalculation.h Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=42255&r1=42254&r2=42255&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Sun Sep 23 21:29:29 2007 @@ -275,6 +275,11 @@ virtual void dump(); protected: + friend void Compress(DominatorTreeBase& DT, BasicBlock *VIn); + friend BasicBlock *Eval(DominatorTreeBase& DT, BasicBlock *V); + friend void Link(DominatorTreeBase& DT, BasicBlock *V, + BasicBlock *W, InfoRec &WInfo); + /// updateDFSNumbers - Assign In and Out numbers to the nodes while walking /// dominator tree in dfs order. void updateDFSNumbers(); @@ -314,10 +319,6 @@ private: friend void DTcalculate(DominatorTree& DT, Function& F); - friend void DTCompress(DominatorTree& DT, BasicBlock *VIn); - friend BasicBlock *DTEval(DominatorTree& DT, BasicBlock *v); - friend void DTLink(DominatorTree& DT, BasicBlock *V, - BasicBlock *W, InfoRec &WInfo); unsigned DFSPass(BasicBlock *V, unsigned N); }; Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=42255&r1=42254&r2=42255&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/PostDominators.h (original) +++ llvm/trunk/include/llvm/Analysis/PostDominators.h Sun Sep 23 21:29:29 2007 @@ -39,9 +39,6 @@ private: unsigned DFSPass(BasicBlock *V, unsigned N); friend void PDTcalculate(PostDominatorTree& PDT, Function &F); - friend void PDTCompress(PostDominatorTree& PDT, BasicBlock *V, - InfoRec &VInfo); - friend BasicBlock *PDTEval(PostDominatorTree& PDT, BasicBlock *V); friend void PDTLink(PostDominatorTree& PDT,BasicBlock *V, BasicBlock *W, InfoRec &WInfo); }; Modified: llvm/trunk/lib/Analysis/PostDominatorCalculation.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PostDominatorCalculation.h?rev=42255&r1=42254&r2=42255&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/PostDominatorCalculation.h (original) +++ llvm/trunk/lib/Analysis/PostDominatorCalculation.h Sun Sep 23 21:29:29 2007 @@ -17,39 +17,6 @@ namespace llvm { -void PDTCompress(PostDominatorTree& PDT, BasicBlock *V, - PostDominatorTree::InfoRec &VInfo) { - BasicBlock *VAncestor = VInfo.Ancestor; - PostDominatorTree::InfoRec &VAInfo = PDT.Info[VAncestor]; - if (VAInfo.Ancestor == 0) - return; - - PDTCompress(PDT, VAncestor, VAInfo); - - BasicBlock *VAncestorLabel = VAInfo.Label; - BasicBlock *VLabel = VInfo.Label; - if (PDT.Info[VAncestorLabel].Semi < PDT.Info[VLabel].Semi) - VInfo.Label = VAncestorLabel; - - VInfo.Ancestor = VAInfo.Ancestor; -} - -BasicBlock *PDTEval(PostDominatorTree& PDT, BasicBlock *V) { - PostDominatorTree::InfoRec &VInfo = PDT.Info[V]; - - // Higher-complexity but faster implementation - if (VInfo.Ancestor == 0) - return V; - PDTCompress(PDT, V, VInfo); - return VInfo.Label; -} - -void PDTLink(PostDominatorTree& PDT, BasicBlock *V, BasicBlock *W, - PostDominatorTree::InfoRec &WInfo) { - // Higher-complexity but faster implementation - WInfo.Ancestor = V; -} - void PDTcalculate(PostDominatorTree& PDT, Function &F) { // Step #0: Scan the function looking for the root nodes of the post-dominance // relationships. These blocks, which have no successors, end with return and @@ -82,7 +49,7 @@ // Step #2: Calculate the semidominators of all vertices for (succ_iterator SI = succ_begin(W), SE = succ_end(W); SI != SE; ++SI) if (PDT.Info.count(*SI)) { // Only if this predecessor is reachable! - unsigned SemiU = PDT.Info[PDTEval(PDT, *SI)].Semi; + unsigned SemiU = PDT.Info[Eval(PDT, *SI)].Semi; if (SemiU < WInfo.Semi) WInfo.Semi = SemiU; } @@ -90,14 +57,14 @@ PDT.Info[PDT.Vertex[WInfo.Semi]].Bucket.push_back(W); BasicBlock *WParent = WInfo.Parent; - PDTLink(PDT, WParent, W, WInfo); + Link(PDT, WParent, W, WInfo); // Step #3: Implicitly define the immediate dominator of vertices std::vector &WParentBucket = PDT.Info[WParent].Bucket; while (!WParentBucket.empty()) { BasicBlock *V = WParentBucket.back(); WParentBucket.pop_back(); - BasicBlock *U = PDTEval(PDT, V); + BasicBlock *U = Eval(PDT, V); PDT.IDoms[V] = PDT.Info[U].Semi < PDT.Info[V].Semi ? U : WParent; } } Modified: llvm/trunk/lib/VMCore/DominatorCalculation.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/DominatorCalculation.h?rev=42255&r1=42254&r2=42255&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/DominatorCalculation.h (original) +++ llvm/trunk/lib/VMCore/DominatorCalculation.h Sun Sep 23 21:29:29 2007 @@ -33,112 +33,6 @@ namespace llvm { -void DTCompress(DominatorTree& DT, BasicBlock *VIn) { - - std::vector Work; - SmallPtrSet Visited; - BasicBlock *VInAncestor = DT.Info[VIn].Ancestor; - DominatorTree::InfoRec &VInVAInfo = DT.Info[VInAncestor]; - - if (VInVAInfo.Ancestor != 0) - Work.push_back(VIn); - - while (!Work.empty()) { - BasicBlock *V = Work.back(); - DominatorTree::InfoRec &VInfo = DT.Info[V]; - BasicBlock *VAncestor = VInfo.Ancestor; - DominatorTree::InfoRec &VAInfo = DT.Info[VAncestor]; - - // Process Ancestor first - if (Visited.insert(VAncestor) && - VAInfo.Ancestor != 0) { - Work.push_back(VAncestor); - continue; - } - Work.pop_back(); - - // Update VInfo based on Ancestor info - if (VAInfo.Ancestor == 0) - continue; - BasicBlock *VAncestorLabel = VAInfo.Label; - BasicBlock *VLabel = VInfo.Label; - if (DT.Info[VAncestorLabel].Semi < DT.Info[VLabel].Semi) - VInfo.Label = VAncestorLabel; - VInfo.Ancestor = VAInfo.Ancestor; - } -} - -BasicBlock *DTEval(DominatorTree& DT, BasicBlock *V) { - DominatorTree::InfoRec &VInfo = DT.Info[V]; -#if !BALANCE_IDOM_TREE - // Higher-complexity but faster implementation - if (VInfo.Ancestor == 0) - return V; - DTCompress(DT, V); - return VInfo.Label; -#else - // Lower-complexity but slower implementation - if (VInfo.Ancestor == 0) - return VInfo.Label; - DTCompress(DT, V); - BasicBlock *VLabel = VInfo.Label; - - BasicBlock *VAncestorLabel = DT.Info[VInfo.Ancestor].Label; - if (DT.Info[VAncestorLabel].Semi >= DT.Info[VLabel].Semi) - return VLabel; - else - return VAncestorLabel; -#endif -} - -void DTLink(DominatorTree& DT, BasicBlock *V, BasicBlock *W, - DominatorTree::InfoRec &WInfo) { -#if !BALANCE_IDOM_TREE - // Higher-complexity but faster implementation - WInfo.Ancestor = V; -#else - // Lower-complexity but slower implementation - BasicBlock *WLabel = WInfo.Label; - unsigned WLabelSemi = Info[WLabel].Semi; - BasicBlock *S = W; - InfoRec *SInfo = &Info[S]; - - BasicBlock *SChild = SInfo->Child; - InfoRec *SChildInfo = &Info[SChild]; - - while (WLabelSemi < Info[SChildInfo->Label].Semi) { - BasicBlock *SChildChild = SChildInfo->Child; - if (SInfo->Size+Info[SChildChild].Size >= 2*SChildInfo->Size) { - SChildInfo->Ancestor = S; - SInfo->Child = SChild = SChildChild; - SChildInfo = &Info[SChild]; - } else { - SChildInfo->Size = SInfo->Size; - S = SInfo->Ancestor = SChild; - SInfo = SChildInfo; - SChild = SChildChild; - SChildInfo = &Info[SChild]; - } - } - - InfoRec &VInfo = Info[V]; - SInfo->Label = WLabel; - - assert(V != W && "The optimization here will not work in this case!"); - unsigned WSize = WInfo.Size; - unsigned VSize = (VInfo.Size += WSize); - - if (VSize < 2*WSize) - std::swap(S, VInfo.Child); - - while (S) { - SInfo = &Info[S]; - SInfo->Ancestor = V; - S = SInfo->Child; - } -#endif -} - void DTcalculate(DominatorTree& DT, Function &F) { BasicBlock* Root = DT.Roots[0]; @@ -158,7 +52,7 @@ // Step #2: Calculate the semidominators of all vertices for (pred_iterator PI = pred_begin(W), E = pred_end(W); PI != E; ++PI) if (DT.Info.count(*PI)) { // Only if this predecessor is reachable! - unsigned SemiU = DT.Info[DTEval(DT, *PI)].Semi; + unsigned SemiU = DT.Info[Eval(DT, *PI)].Semi; if (SemiU < WInfo.Semi) WInfo.Semi = SemiU; } @@ -166,14 +60,14 @@ DT.Info[DT.Vertex[WInfo.Semi]].Bucket.push_back(W); BasicBlock *WParent = WInfo.Parent; - DTLink(DT, WParent, W, WInfo); + Link(DT, WParent, W, WInfo); // Step #3: Implicitly define the immediate dominator of vertices std::vector &WParentBucket = DT.Info[WParent].Bucket; while (!WParentBucket.empty()) { BasicBlock *V = WParentBucket.back(); WParentBucket.pop_back(); - BasicBlock *U = DTEval(DT, V); + BasicBlock *U = Eval(DT, V); DT.IDoms[V] = DT.Info[U].Semi < DT.Info[V].Semi ? U : WParent; } } Added: llvm/trunk/lib/VMCore/DominatorInternals.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/DominatorInternals.cpp?rev=42255&view=auto ============================================================================== --- llvm/trunk/lib/VMCore/DominatorInternals.cpp (added) +++ llvm/trunk/lib/VMCore/DominatorInternals.cpp Sun Sep 23 21:29:29 2007 @@ -0,0 +1,145 @@ +//==- DominatorInternals.cpp - Dominator Calculation -------------*- C++ -*-==// +// +// 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. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ANALYSIS_DOMINATOR_INTERNALS_H +#define LLVM_ANALYSIS_DOMINATOR_INTERNALS_H + +#include "llvm/Analysis/Dominators.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallPtrSet.h" +//===----------------------------------------------------------------------===// +// +// DominatorTree construction - This pass constructs immediate dominator +// information for a flow-graph based on the algorithm described in this +// document: +// +// A Fast Algorithm for Finding Dominators in a Flowgraph +// T. Lengauer & R. Tarjan, ACM TOPLAS July 1979, pgs 121-141. +// +// This implements both the O(n*ack(n)) and the O(n*log(n)) versions of EVAL and +// LINK, but it turns out that the theoretically slower O(n*log(n)) +// implementation is actually faster than the "efficient" algorithm (even for +// large CFGs) because the constant overheads are substantially smaller. The +// lower-complexity version can be enabled with the following #define: +// +#define BALANCE_IDOM_TREE 0 +// +//===----------------------------------------------------------------------===// + +namespace llvm { + +void Compress(DominatorTreeBase& DT, BasicBlock *VIn) { + + std::vector Work; + SmallPtrSet Visited; + BasicBlock *VInAncestor = DT.Info[VIn].Ancestor; + DominatorTreeBase::InfoRec &VInVAInfo = DT.Info[VInAncestor]; + + if (VInVAInfo.Ancestor != 0) + Work.push_back(VIn); + + while (!Work.empty()) { + BasicBlock *V = Work.back(); + DominatorTree::InfoRec &VInfo = DT.Info[V]; + BasicBlock *VAncestor = VInfo.Ancestor; + DominatorTreeBase::InfoRec &VAInfo = DT.Info[VAncestor]; + + // Process Ancestor first + if (Visited.insert(VAncestor) && + VAInfo.Ancestor != 0) { + Work.push_back(VAncestor); + continue; + } + Work.pop_back(); + + // Update VInfo based on Ancestor info + if (VAInfo.Ancestor == 0) + continue; + BasicBlock *VAncestorLabel = VAInfo.Label; + BasicBlock *VLabel = VInfo.Label; + if (DT.Info[VAncestorLabel].Semi < DT.Info[VLabel].Semi) + VInfo.Label = VAncestorLabel; + VInfo.Ancestor = VAInfo.Ancestor; + } +} + +BasicBlock *Eval(DominatorTreeBase& DT, BasicBlock *V) { + DominatorTreeBase::InfoRec &VInfo = DT.Info[V]; +#if !BALANCE_IDOM_TREE + // Higher-complexity but faster implementation + if (VInfo.Ancestor == 0) + return V; + Compress(DT, V); + return VInfo.Label; +#else + // Lower-complexity but slower implementation + if (VInfo.Ancestor == 0) + return VInfo.Label; + Compress(DT, V); + BasicBlock *VLabel = VInfo.Label; + + BasicBlock *VAncestorLabel = DT.Info[VInfo.Ancestor].Label; + if (DT.Info[VAncestorLabel].Semi >= DT.Info[VLabel].Semi) + return VLabel; + else + return VAncestorLabel; +#endif +} + +void Link(DominatorTreeBase& DT, BasicBlock *V, BasicBlock *W, + DominatorTreeBase::InfoRec &WInfo) { +#if !BALANCE_IDOM_TREE + // Higher-complexity but faster implementation + WInfo.Ancestor = V; +#else + // Lower-complexity but slower implementation + BasicBlock *WLabel = WInfo.Label; + unsigned WLabelSemi = DT.Info[WLabel].Semi; + BasicBlock *S = W; + InfoRec *SInfo = &DT.Info[S]; + + BasicBlock *SChild = SInfo->Child; + InfoRec *SChildInfo = &DT.Info[SChild]; + + while (WLabelSemi < DT.Info[SChildInfo->Label].Semi) { + BasicBlock *SChildChild = SChildInfo->Child; + if (SInfo->Size+DT.Info[SChildChild].Size >= 2*SChildInfo->Size) { + SChildInfo->Ancestor = S; + SInfo->Child = SChild = SChildChild; + SChildInfo = &DT.Info[SChild]; + } else { + SChildInfo->Size = SInfo->Size; + S = SInfo->Ancestor = SChild; + SInfo = SChildInfo; + SChild = SChildChild; + SChildInfo = &DT.Info[SChild]; + } + } + + DominatorTreeBase::InfoRec &VInfo = DT.Info[V]; + SInfo->Label = WLabel; + + assert(V != W && "The optimization here will not work in this case!"); + unsigned WSize = WInfo.Size; + unsigned VSize = (VInfo.Size += WSize); + + if (VSize < 2*WSize) + std::swap(S, VInfo.Child); + + while (S) { + SInfo = &DT.Info[S]; + SInfo->Ancestor = V; + S = SInfo->Child; + } +#endif +} + +} + +#endif \ No newline at end of file From resistor at mac.com Sun Sep 23 21:33:22 2007 From: resistor at mac.com (Owen Anderson) Date: Mon, 24 Sep 2007 02:33:22 -0000 Subject: [llvm-commits] [llvm] r42256 - /llvm/trunk/include/llvm/ADT/PostOrderIterator.h Message-ID: <200709240233.l8O2XMp5028047@zion.cs.uiuc.edu> Author: resistor Date: Sun Sep 23 21:33:22 2007 New Revision: 42256 URL: http://llvm.org/viewvc/llvm-project?rev=42256&view=rev Log: Fix typo. Modified: llvm/trunk/include/llvm/ADT/PostOrderIterator.h Modified: llvm/trunk/include/llvm/ADT/PostOrderIterator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PostOrderIterator.h?rev=42256&r1=42255&r2=42256&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/PostOrderIterator.h (original) +++ llvm/trunk/include/llvm/ADT/PostOrderIterator.h Sun Sep 23 21:33:22 2007 @@ -147,7 +147,7 @@ // Provide global definitions of inverse post order iterators... template ::NoddeType*>, + class SetType = std::set::NodeType*>, bool External = false> struct ipo_iterator : public po_iterator, SetType, External > { ipo_iterator(const po_iterator, SetType, External> &V) : From sabre at nondot.org Sun Sep 23 22:35:38 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 24 Sep 2007 03:35:38 -0000 Subject: [llvm-commits] [llvm] r42257 - /llvm/trunk/lib/CodeGen/DwarfWriter.cpp Message-ID: <200709240335.l8O3ZceL029398@zion.cs.uiuc.edu> Author: lattner Date: Sun Sep 23 22:35:37 2007 New Revision: 42257 URL: http://llvm.org/viewvc/llvm-project?rev=42257&view=rev Log: When emitting .set directives, make sure the EH and Debug labels can't conflict. Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=42257&r1=42256&r2=42257&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Sun Sep 23 22:35:37 2007 @@ -798,9 +798,14 @@ /// SubprogramCount - The running count of functions being compiled. /// unsigned SubprogramCount; + + /// Flavor - A unique string indicating what dwarf producer this is, used to + /// unique labels. + const char * const Flavor; unsigned SetCounter; - Dwarf(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T) + Dwarf(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T, + const char *flavor) : O(OS) , Asm(A) , TAI(T) @@ -810,6 +815,7 @@ , MF(NULL) , MMI(NULL) , SubprogramCount(0) + , Flavor(flavor) , SetCounter(1) { } @@ -839,11 +845,17 @@ PrintLabelName(Label.Tag, Label.Number); } void PrintLabelName(const char *Tag, unsigned Number) const { - O << TAI->getPrivateGlobalPrefix() << Tag; if (Number) O << Number; } + void PrintLabelName(const char *Tag, unsigned Number, + const char *Suffix) const { + O << TAI->getPrivateGlobalPrefix() << Tag; + if (Number) O << Number; + O << Suffix; + } + /// EmitLabel - Emit location label for internal use by Dwarf. /// void EmitLabel(DWLabel Label) const { @@ -888,7 +900,7 @@ bool IsSmall = false) { if (TAI->needsSet()) { O << "\t.set\t"; - PrintLabelName("set", SetCounter); + PrintLabelName("set", SetCounter, Flavor); O << ","; PrintLabelName(TagHi, NumberHi); O << "-"; @@ -896,9 +908,7 @@ O << "\n"; PrintRelDirective(IsSmall); - - PrintLabelName("set", SetCounter); - + PrintLabelName("set", SetCounter, Flavor); ++SetCounter; } else { PrintRelDirective(IsSmall); @@ -915,7 +925,7 @@ bool printAbsolute = false; if (TAI->needsSet()) { O << "\t.set\t"; - PrintLabelName("set", SetCounter); + PrintLabelName("set", SetCounter, Flavor); O << ","; PrintLabelName(Label, LabelNumber); @@ -932,7 +942,7 @@ PrintRelDirective(IsSmall); - PrintLabelName("set", SetCounter); + PrintLabelName("set", SetCounter, Flavor); ++SetCounter; } else { PrintRelDirective(IsSmall, true); @@ -2565,7 +2575,7 @@ // Main entry points. // DwarfDebug(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T) - : Dwarf(OS, A, T) + : Dwarf(OS, A, T, "dbg") , CompileUnits() , AbbreviationsSet(InitAbbreviationsSetSize) , Abbreviations() @@ -3268,7 +3278,7 @@ // Main entry points. // DwarfException(std::ostream &OS, AsmPrinter *A, const TargetAsmInfo *T) - : Dwarf(OS, A, T) + : Dwarf(OS, A, T, "eh") , shouldEmit(false) {}