From evan.cheng at apple.com Mon Jun 30 02:11:37 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 30 Jun 2008 00:11:37 -0700 Subject: [llvm-commits] [llvm] r52854 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <1214769393.8922.67.camel@localhost> References: <200806280624.m5S6OpPs025870@zion.cs.uiuc.edu> <1214650526.8922.53.camel@localhost> <45C12D28-BB2C-4AE8-8498-03C10C95AF2B@apple.com> <1214769393.8922.67.camel@localhost> Message-ID: <76165B66-37FF-4966-8416-177DC831AB1A@apple.com> I have a proper fix (I think). I'll commit it soon. Please let me know if llvm-gcc bootstrapping fails for you. Evan On Jun 29, 2008, at 12:56 PM, Anton Korobeynikov wrote: > Hi, Evan > >> I haven't had a chance to look into it. But 64-bit llvm compiles this >> bc file compiles to different code from 32-bit llvm. > Hope, this will help. However, I've reverted that series of patches > for > now. > > -- > 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 Jun 30 02:31:25 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 30 Jun 2008 07:31:25 -0000 Subject: [llvm-commits] [llvm] r52891 - in /llvm/trunk: include/llvm/Analysis/ValueTracking.h include/llvm/Constant.h include/llvm/IntrinsicInst.h lib/Analysis/ValueTracking.cpp lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Debugger/ProgramInfo.cpp lib/Transforms/Scalar/InstructionCombining.cpp lib/Transforms/Scalar/SimplifyLibCalls.cpp lib/VMCore/Constants.cpp lib/VMCore/IntrinsicInst.cpp Message-ID: <200806300731.m5U7VQMU031293@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 30 02:31:25 2008 New Revision: 52891 URL: http://llvm.org/viewvc/llvm-project?rev=52891&view=rev Log: - Re-apply 52748 and friends with fix. GetConstantStringInfo() returns an empty string for ConstantAggregateZero case which surprises selectiondag. - Correctly handle memcpy from constant string which is zero-initialized. Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h llvm/trunk/include/llvm/Constant.h llvm/trunk/include/llvm/IntrinsicInst.h llvm/trunk/lib/Analysis/ValueTracking.cpp llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Debugger/ProgramInfo.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/IntrinsicInst.cpp Modified: llvm/trunk/include/llvm/Analysis/ValueTracking.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ValueTracking.h?rev=52891&r1=52890&r2=52891&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ValueTracking.h (original) +++ llvm/trunk/include/llvm/Analysis/ValueTracking.h Mon Jun 30 02:31:25 2008 @@ -72,7 +72,16 @@ Instruction *InsertBefore = 0) { const unsigned Idxs[1] = { Idx }; return FindInsertedValue(V, &Idxs[0], &Idxs[1], InsertBefore); - } + } + + /// GetConstantStringInfo - This function computes the length of a + /// null-terminated C string pointed to by V. If successful, it returns true + /// and returns the string in Str. If unsuccessful, it returns false. If + /// StopAtNul is set to true (the default), the returned string is truncated + /// by a nul character in the global. If StopAtNul is false, the nul + /// character is included in the result string. + bool GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset = 0, + bool StopAtNul = true); } // end namespace llvm #endif Modified: llvm/trunk/include/llvm/Constant.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Constant.h?rev=52891&r1=52890&r2=52891&view=diff ============================================================================== --- llvm/trunk/include/llvm/Constant.h (original) +++ llvm/trunk/include/llvm/Constant.h Mon Jun 30 02:31:25 2008 @@ -115,13 +115,6 @@ "implemented for all constants that have operands!"); assert(0 && "Constants that do not have operands cannot be using 'From'!"); } - - /// getStringValue - Turn an LLVM constant pointer that eventually points to a - /// global into a string value. Return an empty string if we can't do it. - /// Parameter Chop determines if the result is chopped at the first null - /// terminator. - /// - std::string getStringValue(bool Chop = true, unsigned Offset = 0); }; } // End llvm namespace Modified: llvm/trunk/include/llvm/IntrinsicInst.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicInst.h?rev=52891&r1=52890&r2=52891&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicInst.h (original) +++ llvm/trunk/include/llvm/IntrinsicInst.h Mon Jun 30 02:31:25 2008 @@ -96,8 +96,8 @@ return unsigned(cast(getOperand(2))->getZExtValue()); } - std::string getFileName() const; - std::string getDirectory() const; + Value* getFileName() const; + Value* getDirectory() const; // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const DbgStopPointInst *) { return true; } Modified: llvm/trunk/lib/Analysis/ValueTracking.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ValueTracking.cpp?rev=52891&r1=52890&r2=52891&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ValueTracking.cpp (original) +++ llvm/trunk/lib/Analysis/ValueTracking.cpp Mon Jun 30 02:31:25 2008 @@ -15,6 +15,7 @@ #include "llvm/Analysis/ValueTracking.h" #include "llvm/Constants.h" #include "llvm/Instructions.h" +#include "llvm/GlobalVariable.h" #include "llvm/IntrinsicInst.h" #include "llvm/Target/TargetData.h" #include "llvm/Support/GetElementPtrTypeIterator.h" @@ -930,3 +931,102 @@ // or load instruction) return 0; } + +/// GetConstantStringInfo - This function computes the length of a +/// null-terminated C string pointed to by V. If successful, it returns true +/// and returns the string in Str. If unsuccessful, it returns false. +bool llvm::GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset, + bool StopAtNul) { + // If V is NULL then return false; + if (V == NULL) return false; + + // Look through bitcast instructions. + if (BitCastInst *BCI = dyn_cast(V)) + return GetConstantStringInfo(BCI->getOperand(0), Str, Offset, StopAtNul); + + // If the value is not a GEP instruction nor a constant expression with a + // GEP instruction, then return false because ConstantArray can't occur + // any other way + User *GEP = 0; + if (GetElementPtrInst *GEPI = dyn_cast(V)) { + GEP = GEPI; + } else if (ConstantExpr *CE = dyn_cast(V)) { + if (CE->getOpcode() == Instruction::BitCast) + return GetConstantStringInfo(CE->getOperand(0), Str, Offset, StopAtNul); + if (CE->getOpcode() != Instruction::GetElementPtr) + return false; + GEP = CE; + } + + if (GEP) { + // Make sure the GEP has exactly three arguments. + if (GEP->getNumOperands() != 3) + return false; + + // Make sure the index-ee is a pointer to array of i8. + const PointerType *PT = cast(GEP->getOperand(0)->getType()); + const ArrayType *AT = dyn_cast(PT->getElementType()); + if (AT == 0 || AT->getElementType() != Type::Int8Ty) + return false; + + // Check to make sure that the first operand of the GEP is an integer and + // has value 0 so that we are sure we're indexing into the initializer. + ConstantInt *FirstIdx = dyn_cast(GEP->getOperand(1)); + if (FirstIdx == 0 || !FirstIdx->isZero()) + return false; + + // If the second index isn't a ConstantInt, then this is a variable index + // into the array. If this occurs, we can't say anything meaningful about + // the string. + uint64_t StartIdx = 0; + if (ConstantInt *CI = dyn_cast(GEP->getOperand(2))) + StartIdx = CI->getZExtValue(); + else + return false; + return GetConstantStringInfo(GEP->getOperand(0), Str, StartIdx+Offset, + StopAtNul); + } + + // The GEP instruction, constant or instruction, must reference a global + // variable that is a constant and is initialized. The referenced constant + // initializer is the array that we'll use for optimization. + GlobalVariable* GV = dyn_cast(V); + if (!GV || !GV->isConstant() || !GV->hasInitializer()) + return false; + Constant *GlobalInit = GV->getInitializer(); + + // Handle the ConstantAggregateZero case + if (isa(GlobalInit)) { + // This is a degenerate case. The initializer is constant zero so the + // length of the string must be zero. + Str.clear(); + return true; + } + + // Must be a Constant Array + ConstantArray *Array = dyn_cast(GlobalInit); + if (Array == 0 || Array->getType()->getElementType() != Type::Int8Ty) + return false; + + // Get the number of elements in the array + uint64_t NumElts = Array->getType()->getNumElements(); + + if (Offset > NumElts) + return false; + + // Traverse the constant array from 'Offset' which is the place the GEP refers + // to in the array. + Str.reserve(NumElts-Offset); + for (unsigned i = Offset; i != NumElts; ++i) { + Constant *Elt = Array->getOperand(i); + ConstantInt *CI = dyn_cast(Elt); + if (!CI) // This array isn't suitable, non-int initializer. + return false; + if (StopAtNul && CI->isZero()) + return true; // we found end of string, success! + Str += (char)CI->getZExtValue(); + } + + // The array isn't null terminated, but maybe this is a memcpy, not a strcpy. + return true; +} Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=52891&r1=52890&r2=52891&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Mon Jun 30 02:31:25 2008 @@ -10,6 +10,7 @@ #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/Constants.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineLocation.h" @@ -206,7 +207,9 @@ } virtual void Apply(std::string &Field) { Constant *C = CI->getOperand(I++); - Field = C->getStringValue(); + // Fills in the string if it succeeds + if (!GetConstantStringInfo(C, Field)) + Field.clear(); } virtual void Apply(DebugInfoDesc *&Field) { Constant *C = CI->getOperand(I++); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52891&r1=52890&r2=52891&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jun 30 02:31:25 2008 @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/SelectionDAG.h" #include "llvm/Constants.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/GlobalAlias.h" #include "llvm/GlobalVariable.h" #include "llvm/Intrinsics.h" @@ -747,18 +748,14 @@ } SDOperand SelectionDAG::getConstant(uint64_t Val, MVT VT, bool isT) { - MVT EltVT = - VT.isVector() ? VT.getVectorElementType() : VT; - + MVT EltVT = VT.isVector() ? VT.getVectorElementType() : VT; return getConstant(APInt(EltVT.getSizeInBits(), Val), VT, isT); } SDOperand SelectionDAG::getConstant(const APInt &Val, MVT VT, bool isT) { assert(VT.isInteger() && "Cannot create FP integer constant!"); - MVT EltVT = - VT.isVector() ? VT.getVectorElementType() : VT; - + MVT EltVT = VT.isVector() ? VT.getVectorElementType() : VT; assert(Val.getBitWidth() == EltVT.getSizeInBits() && "APInt size does not match type size!"); @@ -2554,6 +2551,16 @@ static SDOperand getMemsetStringVal(MVT VT, SelectionDAG &DAG, const TargetLowering &TLI, std::string &Str, unsigned Offset) { + // Handle vector with all elements zero. + if (Str.empty()) { + if (VT.isInteger()) + return DAG.getConstant(0, VT); + unsigned NumElts = VT.getVectorNumElements(); + MVT EltVT = (VT.getVectorElementType() == MVT::f32) ? MVT::i32 : MVT::i64; + return DAG.getNode(ISD::BIT_CONVERT, VT, + DAG.getConstant(0, MVT::getVectorVT(EltVT, NumElts))); + } + assert(!VT.isVector() && "Can't handle vector type here!"); unsigned NumBits = VT.getSizeInBits(); unsigned MSB = NumBits / 8; @@ -2577,8 +2584,7 @@ /// isMemSrcFromString - Returns true if memcpy source is a string constant. /// -static bool isMemSrcFromString(SDOperand Src, std::string &Str, - uint64_t &SrcOff) { +static bool isMemSrcFromString(SDOperand Src, std::string &Str) { unsigned SrcDelta = 0; GlobalAddressSDNode *G = NULL; if (Src.getOpcode() == ISD::GlobalAddress) @@ -2593,13 +2599,8 @@ return false; GlobalVariable *GV = dyn_cast(G->getGlobal()); - if (GV && GV->isConstant()) { - Str = GV->getStringValue(false); - if (!Str.empty()) { - SrcOff += SrcDelta; - return true; - } - } + if (GV && GetConstantStringInfo(GV, Str, SrcDelta, false)) + return true; return false; } @@ -2611,14 +2612,12 @@ bool MeetsMaxMemopRequirement(std::vector &MemOps, SDOperand Dst, SDOperand Src, unsigned Limit, uint64_t Size, unsigned &Align, + std::string &Str, bool &isSrcStr, SelectionDAG &DAG, const TargetLowering &TLI) { - bool AllowUnalign = TLI.allowsUnalignedMemoryAccesses(); - - std::string Str; - uint64_t SrcOff = 0; - bool isSrcStr = isMemSrcFromString(Src, Str, SrcOff); + isSrcStr = isMemSrcFromString(Src, Str); bool isSrcConst = isa(Src); + bool AllowUnalign = TLI.allowsUnalignedMemoryAccesses(); MVT VT= TLI.getOptimalMemOpType(Size, Align, isSrcConst, isSrcStr); if (VT != MVT::iAny) { unsigned NewAlign = (unsigned) @@ -2707,26 +2706,28 @@ if (!AlwaysInline) Limit = TLI.getMaxStoresPerMemcpy(); unsigned DstAlign = Align; // Destination alignment can change. + std::string Str; + bool CopyFromStr; if (!MeetsMaxMemopRequirement(MemOps, Dst, Src, Limit, Size, DstAlign, - DAG, TLI)) + Str, CopyFromStr, DAG, TLI)) return SDOperand(); - std::string Str; - uint64_t SrcOff = 0, DstOff = 0; - bool CopyFromStr = isMemSrcFromString(Src, Str, SrcOff); + bool isZeroStr = CopyFromStr && Str.empty(); SmallVector OutChains; unsigned NumMemOps = MemOps.size(); + uint64_t SrcOff = 0, DstOff = 0; for (unsigned i = 0; i < NumMemOps; i++) { MVT VT = MemOps[i]; unsigned VTSize = VT.getSizeInBits() / 8; SDOperand Value, Store; - if (CopyFromStr && !VT.isVector()) { + if (CopyFromStr && (isZeroStr || !VT.isVector())) { // It's unlikely a store of a vector immediate can be done in a single // instruction. It would require a load from a constantpool first. - // FIXME: Handle cases where store of vector immediate is done in a - // single instruction. + // We also handle store a vector with all zero's. + // FIXME: Handle other cases where store of vector immediate is done in + // a single instruction. Value = getMemsetStringVal(VT, DAG, TLI, Str, SrcOff); Store = DAG.getStore(Chain, Value, getMemBasePlusOffset(Dst, DstOff, DAG), @@ -2763,8 +2764,10 @@ if (!AlwaysInline) Limit = TLI.getMaxStoresPerMemmove(); unsigned DstAlign = Align; // Destination alignment can change. + std::string Str; + bool CopyFromStr; if (!MeetsMaxMemopRequirement(MemOps, Dst, Src, Limit, Size, DstAlign, - DAG, TLI)) + Str, CopyFromStr, DAG, TLI)) return SDOperand(); uint64_t SrcOff = 0, DstOff = 0; @@ -2814,8 +2817,10 @@ // Expand memset to a series of load/store ops if the size operand // falls below a certain threshold. std::vector MemOps; + std::string Str; + bool CopyFromStr; if (!MeetsMaxMemopRequirement(MemOps, Dst, Src, TLI.getMaxStoresPerMemset(), - Size, Align, DAG, TLI)) + Size, Align, Str, CopyFromStr, DAG, TLI)) return SDOperand(); SmallVector OutChains; Modified: llvm/trunk/lib/Debugger/ProgramInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Debugger/ProgramInfo.cpp?rev=52891&r1=52890&r2=52891&view=diff ============================================================================== --- llvm/trunk/lib/Debugger/ProgramInfo.cpp (original) +++ llvm/trunk/lib/Debugger/ProgramInfo.cpp Mon Jun 30 02:31:25 2008 @@ -14,6 +14,7 @@ #include "llvm/Debugger/ProgramInfo.h" #include "llvm/Constants.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/DerivedTypes.h" #include "llvm/Intrinsics.h" #include "llvm/IntrinsicInst.h" @@ -115,8 +116,10 @@ if (ConstantInt *CUI = dyn_cast(CS->getOperand(1))) Version = CUI->getZExtValue(); - BaseName = CS->getOperand(3)->getStringValue(); - Directory = CS->getOperand(4)->getStringValue(); + if (!GetConstantStringInfo(CS->getOperand(3), BaseName)) + BaseName = ""; + if (!GetConstantStringInfo(CS->getOperand(4), Directory)) + Directory = ""; } } @@ -156,7 +159,8 @@ SourceFile = &PI.getSourceFile(GV); // Entry #2 is the function name. - Name = CS->getOperand(2)->getStringValue(); + if (!GetConstantStringInfo(CS->getOperand(2), Name)) + Name = ""; } } Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=52891&r1=52890&r2=52891&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Mon Jun 30 02:31:25 2008 @@ -9973,8 +9973,8 @@ if (ConstantExpr *CE = dyn_cast(CI)) { // Instead of loading constant c string, use corresponding integer value // directly if string length is small enough. - const std::string &Str = CE->getOperand(0)->getStringValue(); - if (!Str.empty()) { + std::string Str; + if (GetConstantStringInfo(CE->getOperand(0), Str) && !Str.empty()) { unsigned len = Str.length(); const Type *Ty = cast(CE->getType())->getElementType(); unsigned numBits = Ty->getPrimitiveSizeInBits(); Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp?rev=52891&r1=52890&r2=52891&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyLibCalls.cpp Mon Jun 30 02:31:25 2008 @@ -23,6 +23,7 @@ #include "llvm/Module.h" #include "llvm/Pass.h" #include "llvm/Support/IRBuilder.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/Target/TargetData.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringMap.h" @@ -229,88 +230,6 @@ // Helper Functions //===----------------------------------------------------------------------===// -/// GetConstantStringInfo - This function computes the length of a -/// null-terminated C string pointed to by V. If successful, it returns true -/// and returns the string in Str. If unsuccessful, it returns false. -static bool GetConstantStringInfo(Value *V, std::string &Str) { - // Look bitcast instructions. - if (BitCastInst *BCI = dyn_cast(V)) - return GetConstantStringInfo(BCI->getOperand(0), Str); - - // If the value is not a GEP instruction nor a constant expression with a - // GEP instruction, then return false because ConstantArray can't occur - // any other way - User *GEP = 0; - if (GetElementPtrInst *GEPI = dyn_cast(V)) { - GEP = GEPI; - } else if (ConstantExpr *CE = dyn_cast(V)) { - if (CE->getOpcode() != Instruction::GetElementPtr) - return false; - GEP = CE; - } else { - return false; - } - - // Make sure the GEP has exactly three arguments. - if (GEP->getNumOperands() != 3) - return false; - - // Check to make sure that the first operand of the GEP is an integer and - // has value 0 so that we are sure we're indexing into the initializer. - if (ConstantInt *Idx = dyn_cast(GEP->getOperand(1))) { - if (!Idx->isZero()) - return false; - } else - return false; - - // If the second index isn't a ConstantInt, then this is a variable index - // into the array. If this occurs, we can't say anything meaningful about - // the string. - uint64_t StartIdx = 0; - if (ConstantInt *CI = dyn_cast(GEP->getOperand(2))) - StartIdx = CI->getZExtValue(); - else - return false; - - // The GEP instruction, constant or instruction, must reference a global - // variable that is a constant and is initialized. The referenced constant - // initializer is the array that we'll use for optimization. - GlobalVariable* GV = dyn_cast(GEP->getOperand(0)); - if (!GV || !GV->isConstant() || !GV->hasInitializer()) - return false; - Constant *GlobalInit = GV->getInitializer(); - - // Handle the ConstantAggregateZero case - if (isa(GlobalInit)) { - // This is a degenerate case. The initializer is constant zero so the - // length of the string must be zero. - Str.clear(); - return true; - } - - // Must be a Constant Array - ConstantArray *Array = dyn_cast(GlobalInit); - if (Array == 0 || Array->getType()->getElementType() != Type::Int8Ty) - return false; - - // Get the number of elements in the array - uint64_t NumElts = Array->getType()->getNumElements(); - - // Traverse the constant array from StartIdx (derived above) which is - // the place the GEP refers to in the array. - for (unsigned i = StartIdx; i < NumElts; ++i) { - Constant *Elt = Array->getOperand(i); - ConstantInt *CI = dyn_cast(Elt); - if (!CI) // This array isn't suitable, non-int initializer. - return false; - if (CI->isZero()) - return true; // we found end of string, success! - Str += (char)CI->getZExtValue(); - } - - return false; // The array isn't null terminated. -} - /// GetStringLengthH - If we can compute the length of the string pointed to by /// the specified pointer, return 'len+1'. If we can't, return 0. static uint64_t GetStringLengthH(Value *V, SmallPtrSet &PHIs) { Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=52891&r1=52890&r2=52891&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Mon Jun 30 02:31:25 2008 @@ -2658,44 +2658,4 @@ // Delete the old constant! destroyConstant(); -} - - -/// getStringValue - Turn an LLVM constant pointer that eventually points to a -/// global into a string value. Return an empty string if we can't do it. -/// Parameter Chop determines if the result is chopped at the first null -/// terminator. -/// -std::string Constant::getStringValue(bool Chop, unsigned Offset) { - if (GlobalVariable *GV = dyn_cast(this)) { - if (GV->hasInitializer() && isa(GV->getInitializer())) { - ConstantArray *Init = cast(GV->getInitializer()); - if (Init->isString()) { - std::string Result = Init->getAsString(); - if (Offset < Result.size()) { - // If we are pointing INTO The string, erase the beginning... - Result.erase(Result.begin(), Result.begin()+Offset); - - // Take off the null terminator, and any string fragments after it. - if (Chop) { - std::string::size_type NullPos = Result.find_first_of((char)0); - if (NullPos != std::string::npos) - Result.erase(Result.begin()+NullPos, Result.end()); - } - return Result; - } - } - } - } else if (ConstantExpr *CE = dyn_cast(this)) { - if (CE->getOpcode() == Instruction::GetElementPtr) { - // Turn a gep into the specified offset. - if (CE->getNumOperands() == 3 && - cast(CE->getOperand(1))->isNullValue() && - isa(CE->getOperand(2))) { - Offset += cast(CE->getOperand(2))->getZExtValue(); - return CE->getOperand(0)->getStringValue(Chop, Offset); - } - } - } - return ""; -} +} \ No newline at end of file Modified: llvm/trunk/lib/VMCore/IntrinsicInst.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IntrinsicInst.cpp?rev=52891&r1=52890&r2=52891&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/IntrinsicInst.cpp (original) +++ llvm/trunk/lib/VMCore/IntrinsicInst.cpp Mon Jun 30 02:31:25 2008 @@ -28,6 +28,7 @@ #include "llvm/IntrinsicInst.h" #include "llvm/Constants.h" #include "llvm/GlobalVariable.h" +#include "llvm/Analysis/ValueTracking.h" #include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/CodeGen/MachineModuleInfo.h" using namespace llvm; @@ -58,20 +59,20 @@ /// DbgStopPointInst - This represents the llvm.dbg.stoppoint instruction. /// -std::string DbgStopPointInst::getFileName() const { +Value *DbgStopPointInst::getFileName() const { // Once the operand indices are verified, update this assert assert(LLVMDebugVersion == (6 << 16) && "Verify operand indices"); GlobalVariable *GV = cast(getContext()); - if (!GV->hasInitializer()) return ""; + if (!GV->hasInitializer()) return NULL; ConstantStruct *CS = cast(GV->getInitializer()); - return CS->getOperand(3)->getStringValue(); + return CS->getOperand(4); } -std::string DbgStopPointInst::getDirectory() const { +Value *DbgStopPointInst::getDirectory() const { // Once the operand indices are verified, update this assert assert(LLVMDebugVersion == (6 << 16) && "Verify operand indices"); GlobalVariable *GV = cast(getContext()); - if (!GV->hasInitializer()) return ""; + if (!GV->hasInitializer()) return NULL; ConstantStruct *CS = cast(GV->getInitializer()); - return CS->getOperand(4)->getStringValue(); + return CS->getOperand(4); } From evan.cheng at apple.com Mon Jun 30 02:32:57 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 30 Jun 2008 07:32:57 -0000 Subject: [llvm-commits] [llvm] r52892 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h utils/TableGen/RegisterInfoEmitter.cpp Message-ID: <200806300732.m5U7Wvt3031653@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 30 02:32:56 2008 New Revision: 52892 URL: http://llvm.org/viewvc/llvm-project?rev=52892&view=rev Log: Eliminate TargetRegisterDesc::ImmSubRegs. It's no longer in use. Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=52892&r1=52891&r2=52892&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Mon Jun 30 02:32:56 2008 @@ -42,18 +42,15 @@ /// Registers that this does not apply to simply should set this to null. /// The SubRegs field is a zero terminated array of registers that are /// sub-registers of the specific register, e.g. AL, AH are sub-registers of AX. -/// The ImmsubRegs field is a subset of SubRegs. It includes only the immediate -/// sub-registers. e.g. EAX has only one immediate sub-register of AX, not AH, -/// AL which are immediate sub-registers of AX. The SuperRegs field is a zero -/// terminated array of registers that are super-registers of the specific -/// register, e.g. RAX, EAX, are super-registers of AX. +/// The SuperRegs field is a zero terminated array of registers that are +/// super-registers of the specific register, e.g. RAX, EAX, are super-registers +/// of AX. /// struct TargetRegisterDesc { const char *AsmName; // Assembly language name for the register const char *Name; // Printable name for the reg (for debugging) const unsigned *AliasSet; // Register Alias Set, described above const unsigned *SubRegs; // Sub-register set, described above - const unsigned *ImmSubRegs; // Immediate sub-register set, described above const unsigned *SuperRegs; // Super-register set, described above }; @@ -364,14 +361,6 @@ return get(RegNo).SubRegs; } - /// getImmediateSubRegisters - Return the set of registers that are immediate - /// sub-registers of the specified register, or a null list of there are none. - /// The list returned is zero terminated. - /// - const unsigned *getImmediateSubRegisters(unsigned RegNo) const { - return get(RegNo).ImmSubRegs; - } - /// getSuperRegisters - Return the list of registers that are super-registers /// of the specified register, or a null list of there are none. The list /// returned is zero terminated and sorted according to super-sub register Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=52892&r1=52891&r2=52892&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Mon Jun 30 02:32:56 2008 @@ -418,7 +418,6 @@ OS << " };\n"; // Emit register sub-registers / super-registers, aliases... - std::map > RegisterImmSubRegs; std::map > RegisterSubRegs; std::map > RegisterSuperRegs; std::map > RegisterAliases; @@ -459,7 +458,6 @@ cerr << "Warning: register " << getQualifiedName(SubReg) << " specified as a sub-register of " << getQualifiedName(R) << " multiple times!\n"; - RegisterImmSubRegs[R].insert(SubReg); addSubSuperReg(R, SubReg, RegisterSubRegs, RegisterSuperRegs, RegisterAliases); } @@ -502,21 +500,6 @@ OS << "0 };\n"; } - if (!RegisterImmSubRegs.empty()) - OS << "\n\n // Register Immediate Sub-registers Sets...\n"; - - // Loop over all of the registers which have sub-registers, emitting the - // sub-registers list to memory. - for (std::map >::iterator - I = RegisterImmSubRegs.begin(), E = RegisterImmSubRegs.end(); - I != E; ++I) { - OS << " const unsigned " << I->first->getName() << "_ImmSubRegsSet[] = { "; - for (std::set::iterator ASI = I->second.begin(), - E = I->second.end(); ASI != E; ++ASI) - OS << getQualifiedName(*ASI) << ", "; - OS << "0 };\n"; - } - if (!RegisterSuperRegs.empty()) OS << "\n\n // Register Super-registers Sets...\n"; @@ -540,7 +523,7 @@ } OS<<"\n const TargetRegisterDesc RegisterDescriptors[] = { // Descriptors\n"; - OS << " { \"NOREG\",\t\"NOREG\",\t0,\t0,\t0,\t0 },\n"; + OS << " { \"NOREG\",\t\"NOREG\",\t0,\t0,\t0 },\n"; // Now that register alias and sub-registers sets have been emitted, emit the // register descriptors now. @@ -571,10 +554,6 @@ OS << Reg.getName() << "_SubRegsSet,\t"; else OS << "Empty_SubRegsSet,\t"; - if (RegisterImmSubRegs.count(Reg.TheDef)) - OS << Reg.getName() << "_ImmSubRegsSet,\t"; - else - OS << "Empty_SubRegsSet,\t"; if (RegisterSuperRegs.count(Reg.TheDef)) OS << Reg.getName() << "_SuperRegsSet },\n"; else From baldrick at free.fr Mon Jun 30 05:19:17 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 30 Jun 2008 10:19:17 -0000 Subject: [llvm-commits] [llvm] r52893 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/Alpha/AlphaISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/Mips/MipsISelLowering.cpp lib/Target/PIC16/PIC16ISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp Message-ID: <200806301019.m5UAJJbk018595@zion.cs.uiuc.edu> Author: baldrick Date: Mon Jun 30 05:19:09 2008 New Revision: 52893 URL: http://llvm.org/viewvc/llvm-project?rev=52893&view=rev Log: Revert the SelectionDAG optimization that makes it impossible to create a MERGE_VALUES node with only one result: sometimes it is useful to be able to create a node with only one result out of one of the results of a node with more than one result, for example because the new node will eventually be used to replace a one-result node using ReplaceAllUsesWith, cf X86TargetLowering::ExpandFP_TO_SINT. On the other hand, most users of MERGE_VALUES don't need this and for them the optimization was valuable. So add a new utility method getMergeValues for creating MERGE_VALUES nodes which by default performs the optimization. Change almost everywhere to use getMergeValues (and tidy some stuff up at the same time). Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Jun 30 05:19:09 2008 @@ -379,6 +379,15 @@ SDOperand Val, const Value* PtrVal, unsigned Alignment = 0); + /// getMergeValues - Create a MERGE_VALUES node from the given types and ops. + /// Allowed to return something different (and simpler) if Simplify is true. + SDOperand getMergeValues(SDVTList VTs, SDOperandPtr Ops, unsigned NumOps, + bool Simplify = true) { + if (Simplify && NumOps == 1) + return Ops[0]; + return getNode(ISD::MERGE_VALUES, VTs, Ops, NumOps); + } + /// getLoad - Loads are not normal binary operators: their result type is not /// determined by their operands, and they produce a value AND a token chain. /// Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Jun 30 05:19:09 2008 @@ -652,8 +652,7 @@ Result = DAG.getNode(ISD::FP_EXTEND, VT, Result); SDOperand Ops[] = { Result, Chain }; - return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, MVT::Other), - Ops, 2); + return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), Ops, 2); } assert(LoadedVT.isInteger() && !LoadedVT.isVector() && "Unaligned load of unsupported type."); @@ -702,7 +701,7 @@ Hi.getValue(1)); SDOperand Ops[] = { Result, TF }; - return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, MVT::Other), Ops, 2); + return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), Ops, 2); } /// UnrollVectorOp - We know that the given vector has a legal type, however @@ -933,8 +932,7 @@ // Fall Thru case TargetLowering::Legal: { SDOperand Ops[] = { DAG.getConstant(0, VT), Tmp1 }; - Result = DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, MVT::Other), - Ops, 2); + Result = DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), Ops, 2); break; } } @@ -968,8 +966,7 @@ // Fall Thru case TargetLowering::Legal: { SDOperand Ops[] = { DAG.getConstant(0, VT), Tmp2 }; - Result = DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, MVT::Other), - Ops, 2); + Result = DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), Ops, 2); break; } } @@ -4737,10 +4734,10 @@ default: assert(0 && "Unsupported FP setcc!"); } } - + SDOperand Dummy; Tmp1 = ExpandLibCall(LC1, - DAG.getNode(ISD::MERGE_VALUES, VT, LHS, RHS).Val, + DAG.getNode(ISD::MERGE_VALUES, VT, LHS, RHS).Val, false /*sign irrelevant*/, Dummy); Tmp2 = DAG.getConstant(0, MVT::i32); CC = DAG.getCondCode(TLI.getCmpLibcallCC(LC1)); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jun 30 05:19:09 2008 @@ -1983,8 +1983,7 @@ unsigned OpOpcode = Operand.Val->getOpcode(); switch (Opcode) { case ISD::TokenFactor: - case ISD::MERGE_VALUES: - return Operand; // Factor or merge of one node? No need. + return Operand; // Factor of one node? No need. case ISD::FP_ROUND: assert(0 && "Invalid method to make FP_ROUND node"); case ISD::FP_EXTEND: assert(VT.isFloatingPoint() && Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jun 30 05:19:09 2008 @@ -1165,9 +1165,8 @@ ValueVTs.push_back(Val->getValueType(i)); } } - return DAG.getNode(ISD::MERGE_VALUES, - DAG.getVTList(&ValueVTs[0], ValueVTs.size()), - &Constants[0], Constants.size()); + return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), + &Constants[0], Constants.size()); } if (const ArrayType *ATy = dyn_cast(C->getType())) { @@ -1187,9 +1186,8 @@ else Constants[i] = DAG.getConstant(0, EltVT); } - return DAG.getNode(ISD::MERGE_VALUES, - DAG.getVTList(&ValueVTs[0], ValueVTs.size()), - &Constants[0], Constants.size()); + return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), + &Constants[0], Constants.size()); } if (const StructType *STy = dyn_cast(C->getType())) { @@ -1210,9 +1208,8 @@ else Constants[i] = DAG.getConstant(0, EltVT); } - return DAG.getNode(ISD::MERGE_VALUES, - DAG.getVTList(&ValueVTs[0], ValueVTs.size()), - &Constants[0], Constants.size()); + return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), + &Constants[0], Constants.size()); } const VectorType *VecTy = cast(V->getType()); @@ -2722,9 +2719,8 @@ Values[i] = IntoUndef ? DAG.getNode(ISD::UNDEF, AggValueVTs[i]) : SDOperand(Agg.Val, Agg.ResNo + i); - setValue(&I, DAG.getNode(ISD::MERGE_VALUES, - DAG.getVTList(&AggValueVTs[0], NumAggValues), - &Values[0], NumAggValues)); + setValue(&I, DAG.getMergeValues(DAG.getVTList(&AggValueVTs[0], NumAggValues), + &Values[0], NumAggValues)); } void SelectionDAGLowering::visitExtractValue(ExtractValueInst &I) { @@ -2749,9 +2745,8 @@ OutOfUndef ? DAG.getNode(ISD::UNDEF, Agg.Val->getValueType(Agg.ResNo + i)) : SDOperand(Agg.Val, Agg.ResNo + i); - setValue(&I, DAG.getNode(ISD::MERGE_VALUES, - DAG.getVTList(&ValValueVTs[0], NumValValues), - &Values[0], NumValValues)); + setValue(&I, DAG.getMergeValues(DAG.getVTList(&ValValueVTs[0], NumValValues), + &Values[0], NumValValues)); } @@ -2906,9 +2901,8 @@ else PendingLoads.push_back(Chain); - setValue(&I, DAG.getNode(ISD::MERGE_VALUES, - DAG.getVTList(&ValueVTs[0], NumValues), - &Values[0], NumValues)); + setValue(&I, DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], NumValues), + &Values[0], NumValues)); } @@ -3796,9 +3790,8 @@ if (ValueVTs.size() == 1) return Values[0]; - return DAG.getNode(ISD::MERGE_VALUES, - DAG.getVTList(&ValueVTs[0], ValueVTs.size()), - &Values[0], ValueVTs.size()); + return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), + &Values[0], ValueVTs.size()); } /// getCopyToRegs - Emit a series of CopyToReg nodes that copies the @@ -4867,10 +4860,8 @@ AssertOp); ReturnValues.push_back(ReturnValue); } - Res = ReturnValues.size() == 1 ? ReturnValues.front() : - DAG.getNode(ISD::MERGE_VALUES, - DAG.getVTList(&RetTys[0], RetTys.size()), - &ReturnValues[0], ReturnValues.size()); + Res = DAG.getMergeValues(DAG.getVTList(&RetTys[0], RetTys.size()), + &ReturnValues[0], ReturnValues.size()); } return std::make_pair(Res, Chain); @@ -4972,10 +4963,10 @@ SmallVector LegalValueVTs(NumValues); for (unsigned VI = 0; VI != NumValues; ++VI) LegalValueVTs[VI] = Args[a + VI].getValueType(); - SDL.setValue(AI, SDL.DAG.getNode(ISD::MERGE_VALUES, - SDL.DAG.getVTList(&LegalValueVTs[0], - NumValues), - &Args[a], NumValues)); + SDL.setValue(AI, + SDL.DAG.getMergeValues(SDL.DAG.getVTList(&LegalValueVTs[0], + NumValues), + &Args[a], NumValues)); // If this argument is live outside of the entry block, insert a copy from // whereever we got it to the vreg that other BB's will reference it as. DenseMap::iterator VMI=FuncInfo.ValueMap.find(AI); Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Jun 30 05:19:09 2008 @@ -654,8 +654,8 @@ return Chain; ResultVals.push_back(Chain); - SDOperand Res = DAG.getNode(ISD::MERGE_VALUES, NodeTys, &ResultVals[0], - ResultVals.size()); + SDOperand Res = DAG.getMergeValues(DAG.getVTList(&NodeTys[0], NodeTys.size()), + &ResultVals[0], ResultVals.size()); return Res.getValue(Op.ResNo); } @@ -1025,9 +1025,8 @@ ArgValues.push_back(Root); // Return the new list of results. - std::vector RetVT(Op.Val->value_begin(), - Op.Val->value_end()); - return DAG.getNode(ISD::MERGE_VALUES, RetVT, &ArgValues[0], ArgValues.size()); + return DAG.getMergeValues(Op.Val->getVTList(), &ArgValues[0], + ArgValues.size()); } /// isFloatingPointZero - Return true if this is +0.0. Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Mon Jun 30 05:19:09 2008 @@ -280,9 +280,8 @@ ArgValues.push_back(Root); // Return the new list of results. - std::vector RetVT(Op.Val->value_begin(), - Op.Val->value_end()); - return DAG.getNode(ISD::MERGE_VALUES, RetVT, &ArgValues[0], ArgValues.size()); + return DAG.getMergeValues(Op.Val->getVTList(), &ArgValues[0], + ArgValues.size()); } static SDOperand LowerRET(SDOperand Op, SelectionDAG &DAG) { Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Mon Jun 30 05:19:09 2008 @@ -1060,9 +1060,8 @@ ArgValues.push_back(Root); // Return the new list of results. - std::vector RetVT(Op.Val->value_begin(), - Op.Val->value_end()); - return DAG.getNode(ISD::MERGE_VALUES, RetVT, &ArgValues[0], ArgValues.size()); + return DAG.getMergeValues(Op.Val->getVTList(), &ArgValues[0], + ArgValues.size()); } /// isLSAAddress - Return the immediate to use if the specified @@ -1301,8 +1300,8 @@ // Otherwise, merge everything together with a MERGE_VALUES node. ResultVals[NumResults++] = Chain; - SDOperand Res = DAG.getNode(ISD::MERGE_VALUES, NodeTys, - ResultVals, NumResults); + SDOperand Res = DAG.getMergeValues(DAG.getVTList(&NodeTys[0], NodeTys.size()), + ResultVals, NumResults); return Res.getValue(Op.ResNo); } Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Mon Jun 30 05:19:09 2008 @@ -517,8 +517,8 @@ ResultVals.push_back(Chain); // Merge everything together with a MERGE_VALUES node. - return DAG.getNode(ISD::MERGE_VALUES, TheCall->getVTList(), - &ResultVals[0], ResultVals.size()).Val; + return DAG.getMergeValues(TheCall->getVTList(), &ResultVals[0], + ResultVals.size()).Val; } //===----------------------------------------------------------------------===// @@ -649,8 +649,8 @@ ArgValues.push_back(Root); // Return the new list of results. - return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(), - &ArgValues[0], ArgValues.size()).getValue(Op.ResNo); + return DAG.getMergeValues(Op.Val->getVTList(), &ArgValues[0], + ArgValues.size()).getValue(Op.ResNo); } //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Mon Jun 30 05:19:09 2008 @@ -542,8 +542,8 @@ // FIXME: Just copy right now. ArgValues.push_back(Root); - return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(), &ArgValues[0], - ArgValues.size()).getValue(Op.ResNo); + return DAG.getMergeValues(Op.Val->getVTList(), &ArgValues[0], + ArgValues.size()).getValue(Op.ResNo); } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Jun 30 05:19:09 2008 @@ -1775,9 +1775,8 @@ ArgValues.push_back(Root); // Return the new list of results. - std::vector RetVT(Op.Val->value_begin(), - Op.Val->value_end()); - return DAG.getNode(ISD::MERGE_VALUES, RetVT, &ArgValues[0], ArgValues.size()); + return DAG.getMergeValues(Op.Val->getVTList(), &ArgValues[0], + ArgValues.size()); } /// CalculateParameterAndLinkageAreaSize - Get the size of the paramter plus @@ -2557,8 +2556,8 @@ // Otherwise, merge everything together with a MERGE_VALUES node. ResultVals.push_back(Chain); - SDOperand Res = DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(), - &ResultVals[0], ResultVals.size()); + SDOperand Res = DAG.getMergeValues(Op.Val->getVTList(), &ResultVals[0], + ResultVals.size()); return Res.getValue(Op.ResNo); } @@ -2753,8 +2752,7 @@ }; SDOperand Store = DAG.getNode(PPCISD::STCX, MVT::Other, Ops2, 4); SDOperand OutOps[] = { Load, Store }; - return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, MVT::Other), - OutOps, 2); + return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), OutOps, 2); } SDOperand PPCTargetLowering::LowerAtomicCMP_SWAP(SDOperand Op, SelectionDAG &DAG) { @@ -2796,8 +2794,7 @@ }; SDOperand Store = DAG.getNode(PPCISD::STCX, MVT::Other, Ops3, 4); SDOperand OutOps[] = { Load, Store }; - return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, MVT::Other), - OutOps, 2); + return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), OutOps, 2); } SDOperand PPCTargetLowering::LowerAtomicSWAP(SDOperand Op, SelectionDAG &DAG) { @@ -2829,8 +2826,7 @@ }; SDOperand Store = DAG.getNode(PPCISD::STCX, MVT::Other, Ops2, 4); SDOperand OutOps[] = { Load, Store }; - return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, MVT::Other), - OutOps, 2); + return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), OutOps, 2); } /// LowerSELECT_CC - Lower floating point select_cc's into fsel instruction when @@ -3134,8 +3130,7 @@ SDOperand OutHi = DAG.getNode(ISD::OR, VT, Tmp4, Tmp6); SDOperand OutLo = DAG.getNode(PPCISD::SHL, VT, Lo, Amt); SDOperand OutOps[] = { OutLo, OutHi }; - return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, VT), - OutOps, 2); + return DAG.getMergeValues(DAG.getVTList(VT, VT), OutOps, 2); } SDOperand PPCTargetLowering::LowerSRL_PARTS(SDOperand Op, SelectionDAG &DAG) { @@ -3163,8 +3158,7 @@ SDOperand OutLo = DAG.getNode(ISD::OR, VT, Tmp4, Tmp6); SDOperand OutHi = DAG.getNode(PPCISD::SRL, VT, Hi, Amt); SDOperand OutOps[] = { OutLo, OutHi }; - return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, VT), - OutOps, 2); + return DAG.getMergeValues(DAG.getVTList(VT, VT), OutOps, 2); } SDOperand PPCTargetLowering::LowerSRA_PARTS(SDOperand Op, SelectionDAG &DAG) { @@ -3192,8 +3186,7 @@ SDOperand OutLo = DAG.getSelectCC(Tmp5, DAG.getConstant(0, AmtVT), Tmp4, Tmp6, ISD::SETLE); SDOperand OutOps[] = { OutLo, OutHi }; - return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(VT, VT), - OutOps, 2); + return DAG.getMergeValues(DAG.getVTList(VT, VT), OutOps, 2); } //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Mon Jun 30 05:19:09 2008 @@ -450,8 +450,8 @@ ResultVals.push_back(Chain); // Merge everything together with a MERGE_VALUES node. - return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(), - &ResultVals[0], ResultVals.size()); + return DAG.getMergeValues(Op.Val->getVTList(), &ResultVals[0], + ResultVals.size()); } @@ -829,8 +829,7 @@ DAG.getNode(ISD::BIT_CONVERT, MVT::f64, V), V.getValue(1) }; - return DAG.getNode(ISD::MERGE_VALUES, DAG.getVTList(MVT::f64, MVT::Other), - Ops, 2); + return DAG.getMergeValues(DAG.getVTList(MVT::f64, MVT::Other), Ops, 2); } static SDOperand LowerDYNAMIC_STACKALLOC(SDOperand Op, SelectionDAG &DAG) { @@ -846,11 +845,8 @@ // to provide a register spill area. SDOperand NewVal = DAG.getNode(ISD::ADD, MVT::i32, NewSP, DAG.getConstant(96, MVT::i32)); - std::vector Tys; - Tys.push_back(MVT::i32); - Tys.push_back(MVT::Other); SDOperand Ops[2] = { NewVal, Chain }; - return DAG.getNode(ISD::MERGE_VALUES, Tys, Ops, 2); + return DAG.getMergeValues(DAG.getVTList(MVT::i32, MVT::Other), Ops, 2); } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=52893&r1=52892&r2=52893&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jun 30 05:19:09 2008 @@ -979,8 +979,8 @@ // Merge everything together with a MERGE_VALUES node. ResultVals.push_back(Chain); - return DAG.getNode(ISD::MERGE_VALUES, TheCall->getVTList(), - &ResultVals[0], ResultVals.size()).Val; + return DAG.getMergeValues(TheCall->getVTList(), &ResultVals[0], + ResultVals.size()).Val; } @@ -1377,8 +1377,8 @@ FuncInfo->setBytesToPopOnReturn(BytesToPopOnReturn); // Return the new list of results. - return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(), - &ArgValues[0], ArgValues.size()).getValue(Op.ResNo); + return DAG.getMergeValues(Op.Val->getVTList(), &ArgValues[0], + ArgValues.size()).getValue(Op.ResNo); } SDOperand @@ -4361,7 +4361,6 @@ Tmp3 = DAG.getNode(isSRA ? ISD::SRA : ISD::SRL, VT, ShOpHi, ShAmt); } - const MVT *VTs = DAG.getNodeValueTypes(MVT::Other, MVT::Flag); SDOperand AndNode = DAG.getNode(ISD::AND, MVT::i8, ShAmt, DAG.getConstant(VTBits, MVT::i8)); SDOperand Cond = DAG.getNode(X86ISD::CMP, VT, @@ -4369,41 +4368,19 @@ SDOperand Hi, Lo; SDOperand CC = DAG.getConstant(X86::COND_NE, MVT::i8); - VTs = DAG.getNodeValueTypes(VT, MVT::Flag); - SmallVector Ops; - if (Op.getOpcode() == ISD::SHL_PARTS) { - Ops.push_back(Tmp2); - Ops.push_back(Tmp3); - Ops.push_back(CC); - Ops.push_back(Cond); - Hi = DAG.getNode(X86ISD::CMOV, VT, &Ops[0], Ops.size()); + SDOperand Ops0[4] = { Tmp2, Tmp3, CC, Cond }; + SDOperand Ops1[4] = { Tmp3, Tmp1, CC, Cond }; - Ops.clear(); - Ops.push_back(Tmp3); - Ops.push_back(Tmp1); - Ops.push_back(CC); - Ops.push_back(Cond); - Lo = DAG.getNode(X86ISD::CMOV, VT, &Ops[0], Ops.size()); + if (Op.getOpcode() == ISD::SHL_PARTS) { + Hi = DAG.getNode(X86ISD::CMOV, VT, Ops0, 4); + Lo = DAG.getNode(X86ISD::CMOV, VT, Ops1, 4); } else { - Ops.push_back(Tmp2); - Ops.push_back(Tmp3); - Ops.push_back(CC); - Ops.push_back(Cond); - Lo = DAG.getNode(X86ISD::CMOV, VT, &Ops[0], Ops.size()); - - Ops.clear(); - Ops.push_back(Tmp3); - Ops.push_back(Tmp1); - Ops.push_back(CC); - Ops.push_back(Cond); - Hi = DAG.getNode(X86ISD::CMOV, VT, &Ops[0], Ops.size()); + Lo = DAG.getNode(X86ISD::CMOV, VT, Ops0, 4); + Hi = DAG.getNode(X86ISD::CMOV, VT, Ops1, 4); } - VTs = DAG.getNodeValueTypes(VT, VT); - Ops.clear(); - Ops.push_back(Lo); - Ops.push_back(Hi); - return DAG.getNode(ISD::MERGE_VALUES, VTs, 2, &Ops[0], Ops.size()); + SDOperand Ops[2] = { Lo, Hi }; + return DAG.getMergeValues(DAG.getVTList(VT, VT), Ops, 2); } SDOperand X86TargetLowering::LowerSINT_TO_FP(SDOperand Op, SelectionDAG &DAG) { @@ -4531,13 +4508,15 @@ std::pair Vals = FP_TO_SINTHelper(SDOperand(N, 0), DAG); SDOperand FIST = Vals.first, StackSlot = Vals.second; if (FIST.Val == 0) return 0; - - // Return an i64 load from the stack slot. - SDOperand Res = DAG.getLoad(MVT::i64, FIST, StackSlot, NULL, 0); + + MVT VT = N->getValueType(0); + + // Return a load from the stack slot. + SDOperand Res = DAG.getLoad(VT, FIST, StackSlot, NULL, 0); // Use a MERGE_VALUES node to drop the chain result value. - return DAG.getNode(ISD::MERGE_VALUES, MVT::i64, Res).Val; -} + return DAG.getMergeValues(DAG.getVTList(VT), &Res, 1, false).Val; +} SDOperand X86TargetLowering::LowerFABS(SDOperand Op, SelectionDAG &DAG) { MVT VT = Op.getValueType(); @@ -4833,11 +4812,8 @@ Chain = DAG.getCopyFromReg(Chain, X86StackPtr, SPTy).getValue(1); - std::vector Tys; - Tys.push_back(SPTy); - Tys.push_back(MVT::Other); SDOperand Ops1[2] = { Chain.getValue(0), Chain }; - return DAG.getNode(ISD::MERGE_VALUES, Tys, Ops1, 2); + return DAG.getMergeValues(DAG.getVTList(SPTy, MVT::Other), Ops1, 2); } SDOperand @@ -5069,7 +5045,7 @@ }; Tys = DAG.getVTList(MVT::i64, MVT::Other); - return DAG.getNode(ISD::MERGE_VALUES, Tys, Ops, 2).Val; + return DAG.getMergeValues(Tys, Ops, 2).Val; } SDOperand eax = DAG.getCopyFromReg(rd, X86::EAX, MVT::i32, rd.getValue(1)); @@ -5081,8 +5057,7 @@ // Use a MERGE_VALUES to return the value and chain. Ops[1] = edx.getValue(1); - Tys = DAG.getVTList(MVT::i64, MVT::Other); - return DAG.getNode(ISD::MERGE_VALUES, Tys, Ops, 2).Val; + return DAG.getMergeValues(DAG.getVTList(MVT::i64, MVT::Other), Ops, 2).Val; } SDOperand X86TargetLowering::LowerVASTART(SDOperand Op, SelectionDAG &DAG) { @@ -5463,7 +5438,7 @@ SDOperand Ops[] = { Trmp, DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains, 6) }; - return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(), Ops, 2); + return DAG.getMergeValues(Op.Val->getVTList(), Ops, 2); } else { const Function *Func = cast(cast(Op.getOperand(5))->getValue()); @@ -5531,7 +5506,7 @@ SDOperand Ops[] = { Trmp, DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains, 4) }; - return DAG.getNode(ISD::MERGE_VALUES, Op.Val->getVTList(), Ops, 2); + return DAG.getMergeValues(Op.Val->getVTList(), Ops, 2); } } @@ -5718,8 +5693,8 @@ cpOutL.getValue(2)); SDOperand OpsF[] = { cpOutL.getValue(0), cpOutH.getValue(0)}; SDOperand ResultVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, OpsF, 2); - Tys = DAG.getVTList(MVT::i64, MVT::Other); - return DAG.getNode(ISD::MERGE_VALUES, Tys, ResultVal, cpOutH.getValue(1)).Val; + SDOperand Vals[2] = { ResultVal, cpOutH.getValue(1) }; + return DAG.getMergeValues(DAG.getVTList(MVT::i64, MVT::Other), Vals, 2).Val; } SDNode* X86TargetLowering::ExpandATOMIC_LOAD_SUB(SDNode* Op, SelectionDAG &DAG) { From baldrick at free.fr Mon Jun 30 06:50:17 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 30 Jun 2008 11:50:17 -0000 Subject: [llvm-commits] [llvm] r52895 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeIntegerTypes.cpp LegalizeTypes.h Message-ID: <200806301150.m5UBoI4K022019@zion.cs.uiuc.edu> Author: baldrick Date: Mon Jun 30 06:50:11 2008 New Revision: 52895 URL: http://llvm.org/viewvc/llvm-project?rev=52895&view=rev Log: Support for promoting select_cc operands. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=52895&r1=52894&r2=52895&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Jun 30 06:50:11 2008 @@ -444,6 +444,7 @@ case ISD::BRCOND: Res = PromoteIntOp_BRCOND(N, OpNo); break; case ISD::BR_CC: Res = PromoteIntOp_BR_CC(N, OpNo); break; case ISD::SELECT: Res = PromoteIntOp_SELECT(N, OpNo); break; + case ISD::SELECT_CC: Res = PromoteIntOp_SELECT_CC(N, OpNo); break; case ISD::SETCC: Res = PromoteIntOp_SETCC(N, OpNo); break; case ISD::STORE: Res = PromoteIntOp_STORE(cast(N), @@ -568,7 +569,7 @@ } SDOperand DAGTypeLegalizer::PromoteIntOp_BR_CC(SDNode *N, unsigned OpNo) { - assert(OpNo == 2 && "Don't know how to promote this operand"); + assert(OpNo == 2 && "Don't know how to promote this operand!"); SDOperand LHS = N->getOperand(2); SDOperand RHS = N->getOperand(3); @@ -580,8 +581,20 @@ N->getOperand(1), LHS, RHS, N->getOperand(4)); } +SDOperand DAGTypeLegalizer::PromoteIntOp_SELECT_CC(SDNode *N, unsigned OpNo) { + assert(OpNo == 0 && "Don't know how to promote this operand!"); + + SDOperand LHS = N->getOperand(0); + SDOperand RHS = N->getOperand(1); + PromoteSetCCOperands(LHS, RHS, cast(N->getOperand(4))->get()); + + // The CC (#4) and the possible return values (#2 and #3) have legal types. + return DAG.UpdateNodeOperands(SDOperand(N, 0), LHS, RHS, N->getOperand(2), + N->getOperand(3), N->getOperand(4)); +} + SDOperand DAGTypeLegalizer::PromoteIntOp_SETCC(SDNode *N, unsigned OpNo) { - assert(OpNo == 0 && "Don't know how to promote this operand"); + assert(OpNo == 0 && "Don't know how to promote this operand!"); SDOperand LHS = N->getOperand(0); SDOperand RHS = N->getOperand(1); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=52895&r1=52894&r2=52895&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Mon Jun 30 06:50:11 2008 @@ -248,6 +248,7 @@ SDOperand PromoteIntOp_INSERT_VECTOR_ELT(SDNode *N, unsigned OpNo); SDOperand PromoteIntOp_MEMBARRIER(SDNode *N); SDOperand PromoteIntOp_SELECT(SDNode *N, unsigned OpNo); + SDOperand PromoteIntOp_SELECT_CC(SDNode *N, unsigned OpNo); SDOperand PromoteIntOp_SETCC(SDNode *N, unsigned OpNo); SDOperand PromoteIntOp_SIGN_EXTEND(SDNode *N); SDOperand PromoteIntOp_STORE(StoreSDNode *N, unsigned OpNo); @@ -428,7 +429,6 @@ void SplitVecRes_UnOp(SDNode *N, SDOperand &Lo, SDOperand &Hi); void SplitVecRes_BinOp(SDNode *N, SDOperand &Lo, SDOperand &Hi); void SplitVecRes_FPOWI(SDNode *N, SDOperand &Lo, SDOperand &Hi); - void SplitVecRes_SELECT(SDNode *N, SDOperand &Lo, SDOperand &Hi); // Vector Operand Splitting: <128 x ty> -> 2 x <64 x ty>. bool SplitOperand(SDNode *N, unsigned OpNo); From baldrick at free.fr Mon Jun 30 08:55:16 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 30 Jun 2008 13:55:16 -0000 Subject: [llvm-commits] [llvm] r52898 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeIntegerTypes.cpp LegalizeTypes.h Message-ID: <200806301355.m5UDtGOl025922@zion.cs.uiuc.edu> Author: baldrick Date: Mon Jun 30 08:55:15 2008 New Revision: 52898 URL: http://llvm.org/viewvc/llvm-project?rev=52898&view=rev Log: Support for VAARG. As noted in a comment, this is wrong for types like x86 long double and i1, but no worse than what is done in LegalizeDAG. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=52898&r1=52897&r2=52898&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Jun 30 08:55:15 2008 @@ -84,6 +84,8 @@ case ISD::EXTRACT_VECTOR_ELT: Result = PromoteIntRes_EXTRACT_VECTOR_ELT(N); break; + + case ISD::VAARG : Result = PromoteIntRes_VAARG(N); break; } // If Result is null, the sub-method took care of registering the result. @@ -411,6 +413,36 @@ return DAG.getNode(ISD::SELECT, NewVT, Odd, Hi, Lo); } +SDOperand DAGTypeLegalizer::PromoteIntRes_VAARG(SDNode *N) { + SDOperand Chain = N->getOperand(0); // Get the chain. + SDOperand Ptr = N->getOperand(1); // Get the pointer. + MVT VT = N->getValueType(0); + + const Value *V = cast(N->getOperand(2))->getValue(); + SDOperand VAList = DAG.getLoad(TLI.getPointerTy(), Chain, Ptr, V, 0); + + // Increment the arg pointer, VAList, to the next vaarg + // FIXME: should the ABI size be used for the increment? Think of + // x86 long double (10 bytes long, but aligned on 4 or 8 bytes) or + // integers of unusual size (such MVT::i1, which gives an increment + // of zero here!). + unsigned Increment = VT.getSizeInBits() / 8; + SDOperand Tmp = DAG.getNode(ISD::ADD, TLI.getPointerTy(), VAList, + DAG.getConstant(Increment, TLI.getPointerTy())); + + // Store the incremented VAList to the pointer. + Tmp = DAG.getStore(VAList.getValue(1), Tmp, Ptr, V, 0); + + // Load the actual argument out of the arg pointer VAList. + Tmp = DAG.getExtLoad(ISD::EXTLOAD, TLI.getTypeToTransformTo(VT), Tmp, + VAList, NULL, 0, VT); + + // Legalized the chain result - switch anything that used the old chain to + // use the new one. + ReplaceValueWith(SDOperand(N, 1), Tmp.getValue(1)); + return Tmp; +} + //===----------------------------------------------------------------------===// // Integer Operand Promotion //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=52898&r1=52897&r2=52898&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Mon Jun 30 08:55:15 2008 @@ -234,6 +234,7 @@ SDOperand PromoteIntRes_TRUNCATE(SDNode *N); SDOperand PromoteIntRes_UDIV(SDNode *N); SDOperand PromoteIntRes_UNDEF(SDNode *N); + SDOperand PromoteIntRes_VAARG(SDNode *N); // Integer Operand Promotion. bool PromoteIntegerOperand(SDNode *N, unsigned OperandNo); From clattner at apple.com Mon Jun 30 10:51:45 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 30 Jun 2008 08:51:45 -0700 Subject: [llvm-commits] [llvm] r52854 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <76165B66-37FF-4966-8416-177DC831AB1A@apple.com> References: <200806280624.m5S6OpPs025870@zion.cs.uiuc.edu> <1214650526.8922.53.camel@localhost> <45C12D28-BB2C-4AE8-8498-03C10C95AF2B@apple.com> <1214769393.8922.67.camel@localhost> <76165B66-37FF-4966-8416-177DC831AB1A@apple.com> Message-ID: <6BE3F8BF-5B87-4413-A81B-2FF92500B3B9@apple.com> Thank you Evan! -Chris On Jun 30, 2008, at 12:11 AM, Evan Cheng wrote: > I have a proper fix (I think). I'll commit it soon. Please let me know > if llvm-gcc bootstrapping fails for you. > > Evan > > On Jun 29, 2008, at 12:56 PM, Anton Korobeynikov wrote: > >> Hi, Evan >> >>> I haven't had a chance to look into it. But 64-bit llvm compiles >>> this >>> bc file compiles to different code from 32-bit llvm. >> Hope, this will help. However, I've reverted that series of patches >> for >> now. >> >> -- >> 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 > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From asl at math.spbu.ru Mon Jun 30 11:06:17 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 30 Jun 2008 20:06:17 +0400 Subject: [llvm-commits] [llvm] r52854 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp In-Reply-To: <6BE3F8BF-5B87-4413-A81B-2FF92500B3B9@apple.com> References: <200806280624.m5S6OpPs025870@zion.cs.uiuc.edu> <1214650526.8922.53.camel@localhost> <45C12D28-BB2C-4AE8-8498-03C10C95AF2B@apple.com> <1214769393.8922.67.camel@localhost> <76165B66-37FF-4966-8416-177DC831AB1A@apple.com> <6BE3F8BF-5B87-4413-A81B-2FF92500B3B9@apple.com> Message-ID: <1214841977.8922.89.camel@localhost> > Thank you Evan! This also passes for me! -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From kremenek at apple.com Mon Jun 30 11:12:59 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 30 Jun 2008 16:12:59 -0000 Subject: [llvm-commits] [llvm] r52900 - /llvm/tags/checker/checker-48/ Message-ID: <200806301612.m5UGCxEJ030485@zion.cs.uiuc.edu> Author: kremenek Date: Mon Jun 30 11:12:59 2008 New Revision: 52900 URL: http://llvm.org/viewvc/llvm-project?rev=52900&view=rev Log: Tagging checker-48. Added: llvm/tags/checker/checker-48/ - copied from r52899, llvm/trunk/ From baldrick at free.fr Mon Jun 30 11:43:45 2008 From: baldrick at free.fr (Duncan Sands) Date: Mon, 30 Jun 2008 16:43:45 -0000 Subject: [llvm-commits] [llvm] r52903 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Message-ID: <200806301643.m5UGhjT5031634@zion.cs.uiuc.edu> Author: baldrick Date: Mon Jun 30 11:43:45 2008 New Revision: 52903 URL: http://llvm.org/viewvc/llvm-project?rev=52903&view=rev Log: ExpungeNode is only needed for new nodes! This fixes CodeGen/PowerPC/2008-06-19-LegalizerCrash.ll when using the new LegalizeTypes infrastructure. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=52903&r1=52902&r2=52903&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Mon Jun 30 11:43:45 2008 @@ -364,16 +364,19 @@ } } -/// ExpungeNode - If this is a deleted value that was kept around to speed up -/// remapping, remove it globally now. The only map that can have a deleted -/// node as a source is ReplacedNodes. Other maps can have deleted nodes as -/// targets, but since their looked-up values are always immediately remapped -/// using RemapNode, resulting in a not-deleted node, this is harmless as long -/// as ReplacedNodes/RemapNode always performs correct mappings. The mapping -/// will always be correct as long as ExpungeNode is called on the source when -/// adding a new node to ReplacedNodes, and called on the target when adding -/// a new node to any map. +/// ExpungeNode - If this is a reincarnation of a deleted value that was kept +/// around to speed up remapping, remove it from all maps now. The only map +/// that can have a deleted node as a source is ReplacedNodes. Other maps can +/// have deleted nodes as targets, but since their looked-up values are always +/// immediately remapped using RemapNode, resulting in a not-deleted node, this +/// is harmless as long as ReplacedNodes/RemapNode always performs correct +/// mappings. The mapping will always be correct as long as ExpungeNode is +/// called on the source when adding a new node to ReplacedNodes, and called on +/// the target when adding a new node to any map. void DAGTypeLegalizer::ExpungeNode(SDOperand N) { + if (N.Val->getNodeId() != NewNode) + return; + SDOperand Replacement = N; RemapNode(Replacement); if (Replacement != N) { From clattner at apple.com Mon Jun 30 12:18:00 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 30 Jun 2008 10:18:00 -0700 Subject: [llvm-commits] [llvm] r52893 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/Alpha/AlphaISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/Mips/MipsISelLowering.cpp lib/Target/PIC16/PIC16ISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <200806301019.m5UAJJbk018595@zion.cs.uiuc.edu> References: <200806301019.m5UAJJbk018595@zion.cs.uiuc.edu> Message-ID: On Jun 30, 2008, at 3:19 AM, Duncan Sands wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=52893&view=rev > Log: > Revert the SelectionDAG optimization that makes > it impossible to create a MERGE_VALUES node with > only one result: sometimes it is useful to be able > to create a node with only one result out of one of Ok > > + /// getMergeValues - Create a MERGE_VALUES node from the given > types and ops. > + /// Allowed to return something different (and simpler) if > Simplify is true. > + SDOperand getMergeValues(SDVTList VTs, SDOperandPtr Ops, unsigned > NumOps, > + bool Simplify = true) { > + if (Simplify && NumOps == 1) > + return Ops[0]; > + return getNode(ISD::MERGE_VALUES, VTs, Ops, NumOps); > + } Why require clients to pass in the VTlist? Can it be inferred from the operands? Since 'getMergeValues' is specific to the MERGE_VALUES node, it seems like a nicety to do that. -Chris From dalej at apple.com Mon Jun 30 12:22:46 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 30 Jun 2008 17:22:46 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52905 - in /llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg: const-cfstring-4-64bit.m const-cfstring-4.m const-str-10-64bit.m const-str-10.m const-str-11-64bit.m const-str-11.m const-str-9-64bit.m const-str-9.m next-runtime-1.m objc2-protocol-ext-1.m symtab-1-64bit.m symtab-1.m Message-ID: <200806301722.m5UHMkTK001059@zion.cs.uiuc.edu> Author: johannes Date: Mon Jun 30 12:22:45 2008 New Revision: 52905 URL: http://llvm.org/viewvc/llvm-project?rev=52905&view=rev Log: Allow for trailing comments inserted by llvm assembly. Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-cfstring-4-64bit.m llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-cfstring-4.m llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-10-64bit.m llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-10.m llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-11-64bit.m llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-11.m llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-9-64bit.m llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-9.m llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1.m llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-protocol-ext-1.m llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1-64bit.m llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1.m Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-cfstring-4-64bit.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-cfstring-4-64bit.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-cfstring-4-64bit.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-cfstring-4-64bit.m Mon Jun 30 12:22:45 2008 @@ -9,4 +9,4 @@ /* { dg-final { scan-assembler ".section __DATA, __cfstring" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space( |\t)4\n\t.quad\t.*\n\t.quad\t19\n" } } */ +/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992.*\n\t.space( |\t)4\n\t.quad\t.*\n\t.quad\t19\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-cfstring-4.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-cfstring-4.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-cfstring-4.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-cfstring-4.m Mon Jun 30 12:22:45 2008 @@ -11,4 +11,4 @@ /* { dg-final { scan-assembler ".section __DATA, __cfstring" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".long\t___CFConstantStringClassReference\n\t.long\t1992\n\t.long\t.*\n\t.long\t19\n" } } */ +/* { dg-final { scan-assembler ".long\t___CFConstantStringClassReference\n\t.long\t1992.*\n\t.long\t.*\n\t.long\t19.*\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-10-64bit.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-10-64bit.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-10-64bit.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-10-64bit.m Mon Jun 30 12:22:45 2008 @@ -31,4 +31,4 @@ /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".quad\t__NSConstantStringClassReference\n\t.quad\t.*\n\t.long\t5\n\t.space( |\t)4\n" } } */ +/* { dg-final { scan-assembler ".quad\t__NSConstantStringClassReference\n\t.quad\t.*\n\t.long\t5.*\n\t.space( |\t)4\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-10.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-10.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-10.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-10.m Mon Jun 30 12:22:45 2008 @@ -34,4 +34,4 @@ /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5.*\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-11-64bit.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-11-64bit.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-11-64bit.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-11-64bit.m Mon Jun 30 12:22:45 2008 @@ -30,4 +30,4 @@ /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".quad\t__XStrClassReference\n\t.quad\t.*\n\t.long\t5\n\t.space( |\t)4\n" } } */ +/* { dg-final { scan-assembler ".quad\t__XStrClassReference\n\t.quad\t.*\n\t.long\t5.*\n\t.space( |\t)4\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-11.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-11.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-11.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-11.m Mon Jun 30 12:22:45 2008 @@ -33,4 +33,4 @@ /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n" } } */ +/* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5.*\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-9-64bit.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-9-64bit.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-9-64bit.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-9-64bit.m Mon Jun 30 12:22:45 2008 @@ -22,4 +22,4 @@ /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".quad\t__NSConstantStringClassReference\n\t.quad\t.*\n\t.long\t5\n\t.space( |\t)4\n" } } */ +/* { dg-final { scan-assembler ".quad\t__NSConstantStringClassReference\n\t.quad\t.*\n\t.long\t5.*\n\t.space( |\t)4\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-9.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-9.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-9.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/const-str-9.m Mon Jun 30 12:22:45 2008 @@ -27,4 +27,4 @@ /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5.*\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/next-runtime-1.m Mon Jun 30 12:22:45 2008 @@ -21,4 +21,4 @@ /* APPLE LOCAL radar 4585769 */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler "L_OBJC_MODULES:.*\n\[ \t\]*\.long\t7\n" } } */ +/* { dg-final { scan-assembler "L_OBJC_MODULES:.*\n\[ \t\]*\.long\t7.*\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-protocol-ext-1.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-protocol-ext-1.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-protocol-ext-1.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/objc2-protocol-ext-1.m Mon Jun 30 12:22:45 2008 @@ -12,4 +12,4 @@ @interface Super { id isa; } @end @implementation Super @end /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".long\t72\n\t.(long\t0|space\t4)" } } */ +/* { dg-final { scan-assembler ".long\t72.*\n\t.(long\t0|space\t4)" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1-64bit.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1-64bit.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1-64bit.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1-64bit.m Mon Jun 30 12:22:45 2008 @@ -23,4 +23,4 @@ /* APPLE LOCAL testing */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:.*\n\t(.quad\t0|.space\t8)\n\t(.long\t0\n\t.space 4|.space\t8)\n\t.(short|word)\t2\n\t.((short|word)\t0|space\t2)\n\t.space( |\t)4\n\t.quad\tL_OBJC_CLASS_Derived.*\n\t.quad\tL_OBJC_CLASS_Base.*\n" } } */ +/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:.*\n\t(.quad\t0|.space\t8)\n\t(.long\t0\n\t.space 4|.space\t8)\n\t.(short|word)\t2.*\n\t.((short|word)\t0|space\t2)\n\t.space( |\t)4\n\t.quad\tL_OBJC_CLASS_Derived.*\n\t.quad\tL_OBJC_CLASS_Base.*\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1.m URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1.m?rev=52905&r1=52904&r2=52905&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1.m (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/objc.dg/symtab-1.m Mon Jun 30 12:22:45 2008 @@ -26,4 +26,4 @@ /* APPLE LOCAL testing */ /* LLVM LOCAL llvm syntax */ -/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:.*\n\t(.long\t0|.space\t4)\n\t(.long\t0|.space\t4)\n\t.(short|word)\t2\n\t.((short|word)\t0|space\t2)\n\t.long\tL_OBJC_CLASS_Derived.*\n\t.long\tL_OBJC_CLASS_Base.*\n" } } */ +/* { dg-final { scan-assembler "L_OBJC_SYMBOLS.*:.*\n\t(.long\t0|.space\t4)\n\t(.long\t0|.space\t4)\n\t.(short|word)\t2.*\n\t.((short|word)\t0|space\t2)\n\t.long\tL_OBJC_CLASS_Derived.*\n\t.long\tL_OBJC_CLASS_Base.*\n" } } */ From dalej at apple.com Mon Jun 30 12:29:10 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 30 Jun 2008 17:29:10 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52906 - in /llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg: const-cfstring-4-64bit.mm const-cfstring-4.mm const-str-10.mm const-str-11.mm const-str-9.mm objc2-protocol-ext-1.mm Message-ID: <200806301729.m5UHTBNN001331@zion.cs.uiuc.edu> Author: johannes Date: Mon Jun 30 12:29:10 2008 New Revision: 52906 URL: http://llvm.org/viewvc/llvm-project?rev=52906&view=rev Log: Allow for trailing comments in llvm assembly. Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-cfstring-4-64bit.mm llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-cfstring-4.mm llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-10.mm llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-11.mm llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-9.mm llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-ext-1.mm Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-cfstring-4-64bit.mm URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/const-cfstring-4-64bit.mm?rev=52906&r1=52905&r2=52906&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-cfstring-4-64bit.mm (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-cfstring-4-64bit.mm Mon Jun 30 12:29:10 2008 @@ -9,4 +9,4 @@ /* { dg-final { scan-assembler ".section __DATA, __cfstring" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992\n\t.space( |\t)4\n\t.quad\t.*\n\t.quad\t19\n" } } */ +/* { dg-final { scan-assembler ".quad\t___CFConstantStringClassReference\n\t.long\t1992.*\n\t.space( |\t)4\n\t.quad\t.*\n\t.quad\t19\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-cfstring-4.mm URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/const-cfstring-4.mm?rev=52906&r1=52905&r2=52906&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-cfstring-4.mm (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-cfstring-4.mm Mon Jun 30 12:29:10 2008 @@ -11,4 +11,4 @@ /* { dg-final { scan-assembler ".section __DATA, __cfstring" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".long\t___CFConstantStringClassReference\n\t.long\t1992\n\t.long\t.*\n\t.long\t19\n" } } */ +/* { dg-final { scan-assembler ".long\t___CFConstantStringClassReference\n\t.long\t1992.*\n\t.long\t.*\n\t.long\t19.*\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-10.mm URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/const-str-10.mm?rev=52906&r1=52905&r2=52906&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-10.mm (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-10.mm Mon Jun 30 12:29:10 2008 @@ -32,4 +32,4 @@ /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5.*\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-11.mm URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/const-str-11.mm?rev=52906&r1=52905&r2=52906&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-11.mm (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-11.mm Mon Jun 30 12:29:10 2008 @@ -31,4 +31,4 @@ /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5\n" } } */ +/* { dg-final { scan-assembler ".long\t__XStrClassReference\n\t.long\t.*\n\t.long\t5.*\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-9.mm URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/const-str-9.mm?rev=52906&r1=52905&r2=52906&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-9.mm (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/const-str-9.mm Mon Jun 30 12:29:10 2008 @@ -24,4 +24,4 @@ /* { dg-final { scan-assembler ".section __OBJC, __cstring_object" } } */ /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5\n" } } */ +/* { dg-final { scan-assembler ".long\t__NSConstantStringClassReference\n\t.long\t.*\n\t.long\t5.*\n" } } */ Modified: llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-ext-1.mm URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/obj-c%2B%2B.dg/objc2-protocol-ext-1.mm?rev=52906&r1=52905&r2=52906&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-ext-1.mm (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/obj-c++.dg/objc2-protocol-ext-1.mm Mon Jun 30 12:29:10 2008 @@ -12,4 +12,4 @@ @interface Super { id isa; } @end @implementation Super @end /* LLVM LOCAL accept llvm syntax */ -/* { dg-final { scan-assembler ".long\t72\n\t.(long\t0|space\t4)" } } */ +/* { dg-final { scan-assembler ".long\t72.*\n\t.(long\t0|space\t4)" } } */ From dpatel at apple.com Mon Jun 30 12:32:58 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 30 Jun 2008 17:32:58 -0000 Subject: [llvm-commits] [llvm] r52907 - in /llvm/trunk: lib/VMCore/Dominators.cpp tools/opt/GraphPrinters.cpp Message-ID: <200806301732.m5UHWwiN001510@zion.cs.uiuc.edu> Author: dpatel Date: Mon Jun 30 12:32:58 2008 New Revision: 52907 URL: http://llvm.org/viewvc/llvm-project?rev=52907&view=rev Log: Move dominator info printer into tool/opt/GraphPrinters.cpp Modified: llvm/trunk/lib/VMCore/Dominators.cpp llvm/trunk/tools/opt/GraphPrinters.cpp Modified: llvm/trunk/lib/VMCore/Dominators.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=52907&r1=52906&r2=52907&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Dominators.cpp (original) +++ llvm/trunk/lib/VMCore/Dominators.cpp Mon Jun 30 12:32:58 2008 @@ -287,33 +287,3 @@ print (llvm::cerr); } -//===----------------------------------------------------------------------===// -// DomInfoPrinter Pass -//===----------------------------------------------------------------------===// - -namespace { - class VISIBILITY_HIDDEN DomInfoPrinter : public FunctionPass { - public: - static char ID; // Pass identification, replacement for typeid - DomInfoPrinter() : FunctionPass((intptr_t)&ID) {} - - virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesAll(); - AU.addRequired(); - AU.addRequired(); - - } - - virtual bool runOnFunction(Function &F) { - DominatorTree &DT = getAnalysis(); - DT.dump(); - DominanceFrontier &DF = getAnalysis(); - DF.dump(); - return false; - } - }; -} - -char DomInfoPrinter::ID = 0; -static RegisterPass -DIP("print-dom-info", "Dominator Info Printer", true, true); Modified: llvm/trunk/tools/opt/GraphPrinters.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/opt/GraphPrinters.cpp?rev=52907&r1=52906&r2=52907&view=diff ============================================================================== --- llvm/trunk/tools/opt/GraphPrinters.cpp (original) +++ llvm/trunk/tools/opt/GraphPrinters.cpp Mon Jun 30 12:32:58 2008 @@ -18,6 +18,7 @@ #include "llvm/Pass.h" #include "llvm/Value.h" #include "llvm/Analysis/CallGraph.h" +#include "llvm/Analysis/Dominators.h" #include #include using namespace llvm; @@ -81,3 +82,34 @@ RegisterPass P2("print-callgraph", "Print Call Graph to 'dot' file"); } + +//===----------------------------------------------------------------------===// +// DomInfoPrinter Pass +//===----------------------------------------------------------------------===// + +namespace { + class DomInfoPrinter : public FunctionPass { + public: + static char ID; // Pass identification, replacement for typeid + DomInfoPrinter() : FunctionPass((intptr_t)&ID) {} + + virtual void getAnalysisUsage(AnalysisUsage &AU) const { + AU.setPreservesAll(); + AU.addRequired(); + AU.addRequired(); + + } + + virtual bool runOnFunction(Function &F) { + DominatorTree &DT = getAnalysis(); + DT.dump(); + DominanceFrontier &DF = getAnalysis(); + DF.dump(); + return false; + } + }; + + char DomInfoPrinter::ID = 0; + static RegisterPass + DIP("print-dom-info", "Dominator Info Printer", true, true); +} From gohman at apple.com Mon Jun 30 12:56:56 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 10:56:56 -0700 Subject: [llvm-commits] [llvm] r52893 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/Alpha/AlphaISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/Mips/MipsISelLowering.cpp lib/Target/PIC16/PIC16ISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <200806301019.m5UAJJbk018595@zion.cs.uiuc.edu> References: <200806301019.m5UAJJbk018595@zion.cs.uiuc.edu> Message-ID: <7945D1F9-8F6F-490D-9CF4-866C89890052@apple.com> On Jun 30, 2008, at 3:19 AM, Duncan Sands wrote: > Author: baldrick > Date: Mon Jun 30 05:19:09 2008 > New Revision: 52893 > > URL: http://llvm.org/viewvc/llvm-project?rev=52893&view=rev > Log: > Revert the SelectionDAG optimization that makes > it impossible to create a MERGE_VALUES node with > only one result: sometimes it is useful to be able > to create a node with only one result out of one of > the results of a node with more than one result, for > example because the new node will eventually be used > to replace a one-result node using ReplaceAllUsesWith, > cf X86TargetLowering::ExpandFP_TO_SINT. On the other > hand, most users of MERGE_VALUES don't need this and > for them the optimization was valuable. So add a new > utility method getMergeValues for creating MERGE_VALUES > nodes which by default performs the optimization. > Change almost everywhere to use getMergeValues (and > tidy some stuff up at the same time). Thanks Duncan! > // Use a MERGE_VALUES node to drop the chain result value. > - return DAG.getNode(ISD::MERGE_VALUES, MVT::i64, Res).Val; > -} > + return DAG.getMergeValues(DAG.getVTList(VT), &Res, 1, false).Val; > +} As this is the one place currently that needs to pass false to getMergeValues, could you put a comment about it here? Something like "note that we need to pass false to getMergeValues to tell it not to just return back Res verbatim, which won't work here because we specifically need a node with exactly one result." Thanks, Dan From sabre at nondot.org Mon Jun 30 13:02:45 2008 From: sabre at nondot.org (Chris Lattner) Date: Mon, 30 Jun 2008 18:02:45 -0000 Subject: [llvm-commits] [llvm] r52908 - /llvm/trunk/include/llvm/ADT/APFloat.h Message-ID: <200806301802.m5UI2jrW002616@zion.cs.uiuc.edu> Author: lattner Date: Mon Jun 30 13:02:44 2008 New Revision: 52908 URL: http://llvm.org/viewvc/llvm-project?rev=52908&view=rev Log: add convenience 'constructors' Modified: llvm/trunk/include/llvm/ADT/APFloat.h Modified: llvm/trunk/include/llvm/ADT/APFloat.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APFloat.h?rev=52908&r1=52907&r2=52908&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/APFloat.h (original) +++ llvm/trunk/include/llvm/ADT/APFloat.h Mon Jun 30 13:02:44 2008 @@ -152,8 +152,8 @@ rmNearestTiesToAway }; - /* Operation status. opUnderflow or opOverflow are always returned - or-ed with opInexact. */ + // Operation status. opUnderflow or opOverflow are always returned + // or-ed with opInexact. enum opStatus { opOK = 0x00, opInvalidOp = 0x01, @@ -163,7 +163,7 @@ opInexact = 0x10 }; - /* Category of internally-represented number. */ + // Category of internally-represented number. enum fltCategory { fcInfinity, fcNaN, @@ -171,7 +171,7 @@ fcZero }; - /* Constructors. */ + // Constructors. APFloat(const fltSemantics &, const char *); APFloat(const fltSemantics &, integerPart); APFloat(const fltSemantics &, fltCategory, bool negative); @@ -180,6 +180,17 @@ explicit APFloat(const APInt &, bool isIEEE = false); APFloat(const APFloat &); ~APFloat(); + + // Convenience "constructors" + static APFloat getZero(const fltSemantics &Sem, bool Negative = false) { + return APFloat(Sem, fcZero, Negative); + } + static APFloat getInf(const fltSemantics &Sem, bool Negative = false) { + return APFloat(Sem, fcInfinity, Negative); + } + static APFloat getNaN(const fltSemantics &Sem, bool Negative = false) { + return APFloat(Sem, fcNaN, Negative); + } /// Profile - Used to insert APFloat objects, or objects that contain /// APFloat objects, into FoldingSets. From dpatel at apple.com Mon Jun 30 13:04:55 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 30 Jun 2008 18:04:55 -0000 Subject: [llvm-commits] [llvm] r52909 - /llvm/trunk/tools/lto/ Message-ID: <200806301804.m5UI4tjL002708@zion.cs.uiuc.edu> Author: dpatel Date: Mon Jun 30 13:04:55 2008 New Revision: 52909 URL: http://llvm.org/viewvc/llvm-project?rev=52909&view=rev Log: Remove old LTO interface. Removed: llvm/trunk/tools/lto/ From dpatel at apple.com Mon Jun 30 13:05:29 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 30 Jun 2008 18:05:29 -0000 Subject: [llvm-commits] [llvm] r52910 - /llvm/trunk/include/llvm/LinkTimeOptimizer.h Message-ID: <200806301805.m5UI5T2r002735@zion.cs.uiuc.edu> Author: dpatel Date: Mon Jun 30 13:05:29 2008 New Revision: 52910 URL: http://llvm.org/viewvc/llvm-project?rev=52910&view=rev Log: Remove old LTO interface. Removed: llvm/trunk/include/llvm/LinkTimeOptimizer.h Removed: llvm/trunk/include/llvm/LinkTimeOptimizer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkTimeOptimizer.h?rev=52909&view=auto ============================================================================== --- llvm/trunk/include/llvm/LinkTimeOptimizer.h (original) +++ llvm/trunk/include/llvm/LinkTimeOptimizer.h (removed) @@ -1,179 +0,0 @@ -//===-- llvm/LinkTimeOptimizer.h - Public Interface ------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This header provides public interface to use LLVM link time optimization -// library. This is intended to be used by linker to do link time optimization. -// -//===----------------------------------------------------------------------===// - -#ifndef __LTO_H__ -#define __LTO_H__ - -#include -#include -#include -#include -#include - -#define LLVM_LTO_VERSION 2 - -namespace llvm { - - class Module; - class GlobalValue; - class TargetMachine; - - enum LTOStatus { - LTO_UNKNOWN, - LTO_OPT_SUCCESS, - LTO_READ_SUCCESS, - LTO_READ_FAILURE, - LTO_WRITE_FAILURE, - LTO_NO_TARGET, - LTO_NO_WORK, - LTO_MODULE_MERGE_FAILURE, - LTO_ASM_FAILURE - }; - - enum LTOLinkageTypes { - LTOExternalLinkage, // Externally visible function - LTOLinkOnceLinkage, // Keep one copy of named function when linking (inline) - LTOWeakLinkage, // Keep one copy of named function when linking (weak) - LTOInternalLinkage, // Rename collisions when linking (static functions) - LTOCommonLinkage // tentative definitions (usually equivalent to weak) - }; - - enum LTOVisibilityTypes { - LTODefaultVisibility = 0, ///< The GV is visible - LTOHiddenVisibility, ///< The GV is hidden - LTOProtectedVisibility ///< The GV is protected - }; - - - enum LTOCodeGenModel { - LTO_CGM_Static, - LTO_CGM_Dynamic, - LTO_CGM_DynamicNoPIC - }; - - /// This class represents LLVM symbol information without exposing details - /// of LLVM global values. It encapsulates symbol linkage information. This - /// is typically used in hash_map where associated name identifies the - /// the symbol name. - class LLVMSymbol { - - public: - - LTOLinkageTypes getLinkage() const { return linkage; } - LTOVisibilityTypes getVisibility() const { return visibility; } - void mayBeNotUsed(); - - LLVMSymbol (enum LTOLinkageTypes lt, enum LTOVisibilityTypes vis, - GlobalValue *g, const std::string &n, - const std::string &m, int a) : linkage(lt), visibility(vis), - gv(g), name(n), - mangledName(m), alignment(a) {} - - const char *getName() { return name.c_str(); } - const char *getMangledName() { return mangledName.c_str(); } - int getAlignment() { return alignment; } - - private: - enum LTOLinkageTypes linkage; - enum LTOVisibilityTypes visibility; - GlobalValue *gv; - std::string name; - std::string mangledName; - int alignment; - }; - - class string_compare { - public: - bool operator()(const char* left, const char* right) const { - return (strcmp(left, right) == 0); - } - }; - - /// This is abstract class to facilitate dlopen() interface. - /// See LTO below for more info. - class LinkTimeOptimizer { - public: - typedef hash_map, - string_compare> NameToSymbolMap; - typedef hash_map, - string_compare> NameToModuleMap; - virtual enum LTOStatus readLLVMObjectFile(const std::string &, - NameToSymbolMap &, - std::set &) = 0; - virtual enum LTOStatus optimizeModules(const std::string &, - std::vector &exportList, - std::string &targetTriple, - bool saveTemps, const char *) = 0; - virtual void getTargetTriple(const std::string &, std::string &) = 0; - virtual void removeModule (const std::string &InputFilename) = 0; - virtual void setCodeGenModel(LTOCodeGenModel CGM) = 0; - virtual void printVersion () = 0; - virtual ~LinkTimeOptimizer() = 0; - }; - - /// This is the main link time optimization class. It exposes simple API - /// to perform link time optimization using LLVM intermodular optimizer. - class LTO : public LinkTimeOptimizer { - - public: - typedef hash_map, - string_compare> NameToSymbolMap; - typedef hash_map, - string_compare> NameToModuleMap; - - enum LTOStatus readLLVMObjectFile(const std::string &InputFilename, - NameToSymbolMap &symbols, - std::set &references); - enum LTOStatus optimizeModules(const std::string &OutputFilename, - std::vector &exportList, - std::string &targetTriple, - bool saveTemps, const char *); - void getTargetTriple(const std::string &InputFilename, - std::string &targetTriple); - void removeModule (const std::string &InputFilename); - void printVersion(); - - void setCodeGenModel(LTOCodeGenModel CGM) { - CGModel = CGM; - } - - // Constructors and destructors - LTO() : Target(NULL), CGModel(LTO_CGM_Dynamic) { - /// TODO: Use Target info, it is available at this time. - } - ~LTO(); - - private: - Module *getModule (const std::string &InputFilename); - enum LTOStatus optimize(Module *, std::ostream &, - std::vector &); - void getTarget(Module *); - - private: - std::vector modules; - NameToSymbolMap allSymbols; - NameToModuleMap allModules; - TargetMachine *Target; - LTOCodeGenModel CGModel; - }; - -} // End llvm namespace - -/// This provides C interface to initialize link time optimizer. This allows -/// linker to use dlopen() interface to dynamically load LinkTimeOptimizer. -/// extern "C" helps, because dlopen() interface uses name to find the symbol. -extern "C" -llvm::LinkTimeOptimizer *createLLVMOptimizer(unsigned VERSION = LLVM_LTO_VERSION); - -#endif From kremenek at apple.com Mon Jun 30 13:07:39 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 30 Jun 2008 18:07:39 -0000 Subject: [llvm-commits] [llvm] r52911 - /llvm/trunk/include/llvm/ADT/ImmutableList.h Message-ID: <200806301807.m5UI7djo002811@zion.cs.uiuc.edu> Author: kremenek Date: Mon Jun 30 13:07:38 2008 New Revision: 52911 URL: http://llvm.org/viewvc/llvm-project?rev=52911&view=rev Log: Added ImmutableList, a companion ADT to ImmutableSet and ImmutableMap that is used to represent a purely functional list. Added: llvm/trunk/include/llvm/ADT/ImmutableList.h Added: llvm/trunk/include/llvm/ADT/ImmutableList.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableList.h?rev=52911&view=auto ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableList.h (added) +++ llvm/trunk/include/llvm/ADT/ImmutableList.h Mon Jun 30 13:07:38 2008 @@ -0,0 +1,175 @@ +//==--- ImmutableList.h - Immutable (functional) list interface --*- C++ -*-==// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the ImmutableList class. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_IMLIST_H +#define LLVM_ADT_IMLIST_H + +#include "llvm/Support/Allocator.h" +#include "llvm/ADT/FoldingSet.h" +#include "llvm/Support/DataTypes.h" +#include + +namespace llvm { + +template class ImmutableListFactory; + +template +class ImmutableListImpl : public FoldingSetNode { + T Head; + ImmutableListImpl* Tail; + + ImmutableListImpl(const T& head, ImmutableListImpl* tail = 0) + : Head(head), Tail(tail) {} + + friend class ImmutableListFactory; + + // Do not implement. + void operator=(const ImmutableListImpl&); + ImmutableListImpl(const ImmutableListImpl&); + +public: + const T& getHead() const { return Head; } + ImmutableListImpl* getTail() const { return Tail; } + + static inline void Profile(FoldingSetNodeID& ID, const T& H, + ImmutableListImpl* L){ + ID.AddPointer(L); + ID.Add(H); + } + + void Profile(FoldingSetNodeID& ID) { + Profile(ID, Head, Tail); + } +}; + +/// ImmutableList - This class represents an immutable (functional) list. +/// It is implemented as a smart pointer (wraps ImmutableListImpl), so it +/// it is intended to always be copied by value as if it were a pointer. +/// This interface matches ImmutableSet and ImmutableMap. ImmutableList +/// objects should almost never be created directly, and instead should +/// be created by ImmutableListFactory objects that manage the lifetime +/// of a group of lists. When the factory object is reclaimed, all lists +/// created by that factory are released as well. +template +class ImmutableList { +public: + typedef T value_type; + typedef ImmutableListFactory Factory; + +private: + ImmutableListImpl* X; + +public: + // This constructor should normally only be called by ImmutableListFactory. + // There may be cases, however, when one needs to extract the internal pointer + // and reconstruct a list object from that pointer. + ImmutableList(ImmutableListImpl* x) : X(x) {} + + ImmutableListImpl* getInternalPointer() const { + return X; + } + + class iterator { + ImmutableListImpl* L; + public: + iterator() : L(0) {} + iterator(ImmutableList l) : L(l.getInternalPointer()) {} + + iterator& operator++() { L = L->Tail; } + bool operator==(const iterator& I) const { return L == I.L; } + ImmutableList operator*() const { return L; } + }; + + iterator begin() const { return iterator(X); } + iterator end() const { return iterator(); } + + bool isEmpty() const { return !X; } + + bool isEqual(const ImmutableList& L) const { return X == L.X; } + bool operator==(const ImmutableList& L) const { return isEqual(L); } + + const T& getHead() { + assert (!isEmpty() && "Cannot get the head of an empty list."); + return X->getHead(); + } + + ImmutableList getTail() { + return X ? X->getTail() : 0; + } +}; + +template +class ImmutableListFactory { + typedef ImmutableListImpl ListTy; + typedef FoldingSet CacheTy; + + CacheTy Cache; + uintptr_t Allocator; + + bool ownsAllocator() const { + return Allocator & 0x1 ? false : true; + } + + BumpPtrAllocator& getAllocator() const { + return *reinterpret_cast(Allocator & ~0x1); + } + +public: + ImmutableListFactory() + : Allocator(reinterpret_cast(new BumpPtrAllocator())) {} + + ImmutableListFactory(BumpPtrAllocator& Alloc) + : Allocator(reinterpret_cast(&Alloc) | 0x1) {} + + ~ImmutableListFactory() { + if (ownsAllocator()) delete &getAllocator(); + } + + ImmutableList Concat(const T& Head, ImmutableList Tail) { + // Profile the new list to see if it already exists in our cache. + FoldingSetNodeID ID; + void* InsertPos; + + ListTy* TailImpl = Tail.getInternalPointer(); + ListTy::Profile(ID, Head, TailImpl); + ListTy* L = Cache.FindNodeOrInsertPos(ID, InsertPos); + + if (!L) { + // The list does not exist in our cache. Create it. + BumpPtrAllocator& A = getAllocator(); + L = (ListTy*) A.Allocate(); + new (L) ListTy(Head, TailImpl); + + // Insert the new list into the cache. + Cache.InsertNode(L, InsertPos); + } + + return L; + } + + ImmutableList Add(const T& D, ImmutableList L) { + return Concat(D, L); + } + + ImmutableList GetEmptyList() const { + return ImmutableList(0); + } + + ImmutableList Create(const T& X) { + return Concat(X, GetEmptyList()); + } +}; + +} // end llvm namespace + +#endif From dpatel at apple.com Mon Jun 30 13:15:01 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 30 Jun 2008 18:15:01 -0000 Subject: [llvm-commits] [llvm] r52912 - in /llvm/trunk/tools: Makefile lto/ lto2/ Message-ID: <200806301815.m5UIF1Do003053@zion.cs.uiuc.edu> Author: dpatel Date: Mon Jun 30 13:15:01 2008 New Revision: 52912 URL: http://llvm.org/viewvc/llvm-project?rev=52912&view=rev Log: Rename new lto2 tool as lto. lto2->lto Added: llvm/trunk/tools/lto/ - copied from r52903, llvm/trunk/tools/lto2/ Removed: llvm/trunk/tools/lto2/ Modified: llvm/trunk/tools/Makefile Modified: llvm/trunk/tools/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/Makefile?rev=52912&r1=52911&r2=52912&view=diff ============================================================================== --- llvm/trunk/tools/Makefile (original) +++ llvm/trunk/tools/Makefile Mon Jun 30 13:15:01 2008 @@ -21,12 +21,9 @@ include $(LEVEL)/Makefile.config -# Disable liblto as it is going away -#PARALLEL_DIRS += lto - # only build new lto project on Darwin for now ifeq ($(OS),Darwin) -PARALLEL_DIRS += lto2 +PARALLEL_DIRS += lto endif include $(LEVEL)/Makefile.common From gohman at apple.com Mon Jun 30 15:25:31 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 20:25:31 -0000 Subject: [llvm-commits] [llvm] r52915 - /llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp Message-ID: <200806302025.m5UKPV0X007940@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 15:25:31 2008 New Revision: 52915 URL: http://llvm.org/viewvc/llvm-project?rev=52915&view=rev Log: Correct the allocation size for CCState's UsedRegs member, which only needs one bit for each register. UsedRegs is a SmallVector sized at 16, so this eliminates a heap allocation/free for every call and return processed by Legalize on most targets. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp?rev=52915&r1=52914&r2=52915&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/CallingConvLower.cpp Mon Jun 30 15:25:31 2008 @@ -26,7 +26,7 @@ // No stack is used. StackOffset = 0; - UsedRegs.resize(TRI.getNumRegs()); + UsedRegs.resize((TRI.getNumRegs()+31)/32); } // HandleByVal - Allocate a stack slot large enough to pass an argument by From resistor at mac.com Mon Jun 30 15:28:02 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 30 Jun 2008 20:28:02 -0000 Subject: [llvm-commits] [llvm] r52916 - /llvm/trunk/include/llvm/Analysis/Dominators.h Message-ID: <200806302028.m5UKS2fI008114@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 30 15:28:02 2008 New Revision: 52916 URL: http://llvm.org/viewvc/llvm-project?rev=52916&view=rev Log: Add an isReachableFromEntry method. Modified: llvm/trunk/include/llvm/Analysis/Dominators.h Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=52916&r1=52915&r2=52916&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Mon Jun 30 15:28:02 2008 @@ -792,6 +792,10 @@ DT->splitBlock(NewBB); } + bool isReachableFromEntry(BasicBlock* A) { + return DT->isReachableFromEntry(A); + } + virtual void releaseMemory() { DT->releaseMemory(); From gohman at apple.com Mon Jun 30 15:31:15 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 20:31:15 -0000 Subject: [llvm-commits] [llvm] r52917 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/IA64/IA64ISelLowering.cpp lib/Target/IA64/IA64ISelLowering.h lib/Target/Sparc/SparcISelLowering.cpp lib/Target/Sparc/SparcISelLowering.h Message-ID: <200806302031.m5UKVFYS008283@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 15:31:15 2008 New Revision: 52917 URL: http://llvm.org/viewvc/llvm-project?rev=52917&view=rev Log: Replace some std::vectors that showed up in heap profiling with SmallVectors. Change the signature of TargetLowering::LowerArguments to avoid returning a vector by value, and update the two targets which still use this directly, Sparc and IA64, accordingly. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp llvm/trunk/lib/Target/IA64/IA64ISelLowering.h llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=52917&r1=52916&r2=52917&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Jun 30 15:31:15 2008 @@ -964,8 +964,9 @@ /// LowerArguments - This hook must be implemented to indicate how we should /// lower the arguments for the specified function, into the specified DAG. - virtual std::vector - LowerArguments(Function &F, SelectionDAG &DAG); + virtual void + LowerArguments(Function &F, SelectionDAG &DAG, + SmallVectorImpl& ArgValues); /// LowerCallTo - This hook lowers an abstract call to a function into an /// actual call. This returns a pair of operands. The first element is the Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52917&r1=52916&r2=52917&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jun 30 15:31:15 2008 @@ -474,7 +474,7 @@ /// them up and then emit token factor nodes when possible. This allows us to /// get simple disambiguation between loads without worrying about alias /// analysis. - std::vector PendingLoads; + SmallVector PendingLoads; /// PendingExports - CopyToReg nodes that copy values to virtual registers /// for export to other blocks need to be emitted before any terminator @@ -4612,16 +4612,16 @@ /// implementation, which just inserts a FORMAL_ARGUMENTS node. FIXME: When all /// targets are migrated to using FORMAL_ARGUMENTS, this hook should be /// integrated into SDISel. -std::vector -TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) { +void TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG, + SmallVectorImpl &ArgValues) { // Add CC# and isVararg as operands to the FORMAL_ARGUMENTS node. - std::vector Ops; + SmallVector Ops; Ops.push_back(DAG.getRoot()); Ops.push_back(DAG.getConstant(F.getCallingConv(), getPointerTy())); Ops.push_back(DAG.getConstant(F.isVarArg(), getPointerTy())); // Add one result value for each formal argument. - std::vector RetVals; + SmallVector RetVals; unsigned j = 1; for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++j) { @@ -4699,7 +4699,6 @@ DAG.setRoot(SDOperand(Result, NumArgRegs)); // Set up the return result vector. - Ops.clear(); unsigned i = 0; unsigned Idx = 1; for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; @@ -4722,12 +4721,11 @@ else if (F.paramHasAttr(Idx, ParamAttr::ZExt)) AssertOp = ISD::AssertZext; - Ops.push_back(getCopyFromParts(DAG, &Parts[0], NumParts, PartVT, VT, - AssertOp)); + ArgValues.push_back(getCopyFromParts(DAG, &Parts[0], NumParts, PartVT, VT, + AssertOp)); } } assert(i == NumArgRegs && "Argument register count mismatch!"); - return Ops; } @@ -4951,7 +4949,8 @@ Function &F = *LLVMBB->getParent(); FunctionLoweringInfo &FuncInfo = SDL.FuncInfo; SDOperand OldRoot = SDL.DAG.getRoot(); - std::vector Args = TLI.LowerArguments(F, SDL.DAG); + SmallVector Args; + TLI.LowerArguments(F, SDL.DAG, Args); unsigned a = 0; for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=52917&r1=52916&r2=52917&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Mon Jun 30 15:31:15 2008 @@ -143,9 +143,8 @@ return MVT::i1; } -std::vector -IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) { - std::vector ArgValues; +void IA64TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG, + SmallVectorImpl &ArgValues) { // // add beautiful description of IA64 stack frame format // here (from intel 24535803.pdf most likely) @@ -300,8 +299,6 @@ MF.getRegInfo().addLiveOut(IA64::F8); break; } - - return ArgValues; } std::pair Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.h?rev=52917&r1=52916&r2=52917&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.h (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.h Mon Jun 30 15:31:15 2008 @@ -53,8 +53,8 @@ /// LowerArguments - This hook must be implemented to indicate how we should /// lower the arguments for the specified function, into the specified DAG. - virtual std::vector - LowerArguments(Function &F, SelectionDAG &DAG); + virtual void LowerArguments(Function &F, SelectionDAG &DAG, + SmallVectorImpl &ArgValues); /// LowerCallTo - This hook lowers an abstract call to a function into an /// actual call. Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=52917&r1=52916&r2=52917&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Mon Jun 30 15:31:15 2008 @@ -74,11 +74,11 @@ /// LowerArguments - V8 uses a very simple ABI, where all values are passed in /// either one or two GPRs, including FP values. TODO: we should pass FP values /// in FP registers for fastcc functions. -std::vector -SparcTargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) { +void +SparcTargetLowering::LowerArguments(Function &F, SelectionDAG &DAG, + SmallVectorImpl &ArgValues) { MachineFunction &MF = DAG.getMachineFunction(); MachineRegisterInfo &RegInfo = MF.getRegInfo(); - std::vector ArgValues; static const unsigned ArgRegs[] = { SP::I0, SP::I1, SP::I2, SP::I3, SP::I4, SP::I5 @@ -221,8 +221,6 @@ if (!OutChains.empty()) DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other, &OutChains[0], OutChains.size())); - - return ArgValues; } static SDOperand LowerCALL(SDOperand Op, SelectionDAG &DAG) { Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.h?rev=52917&r1=52916&r2=52917&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.h (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.h Mon Jun 30 15:31:15 2008 @@ -57,8 +57,8 @@ const SelectionDAG &DAG, unsigned Depth = 0) const; - virtual std::vector - LowerArguments(Function &F, SelectionDAG &DAG); + virtual void LowerArguments(Function &F, SelectionDAG &DAG, + SmallVectorImpl &ArgValues); virtual MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB); From gohman at apple.com Mon Jun 30 15:33:57 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 20:33:57 -0000 Subject: [llvm-commits] [llvm] r52918 - /llvm/trunk/include/llvm/Target/TargetLowering.h Message-ID: <200806302033.m5UKXvBv008467@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 15:33:57 2008 New Revision: 52918 URL: http://llvm.org/viewvc/llvm-project?rev=52918&view=rev Log: Change bools to 1-bit bitfields to shrink ArgListEntry slightly. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=52918&r1=52917&r2=52918&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Jun 30 15:33:57 2008 @@ -975,12 +975,12 @@ struct ArgListEntry { SDOperand Node; const Type* Ty; - bool isSExt; - bool isZExt; - bool isInReg; - bool isSRet; - bool isNest; - bool isByVal; + bool isSExt : 1; + bool isZExt : 1; + bool isInReg : 1; + bool isSRet : 1; + bool isNest : 1; + bool isByVal : 1; uint16_t Alignment; ArgListEntry() : isSExt(false), isZExt(false), isInReg(false), From gohman at apple.com Mon Jun 30 15:36:26 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 20:36:26 -0000 Subject: [llvm-commits] [llvm] r52919 - /llvm/trunk/include/llvm/Target/TargetLowering.h Message-ID: <200806302036.m5UKaQIt008570@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 15:36:26 2008 New Revision: 52919 URL: http://llvm.org/viewvc/llvm-project?rev=52919&view=rev Log: Reorder the fields in TargetLowering to require less padding. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=52919&r1=52918&r2=52919&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Jun 30 15:36:26 2008 @@ -1288,24 +1288,18 @@ TargetMachine &TM; const TargetData *TD; - /// IsLittleEndian - True if this is a little endian target. - /// - bool IsLittleEndian; - /// PointerTy - The type to use for pointers, usually i32 or i64. /// MVT PointerTy; + /// IsLittleEndian - True if this is a little endian target. + /// + bool IsLittleEndian; + /// UsesGlobalOffsetTable - True if this target uses a GOT for PIC codegen. /// bool UsesGlobalOffsetTable; - /// ShiftAmountTy - The type to use for shift amounts, usually i8 or whatever - /// PointerTy is. - MVT ShiftAmountTy; - - OutOfRangeShiftAmount ShiftAmtHandling; - /// SelectIsExpensive - Tells the code generator not to expand operations /// into sequences that use the select operations if possible. bool SelectIsExpensive; @@ -1321,14 +1315,6 @@ /// it. bool Pow2DivIsCheap; - /// SetCCResultContents - Information about the contents of the high-bits in - /// the result of a setcc comparison operation. - SetCCResultValue SetCCResultContents; - - /// SchedPreferenceInfo - The target scheduling preference: shortest possible - /// total cycles or lowest register usage. - SchedPreference SchedPreferenceInfo; - /// UseUnderscoreSetJmp - This target prefers to use _setjmp to implement /// llvm.setjmp. Defaults to false. bool UseUnderscoreSetJmp; @@ -1337,6 +1323,20 @@ /// llvm.longjmp. Defaults to false. bool UseUnderscoreLongJmp; + /// ShiftAmountTy - The type to use for shift amounts, usually i8 or whatever + /// PointerTy is. + MVT ShiftAmountTy; + + OutOfRangeShiftAmount ShiftAmtHandling; + + /// SetCCResultContents - Information about the contents of the high-bits in + /// the result of a setcc comparison operation. + SetCCResultValue SetCCResultContents; + + /// SchedPreferenceInfo - The target scheduling preference: shortest possible + /// total cycles or lowest register usage. + SchedPreference SchedPreferenceInfo; + /// JumpBufSize - The size, in bytes, of the target's jmp_buf buffers unsigned JumpBufSize; From evan.cheng at apple.com Mon Jun 30 15:38:22 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 30 Jun 2008 20:38:22 -0000 Subject: [llvm-commits] [llvm] r52920 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200806302038.m5UKcMJp008640@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 30 15:38:22 2008 New Revision: 52920 URL: http://llvm.org/viewvc/llvm-project?rev=52920&view=rev Log: Remove unneeded include. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=52920&r1=52919&r2=52920&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Mon Jun 30 15:38:22 2008 @@ -37,7 +37,6 @@ #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/ADT/BitVector.h" From dalej at apple.com Mon Jun 30 15:40:16 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 30 Jun 2008 20:40:16 -0000 Subject: [llvm-commits] [llvm] r52921 - /llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200806302040.m5UKeGVN008714@zion.cs.uiuc.edu> Author: johannes Date: Mon Jun 30 15:40:16 2008 New Revision: 52921 URL: http://llvm.org/viewvc/llvm-project?rev=52921&view=rev Log: No need to align the stack if there are no stack objects. Fixes a couple of tests on Linux. Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=52921&r1=52920&r2=52921&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Mon Jun 30 15:40:16 2008 @@ -464,7 +464,8 @@ // works. if (!RegInfo->targetHandlesStackFrameRounding() && (FFI->hasCalls() || FFI->hasVarSizedObjects() || - RegInfo->needsStackRealignment(Fn))) { + (RegInfo->needsStackRealignment(Fn) && + FFI->getObjectIndexEnd() != 0))) { // If we have reserved argument space for call sites in the function // immediately on entry to the current function, count it as part of the // overall stack size. From kremenek at apple.com Mon Jun 30 15:41:23 2008 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 30 Jun 2008 20:41:23 -0000 Subject: [llvm-commits] [llvm] r52922 - /llvm/trunk/include/llvm/ADT/ImmutableList.h Message-ID: <200806302041.m5UKfN2O008784@zion.cs.uiuc.edu> Author: kremenek Date: Mon Jun 30 15:41:22 2008 New Revision: 52922 URL: http://llvm.org/viewvc/llvm-project?rev=52922&view=rev Log: Added some comments and some cleanups. Modified: llvm/trunk/include/llvm/ADT/ImmutableList.h Modified: llvm/trunk/include/llvm/ADT/ImmutableList.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableList.h?rev=52922&r1=52921&r2=52922&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableList.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableList.h Mon Jun 30 15:41:22 2008 @@ -85,24 +85,39 @@ iterator() : L(0) {} iterator(ImmutableList l) : L(l.getInternalPointer()) {} - iterator& operator++() { L = L->Tail; } + iterator& operator++() { L = L->Tail; return *this; } bool operator==(const iterator& I) const { return L == I.L; } ImmutableList operator*() const { return L; } }; + /// begin - Returns an iterator referring to the head of the list, or + /// an iterator denoting the end of the list if the list is empty. iterator begin() const { return iterator(X); } + + /// end - Returns an iterator denoting the end of the list. This iterator + /// does not refer to a valid list element. iterator end() const { return iterator(); } + /// isEmpty - Returns true if the list is empty. bool isEmpty() const { return !X; } + /// isEqual - Returns true if two lists are equal. Because all lists created + /// from the same ImmutableListFactory are uniqued, this has O(1) complexity + /// because it the contents of the list do not need to be compared. Note + /// that you should only compare two lists created from the same + /// ImmutableListFactory. bool isEqual(const ImmutableList& L) const { return X == L.X; } + bool operator==(const ImmutableList& L) const { return isEqual(L); } + /// getHead - Returns the head of the list. const T& getHead() { assert (!isEmpty() && "Cannot get the head of an empty list."); return X->getHead(); } + /// getTail - Returns the tail of the list, which is another (possibly empty) + /// ImmutableList. ImmutableList getTail() { return X ? X->getTail() : 0; } From evan.cheng at apple.com Mon Jun 30 15:45:07 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 30 Jun 2008 20:45:07 -0000 Subject: [llvm-commits] [llvm] r52923 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAGISel.h lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelDAGToDAG.cpp lib/Target/Alpha/AlphaISelDAGToDAG.cpp lib/Target/CellSPU/SPUISelDAGToDAG.cpp lib/Target/IA64/IA64ISelDAGToDAG.cpp lib/Target/Mips/MipsISelDAGToDAG.cpp lib/Target/PIC16/PIC16ISelDAGToDAG.cpp lib/Target/PowerPC/PPCISelDAGToDAG.cpp lib/Target/Sparc/SparcISelDAGToDAG.cpp lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200806302045.m5UKj7nV008954@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 30 15:45:06 2008 New Revision: 52923 URL: http://llvm.org/viewvc/llvm-project?rev=52923&view=rev Log: Split scheduling from instruction selection. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h?rev=52923&r1=52922&r2=52923&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Mon Jun 30 15:45:06 2008 @@ -58,7 +58,9 @@ unsigned MakeReg(MVT VT); virtual void EmitFunctionEntryCode(Function &Fn, MachineFunction &MF) {} - virtual void InstructionSelectBasicBlock(SelectionDAG &SD) = 0; + virtual void InstructionSelect(SelectionDAG &SD) = 0; + virtual void InstructionSelectPostProcessing(SelectionDAG &DAG) {} + virtual void SelectRootInit() { DAGSize = CurDAG->AssignTopologicalOrder(TopOrder); } @@ -160,10 +162,6 @@ }; protected: - /// Pick a safe ordering and emit instructions for each target node in the - /// graph. - void ScheduleAndEmitDAG(SelectionDAG &DAG); - /// SelectInlineAsmMemoryOperands - Calls to this are automatically generated /// by tblgen. Others should not call it. void SelectInlineAsmMemoryOperands(std::vector &Ops, @@ -187,6 +185,10 @@ void ComputeLiveOutVRegInfo(SelectionDAG &DAG); + /// Pick a safe ordering and emit instructions for each target node in the + /// graph. + void ScheduleAndEmitDAG(SelectionDAG &DAG); + /// SwitchCases - Vector of CaseBlock structures used to communicate /// SwitchInst code generation information. std::vector SwitchCases; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52923&r1=52922&r2=52923&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jun 30 15:45:06 2008 @@ -43,9 +43,10 @@ #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" -#include "llvm/Support/MathExtras.h" -#include "llvm/Support/Debug.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/MathExtras.h" +#include "llvm/Support/Timer.h" #include using namespace llvm; @@ -5354,7 +5355,14 @@ // Third, instruction select all of the operations to machine code, adding the // code to the MachineBasicBlock. - InstructionSelectBasicBlock(DAG); + InstructionSelect(DAG); + + // Emit machine code to BB. This can change 'BB' to the last block being + // inserted into. + ScheduleAndEmitDAG(DAG); + + // Perform target specific isel post processing. + InstructionSelectPostProcessing(DAG); DOUT << "Selected machine code:\n"; DEBUG(BB->dump()); Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=52923&r1=52922&r2=52923&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Jun 30 15:45:06 2008 @@ -54,7 +54,7 @@ } SDNode *Select(SDOperand Op); - virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); + virtual void InstructionSelect(SelectionDAG &DAG); bool SelectAddrMode2(SDOperand Op, SDOperand N, SDOperand &Base, SDOperand &Offset, SDOperand &Opc); bool SelectAddrMode2Offset(SDOperand Op, SDOperand N, @@ -91,13 +91,11 @@ }; } -void ARMDAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) { +void ARMDAGToDAGISel::InstructionSelect(SelectionDAG &DAG) { DEBUG(BB->dump()); DAG.setRoot(SelectRoot(DAG.getRoot())); DAG.RemoveDeadNodes(); - - ScheduleAndEmitDAG(DAG); } bool ARMDAGToDAGISel::SelectAddrMode2(SDOperand Op, SDOperand N, Modified: llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp?rev=52923&r1=52922&r2=52923&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Mon Jun 30 15:45:06 2008 @@ -161,9 +161,9 @@ // target-specific node if it hasn't already been changed. SDNode *Select(SDOperand Op); - /// InstructionSelectBasicBlock - This callback is invoked by + /// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. - virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); + virtual void InstructionSelect(SelectionDAG &DAG); virtual const char *getPassName() const { return "Alpha DAG->DAG Pattern Instruction Selection"; @@ -230,17 +230,14 @@ RA, MVT::i64); } -/// InstructionSelectBasicBlock - This callback is invoked by +/// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. -void AlphaDAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) { +void AlphaDAGToDAGISel::InstructionSelect(SelectionDAG &DAG) { DEBUG(BB->dump()); // Select target instructions for the DAG. DAG.setRoot(SelectRoot(DAG.getRoot())); DAG.RemoveDeadNodes(); - - // Emit machine code to BB. - ScheduleAndEmitDAG(DAG); } // Select - Convert the specified operand from a target-independent to a Modified: llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp?rev=52923&r1=52922&r2=52923&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp Mon Jun 30 15:45:06 2008 @@ -317,9 +317,9 @@ return false; } - /// InstructionSelectBasicBlock - This callback is invoked by + /// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. - virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); + virtual void InstructionSelect(SelectionDAG &DAG); virtual const char *getPassName() const { return "Cell SPU DAG->DAG Pattern Instruction Selection"; @@ -339,19 +339,16 @@ } -/// InstructionSelectBasicBlock - This callback is invoked by +/// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. void -SPUDAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) +SPUDAGToDAGISel::InstructionSelect(SelectionDAG &DAG) { DEBUG(BB->dump()); // Select target instructions for the DAG. DAG.setRoot(SelectRoot(DAG.getRoot())); DAG.RemoveDeadNodes(); - - // Emit machine code to BB. - ScheduleAndEmitDAG(DAG); } /*! Modified: llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp?rev=52923&r1=52922&r2=52923&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelDAGToDAG.cpp Mon Jun 30 15:45:06 2008 @@ -78,9 +78,9 @@ /// operation. bool SelectAddr(SDOperand Addr, SDOperand &Op1, SDOperand &Op2); - /// InstructionSelectBasicBlock - This callback is invoked by + /// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. - virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); + virtual void InstructionSelect(SelectionDAG &DAG); virtual const char *getPassName() const { return "IA64 (Itanium) DAG->DAG Instruction Selector"; @@ -94,17 +94,14 @@ }; } -/// InstructionSelectBasicBlock - This callback is invoked by +/// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. -void IA64DAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) { +void IA64DAGToDAGISel::InstructionSelect(SelectionDAG &DAG) { DEBUG(BB->dump()); // Select target instructions for the DAG. DAG.setRoot(SelectRoot(DAG.getRoot())); DAG.RemoveDeadNodes(); - - // Emit machine code to BB. - ScheduleAndEmitDAG(DAG); } SDNode *IA64DAGToDAGISel::SelectDIV(SDOperand Op) { Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=52923&r1=52922&r2=52923&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Mon Jun 30 15:45:06 2008 @@ -66,7 +66,7 @@ SelectionDAGISel(MipsLowering), TM(tm), MipsLowering(*TM.getTargetLowering()) {} - virtual void InstructionSelectBasicBlock(SelectionDAG &SD); + virtual void InstructionSelect(SelectionDAG &SD); // Pass Name virtual const char *getPassName() const { @@ -100,10 +100,10 @@ } -/// InstructionSelectBasicBlock - This callback is invoked by +/// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. void MipsDAGToDAGISel:: -InstructionSelectBasicBlock(SelectionDAG &SD) +InstructionSelect(SelectionDAG &SD) { DEBUG(BB->dump()); // Codegen the basic block. @@ -120,9 +120,6 @@ #endif SD.RemoveDeadNodes(); - - // Emit machine code to BB. - ScheduleAndEmitDAG(SD); } /// getGlobalBaseReg - Output the instructions required to put the Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp?rev=52923&r1=52922&r2=52923&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp Mon Jun 30 15:45:06 2008 @@ -61,7 +61,7 @@ SelectionDAGISel(PIC16Lowering), TM(tm), PIC16Lowering(*TM.getTargetLowering()) {} - virtual void InstructionSelectBasicBlock(SelectionDAG &SD); + virtual void InstructionSelect(SelectionDAG &SD); // Pass Name virtual const char *getPassName() const { @@ -97,9 +97,9 @@ } -/// InstructionSelectBasicBlock - This callback is invoked by +/// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. -void PIC16DAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &SD) +void PIC16DAGToDAGISel::InstructionSelect(SelectionDAG &SD) { DEBUG(BB->dump()); // Codegen the basic block. @@ -115,9 +115,6 @@ DOUT << "===== Instruction selection ends:\n"; SD.RemoveDeadNodes(); - - // Emit machine code to BB. - ScheduleAndEmitDAG(SD); } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp?rev=52923&r1=52922&r2=52923&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Mon Jun 30 15:45:06 2008 @@ -173,9 +173,9 @@ SDOperand BuildSDIVSequence(SDNode *N); SDOperand BuildUDIVSequence(SDNode *N); - /// InstructionSelectBasicBlock - This callback is invoked by + /// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. - virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); + virtual void InstructionSelect(SelectionDAG &DAG); void InsertVRSaveCode(Function &Fn); @@ -201,17 +201,14 @@ }; } -/// InstructionSelectBasicBlock - This callback is invoked by +/// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. -void PPCDAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) { +void PPCDAGToDAGISel::InstructionSelect(SelectionDAG &DAG) { DEBUG(BB->dump()); // Select target instructions for the DAG. DAG.setRoot(SelectRoot(DAG.getRoot())); DAG.RemoveDeadNodes(); - - // Emit machine code to BB. - ScheduleAndEmitDAG(DAG); } /// InsertVRSaveCode - Once the entire function has been instruction selected, Modified: llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp?rev=52923&r1=52922&r2=52923&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelDAGToDAG.cpp Mon Jun 30 15:45:06 2008 @@ -47,9 +47,9 @@ bool SelectADDRri(SDOperand Op, SDOperand N, SDOperand &Base, SDOperand &Offset); - /// InstructionSelectBasicBlock - This callback is invoked by + /// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. - virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); + virtual void InstructionSelect(SelectionDAG &DAG); virtual const char *getPassName() const { return "SPARC DAG->DAG Pattern Instruction Selection"; @@ -60,17 +60,14 @@ }; } // end anonymous namespace -/// InstructionSelectBasicBlock - This callback is invoked by +/// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. -void SparcDAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) { +void SparcDAGToDAGISel::InstructionSelect(SelectionDAG &DAG) { DEBUG(BB->dump()); // Select target instructions for the DAG. DAG.setRoot(SelectRoot(DAG.getRoot())); DAG.RemoveDeadNodes(); - - // Emit machine code to BB. - ScheduleAndEmitDAG(DAG); } bool SparcDAGToDAGISel::SelectADDRri(SDOperand Op, SDOperand Addr, Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=52923&r1=52922&r2=52923&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Jun 30 15:45:06 2008 @@ -32,7 +32,6 @@ #include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/SelectionDAGISel.h" #include "llvm/Target/TargetMachine.h" -#include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" @@ -111,6 +110,10 @@ /// base register. unsigned GlobalBaseReg; + /// CurBB - Current BB being isel'd. + /// + MachineBasicBlock *CurBB; + public: X86DAGToDAGISel(X86TargetMachine &tm, bool fast) : SelectionDAGISel(X86Lowering), @@ -128,9 +131,13 @@ return "X86 DAG->DAG Instruction Selection"; } - /// InstructionSelectBasicBlock - This callback is invoked by + /// InstructionSelect - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. - virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); + virtual void InstructionSelect(SelectionDAG &DAG); + + /// InstructionSelectPostProcessing - Post processing of selected and + /// scheduled basic blocks. + virtual void InstructionSelectPostProcessing(SelectionDAG &DAG); virtual void EmitFunctionEntryCode(Function &Fn, MachineFunction &MF); @@ -554,10 +561,10 @@ /// InstructionSelectBasicBlock - This callback is invoked by SelectionDAGISel /// when it has created a SelectionDAG for us to codegen. -void X86DAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) { - DEBUG(BB->dump()); - MachineFunction::iterator FirstMBB = BB; +void X86DAGToDAGISel::InstructionSelect(SelectionDAG &DAG) { + CurBB = BB; // BB can change as result of isel. + DEBUG(BB->dump()); if (!FastISel) PreprocessForRMW(DAG); @@ -575,11 +582,9 @@ #endif DAG.RemoveDeadNodes(); +} - // Emit machine code to BB. This can change 'BB' to the last block being - // inserted into. - ScheduleAndEmitDAG(DAG); - +void X86DAGToDAGISel::InstructionSelectPostProcessing(SelectionDAG &DAG) { // If we are emitting FP stack code, scan the basic block to determine if this // block defines any FP values. If so, put an FP_REG_KILL instruction before // the terminator of the block. @@ -592,7 +597,7 @@ // Scan all of the machine instructions in these MBBs, checking for FP // stores. (RFP32 and RFP64 will not exist in SSE mode, but RFP80 might.) - MachineFunction::iterator MBBI = FirstMBB; + MachineFunction::iterator MBBI = CurBB; MachineFunction::iterator EndMBB = BB; ++EndMBB; for (; MBBI != EndMBB; ++MBBI) { MachineBasicBlock *MBB = MBBI; From gohman at apple.com Mon Jun 30 15:59:52 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 20:59:52 -0000 Subject: [llvm-commits] [llvm] r52924 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ Message-ID: <200806302059.m5UKxsBR009507@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 15:59:49 2008 New Revision: 52924 URL: http://llvm.org/viewvc/llvm-project?rev=52924&view=rev Log: Rename ISD::LOCATION to ISD::DBG_STOPPOINT to better reflect its purpose, and give it a custom SDNode subclass so that it doesn't need to have line number, column number, filename string, and directory string, all existing as individual SDNodes to be the operands. This was the only user of ISD::STRING, StringSDNode, etc., so remove those and some associated code. This makes stop-points considerably easier to read in -view-legalize-dags output, and reduces overhead (creating new nodes and copying std::strings into them) on code containing debugging information. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Jun 30 15:59:49 2008 @@ -173,7 +173,6 @@ //===--------------------------------------------------------------------===// // Node creation methods. // - SDOperand getString(const std::string &Val); SDOperand getConstant(uint64_t Val, MVT VT, bool isTarget = false); SDOperand getConstant(const APInt &Val, MVT VT, bool isTarget = false); SDOperand getIntPtrConstant(uint64_t Val, bool isTarget = false); @@ -224,6 +223,8 @@ SDOperand getArgFlags(ISD::ArgFlagsTy Flags); SDOperand getValueType(MVT); SDOperand getRegister(unsigned Reg, MVT VT); + SDOperand getDbgStopPoint(SDOperand Root, unsigned Line, unsigned Col, + const CompileUnitDesc *CU); SDOperand getCopyToReg(SDOperand Chain, unsigned Reg, SDOperand N) { return getNode(ISD::CopyToReg, MVT::Other, Chain, @@ -635,7 +636,6 @@ std::map ExtendedValueTypeNodes; StringMap ExternalSymbols; StringMap TargetExternalSymbols; - StringMap StringNodes; }; template <> struct GraphTraits : public GraphTraits { Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Mon Jun 30 15:59:49 2008 @@ -37,6 +37,7 @@ class MachineBasicBlock; class MachineConstantPoolValue; class SDNode; +class CompileUnitDesc; template struct DenseMapInfo; template struct simplify_type; template struct ilist_traits; @@ -82,7 +83,7 @@ AssertSext, AssertZext, // Various leaf nodes. - STRING, BasicBlock, VALUETYPE, ARG_FLAGS, CONDCODE, Register, + BasicBlock, VALUETYPE, ARG_FLAGS, CONDCODE, Register, Constant, ConstantFP, GlobalAddress, GlobalTLSAddress, FrameIndex, JumpTable, ConstantPool, ExternalSymbol, @@ -547,11 +548,11 @@ // HANDLENODE node - Used as a handle for various purposes. HANDLENODE, - // LOCATION - This node is used to represent a source location for debug - // info. It takes token chain as input, then a line number, then a column - // number, then a filename, then a working dir. It produces a token chain - // as output. - LOCATION, + // DBG_STOPPOINT - This node is used to represent a source location for + // debug info. It takes token chain as input, and carries a line number, + // column number, and a pointer to a CompileUnitDesc object identifying + // the containing compilation unit. It produces a token chain as output. + DBG_STOPPOINT, // DEBUG_LOC - This node is used to represent source line information // embedded in the code. It takes a token chain as input, then a line @@ -1552,22 +1553,6 @@ } }; -class StringSDNode : public SDNode { - std::string Value; - virtual void ANCHOR(); // Out-of-line virtual method to give class a home. -protected: - friend class SelectionDAG; - explicit StringSDNode(const std::string &val) - : SDNode(ISD::STRING, getSDVTList(MVT::Other)), Value(val) { - } -public: - const std::string &getValue() const { return Value; } - static bool classof(const StringSDNode *) { return true; } - static bool classof(const SDNode *N) { - return N->getOpcode() == ISD::STRING; - } -}; - class ConstantSDNode : public SDNode { APInt Value; virtual void ANCHOR(); // Out-of-line virtual method to give class a home. @@ -1858,6 +1843,33 @@ } }; +class DbgStopPointSDNode : public SDNode { + SDUse Chain; + unsigned Line; + unsigned Column; + const CompileUnitDesc *CU; + virtual void ANCHOR(); // Out-of-line virtual method to give class a home. +protected: + friend class SelectionDAG; + DbgStopPointSDNode(SDOperand ch, unsigned l, unsigned c, + const CompileUnitDesc *cu) + : SDNode(ISD::DBG_STOPPOINT, getSDVTList(MVT::Other)), + Line(l), Column(c), CU(cu) { + Chain = ch; + InitOperands(&Chain, 1); + } +public: + + unsigned getLine() const { return Line; } + unsigned getColumn() const { return Column; } + const CompileUnitDesc *getCompileUnit() const { return CU; } + + static bool classof(const DbgStopPointSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::DBG_STOPPOINT; + } +}; + class ExternalSymbolSDNode : public SDNode { const char *Symbol; virtual void ANCHOR(); // Out-of-line virtual method to give class a home. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Jun 30 15:59:49 2008 @@ -849,7 +849,6 @@ case ISD::VALUETYPE: case ISD::SRCVALUE: case ISD::MEMOPERAND: - case ISD::STRING: case ISD::CONDCODE: case ISD::ARG_FLAGS: // Primitives must all be legal. @@ -1075,11 +1074,11 @@ return Result.getValue(Op.ResNo); } - case ISD::LOCATION: - assert(Node->getNumOperands() == 5 && "Invalid LOCATION node!"); + case ISD::DBG_STOPPOINT: + assert(Node->getNumOperands() == 1 && "Invalid DBG_STOPPOINT node!"); Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the input chain. - switch (TLI.getOperationAction(ISD::LOCATION, MVT::Other)) { + switch (TLI.getOperationAction(ISD::DBG_STOPPOINT, MVT::Other)) { case TargetLowering::Promote: default: assert(0 && "This action is not supported yet!"); case TargetLowering::Expand: { @@ -1087,26 +1086,22 @@ bool useDEBUG_LOC = TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other); bool useLABEL = TLI.isOperationLegal(ISD::LABEL, MVT::Other); + const DbgStopPointSDNode *DSP = cast(Node); if (MMI && (useDEBUG_LOC || useLABEL)) { - const std::string &FName = - cast(Node->getOperand(3))->getValue(); - const std::string &DirName = - cast(Node->getOperand(4))->getValue(); - unsigned SrcFile = MMI->RecordSource(DirName, FName); + const CompileUnitDesc *CompileUnit = DSP->getCompileUnit(); + unsigned SrcFile = MMI->RecordSource(CompileUnit); SmallVector Ops; Ops.push_back(Tmp1); // chain - SDOperand LineOp = Node->getOperand(1); - SDOperand ColOp = Node->getOperand(2); + unsigned Line = DSP->getLine(); + unsigned Col = DSP->getColumn(); if (useDEBUG_LOC) { - Ops.push_back(LineOp); // line # - Ops.push_back(ColOp); // col # + Ops.push_back(DAG.getConstant(Line, MVT::i32)); // line # + Ops.push_back(DAG.getConstant(Col, MVT::i32)); // col # Ops.push_back(DAG.getConstant(SrcFile, MVT::i32)); // source file id Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, &Ops[0], Ops.size()); } else { - unsigned Line = cast(LineOp)->getValue(); - unsigned Col = cast(ColOp)->getValue(); unsigned ID = MMI->RecordSourceLine(Line, Col, SrcFile); Ops.push_back(DAG.getConstant(ID, MVT::i32)); Ops.push_back(DAG.getConstant(0, MVT::i32)); // a debug label Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jun 30 15:59:49 2008 @@ -382,6 +382,13 @@ case ISD::Register: ID.AddInteger(cast(N)->getReg()); break; + case ISD::DBG_STOPPOINT: { + const DbgStopPointSDNode *DSP = cast(N); + ID.AddInteger(DSP->getLine()); + ID.AddInteger(DSP->getColumn()); + ID.AddPointer(DSP->getCompileUnit()); + break; + } case ISD::SRCVALUE: ID.AddPointer(cast(N)->getValue()); break; @@ -575,9 +582,6 @@ bool Erased = false; switch (N->getOpcode()) { case ISD::HANDLENODE: return; // noop. - case ISD::STRING: - Erased = StringNodes.erase(cast(N)->getValue()); - break; case ISD::CONDCODE: assert(CondCodeNodes[cast(N)->get()] && "Cond code doesn't exist!"); @@ -738,15 +742,6 @@ getConstant(Imm, Op.getValueType())); } -SDOperand SelectionDAG::getString(const std::string &Val) { - StringSDNode *&N = StringNodes[Val]; - if (!N) { - N = new StringSDNode(Val); - AllNodes.push_back(N); - } - return SDOperand(N, 0); -} - SDOperand SelectionDAG::getConstant(uint64_t Val, MVT VT, bool isT) { MVT EltVT = VT.isVector() ? VT.getVectorElementType() : VT; return getConstant(APInt(EltVT.getSizeInBits(), Val), VT, isT); @@ -1005,6 +1000,24 @@ return SDOperand(N, 0); } +SDOperand SelectionDAG::getDbgStopPoint(SDOperand Root, + unsigned Line, unsigned Col, + const CompileUnitDesc *CU) { + FoldingSetNodeID ID; + SDOperand Ops[] = { Root }; + AddNodeIDNode(ID, ISD::DBG_STOPPOINT, getVTList(MVT::Other), &Ops[0], 1); + ID.AddInteger(Line); + ID.AddInteger(Col); + ID.AddPointer(CU); + void *IP = 0; + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) + return SDOperand(E, 0); + SDNode *N = new DbgStopPointSDNode(Root, Line, Col, CU); + CSEMap.InsertNode(N, IP); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + SDOperand SelectionDAG::getSrcValue(const Value *V) { assert((!V || isa(V->getType())) && "SrcValue is not a pointer?"); @@ -4178,7 +4191,6 @@ void BinarySDNode::ANCHOR() {} void TernarySDNode::ANCHOR() {} void HandleSDNode::ANCHOR() {} -void StringSDNode::ANCHOR() {} void ConstantSDNode::ANCHOR() {} void ConstantFPSDNode::ANCHOR() {} void GlobalAddressSDNode::ANCHOR() {} @@ -4189,6 +4201,7 @@ void SrcValueSDNode::ANCHOR() {} void MemOperandSDNode::ANCHOR() {} void RegisterSDNode::ANCHOR() {} +void DbgStopPointSDNode::ANCHOR() {} void ExternalSymbolSDNode::ANCHOR() {} void CondCodeSDNode::ANCHOR() {} void ARG_FLAGSSDNode::ANCHOR() {} @@ -4463,7 +4476,6 @@ case ISD::AssertSext: return "AssertSext"; case ISD::AssertZext: return "AssertZext"; - case ISD::STRING: return "String"; case ISD::BasicBlock: return "BasicBlock"; case ISD::ARG_FLAGS: return "ArgFlags"; case ISD::VALUETYPE: return "ValueType"; @@ -4624,7 +4636,7 @@ case ISD::CTLZ: return "ctlz"; // Debug info - case ISD::LOCATION: return "location"; + case ISD::DBG_STOPPOINT: return "dbg_stoppoint"; case ISD::DEBUG_LOC: return "debug_loc"; // Trampolines Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jun 30 15:59:49 2008 @@ -3164,20 +3164,12 @@ MachineModuleInfo *MMI = DAG.getMachineModuleInfo(); DbgStopPointInst &SPI = cast(I); if (MMI && SPI.getContext() && MMI->Verify(SPI.getContext())) { - SDOperand Ops[5]; - - Ops[0] = getRoot(); - Ops[1] = getValue(SPI.getLineValue()); - Ops[2] = getValue(SPI.getColumnValue()); - DebugInfoDesc *DD = MMI->getDescFor(SPI.getContext()); assert(DD && "Not a debug information descriptor"); - CompileUnitDesc *CompileUnit = cast(DD); - - Ops[3] = DAG.getString(CompileUnit->getFileName()); - Ops[4] = DAG.getString(CompileUnit->getDirectory()); - - DAG.setRoot(DAG.getNode(ISD::LOCATION, MVT::Other, Ops, 5)); + DAG.setRoot(DAG.getDbgStopPoint(getRoot(), + SPI.getLine(), + SPI.getColumn(), + cast(DD))); } return 0; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Jun 30 15:59:49 2008 @@ -18,6 +18,7 @@ #include "llvm/CodeGen/ScheduleDAG.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/GraphWriter.h" @@ -138,6 +139,11 @@ } else { Op += " #" + utostr(R->getReg()); } + } else if (const DbgStopPointSDNode *D = dyn_cast(Node)) { + Op += ": " + D->getCompileUnit()->getFileName(); + Op += ":" + utostr(D->getLine()); + if (D->getColumn() != 0) + Op += ":" + utostr(D->getColumn()); } else if (const ExternalSymbolSDNode *ES = dyn_cast(Node)) { Op += "'" + std::string(ES->getSymbol()) + "'"; @@ -155,8 +161,6 @@ Op = Op + " AF=" + N->getArgFlags().getArgFlagsString(); } else if (const VTSDNode *N = dyn_cast(Node)) { Op = Op + " VT=" + N->getVT().getMVTString(); - } else if (const StringSDNode *N = dyn_cast(Node)) { - Op = Op + "\"" + N->getValue() + "\""; } else if (const LoadSDNode *LD = dyn_cast(Node)) { bool doExt = true; switch (LD->getExtensionType()) { Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Mon Jun 30 15:59:49 2008 @@ -188,7 +188,7 @@ setOperationAction(ISD::UDIVREM, MVT::i32, Expand); // Support label based line numbers. - setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); setOperationAction(ISD::RET, MVT::Other, Custom); Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Mon Jun 30 15:59:49 2008 @@ -104,7 +104,7 @@ setOperationAction(ISD::BIT_CONVERT, MVT::f32, Promote); // We don't have line number support yet. - setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); setOperationAction(ISD::LABEL, MVT::Other, Expand); Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Mon Jun 30 15:59:49 2008 @@ -290,7 +290,7 @@ setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i1, Expand); // Support label based line numbers. - setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); // We want to legalize GlobalAddress and ConstantPool nodes into the Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Mon Jun 30 15:59:49 2008 @@ -87,7 +87,7 @@ setOperationAction(ISD::FCOPYSIGN, MVT::f32, Expand); // We don't have line number support yet. - setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); setOperationAction(ISD::LABEL, MVT::Other, Expand); Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Mon Jun 30 15:59:49 2008 @@ -95,7 +95,7 @@ setOperationAction(ISD::SRL_PARTS, MVT::i32, Expand); // We don't have line number support yet. - setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); setOperationAction(ISD::LABEL, MVT::Other, Expand); Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Mon Jun 30 15:59:49 2008 @@ -133,7 +133,7 @@ setOperationAction(ISD::SRL_PARTS, MVT::i32, Expand); // We don't have line number support yet. - setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); setOperationAction(ISD::LABEL, MVT::Other, Expand); Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Mon Jun 30 15:59:49 2008 @@ -164,7 +164,7 @@ setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i1, Expand); // Support label based line numbers. - setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); setOperationAction(ISD::EXCEPTIONADDR, MVT::i64, Expand); Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Mon Jun 30 15:59:49 2008 @@ -595,7 +595,7 @@ setOperationAction(ISD::UMUL_LOHI, MVT::i32, Expand); // We don't have line number support yet. - setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); setOperationAction(ISD::LABEL, MVT::Other, Expand); @@ -615,7 +615,7 @@ setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32 , Custom); // No debug info support yet. - setOperationAction(ISD::LOCATION, MVT::Other, Expand); + setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::LABEL, MVT::Other, Expand); setOperationAction(ISD::DECLARE, MVT::Other, Expand); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=52924&r1=52923&r2=52924&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jun 30 15:59:49 2008 @@ -298,8 +298,8 @@ setOperationAction(ISD::ATOMIC_CMP_SWAP , MVT::i64, Custom); setOperationAction(ISD::ATOMIC_LOAD_SUB , MVT::i32, Expand); - // Use the default ISD::LOCATION, ISD::DECLARE expansion. - setOperationAction(ISD::LOCATION, MVT::Other, Expand); + // Use the default ISD::DBG_STOPPOINT, ISD::DECLARE expansion. + setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); // FIXME - use subtarget debug flags if (!Subtarget->isTargetDarwin() && !Subtarget->isTargetELF() && From gohman at apple.com Mon Jun 30 16:00:56 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 21:00:56 -0000 Subject: [llvm-commits] [llvm] r52925 - in /llvm/trunk: include/llvm/Target/TargetLowering.h lib/Target/X86/X86ISelLowering.cpp Message-ID: <200806302100.m5UL0vIT009551@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 16:00:56 2008 New Revision: 52925 URL: http://llvm.org/viewvc/llvm-project?rev=52925&view=rev Log: Update comments to new-style syntax. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=52925&r1=52924&r2=52925&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Mon Jun 30 16:00:56 2008 @@ -1445,7 +1445,7 @@ ISD::CondCode CmpLibcallCCs[RTLIB::UNKNOWN_LIBCALL]; protected: - /// When lowering %llvm.memset this field specifies the maximum number of + /// When lowering @llvm.memset this field specifies the maximum number of /// store operations that may be substituted for the call to memset. Targets /// must set this value based on the cost threshold for that target. Targets /// should assume that the memset will be done using as many of the largest @@ -1456,7 +1456,7 @@ /// @brief Specify maximum number of store instructions per memset call. unsigned maxStoresPerMemset; - /// When lowering %llvm.memcpy this field specifies the maximum number of + /// When lowering @llvm.memcpy this field specifies the maximum number of /// store operations that may be substituted for a call to memcpy. Targets /// must set this value based on the cost threshold for that target. Targets /// should assume that the memcpy will be done using as many of the largest @@ -1468,7 +1468,7 @@ /// @brief Specify maximum bytes of store instructions per memcpy call. unsigned maxStoresPerMemcpy; - /// When lowering %llvm.memmove this field specifies the maximum number of + /// When lowering @llvm.memmove this field specifies the maximum number of /// store instructions that may be substituted for a call to memmove. Targets /// must set this value based on the cost threshold for that target. Targets /// should assume that the memmove will be done using as many of the largest Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=52925&r1=52924&r2=52925&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jun 30 16:00:56 2008 @@ -739,9 +739,9 @@ // FIXME: These should be based on subtarget info. Plus, the values should // be smaller when we are in optimizing for size mode. - maxStoresPerMemset = 16; // For %llvm.memset -> sequence of stores - maxStoresPerMemcpy = 16; // For %llvm.memcpy -> sequence of stores - maxStoresPerMemmove = 3; // For %llvm.memmove -> sequence of stores + maxStoresPerMemset = 16; // For @llvm.memset -> sequence of stores + maxStoresPerMemcpy = 16; // For @llvm.memcpy -> sequence of stores + maxStoresPerMemmove = 3; // For @llvm.memmove -> sequence of stores allowUnalignedMemoryAccesses = true; // x86 supports it! setPrefLoopAlignment(16); } From gohman at apple.com Mon Jun 30 16:04:11 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 21:04:11 -0000 Subject: [llvm-commits] [llvm] r52926 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200806302104.m5UL4CsQ009648@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 16:04:06 2008 New Revision: 52926 URL: http://llvm.org/viewvc/llvm-project?rev=52926&view=rev Log: Use reserve. SelectionDAG::allnodes_size is linear, but that doesn't appear to outweigh the benefit of reducing heap traffic. If it does become a problem, we should teach SelectionDAG to keep a count of how many nodes are live, because there are several other places where that information would be useful as well. 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=52926&r1=52925&r2=52926&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Jun 30 16:04:06 2008 @@ -592,6 +592,7 @@ AfterLegalize = RunningAfterLegalize; // Add all the dag nodes to the worklist. + WorkList.reserve(DAG.allnodes_size()); for (SelectionDAG::allnodes_iterator I = DAG.allnodes_begin(), E = DAG.allnodes_end(); I != E; ++I) WorkList.push_back(I); From gohman at apple.com Mon Jun 30 16:33:03 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 21:33:03 -0000 Subject: [llvm-commits] [llvm] r52927 - /llvm/trunk/include/llvm/ADT/SmallVector.h Message-ID: <200806302133.m5ULX3nf010634@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 16:33:02 2008 New Revision: 52927 URL: http://llvm.org/viewvc/llvm-project?rev=52927&view=rev Log: Use plain operator new instead of new char[]. Modified: llvm/trunk/include/llvm/ADT/SmallVector.h Modified: llvm/trunk/include/llvm/ADT/SmallVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=52927&r1=52926&r2=52927&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallVector.h (original) +++ llvm/trunk/include/llvm/ADT/SmallVector.h Mon Jun 30 16:33:02 2008 @@ -84,7 +84,7 @@ // If this wasn't grown from the inline copy, deallocate the old space. if (!isSmall()) - delete[] reinterpret_cast(Begin); + operator delete(static_cast(Begin)); } typedef size_t size_type; @@ -317,8 +317,8 @@ /// isSmall - Return true if this is a smallvector which has not had dynamic /// memory allocated for it. bool isSmall() const { - return reinterpret_cast(Begin) == - reinterpret_cast(&FirstEl); + return static_cast(Begin) == + static_cast(&FirstEl); } /// grow - double the size of the allocated memory, guaranteeing space for at @@ -346,7 +346,7 @@ size_t NewCapacity = 2*CurCapacity; if (NewCapacity < MinSize) NewCapacity = MinSize; - T *NewElts = reinterpret_cast(new char[NewCapacity*sizeof(T)]); + T *NewElts = static_cast(operator new(NewCapacity*sizeof(T))); // Copy the elements over. std::uninitialized_copy(Begin, End, NewElts); @@ -356,7 +356,7 @@ // If this wasn't grown from the inline copy, deallocate the old space. if (!isSmall()) - delete[] reinterpret_cast(Begin); + operator delete(static_cast(Begin)); Begin = NewElts; End = NewElts+CurSize; From gohman at apple.com Mon Jun 30 16:45:14 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 21:45:14 -0000 Subject: [llvm-commits] [llvm] r52928 - /llvm/trunk/include/llvm/ADT/SmallVector.h Message-ID: <200806302145.m5ULjESB011045@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 16:45:13 2008 New Revision: 52928 URL: http://llvm.org/viewvc/llvm-project?rev=52928&view=rev Log: Make SmallVector's grow use memcpy in common cases instead of std::uninitialized_copy, which uses memmove. Modified: llvm/trunk/include/llvm/ADT/SmallVector.h Modified: llvm/trunk/include/llvm/ADT/SmallVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=52928&r1=52927&r2=52928&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallVector.h (original) +++ llvm/trunk/include/llvm/ADT/SmallVector.h Mon Jun 30 16:45:13 2008 @@ -15,6 +15,7 @@ #define LLVM_ADT_SMALLVECTOR_H #include "llvm/ADT/iterator.h" +#include "llvm/Support/type_traits.h" #include #include @@ -349,7 +350,11 @@ T *NewElts = static_cast(operator new(NewCapacity*sizeof(T))); // Copy the elements over. - std::uninitialized_copy(Begin, End, NewElts); + if (is_class::value) + std::uninitialized_copy(Begin, End, NewElts); + else + // Use memcpy for PODs (std::uninitialized_copy optimizes to memmove). + memcpy(NewElts, Begin, CurSize * sizeof(T)); // Destroy the original elements. destroy_range(Begin, End); From gohman at apple.com Mon Jun 30 17:03:41 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 22:03:41 -0000 Subject: [llvm-commits] [llvm] r52929 - in /llvm/trunk/lib: CodeGen/AsmPrinter.cpp Target/X86/X86ATTAsmPrinter.cpp Message-ID: <200806302203.m5UM3fC0011886@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 17:03:41 2008 New Revision: 52929 URL: http://llvm.org/viewvc/llvm-project?rev=52929&view=rev Log: std::ostream and std::string microoptimizations for asm printing. Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=52929&r1=52928&r2=52929&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Mon Jun 30 17:03:41 2008 @@ -66,7 +66,7 @@ // Close the current section, if applicable. if (TAI->getSectionEndDirectiveSuffix() && !CurrentSection.empty()) - O << CurrentSection << TAI->getSectionEndDirectiveSuffix() << "\n"; + O << CurrentSection << TAI->getSectionEndDirectiveSuffix() << '\n'; CurrentSection = NS; @@ -92,7 +92,7 @@ // Close the current section, if applicable. if (TAI->getSectionEndDirectiveSuffix() && !CurrentSection.empty()) - O << CurrentSection << TAI->getSectionEndDirectiveSuffix() << "\n"; + O << CurrentSection << TAI->getSectionEndDirectiveSuffix() << '\n'; CurrentSection = NS; @@ -120,7 +120,7 @@ if (!M.getModuleInlineAsm().empty()) O << TAI->getCommentString() << " Start of file scope inline assembly\n" << M.getModuleInlineAsm() - << "\n" << TAI->getCommentString() + << '\n' << TAI->getCommentString() << " End of file scope inline assembly\n"; SwitchToDataSection(""); // Reset back to no section. @@ -140,7 +140,7 @@ e = ExtWeakSymbols.end(); i != e; ++i) { const GlobalValue *GV = *i; std::string Name = Mang->getValueName(GV); - O << TAI->getWeakRefDirective() << Name << "\n"; + O << TAI->getWeakRefDirective() << Name << '\n'; } } @@ -148,7 +148,7 @@ if (!M.alias_empty()) SwitchToTextSection(TAI->getTextSection()); - O << "\n"; + O << '\n'; for (Module::const_alias_iterator I = M.alias_begin(), E = M.alias_end(); I!=E; ++I) { std::string Name = Mang->getValueName(I); @@ -158,30 +158,30 @@ Target = Mang->getValueName(GV); if (I->hasExternalLinkage() || !TAI->getWeakRefDirective()) - O << "\t.globl\t" << Name << "\n"; + O << "\t.globl\t" << Name << '\n'; else if (I->hasWeakLinkage()) - O << TAI->getWeakRefDirective() << Name << "\n"; + O << TAI->getWeakRefDirective() << Name << '\n'; else if (!I->hasInternalLinkage()) assert(0 && "Invalid alias linkage"); if (I->hasHiddenVisibility()) { if (const char *Directive = TAI->getHiddenDirective()) - O << Directive << Name << "\n"; + O << Directive << Name << '\n'; } else if (I->hasProtectedVisibility()) { if (const char *Directive = TAI->getProtectedDirective()) - O << Directive << Name << "\n"; + O << Directive << Name << '\n'; } - O << TAI->getSetDirective() << ' ' << Name << ", " << Target << "\n"; + O << TAI->getSetDirective() << ' ' << Name << ", " << Target << '\n'; // If the aliasee has external weak linkage it can be referenced only by // alias itself. In this case it can be not in ExtWeakSymbols list. Emit // weak reference in such case. if (GV->hasExternalWeakLinkage()) { if (TAI->getWeakRefDirective()) - O << TAI->getWeakRefDirective() << Target << "\n"; + O << TAI->getWeakRefDirective() << Target << '\n'; else - O << "\t.globl\t" << Target << "\n"; + O << "\t.globl\t" << Target << '\n'; } } } @@ -197,7 +197,7 @@ Function* InitTrampolineIntrinsic = M.getFunction("llvm.init.trampoline"); if (!InitTrampolineIntrinsic || InitTrampolineIntrinsic->use_empty()) if (TAI->getNonexecutableStackDirective()) - O << TAI->getNonexecutableStackDirective() << "\n"; + O << TAI->getNonexecutableStackDirective() << '\n'; delete Mang; Mang = 0; return false; @@ -265,7 +265,7 @@ EmitAlignment(Alignment); for (unsigned i = 0, e = CP.size(); i != e; ++i) { O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_' - << CP[i].second << ":\t\t\t\t\t" << TAI->getCommentString() << " "; + << CP[i].second << ":\t\t\t\t\t" << TAI->getCommentString() << ' '; WriteTypeSymbolic(O, CP[i].first.getType(), 0) << '\n'; if (CP[i].first.isMachineConstantPoolEntry()) EmitMachineConstantPoolValue(CP[i].first.Val.MachineCPVal); @@ -429,7 +429,7 @@ for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) { O << Directive; EmitConstantValueOnly(InitList->getOperand(i)); - O << "\n"; + O << '\n'; } } @@ -549,16 +549,16 @@ /// EOL - Print a newline character to asm stream. If a comment is present /// then it will be printed first. Comments should not contain '\n'. void AsmPrinter::EOL() const { - O << "\n"; + O << '\n'; } void AsmPrinter::EOL(const std::string &Comment) const { if (AsmVerbose && !Comment.empty()) { - O << "\t" + O << '\t' << TAI->getCommentString() - << " " + << ' ' << Comment; } - O << "\n"; + O << '\n'; } /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an @@ -614,10 +614,10 @@ PrintHex(Value); } else { if (TM.getTargetData()->isBigEndian()) { - EmitInt32(unsigned(Value >> 32)); O << "\n"; + EmitInt32(unsigned(Value >> 32)); O << '\n'; EmitInt32(unsigned(Value)); } else { - EmitInt32(unsigned(Value)); O << "\n"; + EmitInt32(unsigned(Value)); O << '\n'; EmitInt32(unsigned(Value >> 32)); } } @@ -664,13 +664,13 @@ O << AscizDirective; else O << TAI->getAsciiDirective(); - O << "\""; + O << '\"'; for (unsigned i = 0, N = String.size(); i < N; ++i) { unsigned char C = String[i]; printStringChar(O, C); } if (AscizDirective) - O << "\""; + O << '\"'; else O << "\\0\""; } @@ -683,7 +683,7 @@ unsigned char C = Name[i]; printStringChar(O, C); } - O << "\""; + O << '\"'; } @@ -716,7 +716,7 @@ unsigned FillValue = TAI->getTextAlignFillValue(); UseFillExpr &= IsInTextSection && FillValue; if (UseFillExpr) O << ",0x" << std::hex << FillValue << std::dec; - O << "\n"; + O << '\n'; } @@ -728,7 +728,7 @@ O << TAI->getZeroDirective() << NumZeros; if (TAI->getZeroDirectiveSuffix()) O << TAI->getZeroDirectiveSuffix(); - O << "\n"; + O << '\n'; } else { for (; NumZeros; --NumZeros) O << TAI->getData8bitsDirective() << "0\n"; @@ -740,7 +740,7 @@ // constants valid in constant expressions can occur here. void AsmPrinter::EmitConstantValueOnly(const Constant *CV) { if (CV->isNullValue() || isa(CV)) - O << "0"; + O << '0'; else if (const ConstantInt *CI = dyn_cast(CV)) { O << CI->getZExtValue(); } else if (const GlobalValue *GV = dyn_cast(CV)) { @@ -768,7 +768,7 @@ if (int64_t Offset = TD->getIndexedOffset(ptrVal->getType(), &idxVec[0], idxVec.size())) { if (Offset) - O << "("; + O << '('; EmitConstantValueOnly(ptrVal); if (Offset > 0) O << ") + " << Offset; @@ -823,9 +823,9 @@ case Instruction::And: case Instruction::Or: case Instruction::Xor: - O << "("; + O << '('; EmitConstantValueOnly(CE->getOperand(0)); - O << ")"; + O << ')'; switch (Opcode) { case Instruction::Add: O << " + "; @@ -845,9 +845,9 @@ default: break; } - O << "("; + O << '('; EmitConstantValueOnly(CE->getOperand(1)); - O << ")"; + O << ')'; break; default: assert(0 && "Unsupported operator!"); @@ -864,13 +864,13 @@ unsigned LastElt) { assert(CVA->isString() && "Array is not string compatible!"); - O << "\""; + O << '\"'; for (unsigned i = 0; i != LastElt; ++i) { unsigned char C = (unsigned char)cast(CVA->getOperand(i))->getZExtValue(); printStringChar(O, C); } - O << "\""; + O << '\"'; } /// EmitString - Emit a zero-byte-terminated string constant. @@ -885,7 +885,7 @@ O << TAI->getAsciiDirective(); printAsCString(O, CVA, NumElts); } - O << "\n"; + O << '\n'; } /// EmitGlobalConstant - Print a general LLVM constant to the .s file. @@ -935,29 +935,29 @@ double Val = CFP->getValueAPF().convertToDouble(); // for comment only uint64_t i = CFP->getValueAPF().convertToAPInt().getZExtValue(); if (TAI->getData64bitsDirective()) - O << TAI->getData64bitsDirective() << i << "\t" - << TAI->getCommentString() << " double value: " << Val << "\n"; + O << TAI->getData64bitsDirective() << i << '\t' + << TAI->getCommentString() << " double value: " << Val << '\n'; else if (TD->isBigEndian()) { O << TAI->getData32bitsDirective() << unsigned(i >> 32) - << "\t" << TAI->getCommentString() - << " double most significant word " << Val << "\n"; + << '\t' << TAI->getCommentString() + << " double most significant word " << Val << '\n'; O << TAI->getData32bitsDirective() << unsigned(i) - << "\t" << TAI->getCommentString() - << " double least significant word " << Val << "\n"; + << '\t' << TAI->getCommentString() + << " double least significant word " << Val << '\n'; } else { O << TAI->getData32bitsDirective() << unsigned(i) - << "\t" << TAI->getCommentString() - << " double least significant word " << Val << "\n"; + << '\t' << TAI->getCommentString() + << " double least significant word " << Val << '\n'; O << TAI->getData32bitsDirective() << unsigned(i >> 32) - << "\t" << TAI->getCommentString() - << " double most significant word " << Val << "\n"; + << '\t' << TAI->getCommentString() + << " double most significant word " << Val << '\n'; } return; } else if (CFP->getType() == Type::FloatTy) { float Val = CFP->getValueAPF().convertToFloat(); // for comment only O << TAI->getData32bitsDirective() << CFP->getValueAPF().convertToAPInt().getZExtValue() - << "\t" << TAI->getCommentString() << " float " << Val << "\n"; + << '\t' << TAI->getCommentString() << " float " << Val << '\n'; return; } else if (CFP->getType() == Type::X86_FP80Ty) { // all long double variants are printed as hex @@ -968,37 +968,37 @@ DoubleVal.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven); if (TD->isBigEndian()) { O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 48) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double most significant halfword of ~" - << DoubleVal.convertToDouble() << "\n"; + << DoubleVal.convertToDouble() << '\n'; O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 32) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double next halfword\n"; O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 16) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double next halfword\n"; O << TAI->getData16bitsDirective() << uint16_t(p[0]) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double next halfword\n"; O << TAI->getData16bitsDirective() << uint16_t(p[1]) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double least significant halfword\n"; } else { O << TAI->getData16bitsDirective() << uint16_t(p[1]) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double least significant halfword of ~" - << DoubleVal.convertToDouble() << "\n"; + << DoubleVal.convertToDouble() << '\n'; O << TAI->getData16bitsDirective() << uint16_t(p[0]) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double next halfword\n"; O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 16) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double next halfword\n"; O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 32) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double next halfword\n"; O << TAI->getData16bitsDirective() << uint16_t(p[0] >> 48) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double most significant halfword\n"; } EmitZeros(Size - TD->getTypeStoreSize(Type::X86_FP80Ty)); @@ -1010,29 +1010,29 @@ const uint64_t *p = api.getRawData(); if (TD->isBigEndian()) { O << TAI->getData32bitsDirective() << uint32_t(p[0] >> 32) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double most significant word\n"; O << TAI->getData32bitsDirective() << uint32_t(p[0]) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double next word\n"; O << TAI->getData32bitsDirective() << uint32_t(p[1] >> 32) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double next word\n"; O << TAI->getData32bitsDirective() << uint32_t(p[1]) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double least significant word\n"; } else { O << TAI->getData32bitsDirective() << uint32_t(p[1]) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double least significant word\n"; O << TAI->getData32bitsDirective() << uint32_t(p[1] >> 32) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double next word\n"; O << TAI->getData32bitsDirective() << uint32_t(p[0]) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double next word\n"; O << TAI->getData32bitsDirective() << uint32_t(p[0] >> 32) - << "\t" << TAI->getCommentString() + << '\t' << TAI->getCommentString() << " long double most significant word\n"; } return; @@ -1042,21 +1042,21 @@ uint64_t Val = CI->getZExtValue(); if (TAI->getData64bitsDirective()) - O << TAI->getData64bitsDirective() << Val << "\n"; + O << TAI->getData64bitsDirective() << Val << '\n'; else if (TD->isBigEndian()) { O << TAI->getData32bitsDirective() << unsigned(Val >> 32) - << "\t" << TAI->getCommentString() - << " Double-word most significant word " << Val << "\n"; + << '\t' << TAI->getCommentString() + << " Double-word most significant word " << Val << '\n'; O << TAI->getData32bitsDirective() << unsigned(Val) - << "\t" << TAI->getCommentString() - << " Double-word least significant word " << Val << "\n"; + << '\t' << TAI->getCommentString() + << " Double-word least significant word " << Val << '\n'; } else { O << TAI->getData32bitsDirective() << unsigned(Val) - << "\t" << TAI->getCommentString() - << " Double-word least significant word " << Val << "\n"; + << '\t' << TAI->getCommentString() + << " Double-word least significant word " << Val << '\n'; O << TAI->getData32bitsDirective() << unsigned(Val >> 32) - << "\t" << TAI->getCommentString() - << " Double-word most significant word " << Val << "\n"; + << '\t' << TAI->getCommentString() + << " Double-word most significant word " << Val << '\n'; } return; } @@ -1077,7 +1077,7 @@ << TAI->getCommentString() << " 0x" << CI->getValue().toStringUnsigned(16); } - O << "\n"; + O << '\n'; } void @@ -1141,7 +1141,7 @@ // If this asmstr is empty, just print the #APP/#NOAPP markers. // These are useful to see where empty asm's wound up. if (AsmStr[0] == 0) { - O << TAI->getInlineAsmStart() << "\n\t" << TAI->getInlineAsmEnd() << "\n"; + O << TAI->getInlineAsmStart() << "\n\t" << TAI->getInlineAsmEnd() << '\n'; return; } @@ -1168,7 +1168,7 @@ } case '\n': ++LastEmitted; // Consume newline character. - O << "\n"; // Indent code with newline. + O << '\n'; // Indent code with newline. break; case '$': { ++LastEmitted; // Consume '$' character. @@ -1305,14 +1305,14 @@ } } } - O << "\n\t" << TAI->getInlineAsmEnd() << "\n"; + O << "\n\t" << TAI->getInlineAsmEnd() << '\n'; } /// printImplicitDef - This method prints the specified machine instruction /// that is an implicit def. void AsmPrinter::printImplicitDef(const MachineInstr *MI) const { - O << "\t" << TAI->getCommentString() << " implicit-def: " - << TRI->getAsmName(MI->getOperand(0).getReg()) << "\n"; + O << '\t' << TAI->getCommentString() << " implicit-def: " + << TRI->getAsmName(MI->getOperand(0).getReg()) << '\n'; } /// printLabel - This method prints a local label used by debug and @@ -1364,7 +1364,7 @@ EmitAlignment(Log2_32(Align)); } - O << TAI->getPrivateGlobalPrefix() << "BB" << getFunctionNumber() << "_" + O << TAI->getPrivateGlobalPrefix() << "BB" << getFunctionNumber() << '_' << MBB->getNumber(); if (printColon) O << ':'; @@ -1440,8 +1440,8 @@ void AsmPrinter::printSuffixedName(std::string &Name, const char* Suffix) { if (Name[0]=='\"') - O << "\"" << TAI->getPrivateGlobalPrefix() << - Name.substr(1, Name.length()-2) << Suffix << "\""; + O << '\"' << TAI->getPrivateGlobalPrefix() << + Name.substr(1, Name.length()-2) << Suffix << '\"'; else O << TAI->getPrivateGlobalPrefix() << Name << Suffix; } Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=52929&r1=52928&r2=52929&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Mon Jun 30 17:03:41 2008 @@ -41,7 +41,7 @@ if (Subtarget->isTargetDarwin()) label = "\"L" + utostr_32(FnNum) + "$pb\""; else if (Subtarget->isTargetELF()) - label = ".Lllvm$" + utostr_32(FnNum) + "." + "$piclabel"; + label = ".Lllvm$" + utostr_32(FnNum) + "." "$piclabel"; else assert(0 && "Don't know how to print PIC label!\n"); @@ -183,28 +183,28 @@ case Function::DLLExportLinkage: case Function::ExternalLinkage: EmitAlignment(FnAlign, F); - O << "\t.globl\t" << CurrentFnName << "\n"; + O << "\t.globl\t" << CurrentFnName << '\n'; break; case Function::LinkOnceLinkage: case Function::WeakLinkage: EmitAlignment(FnAlign, F); if (Subtarget->isTargetDarwin()) { - O << "\t.globl\t" << CurrentFnName << "\n"; - O << TAI->getWeakDefDirective() << CurrentFnName << "\n"; + O << "\t.globl\t" << CurrentFnName << '\n'; + O << TAI->getWeakDefDirective() << CurrentFnName << '\n'; } else if (Subtarget->isTargetCygMing()) { - O << "\t.globl\t" << CurrentFnName << "\n"; - O << "\t.linkonce discard\n"; + O << "\t.globl\t" << CurrentFnName << "\n" + "\t.linkonce discard\n"; } else { - O << "\t.weak\t" << CurrentFnName << "\n"; + O << "\t.weak\t" << CurrentFnName << '\n'; } break; } if (F->hasHiddenVisibility()) { if (const char *Directive = TAI->getHiddenDirective()) - O << Directive << CurrentFnName << "\n"; + O << Directive << CurrentFnName << '\n'; } else if (F->hasProtectedVisibility()) { if (const char *Directive = TAI->getProtectedDirective()) - O << Directive << CurrentFnName << "\n"; + O << Directive << CurrentFnName << '\n'; } if (Subtarget->isTargetELF()) @@ -287,7 +287,7 @@ } if (TAI->hasDotTypeDotSizeDirective()) - O << "\t.size\t" << CurrentFnName << ", .-" << CurrentFnName << "\n"; + O << "\t.size\t" << CurrentFnName << ", .-" << CurrentFnName << '\n'; // Emit post-function debug information. if (TAI->doesSupportDebugInformation()) @@ -345,7 +345,7 @@ case MachineOperand::MO_JumpTableIndex: { bool isMemOp = Modifier && !strcmp(Modifier, "mem"); if (!isMemOp) O << '$'; - O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << "_" + O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() << '_' << MO.getIndex(); if (TM.getRelocationModel() == Reloc::PIC_) { @@ -363,7 +363,7 @@ case MachineOperand::MO_ConstantPoolIndex: { bool isMemOp = Modifier && !strcmp(Modifier, "mem"); if (!isMemOp) O << '$'; - O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_" + O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << '_' << MO.getIndex(); if (TM.getRelocationModel() == Reloc::PIC_) { @@ -376,7 +376,7 @@ int Offset = MO.getOffset(); if (Offset > 0) - O << "+" << Offset; + O << '+' << Offset; else if (Offset < 0) O << Offset; @@ -459,7 +459,7 @@ int Offset = MO.getOffset(); if (Offset > 0) - O << "+" << Offset; + O << '+' << Offset; else if (Offset < 0) O << Offset; @@ -532,7 +532,7 @@ // popl %some_register // addl $_GLOBAL_ADDRESS_TABLE_ + [.-piclabel], %some_register O << " + [.-" - << getPICLabelString(getFunctionNumber(), TAI, Subtarget) << "]"; + << getPICLabelString(getFunctionNumber(), TAI, Subtarget) << ']'; if (isCallOp) O << "@PLT"; @@ -597,17 +597,17 @@ std::swap(BaseRegOperand, IndexRegOperand); } - O << "("; + O << '('; if (BaseReg.getReg()) printOperand(MI, Op+BaseRegOperand, Modifier); if (IndexReg.getReg()) { - O << ","; + O << ','; printOperand(MI, Op+IndexRegOperand, Modifier); if (ScaleVal != 1) - O << "," << ScaleVal; + O << ',' << ScaleVal; } - O << ")"; + O << ')'; } } @@ -632,7 +632,7 @@ void X86ATTAsmPrinter::printPICLabel(const MachineInstr *MI, unsigned Op) { std::string label = getPICLabelString(getFunctionNumber(), TAI, Subtarget); - O << label << "\n" << label << ":"; + O << label << '\n' << label << ':'; } @@ -795,10 +795,10 @@ if (GVar->hasHiddenVisibility()) { if (const char *Directive = TAI->getHiddenDirective()) - O << Directive << name << "\n"; + O << Directive << name << '\n'; } else if (GVar->hasProtectedVisibility()) { if (const char *Directive = TAI->getProtectedDirective()) - O << Directive << name << "\n"; + O << Directive << name << '\n'; } if (Subtarget->isTargetELF()) @@ -807,9 +807,9 @@ if (C->isNullValue() && !GVar->hasSection()) { if (GVar->hasExternalLinkage()) { if (const char *Directive = TAI->getZeroFillDirective()) { - O << "\t.globl " << name << "\n"; + O << "\t.globl " << name << '\n'; O << Directive << "__DATA, __common, " << name << ", " - << Size << ", " << Align << "\n"; + << Size << ", " << Align << '\n'; return; } } @@ -824,38 +824,38 @@ SwitchToDataSection(TAI->getDataSection(), GVar); if (TAI->getLCOMMDirective() != NULL) { if (GVar->hasInternalLinkage()) { - O << TAI->getLCOMMDirective() << name << "," << Size; + O << TAI->getLCOMMDirective() << name << ',' << Size; if (Subtarget->isTargetDarwin()) - O << "," << Align; + O << ',' << Align; } else if (Subtarget->isTargetDarwin() && !GVar->hasCommonLinkage()) { - O << "\t.globl " << name << "\n" - << TAI->getWeakDefDirective() << name << "\n"; + O << "\t.globl " << name << '\n' + << TAI->getWeakDefDirective() << name << '\n'; SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", GVar); EmitAlignment(Align, GVar); - O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; + O << name << ":\t\t\t\t" << TAI->getCommentString() << ' '; PrintUnmangledNameSafely(GVar, O); - O << "\n"; + O << '\n'; EmitGlobalConstant(C); return; } else { - O << TAI->getCOMMDirective() << name << "," << Size; + O << TAI->getCOMMDirective() << name << ',' << Size; // Leopard and above support aligned common symbols. if (Subtarget->getDarwinVers() >= 9) - O << "," << Align; + O << ',' << Align; } } else { if (!Subtarget->isTargetCygMing()) { if (GVar->hasInternalLinkage()) - O << "\t.local\t" << name << "\n"; + O << "\t.local\t" << name << '\n'; } - O << TAI->getCOMMDirective() << name << "," << Size; + O << TAI->getCOMMDirective() << name << ',' << Size; if (TAI->getCOMMDirectiveTakesAlignment()) - O << "," << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align); + O << ',' << (TAI->getAlignmentIsInBytes() ? (1 << Align) : Align); } - O << "\t\t" << TAI->getCommentString() << " "; + O << "\t\t" << TAI->getCommentString() << ' '; PrintUnmangledNameSafely(GVar, O); - O << "\n"; + O << '\n'; return; } } @@ -865,8 +865,8 @@ case GlobalValue::LinkOnceLinkage: case GlobalValue::WeakLinkage: if (Subtarget->isTargetDarwin()) { - O << "\t.globl " << name << "\n" - << TAI->getWeakDefDirective() << name << "\n"; + O << "\t.globl " << name << '\n' + << TAI->getWeakDefDirective() << name << '\n'; if (!GVar->isConstant()) SwitchToDataSection("\t.section __DATA,__datacoal_nt,coalesced", GVar); else { @@ -882,13 +882,13 @@ ",\"aw\""); SwitchToDataSection(SectionName.c_str(), GVar); O << "\t.globl\t" << name << "\n" - << "\t.linkonce same_size\n"; + "\t.linkonce same_size\n"; } else { std::string SectionName("\t.section\t.llvm.linkonce.d." + name + ",\"aw\", at progbits"); SwitchToDataSection(SectionName.c_str(), GVar); - O << "\t.weak\t" << name << "\n"; + O << "\t.weak\t" << name << '\n'; } break; case GlobalValue::DLLExportLinkage: @@ -897,7 +897,7 @@ // their name or something. For now, just emit them as external. case GlobalValue::ExternalLinkage: // If external or appending, declare as a global symbol - O << "\t.globl " << name << "\n"; + O << "\t.globl " << name << '\n'; // FALL THROUGH case GlobalValue::InternalLinkage: { if (GVar->isConstant()) { @@ -962,11 +962,11 @@ } EmitAlignment(Align, GVar); - O << name << ":\t\t\t\t" << TAI->getCommentString() << " "; + O << name << ":\t\t\t\t" << TAI->getCommentString() << ' '; PrintUnmangledNameSafely(GVar, O); - O << "\n"; + O << '\n'; if (TAI->hasDotTypeDotSizeDirective()) - O << "\t.size\t" << name << ", " << Size << "\n"; + O << "\t.size\t" << name << ", " << Size << '\n'; // If the initializer is a extern weak symbol, remember to emit the weak // reference! @@ -1017,12 +1017,12 @@ "self_modifying_code+pure_instructions,5", 0); std::string p = i->getKeyData(); printSuffixedName(p, "$stub"); - O << ":\n"; - O << "\t.indirect_symbol " << p << "\n"; - O << "\thlt ; hlt ; hlt ; hlt ; hlt\n"; + O << ":\n" + "\t.indirect_symbol " << p << "\n" + "\thlt ; hlt ; hlt ; hlt ; hlt\n"; } - O << "\n"; + O << '\n'; if (TAI->doesSupportExceptionHandling() && MMI && !Subtarget->is64Bit()) { // Add the (possibly multiple) personalities to the set of global values. @@ -1031,7 +1031,7 @@ for (std::vector::const_iterator I = Personalities.begin(), E = Personalities.end(); I != E; ++I) - if (*I) GVStubs.insert("_" + (*I)->getName()); + if (*I) GVStubs.insert('_' + (*I)->getName()); } // Output stubs for external and common global variables. @@ -1042,9 +1042,9 @@ i != e; ++i) { std::string p = i->getKeyData(); printSuffixedName(p, "$non_lazy_ptr"); - O << ":\n"; - O << "\t.indirect_symbol " << p << "\n"; - O << "\t.long\t0\n"; + O << ":\n" + "\t.indirect_symbol " << p << "\n" + "\t.long\t0\n"; } // Emit final debug information. From evan.cheng at apple.com Mon Jun 30 17:08:28 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 30 Jun 2008 15:08:28 -0700 Subject: [llvm-commits] [llvm] r52921 - /llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp In-Reply-To: <200806302040.m5UKeGVN008714@zion.cs.uiuc.edu> References: <200806302040.m5UKeGVN008714@zion.cs.uiuc.edu> Message-ID: Hi Dale, This check doesn't jive with the comment: FFI->getObjectIndexEnd() != 0))) { When getObjectIndexEnd() is equal to zero, it means there are non "non- fixed" objects. It can still have fixed objects. Can you clarify what it is you are checking? Thanks, Evan On Jun 30, 2008, at 1:40 PM, Dale Johannesen wrote: > Author: johannes > Date: Mon Jun 30 15:40:16 2008 > New Revision: 52921 > > URL: http://llvm.org/viewvc/llvm-project?rev=52921&view=rev > Log: > No need to align the stack if there are no stack > objects. Fixes a couple of tests on Linux. > > > Modified: > llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp > > Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=52921&r1=52920&r2=52921&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) > +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Mon Jun 30 > 15:40:16 2008 > @@ -464,7 +464,8 @@ > // works. > if (!RegInfo->targetHandlesStackFrameRounding() && > (FFI->hasCalls() || FFI->hasVarSizedObjects() || > - RegInfo->needsStackRealignment(Fn))) { > + (RegInfo->needsStackRealignment(Fn) && > + FFI->getObjectIndexEnd() != 0))) { > // If we have reserved argument space for call sites in the > function > // immediately on entry to the current function, count it as > part of the > // overall stack size. > > > _______________________________________________ > 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 Jun 30 17:10:09 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 30 Jun 2008 22:10:09 -0000 Subject: [llvm-commits] [llvm] r52930 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200806302210.m5UMA9tO012208@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 30 17:10:09 2008 New Revision: 52930 URL: http://llvm.org/viewvc/llvm-project?rev=52930&view=rev Log: Add timing report for various sub-passes under SelectionDAGISel. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52930&r1=52929&r2=52930&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jun 30 17:10:09 2008 @@ -5314,11 +5314,17 @@ } void SelectionDAGISel::CodeGenAndEmitDAG(SelectionDAG &DAG) { + NamedRegionTimer *RegionTimer = 0; + DOUT << "Lowered selection DAG:\n"; DEBUG(DAG.dump()); // Run the DAG combiner in pre-legalize mode. + if (TimePassesIsEnabled) + RegionTimer = new NamedRegionTimer("DAG Combining 1"); DAG.Combine(false, *AA); + if (TimePassesIsEnabled) + delete RegionTimer; DOUT << "Optimized lowered selection DAG:\n"; DEBUG(DAG.dump()); @@ -5329,13 +5335,21 @@ DAG.LegalizeTypes(); // Someday even later, enable a dag combine pass here. #endif + if (TimePassesIsEnabled) + RegionTimer = new NamedRegionTimer("DAG Legalization"); DAG.Legalize(); + if (TimePassesIsEnabled) + delete RegionTimer; DOUT << "Legalized selection DAG:\n"; DEBUG(DAG.dump()); // Run the DAG combiner in post-legalize mode. + if (TimePassesIsEnabled) + RegionTimer = new NamedRegionTimer("DAG Combining 2"); DAG.Combine(true, *AA); + if (TimePassesIsEnabled) + delete RegionTimer; DOUT << "Optimized legalized selection DAG:\n"; DEBUG(DAG.dump()); @@ -5347,14 +5361,26 @@ // Third, instruction select all of the operations to machine code, adding the // code to the MachineBasicBlock. + if (TimePassesIsEnabled) + RegionTimer = new NamedRegionTimer("Instruction Selection"); InstructionSelect(DAG); + if (TimePassesIsEnabled) + delete RegionTimer; // Emit machine code to BB. This can change 'BB' to the last block being // inserted into. + if (TimePassesIsEnabled) + RegionTimer = new NamedRegionTimer("Instruction Scheduling"); ScheduleAndEmitDAG(DAG); + if (TimePassesIsEnabled) + delete RegionTimer; // Perform target specific isel post processing. + if (TimePassesIsEnabled) + RegionTimer = new NamedRegionTimer("Instruction Selection Post Processing"); InstructionSelectPostProcessing(DAG); + if (TimePassesIsEnabled) + delete RegionTimer; DOUT << "Selected machine code:\n"; DEBUG(BB->dump()); From gohman at apple.com Mon Jun 30 17:21:03 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 22:21:03 -0000 Subject: [llvm-commits] [llvm] r52931 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200806302221.m5UML3HQ012605@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 17:21:03 2008 New Revision: 52931 URL: http://llvm.org/viewvc/llvm-project?rev=52931&view=rev Log: Use a simpler but equivalent form of RecordSource. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52931&r1=52930&r2=52931&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jun 30 17:21:03 2008 @@ -3210,8 +3210,7 @@ assert(DD && "Not a debug information descriptor"); SubprogramDesc *Subprogram = cast(DD); const CompileUnitDesc *CompileUnit = Subprogram->getFile(); - unsigned SrcFile = MMI->RecordSource(CompileUnit->getDirectory(), - CompileUnit->getFileName()); + unsigned SrcFile = MMI->RecordSource(CompileUnit); // Record the source line but does create a label. It will be emitted // at asm emission time. MMI->RecordSourceLine(Subprogram->getLine(), 0, SrcFile); From gohman at apple.com Mon Jun 30 17:23:08 2008 From: gohman at apple.com (Dan Gohman) Date: Mon, 30 Jun 2008 22:23:08 -0000 Subject: [llvm-commits] [llvm] r52932 - /llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp Message-ID: <200806302223.m5UMN8fU012690@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 17:23:08 2008 New Revision: 52932 URL: http://llvm.org/viewvc/llvm-project?rev=52932&view=rev Log: Don't use ISD namespace opcodes for MachineInstrs. Modified: llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp Modified: llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp?rev=52932&r1=52931&r2=52932&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp Mon Jun 30 17:23:08 2008 @@ -444,7 +444,7 @@ if (hasDebugInfo) { // Mark effective beginning of when frame pointer becomes valid. FrameLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, TII.get(ISD::LABEL)).addImm(FrameLabelId).addImm(0); + BuildMI(MBB, MBBI, TII.get(SPU::LABEL)).addImm(FrameLabelId).addImm(0); } // Adjust stack pointer, spilling $lr -> 16($sp) and $sp -> -FrameSize($sp) @@ -504,7 +504,7 @@ // Mark effective beginning of when frame pointer is ready. unsigned ReadyLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, TII.get(ISD::LABEL)).addImm(ReadyLabelId).addImm(0); + BuildMI(MBB, MBBI, TII.get(SPU::LABEL)).addImm(ReadyLabelId).addImm(0); MachineLocation FPDst(SPU::R1); MachineLocation FPSrc(MachineLocation::VirtualFP); From dalej at apple.com Mon Jun 30 17:30:09 2008 From: dalej at apple.com (Dale Johannesen) Date: Mon, 30 Jun 2008 15:30:09 -0700 Subject: [llvm-commits] [llvm] r52921 - /llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp In-Reply-To: References: <200806302040.m5UKeGVN008714@zion.cs.uiuc.edu> Message-ID: On Jun 30, 2008, at 3:08 PMPDT, Evan Cheng wrote: > Hi Dale, > > This check doesn't jive with the comment: > > FFI->getObjectIndexEnd() != 0))) { > > When getObjectIndexEnd() is equal to zero, it means there are non > "non- > fixed" objects. It can still have fixed objects. Can you clarify what > it is you are checking? I may not have used the right terminology. The case that causes a problem on Darwin is the second one in X86RegisterInfo::getFrameIndexOffset, where needsStackRealignment() is true and FI>=-0. So abstractly what I want to check is that you can't get into that case. However, padding the stack is conservatively correct, so if it aligns some low-probability case it doesn't have to, that's ok. (The Linux test cases were looking for subtracts off the SP, but were actually interested in accesses to the stack, not allocation of it. It would have been OK to fix this by adjusting the testcases, but this is better.) On Darwin the only way needsStackRealignment gets turned on is if you allocate a stack object with alignment > 16 bytes, so this whole patch probably doesn't affect anything but test cases. > Thanks, > > Evan > > On Jun 30, 2008, at 1:40 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Mon Jun 30 15:40:16 2008 >> New Revision: 52921 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52921&view=rev >> Log: >> No need to align the stack if there are no stack >> objects. Fixes a couple of tests on Linux. >> >> >> Modified: >> llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp >> >> Modified: llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp?rev=52921&r1=52920&r2=52921&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp (original) >> +++ llvm/trunk/lib/CodeGen/PrologEpilogInserter.cpp Mon Jun 30 >> 15:40:16 2008 >> @@ -464,7 +464,8 @@ >> // works. >> if (!RegInfo->targetHandlesStackFrameRounding() && >> (FFI->hasCalls() || FFI->hasVarSizedObjects() || >> - RegInfo->needsStackRealignment(Fn))) { >> + (RegInfo->needsStackRealignment(Fn) && >> + FFI->getObjectIndexEnd() != 0))) { >> // If we have reserved argument space for call sites in the >> function >> // immediately on entry to the current function, count it as >> part of the >> // overall stack size. >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Mon Jun 30 17:33:16 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 30 Jun 2008 22:33:16 -0000 Subject: [llvm-commits] [llvm] r52933 - /llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Message-ID: <200806302233.m5UMXGIv013040@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 30 17:33:16 2008 New Revision: 52933 URL: http://llvm.org/viewvc/llvm-project?rev=52933&view=rev Log: Don't run stack slot coloring if -fast. Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=52933&r1=52932&r2=52933&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original) +++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Mon Jun 30 17:33:16 2008 @@ -99,7 +99,8 @@ PM.add(createRegisterAllocator()); // Perform stack slot coloring. - PM.add(createStackSlotColoringPass()); + if (!Fast) + PM.add(createStackSlotColoringPass()); if (PrintMachineCode) // Print the register-allocated code PM.add(createMachineFunctionPrinterPass(cerr)); @@ -235,7 +236,8 @@ PM.add(createRegisterAllocator()); // Perform stack slot coloring. - PM.add(createStackSlotColoringPass()); + if (!Fast) + PM.add(createStackSlotColoringPass()); if (PrintMachineCode) PM.add(createMachineFunctionPrinterPass(cerr)); From evan.cheng at apple.com Mon Jun 30 17:33:56 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 30 Jun 2008 22:33:56 -0000 Subject: [llvm-commits] [llvm] r52934 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Message-ID: <200806302233.m5UMXvMY013077@zion.cs.uiuc.edu> Author: evancheng Date: Mon Jun 30 17:33:56 2008 New Revision: 52934 URL: http://llvm.org/viewvc/llvm-project?rev=52934&view=rev Log: Suppress compiler warning. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=52934&r1=52933&r2=52934&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Mon Jun 30 17:33:56 2008 @@ -372,7 +372,7 @@ assert((VT == MVT::f32 || VT == MVT::f64) && "Unsupported setcc type!"); // Expand into one or more soft-fp libcall(s). - RTLIB::Libcall LC1, LC2 = RTLIB::UNKNOWN_LIBCALL; + RTLIB::Libcall LC1 = RTLIB::UNKNOWN_LIBCALL, LC2 = RTLIB::UNKNOWN_LIBCALL; switch (CCCode) { case ISD::SETEQ: case ISD::SETOEQ: From cfr at adobe.com Mon Jun 30 17:37:58 2008 From: cfr at adobe.com (Chuck Rose III) Date: Mon, 30 Jun 2008 22:37:58 -0000 Subject: [llvm-commits] [llvm] r52935 - in /llvm/trunk/win32: Analysis/Analysis.vcproj AsmParser/AsmParser.vcproj Support/Support.vcproj Target/Target.vcproj Transforms/Transforms.vcproj Message-ID: <200806302237.m5UMbwIo013229@zion.cs.uiuc.edu> Author: cfr Date: Mon Jun 30 17:37:57 2008 New Revision: 52935 URL: http://llvm.org/viewvc/llvm-project?rev=52935&view=rev Log: Adding some missing files to VStudio project files. Switching to use generated llvmAsmParser.cpp/.h Modified: llvm/trunk/win32/Analysis/Analysis.vcproj llvm/trunk/win32/AsmParser/AsmParser.vcproj llvm/trunk/win32/Support/Support.vcproj llvm/trunk/win32/Target/Target.vcproj llvm/trunk/win32/Transforms/Transforms.vcproj Modified: llvm/trunk/win32/Analysis/Analysis.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Analysis/Analysis.vcproj?rev=52935&r1=52934&r2=52935&view=diff ============================================================================== --- llvm/trunk/win32/Analysis/Analysis.vcproj (original) +++ llvm/trunk/win32/Analysis/Analysis.vcproj Mon Jun 30 17:37:57 2008 @@ -405,6 +405,10 @@ > + + Modified: llvm/trunk/win32/AsmParser/AsmParser.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/AsmParser/AsmParser.vcproj?rev=52935&r1=52934&r2=52935&view=diff ============================================================================== --- llvm/trunk/win32/AsmParser/AsmParser.vcproj (original) +++ llvm/trunk/win32/AsmParser/AsmParser.vcproj Mon Jun 30 17:37:57 2008 @@ -380,11 +380,11 @@ Name="Generated Files" > Modified: llvm/trunk/win32/Support/Support.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Support/Support.vcproj?rev=52935&r1=52934&r2=52935&view=diff ============================================================================== --- llvm/trunk/win32/Support/Support.vcproj (original) +++ llvm/trunk/win32/Support/Support.vcproj Mon Jun 30 17:37:57 2008 @@ -377,8 +377,14 @@ RelativePath="..\..\lib\Support\SlowOperationInformer.cpp" > + + + + + Modified: llvm/trunk/win32/Transforms/Transforms.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Transforms/Transforms.vcproj?rev=52935&r1=52934&r2=52935&view=diff ============================================================================== --- llvm/trunk/win32/Transforms/Transforms.vcproj (original) +++ llvm/trunk/win32/Transforms/Transforms.vcproj Mon Jun 30 17:37:57 2008 @@ -352,6 +352,10 @@ > + + @@ -555,10 +559,6 @@ - - Author: void Date: Mon Jun 30 18:30:39 2008 New Revision: 52936 URL: http://llvm.org/viewvc/llvm-project?rev=52936&view=rev Log: Bad tag. Removed: llvm/tags/Apple/llvmCore-2051/ From isanbard at gmail.com Mon Jun 30 18:30:58 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 30 Jun 2008 23:30:58 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52937 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2051/ Message-ID: <200806302330.m5UNUwe3014948@zion.cs.uiuc.edu> Author: void Date: Mon Jun 30 18:30:58 2008 New Revision: 52937 URL: http://llvm.org/viewvc/llvm-project?rev=52937&view=rev Log: Bad tag. Removed: llvm-gcc-4.2/tags/Apple/llvmgcc42-2051/ From isanbard at gmail.com Mon Jun 30 18:33:47 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 30 Jun 2008 23:33:47 -0000 Subject: [llvm-commits] [llvm] r52938 - /llvm/tags/Apple/llvmCore-2051/ Message-ID: <200806302333.m5UNXlu7015066@zion.cs.uiuc.edu> Author: void Date: Mon Jun 30 18:33:47 2008 New Revision: 52938 URL: http://llvm.org/viewvc/llvm-project?rev=52938&view=rev Log: Creating llvmCore-2051 branch Added: llvm/tags/Apple/llvmCore-2051/ - copied from r52937, llvm/trunk/ From isanbard at gmail.com Mon Jun 30 18:33:54 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 30 Jun 2008 23:33:54 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52939 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2051/ Message-ID: <200806302333.m5UNXsQd015078@zion.cs.uiuc.edu> Author: void Date: Mon Jun 30 18:33:54 2008 New Revision: 52939 URL: http://llvm.org/viewvc/llvm-project?rev=52939&view=rev Log: Creating llvmgcc42-2051 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2051/ - copied from r52938, llvm-gcc-4.2/trunk/ From isanbard at gmail.com Mon Jun 30 18:40:20 2008 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 30 Jun 2008 16:40:20 -0700 Subject: [llvm-commits] [llvm] r52916 - /llvm/trunk/include/llvm/Analysis/Dominators.h In-Reply-To: <200806302028.m5UKS2fI008114@zion.cs.uiuc.edu> References: <200806302028.m5UKS2fI008114@zion.cs.uiuc.edu> Message-ID: <20A8133B-FEC0-40A4-A8AA-B7282B916654@gmail.com> Hi Owen, --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) > +++ llvm/trunk/include/llvm/Analysis/Dominators.h Mon Jun 30 > 15:28:02 2008 > @@ -792,6 +792,10 @@ > DT->splitBlock(NewBB); > } > > + bool isReachableFromEntry(BasicBlock* A) { > + return DT->isReachableFromEntry(A); > + } > + Can this be constified? Also, there's some code in that header file like this: for (i = 0; i < PredBlocks.size(); ++i) This is wasteful. You can assign PredBlocks.size() to a variable if the size isn't changed in the loop. Thanks! -bw From kremenek at apple.com Mon Jun 30 19:02:05 2008 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 01 Jul 2008 00:02:05 -0000 Subject: [llvm-commits] [llvm] r52941 - /llvm/tags/checker/checker-50/ Message-ID: <200807010002.m61025YU015966@zion.cs.uiuc.edu> Author: kremenek Date: Mon Jun 30 19:02:05 2008 New Revision: 52941 URL: http://llvm.org/viewvc/llvm-project?rev=52941&view=rev Log: Tagging checker-50. Added: llvm/tags/checker/checker-50/ - copied from r52940, llvm/trunk/ From gohman at apple.com Mon Jun 30 19:05:17 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 01 Jul 2008 00:05:17 -0000 Subject: [llvm-commits] [llvm] r52943 - in /llvm/trunk: include/llvm/CodeGen/ include/llvm/Target/ lib/CodeGen/ lib/CodeGen/SelectionDAG/ lib/ExecutionEngine/JIT/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PIC16/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ utils/TableGen/ Message-ID: <200807010005.m6105InB016111@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 19:05:16 2008 New Revision: 52943 URL: http://llvm.org/viewvc/llvm-project?rev=52943&view=rev Log: Split ISD::LABEL into ISD::DBG_LABEL and ISD::EH_LABEL, eliminating the need for a flavor operand, and add a new SDNode subclass, LabelSDNode, for use with them to eliminate the need for a label id operand. Change instruction selection to let these label nodes through unmodified instead of creating copies of them. Teach the MachineInstr emitter how to emit a MachineInstr directly from an ISD label node. This avoids the need for allocating SDNodes for the label id and flavor value, as well as SDNodes for each of the post-isel label, label id, and label flavor. Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h llvm/trunk/include/llvm/Target/TargetInstrInfo.h llvm/trunk/lib/CodeGen/BranchFolding.cpp llvm/trunk/lib/CodeGen/Collector.cpp llvm/trunk/lib/CodeGen/DwarfWriter.cpp llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/Target.td llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp llvm/trunk/utils/TableGen/CodeEmitterGen.cpp llvm/trunk/utils/TableGen/CodeGenTarget.cpp llvm/trunk/utils/TableGen/DAGISelEmitter.cpp llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Mon Jun 30 19:05:16 2008 @@ -136,6 +136,10 @@ delete removeFromParent(); } + /// isLabel - Returns true if the MachineInstr represents a label. + /// + bool isLabel() const; + /// isDebugLabel - Returns true if the MachineInstr represents a debug label. /// bool isDebugLabel() const; Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Mon Jun 30 19:05:16 2008 @@ -225,6 +225,7 @@ SDOperand getRegister(unsigned Reg, MVT VT); SDOperand getDbgStopPoint(SDOperand Root, unsigned Line, unsigned Col, const CompileUnitDesc *CU); + SDOperand getLabel(unsigned Opcode, SDOperand Root, unsigned LabelID); SDOperand getCopyToReg(SDOperand Chain, unsigned Reg, SDOperand N) { return getNode(ISD::CopyToReg, MVT::Other, Chain, Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Mon Jun 30 19:05:16 2008 @@ -482,14 +482,11 @@ // Operand #last: Optional, an incoming flag. INLINEASM, - // LABEL - Represents a label in mid basic block used to track - // locations needed for debug and exception handling tables. This node - // returns a chain. - // Operand #0 : input chain. - // Operand #1 : module unique number use to identify the label. - // Operand #2 : 0 indicates a debug label (e.g. stoppoint), 1 indicates - // a EH label, 2 indicates unknown label type. - LABEL, + // DBG_LABEL, EH_LABEL - Represents a label in mid basic block used to track + // locations needed for debug and exception handling tables. These nodes + // take a chain as input and return a chain. + DBG_LABEL, + EH_LABEL, // DECLARE - Represents a llvm.dbg.declare intrinsic. It's used to track // local variable declarations for debugging information. First operand is @@ -642,8 +639,7 @@ bool isScalarToVector(const SDNode *N); /// isDebugLabel - Return true if the specified node represents a debug - /// label (i.e. ISD::LABEL or TargetInstrInfo::LABEL node and third operand - /// is 0). + /// label (i.e. ISD::DBG_LABEL or TargetInstrInfo::DBG_LABEL node). bool isDebugLabel(const SDNode *N); //===--------------------------------------------------------------------===// @@ -1859,7 +1855,6 @@ InitOperands(&Chain, 1); } public: - unsigned getLine() const { return Line; } unsigned getColumn() const { return Column; } const CompileUnitDesc *getCompileUnit() const { return CU; } @@ -1870,6 +1865,27 @@ } }; +class LabelSDNode : public SDNode { + SDUse Chain; + unsigned LabelID; + virtual void ANCHOR(); // Out-of-line virtual method to give class a home. +protected: + friend class SelectionDAG; + LabelSDNode(unsigned NodeTy, SDOperand ch, unsigned id) + : SDNode(NodeTy, getSDVTList(MVT::Other)), LabelID(id) { + Chain = ch; + InitOperands(&Chain, 1); + } +public: + unsigned getLabelID() const { return LabelID; } + + static bool classof(const LabelSDNode *) { return true; } + static bool classof(const SDNode *N) { + return N->getOpcode() == ISD::DBG_LABEL || + N->getOpcode() == ISD::EH_LABEL; + } +}; + class ExternalSymbolSDNode : public SDNode { const char *Symbol; virtual void ANCHOR(); // Out-of-line virtual method to give class a home. Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Mon Jun 30 19:05:16 2008 @@ -46,12 +46,14 @@ enum { PHI = 0, INLINEASM = 1, - LABEL = 2, - DECLARE = 3, - EXTRACT_SUBREG = 4, - INSERT_SUBREG = 5, - IMPLICIT_DEF = 6, - SUBREG_TO_REG = 7 + DBG_LABEL = 2, + EH_LABEL = 3, + GC_LABEL = 4, + DECLARE = 5, + EXTRACT_SUBREG = 6, + INSERT_SUBREG = 7, + IMPLICIT_DEF = 8, + SUBREG_TO_REG = 9 }; unsigned getNumOpcodes() const { return NumOpcodes; } Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original) +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Mon Jun 30 19:05:16 2008 @@ -114,12 +114,12 @@ while (!MBB->succ_empty()) MBB->removeSuccessor(MBB->succ_end()-1); - // If there is DWARF info to active, check to see if there are any LABEL + // If there is DWARF info to active, check to see if there are any DBG_LABEL // records in the basic block. If so, unregister them from MachineModuleInfo. if (MMI && !MBB->empty()) { for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E; ++I) { - if ((unsigned)I->getOpcode() == TargetInstrInfo::LABEL) { + if ((unsigned)I->getOpcode() == TargetInstrInfo::DBG_LABEL) { // The label ID # is always operand #0, an immediate. MMI->InvalidateLabel(I->getOperand(0).getImm()); } Modified: llvm/trunk/lib/CodeGen/Collector.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Collector.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/Collector.cpp (original) +++ llvm/trunk/lib/CodeGen/Collector.cpp Mon Jun 30 19:05:16 2008 @@ -337,7 +337,7 @@ unsigned MachineCodeAnalysis::InsertLabel(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const { unsigned Label = MMI->NextLabelID(); - BuildMI(MBB, MI, TII->get(TargetInstrInfo::LABEL)).addImm(Label).addImm(2); + BuildMI(MBB, MI, TII->get(TargetInstrInfo::GC_LABEL)).addImm(Label); return Label; } Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Mon Jun 30 19:05:16 2008 @@ -3260,7 +3260,7 @@ I != E; ++I) { for (MachineBasicBlock::const_iterator MI = I->begin(), E = I->end(); MI != E; ++MI) { - if (MI->getOpcode() != TargetInstrInfo::LABEL) { + if (!MI->isLabel()) { SawPotentiallyThrowing |= MI->getDesc().isCall(); continue; } Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Mon Jun 30 19:05:16 2008 @@ -523,10 +523,18 @@ } +/// isLabel - Returns true if the MachineInstr represents a label. +/// +bool MachineInstr::isLabel() const { + return getOpcode() == TargetInstrInfo::DBG_LABEL || + getOpcode() == TargetInstrInfo::EH_LABEL || + getOpcode() == TargetInstrInfo::GC_LABEL; +} + /// isDebugLabel - Returns true if the MachineInstr represents a debug label. /// bool MachineInstr::isDebugLabel() const { - return getOpcode() == TargetInstrInfo::LABEL && getOperand(1).getImm() == 0; + return getOpcode() == TargetInstrInfo::DBG_LABEL; } /// findRegisterUseOperandIdx() - Returns the MachineOperand that is a use of Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Jun 30 19:05:16 2008 @@ -1084,28 +1084,26 @@ case TargetLowering::Expand: { MachineModuleInfo *MMI = DAG.getMachineModuleInfo(); bool useDEBUG_LOC = TLI.isOperationLegal(ISD::DEBUG_LOC, MVT::Other); - bool useLABEL = TLI.isOperationLegal(ISD::LABEL, MVT::Other); + bool useLABEL = TLI.isOperationLegal(ISD::DBG_LABEL, MVT::Other); const DbgStopPointSDNode *DSP = cast(Node); if (MMI && (useDEBUG_LOC || useLABEL)) { const CompileUnitDesc *CompileUnit = DSP->getCompileUnit(); unsigned SrcFile = MMI->RecordSource(CompileUnit); - SmallVector Ops; - Ops.push_back(Tmp1); // chain unsigned Line = DSP->getLine(); unsigned Col = DSP->getColumn(); if (useDEBUG_LOC) { + SmallVector Ops; + Ops.push_back(Tmp1); // chain Ops.push_back(DAG.getConstant(Line, MVT::i32)); // line # Ops.push_back(DAG.getConstant(Col, MVT::i32)); // col # Ops.push_back(DAG.getConstant(SrcFile, MVT::i32)); // source file id Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, &Ops[0], Ops.size()); } else { unsigned ID = MMI->RecordSourceLine(Line, Col, SrcFile); - Ops.push_back(DAG.getConstant(ID, MVT::i32)); - Ops.push_back(DAG.getConstant(0, MVT::i32)); // a debug label - Result = DAG.getNode(ISD::LABEL, MVT::Other, &Ops[0], Ops.size()); + Result = DAG.getLabel(ISD::DBG_LABEL, Tmp1, ID); } } else { Result = Tmp1; // chain @@ -1163,15 +1161,14 @@ } break; - case ISD::LABEL: - assert(Node->getNumOperands() == 3 && "Invalid LABEL node!"); - switch (TLI.getOperationAction(ISD::LABEL, MVT::Other)) { + case ISD::DBG_LABEL: + case ISD::EH_LABEL: + assert(Node->getNumOperands() == 1 && "Invalid LABEL node!"); + switch (TLI.getOperationAction(Node->getOpcode(), MVT::Other)) { default: assert(0 && "This action is not supported yet!"); case TargetLowering::Legal: Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. - Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the label id. - Tmp3 = LegalizeOp(Node->getOperand(2)); // Legalize the "flavor" operand. - Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Tmp3); + Result = DAG.UpdateNodeOperands(Result, Tmp1); break; case TargetLowering::Expand: Result = LegalizeOp(Node->getOperand(0)); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Mon Jun 30 19:05:16 2008 @@ -879,10 +879,17 @@ assert(0 && "EntryToken should have been excluded from the schedule!"); break; case ISD::TokenFactor: // fall thru - case ISD::LABEL: case ISD::DECLARE: case ISD::SRCVALUE: break; + case ISD::DBG_LABEL: + BB->push_back(BuildMI(TII->get(TargetInstrInfo::DBG_LABEL)) + .addImm(cast(Node)->getLabelID())); + break; + case ISD::EH_LABEL: + BB->push_back(BuildMI(TII->get(TargetInstrInfo::EH_LABEL)) + .addImm(cast(Node)->getLabelID())); + break; case ISD::CopyToReg: { unsigned SrcReg; SDOperand SrcVal = Node->getOperand(2); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Jun 30 19:05:16 2008 @@ -192,19 +192,15 @@ /// isDebugLabel - Return true if the specified node represents a debug -/// label (i.e. ISD::LABEL or TargetInstrInfo::LABEL node and third operand -/// is 0). +/// label (i.e. ISD::DBG_LABEL or TargetInstrInfo::DBG_LABEL node). bool ISD::isDebugLabel(const SDNode *N) { SDOperand Zero; - if (N->getOpcode() == ISD::LABEL) - Zero = N->getOperand(2); - else if (N->isTargetOpcode() && - N->getTargetOpcode() == TargetInstrInfo::LABEL) - // Chain moved to last operand. - Zero = N->getOperand(1); - else - return false; - return isa(Zero) && cast(Zero)->isNullValue(); + if (N->getOpcode() == ISD::DBG_LABEL) + return true; + if (N->isTargetOpcode() && + N->getTargetOpcode() == TargetInstrInfo::DBG_LABEL) + return true; + return false; } /// getSetCCSwappedOperands - Return the operation corresponding to (Y op X) @@ -389,6 +385,10 @@ ID.AddPointer(DSP->getCompileUnit()); break; } + case ISD::DBG_LABEL: + case ISD::EH_LABEL: + ID.AddInteger(cast(N)->getLabelID()); + break; case ISD::SRCVALUE: ID.AddPointer(cast(N)->getValue()); break; @@ -1018,6 +1018,22 @@ return SDOperand(N, 0); } +SDOperand SelectionDAG::getLabel(unsigned Opcode, + SDOperand Root, + unsigned LabelID) { + FoldingSetNodeID ID; + SDOperand Ops[] = { Root }; + AddNodeIDNode(ID, Opcode, getVTList(MVT::Other), &Ops[0], 1); + ID.AddInteger(LabelID); + void *IP = 0; + if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) + return SDOperand(E, 0); + SDNode *N = new LabelSDNode(Opcode, Root, LabelID); + CSEMap.InsertNode(N, IP); + AllNodes.push_back(N); + return SDOperand(N, 0); +} + SDOperand SelectionDAG::getSrcValue(const Value *V) { assert((!V || isa(V->getType())) && "SrcValue is not a pointer?"); @@ -4202,6 +4218,7 @@ void MemOperandSDNode::ANCHOR() {} void RegisterSDNode::ANCHOR() {} void DbgStopPointSDNode::ANCHOR() {} +void LabelSDNode::ANCHOR() {} void ExternalSymbolSDNode::ANCHOR() {} void CondCodeSDNode::ANCHOR() {} void ARG_FLAGSSDNode::ANCHOR() {} @@ -4521,7 +4538,8 @@ case ISD::UNDEF: return "undef"; case ISD::MERGE_VALUES: return "merge_values"; case ISD::INLINEASM: return "inlineasm"; - case ISD::LABEL: return "label"; + case ISD::DBG_LABEL: return "dbg_label"; + case ISD::EH_LABEL: return "eh_label"; case ISD::DECLARE: return "declare"; case ISD::HANDLENODE: return "handlenode"; case ISD::FORMAL_ARGUMENTS: return "formal_arguments"; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Jun 30 19:05:16 2008 @@ -3179,9 +3179,7 @@ DbgRegionStartInst &RSI = cast(I); if (MMI && RSI.getContext() && MMI->Verify(RSI.getContext())) { unsigned LabelID = MMI->RecordRegionStart(RSI.getContext()); - DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(), - DAG.getConstant(LabelID, MVT::i32), - DAG.getConstant(0, MVT::i32))); + DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getRoot(), LabelID)); } return 0; @@ -3191,9 +3189,7 @@ DbgRegionEndInst &REI = cast(I); if (MMI && REI.getContext() && MMI->Verify(REI.getContext())) { unsigned LabelID = MMI->RecordRegionEnd(REI.getContext()); - DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(), - DAG.getConstant(LabelID, MVT::i32), - DAG.getConstant(0, MVT::i32))); + DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getRoot(), LabelID)); } return 0; @@ -3576,9 +3572,7 @@ // Both PendingLoads and PendingExports must be flushed here; // this call might not return. (void)getRoot(); - DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getControlRoot(), - DAG.getConstant(BeginLabel, MVT::i32), - DAG.getConstant(1, MVT::i32))); + DAG.setRoot(DAG.getLabel(ISD::EH_LABEL, getControlRoot(), BeginLabel)); } std::pair Result = @@ -3595,9 +3589,7 @@ // Insert a label at the end of the invoke call to mark the try range. This // can be used to detect deletion of the invoke via the MachineModuleInfo. EndLabel = MMI->NextLabelID(); - DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, getRoot(), - DAG.getConstant(EndLabel, MVT::i32), - DAG.getConstant(1, MVT::i32))); + DAG.setRoot(DAG.getLabel(ISD::EH_LABEL, getRoot(), EndLabel)); // Inform MachineModuleInfo of range. MMI->addInvoke(LandingPad, BeginLabel, EndLabel); @@ -5112,9 +5104,7 @@ // Add a label to mark the beginning of the landing pad. Deletion of the // landing pad can thus be detected via the MachineModuleInfo. unsigned LabelID = MMI->addLandingPad(BB); - DAG.setRoot(DAG.getNode(ISD::LABEL, MVT::Other, DAG.getEntryNode(), - DAG.getConstant(LabelID, MVT::i32), - DAG.getConstant(1, MVT::i32))); + DAG.setRoot(DAG.getLabel(ISD::EH_LABEL, DAG.getEntryNode(), LabelID)); // Mark exception register as live in. unsigned Reg = TLI.getExceptionAddressRegister(); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Mon Jun 30 19:05:16 2008 @@ -144,6 +144,8 @@ Op += ":" + utostr(D->getLine()); if (D->getColumn() != 0) Op += ":" + utostr(D->getColumn()); + } else if (const LabelSDNode *L = dyn_cast(Node)) { + Op += ": LabelID=" + utostr(L->getLabelID()); } else if (const ExternalSymbolSDNode *ES = dyn_cast(Node)) { Op += "'" + std::string(ES->getSymbol()) + "'"; Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp Mon Jun 30 19:05:16 2008 @@ -325,7 +325,7 @@ I != E; ++I) { for (MachineBasicBlock::const_iterator MI = I->begin(), E = I->end(); MI != E; ++MI) { - if (MI->getOpcode() != TargetInstrInfo::LABEL) { + if (!MI->isLabel()) { MayThrow |= MI->getDesc().isCall(); continue; } @@ -940,7 +940,7 @@ I != E; ++I) { for (MachineBasicBlock::const_iterator MI = I->begin(), E = I->end(); MI != E; ++MI) { - if (MI->getOpcode() != TargetInstrInfo::LABEL) { + if (!MI->isLabel()) { MayThrow |= MI->getDesc().isCall(); continue; } Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Mon Jun 30 19:05:16 2008 @@ -891,7 +891,7 @@ // If this machine instr is an inline asm, measure it. if (MI->getOpcode() == ARM::INLINEASM) return TAI->getInlineAsmLength(MI->getOperand(0).getSymbolName()); - if (MI->getOpcode() == ARM::LABEL) + if (MI->isLabel()) return 0; if (MI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) return 0; Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Mon Jun 30 19:05:16 2008 @@ -106,7 +106,8 @@ // We don't have line number support yet. setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); - setOperationAction(ISD::LABEL, MVT::Other, Expand); + setOperationAction(ISD::DBG_LABEL, MVT::Other, Expand); + setOperationAction(ISD::EH_LABEL, MVT::Other, Expand); // Not implemented yet. setOperationAction(ISD::STACKSAVE, MVT::Other, Expand); Modified: llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPURegisterInfo.cpp Mon Jun 30 19:05:16 2008 @@ -444,7 +444,7 @@ if (hasDebugInfo) { // Mark effective beginning of when frame pointer becomes valid. FrameLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, TII.get(SPU::LABEL)).addImm(FrameLabelId).addImm(0); + BuildMI(MBB, MBBI, TII.get(SPU::DBG_LABEL)).addImm(FrameLabelId); } // Adjust stack pointer, spilling $lr -> 16($sp) and $sp -> -FrameSize($sp) @@ -504,7 +504,7 @@ // Mark effective beginning of when frame pointer is ready. unsigned ReadyLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, TII.get(SPU::LABEL)).addImm(ReadyLabelId).addImm(0); + BuildMI(MBB, MBBI, TII.get(SPU::DBG_LABEL)).addImm(ReadyLabelId); MachineLocation FPDst(SPU::R1); MachineLocation FPSrc(MachineLocation::VirtualFP); @@ -518,7 +518,7 @@ MachineBasicBlock::iterator MBBI = prior(MBB.end()); // Insert terminator label unsigned BranchLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, TII.get(SPU::LABEL)).addImm(BranchLabelId).addImm(0); + BuildMI(MBB, MBBI, TII.get(SPU::DBG_LABEL)).addImm(BranchLabelId); } } } Modified: llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/IA64/IA64ISelLowering.cpp Mon Jun 30 19:05:16 2008 @@ -89,7 +89,8 @@ // We don't have line number support yet. setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); - setOperationAction(ISD::LABEL, MVT::Other, Expand); + setOperationAction(ISD::DBG_LABEL, MVT::Other, Expand); + setOperationAction(ISD::EH_LABEL, MVT::Other, Expand); // IA64 has ctlz in the form of the 'fnorm' instruction. The Legalizer // expansion for ctlz/cttz in terms of ctpop is much larger, but lower Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Mon Jun 30 19:05:16 2008 @@ -97,7 +97,8 @@ // We don't have line number support yet. setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); - setOperationAction(ISD::LABEL, MVT::Other, Expand); + setOperationAction(ISD::DBG_LABEL, MVT::Other, Expand); + setOperationAction(ISD::EH_LABEL, MVT::Other, Expand); // Use the default for now setOperationAction(ISD::STACKSAVE, MVT::Other, Expand); Modified: llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PIC16/PIC16ISelLowering.cpp Mon Jun 30 19:05:16 2008 @@ -135,7 +135,8 @@ // We don't have line number support yet. setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); - setOperationAction(ISD::LABEL, MVT::Other, Expand); + setOperationAction(ISD::DBG_LABEL, MVT::Other, Expand); + setOperationAction(ISD::EH_LABEL, MVT::Other, Expand); // Use the default for now. setOperationAction(ISD::STACKSAVE, MVT::Other, Expand); Modified: llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCCodeEmitter.cpp Mon Jun 30 19:05:16 2008 @@ -105,7 +105,8 @@ default: MCE.emitWordBE(getBinaryCodeForInstr(*I)); break; - case TargetInstrInfo::LABEL: + case TargetInstrInfo::DBG_LABEL: + case TargetInstrInfo::EH_LABEL: MCE.emitLabel(MI.getOperand(0).getImm()); break; case TargetInstrInfo::IMPLICIT_DEF: Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp Mon Jun 30 19:05:16 2008 @@ -754,9 +754,10 @@ const char *AsmStr = MI->getOperand(0).getSymbolName(); return MF->getTarget().getTargetAsmInfo()->getInlineAsmLength(AsmStr); } - case PPC::LABEL: { + case PPC::DBG_LABEL: + case PPC::EH_LABEL: + case PPC::GC_LABEL: return 0; - } default: return 4; // PowerPC instructions are all 4 bytes } Modified: llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCRegisterInfo.cpp Mon Jun 30 19:05:16 2008 @@ -1068,7 +1068,7 @@ if (needsFrameMoves) { // Mark effective beginning of when frame pointer becomes valid. FrameLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, TII.get(PPC::LABEL)).addImm(FrameLabelId).addImm(0); + BuildMI(MBB, MBBI, TII.get(PPC::DBG_LABEL)).addImm(FrameLabelId); } // Adjust stack pointer: r1 += NegFrameSize. @@ -1177,7 +1177,7 @@ // Mark effective beginning of when frame pointer is ready. unsigned ReadyLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, TII.get(PPC::LABEL)).addImm(ReadyLabelId).addImm(0); + BuildMI(MBB, MBBI, TII.get(PPC::DBG_LABEL)).addImm(ReadyLabelId); MachineLocation FPDst(HasFP ? (IsPPC64 ? PPC::X31 : PPC::R31) : (IsPPC64 ? PPC::X1 : PPC::R1)); Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Mon Jun 30 19:05:16 2008 @@ -597,7 +597,8 @@ // We don't have line number support yet. setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand); - setOperationAction(ISD::LABEL, MVT::Other, Expand); + setOperationAction(ISD::DBG_LABEL, MVT::Other, Expand); + setOperationAction(ISD::EH_LABEL, MVT::Other, Expand); // RET must be custom lowered, to meet ABI requirements setOperationAction(ISD::RET , MVT::Other, Custom); @@ -616,7 +617,8 @@ // No debug info support yet. setOperationAction(ISD::DBG_STOPPOINT, MVT::Other, Expand); - setOperationAction(ISD::LABEL, MVT::Other, Expand); + setOperationAction(ISD::DBG_LABEL, MVT::Other, Expand); + setOperationAction(ISD::EH_LABEL, MVT::Other, Expand); setOperationAction(ISD::DECLARE, MVT::Other, Expand); setStackPointerRegisterToSaveRestore(SP::O6); Modified: llvm/trunk/lib/Target/Target.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Target.td?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/Target.td (original) +++ llvm/trunk/lib/Target/Target.td Mon Jun 30 19:05:16 2008 @@ -342,9 +342,23 @@ let AsmString = ""; let Namespace = "TargetInstrInfo"; } -def LABEL : Instruction { +def DBG_LABEL : Instruction { let OutOperandList = (ops); - let InOperandList = (ops i32imm:$id, i32imm:$flavor); + let InOperandList = (ops i32imm:$id); + let AsmString = ""; + let Namespace = "TargetInstrInfo"; + let hasCtrlDep = 1; +} +def EH_LABEL : Instruction { + let OutOperandList = (ops); + let InOperandList = (ops i32imm:$id); + let AsmString = ""; + let Namespace = "TargetInstrInfo"; + let hasCtrlDep = 1; +} +def GC_LABEL : Instruction { + let OutOperandList = (ops); + let InOperandList = (ops i32imm:$id); let AsmString = ""; let Namespace = "TargetInstrInfo"; let hasCtrlDep = 1; Modified: llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ATTAsmPrinter.cpp Mon Jun 30 19:05:16 2008 @@ -272,7 +272,7 @@ for (MachineBasicBlock::const_iterator II = I->begin(), IE = I->end(); II != IE; ++II) { // Print the assembly for the instruction. - if (II->getOpcode() != X86::LABEL) + if (!II->isLabel()) hasAnyRealCode = true; printMachineInstruction(II); } Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original) +++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Mon Jun 30 19:05:16 2008 @@ -490,7 +490,8 @@ case TargetInstrInfo::INLINEASM: assert(0 && "JIT does not support inline asm!\n"); break; - case TargetInstrInfo::LABEL: + case TargetInstrInfo::DBG_LABEL: + case TargetInstrInfo::EH_LABEL: MCE.emitLabel(MI.getOperand(0).getImm()); break; case TargetInstrInfo::IMPLICIT_DEF: Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Jun 30 19:05:16 2008 @@ -303,8 +303,10 @@ // FIXME - use subtarget debug flags if (!Subtarget->isTargetDarwin() && !Subtarget->isTargetELF() && - !Subtarget->isTargetCygMing()) - setOperationAction(ISD::LABEL, MVT::Other, Expand); + !Subtarget->isTargetCygMing()) { + setOperationAction(ISD::DBG_LABEL, MVT::Other, Expand); + setOperationAction(ISD::EH_LABEL, MVT::Other, Expand); + } setOperationAction(ISD::EXCEPTIONADDR, MVT::i64, Expand); setOperationAction(ISD::EHSELECTION, MVT::i64, Expand); Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Mon Jun 30 19:05:16 2008 @@ -2681,7 +2681,8 @@ FinalSize += AI->getInlineAsmLength(AsmStr); break; } - case TargetInstrInfo::LABEL: + case TargetInstrInfo::DBG_LABEL: + case TargetInstrInfo::EH_LABEL: break; case TargetInstrInfo::IMPLICIT_DEF: case TargetInstrInfo::DECLARE: Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Mon Jun 30 19:05:16 2008 @@ -691,7 +691,7 @@ if (needsFrameMoves) { // Mark effective beginning of when frame pointer becomes valid. FrameLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(FrameLabelId).addImm(0); + BuildMI(MBB, MBBI, TII.get(X86::DBG_LABEL)).addImm(FrameLabelId); } // Update EBP with the new base value... @@ -710,7 +710,7 @@ if (needsFrameMoves) { // Mark effective beginning of when frame pointer is ready. ReadyLabelId = MMI->NextLabelID(); - BuildMI(MBB, MBBI, TII.get(X86::LABEL)).addImm(ReadyLabelId).addImm(0); + BuildMI(MBB, MBBI, TII.get(X86::DBG_LABEL)).addImm(ReadyLabelId); } // Skip the callee-saved push instructions. Modified: llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/AsmWriterEmitter.cpp Mon Jun 30 19:05:16 2008 @@ -363,7 +363,7 @@ for (unsigned i = 0, e = NumberedInstructions.size(); i != e; ++i) { const AsmWriterInst *Inst = getAsmWriterInstByID(i); - if (Inst == 0) continue; // PHI, INLINEASM, LABEL, etc. + if (Inst == 0) continue; // PHI, INLINEASM, DBG_LABEL, etc. std::string Command; if (Inst->Operands.empty()) @@ -641,7 +641,7 @@ << " O << \"\\t\";\n" << " printInlineAsm(MI);\n" << " return true;\n" - << " } else if (MI->getOpcode() == TargetInstrInfo::LABEL) {\n" + << " } else if (MI->isLabel()) {\n" << " printLabel(MI);\n" << " return true;\n" << " } else if (MI->getOpcode() == TargetInstrInfo::DECLARE) {\n" Modified: llvm/trunk/utils/TableGen/CodeEmitterGen.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeEmitterGen.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeEmitterGen.cpp (original) +++ llvm/trunk/utils/TableGen/CodeEmitterGen.cpp Mon Jun 30 19:05:16 2008 @@ -26,7 +26,9 @@ Record *R = *I; if (R->getName() == "PHI" || R->getName() == "INLINEASM" || - R->getName() == "LABEL" || + R->getName() == "DBG_LABEL" || + R->getName() == "EH_LABEL" || + R->getName() == "GC_LABEL" || R->getName() == "DECLARE" || R->getName() == "EXTRACT_SUBREG" || R->getName() == "INSERT_SUBREG" || @@ -102,7 +104,9 @@ if (R->getName() == "PHI" || R->getName() == "INLINEASM" || - R->getName() == "LABEL" || + R->getName() == "DBG_LABEL" || + R->getName() == "EH_LABEL" || + R->getName() == "GC_LABEL" || R->getName() == "DECLARE" || R->getName() == "EXTRACT_SUBREG" || R->getName() == "INSERT_SUBREG" || @@ -137,7 +141,9 @@ if (InstName == "PHI" || InstName == "INLINEASM" || - InstName == "LABEL"|| + InstName == "DBG_LABEL"|| + InstName == "EH_LABEL"|| + InstName == "GC_LABEL"|| InstName == "DECLARE"|| InstName == "EXTRACT_SUBREG" || InstName == "INSERT_SUBREG" || Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Mon Jun 30 19:05:16 2008 @@ -286,9 +286,17 @@ if (I == Instructions.end()) throw "Could not find 'INLINEASM' instruction!"; const CodeGenInstruction *INLINEASM = &I->second; - I = getInstructions().find("LABEL"); - if (I == Instructions.end()) throw "Could not find 'LABEL' instruction!"; - const CodeGenInstruction *LABEL = &I->second; + I = getInstructions().find("DBG_LABEL"); + if (I == Instructions.end()) throw "Could not find 'DBG_LABEL' instruction!"; + const CodeGenInstruction *DBG_LABEL = &I->second; + + I = getInstructions().find("EH_LABEL"); + if (I == Instructions.end()) throw "Could not find 'EH_LABEL' instruction!"; + const CodeGenInstruction *EH_LABEL = &I->second; + + I = getInstructions().find("GC_LABEL"); + if (I == Instructions.end()) throw "Could not find 'GC_LABEL' instruction!"; + const CodeGenInstruction *GC_LABEL = &I->second; I = getInstructions().find("DECLARE"); if (I == Instructions.end()) throw "Could not find 'DECLARE' instruction!"; @@ -317,7 +325,9 @@ // Print out the rest of the instructions now. NumberedInstructions.push_back(PHI); NumberedInstructions.push_back(INLINEASM); - NumberedInstructions.push_back(LABEL); + NumberedInstructions.push_back(DBG_LABEL); + NumberedInstructions.push_back(EH_LABEL); + NumberedInstructions.push_back(GC_LABEL); NumberedInstructions.push_back(DECLARE); NumberedInstructions.push_back(EXTRACT_SUBREG); NumberedInstructions.push_back(INSERT_SUBREG); @@ -326,7 +336,9 @@ for (inst_iterator II = inst_begin(), E = inst_end(); II != E; ++II) if (&II->second != PHI && &II->second != INLINEASM && - &II->second != LABEL && + &II->second != DBG_LABEL && + &II->second != EH_LABEL && + &II->second != GC_LABEL && &II->second != DECLARE && &II->second != EXTRACT_SUBREG && &II->second != INSERT_SUBREG && Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Mon Jun 30 19:05:16 2008 @@ -1864,20 +1864,6 @@ << " N.getValueType());\n" << "}\n\n"; - OS << "SDNode *Select_LABEL(const SDOperand &N) {\n" - << " SDOperand Chain = N.getOperand(0);\n" - << " SDOperand N1 = N.getOperand(1);\n" - << " SDOperand N2 = N.getOperand(2);\n" - << " unsigned C1 = cast(N1)->getValue();\n" - << " unsigned C2 = cast(N2)->getValue();\n" - << " SDOperand Tmp1 = CurDAG->getTargetConstant(C1, MVT::i32);\n" - << " SDOperand Tmp2 = CurDAG->getTargetConstant(C2, MVT::i32);\n" - << " AddToISelQueue(Chain);\n" - << " SDOperand Ops[] = { Tmp1, Tmp2, Chain };\n" - << " return CurDAG->getTargetNode(TargetInstrInfo::LABEL,\n" - << " MVT::Other, Ops, 3);\n" - << "}\n\n"; - OS << "SDNode *Select_DECLARE(const SDOperand &N) {\n" << " SDOperand Chain = N.getOperand(0);\n" << " SDOperand N1 = N.getOperand(1);\n" @@ -1956,12 +1942,13 @@ << " case ISD::TokenFactor:\n" << " case ISD::CopyFromReg:\n" << " case ISD::CopyToReg: {\n" + << " case ISD::DBG_LABEL:\n" + << " case ISD::EH_LABEL:\n" << " for (unsigned i = 0, e = N.getNumOperands(); i != e; ++i)\n" << " AddToISelQueue(N.getOperand(i));\n" << " return NULL;\n" << " }\n" << " case ISD::INLINEASM: return Select_INLINEASM(N);\n" - << " case ISD::LABEL: return Select_LABEL(N);\n" << " case ISD::DECLARE: return Select_DECLARE(N);\n" << " case ISD::EXTRACT_SUBREG: return Select_EXTRACT_SUBREG(N);\n" << " case ISD::INSERT_SUBREG: return Select_INSERT_SUBREG(N);\n" Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=52943&r1=52942&r2=52943&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Mon Jun 30 19:05:16 2008 @@ -279,7 +279,9 @@ // This isn't an error if this is a builtin instruction. if (R->getName() != "PHI" && R->getName() != "INLINEASM" && - R->getName() != "LABEL" && + R->getName() != "DBG_LABEL" && + R->getName() != "EH_LABEL" && + R->getName() != "GC_LABEL" && R->getName() != "DECLARE" && R->getName() != "EXTRACT_SUBREG" && R->getName() != "INSERT_SUBREG" && From gohman at apple.com Mon Jun 30 19:16:26 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 01 Jul 2008 00:16:26 -0000 Subject: [llvm-commits] [llvm] r52944 - /llvm/trunk/lib/CodeGen/AsmPrinter.cpp Message-ID: <200807010016.m610GQAR016480@zion.cs.uiuc.edu> Author: djg Date: Mon Jun 30 19:16:26 2008 New Revision: 52944 URL: http://llvm.org/viewvc/llvm-project?rev=52944&view=rev Log: Minimize duplicated code in AsmPrinter::printLabel. Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=52944&r1=52943&r2=52944&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Mon Jun 30 19:16:26 2008 @@ -1318,8 +1318,7 @@ /// printLabel - This method prints a local label used by debug and /// exception handling tables. void AsmPrinter::printLabel(const MachineInstr *MI) const { - O << TAI->getPrivateGlobalPrefix() - << "label" << MI->getOperand(0).getImm() << ":\n"; + printLabel(MI->getOperand(0).getImm()); } void AsmPrinter::printLabel(unsigned Id) const { From resistor at mac.com Mon Jun 30 19:18:53 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 01 Jul 2008 00:18:53 -0000 Subject: [llvm-commits] [llvm] r52945 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/Target/TargetRegisterInfo.cpp utils/TableGen/RegisterInfoEmitter.cpp Message-ID: <200807010018.m610IrTV016554@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 30 19:18:52 2008 New Revision: 52945 URL: http://llvm.org/viewvc/llvm-project?rev=52945&view=rev Log: Replace the dynamically computed std::set lookup method for subregisters with a hashtable-based version that is computed by tblgen at the time LLVM is compiled. Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h llvm/trunk/lib/Target/TargetRegisterInfo.cpp llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=52945&r1=52944&r2=52945&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Mon Jun 30 19:18:52 2008 @@ -274,6 +274,9 @@ /// descriptor. /// class TargetRegisterInfo { +protected: + unsigned* SubregHash; + unsigned SubregHashSize; public: typedef const TargetRegisterClass * const * regclass_iterator; private: @@ -283,7 +286,6 @@ regclass_iterator RegClassBegin, RegClassEnd; // List of regclasses int CallFrameSetupOpcode, CallFrameDestroyOpcode; - std::set > Subregs; protected: TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR, regclass_iterator RegClassBegin, @@ -410,7 +412,19 @@ /// isSubRegister - Returns true if regB is a sub-register of regA. /// bool isSubRegister(unsigned regA, unsigned regB) const { - return Subregs.count(std::make_pair(regA, regB)); + // SubregHash is a simple quadratically probed hash table. + size_t index = (regA + regB * 37) % SubregHashSize; + unsigned ProbeAmt = 2; + while (SubregHash[index*2] != 0 && + SubregHash[index*2+1] != 0) { + if (SubregHash[index*2] == regA && SubregHash[index*2+1] == regB) + return true; + + index = (index + ProbeAmt) % SubregHashSize; + ProbeAmt += 2; + } + + return false; } /// isSuperRegister - Returns true if regB is a super-register of regA. Modified: llvm/trunk/lib/Target/TargetRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegisterInfo.cpp?rev=52945&r1=52944&r2=52945&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetRegisterInfo.cpp Mon Jun 30 19:18:52 2008 @@ -29,16 +29,6 @@ CallFrameSetupOpcode = CFSO; CallFrameDestroyOpcode = CFDO; - - for (unsigned i = 0; i < NumRegs; ++i) { - const TargetRegisterDesc* CurrReg = Desc + i; - - // Initialize the Subregs set, which stores pairs (a, b) where - // b is a subreg of a. - if (CurrReg->SubRegs) - for (const unsigned* CurrSR = CurrReg->SubRegs; *CurrSR; ++CurrSR) - Subregs.insert(std::make_pair(i, *CurrSR)); - } } TargetRegisterInfo::~TargetRegisterInfo() {} Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=52945&r1=52944&r2=52945&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Mon Jun 30 19:18:52 2008 @@ -462,6 +462,70 @@ RegisterAliases); } } + + // Print the SubregHashTable, a simple quadratically probed + // hash table for determining if a register is a subregister + // of another register. + unsigned SubregHashTableSize = NextPowerOf2(2 * Regs.size()); + unsigned* SubregHashTable = + (unsigned*)malloc(2 * SubregHashTableSize * sizeof(unsigned)); + for (unsigned i = 0; i < SubregHashTableSize * 2; ++i) + SubregHashTable[i] = ~0U; + + std::map RegNo; + for (unsigned i = 0, e = Regs.size(); i != e; ++i) + RegNo[Regs[i].TheDef] = i; + + for (unsigned i = 0, e = Regs.size(); i != e; ++i) { + Record* R = Regs[i].TheDef; + for (std::set::iterator I = RegisterSubRegs[R].begin(), + E = RegisterSubRegs[R].end(); I != E; ++I) { + Record* RJ = *I; + // We have to increase the indices of both registers by one when + // computing the hash because, in the generated code, there + // will be an extra empty slot at register 0. + size_t index = ((i+1) + (RegNo[RJ]+1) * 37) % SubregHashTableSize; + unsigned ProbeAmt = 2; + while (SubregHashTable[index*2] != ~0U && + SubregHashTable[index*2+1] != ~0U) { + index = (index + ProbeAmt) % SubregHashTableSize; + ProbeAmt += 2; + } + + SubregHashTable[index*2] = i; + SubregHashTable[index*2+1] = RegNo[RJ]; + } + } + + if (SubregHashTableSize) { + std::string Namespace = Regs[0].TheDef->getValueAsString("Namespace"); + + OS << "\n\n unsigned SubregHashTable[] = {"; + for (unsigned i = 0; i < SubregHashTableSize - 1; ++i) { + if (SubregHashTable[2*i] != ~0U) { + OS << getQualifiedName(Regs[SubregHashTable[2*i]].TheDef) << ", " + << getQualifiedName(Regs[SubregHashTable[2*i+1]].TheDef) << ", "; + } else { + OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister, "; + } + } + + unsigned Idx = SubregHashTableSize*2-2; + if (SubregHashTable[Idx] != ~0U) { + OS << getQualifiedName(Regs[SubregHashTable[Idx]].TheDef) << ", " + << getQualifiedName(Regs[SubregHashTable[Idx+1]].TheDef) << "};\n"; + } else { + OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister};\n"; + } + + OS << " unsigned SubregHashTableSize = " + << SubregHashTableSize << ";\n"; + } else { + OS << "\n\n unsigned SubregHashTable[] = { ~0U, ~0U };\n" + << " unsigned SubregHashTableSize = 1;\n"; + } + + free(SubregHashTable); if (!RegisterAliases.empty()) OS << "\n\n // Register Alias Sets...\n"; @@ -607,7 +671,10 @@ << "(int CallFrameSetupOpcode, int CallFrameDestroyOpcode)\n" << " : TargetRegisterInfo(RegisterDescriptors, " << Registers.size()+1 << ", RegisterClasses, RegisterClasses+" << RegisterClasses.size() <<",\n " - << " CallFrameSetupOpcode, CallFrameDestroyOpcode) {}\n\n"; + << " CallFrameSetupOpcode, CallFrameDestroyOpcode) {\n" + << " this->SubregHash = SubregHashTable;\n" + << " this->SubregHashSize = SubregHashTableSize;\n" + << "}\n\n"; // Collect all information about dwarf register numbers From resistor at mac.com Mon Jun 30 19:41:04 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 01 Jul 2008 00:41:04 -0000 Subject: [llvm-commits] [llvm] r52946 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Message-ID: <200807010041.m610f4aN017191@zion.cs.uiuc.edu> Author: resistor Date: Mon Jun 30 19:40:58 2008 New Revision: 52946 URL: http://llvm.org/viewvc/llvm-project?rev=52946&view=rev Log: Properly handle cases where a predecessor of the block being queried on is unreachable. This fixes PR2503, though we should also fix other passes not to emit this kind of code. Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=52946&r1=52945&r2=52946&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Mon Jun 30 19:40:58 2008 @@ -19,6 +19,7 @@ #include "llvm/Instructions.h" #include "llvm/Function.h" #include "llvm/Analysis/AliasAnalysis.h" +#include "llvm/Analysis/Dominators.h" #include "llvm/Support/CFG.h" #include "llvm/Support/CommandLine.h" #include "llvm/Target/TargetData.h" @@ -82,6 +83,7 @@ AU.setPreservesAll(); AU.addRequiredTransitive(); AU.addRequiredTransitive(); + AU.addRequiredTransitive(); } /// getCallSiteDependency - Private helper for finding the local dependencies @@ -222,6 +224,17 @@ continue; } + // Don't recur upwards if the current block is unreachable. + // Instead, mark it as having no dependency on this path, + // which will block optzns from occuring. For this reason, + // eliminating unreachable blocks before running a memdep + // based optimization is recommended. + DominatorTree& DT = getAnalysis(); + if (!DT.isReachableFromEntry(BB)) { + resp.insert(std::make_pair(BB, None)); + continue; + } + // If we didn't find anything, recurse on the precessors of this block // Only do this for blocks with a small number of predecessors. bool predOnStack = false; From clattner at apple.com Mon Jun 30 19:55:07 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 30 Jun 2008 17:55:07 -0700 Subject: [llvm-commits] [llvm] r52930 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp In-Reply-To: <200806302210.m5UMA9tO012208@zion.cs.uiuc.edu> References: <200806302210.m5UMA9tO012208@zion.cs.uiuc.edu> Message-ID: <55CBEEA5-BB4E-497E-AC47-2D9E262A81BB@apple.com> On Jun 30, 2008, at 3:10 PM, Evan Cheng wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=52930&view=rev > Log: > Add timing report for various sub-passes under SelectionDAGISel. Nifty. > void SelectionDAGISel::CodeGenAndEmitDAG(SelectionDAG &DAG) { > + NamedRegionTimer *RegionTimer = 0; > + > DOUT << "Lowered selection DAG:\n"; > DEBUG(DAG.dump()); > > // Run the DAG combiner in pre-legalize mode. > + if (TimePassesIsEnabled) > + RegionTimer = new NamedRegionTimer("DAG Combining 1"); > DAG.Combine(false, *AA); > + if (TimePassesIsEnabled) > + delete RegionTimer; How about: if (TimePassesIsEnabled) { NamedRegionTimer T("DAG Combining 1"); DAG.Combine(false, *AA); } else { DAG.Combine(false, *AA); } ? -Chris From clattner at apple.com Mon Jun 30 20:06:49 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 30 Jun 2008 18:06:49 -0700 Subject: [llvm-commits] [llvm] r52945 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/Target/TargetRegisterInfo.cpp utils/TableGen/RegisterInfoEmitter.cpp In-Reply-To: <200807010018.m610IrTV016554@zion.cs.uiuc.edu> References: <200807010018.m610IrTV016554@zion.cs.uiuc.edu> Message-ID: <049F9D15-954F-4972-BBB0-980F79472717@apple.com> On Jun 30, 2008, at 5:18 PM, Owen Anderson wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=52945&view=rev > Log: > Replace the dynamically computed std::set lookup method for > subregisters with a hashtable-based > version that is computed by tblgen at the time LLVM is compiled. Nice! > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) > +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Mon Jun 30 > 19:18:52 2008 > > @@ -410,7 +412,19 @@ > /// isSubRegister - Returns true if regB is a sub-register of regA. > /// > bool isSubRegister(unsigned regA, unsigned regB) const { > + // SubregHash is a simple quadratically probed hash table. > + size_t index = (regA + regB * 37) % SubregHashSize; Is SubregHashSize always a power of 2? If so, it would be better to write this as: size_t index = (regA + regB * 37) & (SubregHashSize-1); If not, why not? :) > + unsigned ProbeAmt = 2; > + while (SubregHash[index*2] != 0 && > + SubregHash[index*2+1] != 0) { > > + if (SubregHash[index*2] == regA && SubregHash[index*2+1] == > regB) > + return true; > + > + index = (index + ProbeAmt) % SubregHashSize; Likewise % -> & > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) > +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Mon Jun 30 > 19:18:52 2008 > @@ -462,6 +462,70 @@ > RegisterAliases); > } > } > + > + // Print the SubregHashTable, a simple quadratically probed > + // hash table for determining if a register is a subregister > + // of another register. > + unsigned SubregHashTableSize = NextPowerOf2(2 * Regs.size()); > + unsigned* SubregHashTable = > + (unsigned*)malloc(2 * SubregHashTableSize * > sizeof(unsigned)); Please use new[]/delete[] instead of malloc/free. Does this really guarantee that the hash table is sparse enough? If I had 31 registers, would this make a table of size 32? For a probed hash table like this, you want at least 30-40% sparsity. > + for (unsigned i = 0; i < SubregHashTableSize * 2; ++i) > + SubregHashTable[i] = ~0U; memset? -Chris From dpatel at apple.com Mon Jun 30 20:14:01 2008 From: dpatel at apple.com (Devang Patel) Date: Mon, 30 Jun 2008 18:14:01 -0700 Subject: [llvm-commits] [llvm] r52946 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp In-Reply-To: <200807010041.m610f4aN017191@zion.cs.uiuc.edu> References: <200807010041.m610f4aN017191@zion.cs.uiuc.edu> Message-ID: <0E9C4E63-BEF5-476E-9737-5D5C270E01E8@apple.com> On Jun 30, 2008, at 5:41 PM, Owen Anderson wrote: > Properly handle cases where a predecessor of the block being queried > on is unreachable. > This fixes PR2503, though we should also fix other passes not to > emit this kind of code. Is this dead code emitted by other pass or is it coming from the input ? - Devang From kremenek at apple.com Mon Jun 30 20:46:41 2008 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 01 Jul 2008 01:46:41 -0000 Subject: [llvm-commits] [llvm] r52947 - /llvm/tags/checker/checker-51/ Message-ID: <200807010146.m611kfVv019173@zion.cs.uiuc.edu> Author: kremenek Date: Mon Jun 30 20:46:41 2008 New Revision: 52947 URL: http://llvm.org/viewvc/llvm-project?rev=52947&view=rev Log: Tagging checker-51. Added: llvm/tags/checker/checker-51/ - copied from r52946, llvm/trunk/ From resistor at mac.com Mon Jun 30 22:59:55 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 30 Jun 2008 20:59:55 -0700 Subject: [llvm-commits] [llvm] r52946 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp In-Reply-To: <0E9C4E63-BEF5-476E-9737-5D5C270E01E8@apple.com> References: <200807010041.m610f4aN017191@zion.cs.uiuc.edu> <0E9C4E63-BEF5-476E-9737-5D5C270E01E8@apple.com> Message-ID: <9CE157C9-6306-44DA-80B4-D1D19117971B@mac.com> On Jun 30, 2008, at 6:14 PM, Devang Patel wrote: > > On Jun 30, 2008, at 5:41 PM, Owen Anderson wrote: > >> Properly handle cases where a predecessor of the block being queried >> on is unreachable. >> This fixes PR2503, though we should also fix other passes not to >> emit this kind of code. > > > Is this dead code emitted by other pass or is it coming from the > input ? > - > Devang > > It comes from JumpThreading. See PR2509. --Owen -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4260 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080630/5b8f898d/attachment.bin From resistor at mac.com Mon Jun 30 23:02:27 2008 From: resistor at mac.com (Owen Anderson) Date: Mon, 30 Jun 2008 21:02:27 -0700 Subject: [llvm-commits] [llvm] r52945 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/Target/TargetRegisterInfo.cpp utils/TableGen/RegisterInfoEmitter.cpp In-Reply-To: <049F9D15-954F-4972-BBB0-980F79472717@apple.com> References: <200807010018.m610IrTV016554@zion.cs.uiuc.edu> <049F9D15-954F-4972-BBB0-980F79472717@apple.com> Message-ID: <39DD3FAC-8F6D-4DAB-8DC8-2F7254914F3D@mac.com> On Jun 30, 2008, at 6:06 PM, Chris Lattner wrote: >> = >> ===================================================================== >> --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) >> +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Mon Jun 30 >> 19:18:52 2008 >> @@ -462,6 +462,70 @@ >> RegisterAliases); >> } >> } >> + >> + // Print the SubregHashTable, a simple quadratically probed >> + // hash table for determining if a register is a subregister >> + // of another register. >> + unsigned SubregHashTableSize = NextPowerOf2(2 * Regs.size()); >> + unsigned* SubregHashTable = >> + (unsigned*)malloc(2 * SubregHashTableSize * >> sizeof(unsigned)); > > Please use new[]/delete[] instead of malloc/free. Does this really > guarantee that the hash table is sparse enough? If I had 31 > registers, would this make a table of size 32? For a probed hash > table like this, you want at least 30-40% sparsity. > The number of entries in the hash table is equal to the number of subregister relationship. In theory this could be as big as n^2/2, but it won't ever be in practice. As for your example. you forgot the doubling. So for 31 registers, there would be 64 slots, which seems reasonable in practice. Remember that the number of registers includes condition codes, vector registers, etc. --Owen -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 4260 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080630/ef1fdd99/attachment.bin From clattner at apple.com Mon Jun 30 23:45:17 2008 From: clattner at apple.com (Chris Lattner) Date: Mon, 30 Jun 2008 21:45:17 -0700 Subject: [llvm-commits] [llvm] r52945 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/Target/TargetRegisterInfo.cpp utils/TableGen/RegisterInfoEmitter.cpp In-Reply-To: <39DD3FAC-8F6D-4DAB-8DC8-2F7254914F3D@mac.com> References: <200807010018.m610IrTV016554@zion.cs.uiuc.edu> <049F9D15-954F-4972-BBB0-980F79472717@apple.com> <39DD3FAC-8F6D-4DAB-8DC8-2F7254914F3D@mac.com> Message-ID: On Jun 30, 2008, at 9:02 PM, Owen Anderson wrote: > > On Jun 30, 2008, at 6:06 PM, Chris Lattner wrote: >>> = >>> = >>> ==================================================================== >>> --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) >>> +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Mon Jun 30 >>> 19:18:52 2008 >>> @@ -462,6 +462,70 @@ >>> RegisterAliases); >>> } >>> } >>> + >>> + // Print the SubregHashTable, a simple quadratically probed >>> + // hash table for determining if a register is a subregister >>> + // of another register. >>> + unsigned SubregHashTableSize = NextPowerOf2(2 * Regs.size()); >>> + unsigned* SubregHashTable = >>> + (unsigned*)malloc(2 * SubregHashTableSize * >>> sizeof(unsigned)); >> >> Please use new[]/delete[] instead of malloc/free. Does this really >> guarantee that the hash table is sparse enough? If I had 31 >> registers, would this make a table of size 32? For a probed hash >> table like this, you want at least 30-40% sparsity. >> > > The number of entries in the hash table is equal to the number of > subregister relationship. In theory this could be as big as n^2/2, > but it won't ever be in practice. As for your example. you forgot > the doubling. So for 31 registers, there would be 64 slots, which > seems reasonable in practice. Remember that the number of registers > includes condition codes, vector registers, etc. I thought the doubling was due to each entry taking two slots? In any case, this seems like an even worse approximation for the hash table size. What do you think of nextpow2(nsubregs*1.3)? Using # subreg relationships as the base is important. Targets like ia64 have no subregs but a huge number of regs, so the table should be small for it (1 pair of entries!) -Chris From sanxiyn at gmail.com Tue Jul 1 00:27:29 2008 From: sanxiyn at gmail.com (Seo Sanghyeon) Date: Tue, 01 Jul 2008 05:27:29 -0000 Subject: [llvm-commits] [llvm] r52950 - /llvm/trunk/include/llvm/ADT/SmallVector.h Message-ID: <200807010527.m615RTC5025293@zion.cs.uiuc.edu> Author: sanxiyn Date: Tue Jul 1 00:27:28 2008 New Revision: 52950 URL: http://llvm.org/viewvc/llvm-project?rev=52950&view=rev Log: Compilation fix Modified: llvm/trunk/include/llvm/ADT/SmallVector.h Modified: llvm/trunk/include/llvm/ADT/SmallVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallVector.h?rev=52950&r1=52949&r2=52950&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/SmallVector.h (original) +++ llvm/trunk/include/llvm/ADT/SmallVector.h Tue Jul 1 00:27:28 2008 @@ -17,6 +17,7 @@ #include "llvm/ADT/iterator.h" #include "llvm/Support/type_traits.h" #include +#include #include #ifdef _MSC_VER From resistor at mac.com Tue Jul 1 02:02:30 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 01 Jul 2008 07:02:30 -0000 Subject: [llvm-commits] [llvm] r52951 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h utils/TableGen/RegisterInfoEmitter.cpp Message-ID: <200807010702.m6172US0028108@zion.cs.uiuc.edu> Author: resistor Date: Tue Jul 1 02:02:30 2008 New Revision: 52951 URL: http://llvm.org/viewvc/llvm-project?rev=52951&view=rev Log: Implement suggestions from Chris: - Use a more accurate heuristic for the size of the hashtable. - Use bitwise and instead of modulo since the size is a power of two. - Use new[] instead of malloc(). Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=52951&r1=52950&r2=52951&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Tue Jul 1 02:02:30 2008 @@ -413,14 +413,14 @@ /// bool isSubRegister(unsigned regA, unsigned regB) const { // SubregHash is a simple quadratically probed hash table. - size_t index = (regA + regB * 37) % SubregHashSize; + size_t index = (regA + regB * 37) & (SubregHashSize-1); unsigned ProbeAmt = 2; while (SubregHash[index*2] != 0 && SubregHash[index*2+1] != 0) { if (SubregHash[index*2] == regA && SubregHash[index*2+1] == regB) return true; - index = (index + ProbeAmt) % SubregHashSize; + index = (index + ProbeAmt) & (SubregHashSize-1); ProbeAmt += 2; } Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=52951&r1=52950&r2=52951&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Tue Jul 1 02:02:30 2008 @@ -466,15 +466,16 @@ // Print the SubregHashTable, a simple quadratically probed // hash table for determining if a register is a subregister // of another register. - unsigned SubregHashTableSize = NextPowerOf2(2 * Regs.size()); - unsigned* SubregHashTable = - (unsigned*)malloc(2 * SubregHashTableSize * sizeof(unsigned)); - for (unsigned i = 0; i < SubregHashTableSize * 2; ++i) - SubregHashTable[i] = ~0U; - + unsigned NumSubRegs = 0; std::map RegNo; - for (unsigned i = 0, e = Regs.size(); i != e; ++i) + for (unsigned i = 0, e = Regs.size(); i != e; ++i) { RegNo[Regs[i].TheDef] = i; + NumSubRegs += RegisterSubRegs[Regs[i].TheDef].size(); + } + + unsigned SubregHashTableSize = NextPowerOf2(2 * NumSubRegs); + unsigned* SubregHashTable = new unsigned[2 * SubregHashTableSize]; + std::fill(SubregHashTable, SubregHashTable + 2 * SubregHashTableSize, ~0U); for (unsigned i = 0, e = Regs.size(); i != e; ++i) { Record* R = Regs[i].TheDef; @@ -484,11 +485,11 @@ // We have to increase the indices of both registers by one when // computing the hash because, in the generated code, there // will be an extra empty slot at register 0. - size_t index = ((i+1) + (RegNo[RJ]+1) * 37) % SubregHashTableSize; + size_t index = ((i+1) + (RegNo[RJ]+1) * 37) & (SubregHashTableSize-1); unsigned ProbeAmt = 2; while (SubregHashTable[index*2] != ~0U && SubregHashTable[index*2+1] != ~0U) { - index = (index + ProbeAmt) % SubregHashTableSize; + index = (index + ProbeAmt) & (SubregHashTableSize-1); ProbeAmt += 2; } From baldrick at free.fr Tue Jul 1 02:55:18 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 1 Jul 2008 09:55:18 +0200 Subject: [llvm-commits] [llvm] r52893 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/Alpha/AlphaISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/Mips/MipsISelLowering.cpp lib/Target/PIC16/PIC16ISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: References: <200806301019.m5UAJJbk018595@zion.cs.uiuc.edu> Message-ID: <200807010955.18854.baldrick@free.fr> Hi Chris, > > + /// getMergeValues - Create a MERGE_VALUES node from the given > > types and ops. > > + /// Allowed to return something different (and simpler) if > > Simplify is true. > > + SDOperand getMergeValues(SDVTList VTs, SDOperandPtr Ops, unsigned > > NumOps, > > + bool Simplify = true) { > > + if (Simplify && NumOps == 1) > > + return Ops[0]; > > + return getNode(ISD::MERGE_VALUES, VTs, Ops, NumOps); > > + } > > Why require clients to pass in the VTlist? Can it be inferred from > the operands? Since 'getMergeValues' is specific to the MERGE_VALUES > node, it seems like a nicety to do that. the value types can be inferred from the operands. This is the case for getNode too. I assumed that the value types were passed to getNode as a sanity check, so it seemed good to sanity check getMergeValues too; but perhaps they are passed for efficiency reasons? Ciao, Duncan. From baldrick at free.fr Tue Jul 1 03:00:52 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 01 Jul 2008 08:00:52 -0000 Subject: [llvm-commits] [llvm] r52952 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200807010800.m6180rxx007930@zion.cs.uiuc.edu> Author: baldrick Date: Tue Jul 1 03:00:49 2008 New Revision: 52952 URL: http://llvm.org/viewvc/llvm-project?rev=52952&view=rev Log: Highlight that getMergeValues optimization is being suppressed here. 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=52952&r1=52951&r2=52952&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Jul 1 03:00:49 2008 @@ -4517,7 +4517,8 @@ SDOperand Res = DAG.getLoad(VT, FIST, StackSlot, NULL, 0); // Use a MERGE_VALUES node to drop the chain result value. - return DAG.getMergeValues(DAG.getVTList(VT), &Res, 1, false).Val; + return DAG.getMergeValues(DAG.getVTList(VT), &Res, 1, + false /* Require a node with one-result */).Val; } SDOperand X86TargetLowering::LowerFABS(SDOperand Op, SelectionDAG &DAG) { From baldrick at free.fr Tue Jul 1 03:01:13 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 1 Jul 2008 10:01:13 +0200 Subject: [llvm-commits] [llvm] r52893 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/Alpha/AlphaISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/Mips/MipsISelLowering.cpp lib/Target/PIC16/PIC16ISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <7945D1F9-8F6F-490D-9CF4-866C89890052@apple.com> References: <200806301019.m5UAJJbk018595@zion.cs.uiuc.edu> <7945D1F9-8F6F-490D-9CF4-866C89890052@apple.com> Message-ID: <200807011001.13350.baldrick@free.fr> Hi Dan, > > // Use a MERGE_VALUES node to drop the chain result value. > > - return DAG.getNode(ISD::MERGE_VALUES, MVT::i64, Res).Val; > > -} > > + return DAG.getMergeValues(DAG.getVTList(VT), &Res, 1, false).Val; > > +} > > As this is the one place currently that needs to pass false to > getMergeValues, could you put a comment about it here? Something > like "note that we need to pass false to getMergeValues to tell > it not to just return back Res verbatim, which won't work here > because we specifically need a node with exactly one result." I added a (minimal) comment - r52952. Thanks! Duncan. From baldrick at free.fr Tue Jul 1 03:12:05 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 1 Jul 2008 10:12:05 +0200 Subject: [llvm-commits] [llvm] r52934 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp In-Reply-To: <200806302233.m5UMXvMY013077@zion.cs.uiuc.edu> References: <200806302233.m5UMXvMY013077@zion.cs.uiuc.edu> Message-ID: <200807011012.06224.baldrick@free.fr> > Suppress compiler warning. Thanks! The odd thing is that the same code can be found in LegalizeDAG.cpp line 4672, but (presumably) does not generate a warning. Ciao, Duncan. > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Mon Jun 30 17:33:56 2008 > @@ -372,7 +372,7 @@ > assert((VT == MVT::f32 || VT == MVT::f64) && "Unsupported setcc type!"); > > // Expand into one or more soft-fp libcall(s). > - RTLIB::Libcall LC1, LC2 = RTLIB::UNKNOWN_LIBCALL; > + RTLIB::Libcall LC1 = RTLIB::UNKNOWN_LIBCALL, LC2 = RTLIB::UNKNOWN_LIBCALL; > switch (CCCode) { > case ISD::SETEQ: > case ISD::SETOEQ: From baldrick at free.fr Tue Jul 1 03:09:25 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 1 Jul 2008 10:09:25 +0200 Subject: [llvm-commits] [llvm] r52933 - /llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp In-Reply-To: <200806302233.m5UMXGIv013040@zion.cs.uiuc.edu> References: <200806302233.m5UMXGIv013040@zion.cs.uiuc.edu> Message-ID: <200807011009.25527.baldrick@free.fr> Hi Evan, > Don't run stack slot coloring if -fast. I noticed that the DAG combiner runs even if -fast. Is that needed for correctness or is it an oversight? Ciao, Duncan. From resistor at mac.com Tue Jul 1 10:56:31 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 01 Jul 2008 15:56:31 -0000 Subject: [llvm-commits] [llvm] r52960 - /llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Message-ID: <200807011556.m61FuWue024648@zion.cs.uiuc.edu> Author: resistor Date: Tue Jul 1 10:56:31 2008 New Revision: 52960 URL: http://llvm.org/viewvc/llvm-project?rev=52960&view=rev Log: Use delete[] instead of free on an array created with new[]. Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=52960&r1=52959&r2=52960&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Tue Jul 1 10:56:31 2008 @@ -526,7 +526,7 @@ << " unsigned SubregHashTableSize = 1;\n"; } - free(SubregHashTable); + delete [] SubregHashTable; if (!RegisterAliases.empty()) OS << "\n\n // Register Alias Sets...\n"; From evan.cheng at apple.com Tue Jul 1 11:08:20 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Jul 2008 09:08:20 -0700 Subject: [llvm-commits] [llvm] r52933 - /llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp In-Reply-To: <200807011009.25527.baldrick@free.fr> References: <200806302233.m5UMXGIv013040@zion.cs.uiuc.edu> <200807011009.25527.baldrick@free.fr> Message-ID: <17151528-C5B4-401A-B202-26ADBFE29A20@apple.com> Surprisingly turning off DAG combiner will slow down compilation. The dag combiner time is out weighted by the time spent processing all the crap that's not optimized away. It's possible we can turn off the second run of dag combiner only. I'll find out if that's case. Evan On Jul 1, 2008, at 1:09 AM, Duncan Sands wrote: > Hi Evan, > >> Don't run stack slot coloring if -fast. > > I noticed that the DAG combiner runs even if -fast. > Is that needed for correctness or is it an oversight? > > Ciao, > > Duncan. From clattner at apple.com Tue Jul 1 11:59:25 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 1 Jul 2008 09:59:25 -0700 Subject: [llvm-commits] [llvm] r52933 - /llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp In-Reply-To: <17151528-C5B4-401A-B202-26ADBFE29A20@apple.com> References: <200806302233.m5UMXGIv013040@zion.cs.uiuc.edu> <200807011009.25527.baldrick@free.fr> <17151528-C5B4-401A-B202-26ADBFE29A20@apple.com> Message-ID: On Jul 1, 2008, at 9:08 AM, Evan Cheng wrote: > Surprisingly turning off DAG combiner will slow down compilation. The > dag combiner time is out weighted by the time spent processing all the > crap that's not optimized away. It's possible we can turn off the > second run of dag combiner only. I'll find out if that's case. Are there a few common xforms that dag combiner does that are important? If so, maybe those should be added to ::getNode()? -Chris > > > Evan > > On Jul 1, 2008, at 1:09 AM, Duncan Sands wrote: > >> Hi Evan, >> >>> Don't run stack slot coloring if -fast. >> >> I noticed that the DAG combiner runs even if -fast. >> Is that needed for correctness or is it an oversight? >> >> Ciao, >> >> Duncan. > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Tue Jul 1 12:01:41 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 1 Jul 2008 10:01:41 -0700 Subject: [llvm-commits] [llvm] r52893 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/Alpha/AlphaISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/Mips/MipsISelLowering.cpp lib/Target/PIC16/PIC16ISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <200807010955.18854.baldrick@free.fr> References: <200806301019.m5UAJJbk018595@zion.cs.uiuc.edu> <200807010955.18854.baldrick@free.fr> Message-ID: <14ADDE5D-909F-4DE3-B83C-6D4394A8E90B@apple.com> On Jul 1, 2008, at 12:55 AM, Duncan Sands wrote: > Hi Chris, > >>> + /// getMergeValues - Create a MERGE_VALUES node from the given >>> types and ops. >>> + /// Allowed to return something different (and simpler) if >>> Simplify is true. >>> + SDOperand getMergeValues(SDVTList VTs, SDOperandPtr Ops, unsigned >>> NumOps, >>> + bool Simplify = true) { >>> + if (Simplify && NumOps == 1) >>> + return Ops[0]; >>> + return getNode(ISD::MERGE_VALUES, VTs, Ops, NumOps); >>> + } >> >> Why require clients to pass in the VTlist? Can it be inferred from >> the operands? Since 'getMergeValues' is specific to the MERGE_VALUES >> node, it seems like a nicety to do that. > > the value types can be inferred from the operands. This is the case > for getNode too. I assumed that the value types were passed to > getNode > as a sanity check, so it seemed good to sanity check getMergeValues > too; > but perhaps they are passed for efficiency reasons? The idea was that the general ::getNode() methods should specify it for uniformity. Specialized methods (like getCopyFromReg and your new method) which only produce a single node type can/should be optimized for that node type. Does that seem reasonable? -Chris From clattner at apple.com Tue Jul 1 12:02:41 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 1 Jul 2008 10:02:41 -0700 Subject: [llvm-commits] [llvm] r52951 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h utils/TableGen/RegisterInfoEmitter.cpp In-Reply-To: <200807010702.m6172US0028108@zion.cs.uiuc.edu> References: <200807010702.m6172US0028108@zion.cs.uiuc.edu> Message-ID: <6980617F-2F64-40A6-A22C-259B5D4C5857@apple.com> On Jul 1, 2008, at 12:02 AM, Owen Anderson wrote: > Author: resistor > Date: Tue Jul 1 02:02:30 2008 > New Revision: 52951 > > URL: http://llvm.org/viewvc/llvm-project?rev=52951&view=rev > Log: > Implement suggestions from Chris: > - Use a more accurate heuristic for the size of the hashtable. > - Use bitwise and instead of modulo since the size is a power of two. > - Use new[] instead of malloc(). Thanks Owen! BTW, is there a reason you use malloc/free (now new/ delete) instead of a std::vector? -Chris > > > Modified: > llvm/trunk/include/llvm/Target/TargetRegisterInfo.h > llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp > > Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=52951&r1=52950&r2=52951&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) > +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Tue Jul 1 > 02:02:30 2008 > @@ -413,14 +413,14 @@ > /// > bool isSubRegister(unsigned regA, unsigned regB) const { > // SubregHash is a simple quadratically probed hash table. > - size_t index = (regA + regB * 37) % SubregHashSize; > + size_t index = (regA + regB * 37) & (SubregHashSize-1); > unsigned ProbeAmt = 2; > while (SubregHash[index*2] != 0 && > SubregHash[index*2+1] != 0) { > if (SubregHash[index*2] == regA && SubregHash[index*2+1] == > regB) > return true; > > - index = (index + ProbeAmt) % SubregHashSize; > + index = (index + ProbeAmt) & (SubregHashSize-1); > ProbeAmt += 2; > } > > > Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=52951&r1=52950&r2=52951&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) > +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Tue Jul 1 > 02:02:30 2008 > @@ -466,15 +466,16 @@ > // Print the SubregHashTable, a simple quadratically probed > // hash table for determining if a register is a subregister > // of another register. > - unsigned SubregHashTableSize = NextPowerOf2(2 * Regs.size()); > - unsigned* SubregHashTable = > - (unsigned*)malloc(2 * SubregHashTableSize * > sizeof(unsigned)); > - for (unsigned i = 0; i < SubregHashTableSize * 2; ++i) > - SubregHashTable[i] = ~0U; > - > + unsigned NumSubRegs = 0; > std::map RegNo; > - for (unsigned i = 0, e = Regs.size(); i != e; ++i) > + for (unsigned i = 0, e = Regs.size(); i != e; ++i) { > RegNo[Regs[i].TheDef] = i; > + NumSubRegs += RegisterSubRegs[Regs[i].TheDef].size(); > + } > + > + unsigned SubregHashTableSize = NextPowerOf2(2 * NumSubRegs); > + unsigned* SubregHashTable = new unsigned[2 * SubregHashTableSize]; > + std::fill(SubregHashTable, SubregHashTable + 2 * > SubregHashTableSize, ~0U); > > for (unsigned i = 0, e = Regs.size(); i != e; ++i) { > Record* R = Regs[i].TheDef; > @@ -484,11 +485,11 @@ > // We have to increase the indices of both registers by one when > // computing the hash because, in the generated code, there > // will be an extra empty slot at register 0. > - size_t index = ((i+1) + (RegNo[RJ]+1) * 37) % > SubregHashTableSize; > + size_t index = ((i+1) + (RegNo[RJ]+1) * 37) & > (SubregHashTableSize-1); > unsigned ProbeAmt = 2; > while (SubregHashTable[index*2] != ~0U && > SubregHashTable[index*2+1] != ~0U) { > - index = (index + ProbeAmt) % SubregHashTableSize; > + index = (index + ProbeAmt) & (SubregHashTableSize-1); > ProbeAmt += 2; > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Tue Jul 1 12:07:24 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 01 Jul 2008 10:07:24 -0700 Subject: [llvm-commits] [llvm] r52951 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h utils/TableGen/RegisterInfoEmitter.cpp In-Reply-To: <6980617F-2F64-40A6-A22C-259B5D4C5857@apple.com> References: <200807010702.m6172US0028108@zion.cs.uiuc.edu> <6980617F-2F64-40A6-A22C-259B5D4C5857@apple.com> Message-ID: <1C1B7467-E046-43EA-BA8E-34BC641B76E1@mac.com> On Jul 1, 2008, at 10:02 AM, Chris Lattner wrote: > > On Jul 1, 2008, at 12:02 AM, Owen Anderson wrote: > >> Author: resistor >> Date: Tue Jul 1 02:02:30 2008 >> New Revision: 52951 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52951&view=rev >> Log: >> Implement suggestions from Chris: >> - Use a more accurate heuristic for the size of the hashtable. >> - Use bitwise and instead of modulo since the size is a power of two. >> - Use new[] instead of malloc(). > > Thanks Owen! BTW, is there a reason you use malloc/free (now new/ > delete) instead of a std::vector? Not particularly. A vector just seemed like overkill since I have to determine its size upfront anyways. Plus, it let me use similar code in tblgen and in TRI, since both of them store it as an array of unsigned's. --Owen From kremenek at apple.com Tue Jul 1 12:18:28 2008 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 01 Jul 2008 17:18:28 -0000 Subject: [llvm-commits] [llvm] r52961 - /llvm/tags/checker/checker-52/ Message-ID: <200807011718.m61HISDh027474@zion.cs.uiuc.edu> Author: kremenek Date: Tue Jul 1 12:18:27 2008 New Revision: 52961 URL: http://llvm.org/viewvc/llvm-project?rev=52961&view=rev Log: Tagging checker-52. Added: llvm/tags/checker/checker-52/ - copied from r52960, llvm/trunk/ From kremenek at apple.com Tue Jul 1 12:20:02 2008 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 01 Jul 2008 17:20:02 -0000 Subject: [llvm-commits] [llvm] r52962 - /llvm/tags/checker/checker-52/ Message-ID: <200807011720.m61HK2AV027531@zion.cs.uiuc.edu> Author: kremenek Date: Tue Jul 1 12:20:02 2008 New Revision: 52962 URL: http://llvm.org/viewvc/llvm-project?rev=52962&view=rev Log: Tagging checker-52. Removed: llvm/tags/checker/checker-52/ From kremenek at apple.com Tue Jul 1 12:22:21 2008 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 01 Jul 2008 17:22:21 -0000 Subject: [llvm-commits] [llvm] r52964 - /llvm/tags/checker/checker-52/ Message-ID: <200807011722.m61HMLFB027629@zion.cs.uiuc.edu> Author: kremenek Date: Tue Jul 1 12:22:21 2008 New Revision: 52964 URL: http://llvm.org/viewvc/llvm-project?rev=52964&view=rev Log: Tagging checker-52. Added: llvm/tags/checker/checker-52/ - copied from r52963, llvm/trunk/ From resistor at mac.com Tue Jul 1 12:34:38 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 01 Jul 2008 17:34:38 -0000 Subject: [llvm-commits] [llvm] r52966 - in /llvm/trunk: include/llvm/Target/TargetRegisterInfo.h lib/Target/TargetRegisterInfo.cpp utils/TableGen/RegisterInfoEmitter.cpp Message-ID: <200807011734.m61HYcMn028008@zion.cs.uiuc.edu> Author: resistor Date: Tue Jul 1 12:34:38 2008 New Revision: 52966 URL: http://llvm.org/viewvc/llvm-project?rev=52966&view=rev Log: Make the subregister hashtable output more readable by wrapping the lines, and mark it const along with the associated changes to TargetRegisterInfo. Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h llvm/trunk/lib/Target/TargetRegisterInfo.cpp llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Modified: llvm/trunk/include/llvm/Target/TargetRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetRegisterInfo.h?rev=52966&r1=52965&r2=52966&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetRegisterInfo.h Tue Jul 1 12:34:38 2008 @@ -275,8 +275,8 @@ /// class TargetRegisterInfo { protected: - unsigned* SubregHash; - unsigned SubregHashSize; + const unsigned* SubregHash; + const unsigned SubregHashSize; public: typedef const TargetRegisterClass * const * regclass_iterator; private: @@ -291,7 +291,9 @@ regclass_iterator RegClassBegin, regclass_iterator RegClassEnd, int CallFrameSetupOpcode = -1, - int CallFrameDestroyOpcode = -1); + int CallFrameDestroyOpcode = -1, + const unsigned* subregs = 0, + const unsigned subregsize = 0); virtual ~TargetRegisterInfo(); public: Modified: llvm/trunk/lib/Target/TargetRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegisterInfo.cpp?rev=52966&r1=52965&r2=52966&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetRegisterInfo.cpp Tue Jul 1 12:34:38 2008 @@ -22,8 +22,10 @@ TargetRegisterInfo::TargetRegisterInfo(const TargetRegisterDesc *D, unsigned NR, regclass_iterator RCB, regclass_iterator RCE, - int CFSO, int CFDO) - : Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE) { + int CFSO, int CFDO, + const unsigned* subregs, const unsigned subregsize) + : Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE), + SubregHash(subregs), SubregHashSize(subregsize) { assert(NumRegs < FirstVirtualRegister && "Target has too many physical registers!"); Modified: llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp?rev=52966&r1=52965&r2=52966&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/RegisterInfoEmitter.cpp Tue Jul 1 12:34:38 2008 @@ -501,29 +501,34 @@ if (SubregHashTableSize) { std::string Namespace = Regs[0].TheDef->getValueAsString("Namespace"); - OS << "\n\n unsigned SubregHashTable[] = {"; + OS << "\n\n const unsigned SubregHashTable[] = { "; for (unsigned i = 0; i < SubregHashTableSize - 1; ++i) { + if (i != 0) + // Insert spaces for nice formatting. + OS << " "; + if (SubregHashTable[2*i] != ~0U) { OS << getQualifiedName(Regs[SubregHashTable[2*i]].TheDef) << ", " - << getQualifiedName(Regs[SubregHashTable[2*i+1]].TheDef) << ", "; + << getQualifiedName(Regs[SubregHashTable[2*i+1]].TheDef) << ", \n"; } else { - OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister, "; + OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister, \n"; } } unsigned Idx = SubregHashTableSize*2-2; if (SubregHashTable[Idx] != ~0U) { - OS << getQualifiedName(Regs[SubregHashTable[Idx]].TheDef) << ", " - << getQualifiedName(Regs[SubregHashTable[Idx+1]].TheDef) << "};\n"; + OS << " " + << getQualifiedName(Regs[SubregHashTable[Idx]].TheDef) << ", " + << getQualifiedName(Regs[SubregHashTable[Idx+1]].TheDef) << " };\n"; } else { - OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister};\n"; + OS << Namespace << "::NoRegister, " << Namespace << "::NoRegister };\n"; } - OS << " unsigned SubregHashTableSize = " + OS << " const unsigned SubregHashTableSize = " << SubregHashTableSize << ";\n"; } else { - OS << "\n\n unsigned SubregHashTable[] = { ~0U, ~0U };\n" - << " unsigned SubregHashTableSize = 1;\n"; + OS << "\n\n const unsigned SubregHashTable[] = { ~0U, ~0U };\n" + << " const unsigned SubregHashTableSize = 1;\n"; } delete [] SubregHashTable; @@ -672,9 +677,8 @@ << "(int CallFrameSetupOpcode, int CallFrameDestroyOpcode)\n" << " : TargetRegisterInfo(RegisterDescriptors, " << Registers.size()+1 << ", RegisterClasses, RegisterClasses+" << RegisterClasses.size() <<",\n " - << " CallFrameSetupOpcode, CallFrameDestroyOpcode) {\n" - << " this->SubregHash = SubregHashTable;\n" - << " this->SubregHashSize = SubregHashTableSize;\n" + << " CallFrameSetupOpcode, CallFrameDestroyOpcode,\n" + << " SubregHashTable, SubregHashTableSize) {\n" << "}\n\n"; // Collect all information about dwarf register numbers From dpatel at apple.com Tue Jul 1 12:44:24 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 01 Jul 2008 17:44:24 -0000 Subject: [llvm-commits] [llvm] r52967 - in /llvm/trunk: include/llvm/Analysis/Dominators.h include/llvm/Pass.h include/llvm/PassManagers.h lib/Analysis/LoopPass.cpp lib/VMCore/PassManager.cpp Message-ID: <200807011744.m61HiOOk028367@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 1 12:44:24 2008 New Revision: 52967 URL: http://llvm.org/viewvc/llvm-project?rev=52967&view=rev Log: Add dom info verifier. Modified: llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/include/llvm/Pass.h llvm/trunk/include/llvm/PassManagers.h llvm/trunk/lib/Analysis/LoopPass.cpp llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=52967&r1=52966&r2=52967&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Tue Jul 1 12:44:24 2008 @@ -102,7 +102,7 @@ Children.push_back(C); return C; } - + size_t getNumChildren() const { return Children.size(); } @@ -308,6 +308,43 @@ // FIXME: Should remove this virtual bool runOnFunction(Function &F) { return false; } + /// compare - Return false if the other dominator tree base maches this + /// dominator tree base. Otherwise return true. + bool compare(DominatorTreeBase &Other) const { + + // Collect nodes. + SmallPtrSet MyBBs; + for (typename DomTreeNodeMapType::const_iterator + I = this->DomTreeNodes.begin(), + E = this->DomTreeNodes.end(); I != E; ++I) { + const NodeT *BB = I->first; + MyBBs.insert(BB); + } + + SmallPtrSet OtherBBs; + const DomTreeNodeMapType &OtherDomTreeNodes = Other.DomTreeNodes; + for (typename DomTreeNodeMapType::const_iterator + I = OtherDomTreeNodes.begin(), + E = OtherDomTreeNodes.end(); I != E; ++I) { + const NodeT *BB = I->first; + OtherBBs.insert(BB); + } + + if (OtherBBs.size() != MyBBs.size()) + return true; + + // Compare node sets. + for (typename SmallPtrSet::const_iterator I = MyBBs.begin(), + E = MyBBs.end(); I != E; ++I) { + const NodeT *BB = *I; + if (OtherBBs.erase(BB) == 0) + return true; + } + if (!OtherBBs.empty()) + return true; + return false; + } + virtual void releaseMemory() { reset(); } /// getNode - return the (Post)DominatorTree node for the specified basic @@ -697,7 +734,22 @@ inline DomTreeNode *getRootNode() const { return DT->getRootNode(); } - + + /// compare - Return false if the other dominator tree maches this + /// dominator tree. Otherwise return true. + inline bool compare(DominatorTree &Other) const { + DomTreeNode *R = getRootNode(); + DomTreeNode *OtherR = Other.getRootNode(); + + if (!R || !OtherR || R->getBlock() != OtherR->getBlock()) + return true; + + if (DT->compare(Other.getBase())) + return true; + + return false; + } + virtual bool runOnFunction(Function &F); virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -843,8 +895,8 @@ typedef std::map DomSetMapType; // Dom set map protected: DomSetMapType Frontiers; - std::vector Roots; - const bool IsPostDominators; + std::vector Roots; + const bool IsPostDominators; public: DominanceFrontierBase(intptr_t ID, bool isPostDom) @@ -896,6 +948,58 @@ I->second.erase(Node); } + /// compareDomSet - Return false if two domsets match. Otherwise + /// return ture; + bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const { + std::set tmpSet; + for (DomSetType::const_iterator I = DS2.begin(), + E = DS2.end(); I != E; ++I) + tmpSet.insert(*I); + + for (DomSetType::const_iterator I = DS1.begin(), + E = DS1.end(); I != E; ++I) { + BasicBlock *Node = *I; + + if (tmpSet.erase(Node) == 0) + // Node is in DS1 but not in DS2. + return true; + } + + if(!tmpSet.empty()) + // There are nodes that are in DS2 but not in DS1. + return true; + + // DS1 and DS2 matches. + return false; + } + + /// compare - Return true if the other dominance frontier base matches + /// this dominance frontier base. Otherwise return false. + bool compare(DominanceFrontierBase &Other) const { + DomSetMapType tmpFrontiers; + for (DomSetMapType::const_iterator I = Other.begin(), + E = Other.end(); I != E; ++I) + tmpFrontiers.insert(std::make_pair(I->first, I->second)); + + for (DomSetMapType::iterator I = tmpFrontiers.begin(), + E = tmpFrontiers.end(); I != E; ++I) { + BasicBlock *Node = I->first; + const_iterator DFI = find(Node); + if (DFI == end()) + return true; + + if (compareDomSet(I->second, DFI->second)) + return true; + + tmpFrontiers.erase(Node); + } + + if (!tmpFrontiers.empty()) + return true; + + return false; + } + /// print - Convert to human readable form /// virtual void print(std::ostream &OS, const Module* = 0) const; @@ -962,7 +1066,6 @@ NewDFI->second.erase(BB); } -private: const DomSetType &calculate(const DominatorTree &DT, const DomTreeNode *Node); }; Modified: llvm/trunk/include/llvm/Pass.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=52967&r1=52966&r2=52967&view=diff ============================================================================== --- llvm/trunk/include/llvm/Pass.h (original) +++ llvm/trunk/include/llvm/Pass.h Tue Jul 1 12:44:24 2008 @@ -125,7 +125,6 @@ Resolver = AR; } inline AnalysisResolver *getResolver() { - assert (Resolver && "Resolver is not set"); return Resolver; } Modified: llvm/trunk/include/llvm/PassManagers.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=52967&r1=52966&r2=52967&view=diff ============================================================================== --- llvm/trunk/include/llvm/PassManagers.h (original) +++ llvm/trunk/include/llvm/PassManagers.h Tue Jul 1 12:44:24 2008 @@ -245,6 +245,9 @@ /// verifyPreservedAnalysis -- Verify analysis presreved by pass P. void verifyPreservedAnalysis(Pass *P); + /// verifyDomInfo -- Verify dominator information if it is available. + void verifyDomInfo(Pass &P, Function &F); + /// Remove Analysis that is not preserved by the pass void removeNotPreservedAnalysis(Pass *P); Modified: llvm/trunk/lib/Analysis/LoopPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=52967&r1=52966&r2=52967&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopPass.cpp (original) +++ llvm/trunk/lib/Analysis/LoopPass.cpp Tue Jul 1 12:44:24 2008 @@ -234,6 +234,9 @@ recordAvailableAnalysis(P); removeDeadPasses(P, "", ON_LOOP_MSG); + // Verify dominator information if it is available and preserved. + verifyDomInfo(*LP, F); + if (skipThisLoop) // Do not run other passes on this loop. break; Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=52967&r1=52966&r2=52967&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Tue Jul 1 12:44:24 2008 @@ -19,6 +19,7 @@ #include "llvm/ModuleProvider.h" #include "llvm/Support/Streams.h" #include "llvm/Support/ManagedStatic.h" +#include "llvm/Analysis/Dominators.h" #include "llvm-c/Core.h" #include #include @@ -41,6 +42,11 @@ None, Arguments, Structure, Executions, Details }; +bool VerifyDomInfo = false; +static cl::opt +VerifyDomInfoX("verify-dom-info", cl::location(VerifyDomInfo), + cl::desc("Verify dominator info (time consuming)")); + static cl::opt PassDebugging("debug-pass", cl::Hidden, cl::desc("Print PassManager debugging information"), @@ -608,6 +614,46 @@ } } +/// verifyDomInfo - Verify dominator information if it is available. +void PMDataManager::verifyDomInfo(Pass &P, Function &F) { + + if (!VerifyDomInfo || !P.getResolver()) + return; + + DominatorTree *DT = P.getAnalysisToUpdate(); + if (!DT) + return; + + DominatorTree OtherDT; + OtherDT.getBase().recalculate(F); + if (DT->compare(OtherDT)) { + cerr << "Dominator Information for " << F.getNameStart() << "\n"; + cerr << "Pass " << P.getPassName() << "\n"; + cerr << "----- Valid -----\n"; + OtherDT.dump(); + cerr << "----- InValid -----\n"; + DT->dump(); + assert (0 && "Invalid dominator info"); + } + + DominanceFrontier *DF = P.getAnalysisToUpdate(); + if (!DF) + return; + + DominanceFrontier OtherDF; + std::vector DTRoots = DT->getRoots(); + OtherDF.calculate(*DT, DT->getNode(DTRoots[0])); + if (DF->compare(OtherDF)) { + cerr << "Dominator Information for " << F.getNameStart() << "\n"; + cerr << "Pass " << P.getPassName() << "\n"; + cerr << "----- Valid -----\n"; + OtherDF.dump(); + cerr << "----- InValid -----\n"; + DF->dump(); + assert (0 && "Invalid dominator info"); + } +} + /// Remove Analyss not preserved by Pass P void PMDataManager::removeNotPreservedAnalysis(Pass *P) { AnalysisUsage AnUsage; @@ -650,7 +696,6 @@ InheritedAnalysis[Index]->erase(Info); } } - } /// Remove analysis passes that are not used any longer @@ -719,6 +764,7 @@ Pass *PRequired = *I; unsigned RDepth = 0; + assert (PRequired->getResolver() && "Analysis Resolver is not set"); PMDataManager &DM = PRequired->getResolver()->getPMDataManager(); RDepth = DM.getDepth(); @@ -813,6 +859,7 @@ // If that is not the case then it will raise an assert when it is used. continue; AnalysisResolver *AR = P->getResolver(); + assert (AR && "Analysis Resolver is not set"); AR->addAnalysisImplsPair(*I, Impl); } } @@ -1202,6 +1249,9 @@ removeNotPreservedAnalysis(FP); recordAvailableAnalysis(FP); removeDeadPasses(FP, F.getNameStart(), ON_FUNCTION_MSG); + + // Verify dominator information if it is available and preserved. + verifyDomInfo(*FP, F); } return Changed; } From evan.cheng at apple.com Tue Jul 1 12:59:21 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 01 Jul 2008 17:59:21 -0000 Subject: [llvm-commits] [llvm] r52970 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200807011759.m61HxLUr028822@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 1 12:59:20 2008 New Revision: 52970 URL: http://llvm.org/viewvc/llvm-project?rev=52970&view=rev Log: Apply Chris' suggestion. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52970&r1=52969&r2=52970&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Jul 1 12:59:20 2008 @@ -5303,17 +5303,16 @@ } void SelectionDAGISel::CodeGenAndEmitDAG(SelectionDAG &DAG) { - NamedRegionTimer *RegionTimer = 0; - DOUT << "Lowered selection DAG:\n"; DEBUG(DAG.dump()); // Run the DAG combiner in pre-legalize mode. - if (TimePassesIsEnabled) - RegionTimer = new NamedRegionTimer("DAG Combining 1"); - DAG.Combine(false, *AA); - if (TimePassesIsEnabled) - delete RegionTimer; + if (TimePassesIsEnabled) { + NamedRegionTimer T("DAG Combining 1"); + DAG.Combine(false, *AA); + } else { + DAG.Combine(false, *AA); + } DOUT << "Optimized lowered selection DAG:\n"; DEBUG(DAG.dump()); @@ -5324,21 +5323,23 @@ DAG.LegalizeTypes(); // Someday even later, enable a dag combine pass here. #endif - if (TimePassesIsEnabled) - RegionTimer = new NamedRegionTimer("DAG Legalization"); - DAG.Legalize(); - if (TimePassesIsEnabled) - delete RegionTimer; + if (TimePassesIsEnabled) { + NamedRegionTimer T("DAG Legalization"); + DAG.Legalize(); + } else { + DAG.Legalize(); + } DOUT << "Legalized selection DAG:\n"; DEBUG(DAG.dump()); // Run the DAG combiner in post-legalize mode. - if (TimePassesIsEnabled) - RegionTimer = new NamedRegionTimer("DAG Combining 2"); - DAG.Combine(true, *AA); - if (TimePassesIsEnabled) - delete RegionTimer; + if (TimePassesIsEnabled) { + NamedRegionTimer T("DAG Combining 2"); + DAG.Combine(true, *AA); + } else { + DAG.Combine(true, *AA); + } DOUT << "Optimized legalized selection DAG:\n"; DEBUG(DAG.dump()); @@ -5350,26 +5351,29 @@ // Third, instruction select all of the operations to machine code, adding the // code to the MachineBasicBlock. - if (TimePassesIsEnabled) - RegionTimer = new NamedRegionTimer("Instruction Selection"); - InstructionSelect(DAG); - if (TimePassesIsEnabled) - delete RegionTimer; + if (TimePassesIsEnabled) { + NamedRegionTimer T("Instruction Selection"); + InstructionSelect(DAG); + } else { + InstructionSelect(DAG); + } // Emit machine code to BB. This can change 'BB' to the last block being // inserted into. - if (TimePassesIsEnabled) - RegionTimer = new NamedRegionTimer("Instruction Scheduling"); - ScheduleAndEmitDAG(DAG); - if (TimePassesIsEnabled) - delete RegionTimer; + if (TimePassesIsEnabled) { + NamedRegionTimer T("Instruction Scheduling"); + ScheduleAndEmitDAG(DAG); + } else { + ScheduleAndEmitDAG(DAG); + } // Perform target specific isel post processing. - if (TimePassesIsEnabled) - RegionTimer = new NamedRegionTimer("Instruction Selection Post Processing"); - InstructionSelectPostProcessing(DAG); - if (TimePassesIsEnabled) - delete RegionTimer; + if (TimePassesIsEnabled) { + NamedRegionTimer T("Instruction Selection Post Processing"); + InstructionSelectPostProcessing(DAG); + } else { + InstructionSelectPostProcessing(DAG); + } DOUT << "Selected machine code:\n"; DEBUG(BB->dump()); From evan.cheng at apple.com Tue Jul 1 13:05:04 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 01 Jul 2008 18:05:04 -0000 Subject: [llvm-commits] [llvm] r52971 - in /llvm/trunk: include/llvm/CodeGen/LinkAllCodegenComponents.h include/llvm/CodeGen/ScheduleDAG.h include/llvm/CodeGen/SchedulerRegistry.h include/llvm/CodeGen/SelectionDAGISel.h lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200807011805.m61I54sx029082@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 1 13:05:03 2008 New Revision: 52971 URL: http://llvm.org/viewvc/llvm-project?rev=52971&view=rev Log: Do not use computationally expensive scheduling heuristics with -fast. Modified: llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h llvm/trunk/include/llvm/CodeGen/SchedulerRegistry.h llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h?rev=52971&r1=52970&r2=52971&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h (original) +++ llvm/trunk/include/llvm/CodeGen/LinkAllCodegenComponents.h Tue Jul 1 13:05:03 2008 @@ -39,10 +39,10 @@ (void) llvm::createOcamlCollector(); (void) llvm::createShadowStackCollector(); - (void) llvm::createBURRListDAGScheduler(NULL, NULL, NULL); - (void) llvm::createTDRRListDAGScheduler(NULL, NULL, NULL); - (void) llvm::createTDListDAGScheduler(NULL, NULL, NULL); - (void) llvm::createDefaultScheduler(NULL, NULL, NULL); + (void) llvm::createBURRListDAGScheduler(NULL, NULL, NULL, false); + (void) llvm::createTDRRListDAGScheduler(NULL, NULL, NULL, false); + (void) llvm::createTDListDAGScheduler(NULL, NULL, NULL, false); + (void) llvm::createDefaultScheduler(NULL, NULL, NULL, false); } } ForceCodegenLinking; // Force link by creating a global definition. Modified: llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h?rev=52971&r1=52970&r2=52971&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/ScheduleDAG.h Tue Jul 1 13:05:03 2008 @@ -396,25 +396,29 @@ /// reduction list scheduler. ScheduleDAG* createBURRListDAGScheduler(SelectionDAGISel *IS, SelectionDAG *DAG, - MachineBasicBlock *BB); + MachineBasicBlock *BB, + bool Fast); /// createTDRRListDAGScheduler - This creates a top down register usage /// reduction list scheduler. ScheduleDAG* createTDRRListDAGScheduler(SelectionDAGISel *IS, SelectionDAG *DAG, - MachineBasicBlock *BB); + MachineBasicBlock *BB, + bool Fast); /// createTDListDAGScheduler - This creates a top-down list scheduler with /// a hazard recognizer. ScheduleDAG* createTDListDAGScheduler(SelectionDAGISel *IS, SelectionDAG *DAG, - MachineBasicBlock *BB); + MachineBasicBlock *BB, + bool Fast); /// createDefaultScheduler - This creates an instruction scheduler appropriate /// for the target. ScheduleDAG* createDefaultScheduler(SelectionDAGISel *IS, SelectionDAG *DAG, - MachineBasicBlock *BB); + MachineBasicBlock *BB, + bool Fast); class SUnitIterator : public forward_iterator { SUnit *Node; Modified: llvm/trunk/include/llvm/CodeGen/SchedulerRegistry.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SchedulerRegistry.h?rev=52971&r1=52970&r2=52971&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SchedulerRegistry.h (original) +++ llvm/trunk/include/llvm/CodeGen/SchedulerRegistry.h Tue Jul 1 13:05:03 2008 @@ -35,7 +35,7 @@ public: typedef ScheduleDAG *(*FunctionPassCtor)(SelectionDAGISel*, SelectionDAG*, - MachineBasicBlock*); + MachineBasicBlock*, bool); static MachinePassRegistry Registry; Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h?rev=52971&r1=52970&r2=52971&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Tue Jul 1 13:05:03 2008 @@ -44,10 +44,11 @@ std::vector TopOrder; unsigned DAGSize; CollectorMetadata *GCI; + bool FastISel; static char ID; - explicit SelectionDAGISel(TargetLowering &tli) : - FunctionPass((intptr_t)&ID), TLI(tli), DAGSize(0), GCI(0) {} + explicit SelectionDAGISel(TargetLowering &tli, bool fast = false) : + FunctionPass((intptr_t)&ID), TLI(tli), DAGSize(0), GCI(0), FastISel(fast) {} TargetLowering &getTargetLowering() { return TLI; } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp?rev=52971&r1=52970&r2=52971&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp Tue Jul 1 13:05:03 2008 @@ -548,7 +548,7 @@ /// recognizer and deletes it when done. ScheduleDAG* llvm::createTDListDAGScheduler(SelectionDAGISel *IS, SelectionDAG *DAG, - MachineBasicBlock *BB) { + MachineBasicBlock *BB, bool Fast) { return new ScheduleDAGList(*DAG, BB, DAG->getTarget(), new LatencyPriorityQueue(), IS->CreateTargetHazardRecognizer()); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=52971&r1=52970&r2=52971&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Tue Jul 1 13:05:03 2008 @@ -58,6 +58,8 @@ /// isBottomUp - This is true if the scheduling problem is bottom-up, false if /// it is top-down. bool isBottomUp; + + bool Fast; /// AvailableQueue - The priority queue to use for the available SUnits. SchedulingPriorityQueue *AvailableQueue; @@ -71,9 +73,9 @@ public: ScheduleDAGRRList(SelectionDAG &dag, MachineBasicBlock *bb, - const TargetMachine &tm, bool isbottomup, - SchedulingPriorityQueue *availqueue) - : ScheduleDAG(dag, bb, tm), isBottomUp(isbottomup), + const TargetMachine &tm, bool isbottomup, bool f, + SchedulingPriorityQueue *availqueue) + : ScheduleDAG(dag, bb, tm), isBottomUp(isbottomup), Fast(f), AvailableQueue(availqueue) { } @@ -144,36 +146,6 @@ /// even after dynamic insertions of new edges. /// This allows a very fast implementation of IsReachable. - - /** - The idea of the algorithm is taken from - "Online algorithms for managing the topological order of - a directed acyclic graph" by David J. Pearce and Paul H.J. Kelly - This is the MNR algorithm, which was first introduced by - A. Marchetti-Spaccamela, U. Nanni and H. Rohnert in - "Maintaining a topological order under edge insertions". - - Short description of the algorithm: - - Topological ordering, ord, of a DAG maps each node to a topological - index so that for all edges X->Y it is the case that ord(X) < ord(Y). - - This means that if there is a path from the node X to the node Z, - then ord(X) < ord(Z). - - This property can be used to check for reachability of nodes: - if Z is reachable from X, then an insertion of the edge Z->X would - create a cycle. - - The algorithm first computes a topological ordering for the DAG by initializing - the Index2Node and Node2Index arrays and then tries to keep the ordering - up-to-date after edge insertions by reordering the DAG. - - On insertion of the edge X->Y, the algorithm first marks by calling DFS the - nodes reachable from Y, and then shifts them using Shift to lie immediately - after X in Index2Node. - */ - /// InitDAGTopologicalSorting - create the initial topological /// ordering from the DAG to be scheduled. void InitDAGTopologicalSorting(); @@ -212,8 +184,10 @@ DEBUG(for (unsigned su = 0, e = SUnits.size(); su != e; ++su) SUnits[su].dumpAll(&DAG)); - CalculateDepths(); - CalculateHeights(); + if (!Fast) { + CalculateDepths(); + CalculateHeights(); + } InitDAGTopologicalSorting(); AvailableQueue->initNodes(SUnits); @@ -225,8 +199,9 @@ ListScheduleTopDown(); AvailableQueue->releaseState(); - - CommuteNodesToReducePressure(); + + if (!Fast) + CommuteNodesToReducePressure(); DOUT << "*** Final schedule ***\n"; DEBUG(dumpSchedule()); @@ -449,6 +424,33 @@ /// InitDAGTopologicalSorting - create the initial topological /// ordering from the DAG to be scheduled. + +/// The idea of the algorithm is taken from +/// "Online algorithms for managing the topological order of +/// a directed acyclic graph" by David J. Pearce and Paul H.J. Kelly +/// This is the MNR algorithm, which was first introduced by +/// A. Marchetti-Spaccamela, U. Nanni and H. Rohnert in +/// "Maintaining a topological order under edge insertions". +/// +/// Short description of the algorithm: +/// +/// Topological ordering, ord, of a DAG maps each node to a topological +/// index so that for all edges X->Y it is the case that ord(X) < ord(Y). +/// +/// This means that if there is a path from the node X to the node Z, +/// then ord(X) < ord(Z). +/// +/// This property can be used to check for reachability of nodes: +/// if Z is reachable from X, then an insertion of the edge Z->X would +/// create a cycle. +/// +/// The algorithm first computes a topological ordering for the DAG by +/// initializing the Index2Node and Node2Index arrays and then tries to keep +/// the ordering up-to-date after edge insertions by reordering the DAG. +/// +/// On insertion of the edge X->Y, the algorithm first marks by calling DFS +/// the nodes reachable from Y, and then shifts them using Shift to lie +/// immediately after X in Index2Node. void ScheduleDAGRRList::InitDAGTopologicalSorting() { unsigned DAGSize = SUnits.size(); std::vector InDegree(DAGSize); @@ -1335,15 +1337,19 @@ const TargetInstrInfo *TII; const TargetRegisterInfo *TRI; ScheduleDAGRRList *scheduleDAG; + + bool Fast; public: explicit BURegReductionPriorityQueue(const TargetInstrInfo *tii, - const TargetRegisterInfo *tri) - : TII(tii), TRI(tri), scheduleDAG(NULL) {} + const TargetRegisterInfo *tri, + bool f) + : TII(tii), TRI(tri), scheduleDAG(NULL), Fast(f) {} void initNodes(std::vector &sunits) { SUnits = &sunits; // Add pseudo dependency edges for two-address nodes. - AddPseudoTwoAddrDeps(); + if (!Fast) + AddPseudoTwoAddrDeps(); // Calculate node priorities. CalculateSethiUllmanNumbers(); } @@ -1821,23 +1827,25 @@ llvm::ScheduleDAG* llvm::createBURRListDAGScheduler(SelectionDAGISel *IS, SelectionDAG *DAG, - MachineBasicBlock *BB) { + MachineBasicBlock *BB, + bool Fast) { const TargetInstrInfo *TII = DAG->getTarget().getInstrInfo(); const TargetRegisterInfo *TRI = DAG->getTarget().getRegisterInfo(); BURegReductionPriorityQueue *priorityQueue = - new BURegReductionPriorityQueue(TII, TRI); + new BURegReductionPriorityQueue(TII, TRI, Fast); ScheduleDAGRRList * scheduleDAG = - new ScheduleDAGRRList(*DAG, BB, DAG->getTarget(), true, priorityQueue); + new ScheduleDAGRRList(*DAG, BB, DAG->getTarget(), true, Fast,priorityQueue); priorityQueue->setScheduleDAG(scheduleDAG); return scheduleDAG; } llvm::ScheduleDAG* llvm::createTDRRListDAGScheduler(SelectionDAGISel *IS, SelectionDAG *DAG, - MachineBasicBlock *BB) { - return new ScheduleDAGRRList(*DAG, BB, DAG->getTarget(), false, + MachineBasicBlock *BB, + bool Fast) { + return new ScheduleDAGRRList(*DAG, BB, DAG->getTarget(), false, Fast, new TDRegReductionPriorityQueue()); } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52971&r1=52970&r2=52971&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Jul 1 13:05:03 2008 @@ -266,15 +266,16 @@ /// for the target. ScheduleDAG* createDefaultScheduler(SelectionDAGISel *IS, SelectionDAG *DAG, - MachineBasicBlock *BB) { + MachineBasicBlock *BB, + bool Fast) { TargetLowering &TLI = IS->getTargetLowering(); if (TLI.getSchedulingPreference() == TargetLowering::SchedulingForLatency) { - return createTDListDAGScheduler(IS, DAG, BB); + return createTDListDAGScheduler(IS, DAG, BB, Fast); } else { assert(TLI.getSchedulingPreference() == TargetLowering::SchedulingForRegPressure && "Unknown sched type!"); - return createBURRListDAGScheduler(IS, DAG, BB); + return createBURRListDAGScheduler(IS, DAG, BB, Fast); } } @@ -5611,7 +5612,7 @@ RegisterScheduler::setDefault(Ctor); } - ScheduleDAG *SL = Ctor(this, &DAG, BB); + ScheduleDAG *SL = Ctor(this, &DAG, BB, FastISel); BB = SL->Run(); if (ViewSUnitDAGs) SL->viewGraph(); Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=52971&r1=52970&r2=52971&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Tue Jul 1 13:05:03 2008 @@ -90,10 +90,6 @@ /// register should set this to true. bool ContainsFPCode; - /// FastISel - Enable fast(er) instruction selection. - /// - bool FastISel; - /// TM - Keep a reference to X86TargetMachine. /// X86TargetMachine &TM; @@ -116,8 +112,8 @@ public: X86DAGToDAGISel(X86TargetMachine &tm, bool fast) - : SelectionDAGISel(X86Lowering), - ContainsFPCode(false), FastISel(fast), TM(tm), + : SelectionDAGISel(X86Lowering, fast), + ContainsFPCode(false), TM(tm), X86Lowering(*TM.getTargetLowering()), Subtarget(&TM.getSubtarget()) {} From gohman at apple.com Tue Jul 1 13:12:31 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 01 Jul 2008 18:12:31 -0000 Subject: [llvm-commits] [llvm] r52972 - /llvm/trunk/include/llvm/Support/Timer.h Message-ID: <200807011812.m61ICV84029363@zion.cs.uiuc.edu> Author: djg Date: Tue Jul 1 13:12:31 2008 New Revision: 52972 URL: http://llvm.org/viewvc/llvm-project?rev=52972&view=rev Log: Fix apostrophes in a comment. Modified: llvm/trunk/include/llvm/Support/Timer.h Modified: llvm/trunk/include/llvm/Support/Timer.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Timer.h?rev=52972&r1=52971&r2=52972&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Timer.h (original) +++ llvm/trunk/include/llvm/Support/Timer.h Tue Jul 1 13:12:31 2008 @@ -30,7 +30,7 @@ /// support it can also keep track of the RSS of the program at various points. /// By default, the Timer will print the amount of time it has captured to /// standard error when the laster timer is destroyed, otherwise it is printed -/// when it's TimerGroup is destroyed. Timer's do not print their information +/// when its TimerGroup is destroyed. Timers do not print their information /// if they are never started. /// class Timer { From dalej at apple.com Tue Jul 1 13:12:59 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 01 Jul 2008 18:12:59 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52973 - /llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Message-ID: <200807011812.m61ICxSi029385@zion.cs.uiuc.edu> Author: johannes Date: Tue Jul 1 13:12:59 2008 New Revision: 52973 URL: http://llvm.org/viewvc/llvm-project?rev=52973&view=rev Log: Maintain size and layout of structs built by ObjC FE as non-fragile ivars are added. Fixes objc.dg/newproperty-retain-3.m obj-c++.dg/newproperty-retain-3.mm Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Modified: llvm-gcc-4.2/trunk/gcc/objc/objc-act.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=52973&r1=52972&r2=52973&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original) +++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Tue Jul 1 13:12:59 2008 @@ -1000,6 +1000,46 @@ = objc_ivar_context = start_class (CLASS_IMPLEMENTATION_TYPE, class, super_class, NULL_TREE); objc_public_flag = 0; +#ifdef ENABLE_LLVM + if (flag_objc_abi == 2) + { + tree record = CLASS_STATIC_TEMPLATE(implementation_template); + if (record) + { + bool changed = false; + tree field; + for (field = TYPE_FIELDS(record); field; field = TREE_CHAIN (field)) + { +#ifdef OBJCPLUS + /* Skip C++ static members, and things that are not fields at all. */ + if (TREE_CODE (field) != FIELD_DECL || TREE_STATIC (field)) + continue; +#endif + /* If we have an embedded base class, and its size doesn't match the + size in the field node, that's because ivars were added to the base + class after the field node was built. We need to update the field + node and re-layout the outer record. */ + if (DECL_ARTIFICIAL (field) && !DECL_NAME (field) + && TREE_CODE (TREE_TYPE (field)) == RECORD_TYPE + && DECL_SIZE (field) && TYPE_SIZE(TREE_TYPE(field)) + && TREE_CODE (DECL_SIZE (field)) == INTEGER_CST + && TREE_CODE (TYPE_SIZE (TREE_TYPE (field))) == INTEGER_CST + && TREE_INT_CST_LOW (DECL_SIZE (field)) + != TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (field)))) + { + DECL_SIZE (field) = TYPE_SIZE (TREE_TYPE (field)); + DECL_SIZE_UNIT (field) = TYPE_SIZE_UNIT (TREE_TYPE (field)); + changed = true; + } + } + if (changed) + { + TYPE_SIZE (record) = 0; + layout_type (record); + } + } + } +#endif } void From gohman at apple.com Tue Jul 1 13:13:58 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 01 Jul 2008 18:13:58 -0000 Subject: [llvm-commits] [llvm] r52974 - /llvm/trunk/include/llvm/CodeGen/MachineFunction.h Message-ID: <200807011813.m61IDwEP029418@zion.cs.uiuc.edu> Author: djg Date: Tue Jul 1 13:13:58 2008 New Revision: 52974 URL: http://llvm.org/viewvc/llvm-project?rev=52974&view=rev Log: Make ilist_traits's Parent member private. Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=52974&r1=52973&r2=52974&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Tue Jul 1 13:13:58 2008 @@ -32,7 +32,7 @@ // ilist_traits template <> -struct ilist_traits { +class ilist_traits { // this is only set by the MachineFunction owning the ilist friend class MachineFunction; MachineFunction* Parent; From evan.cheng at apple.com Tue Jul 1 13:15:04 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 01 Jul 2008 18:15:04 -0000 Subject: [llvm-commits] [llvm] r52975 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200807011815.m61IF4V9029457@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 1 13:15:04 2008 New Revision: 52975 URL: http://llvm.org/viewvc/llvm-project?rev=52975&view=rev Log: Do run ComputeLiveOutVRegInfo with -fast. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=52975&r1=52974&r2=52975&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Jul 1 13:15:04 2008 @@ -5347,7 +5347,7 @@ if (ViewISelDAGs) DAG.viewGraph(); - if (EnableValueProp) // FIXME: Only do this if !fast. + if (!FastISel && EnableValueProp) ComputeLiveOutVRegInfo(DAG); // Third, instruction select all of the operations to machine code, adding the From gohman at apple.com Tue Jul 1 13:15:35 2008 From: gohman at apple.com (Dan Gohman) Date: Tue, 01 Jul 2008 18:15:35 -0000 Subject: [llvm-commits] [llvm] r52976 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/ExecutionEngine/JIT/JIT.cpp lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200807011815.m61IFZHM029481@zion.cs.uiuc.edu> Author: djg Date: Tue Jul 1 13:15:35 2008 New Revision: 52976 URL: http://llvm.org/viewvc/llvm-project?rev=52976&view=rev Log: Prune a few dependencies on MachineFunction.h. Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=52976&r1=52975&r2=52976&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Jul 1 13:15:35 2008 @@ -16,7 +16,6 @@ #ifndef LLVM_TARGET_ASM_INFO_H #define LLVM_TARGET_ASM_INFO_H -#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/Support/DataTypes.h" namespace llvm { Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=52976&r1=52975&r2=52976&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Tue Jul 1 13:15:35 2008 @@ -20,7 +20,6 @@ #include "llvm/Instructions.h" #include "llvm/ModuleProvider.h" #include "llvm/CodeGen/MachineCodeEmitter.h" -#include "llvm/CodeGen/MachineFunction.h" #include "llvm/ExecutionEngine/GenericValue.h" #include "llvm/Support/MutexGuard.h" #include "llvm/System/DynamicLibrary.h" Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=52976&r1=52975&r2=52976&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Tue Jul 1 13:15:35 2008 @@ -25,6 +25,7 @@ #include "llvm/CodeGen/ValueTypes.h" #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineLocation.h" #include "llvm/CodeGen/MachineModuleInfo.h" From clattner at apple.com Tue Jul 1 13:41:07 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 1 Jul 2008 11:41:07 -0700 Subject: [llvm-commits] [llvm] r52967 - in /llvm/trunk: include/llvm/Analysis/Dominators.h include/llvm/Pass.h include/llvm/PassManagers.h lib/Analysis/LoopPass.cpp lib/VMCore/PassManager.cpp In-Reply-To: <200807011744.m61HiOOk028367@zion.cs.uiuc.edu> References: <200807011744.m61HiOOk028367@zion.cs.uiuc.edu> Message-ID: <3820EA81-6A70-4A66-A373-DD7973A9B3D3@apple.com> On Jul 1, 2008, at 10:44 AM, Devang Patel wrote: > @@ -234,6 +234,9 @@ > recordAvailableAnalysis(P); > removeDeadPasses(P, "", ON_LOOP_MSG); > > + // Verify dominator information if it is available and > preserved. > + verifyDomInfo(*LP, F); Please make the comment be something like "if -verify-dom-info is enabled, do verification" to make it more obvious that this only conditionally happens. This is very cool, hopefully it will find lots of bugs :) Thanks Devang, -Chris From evan.cheng at apple.com Tue Jul 1 13:49:06 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 01 Jul 2008 18:49:06 -0000 Subject: [llvm-commits] [llvm] r52977 - /llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Message-ID: <200807011849.m61In6H7030497@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 1 13:49:06 2008 New Revision: 52977 URL: http://llvm.org/viewvc/llvm-project?rev=52977&view=rev Log: DAGSize should not be public. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h?rev=52977&r1=52976&r2=52977&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGISel.h Tue Jul 1 13:49:06 2008 @@ -41,14 +41,13 @@ SelectionDAG *CurDAG; MachineBasicBlock *BB; AliasAnalysis *AA; - std::vector TopOrder; - unsigned DAGSize; CollectorMetadata *GCI; bool FastISel; + std::vector TopOrder; static char ID; explicit SelectionDAGISel(TargetLowering &tli, bool fast = false) : - FunctionPass((intptr_t)&ID), TLI(tli), DAGSize(0), GCI(0), FastISel(fast) {} + FunctionPass((intptr_t)&ID), TLI(tli), GCI(0), FastISel(fast), DAGSize(0) {} TargetLowering &getTargetLowering() { return TLI; } @@ -163,6 +162,10 @@ }; protected: + /// DAGSize - Size of DAG being instruction selected. + /// + unsigned DAGSize; + /// SelectInlineAsmMemoryOperands - Calls to this are automatically generated /// by tblgen. Others should not call it. void SelectInlineAsmMemoryOperands(std::vector &Ops, From duncan.sands at math.u-psud.fr Tue Jul 1 14:24:28 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Tue, 1 Jul 2008 21:24:28 +0200 Subject: [llvm-commits] [llvm] r52967 - in /llvm/trunk: include/llvm/Analysis/Dominators.h include/llvm/Pass.h include/llvm/PassManagers.h lib/Analysis/LoopPass.cpp lib/VMCore/PassManager.cpp In-Reply-To: <200807011744.m61HiOOk028367@zion.cs.uiuc.edu> References: <200807011744.m61HiOOk028367@zion.cs.uiuc.edu> Message-ID: <200807012124.28515.duncan.sands@math.u-psud.fr> Hi Devang, > + /// compare - Return false if the other dominator tree base maches this maches -> matches Occurs again later. > + /// compareDomSet - Return false if two domsets match. Otherwise > + /// return ture; ture; -> true. > + cerr << "----- InValid -----\n"; InValid -> Invalid Occurs again later. > /// Remove Analyss not preserved by Pass P Analyss -> Analysis Ciao, Duncan. From dpatel at apple.com Tue Jul 1 14:50:56 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 01 Jul 2008 19:50:56 -0000 Subject: [llvm-commits] [llvm] r52978 - in /llvm/trunk: include/llvm/Analysis/Dominators.h lib/Analysis/LoopPass.cpp lib/VMCore/PassManager.cpp Message-ID: <200807011950.m61Joue8032494@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 1 14:50:56 2008 New Revision: 52978 URL: http://llvm.org/viewvc/llvm-project?rev=52978&view=rev Log: Fix typos in comments. Thanks for the feedback! Modified: llvm/trunk/include/llvm/Analysis/Dominators.h llvm/trunk/lib/Analysis/LoopPass.cpp llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=52978&r1=52977&r2=52978&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Tue Jul 1 14:50:56 2008 @@ -308,7 +308,7 @@ // FIXME: Should remove this virtual bool runOnFunction(Function &F) { return false; } - /// compare - Return false if the other dominator tree base maches this + /// compare - Return false if the other dominator tree base matches this /// dominator tree base. Otherwise return true. bool compare(DominatorTreeBase &Other) const { @@ -735,7 +735,7 @@ return DT->getRootNode(); } - /// compare - Return false if the other dominator tree maches this + /// compare - Return false if the other dominator tree matches this /// dominator tree. Otherwise return true. inline bool compare(DominatorTree &Other) const { DomTreeNode *R = getRootNode(); @@ -949,7 +949,7 @@ } /// compareDomSet - Return false if two domsets match. Otherwise - /// return ture; + /// return true; bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const { std::set tmpSet; for (DomSetType::const_iterator I = DS2.begin(), Modified: llvm/trunk/lib/Analysis/LoopPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=52978&r1=52977&r2=52978&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopPass.cpp (original) +++ llvm/trunk/lib/Analysis/LoopPass.cpp Tue Jul 1 14:50:56 2008 @@ -234,7 +234,7 @@ recordAvailableAnalysis(P); removeDeadPasses(P, "", ON_LOOP_MSG); - // Verify dominator information if it is available and preserved. + // If dominator information is available then verify the info if requested. verifyDomInfo(*LP, F); if (skipThisLoop) Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=52978&r1=52977&r2=52978&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Tue Jul 1 14:50:56 2008 @@ -42,7 +42,7 @@ None, Arguments, Structure, Executions, Details }; -bool VerifyDomInfo = false; +bool VerifyDomInfo = true; static cl::opt VerifyDomInfoX("verify-dom-info", cl::location(VerifyDomInfo), cl::desc("Verify dominator info (time consuming)")); @@ -631,7 +631,7 @@ cerr << "Pass " << P.getPassName() << "\n"; cerr << "----- Valid -----\n"; OtherDT.dump(); - cerr << "----- InValid -----\n"; + cerr << "----- Invalid -----\n"; DT->dump(); assert (0 && "Invalid dominator info"); } @@ -648,13 +648,13 @@ cerr << "Pass " << P.getPassName() << "\n"; cerr << "----- Valid -----\n"; OtherDF.dump(); - cerr << "----- InValid -----\n"; + cerr << "----- Invalid -----\n"; DF->dump(); assert (0 && "Invalid dominator info"); } } -/// Remove Analyss not preserved by Pass P +/// Remove Analysis not preserved by Pass P void PMDataManager::removeNotPreservedAnalysis(Pass *P) { AnalysisUsage AnUsage; P->getAnalysisUsage(AnUsage); @@ -1250,7 +1250,7 @@ recordAvailableAnalysis(FP); removeDeadPasses(FP, F.getNameStart(), ON_FUNCTION_MSG); - // Verify dominator information if it is available and preserved. + // If dominator information is available then verify the info if requested. verifyDomInfo(*FP, F); } return Changed; From dag at cray.com Tue Jul 1 15:07:25 2008 From: dag at cray.com (David Greene) Date: Tue, 1 Jul 2008 15:07:25 -0500 Subject: [llvm-commits] [llvm] r52970 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp In-Reply-To: <200807011759.m61HxLUr028822@zion.cs.uiuc.edu> References: <200807011759.m61HxLUr028822@zion.cs.uiuc.edu> Message-ID: <200807011507.25337.dag@cray.com> On Tuesday 01 July 2008 12:59, Evan Cheng wrote: > Author: evancheng > Date: Tue Jul 1 12:59:20 2008 > New Revision: 52970 > > URL: http://llvm.org/viewvc/llvm-project?rev=52970&view=rev > Log: > Apply Chris' suggestion. Evan, This is not a very helpful log message. It's very necessary that we be able to do 'svn blame' and friends to find out why a particular piece of code is the way it is. Without a helpful log message, we can't do that. This goes for everyone, Evan just happened to be the one caught today. :) Also, it's a little weird to read replies like, "Thanks to for help on this!" in log messages as one walks through svn history. No harm, really, just a bit jolting at times. -Dave From baldrick at free.fr Tue Jul 1 15:08:54 2008 From: baldrick at free.fr (Duncan Sands) Date: Tue, 01 Jul 2008 20:08:54 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r52979 - /llvm-gcc-4.2/trunk/gcc/tree-inline.c Message-ID: <200807012008.m61K8sn6000560@zion.cs.uiuc.edu> Author: baldrick Date: Tue Jul 1 15:08:54 2008 New Revision: 52979 URL: http://llvm.org/viewvc/llvm-project?rev=52979&view=rev Log: Eliminate a source of gimple temporaries where the definition doesn't dominate all uses (for some reason this is seen on Darwin but not on linux). Modified: llvm-gcc-4.2/trunk/gcc/tree-inline.c Modified: llvm-gcc-4.2/trunk/gcc/tree-inline.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-inline.c?rev=52979&r1=52978&r2=52979&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree-inline.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree-inline.c Tue Jul 1 15:08:54 2008 @@ -1261,6 +1261,16 @@ { var = modify_dest; use = NULL; + + /* LLVM LOCAL begin */ +#ifdef ENABLE_LLVM + /* The return node may not dominate all of its uses. Because of + * this, conservatively don't consider it for SSA form anymore. + */ + if (TREE_CODE (var) == VAR_DECL) + DECL_GIMPLE_FORMAL_TEMP_P (var) = 0; +#endif + /* LLVM LOCAL end */ goto done; } } From dalej at apple.com Tue Jul 1 15:26:02 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 1 Jul 2008 13:26:02 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r52979 - /llvm-gcc-4.2/trunk/gcc/tree-inline.c In-Reply-To: <200807012008.m61K8sn6000560@zion.cs.uiuc.edu> References: <200807012008.m61K8sn6000560@zion.cs.uiuc.edu> Message-ID: <221B4D47-86F6-4DB1-BDE2-DB3519E5D602@apple.com> Thanks! On Jul 1, 2008, at 1:08 PMPDT, Duncan Sands wrote: > Author: baldrick > Date: Tue Jul 1 15:08:54 2008 > New Revision: 52979 > > URL: http://llvm.org/viewvc/llvm-project?rev=52979&view=rev > Log: > Eliminate a source of gimple temporaries where > the definition doesn't dominate all uses (for > some reason this is seen on Darwin but not on > linux). > > Modified: > llvm-gcc-4.2/trunk/gcc/tree-inline.c > > Modified: llvm-gcc-4.2/trunk/gcc/tree-inline.c > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-inline.c?rev=52979&r1=52978&r2=52979&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/tree-inline.c (original) > +++ llvm-gcc-4.2/trunk/gcc/tree-inline.c Tue Jul 1 15:08:54 2008 > @@ -1261,6 +1261,16 @@ > { > var = modify_dest; > use = NULL; > + > + /* LLVM LOCAL begin */ > +#ifdef ENABLE_LLVM > + /* The return node may not dominate all of its uses. Because of > + * this, conservatively don't consider it for SSA form anymore. > + */ > + if (TREE_CODE (var) == VAR_DECL) > + DECL_GIMPLE_FORMAL_TEMP_P (var) = 0; > +#endif > + /* LLVM LOCAL end */ > goto done; > } > } > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Tue Jul 1 15:26:45 2008 From: clattner at apple.com (Chris Lattner) Date: Tue, 1 Jul 2008 13:26:45 -0700 Subject: [llvm-commits] [llvm] r52970 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp In-Reply-To: <200807011507.25337.dag@cray.com> References: <200807011759.m61HxLUr028822@zion.cs.uiuc.edu> <200807011507.25337.dag@cray.com> Message-ID: On Jul 1, 2008, at 1:07 PM, David Greene wrote: > On Tuesday 01 July 2008 12:59, Evan Cheng wrote: >> Author: evancheng >> Date: Tue Jul 1 12:59:20 2008 >> New Revision: 52970 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52970&view=rev >> Log: >> Apply Chris' suggestion. > > Evan, > > This is not a very helpful log message. It's very necessary that we > be > able to do 'svn blame' and friends to find out why a particular > piece of > code is the way it is. Without a helpful log message, we can't do > that. > > This goes for everyone, Evan just happened to be the one caught > today. :) > > Also, it's a little weird to read replies like, "Thanks to > for > help on this!" in log messages as one walks through svn history. > No harm, really, just a bit jolting at times. FWIW, I completely agree, -Chris From isanbard at gmail.com Tue Jul 1 16:00:32 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 01 Jul 2008 21:00:32 -0000 Subject: [llvm-commits] [llvm] r52980 - /llvm/trunk/lib/Target/TargetRegisterInfo.cpp Message-ID: <200807012100.m61L0WdV002119@zion.cs.uiuc.edu> Author: void Date: Tue Jul 1 16:00:31 2008 New Revision: 52980 URL: http://llvm.org/viewvc/llvm-project?rev=52980&view=rev Log: Remove warning about initialization order. Modified: llvm/trunk/lib/Target/TargetRegisterInfo.cpp Modified: llvm/trunk/lib/Target/TargetRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetRegisterInfo.cpp?rev=52980&r1=52979&r2=52980&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetRegisterInfo.cpp Tue Jul 1 16:00:31 2008 @@ -24,8 +24,8 @@ regclass_iterator RCB, regclass_iterator RCE, int CFSO, int CFDO, const unsigned* subregs, const unsigned subregsize) - : Desc(D), NumRegs(NR), RegClassBegin(RCB), RegClassEnd(RCE), - SubregHash(subregs), SubregHashSize(subregsize) { + : SubregHash(subregs), SubregHashSize(subregsize), Desc(D), NumRegs(NR), + RegClassBegin(RCB), RegClassEnd(RCE) { assert(NumRegs < FirstVirtualRegister && "Target has too many physical registers!"); From resistor at mac.com Tue Jul 1 16:16:27 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 01 Jul 2008 21:16:27 -0000 Subject: [llvm-commits] [llvm] r52981 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter.cpp Message-ID: <200807012116.m61LGSDu002560@zion.cs.uiuc.edu> Author: resistor Date: Tue Jul 1 16:16:27 2008 New Revision: 52981 URL: http://llvm.org/viewvc/llvm-project?rev=52981&view=rev Log: Add a version of AsmPrinter::EOL that takes a const char* so that we don't have to do as many implicit std::string constructions. Unfortunately, this doesn't appear to translate to a real speedup in practice. 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=52981&r1=52980&r2=52981&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original) +++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Jul 1 16:16:27 2008 @@ -236,6 +236,7 @@ /// then it will be printed first. Comments should not contain '\n'. void EOL() const; void EOL(const std::string &Comment) const; + void EOL(const char* Comment) const; /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an /// unsigned leb128 value. Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=52981&r1=52980&r2=52981&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Tue Jul 1 16:16:27 2008 @@ -551,6 +551,7 @@ void AsmPrinter::EOL() const { O << '\n'; } + void AsmPrinter::EOL(const std::string &Comment) const { if (AsmVerbose && !Comment.empty()) { O << '\t' @@ -561,6 +562,16 @@ O << '\n'; } +void AsmPrinter::EOL(const char* Comment) const { + if (AsmVerbose && *Comment) { + O << '\t' + << TAI->getCommentString() + << ' ' + << Comment; + } + O << '\n'; +} + /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an /// unsigned leb128 value. void AsmPrinter::EmitULEB128Bytes(unsigned Value) const { From evan.cheng at apple.com Tue Jul 1 16:35:46 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 01 Jul 2008 21:35:46 -0000 Subject: [llvm-commits] [llvm] r52982 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200807012135.m61LZkq3003124@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 1 16:35:46 2008 New Revision: 52982 URL: http://llvm.org/viewvc/llvm-project?rev=52982&view=rev Log: Eliminate a compile time warning. 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=52982&r1=52981&r2=52982&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Jul 1 16:35:46 2008 @@ -4669,7 +4669,7 @@ MVT VT = LHS.getValueType(); if (VT == MVT::f32 || VT == MVT::f64) { // Expand into one or more soft-fp libcall(s). - RTLIB::Libcall LC1, LC2 = RTLIB::UNKNOWN_LIBCALL; + RTLIB::Libcall LC1 = RTLIB::UNKNOWN_LIBCALL, LC2 = RTLIB::UNKNOWN_LIBCALL; switch (cast(CC)->get()) { case ISD::SETEQ: case ISD::SETOEQ: From dpatel at apple.com Tue Jul 1 16:36:11 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 01 Jul 2008 21:36:11 -0000 Subject: [llvm-commits] [llvm] r52983 - /llvm/trunk/lib/VMCore/PassManager.cpp Message-ID: <200807012136.m61LaBFD003148@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 1 16:36:11 2008 New Revision: 52983 URL: http://llvm.org/viewvc/llvm-project?rev=52983&view=rev Log: Disable dom info verifier by default. Modified: llvm/trunk/lib/VMCore/PassManager.cpp Modified: llvm/trunk/lib/VMCore/PassManager.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=52983&r1=52982&r2=52983&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/PassManager.cpp (original) +++ llvm/trunk/lib/VMCore/PassManager.cpp Tue Jul 1 16:36:11 2008 @@ -42,7 +42,7 @@ None, Arguments, Structure, Executions, Details }; -bool VerifyDomInfo = true; +bool VerifyDomInfo = false; static cl::opt VerifyDomInfoX("verify-dom-info", cl::location(VerifyDomInfo), cl::desc("Verify dominator info (time consuming)")); From evan.cheng at apple.com Tue Jul 1 16:36:43 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Jul 2008 14:36:43 -0700 Subject: [llvm-commits] [llvm] r52934 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp In-Reply-To: <200807011012.06224.baldrick@free.fr> References: <200806302233.m5UMXvMY013077@zion.cs.uiuc.edu> <200807011012.06224.baldrick@free.fr> Message-ID: It is strange. I'll fix it as well. Thanks, Evan On Jul 1, 2008, at 1:12 AM, Duncan Sands wrote: >> Suppress compiler warning. > > Thanks! The odd thing is that the same code > can be found in LegalizeDAG.cpp line 4672, but > (presumably) does not generate a warning. > > Ciao, > > Duncan. > >> --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp >> (original) >> +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Mon >> Jun 30 17:33:56 2008 >> @@ -372,7 +372,7 @@ >> assert((VT == MVT::f32 || VT == MVT::f64) && "Unsupported setcc >> type!"); >> >> // Expand into one or more soft-fp libcall(s). >> - RTLIB::Libcall LC1, LC2 = RTLIB::UNKNOWN_LIBCALL; >> + RTLIB::Libcall LC1 = RTLIB::UNKNOWN_LIBCALL, LC2 = >> RTLIB::UNKNOWN_LIBCALL; >> switch (CCCode) { >> case ISD::SETEQ: >> case ISD::SETOEQ: From dpatel at apple.com Tue Jul 1 16:41:01 2008 From: dpatel at apple.com (Devang Patel) Date: Tue, 01 Jul 2008 21:41:01 -0000 Subject: [llvm-commits] [llvm] r52984 - /llvm/trunk/include/llvm/Analysis/Dominators.h Message-ID: <200807012141.m61Lf1Qd003311@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 1 16:41:00 2008 New Revision: 52984 URL: http://llvm.org/viewvc/llvm-project?rev=52984&view=rev Log: Fix dom tree compare. Don't forget to compare children! Modified: llvm/trunk/include/llvm/Analysis/Dominators.h Modified: llvm/trunk/include/llvm/Analysis/Dominators.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=52984&r1=52983&r2=52984&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/Dominators.h (original) +++ llvm/trunk/include/llvm/Analysis/Dominators.h Tue Jul 1 16:41:00 2008 @@ -94,7 +94,7 @@ const std::vector*> &getChildren() const { return Children; } - + DomTreeNodeBase(NodeT *BB, DomTreeNodeBase *iDom) : TheBB(BB), IDom(iDom), DFSNumIn(-1), DFSNumOut(-1) { } @@ -106,7 +106,29 @@ size_t getNumChildren() const { return Children.size(); } + + void clearAllChildren() { + Children.clear(); + } + bool compare(DomTreeNodeBase *Other) { + if (getNumChildren() != Other->getNumChildren()) + return true; + + SmallPtrSet OtherChildren; + for(iterator I = Other->begin(), E = Other->end(); I != E; ++I) { + NodeT *Nd = (*I)->getBlock(); + OtherChildren.insert(Nd); + } + + for(iterator I = begin(), E = end(); I != E; ++I) { + NodeT *N = (*I)->getBlock(); + if (OtherChildren.count(N) == 0) + return true; + } + return false; + } + void setIDom(DomTreeNodeBase *NewIDom) { assert(IDom && "No immediate dominator?"); if (IDom != NewIDom) { @@ -312,36 +334,26 @@ /// dominator tree base. Otherwise return true. bool compare(DominatorTreeBase &Other) const { - // Collect nodes. + const DomTreeNodeMapType &OtherDomTreeNodes = Other.DomTreeNodes; + if (DomTreeNodes.size() != OtherDomTreeNodes.size()) + return true; + SmallPtrSet MyBBs; for (typename DomTreeNodeMapType::const_iterator I = this->DomTreeNodes.begin(), E = this->DomTreeNodes.end(); I != E; ++I) { - const NodeT *BB = I->first; - MyBBs.insert(BB); - } - - SmallPtrSet OtherBBs; - const DomTreeNodeMapType &OtherDomTreeNodes = Other.DomTreeNodes; - for (typename DomTreeNodeMapType::const_iterator - I = OtherDomTreeNodes.begin(), - E = OtherDomTreeNodes.end(); I != E; ++I) { - const NodeT *BB = I->first; - OtherBBs.insert(BB); - } - - if (OtherBBs.size() != MyBBs.size()) - return true; + NodeT *BB = I->first; + typename DomTreeNodeMapType::const_iterator OI = OtherDomTreeNodes.find(BB); + if (OI == OtherDomTreeNodes.end()) + return true; - // Compare node sets. - for (typename SmallPtrSet::const_iterator I = MyBBs.begin(), - E = MyBBs.end(); I != E; ++I) { - const NodeT *BB = *I; - if (OtherBBs.erase(BB) == 0) + DomTreeNodeBase* MyNd = I->second; + DomTreeNodeBase* OtherNd = OI->second; + + if (MyNd->compare(OtherNd)) return true; } - if (!OtherBBs.empty()) - return true; + return false; } From dalej at apple.com Tue Jul 1 16:50:14 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 01 Jul 2008 21:50:14 -0000 Subject: [llvm-commits] [llvm] r52985 - /llvm/trunk/lib/CodeGen/BranchFolding.cpp Message-ID: <200807012150.m61LoE3Q003588@zion.cs.uiuc.edu> Author: johannes Date: Tue Jul 1 16:50:14 2008 New Revision: 52985 URL: http://llvm.org/viewvc/llvm-project?rev=52985&view=rev Log: Fix longstanding thinko: don't exclude predessors of exit blocks from tail merging consideration. Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=52985&r1=52984&r2=52985&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original) +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Tue Jul 1 16:50:14 2008 @@ -697,8 +697,7 @@ // transformations.) for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) { - if (!I->succ_empty() && I->pred_size() >= 2 && - I->pred_size() < TailMergeThreshold) { + if (I->pred_size() >= 2 && I->pred_size() < TailMergeThreshold) { MachineBasicBlock *IBB = I; MachineBasicBlock *PredBB = prior(I); MergePotentials.clear(); From dalej at apple.com Tue Jul 1 16:50:49 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 01 Jul 2008 21:50:49 -0000 Subject: [llvm-commits] [llvm] r52986 - /llvm/trunk/test/CodeGen/X86/2008-02-18-TailMergingBug.ll Message-ID: <200807012150.m61LooAB003618@zion.cs.uiuc.edu> Author: johannes Date: Tue Jul 1 16:50:49 2008 New Revision: 52986 URL: http://llvm.org/viewvc/llvm-project?rev=52986&view=rev Log: Considering predecessors of exit blocks gets us a little more tail merging. Modified: llvm/trunk/test/CodeGen/X86/2008-02-18-TailMergingBug.ll Modified: llvm/trunk/test/CodeGen/X86/2008-02-18-TailMergingBug.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2008-02-18-TailMergingBug.ll?rev=52986&r1=52985&r2=52986&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2008-02-18-TailMergingBug.ll (original) +++ llvm/trunk/test/CodeGen/X86/2008-02-18-TailMergingBug.ll Tue Jul 1 16:50:49 2008 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -stats |& grep {Number of block tails merged} | grep 6 +; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -stats |& grep {Number of block tails merged} | grep 9 ; PR1909 @.str = internal constant [48 x i8] c"transformed bounds: (%.2f, %.2f), (%.2f, %.2f)\0A\00" ; <[48 x i8]*> [#uses=1] From isanbard at gmail.com Tue Jul 1 17:08:01 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 01 Jul 2008 22:08:01 -0000 Subject: [llvm-commits] [llvm] r52987 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200807012208.m61M81Ml004300@zion.cs.uiuc.edu> Author: void Date: Tue Jul 1 17:08:01 2008 New Revision: 52987 URL: http://llvm.org/viewvc/llvm-project?rev=52987&view=rev Log: - Update comments. - Don't use GlobalVariable::LinkageTypes when unsigned works. Modified: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h?rev=52987&r1=52986&r2=52987&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h Tue Jul 1 17:08:01 2008 @@ -7,15 +7,15 @@ // //===----------------------------------------------------------------------===// // -// -// +// Debug descriptor information for a module. +// //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_MACHINEDEBUGINFODESC_H #define LLVM_CODEGEN_MACHINEDEBUGINFODESC_H -#include "llvm/GlobalValue.h" #include "llvm/Support/DataTypes.h" +#include #include namespace llvm { @@ -67,7 +67,7 @@ /// getLinkage - get linkage appropriate for this type of descriptor. /// - virtual GlobalValue::LinkageTypes getLinkage() const; + virtual unsigned getLinkage() const; //===--------------------------------------------------------------------===// // Subclasses should supply the following virtual methods. @@ -111,7 +111,7 @@ /// getLinkage - get linkage appropriate for this type of descriptor. /// - virtual GlobalValue::LinkageTypes getLinkage() const; + virtual unsigned getLinkage() const; /// ApplyToFields - Target the visitor to the fields of the AnchorDesc. /// Modified: llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp?rev=52987&r1=52986&r2=52987&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp Tue Jul 1 17:08:01 2008 @@ -92,8 +92,8 @@ } /// getLinkage - get linkage appropriate for this type of descriptor. -GlobalValue::LinkageTypes DebugInfoDesc::getLinkage() const { - return GlobalValue::InternalLinkage; +unsigned DebugInfoDesc::getLinkage() const { + return (unsigned)GlobalValue::InternalLinkage; } /// ApplyToFields - Target the vistor to the fields of the descriptor. @@ -104,11 +104,10 @@ //===----------------------------------------------------------------------===// AnchorDesc::AnchorDesc() - : DebugInfoDesc(DW_TAG_anchor), AnchorTag(0){ -} + : DebugInfoDesc(DW_TAG_anchor), AnchorTag(0) {} + AnchorDesc::AnchorDesc(AnchoredDesc *D) - : DebugInfoDesc(DW_TAG_anchor), AnchorTag(D->getTag()) { -} + : DebugInfoDesc(DW_TAG_anchor), AnchorTag(D->getTag()) {} // Implement isa/cast/dyncast. bool AnchorDesc::classof(const DebugInfoDesc *D) { @@ -116,8 +115,8 @@ } /// getLinkage - get linkage appropriate for this type of descriptor. -GlobalValue::LinkageTypes AnchorDesc::getLinkage() const { - return GlobalValue::LinkOnceLinkage; +unsigned AnchorDesc::getLinkage() const { + return (unsigned)GlobalValue::LinkOnceLinkage; } /// ApplyToFields - Target the visitor to the fields of the TransUnitDesc. @@ -167,8 +166,7 @@ //===----------------------------------------------------------------------===// AnchoredDesc::AnchoredDesc(unsigned T) - : DebugInfoDesc(T), Anchor(NULL) { -} + : DebugInfoDesc(T), Anchor(NULL) {} /// ApplyToFields - Target the visitor to the fields of the AnchoredDesc. void AnchoredDesc::ApplyToFields(DIVisitor *Visitor) { @@ -180,8 +178,7 @@ CompileUnitDesc::CompileUnitDesc() : AnchoredDesc(DW_TAG_compile_unit), Language(0), FileName(""), - Directory(""), Producer("") { -} + Directory(""), Producer("") {} // Implement isa/cast/dyncast. bool CompileUnitDesc::classof(const DebugInfoDesc *D) { @@ -222,8 +219,7 @@ TypeDesc::TypeDesc(unsigned T) : DebugInfoDesc(T), Context(NULL), Name(""), File(NULL), Line(0), Size(0), - Align(0), Offset(0), Flags(0) { -} + Align(0), Offset(0), Flags(0) {} /// ApplyToFields - Target the visitor to the fields of the TypeDesc. /// @@ -258,8 +254,7 @@ //===----------------------------------------------------------------------===// BasicTypeDesc::BasicTypeDesc() - : TypeDesc(DW_TAG_base_type), Encoding(0) { -} + : TypeDesc(DW_TAG_base_type), Encoding(0) {} // Implement isa/cast/dyncast. bool BasicTypeDesc::classof(const DebugInfoDesc *D) { @@ -287,8 +282,7 @@ //===----------------------------------------------------------------------===// DerivedTypeDesc::DerivedTypeDesc(unsigned T) - : TypeDesc(T), FromType(NULL) { -} + : TypeDesc(T), FromType(NULL) {} // Implement isa/cast/dyncast. bool DerivedTypeDesc::classof(const DebugInfoDesc *D) { @@ -331,8 +325,7 @@ //===----------------------------------------------------------------------===// CompositeTypeDesc::CompositeTypeDesc(unsigned T) - : DerivedTypeDesc(T), Elements() { -} + : DerivedTypeDesc(T), Elements() {} // Implement isa/cast/dyncast. bool CompositeTypeDesc::classof(const DebugInfoDesc *D) { @@ -375,8 +368,7 @@ //===----------------------------------------------------------------------===// SubrangeDesc::SubrangeDesc() - : DebugInfoDesc(DW_TAG_subrange_type), Lo(0), Hi(0) { -} + : DebugInfoDesc(DW_TAG_subrange_type), Lo(0), Hi(0) {} // Implement isa/cast/dyncast. bool SubrangeDesc::classof(const DebugInfoDesc *D) { @@ -403,8 +395,7 @@ //===----------------------------------------------------------------------===// EnumeratorDesc::EnumeratorDesc() - : DebugInfoDesc(DW_TAG_enumerator), Name(""), Value(0) { -} + : DebugInfoDesc(DW_TAG_enumerator), Name(""), Value(0) {} // Implement isa/cast/dyncast. bool EnumeratorDesc::classof(const DebugInfoDesc *D) { @@ -431,8 +422,8 @@ //===----------------------------------------------------------------------===// VariableDesc::VariableDesc(unsigned T) - : DebugInfoDesc(T), Context(NULL), Name(""), File(NULL), Line(0), TyDesc(0) { -} + : DebugInfoDesc(T), Context(NULL), Name(""), File(NULL), Line(0), TyDesc(0) +{} // Implement isa/cast/dyncast. bool VariableDesc::classof(const DebugInfoDesc *D) { @@ -474,8 +465,7 @@ GlobalDesc::GlobalDesc(unsigned T) : AnchoredDesc(T), Context(0), Name(""), FullName(""), LinkageName(""), - File(NULL), Line(0), TyDesc(NULL), IsStatic(false), IsDefinition(false) { -} + File(NULL), Line(0), TyDesc(NULL), IsStatic(false), IsDefinition(false) {} /// ApplyToFields - Target the visitor to the fields of the global. /// @@ -495,8 +485,7 @@ //===----------------------------------------------------------------------===// GlobalVariableDesc::GlobalVariableDesc() - : GlobalDesc(DW_TAG_variable), Global(NULL) { -} + : GlobalDesc(DW_TAG_variable), Global(NULL) {} // Implement isa/cast/dyncast. bool GlobalVariableDesc::classof(const DebugInfoDesc *D) { @@ -530,8 +519,7 @@ //===----------------------------------------------------------------------===// SubprogramDesc::SubprogramDesc() - : GlobalDesc(DW_TAG_subprogram) { -} + : GlobalDesc(DW_TAG_subprogram) {} // Implement isa/cast/dyncast. bool SubprogramDesc::classof(const DebugInfoDesc *D) { @@ -563,8 +551,7 @@ //===----------------------------------------------------------------------===// BlockDesc::BlockDesc() - : DebugInfoDesc(DW_TAG_lexical_block), Context(NULL) { -} + : DebugInfoDesc(DW_TAG_lexical_block), Context(NULL) {} // Implement isa/cast/dyncast. bool BlockDesc::classof(const DebugInfoDesc *D) { Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=52987&r1=52986&r2=52987&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Tue Jul 1 17:08:01 2008 @@ -586,8 +586,10 @@ const StructType *Ty = getTagType(DD); // Create the GlobalVariable early to prevent infinite recursion. - GlobalVariable *GV = new GlobalVariable(Ty, true, DD->getLinkage(), - NULL, DD->getDescString(), M); + GlobalVariable *GV = + new GlobalVariable(Ty, true, + (GlobalValue::LinkageTypes)DD->getLinkage(), + NULL, DD->getDescString(), M); GV->setSection("llvm.metadata"); // Insert new GlobalVariable in DescGlobals map. From dalej at apple.com Tue Jul 1 17:14:32 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 1 Jul 2008 15:14:32 -0700 Subject: [llvm-commits] [llvm] r52987 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp In-Reply-To: <200807012208.m61M81Ml004300@zion.cs.uiuc.edu> References: <200807012208.m61M81Ml004300@zion.cs.uiuc.edu> Message-ID: <653051EC-EFF8-4688-92B1-40867AD5C6CE@apple.com> On Jul 1, 2008, at 3:08 PMPDT, Bill Wendling wrote: > - Don't use GlobalVariable::LinkageTypes when unsigned works. Is there some reason we need this? I strongly prefer the enum if it works. Makes things easier to read and harder to abuse. From isanbard at gmail.com Tue Jul 1 17:16:15 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 1 Jul 2008 15:16:15 -0700 Subject: [llvm-commits] [llvm] r52987 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp In-Reply-To: <653051EC-EFF8-4688-92B1-40867AD5C6CE@apple.com> References: <200807012208.m61M81Ml004300@zion.cs.uiuc.edu> <653051EC-EFF8-4688-92B1-40867AD5C6CE@apple.com> Message-ID: <16e5fdf90807011516k3e54849fl58e4fb7f1472ee41@mail.gmail.com> On Tue, Jul 1, 2008 at 3:14 PM, Dale Johannesen wrote: > > On Jul 1, 2008, at 3:08 PMPDT, Bill Wendling wrote: >> - Don't use GlobalVariable::LinkageTypes when unsigned works. > > Is there some reason we need this? I strongly prefer the enum if it > works. > Makes things easier to read and harder to abuse. > It required pulling in the GlobalVariable.h header into the MachineDebugInfoDesc.h file. That's the only reason I can think of. -bw From evan.cheng at apple.com Tue Jul 1 17:21:21 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 01 Jul 2008 22:21:21 -0000 Subject: [llvm-commits] [llvm] r52988 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp Message-ID: <200807012221.m61MLLwF004717@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 1 17:21:21 2008 New Revision: 52988 URL: http://llvm.org/viewvc/llvm-project?rev=52988&view=rev Log: Simplify addRegisterKilled and addRegisterDead. Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=52988&r1=52987&r2=52988&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Jul 1 17:21:21 2008 @@ -738,7 +738,7 @@ const TargetRegisterInfo *RegInfo, bool AddIfNotFound) { bool isPhysReg = TargetRegisterInfo::isPhysicalRegister(IncomingReg); - bool Found = false; + bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); SmallVector DeadOps; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); @@ -749,15 +749,15 @@ continue; if (Reg == IncomingReg) { - if (!Found) // One kill of reg per instruction. - MO.setIsKill(); - Found = true; - } else if (isPhysReg && MO.isKill() && - TargetRegisterInfo::isPhysicalRegister(Reg)) { + MO.setIsKill(); + return true; + } + if (hasAliases && MO.isKill() && + TargetRegisterInfo::isPhysicalRegister(Reg)) { // A super-register kill already exists. if (RegInfo->isSuperRegister(IncomingReg, Reg)) - Found = true; - else if (RegInfo->isSubRegister(IncomingReg, Reg)) + return true; + if (RegInfo->isSubRegister(IncomingReg, Reg)) DeadOps.push_back(i); } } @@ -774,14 +774,14 @@ // If not found, this means an alias of one of the operands is killed. Add a // new implicit operand if required. - if (!Found && AddIfNotFound) { + if (AddIfNotFound) { addOperand(MachineOperand::CreateReg(IncomingReg, false /*IsDef*/, true /*IsImp*/, true /*IsKill*/)); return true; } - return Found; + return false; } bool MachineInstr::addRegisterDead(unsigned IncomingReg, @@ -789,7 +789,6 @@ bool AddIfNotFound) { bool isPhysReg = TargetRegisterInfo::isPhysicalRegister(IncomingReg); bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); - bool Found = false; SmallVector DeadOps; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); @@ -798,13 +797,14 @@ unsigned Reg = MO.getReg(); if (Reg == IncomingReg) { MO.setIsDead(); - Found = true; - } else if (hasAliases && MO.isDead() && - TargetRegisterInfo::isPhysicalRegister(Reg)) { + return true; + } + if (hasAliases && MO.isDead() && + TargetRegisterInfo::isPhysicalRegister(Reg)) { // There exists a super-register that's marked dead. if (RegInfo->isSuperRegister(IncomingReg, Reg)) - Found = true; - else if (RegInfo->isSubRegister(IncomingReg, Reg)) + return true; + if (RegInfo->isSubRegister(IncomingReg, Reg)) DeadOps.push_back(i); } } @@ -821,13 +821,13 @@ // If not found, this means an alias of one of the operand is dead. Add a // new implicit operand. - if (!Found && AddIfNotFound) { + if (AddIfNotFound) { addOperand(MachineOperand::CreateReg(IncomingReg, true/*IsDef*/, true/*IsImp*/,false/*IsKill*/, true/*IsDead*/)); return true; } - return Found; + return false; } /// copyKillDeadInfo - copies killed/dead information from one instr to another From kremenek at apple.com Tue Jul 1 17:30:13 2008 From: kremenek at apple.com (Ted Kremenek) Date: Tue, 01 Jul 2008 22:30:13 -0000 Subject: [llvm-commits] [llvm] r52989 - /llvm/trunk/include/llvm/ADT/FoldingSet.h Message-ID: <200807012230.m61MUEon004980@zion.cs.uiuc.edu> Author: kremenek Date: Tue Jul 1 17:30:13 2008 New Revision: 52989 URL: http://llvm.org/viewvc/llvm-project?rev=52989&view=rev Log: Added partial specialization of FoldingSetTrait for pointers. Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=52989&r1=52988&r2=52989&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/FoldingSet.h (original) +++ llvm/trunk/include/llvm/ADT/FoldingSet.h Tue Jul 1 17:30:13 2008 @@ -426,6 +426,18 @@ operator T&() { return data; } operator const T&() const { return data; } +}; + +//===----------------------------------------------------------------------===// +// Partial specializations of FoldingSetTrait. + +template struct FoldingSetTrait { + static inline void Profile(const T* X, FoldingSetNodeID& ID) { + ID.AddPointer(X); + } + static inline void Profile(T* X, FoldingSetNodeID& ID) { + ID.AddPointer(X); + } }; } // End of namespace llvm. From resistor at mac.com Tue Jul 1 17:31:32 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 01 Jul 2008 15:31:32 -0700 Subject: [llvm-commits] [llvm] r52988 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp In-Reply-To: <200807012221.m61MLLwF004717@zion.cs.uiuc.edu> References: <200807012221.m61MLLwF004717@zion.cs.uiuc.edu> Message-ID: Is there any speedup associated with this? --Owen On Jul 1, 2008, at 3:21 PM, Evan Cheng wrote: > Author: evancheng > Date: Tue Jul 1 17:21:21 2008 > New Revision: 52988 > > URL: http://llvm.org/viewvc/llvm-project?rev=52988&view=rev > Log: > Simplify addRegisterKilled and addRegisterDead. > > Modified: > llvm/trunk/lib/CodeGen/MachineInstr.cpp > > Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=52988&r1=52987&r2=52988&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) > +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Jul 1 17:21:21 2008 > @@ -738,7 +738,7 @@ > const TargetRegisterInfo > *RegInfo, > bool AddIfNotFound) { > bool isPhysReg = > TargetRegisterInfo::isPhysicalRegister(IncomingReg); > - bool Found = false; > + bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); > SmallVector DeadOps; > for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { > MachineOperand &MO = getOperand(i); > @@ -749,15 +749,15 @@ > continue; > > if (Reg == IncomingReg) { > - if (!Found) // One kill of reg per instruction. > - MO.setIsKill(); > - Found = true; > - } else if (isPhysReg && MO.isKill() && > - TargetRegisterInfo::isPhysicalRegister(Reg)) { > + MO.setIsKill(); > + return true; > + } > + if (hasAliases && MO.isKill() && > + TargetRegisterInfo::isPhysicalRegister(Reg)) { > // A super-register kill already exists. > if (RegInfo->isSuperRegister(IncomingReg, Reg)) > - Found = true; > - else if (RegInfo->isSubRegister(IncomingReg, Reg)) > + return true; > + if (RegInfo->isSubRegister(IncomingReg, Reg)) > DeadOps.push_back(i); > } > } > @@ -774,14 +774,14 @@ > > // If not found, this means an alias of one of the operands is > killed. Add a > // new implicit operand if required. > - if (!Found && AddIfNotFound) { > + if (AddIfNotFound) { > addOperand(MachineOperand::CreateReg(IncomingReg, > false /*IsDef*/, > true /*IsImp*/, > true /*IsKill*/)); > return true; > } > - return Found; > + return false; > } > > bool MachineInstr::addRegisterDead(unsigned IncomingReg, > @@ -789,7 +789,6 @@ > bool AddIfNotFound) { > bool isPhysReg = > TargetRegisterInfo::isPhysicalRegister(IncomingReg); > bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); > - bool Found = false; > SmallVector DeadOps; > for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { > MachineOperand &MO = getOperand(i); > @@ -798,13 +797,14 @@ > unsigned Reg = MO.getReg(); > if (Reg == IncomingReg) { > MO.setIsDead(); > - Found = true; > - } else if (hasAliases && MO.isDead() && > - TargetRegisterInfo::isPhysicalRegister(Reg)) { > + return true; > + } > + if (hasAliases && MO.isDead() && > + TargetRegisterInfo::isPhysicalRegister(Reg)) { > // There exists a super-register that's marked dead. > if (RegInfo->isSuperRegister(IncomingReg, Reg)) > - Found = true; > - else if (RegInfo->isSubRegister(IncomingReg, Reg)) > + return true; > + if (RegInfo->isSubRegister(IncomingReg, Reg)) > DeadOps.push_back(i); > } > } > @@ -821,13 +821,13 @@ > > // If not found, this means an alias of one of the operand is > dead. Add a > // new implicit operand. > - if (!Found && AddIfNotFound) { > + if (AddIfNotFound) { > addOperand(MachineOperand::CreateReg(IncomingReg, true/*IsDef*/, > true/*IsImp*/,false/ > *IsKill*/, > true/*IsDead*/)); > return true; > } > - return Found; > + return false; > } > > /// copyKillDeadInfo - copies killed/dead information from one instr > to another > > > _______________________________________________ > 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 Tue Jul 1 17:33:42 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 1 Jul 2008 15:33:42 -0700 Subject: [llvm-commits] [llvm] r52988 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp In-Reply-To: References: <200807012221.m61MLLwF004717@zion.cs.uiuc.edu> Message-ID: <72A6136F-995D-49A9-96A4-2885FACAA85E@apple.com> Not noticeable. Evan On Jul 1, 2008, at 3:31 PM, Owen Anderson wrote: > Is there any speedup associated with this? > > --Owen > > On Jul 1, 2008, at 3:21 PM, Evan Cheng wrote: > >> Author: evancheng >> Date: Tue Jul 1 17:21:21 2008 >> New Revision: 52988 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=52988&view=rev >> Log: >> Simplify addRegisterKilled and addRegisterDead. >> >> Modified: >> llvm/trunk/lib/CodeGen/MachineInstr.cpp >> >> Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=52988&r1=52987&r2=52988&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) >> +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Jul 1 17:21:21 2008 >> @@ -738,7 +738,7 @@ >> const TargetRegisterInfo >> *RegInfo, >> bool AddIfNotFound) { >> bool isPhysReg = >> TargetRegisterInfo::isPhysicalRegister(IncomingReg); >> - bool Found = false; >> + bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); >> SmallVector DeadOps; >> for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { >> MachineOperand &MO = getOperand(i); >> @@ -749,15 +749,15 @@ >> continue; >> >> if (Reg == IncomingReg) { >> - if (!Found) // One kill of reg per instruction. >> - MO.setIsKill(); >> - Found = true; >> - } else if (isPhysReg && MO.isKill() && >> - TargetRegisterInfo::isPhysicalRegister(Reg)) { >> + MO.setIsKill(); >> + return true; >> + } >> + if (hasAliases && MO.isKill() && >> + TargetRegisterInfo::isPhysicalRegister(Reg)) { >> // A super-register kill already exists. >> if (RegInfo->isSuperRegister(IncomingReg, Reg)) >> - Found = true; >> - else if (RegInfo->isSubRegister(IncomingReg, Reg)) >> + return true; >> + if (RegInfo->isSubRegister(IncomingReg, Reg)) >> DeadOps.push_back(i); >> } >> } >> @@ -774,14 +774,14 @@ >> >> // If not found, this means an alias of one of the operands is >> killed. Add a >> // new implicit operand if required. >> - if (!Found && AddIfNotFound) { >> + if (AddIfNotFound) { >> addOperand(MachineOperand::CreateReg(IncomingReg, >> false /*IsDef*/, >> true /*IsImp*/, >> true /*IsKill*/)); >> return true; >> } >> - return Found; >> + return false; >> } >> >> bool MachineInstr::addRegisterDead(unsigned IncomingReg, >> @@ -789,7 +789,6 @@ >> bool AddIfNotFound) { >> bool isPhysReg = >> TargetRegisterInfo::isPhysicalRegister(IncomingReg); >> bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); >> - bool Found = false; >> SmallVector DeadOps; >> for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { >> MachineOperand &MO = getOperand(i); >> @@ -798,13 +797,14 @@ >> unsigned Reg = MO.getReg(); >> if (Reg == IncomingReg) { >> MO.setIsDead(); >> - Found = true; >> - } else if (hasAliases && MO.isDead() && >> - TargetRegisterInfo::isPhysicalRegister(Reg)) { >> + return true; >> + } >> + if (hasAliases && MO.isDead() && >> + TargetRegisterInfo::isPhysicalRegister(Reg)) { >> // There exists a super-register that's marked dead. >> if (RegInfo->isSuperRegister(IncomingReg, Reg)) >> - Found = true; >> - else if (RegInfo->isSubRegister(IncomingReg, Reg)) >> + return true; >> + if (RegInfo->isSubRegister(IncomingReg, Reg)) >> DeadOps.push_back(i); >> } >> } >> @@ -821,13 +821,13 @@ >> >> // If not found, this means an alias of one of the operand is >> dead. Add a >> // new implicit operand. >> - if (!Found && AddIfNotFound) { >> + if (AddIfNotFound) { >> addOperand(MachineOperand::CreateReg(IncomingReg, true/*IsDef*/, >> true/*IsImp*/,false/ >> *IsKill*/, >> true/*IsDead*/)); >> return true; >> } >> - return Found; >> + return false; >> } >> >> /// copyKillDeadInfo - copies killed/dead information from one instr >> to another >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Tue Jul 1 17:34:11 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 01 Jul 2008 22:34:11 -0000 Subject: [llvm-commits] [llvm] r52990 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200807012234.m61MYCQR005079@zion.cs.uiuc.edu> Author: resistor Date: Tue Jul 1 17:34:11 2008 New Revision: 52990 URL: http://llvm.org/viewvc/llvm-project?rev=52990&view=rev Log: No need to use std::distance. We can just count the number of operands much more cheaply. 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=52990&r1=52989&r2=52990&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Jul 1 17:34:11 2008 @@ -527,13 +527,16 @@ // Next, brutally remove the operand list. This is safe to do, as there are // no cycles in the graph. + unsigned op_num = 0; for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I) { SDNode *Operand = I->getVal(); - Operand->removeUser(std::distance(N->op_begin(), I), N); + Operand->removeUser(op_num, N); // Now that we removed this operand, see if there are no uses of it left. if (Operand->use_empty()) DeadNodes.push_back(Operand); + + op_num++; } if (N->OperandsNeedDelete) { delete[] N->OperandList; From evan.cheng at apple.com Tue Jul 1 18:18:30 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 01 Jul 2008 23:18:30 -0000 Subject: [llvm-commits] [llvm] r52992 - in /llvm/trunk: include/llvm/Target/TargetOptions.h lib/CodeGen/AsmPrinter.cpp lib/CodeGen/DwarfWriter.cpp lib/Target/TargetMachine.cpp Message-ID: <200807012318.m61NIUNZ006326@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 1 18:18:29 2008 New Revision: 52992 URL: http://llvm.org/viewvc/llvm-project?rev=52992&view=rev Log: Avoid creating expensive comment string if it's not going to be printed. Modified: llvm/trunk/include/llvm/Target/TargetOptions.h llvm/trunk/lib/CodeGen/AsmPrinter.cpp llvm/trunk/lib/CodeGen/DwarfWriter.cpp llvm/trunk/lib/Target/TargetMachine.cpp Modified: llvm/trunk/include/llvm/Target/TargetOptions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=52992&r1=52991&r2=52992&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetOptions.h (original) +++ llvm/trunk/include/llvm/Target/TargetOptions.h Tue Jul 1 18:18:29 2008 @@ -93,6 +93,10 @@ /// RealignStack - This flag indicates, whether stack should be automatically /// realigned, if needed. extern bool RealignStack; + + /// VerboseAsm - When this flag is set, the asm printer prints additional + /// comments to asm directives. + extern bool VerboseAsm; } // End llvm namespace #endif Modified: llvm/trunk/lib/CodeGen/AsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter.cpp?rev=52992&r1=52991&r2=52992&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Tue Jul 1 18:18:29 2008 @@ -21,7 +21,6 @@ #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h" -#include "llvm/Support/CommandLine.h" #include "llvm/Support/Mangler.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Streams.h" @@ -29,14 +28,12 @@ #include "llvm/Target/TargetData.h" #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetOptions.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/ADT/SmallPtrSet.h" #include using namespace llvm; -static cl::opt -AsmVerbose("asm-verbose", cl::Hidden, cl::desc("Add comments to directives.")); - char AsmPrinter::ID = 0; AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm, const TargetAsmInfo *T) @@ -553,7 +550,7 @@ } void AsmPrinter::EOL(const std::string &Comment) const { - if (AsmVerbose && !Comment.empty()) { + if (VerboseAsm && !Comment.empty()) { O << '\t' << TAI->getCommentString() << ' ' @@ -563,7 +560,7 @@ } void AsmPrinter::EOL(const char* Comment) const { - if (AsmVerbose && *Comment) { + if (VerboseAsm && *Comment) { O << '\t' << TAI->getCommentString() << ' ' Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=52992&r1=52991&r2=52992&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Tue Jul 1 18:18:29 2008 @@ -2076,11 +2076,15 @@ // Emit the code (index) for the abbreviation. Asm->EmitULEB128Bytes(AbbrevNumber); - Asm->EOL(std::string("Abbrev [" + - utostr(AbbrevNumber) + - "] 0x" + utohexstr(Die->getOffset()) + - ":0x" + utohexstr(Die->getSize()) + " " + - TagString(Abbrev->getTag()))); + + if (VerboseAsm) + Asm->EOL(std::string("Abbrev [" + + utostr(AbbrevNumber) + + "] 0x" + utohexstr(Die->getOffset()) + + ":0x" + utohexstr(Die->getSize()) + " " + + TagString(Abbrev->getTag()))); + else + Asm->EOL(); SmallVector &Values = Die->getValues(); const SmallVector &AbbrevData = Abbrev->getData(); @@ -2297,8 +2301,7 @@ Asm->EmitInt8(1); Asm->EOL("DW_LNS_fixed_advance_pc arg count"); const UniqueVector &Directories = MMI->getDirectories(); - const UniqueVector - &SourceFiles = MMI->getSourceFiles(); + const UniqueVector &SourceFiles = MMI->getSourceFiles(); // Emit directories. for (unsigned DirectoryID = 1, NDID = Directories.size(); @@ -2328,8 +2331,11 @@ for (unsigned j = 0, M = SectionSourceLines.size(); j < M; ++j) { // Isolate current sections line info. const std::vector &LineInfos = SectionSourceLines[j]; - - Asm->EOL(std::string("Section ") + SectionMap[j + 1]); + + if (VerboseAsm) + Asm->EOL(std::string("Section ") + SectionMap[j + 1]); + else + Asm->EOL(); // Dwarf assumes we start with first line of first source file. unsigned Source = 1; @@ -2344,10 +2350,13 @@ unsigned SourceID = LineInfo.getSourceID(); const SourceFileInfo &SourceFile = SourceFiles[SourceID]; unsigned DirectoryID = SourceFile.getDirectoryID(); - Asm->EOL(Directories[DirectoryID] - + SourceFile.getName() - + ":" - + utostr_32(LineInfo.getLine())); + if (VerboseAsm) + Asm->EOL(Directories[DirectoryID] + + SourceFile.getName() + + ":" + + utostr_32(LineInfo.getLine())); + else + Asm->EOL(); // Define the line address. Asm->EmitInt8(0); Asm->EOL("Extended Op"); Modified: llvm/trunk/lib/Target/TargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=52992&r1=52991&r2=52992&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetMachine.cpp (original) +++ llvm/trunk/lib/Target/TargetMachine.cpp Tue Jul 1 18:18:29 2008 @@ -36,8 +36,9 @@ CodeModel::Model CMModel; bool PerformTailCallOpt; bool OptimizeForSize; - bool RealignStack; unsigned StackAlignment; + bool RealignStack; + bool VerboseAsm; } static cl::opt PrintCode("print-machineinstrs", @@ -138,17 +139,23 @@ cl::location(OptimizeForSize), cl::init(false)); +static cl::opt +OverrideStackAlignment("stack-alignment", + cl::desc("Override default stack alignment"), + cl::location(StackAlignment), + cl::init(0)); + static cl::opt EnableRealignStack("realign-stack", cl::desc("Realign stack if needed"), cl::location(RealignStack), cl::init(true)); -static cl::opt -OverrideStackAlignment("stack-alignment", - cl::desc("Override default stack alignment"), - cl::location(StackAlignment), - cl::init(0)); +static cl::opt +AsmVerbose("asm-verbose", cl::desc("Add comments to directives."), + cl::location(VerboseAsm), + cl::init(false)); + //--------------------------------------------------------------------------- // TargetMachine Class From isanbard at gmail.com Tue Jul 1 18:34:49 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 01 Jul 2008 23:34:49 -0000 Subject: [llvm-commits] [llvm] r52994 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp Message-ID: <200807012334.m61NYnqf006834@zion.cs.uiuc.edu> Author: void Date: Tue Jul 1 18:34:48 2008 New Revision: 52994 URL: http://llvm.org/viewvc/llvm-project?rev=52994&view=rev Log: Darwin doesn't need exception handling information for the "move" info when debug information is being output, because it's leet! Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/CodeGen/DwarfWriter.cpp llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp llvm/trunk/lib/Target/TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=52994&r1=52993&r2=52994&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Jul 1 18:34:48 2008 @@ -412,7 +412,11 @@ /// DwarfExceptionSection - Section directive for Exception table. /// const char *DwarfExceptionSection; // Defaults to ".gcc_except_table". - + + /// DebugInfoRequireFrameMoveInfo - Does debugging info require frame move + /// info. + /// + bool DebugInfoRequireFrameMoveInfo; // Defaults to "true" //===--- CBE Asm Translation Table -----------------------------------===// @@ -699,6 +703,9 @@ const char *getDwarfExceptionSection() const { return DwarfExceptionSection; } + bool doesDebugInfoRequireFrameMoveInfo() const { + return DebugInfoRequireFrameMoveInfo; + } const char *const *getAsmCBE() const { return AsmTransCBE; } Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=52994&r1=52993&r2=52994&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Tue Jul 1 18:34:48 2008 @@ -827,7 +827,7 @@ /// AsmPrinter *Asm; - /// TAI - Target Asm Printer. + /// TAI - Target asm information. const TargetAsmInfo *TAI; /// TD - Target data. @@ -3511,7 +3511,7 @@ shouldEmitTable = true; // See if we need frame move info. - if (MMI->hasDebugInfo() || + if ((MMI->hasDebugInfo() && TAI->doesDebugInfoRequireFrameMoveInfo()) || !MF->getFunction()->doesNotThrow() || UnwindTablesMandatory) shouldEmitMoves = true; Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=52994&r1=52993&r2=52994&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Tue Jul 1 18:34:48 2008 @@ -66,6 +66,7 @@ DwarfEHFrameSection = ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support"; DwarfExceptionSection = ".section __DATA,__gcc_except_tab"; + DebugInfoRequireFrameMoveInfo = false; GlobalEHDirective = "\t.globl\t"; SupportsWeakOmittedEHFrame = false; Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=52994&r1=52993&r2=52994&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Tue Jul 1 18:34:48 2008 @@ -111,6 +111,7 @@ DwarfMacInfoSection(".debug_macinfo"), DwarfEHFrameSection(".eh_frame"), DwarfExceptionSection(".gcc_except_table"), + DebugInfoRequireFrameMoveInfo(true), AsmTransCBE(0) { } Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=52994&r1=52993&r2=52994&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Tue Jul 1 18:34:48 2008 @@ -124,6 +124,7 @@ DwarfEHFrameSection = ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support"; DwarfExceptionSection = ".section __DATA,__gcc_except_tab"; + DebugInfoRequireFrameMoveInfo = false; break; case X86Subtarget::isELF: From resistor at mac.com Tue Jul 1 18:49:59 2008 From: resistor at mac.com (Owen Anderson) Date: Tue, 01 Jul 2008 23:49:59 -0000 Subject: [llvm-commits] [llvm] r52995 - in /llvm/trunk: include/llvm/ADT/FoldingSet.h lib/Support/FoldingSet.cpp Message-ID: <200807012349.m61NnxEc007272@zion.cs.uiuc.edu> Author: resistor Date: Tue Jul 1 18:49:59 2008 New Revision: 52995 URL: http://llvm.org/viewvc/llvm-project?rev=52995&view=rev Log: Add a version of AddString that takes a const char* so we can avoid extraneous conversions to std::string. Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h llvm/trunk/lib/Support/FoldingSet.cpp Modified: llvm/trunk/include/llvm/ADT/FoldingSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/FoldingSet.h?rev=52995&r1=52994&r2=52995&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/FoldingSet.h (original) +++ llvm/trunk/include/llvm/ADT/FoldingSet.h Tue Jul 1 18:49:59 2008 @@ -220,6 +220,7 @@ void AddFloat(float F); void AddDouble(double D); void AddString(const std::string &String); + void AddString(const char* String); template inline void Add(const T& x) { FoldingSetTrait::Profile(x, *this); } Modified: llvm/trunk/lib/Support/FoldingSet.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FoldingSet.cpp?rev=52995&r1=52994&r2=52995&view=diff ============================================================================== --- llvm/trunk/lib/Support/FoldingSet.cpp (original) +++ llvm/trunk/lib/Support/FoldingSet.cpp Tue Jul 1 18:49:59 2008 @@ -57,6 +57,44 @@ void FoldingSetNodeID::AddDouble(double D) { AddInteger(DoubleToBits(D)); } + +void FoldingSetNodeID::AddString(const char *String) { + unsigned Size = static_cast(strlen(String)); + Bits.push_back(Size); + if (!Size) return; + + unsigned Units = Size / 4; + unsigned Pos = 0; + const unsigned *Base = (const unsigned *)String; + + // If the string is aligned do a bulk transfer. + if (!((intptr_t)Base & 3)) { + Bits.append(Base, Base + Units); + Pos = (Units + 1) * 4; + } else { + // Otherwise do it the hard way. + for ( Pos += 4; Pos <= Size; Pos += 4) { + unsigned V = ((unsigned char)String[Pos - 4] << 24) | + ((unsigned char)String[Pos - 3] << 16) | + ((unsigned char)String[Pos - 2] << 8) | + (unsigned char)String[Pos - 1]; + Bits.push_back(V); + } + } + + // With the leftover bits. + unsigned V = 0; + // Pos will have overshot size by 4 - #bytes left over. + switch (Pos - Size) { + case 1: V = (V << 8) | (unsigned char)String[Size - 3]; // Fall thru. + case 2: V = (V << 8) | (unsigned char)String[Size - 2]; // Fall thru. + case 3: V = (V << 8) | (unsigned char)String[Size - 1]; break; + default: return; // Nothing left. + } + + Bits.push_back(V); +} + void FoldingSetNodeID::AddString(const std::string &String) { unsigned Size = static_cast(String.size()); Bits.push_back(Size); From kremenek at apple.com Tue Jul 1 19:06:55 2008 From: kremenek at apple.com (Ted Kremenek) Date: Wed, 02 Jul 2008 00:06:55 -0000 Subject: [llvm-commits] [llvm] r52998 - /llvm/trunk/include/llvm/ADT/ImmutableList.h Message-ID: <200807020006.m6206uOY007902@zion.cs.uiuc.edu> Author: kremenek Date: Tue Jul 1 19:06:55 2008 New Revision: 52998 URL: http://llvm.org/viewvc/llvm-project?rev=52998&view=rev Log: Implemented operator!= for the ImmutableList iterator. Modified: llvm/trunk/include/llvm/ADT/ImmutableList.h Modified: llvm/trunk/include/llvm/ADT/ImmutableList.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/ImmutableList.h?rev=52998&r1=52997&r2=52998&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/ImmutableList.h (original) +++ llvm/trunk/include/llvm/ADT/ImmutableList.h Tue Jul 1 19:06:55 2008 @@ -85,8 +85,9 @@ iterator() : L(0) {} iterator(ImmutableList l) : L(l.getInternalPointer()) {} - iterator& operator++() { L = L->Tail; return *this; } + iterator& operator++() { L = L->getTail(); return *this; } bool operator==(const iterator& I) const { return L == I.L; } + bool operator!=(const iterator& I) const { return L != I.L; } ImmutableList operator*() const { return L; } }; From evan.cheng at apple.com Tue Jul 1 19:21:49 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 02 Jul 2008 00:21:49 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53000 - /llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Message-ID: <200807020021.m620LnAO008321@zion.cs.uiuc.edu> Author: evancheng Date: Tue Jul 1 19:21:48 2008 New Revision: 53000 URL: http://llvm.org/viewvc/llvm-project?rev=53000&view=rev Log: Unbreak the build. Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp?rev=53000&r1=52999&r2=53000&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-linker-hack.cpp Tue Jul 1 19:21:48 2008 @@ -50,7 +50,7 @@ llvm::createScalarReplAggregatesPass(); llvm::createCFGSimplificationPass(); - llvm::createDefaultScheduler(NULL, NULL, NULL); + llvm::createDefaultScheduler(NULL, NULL, NULL, false); llvm::createLinearScanRegisterAllocator(); llvm::createLocalRegisterAllocator(); From isanbard at gmail.com Tue Jul 1 19:35:48 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 02 Jul 2008 00:35:48 -0000 Subject: [llvm-commits] [llvm] r53001 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200807020035.m620ZmnJ008719@zion.cs.uiuc.edu> Author: void Date: Tue Jul 1 19:35:47 2008 New Revision: 53001 URL: http://llvm.org/viewvc/llvm-project?rev=53001&view=rev Log: Sorry. I couldn't sleep at night knowing I put these ugly casts into the source tree. Modified: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h?rev=53001&r1=53000&r2=53001&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h Tue Jul 1 19:35:47 2008 @@ -14,6 +14,7 @@ #ifndef LLVM_CODEGEN_MACHINEDEBUGINFODESC_H #define LLVM_CODEGEN_MACHINEDEBUGINFODESC_H +#include "llvm/GlobalValue.h" #include "llvm/Support/DataTypes.h" #include #include @@ -67,7 +68,7 @@ /// getLinkage - get linkage appropriate for this type of descriptor. /// - virtual unsigned getLinkage() const; + virtual GlobalValue::LinkageTypes getLinkage() const; //===--------------------------------------------------------------------===// // Subclasses should supply the following virtual methods. @@ -111,7 +112,7 @@ /// getLinkage - get linkage appropriate for this type of descriptor. /// - virtual unsigned getLinkage() const; + virtual GlobalValue::LinkageTypes getLinkage() const; /// ApplyToFields - Target the visitor to the fields of the AnchorDesc. /// Modified: llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp?rev=53001&r1=53000&r2=53001&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp Tue Jul 1 19:35:47 2008 @@ -92,8 +92,8 @@ } /// getLinkage - get linkage appropriate for this type of descriptor. -unsigned DebugInfoDesc::getLinkage() const { - return (unsigned)GlobalValue::InternalLinkage; +GlobalValue::LinkageTypes DebugInfoDesc::getLinkage() const { + return GlobalValue::InternalLinkage; } /// ApplyToFields - Target the vistor to the fields of the descriptor. @@ -115,8 +115,8 @@ } /// getLinkage - get linkage appropriate for this type of descriptor. -unsigned AnchorDesc::getLinkage() const { - return (unsigned)GlobalValue::LinkOnceLinkage; +GlobalValue::LinkageTypes AnchorDesc::getLinkage() const { + return GlobalValue::LinkOnceLinkage; } /// ApplyToFields - Target the visitor to the fields of the TransUnitDesc. Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=53001&r1=53000&r2=53001&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Tue Jul 1 19:35:47 2008 @@ -587,8 +587,7 @@ // Create the GlobalVariable early to prevent infinite recursion. GlobalVariable *GV = - new GlobalVariable(Ty, true, - (GlobalValue::LinkageTypes)DD->getLinkage(), + new GlobalVariable(Ty, true, DD->getLinkage(), NULL, DD->getDescString(), M); GV->setSection("llvm.metadata"); From dalej at apple.com Tue Jul 1 19:42:28 2008 From: dalej at apple.com (Dale Johannesen) Date: Tue, 1 Jul 2008 17:42:28 -0700 Subject: [llvm-commits] [llvm] r53001 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp In-Reply-To: <200807020035.m620ZmnJ008719@zion.cs.uiuc.edu> References: <200807020035.m620ZmnJ008719@zion.cs.uiuc.edu> Message-ID: On Jul 1, 2008, at 5:35 PMPDT, Bill Wendling wrote: > Author: void > Date: Tue Jul 1 19:35:47 2008 > New Revision: 53001 > > URL: http://llvm.org/viewvc/llvm-project?rev=53001&view=rev > Log: > Sorry. I couldn't sleep at night knowing I put these ugly casts into > the source tree. Thanks! If the include is really seen as a problem maybe the enum in question could be moved higher up in the hierarchy. It does seem like a reasonable thing for debug info handling to be able to access, right? > Modified: > llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h > llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp > llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp > > Modified: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h?rev=53001&r1=53000&r2=53001&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h (original) > +++ llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h Tue Jul > 1 19:35:47 2008 > @@ -14,6 +14,7 @@ > #ifndef LLVM_CODEGEN_MACHINEDEBUGINFODESC_H > #define LLVM_CODEGEN_MACHINEDEBUGINFODESC_H > > +#include "llvm/GlobalValue.h" > #include "llvm/Support/DataTypes.h" > #include > #include > @@ -67,7 +68,7 @@ > > /// getLinkage - get linkage appropriate for this type of > descriptor. > /// > - virtual unsigned getLinkage() const; > + virtual GlobalValue::LinkageTypes getLinkage() const; > > // > = > = > =-------------------------------------------------------------------- > ===// > // Subclasses should supply the following virtual methods. > @@ -111,7 +112,7 @@ > > /// getLinkage - get linkage appropriate for this type of > descriptor. > /// > - virtual unsigned getLinkage() const; > + virtual GlobalValue::LinkageTypes getLinkage() const; > > /// ApplyToFields - Target the visitor to the fields of the > AnchorDesc. > /// > > Modified: llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp?rev=53001&r1=53000&r2=53001&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp (original) > +++ llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp Tue Jul 1 > 19:35:47 2008 > @@ -92,8 +92,8 @@ > } > > /// getLinkage - get linkage appropriate for this type of descriptor. > -unsigned DebugInfoDesc::getLinkage() const { > - return (unsigned)GlobalValue::InternalLinkage; > +GlobalValue::LinkageTypes DebugInfoDesc::getLinkage() const { > + return GlobalValue::InternalLinkage; > } > > /// ApplyToFields - Target the vistor to the fields of the descriptor. > @@ -115,8 +115,8 @@ > } > > /// getLinkage - get linkage appropriate for this type of descriptor. > -unsigned AnchorDesc::getLinkage() const { > - return (unsigned)GlobalValue::LinkOnceLinkage; > +GlobalValue::LinkageTypes AnchorDesc::getLinkage() const { > + return GlobalValue::LinkOnceLinkage; > } > > /// ApplyToFields - Target the visitor to the fields of the > TransUnitDesc. > > Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=53001&r1=53000&r2=53001&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) > +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Tue Jul 1 19:35:47 > 2008 > @@ -587,8 +587,7 @@ > > // Create the GlobalVariable early to prevent infinite recursion. > GlobalVariable *GV = > - new GlobalVariable(Ty, true, > - (GlobalValue::LinkageTypes)DD->getLinkage(), > + new GlobalVariable(Ty, true, DD->getLinkage(), > NULL, DD->getDescString(), M); > GV->setSection("llvm.metadata"); > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Tue Jul 1 19:50:03 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 02 Jul 2008 00:50:03 -0000 Subject: [llvm-commits] [llvm] r53003 - /llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200807020050.m620o3Qv009260@zion.cs.uiuc.edu> Author: void Date: Tue Jul 1 19:50:02 2008 New Revision: 53003 URL: http://llvm.org/viewvc/llvm-project?rev=53003&view=rev Log: Use the canonical form for getting an empty structure. Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=53003&r1=53002&r2=53003&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Tue Jul 1 19:50:02 2008 @@ -250,10 +250,7 @@ public: DISerializeVisitor(DISerializer &S, std::vector &E) - : DIVisitor() - , SR(S) - , Elements(E) - {} + : DIVisitor(), SR(S), Elements(E) {} /// Apply - Set the value of each of the fields. /// @@ -337,10 +334,7 @@ public: DIGetTypesVisitor(DISerializer &S, std::vector &F) - : DIVisitor() - , SR(S) - , Fields(F) - {} + : DIVisitor(), SR(S), Fields(F) {} /// Apply - Set the value of each of the fields. /// @@ -511,8 +505,7 @@ if (EmptyStructPtrTy) return EmptyStructPtrTy; // Construct the pointer to empty structure type. - const StructType *EmptyStructTy = - StructType::get(std::vector()); + const StructType *EmptyStructTy = StructType::get(NULL, NULL); // Construct the pointer to empty structure type. EmptyStructPtrTy = PointerType::getUnqual(EmptyStructTy); @@ -529,6 +522,7 @@ if (!Ty) { // Set up fields vector. std::vector Fields; + // Get types of fields. DIGetTypesVisitor GTAM(*this, Fields); GTAM.ApplyToFields(DD); @@ -596,6 +590,7 @@ // Set up elements vector std::vector Elements; + // Add fields. DISerializeVisitor SRAM(*this, Elements); SRAM.ApplyToFields(DD); From dpatel at apple.com Tue Jul 1 20:18:13 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 02 Jul 2008 01:18:13 -0000 Subject: [llvm-commits] [llvm] r53005 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200807020118.m621IDSh010069@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 1 20:18:13 2008 New Revision: 53005 URL: http://llvm.org/viewvc/llvm-project?rev=53005&view=rev Log: Preserve loop data so that it is not fetched everytime it is needed. Keep track of currentLoop. 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=53005&r1=53004&r2=53005&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Tue Jul 1 20:18:13 2008 @@ -71,8 +71,11 @@ bool OptimizeForSize; bool redoLoop; + Loop *currentLoop; DominanceFrontier *DF; DominatorTree *DT; + BasicBlock *loopHeader; + BasicBlock *loopPreheader; /// LoopDF - Loop's dominance frontier. This set is a collection of /// loop exiting blocks' DF member blocks. However this does set does not @@ -85,10 +88,12 @@ public: static char ID; // Pass ID, replacement for typeid explicit LoopUnswitch(bool Os = false) : - LoopPass((intptr_t)&ID), OptimizeForSize(Os), redoLoop(false) {} + LoopPass((intptr_t)&ID), OptimizeForSize(Os), redoLoop(false), + currentLoop(NULL), DF(NULL), DT(NULL), loopHeader(NULL), + loopPreheader(NULL) {} bool runOnLoop(Loop *L, LPPassManager &LPM); - bool processLoop(Loop *L); + bool processCurrentLoop(); /// This transformation requires natural loop information & requires that /// loop preheaders be inserted into the CFG... @@ -115,6 +120,11 @@ LoopProcessWorklist.erase(I); } + void initLoopData() { + loopHeader = currentLoop->getHeader(); + loopPreheader = currentLoop->getLoopPreheader(); + } + /// Split all of the edges from inside the loop to their exit blocks. /// Update the appropriate Phi nodes as we do so. void SplitExitEdges(Loop *L, const SmallVector &ExitBlocks, @@ -125,8 +135,8 @@ void ReplaceLoopExternalDFMember(Loop *L, BasicBlock *BB, BasicBlock *NewDFMember); - bool UnswitchIfProfitable(Value *LoopCond, Constant *Val,Loop *L); - unsigned getLoopUnswitchCost(Loop *L, Value *LIC); + bool UnswitchIfProfitable(Value *LoopCond, Constant *Val); + unsigned getLoopUnswitchCost(Value *LIC); void UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val, BasicBlock *ExitBlock); void UnswitchNontrivialCondition(Value *LIC, Constant *OnVal, Loop *L); @@ -143,6 +153,9 @@ void RemoveBlockIfDead(BasicBlock *BB, std::vector &Worklist, Loop *l); void RemoveLoopFromHierarchy(Loop *L); + bool IsTrivialUnswitchCondition(Value *Cond, Constant **Val = 0, + BasicBlock **LoopExit = 0); + }; } char LoopUnswitch::ID = 0; @@ -183,26 +196,28 @@ LPM = &LPM_Ref; DF = getAnalysisToUpdate(); DT = getAnalysisToUpdate(); - + currentLoop = L; bool Changed = false; do { + assert(currentLoop->isLCSSAForm()); redoLoop = false; - Changed |= processLoop(L); + Changed |= processCurrentLoop(); } while(redoLoop); return Changed; } -/// processLoop - Do actual work and unswitch loop if possible and profitable. -bool LoopUnswitch::processLoop(Loop *L) { - assert(L->isLCSSAForm()); +/// processCurrentLoop - Do actual work and unswitch loop if possible +/// and profitable. +bool LoopUnswitch::processCurrentLoop() { bool Changed = false; // Loop over all of the basic blocks in the loop. If we find an interior // block that is branching on a loop-invariant condition, we can unswitch this // loop. - for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); + for (Loop::block_iterator I = currentLoop->block_begin(), + E = currentLoop->block_end(); I != E; ++I) { TerminatorInst *TI = (*I)->getTerminator(); if (BranchInst *BI = dyn_cast(TI)) { @@ -211,15 +226,17 @@ if (BI->isConditional()) { // See if this, or some part of it, is loop invariant. If so, we can // unswitch on it if we desire. - Value *LoopCond = FindLIVLoopCondition(BI->getCondition(), L, Changed); - if (LoopCond && UnswitchIfProfitable(LoopCond, ConstantInt::getTrue(), - L)) { + Value *LoopCond = FindLIVLoopCondition(BI->getCondition(), + currentLoop, Changed); + if (LoopCond && UnswitchIfProfitable(LoopCond, + ConstantInt::getTrue())) { ++NumBranches; return true; } } } else if (SwitchInst *SI = dyn_cast(TI)) { - Value *LoopCond = FindLIVLoopCondition(SI->getCondition(), L, Changed); + Value *LoopCond = FindLIVLoopCondition(SI->getCondition(), + currentLoop, Changed); if (LoopCond && SI->getNumCases() > 1) { // Find a value to unswitch on: // FIXME: this should chose the most expensive case! @@ -228,7 +245,7 @@ if (!UnswitchedVals.insert(UnswitchVal)) continue; - if (UnswitchIfProfitable(LoopCond, UnswitchVal, L)) { + if (UnswitchIfProfitable(LoopCond, UnswitchVal)) { ++NumSwitches; return true; } @@ -239,17 +256,15 @@ for (BasicBlock::iterator BBI = (*I)->begin(), E = (*I)->end(); BBI != E; ++BBI) if (SelectInst *SI = dyn_cast(BBI)) { - Value *LoopCond = FindLIVLoopCondition(SI->getCondition(), L, Changed); - if (LoopCond && UnswitchIfProfitable(LoopCond, ConstantInt::getTrue(), - L)) { + Value *LoopCond = FindLIVLoopCondition(SI->getCondition(), + currentLoop, Changed); + if (LoopCond && UnswitchIfProfitable(LoopCond, + ConstantInt::getTrue())) { ++NumSelects; return true; } } } - - assert(L->isLCSSAForm()); - return Changed; } @@ -314,9 +329,9 @@ /// exit. Finally, this sets LoopExit to the BB that the loop exits to when /// Cond == Val. /// -static bool IsTrivialUnswitchCondition(Loop *L, Value *Cond, Constant **Val = 0, - BasicBlock **LoopExit = 0) { - BasicBlock *Header = L->getHeader(); +bool LoopUnswitch::IsTrivialUnswitchCondition(Value *Cond, Constant **Val, + BasicBlock **LoopExit) { + BasicBlock *Header = currentLoop->getHeader(); TerminatorInst *HeaderTerm = Header->getTerminator(); BasicBlock *LoopExitBB = 0; @@ -330,9 +345,11 @@ // latch block or exit through a one exit block without having any // side-effects. If so, determine the value of Cond that causes it to do // this. - if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(0)))) { + if ((LoopExitBB = isTrivialLoopExitBlock(currentLoop, + BI->getSuccessor(0)))) { if (Val) *Val = ConstantInt::getTrue(); - } else if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(1)))) { + } else if ((LoopExitBB = isTrivialLoopExitBlock(currentLoop, + BI->getSuccessor(1)))) { if (Val) *Val = ConstantInt::getFalse(); } } else if (SwitchInst *SI = dyn_cast(HeaderTerm)) { @@ -344,7 +361,8 @@ // side-effects. If so, determine the value of Cond that causes it to do // this. Note that we can't trivially unswitch on the default case. for (unsigned i = 1, e = SI->getNumSuccessors(); i != e; ++i) - if ((LoopExitBB = isTrivialLoopExitBlock(L, SI->getSuccessor(i)))) { + if ((LoopExitBB = isTrivialLoopExitBlock(currentLoop, + SI->getSuccessor(i)))) { // Okay, we found a trivial case, remember the value that is trivial. if (Val) *Val = SI->getCaseValue(i); break; @@ -370,24 +388,25 @@ } /// getLoopUnswitchCost - Return the cost (code size growth) that will happen if -/// we choose to unswitch the specified loop on the specified value. +/// we choose to unswitch current loop on the specified value. /// -unsigned LoopUnswitch::getLoopUnswitchCost(Loop *L, Value *LIC) { +unsigned LoopUnswitch::getLoopUnswitchCost(Value *LIC) { // If the condition is trivial, always unswitch. There is no code growth for // this case. - if (IsTrivialUnswitchCondition(L, LIC)) + if (IsTrivialUnswitchCondition(LIC)) return 0; // FIXME: This is really overly conservative. However, more liberal // estimations have thus far resulted in excessive unswitching, which is bad // both in compile time and in code size. This should be replaced once // someone figures out how a good estimation. - return L->getBlocks().size(); + return currentLoop->getBlocks().size(); unsigned Cost = 0; // FIXME: this is brain dead. It should take into consideration code // shrinkage. - for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); + for (Loop::block_iterator I = currentLoop->block_begin(), + E = currentLoop->block_end(); I != E; ++I) { BasicBlock *BB = *I; // Do not include empty blocks in the cost calculation. This happen due to @@ -402,12 +421,12 @@ return Cost; } -/// UnswitchIfProfitable - We have found that we can unswitch L when +/// UnswitchIfProfitable - We have found that we can unswitch currentLoop when /// LoopCond == Val to simplify the loop. If we decide that this is profitable, /// unswitch the loop, reprocess the pieces, then return true. -bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val,Loop *L){ - // Check to see if it would be profitable to unswitch this loop. - unsigned Cost = getLoopUnswitchCost(L, LoopCond); +bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){ + // Check to see if it would be profitable to unswitch current loop. + unsigned Cost = getLoopUnswitchCost(LoopCond); // Do not do non-trivial unswitch while optimizing for size. if (Cost && OptimizeForSize) @@ -418,19 +437,19 @@ // resultant unswitched loops. // DOUT << "NOT unswitching loop %" - << L->getHeader()->getName() << ", cost too high: " - << L->getBlocks().size() << "\n"; + << currentLoop->getHeader()->getName() << ", cost too high: " + << currentLoop->getBlocks().size() << "\n"; return false; } - - // If this is a trivial condition to unswitch (which results in no code - // duplication), do it now. + + initLoopData(); + Constant *CondVal; BasicBlock *ExitBlock; - if (IsTrivialUnswitchCondition(L, LoopCond, &CondVal, &ExitBlock)) { - UnswitchTrivialCondition(L, LoopCond, CondVal, ExitBlock); + if (IsTrivialUnswitchCondition(LoopCond, &CondVal, &ExitBlock)) { + UnswitchTrivialCondition(currentLoop, LoopCond, CondVal, ExitBlock); } else { - UnswitchNontrivialCondition(LoopCond, Val, L); + UnswitchNontrivialCondition(LoopCond, Val, currentLoop); } return true; @@ -581,15 +600,14 @@ Constant *Val, BasicBlock *ExitBlock) { DOUT << "loop-unswitch: Trivial-Unswitch loop %" - << L->getHeader()->getName() << " [" << L->getBlocks().size() + << loopHeader->getName() << " [" << L->getBlocks().size() << " blocks] in Function " << L->getHeader()->getParent()->getName() << " on cond: " << *Val << " == " << *Cond << "\n"; // First step, split the preheader, so that we know that there is a safe place - // to insert the conditional branch. We will change 'OrigPH' to have a + // to insert the conditional branch. We will change loopPreheader to have a // conditional branch on Cond. - BasicBlock *OrigPH = L->getLoopPreheader(); - BasicBlock *NewPH = SplitEdge(OrigPH, L->getHeader(), this); + BasicBlock *NewPH = SplitEdge(loopPreheader, loopHeader, this); // Now that we have a place to insert the conditional branch, create a place // to branch to: this is the exit block out of the loop that we should @@ -605,10 +623,10 @@ // Okay, now we have a position to branch from and a position to branch to, // insert the new conditional branch. EmitPreheaderBranchOnCondition(Cond, Val, NewExit, NewPH, - OrigPH->getTerminator()); + loopPreheader->getTerminator()); if (DT) { - DT->changeImmediateDominator(NewExit, OrigPH); - DT->changeImmediateDominator(NewPH, OrigPH); + DT->changeImmediateDominator(NewExit, loopPreheader); + DT->changeImmediateDominator(NewPH, loopPreheader); } if (DF) { @@ -617,7 +635,7 @@ DominanceFrontier::iterator DFI = DF->find(NewPH); if (DFI != DF->end()) DF->addToFrontier(DFI, NewExit); - DFI = DF->find(L->getHeader()); + DFI = DF->find(loopHeader); DF->addToFrontier(DFI, NewExit); // ExitBlock does not have successors then NewExit is part of @@ -627,8 +645,8 @@ DF->addToFrontier(DFI, NewExit); } } - LPM->deleteSimpleAnalysisValue(OrigPH->getTerminator(), L); - OrigPH->getTerminator()->eraseFromParent(); + LPM->deleteSimpleAnalysisValue(loopPreheader->getTerminator(), L); + loopPreheader->getTerminator()->eraseFromParent(); // We need to reprocess this loop, it could be unswitched again. redoLoop = true; @@ -737,9 +755,9 @@ /// condition outside of either loop. Return the loops created as Out1/Out2. void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val, Loop *L) { - Function *F = L->getHeader()->getParent(); + Function *F = loopHeader->getParent(); DOUT << "loop-unswitch: Unswitching loop %" - << L->getHeader()->getName() << " [" << L->getBlocks().size() + << loopHeader->getName() << " [" << L->getBlocks().size() << " blocks] in Function " << F->getName() << " when '" << *Val << "' == " << *LIC << "\n"; @@ -750,9 +768,7 @@ // First step, split the preheader and exit blocks, and add these blocks to // the LoopBlocks list. - BasicBlock *OrigHeader = L->getHeader(); - BasicBlock *OrigPreheader = L->getLoopPreheader(); - BasicBlock *NewPreheader = SplitEdge(OrigPreheader, L->getHeader(), this); + BasicBlock *NewPreheader = SplitEdge(loopPreheader, loopHeader, this); LoopBlocks.push_back(NewPreheader); // We want the loop to come after the preheader, but before the exit blocks. @@ -790,7 +806,7 @@ // at the same time they are not part of loop. SmallPtrSet OutSiders; if (DT) { - DomTreeNode *OrigHeaderNode = DT->getNode(OrigHeader); + DomTreeNode *OrigHeaderNode = DT->getNode(loopHeader); for(std::vector::iterator DI = OrigHeaderNode->begin(), DE = OrigHeaderNode->end(); DI != DE; ++DI) { BasicBlock *B = (*DI)->getBlock(); @@ -844,7 +860,7 @@ RemapInstruction(I, ValueMap); // Rewrite the original preheader to select between versions of the loop. - BranchInst *OldBR = cast(OrigPreheader->getTerminator()); + BranchInst *OldBR = cast(loopPreheader->getTerminator()); assert(OldBR->isUnconditional() && OldBR->getSuccessor(0) == LoopBlocks[0] && "Preheader splitting did not work correctly!"); @@ -863,8 +879,8 @@ for (unsigned i = 0, e = LoopBlocks.size(); i != e; ++i) { BasicBlock *LBB = LoopBlocks[i]; BasicBlock *NBB = NewBlocks[i]; - CloneDomInfo(NBB, LBB, NewPreheader, OrigPreheader, - OrigHeader, DT, DF, ValueMap); + CloneDomInfo(NBB, LBB, NewPreheader, loopPreheader, + loopHeader, DT, DF, ValueMap); // If LBB's dominance frontier includes DFMember // such that DFMember is also a member of LoopDF then @@ -881,7 +897,7 @@ for (DominanceFrontier::DomSetType::iterator LI = LBSet.begin(), LE = LBSet.end(); LI != LE; /* NULL */) { BasicBlock *B = *LI++; - if (B == LBB && B == L->getHeader()) + if (B == LBB && B == loopHeader) continue; bool removeB = false; if (!LoopDF.count(B)) @@ -926,19 +942,19 @@ for (unsigned i = 0, e = MiddleBlocks.size(); i != e; ++i) { BasicBlock *MBB = MiddleBlocks[i]; if (!MBB->getSinglePredecessor()) - DT->changeImmediateDominator(MBB, OrigPreheader); + DT->changeImmediateDominator(MBB, loopPreheader); } // All Outsiders are now dominated by original pre header. for (SmallPtrSet::iterator OI = OutSiders.begin(), OE = OutSiders.end(); OI != OE; ++OI) { BasicBlock *OB = *OI; - DT->changeImmediateDominator(OB, OrigPreheader); + DT->changeImmediateDominator(OB, loopPreheader); } // New loop headers are dominated by original preheader - DT->changeImmediateDominator(NewBlocks[0], OrigPreheader); - DT->changeImmediateDominator(LoopBlocks[0], OrigPreheader); + DT->changeImmediateDominator(NewBlocks[0], loopPreheader); + DT->changeImmediateDominator(LoopBlocks[0], loopPreheader); } LoopProcessWorklist.push_back(NewLoop); @@ -1009,7 +1025,7 @@ // If this is the header of a loop and the only pred is the latch, we now // have an unreachable loop. if (Loop *L = LI->getLoopFor(BB)) - if (L->getHeader() == BB && L->contains(Pred)) { + if (loopHeader == BB && L->contains(Pred)) { // 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). From dpatel at apple.com Tue Jul 1 20:31:19 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 02 Jul 2008 01:31:19 -0000 Subject: [llvm-commits] [llvm] r53006 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200807020131.m621VJGx010393@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 1 20:31:19 2008 New Revision: 53006 URL: http://llvm.org/viewvc/llvm-project?rev=53006&view=rev Log: Fix comment. 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=53006&r1=53005&r2=53006&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Tue Jul 1 20:31:19 2008 @@ -510,7 +510,7 @@ else if (Orig == NewPreheader) OrigIDom = OrigPreheader; - // Other as DT to find Orig's immediate dominator. + // Otherwise ask DT to find Orig's immediate dominator. else OrigIDom = OrigIDomNode->getBlock(); From wangmp at apple.com Tue Jul 1 20:38:14 2008 From: wangmp at apple.com (Mon P Wang) Date: Tue, 1 Jul 2008 18:38:14 -0700 Subject: [llvm-commits] Slot alignment Message-ID: Hi, The following small patch is to fix a problem when we have to EmitStackConvert. It is possible that two types of the same size may have different alignment (e.g., users may specify a stricter alignment than native or vector types may have stricter alignment than a scalar of the same size). If one ever tries to do stack convert of this, we create a stack slot with the alignment of the destination and we can generate a load/store with greater alignment than the stack slot that we have created. The following patch generates a StackSlot with the minimum alignment necessary for both the source and the destination type. If you have any comments, please let me know. -- Mon Ping -------------- next part -------------- A non-text attachment was scrubbed... Name: slot_align.patch Type: application/octet-stream Size: 4340 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080701/3466a5b2/attachment.obj From dpatel at apple.com Tue Jul 1 20:44:30 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 02 Jul 2008 01:44:30 -0000 Subject: [llvm-commits] [llvm] r53007 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200807020144.m621iUht010843@zion.cs.uiuc.edu> Author: dpatel Date: Tue Jul 1 20:44:29 2008 New Revision: 53007 URL: http://llvm.org/viewvc/llvm-project?rev=53007&view=rev Log: reuse vectors. 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=53007&r1=53006&r2=53007&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Tue Jul 1 20:44:29 2008 @@ -85,6 +85,13 @@ /// OrigLoopExitMap - This is used to map loop exiting block with /// corresponding loop exit block, before updating CFG. DenseMap OrigLoopExitMap; + + // LoopBlocks contains all of the basic blocks of the loop, including the + // preheader of the loop, the body of the loop, and the exit blocks of the + // loop, in that order. + std::vector LoopBlocks; + // NewBlocks contained cloned copy of basic blocks from LoopBlocks. + std::vector NewBlocks; public: static char ID; // Pass ID, replacement for typeid explicit LoopUnswitch(bool Os = false) : @@ -761,10 +768,8 @@ << " blocks] in Function " << F->getName() << " when '" << *Val << "' == " << *LIC << "\n"; - // LoopBlocks contains all of the basic blocks of the loop, including the - // preheader of the loop, the body of the loop, and the exit blocks of the - // loop, in that order. - std::vector LoopBlocks; + LoopBlocks.clear(); + NewBlocks.clear(); // First step, split the preheader and exit blocks, and add these blocks to // the LoopBlocks list. @@ -792,7 +797,6 @@ // Next step, clone all of the basic blocks that make up the loop (including // the loop preheader and exit blocks), keeping track of the mapping between // the instructions and blocks. - std::vector NewBlocks; NewBlocks.reserve(LoopBlocks.size()); DenseMap ValueMap; for (unsigned i = 0, e = LoopBlocks.size(); i != e; ++i) { From isanbard at gmail.com Tue Jul 1 23:07:30 2008 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 1 Jul 2008 21:07:30 -0700 Subject: [llvm-commits] Slot alignment In-Reply-To: References: Message-ID: On Jul 1, 2008, at 6:38 PM, Mon P Wang wrote: > Hi, > > The following small patch is to fix a problem when we have to > EmitStackConvert. It is possible that two types of the same size > may have different alignment (e.g., users may specify a stricter > alignment than native or vector types may have stricter alignment > than a scalar of the same size). If one ever tries to do stack > convert of this, we create a stack slot with the alignment of the > destination and we can generate a load/store with greater alignment > than the stack slot that we have created. The following patch > generates a StackSlot with the minimum alignment necessary for both > the source and the destination type. If you have any comments, > please let me know. > Hi Mon Ping, A couple of comments. Index: include/llvm/CodeGen/SelectionDAG.h =================================================================== --- include/llvm/CodeGen/SelectionDAG.h (revision 52999) +++ include/llvm/CodeGen/SelectionDAG.h (working copy) @@ -574,9 +574,11 @@ void dump() const; /// CreateStackTemporary - Create a stack temporary, suitable for holding the - /// specified value type. + /// specified value type. If minAlign is specified, the slot size will have + /// at least that alignment. SDOperand CreateStackTemporary(MVT VT); - + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign); + /// FoldSetCC - Constant fold a setcc to true or false. SDOperand FoldSetCC(MVT VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond); Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp (revision 52999) +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp (working copy) @@ -1081,15 +1081,20 @@ /// CreateStackTemporary - Create a stack temporary, suitable for holding the /// specified value type. SDOperand SelectionDAG::CreateStackTemporary(MVT VT) { + return CreateStackTemporary(VT, 1); +} + +SDOperand SelectionDAG::CreateStackTemporary(MVT VT, unsigned minAlign) { It's not necessary to create two functions. Just specify a default value for minAlign like so: + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1); + if (StackAlign < minAlign) + StackAlign = minAlign; You could use std::max here. From monping at apple.com Tue Jul 1 23:55:25 2008 From: monping at apple.com (Mon P Wang) Date: Tue, 1 Jul 2008 21:55:25 -0700 Subject: [llvm-commits] Slot alignment In-Reply-To: References: Message-ID: <868EB593-9D29-4409-BD25-3CA3FA7C3BCD@apple.com> Hi Bill, I'll make those changes. Thanks, -- Mon Ping On Jul 1, 2008, at 9:07 PM, Bill Wendling wrote: > On Jul 1, 2008, at 6:38 PM, Mon P Wang wrote: > >> Hi, >> >> The following small patch is to fix a problem when we have to >> EmitStackConvert. It is possible that two types of the same size >> may have different alignment (e.g., users may specify a stricter >> alignment than native or vector types may have stricter alignment >> than a scalar of the same size). If one ever tries to do stack >> convert of this, we create a stack slot with the alignment of the >> destination and we can generate a load/store with greater alignment >> than the stack slot that we have created. The following patch >> generates a StackSlot with the minimum alignment necessary for both >> the source and the destination type. If you have any comments, >> please let me know. >> > Hi Mon Ping, > > A couple of comments. > > Index: include/llvm/CodeGen/SelectionDAG.h > =================================================================== > --- include/llvm/CodeGen/SelectionDAG.h (revision 52999) > +++ include/llvm/CodeGen/SelectionDAG.h (working copy) > @@ -574,9 +574,11 @@ > void dump() const; > > /// CreateStackTemporary - Create a stack temporary, suitable for > holding the > - /// specified value type. > + /// specified value type. If minAlign is specified, the slot size > will have > + /// at least that alignment. > SDOperand CreateStackTemporary(MVT VT); > - > + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign); > + > /// FoldSetCC - Constant fold a setcc to true or false. > SDOperand FoldSetCC(MVT VT, SDOperand N1, > SDOperand N2, ISD::CondCode Cond); > Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp > =================================================================== > --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp (revision 52999) > +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp (working copy) > @@ -1081,15 +1081,20 @@ > /// CreateStackTemporary - Create a stack temporary, suitable for > holding the > /// specified value type. > SDOperand SelectionDAG::CreateStackTemporary(MVT VT) { > + return CreateStackTemporary(VT, 1); > +} > + > +SDOperand SelectionDAG::CreateStackTemporary(MVT VT, unsigned > minAlign) { > > It's not necessary to create two functions. Just specify a default > value for minAlign like so: > > + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1); > > > + if (StackAlign < minAlign) > + StackAlign = minAlign; > > You could use std::max here. > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Wed Jul 2 00:26:33 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Jul 2008 05:26:33 -0000 Subject: [llvm-commits] [llvm] r53008 - in /llvm/trunk: include/llvm/ADT/StringMap.h lib/CodeGen/CollectorMetadata.cpp Message-ID: <200807020526.m625QXnu017207@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 2 00:26:32 2008 New Revision: 53008 URL: http://llvm.org/viewvc/llvm-project?rev=53008&view=rev Log: Add a new (simple) StringMap::clear method, patch by Pratik Solanki! Modified: llvm/trunk/include/llvm/ADT/StringMap.h llvm/trunk/lib/CodeGen/CollectorMetadata.cpp Modified: llvm/trunk/include/llvm/ADT/StringMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=53008&r1=53007&r2=53008&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringMap.h (original) +++ llvm/trunk/include/llvm/ADT/StringMap.h Wed Jul 2 00:26:32 2008 @@ -333,6 +333,12 @@ return true; } + // clear - Empties out the StringMap + void clear() { + while (!empty()) + erase(begin()); + } + /// GetOrCreateValue - Look up the specified key in the table. If a value /// exists, return it. Otherwise, default construct a value, insert it, and /// return. Modified: llvm/trunk/lib/CodeGen/CollectorMetadata.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CollectorMetadata.cpp?rev=53008&r1=53007&r2=53008&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CollectorMetadata.cpp (original) +++ llvm/trunk/lib/CodeGen/CollectorMetadata.cpp Wed Jul 2 00:26:32 2008 @@ -112,10 +112,7 @@ void CollectorModuleMetadata::clear() { Map.clear(); - - // TODO: StringMap should provide a clear method. - while (!NameMap.empty()) - NameMap.erase(NameMap.begin()); + NameMap.clear(); for (iterator I = begin(), E = end(); I != E; ++I) delete *I; From sabre at nondot.org Wed Jul 2 00:30:45 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Jul 2008 05:30:45 -0000 Subject: [llvm-commits] [llvm] r53009 - /llvm/trunk/include/llvm/ADT/StringMap.h Message-ID: <200807020530.m625Ujo2017331@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 2 00:30:45 2008 New Revision: 53009 URL: http://llvm.org/viewvc/llvm-project?rev=53009&view=rev Log: optimize StringMap::clear Modified: llvm/trunk/include/llvm/ADT/StringMap.h Modified: llvm/trunk/include/llvm/ADT/StringMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=53009&r1=53008&r2=53009&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringMap.h (original) +++ llvm/trunk/include/llvm/ADT/StringMap.h Wed Jul 2 00:30:45 2008 @@ -335,8 +335,16 @@ // clear - Empties out the StringMap void clear() { - while (!empty()) - erase(begin()); + if (empty()) return; + + // Zap all values, resetting the keys back to non-present (not tombstone), + // which is safe because we're removing all elements. + for (ItemBucket *I = TheTable, *E = TheTable+NumBuckets; I != E; ++I) { + if (I->Item && I->Item != getTombstoneVal()) { + static_cast(I->Item)->Destroy(Allocator); + I->Item = 0; + } + } } /// GetOrCreateValue - Look up the specified key in the table. If a value @@ -398,10 +406,7 @@ } ~StringMap() { - for (ItemBucket *I = TheTable, *E = TheTable+NumBuckets; I != E; ++I) { - if (I->Item && I->Item != getTombstoneVal()) - static_cast(I->Item)->Destroy(Allocator); - } + clear(); free(TheTable); } private: From baldrick at free.fr Wed Jul 2 01:36:20 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 2 Jul 2008 08:36:20 +0200 Subject: [llvm-commits] [llvm] r52987 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp In-Reply-To: <16e5fdf90807011516k3e54849fl58e4fb7f1472ee41@mail.gmail.com> References: <200807012208.m61M81Ml004300@zion.cs.uiuc.edu> <653051EC-EFF8-4688-92B1-40867AD5C6CE@apple.com> <16e5fdf90807011516k3e54849fl58e4fb7f1472ee41@mail.gmail.com> Message-ID: <200807020836.20593.baldrick@free.fr> > >> - Don't use GlobalVariable::LinkageTypes when unsigned works. > > > > Is there some reason we need this? I strongly prefer the enum if it > > works. > > Makes things easier to read and harder to abuse. > > > It required pulling in the GlobalVariable.h header into the > MachineDebugInfoDesc.h file. That's the only reason I can think of. I'm with Dale here. How about putting the enum in its own header instead? Ciao, Duncan. From baldrick at free.fr Wed Jul 2 01:43:06 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 2 Jul 2008 08:43:06 +0200 Subject: [llvm-commits] [llvm] r52994 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp In-Reply-To: <200807012334.m61NYnqf006834@zion.cs.uiuc.edu> References: <200807012334.m61NYnqf006834@zion.cs.uiuc.edu> Message-ID: <200807020843.06862.baldrick@free.fr> > Darwin doesn't need exception handling information for the "move" info when > debug information is being output, because it's leet! Does any target need it? I can't see why it would. By the way, there seems to be some overloading of the term "frame moves". There are moves that tell the unwinder how to restore registers. But the debug info has something similar which tells where to find values for variables. So I'd rather talk of EHMoves rather than FrameMoves (though even better would be to remove this parameter). Ciao, Duncan. From baldrick at free.fr Wed Jul 2 01:54:26 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 2 Jul 2008 08:54:26 +0200 Subject: [llvm-commits] Slot alignment In-Reply-To: References: Message-ID: <200807020854.26505.baldrick@free.fr> Hi, > SDOperand SelectionDAG::CreateStackTemporary(MVT VT) { > + return CreateStackTemporary(VT, 1); while it doesn't hurt to use 1, you could also use 0 here. > + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1); Here too. Ciao, Duncan. PS: Can you please include patches inline rather than attaching them (if they are not too humungous) - that makes it easier to add comments. Thanks! From matthijs at stdin.nl Wed Jul 2 03:40:01 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Wed, 2 Jul 2008 10:40:01 +0200 Subject: [llvm-commits] [llvm] r52677 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll test/Transforms/DeadArgElim/deadretval2.ll test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: <77A96C06-9C33-49DE-A06F-F8D4C48BC9F6@apple.com> References: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> <77A96C06-9C33-49DE-A06F-F8D4C48BC9F6@apple.com> Message-ID: <20080702084001.GC7287@katherina.student.utwente.nl> Hi Evan (and others), > This is breaking SPEC/CFP2006/447.dealII. (Note cbe has never worked > because this test uses exception handling). Do you have access to > SPEC 2006? Thanks to the help of you and Owen I tracked this down to a specific use of invoke instructions. The pass was wrongly performing the use -> argument number translation by taking the operand number - 1. The attached patch fixes this by doing the followin InvokeInst special casin: + unsigned ArgNo = U.getOperandNo() - 1; + if (isa(CS.getInstruction())) + // Skip the to and unwind operands + // TODO: Let CallSite do this magic + ArgNo -= 2; This is obviously ugly and this should be abstracted into CallSite. CallSite already abstracts the argument number -> operand translation with its getArgument() method. I'm not completely sure how to do the reverse. I think the best approach is to add a getArgumentNo() method that takes an operand number and returns the number of the corresponding argument. Alternatively, it could take a use iterator, Value* or Use* or something like that, but I think that will mostly lead to inefficient code. Any thoughts? Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: deadarg.diff Type: text/x-diff Size: 47676 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080702/791d1d83/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080702/791d1d83/attachment-0001.bin From matthijs at stdin.nl Wed Jul 2 03:58:24 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Wed, 2 Jul 2008 10:58:24 +0200 Subject: [llvm-commits] [llvm] r52677 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll test/Transforms/DeadArgElim/deadretval2.ll test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: <20080702084001.GC7287@katherina.student.utwente.nl> References: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> <77A96C06-9C33-49DE-A06F-F8D4C48BC9F6@apple.com> <20080702084001.GC7287@katherina.student.utwente.nl> Message-ID: <20080702085824.GD7287@katherina.student.utwente.nl> Hi Evan, could you also see if the patch (which still is a bit ugly, but functionally correct) works properly with all of SPEC2006 now? Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080702/01175ef5/attachment.bin From evan.cheng at apple.com Wed Jul 2 04:25:05 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 02 Jul 2008 09:25:05 -0000 Subject: [llvm-commits] [llvm] r53010 - in /llvm/trunk/lib/CodeGen/SelectionDAG: ScheduleDAG.cpp ScheduleDAGRRList.cpp Message-ID: <200807020925.m629PSp9002770@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jul 2 04:23:51 2008 New Revision: 53010 URL: http://llvm.org/viewvc/llvm-project?rev=53010&view=rev Log: - Use a faster priority comparison function if -fast. - Code clean up. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=53010&r1=53009&r2=53010&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Wed Jul 2 04:23:51 2008 @@ -224,26 +224,26 @@ if (InstrItins.isEmpty()) { // No latency information. SU->Latency = 1; - } else { - SU->Latency = 0; - if (SU->Node->isTargetOpcode()) { - unsigned SchedClass = - TII->get(SU->Node->getTargetOpcode()).getSchedClass(); + return; + } + + SU->Latency = 0; + if (SU->Node->isTargetOpcode()) { + unsigned SchedClass = TII->get(SU->Node->getTargetOpcode()).getSchedClass(); + const InstrStage *S = InstrItins.begin(SchedClass); + const InstrStage *E = InstrItins.end(SchedClass); + for (; S != E; ++S) + SU->Latency += S->Cycles; + } + for (unsigned i = 0, e = SU->FlaggedNodes.size(); i != e; ++i) { + SDNode *FNode = SU->FlaggedNodes[i]; + if (FNode->isTargetOpcode()) { + unsigned SchedClass = TII->get(FNode->getTargetOpcode()).getSchedClass(); const InstrStage *S = InstrItins.begin(SchedClass); const InstrStage *E = InstrItins.end(SchedClass); for (; S != E; ++S) SU->Latency += S->Cycles; } - for (unsigned i = 0, e = SU->FlaggedNodes.size(); i != e; ++i) { - SDNode *FNode = SU->FlaggedNodes[i]; - if (FNode->isTargetOpcode()) { - unsigned SchedClass =TII->get(FNode->getTargetOpcode()).getSchedClass(); - const InstrStage *S = InstrItins.begin(SchedClass); - const InstrStage *E = InstrItins.end(SchedClass); - for (; S != E; ++S) - SU->Latency += S->Cycles; - } - } } } @@ -390,11 +390,12 @@ return N; } -static const TargetRegisterClass *getInstrOperandRegClass( - const TargetRegisterInfo *TRI, - const TargetInstrInfo *TII, - const TargetInstrDesc &II, - unsigned Op) { +/// getInstrOperandRegClass - Return register class of the operand of an +/// instruction of the specified TargetInstrDesc. +static const TargetRegisterClass* +getInstrOperandRegClass(const TargetRegisterInfo *TRI, + const TargetInstrInfo *TII, const TargetInstrDesc &II, + unsigned Op) { if (Op >= II.getNumOperands()) { assert(II.isVariadic() && "Invalid operand # of instruction"); return NULL; @@ -404,6 +405,8 @@ return TRI->getRegClass(II.OpInfo[Op].RegClass); } +/// EmitCopyFromReg - Generate machine code for an CopyFromReg node or an +/// implicit physical register output. void ScheduleDAG::EmitCopyFromReg(SDNode *Node, unsigned ResNo, bool IsClone, unsigned SrcReg, DenseMap &VRBaseMap) { @@ -660,18 +663,17 @@ assert(getInstrOperandRegClass(TRI, TII, *II, IIOpNum) && "Don't have operand info for this instruction!"); } - } - + } } void ScheduleDAG::AddMemOperand(MachineInstr *MI, const MachineMemOperand &MO) { MI->addMemOperand(MO); } -// Returns the Register Class of a subregister -static const TargetRegisterClass *getSubRegisterRegClass( - const TargetRegisterClass *TRC, - unsigned SubIdx) { +/// getSubRegisterRegClass - Returns the register class of specified register +/// class' "SubIdx"'th sub-register class. +static const TargetRegisterClass* +getSubRegisterRegClass(const TargetRegisterClass *TRC, unsigned SubIdx) { // Pick the register class of the subregister TargetRegisterInfo::regclass_iterator I = TRC->subregclasses_begin() + SubIdx-1; @@ -680,10 +682,12 @@ return *I; } -static const TargetRegisterClass *getSuperregRegisterClass( - const TargetRegisterClass *TRC, - unsigned SubIdx, - MVT VT) { +/// getSuperRegisterRegClass - Returns the register class of a superreg A whose +/// "SubIdx"'th sub-register class is the specified register class and whose +/// type matches the specified type. +static const TargetRegisterClass* +getSuperRegisterRegClass(const TargetRegisterClass *TRC, + unsigned SubIdx, MVT VT) { // Pick the register class of the superegister for this type for (TargetRegisterInfo::regclass_iterator I = TRC->superregclasses_begin(), E = TRC->superregclasses_end(); I != E; ++I) @@ -758,7 +762,7 @@ if (VRBase) { TRC = MRI.getRegClass(VRBase); } else { - TRC = getSuperregRegisterClass(MRI.getRegClass(SubReg), SubIdx, + TRC = getSuperRegisterRegClass(MRI.getRegClass(SubReg), SubIdx, Node->getValueType(0)); assert(TRC && "Couldn't determine register class for insert_subreg"); VRBase = MRI.createVirtualRegister(TRC); // Create the reg @@ -867,124 +871,125 @@ EmitCopyFromReg(Node, i, IsClone, Reg, VRBaseMap); } } - } else { - switch (Node->getOpcode()) { - default: + return; + } + + switch (Node->getOpcode()) { + default: #ifndef NDEBUG - Node->dump(&DAG); + Node->dump(&DAG); #endif - assert(0 && "This target-independent node should have been selected!"); - break; - case ISD::EntryToken: - assert(0 && "EntryToken should have been excluded from the schedule!"); - break; - case ISD::TokenFactor: // fall thru - case ISD::DECLARE: - case ISD::SRCVALUE: - break; - case ISD::DBG_LABEL: - BB->push_back(BuildMI(TII->get(TargetInstrInfo::DBG_LABEL)) - .addImm(cast(Node)->getLabelID())); - break; - case ISD::EH_LABEL: - BB->push_back(BuildMI(TII->get(TargetInstrInfo::EH_LABEL)) - .addImm(cast(Node)->getLabelID())); - break; - case ISD::CopyToReg: { - unsigned SrcReg; - SDOperand SrcVal = Node->getOperand(2); - if (RegisterSDNode *R = dyn_cast(SrcVal)) - SrcReg = R->getReg(); - else - SrcReg = getVR(SrcVal, VRBaseMap); + assert(0 && "This target-independent node should have been selected!"); + break; + case ISD::EntryToken: + assert(0 && "EntryToken should have been excluded from the schedule!"); + break; + case ISD::TokenFactor: // fall thru + case ISD::DECLARE: + case ISD::SRCVALUE: + break; + case ISD::DBG_LABEL: + BB->push_back(BuildMI(TII->get(TargetInstrInfo::DBG_LABEL)) + .addImm(cast(Node)->getLabelID())); + break; + case ISD::EH_LABEL: + BB->push_back(BuildMI(TII->get(TargetInstrInfo::EH_LABEL)) + .addImm(cast(Node)->getLabelID())); + break; + case ISD::CopyToReg: { + unsigned SrcReg; + SDOperand SrcVal = Node->getOperand(2); + if (RegisterSDNode *R = dyn_cast(SrcVal)) + SrcReg = R->getReg(); + else + SrcReg = getVR(SrcVal, VRBaseMap); - unsigned DestReg = cast(Node->getOperand(1))->getReg(); - if (SrcReg == DestReg) // Coalesced away the copy? Ignore. - break; + unsigned DestReg = cast(Node->getOperand(1))->getReg(); + if (SrcReg == DestReg) // Coalesced away the copy? Ignore. + break; - const TargetRegisterClass *SrcTRC = 0, *DstTRC = 0; - // Get the register classes of the src/dst. - if (TargetRegisterInfo::isVirtualRegister(SrcReg)) - SrcTRC = MRI.getRegClass(SrcReg); - else - SrcTRC = TRI->getPhysicalRegisterRegClass(SrcReg,SrcVal.getValueType()); + const TargetRegisterClass *SrcTRC = 0, *DstTRC = 0; + // Get the register classes of the src/dst. + if (TargetRegisterInfo::isVirtualRegister(SrcReg)) + SrcTRC = MRI.getRegClass(SrcReg); + else + SrcTRC = TRI->getPhysicalRegisterRegClass(SrcReg,SrcVal.getValueType()); - if (TargetRegisterInfo::isVirtualRegister(DestReg)) - DstTRC = MRI.getRegClass(DestReg); - else - DstTRC = TRI->getPhysicalRegisterRegClass(DestReg, + if (TargetRegisterInfo::isVirtualRegister(DestReg)) + DstTRC = MRI.getRegClass(DestReg); + else + DstTRC = TRI->getPhysicalRegisterRegClass(DestReg, Node->getOperand(1).getValueType()); - TII->copyRegToReg(*BB, BB->end(), DestReg, SrcReg, DstTRC, SrcTRC); - break; - } - case ISD::CopyFromReg: { - unsigned SrcReg = cast(Node->getOperand(1))->getReg(); - EmitCopyFromReg(Node, 0, IsClone, SrcReg, VRBaseMap); - break; - } - case ISD::INLINEASM: { - unsigned NumOps = Node->getNumOperands(); - if (Node->getOperand(NumOps-1).getValueType() == MVT::Flag) - --NumOps; // Ignore the flag operand. + TII->copyRegToReg(*BB, BB->end(), DestReg, SrcReg, DstTRC, SrcTRC); + break; + } + case ISD::CopyFromReg: { + unsigned SrcReg = cast(Node->getOperand(1))->getReg(); + EmitCopyFromReg(Node, 0, IsClone, SrcReg, VRBaseMap); + break; + } + case ISD::INLINEASM: { + unsigned NumOps = Node->getNumOperands(); + if (Node->getOperand(NumOps-1).getValueType() == MVT::Flag) + --NumOps; // Ignore the flag operand. - // Create the inline asm machine instruction. - MachineInstr *MI = BuildMI(TII->get(TargetInstrInfo::INLINEASM)); + // Create the inline asm machine instruction. + MachineInstr *MI = BuildMI(TII->get(TargetInstrInfo::INLINEASM)); - // Add the asm string as an external symbol operand. - const char *AsmStr = - cast(Node->getOperand(1))->getSymbol(); - MI->addOperand(MachineOperand::CreateES(AsmStr)); + // Add the asm string as an external symbol operand. + const char *AsmStr = + cast(Node->getOperand(1))->getSymbol(); + MI->addOperand(MachineOperand::CreateES(AsmStr)); - // Add all of the operand registers to the instruction. - for (unsigned i = 2; i != NumOps;) { - unsigned Flags = cast(Node->getOperand(i))->getValue(); - unsigned NumVals = Flags >> 3; + // Add all of the operand registers to the instruction. + for (unsigned i = 2; i != NumOps;) { + unsigned Flags = cast(Node->getOperand(i))->getValue(); + unsigned NumVals = Flags >> 3; - MI->addOperand(MachineOperand::CreateImm(Flags)); - ++i; // Skip the ID value. + MI->addOperand(MachineOperand::CreateImm(Flags)); + ++i; // Skip the ID value. - switch (Flags & 7) { - default: assert(0 && "Bad flags!"); - case 1: // Use of register. - for (; NumVals; --NumVals, ++i) { - unsigned Reg = cast(Node->getOperand(i))->getReg(); - MI->addOperand(MachineOperand::CreateReg(Reg, false)); - } - break; - case 2: // Def of register. - for (; NumVals; --NumVals, ++i) { - unsigned Reg = cast(Node->getOperand(i))->getReg(); - MI->addOperand(MachineOperand::CreateReg(Reg, true)); - } - break; - case 3: { // Immediate. - for (; NumVals; --NumVals, ++i) { - if (ConstantSDNode *CS = - dyn_cast(Node->getOperand(i))) { - MI->addOperand(MachineOperand::CreateImm(CS->getValue())); - } else if (GlobalAddressSDNode *GA = - dyn_cast(Node->getOperand(i))) { - MI->addOperand(MachineOperand::CreateGA(GA->getGlobal(), - GA->getOffset())); - } else { - BasicBlockSDNode *BB =cast(Node->getOperand(i)); - MI->addOperand(MachineOperand::CreateMBB(BB->getBasicBlock())); - } - } - break; + switch (Flags & 7) { + default: assert(0 && "Bad flags!"); + case 1: // Use of register. + for (; NumVals; --NumVals, ++i) { + unsigned Reg = cast(Node->getOperand(i))->getReg(); + MI->addOperand(MachineOperand::CreateReg(Reg, false)); } - case 4: // Addressing mode. - // The addressing mode has been selected, just add all of the - // operands to the machine instruction. - for (; NumVals; --NumVals, ++i) - AddOperand(MI, Node->getOperand(i), 0, 0, VRBaseMap); - break; + break; + case 2: // Def of register. + for (; NumVals; --NumVals, ++i) { + unsigned Reg = cast(Node->getOperand(i))->getReg(); + MI->addOperand(MachineOperand::CreateReg(Reg, true)); } + break; + case 3: { // Immediate. + for (; NumVals; --NumVals, ++i) { + if (ConstantSDNode *CS = + dyn_cast(Node->getOperand(i))) { + MI->addOperand(MachineOperand::CreateImm(CS->getValue())); + } else if (GlobalAddressSDNode *GA = + dyn_cast(Node->getOperand(i))) { + MI->addOperand(MachineOperand::CreateGA(GA->getGlobal(), + GA->getOffset())); + } else { + BasicBlockSDNode *BB =cast(Node->getOperand(i)); + MI->addOperand(MachineOperand::CreateMBB(BB->getBasicBlock())); + } + } + break; + } + case 4: // Addressing mode. + // The addressing mode has been selected, just add all of the + // operands to the machine instruction. + for (; NumVals; --NumVals, ++i) + AddOperand(MI, Node->getOperand(i), 0, 0, VRBaseMap); + break; } - BB->push_back(MI); - break; - } } + BB->push_back(MI); + break; + } } } Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp?rev=53010&r1=53009&r2=53010&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Wed Jul 2 04:23:51 2008 @@ -59,6 +59,8 @@ /// it is top-down. bool isBottomUp; + /// Fast - True if we are performing fast scheduling. + /// bool Fast; /// AvailableQueue - The priority queue to use for the available SUnits. @@ -1257,6 +1259,15 @@ bool operator()(const SUnit* left, const SUnit* right) const; }; + struct bu_ls_rr_fast_sort : public std::binary_function{ + RegReductionPriorityQueue *SPQ; + bu_ls_rr_fast_sort(RegReductionPriorityQueue *spq) + : SPQ(spq) {} + bu_ls_rr_fast_sort(const bu_ls_rr_fast_sort &RHS) : SPQ(RHS.SPQ) {} + + bool operator()(const SUnit* left, const SUnit* right) const; + }; + struct td_ls_rr_sort : public std::binary_function { RegReductionPriorityQueue *SPQ; td_ls_rr_sort(RegReductionPriorityQueue *spq) : SPQ(spq) {} @@ -1272,6 +1283,76 @@ N->getOperand(N->getNumOperands()-1).getValueType() != MVT::Flag; } +/// CalcNodeBUSethiUllmanNumber - Compute Sethi Ullman number for bottom up +/// scheduling. Smaller number is the higher priority. +static unsigned +CalcNodeBUSethiUllmanNumber(const SUnit *SU, std::vector &SUNumbers) { + unsigned &SethiUllmanNumber = SUNumbers[SU->NodeNum]; + if (SethiUllmanNumber != 0) + return SethiUllmanNumber; + + unsigned Extra = 0; + for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); + I != E; ++I) { + if (I->isCtrl) continue; // ignore chain preds + SUnit *PredSU = I->Dep; + unsigned PredSethiUllman = CalcNodeBUSethiUllmanNumber(PredSU, SUNumbers); + if (PredSethiUllman > SethiUllmanNumber) { + SethiUllmanNumber = PredSethiUllman; + Extra = 0; + } else if (PredSethiUllman == SethiUllmanNumber && !I->isCtrl) + ++Extra; + } + + SethiUllmanNumber += Extra; + + if (SethiUllmanNumber == 0) + SethiUllmanNumber = 1; + + return SethiUllmanNumber; +} + +/// CalcNodeTDSethiUllmanNumber - Compute Sethi Ullman number for top down +/// scheduling. Smaller number is the higher priority. +static unsigned +CalcNodeTDSethiUllmanNumber(const SUnit *SU, std::vector &SUNumbers) { + unsigned &SethiUllmanNumber = SUNumbers[SU->NodeNum]; + if (SethiUllmanNumber != 0) + return SethiUllmanNumber; + + unsigned Opc = SU->Node ? SU->Node->getOpcode() : 0; + if (Opc == ISD::TokenFactor || Opc == ISD::CopyToReg) + SethiUllmanNumber = 0xffff; + else if (SU->NumSuccsLeft == 0) + // If SU does not have a use, i.e. it doesn't produce a value that would + // be consumed (e.g. store), then it terminates a chain of computation. + // Give it a small SethiUllman number so it will be scheduled right before + // its predecessors that it doesn't lengthen their live ranges. + SethiUllmanNumber = 0; + else if (SU->NumPredsLeft == 0 && + (Opc != ISD::CopyFromReg || isCopyFromLiveIn(SU))) + SethiUllmanNumber = 0xffff; + else { + int Extra = 0; + for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); + I != E; ++I) { + if (I->isCtrl) continue; // ignore chain preds + SUnit *PredSU = I->Dep; + unsigned PredSethiUllman = CalcNodeTDSethiUllmanNumber(PredSU, SUNumbers); + if (PredSethiUllman > SethiUllmanNumber) { + SethiUllmanNumber = PredSethiUllman; + Extra = 0; + } else if (PredSethiUllman == SethiUllmanNumber && !I->isCtrl) + ++Extra; + } + + SethiUllmanNumber += Extra; + } + + return SethiUllmanNumber; +} + + namespace { template class VISIBILITY_HIDDEN RegReductionPriorityQueue @@ -1338,30 +1419,29 @@ const TargetRegisterInfo *TRI; ScheduleDAGRRList *scheduleDAG; - bool Fast; public: explicit BURegReductionPriorityQueue(const TargetInstrInfo *tii, - const TargetRegisterInfo *tri, - bool f) - : TII(tii), TRI(tri), scheduleDAG(NULL), Fast(f) {} + const TargetRegisterInfo *tri) + : TII(tii), TRI(tri), scheduleDAG(NULL) {} void initNodes(std::vector &sunits) { SUnits = &sunits; // Add pseudo dependency edges for two-address nodes. - if (!Fast) - AddPseudoTwoAddrDeps(); + AddPseudoTwoAddrDeps(); // Calculate node priorities. CalculateSethiUllmanNumbers(); } void addNode(const SUnit *SU) { - SethiUllmanNumbers.resize(SUnits->size(), 0); - CalcNodeSethiUllmanNumber(SU); + unsigned SUSize = SethiUllmanNumbers.size(); + if (SUnits->size() > SUSize) + SethiUllmanNumbers.resize(SUSize*2, 0); + CalcNodeBUSethiUllmanNumber(SU, SethiUllmanNumbers); } void updateNode(const SUnit *SU) { SethiUllmanNumbers[SU->NodeNum] = 0; - CalcNodeSethiUllmanNumber(SU); + CalcNodeBUSethiUllmanNumber(SU, SethiUllmanNumbers); } void releaseState() { @@ -1408,7 +1488,48 @@ bool canClobber(const SUnit *SU, const SUnit *Op); void AddPseudoTwoAddrDeps(); void CalculateSethiUllmanNumbers(); - unsigned CalcNodeSethiUllmanNumber(const SUnit *SU); + }; + + + class VISIBILITY_HIDDEN BURegReductionFastPriorityQueue + : public RegReductionPriorityQueue { + // SUnits - The SUnits for the current graph. + const std::vector *SUnits; + + // SethiUllmanNumbers - The SethiUllman number for each node. + std::vector SethiUllmanNumbers; + public: + explicit BURegReductionFastPriorityQueue() {} + + void initNodes(std::vector &sunits) { + SUnits = &sunits; + // Calculate node priorities. + CalculateSethiUllmanNumbers(); + } + + void addNode(const SUnit *SU) { + unsigned SUSize = SethiUllmanNumbers.size(); + if (SUnits->size() > SUSize) + SethiUllmanNumbers.resize(SUSize*2, 0); + CalcNodeBUSethiUllmanNumber(SU, SethiUllmanNumbers); + } + + void updateNode(const SUnit *SU) { + SethiUllmanNumbers[SU->NodeNum] = 0; + CalcNodeBUSethiUllmanNumber(SU, SethiUllmanNumbers); + } + + void releaseState() { + SUnits = 0; + SethiUllmanNumbers.clear(); + } + + unsigned getNodePriority(const SUnit *SU) const { + return SethiUllmanNumbers[SU->NodeNum]; + } + + private: + void CalculateSethiUllmanNumbers(); }; @@ -1430,13 +1551,15 @@ } void addNode(const SUnit *SU) { - SethiUllmanNumbers.resize(SUnits->size(), 0); - CalcNodeSethiUllmanNumber(SU); + unsigned SUSize = SethiUllmanNumbers.size(); + if (SUnits->size() > SUSize) + SethiUllmanNumbers.resize(SUSize*2, 0); + CalcNodeTDSethiUllmanNumber(SU, SethiUllmanNumbers); } void updateNode(const SUnit *SU) { SethiUllmanNumbers[SU->NodeNum] = 0; - CalcNodeSethiUllmanNumber(SU); + CalcNodeTDSethiUllmanNumber(SU, SethiUllmanNumbers); } void releaseState() { @@ -1451,7 +1574,6 @@ private: void CalculateSethiUllmanNumbers(); - unsigned CalcNodeSethiUllmanNumber(const SUnit *SU); }; } @@ -1494,7 +1616,6 @@ // Bottom up bool bu_ls_rr_sort::operator()(const SUnit *left, const SUnit *right) const { - unsigned LPriority = SPQ->getNodePriority(left); unsigned RPriority = SPQ->getNodePriority(right); if (LPriority != RPriority) @@ -1546,6 +1667,17 @@ } bool +bu_ls_rr_fast_sort::operator()(const SUnit *left, const SUnit *right) const { + unsigned LPriority = SPQ->getNodePriority(left); + unsigned RPriority = SPQ->getNodePriority(right); + if (LPriority != RPriority) + return LPriority > RPriority; + assert(left->NodeQueueId && right->NodeQueueId && + "NodeQueueId cannot be zero"); + return (left->NodeQueueId > right->NodeQueueId); +} + +bool BURegReductionPriorityQueue::canClobber(const SUnit *SU, const SUnit *Op) { if (SU->isTwoAddress) { unsigned Opc = SU->Node->getTargetOpcode(); @@ -1671,42 +1803,19 @@ } } -/// CalcNodeSethiUllmanNumber - Priority is the Sethi Ullman number. -/// Smaller number is the higher priority. -unsigned BURegReductionPriorityQueue:: -CalcNodeSethiUllmanNumber(const SUnit *SU) { - unsigned &SethiUllmanNumber = SethiUllmanNumbers[SU->NodeNum]; - if (SethiUllmanNumber != 0) - return SethiUllmanNumber; - - unsigned Extra = 0; - for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); - I != E; ++I) { - 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->isCtrl) - ++Extra; - } - - SethiUllmanNumber += Extra; - - if (SethiUllmanNumber == 0) - SethiUllmanNumber = 1; - - return SethiUllmanNumber; -} - /// CalculateSethiUllmanNumbers - Calculate Sethi-Ullman numbers of all /// scheduling units. void BURegReductionPriorityQueue::CalculateSethiUllmanNumbers() { SethiUllmanNumbers.assign(SUnits->size(), 0); for (unsigned i = 0, e = SUnits->size(); i != e; ++i) - CalcNodeSethiUllmanNumber(&(*SUnits)[i]); + CalcNodeBUSethiUllmanNumber(&(*SUnits)[i], SethiUllmanNumbers); +} +void BURegReductionFastPriorityQueue::CalculateSethiUllmanNumbers() { + SethiUllmanNumbers.assign(SUnits->size(), 0); + + for (unsigned i = 0, e = SUnits->size(); i != e; ++i) + CalcNodeBUSethiUllmanNumber(&(*SUnits)[i], SethiUllmanNumbers); } /// LimitedSumOfUnscheduledPredsOfSuccs - Compute the sum of the unscheduled @@ -1772,53 +1881,13 @@ return (left->NodeQueueId > right->NodeQueueId); } -/// CalcNodeSethiUllmanNumber - Priority is the Sethi Ullman number. -/// Smaller number is the higher priority. -unsigned TDRegReductionPriorityQueue:: -CalcNodeSethiUllmanNumber(const SUnit *SU) { - unsigned &SethiUllmanNumber = SethiUllmanNumbers[SU->NodeNum]; - if (SethiUllmanNumber != 0) - return SethiUllmanNumber; - - unsigned Opc = SU->Node ? SU->Node->getOpcode() : 0; - if (Opc == ISD::TokenFactor || Opc == ISD::CopyToReg) - SethiUllmanNumber = 0xffff; - else if (SU->NumSuccsLeft == 0) - // If SU does not have a use, i.e. it doesn't produce a value that would - // be consumed (e.g. store), then it terminates a chain of computation. - // Give it a small SethiUllman number so it will be scheduled right before - // its predecessors that it doesn't lengthen their live ranges. - SethiUllmanNumber = 0; - else if (SU->NumPredsLeft == 0 && - (Opc != ISD::CopyFromReg || isCopyFromLiveIn(SU))) - SethiUllmanNumber = 0xffff; - else { - int Extra = 0; - for (SUnit::const_pred_iterator I = SU->Preds.begin(), E = SU->Preds.end(); - I != E; ++I) { - 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->isCtrl) - ++Extra; - } - - SethiUllmanNumber += Extra; - } - - return SethiUllmanNumber; -} - /// CalculateSethiUllmanNumbers - Calculate Sethi-Ullman numbers of all /// scheduling units. void TDRegReductionPriorityQueue::CalculateSethiUllmanNumbers() { SethiUllmanNumbers.assign(SUnits->size(), 0); for (unsigned i = 0, e = SUnits->size(); i != e; ++i) - CalcNodeSethiUllmanNumber(&(*SUnits)[i]); + CalcNodeTDSethiUllmanNumber(&(*SUnits)[i], SethiUllmanNumbers); } //===----------------------------------------------------------------------===// @@ -1829,16 +1898,19 @@ SelectionDAG *DAG, MachineBasicBlock *BB, bool Fast) { + if (Fast) + return new ScheduleDAGRRList(*DAG, BB, DAG->getTarget(), true, true, + new BURegReductionFastPriorityQueue()); + const TargetInstrInfo *TII = DAG->getTarget().getInstrInfo(); const TargetRegisterInfo *TRI = DAG->getTarget().getRegisterInfo(); - BURegReductionPriorityQueue *priorityQueue = - new BURegReductionPriorityQueue(TII, TRI, Fast); + BURegReductionPriorityQueue *PQ = new BURegReductionPriorityQueue(TII, TRI); - ScheduleDAGRRList * scheduleDAG = - new ScheduleDAGRRList(*DAG, BB, DAG->getTarget(), true, Fast,priorityQueue); - priorityQueue->setScheduleDAG(scheduleDAG); - return scheduleDAG; + ScheduleDAGRRList *SD = + new ScheduleDAGRRList(*DAG, BB, DAG->getTarget(),true,false, PQ); + PQ->setScheduleDAG(SD); + return SD; } llvm::ScheduleDAG* llvm::createTDRRListDAGScheduler(SelectionDAGISel *IS, @@ -1846,6 +1918,5 @@ MachineBasicBlock *BB, bool Fast) { return new ScheduleDAGRRList(*DAG, BB, DAG->getTarget(), false, Fast, - new TDRegReductionPriorityQueue()); + new TDRegReductionPriorityQueue()); } - From baldrick at free.fr Wed Jul 2 04:56:52 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Jul 2008 09:56:52 -0000 Subject: [llvm-commits] [llvm] r53011 - in /llvm/trunk/lib/CodeGen/SelectionDAG: LegalizeTypes.cpp LegalizeTypes.h Message-ID: <200807020956.m629utlf003908@zion.cs.uiuc.edu> Author: baldrick Date: Wed Jul 2 04:56:41 2008 New Revision: 53011 URL: http://llvm.org/viewvc/llvm-project?rev=53011&view=rev Log: Let AnalyzeNewNode take care of calling ExpungeNode. This makes sure that all new nodes are expunged, not just those the top node of a new subtree. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=53011&r1=53010&r2=53011&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Wed Jul 2 04:56:41 2008 @@ -229,6 +229,9 @@ if (N->getNodeId() != NewNode) return; + // Remove any stale map entries. + ExpungeNode(N); + // Okay, we know that this node is new. Recursively walk all of its operands // to see if they are new also. The depth of this walk is bounded by the size // of the new tree that was constructed (usually 2-3 nodes), so we don't worry @@ -290,8 +293,7 @@ // It is possible, though rare, for the deleted node N to occur as a // target in a map, so note the replacement N -> E in ReplacedNodes. assert(E && "Node not replaced?"); - for (unsigned i = 0, e = E->getNumValues(); i != e; ++i) - DTL.NoteReplacement(SDOperand(N, i), SDOperand(E, i)); + DTL.NoteDeletion(N, E); } virtual void NodeUpdated(SDNode *N) { @@ -314,7 +316,8 @@ if (From == To) return; // If expansion produced new nodes, make sure they are properly marked. - AnalyzeNewNode(To.Val); + ExpungeNode(From.Val); + AnalyzeNewNode(To.Val); // Expunges To. // Anything that used the old node should now use the new one. Note that this // can potentially cause recursive merging. @@ -323,7 +326,7 @@ // The old node may still be present in a map like ExpandedIntegers or // PromotedIntegers. Inform maps about the replacement. - NoteReplacement(From, To); + ReplacedNodes[From] = To; } /// ReplaceNodeWith - Replace uses of the 'from' node's results with the 'to' @@ -332,7 +335,8 @@ if (From == To) return; // If expansion produced new nodes, make sure they are properly marked. - AnalyzeNewNode(To); + ExpungeNode(From); + AnalyzeNewNode(To); // Expunges To. assert(From->getNumValues() == To->getNumValues() && "Node results don't match"); @@ -347,7 +351,7 @@ for (unsigned i = 0, e = From->getNumValues(); i != e; ++i) { assert(From->getValueType(i) == To->getValueType(i) && "Node results don't match"); - NoteReplacement(SDOperand(From, i), SDOperand(To, i)); + ReplacedNodes[SDOperand(From, i)] = SDOperand(To, i); } } @@ -364,84 +368,83 @@ } } -/// ExpungeNode - If this is a reincarnation of a deleted value that was kept -/// around to speed up remapping, remove it from all maps now. The only map -/// that can have a deleted node as a source is ReplacedNodes. Other maps can -/// have deleted nodes as targets, but since their looked-up values are always -/// immediately remapped using RemapNode, resulting in a not-deleted node, this -/// is harmless as long as ReplacedNodes/RemapNode always performs correct -/// mappings. The mapping will always be correct as long as ExpungeNode is -/// called on the source when adding a new node to ReplacedNodes, and called on -/// the target when adding a new node to any map. -void DAGTypeLegalizer::ExpungeNode(SDOperand N) { - if (N.Val->getNodeId() != NewNode) +/// ExpungeNode - If N has a bogus mapping in ReplacedNodes, eliminate it. +/// This can occur when a node is deleted then reallocated as a new node - +/// the mapping in ReplacedNodes applies to the deleted node, not the new +/// one. +/// The only map that can have a deleted node as a source is ReplacedNodes. +/// Other maps can have deleted nodes as targets, but since their looked-up +/// values are always immediately remapped using RemapNode, resulting in a +/// not-deleted node, this is harmless as long as ReplacedNodes/RemapNode +/// always performs correct mappings. In order to keep the mapping correct, +/// ExpungeNode should be called on any new nodes *before* adding them as +/// either source or target to ReplacedNodes (which typically means calling +/// Expunge when a new node is first seen, since it may no longer be marked +/// NewNode by the time it is added to ReplacedNodes). +void DAGTypeLegalizer::ExpungeNode(SDNode *N) { + if (N->getNodeId() != NewNode) return; - SDOperand Replacement = N; - RemapNode(Replacement); - if (Replacement != N) { - // Remove N from all maps - this is expensive but extremely rare. - ReplacedNodes.erase(N); - - for (DenseMap::iterator I = ReplacedNodes.begin(), - E = ReplacedNodes.end(); I != E; ++I) { - if (I->second == N) - I->second = Replacement; - } + // If N is not remapped by ReplacedNodes then there is nothing to do. + unsigned i, e; + for (i = 0, e = N->getNumValues(); i != e; ++i) + if (ReplacedNodes.find(SDOperand(N, i)) != ReplacedNodes.end()) + break; - for (DenseMap::iterator I = PromotedIntegers.begin(), - E = PromotedIntegers.end(); I != E; ++I) { - assert(I->first != N); - if (I->second == N) - I->second = Replacement; - } + if (i == e) + return; - for (DenseMap::iterator I = SoftenedFloats.begin(), - E = SoftenedFloats.end(); I != E; ++I) { - assert(I->first != N); - if (I->second == N) - I->second = Replacement; - } + // Remove N from all maps - this is expensive but rare. - for (DenseMap::iterator I = ScalarizedVectors.begin(), - E = ScalarizedVectors.end(); I != E; ++I) { - assert(I->first != N); - if (I->second == N) - I->second = Replacement; - } + for (DenseMap::iterator I = PromotedIntegers.begin(), + E = PromotedIntegers.end(); I != E; ++I) { + assert(I->first.Val != N); + RemapNode(I->second); + } - for (DenseMap >::iterator - I = ExpandedIntegers.begin(), E = ExpandedIntegers.end(); I != E; ++I){ - assert(I->first != N); - if (I->second.first == N) - I->second.first = Replacement; - if (I->second.second == N) - I->second.second = Replacement; - } + for (DenseMap::iterator I = SoftenedFloats.begin(), + E = SoftenedFloats.end(); I != E; ++I) { + assert(I->first.Val != N); + RemapNode(I->second); + } - for (DenseMap >::iterator - I = ExpandedFloats.begin(), E = ExpandedFloats.end(); I != E; ++I) { - assert(I->first != N); - if (I->second.first == N) - I->second.first = Replacement; - if (I->second.second == N) - I->second.second = Replacement; - } + for (DenseMap::iterator I = ScalarizedVectors.begin(), + E = ScalarizedVectors.end(); I != E; ++I) { + assert(I->first.Val != N); + RemapNode(I->second); + } - for (DenseMap >::iterator - I = SplitVectors.begin(), E = SplitVectors.end(); I != E; ++I) { - assert(I->first != N); - if (I->second.first == N) - I->second.first = Replacement; - if (I->second.second == N) - I->second.second = Replacement; - } + for (DenseMap >::iterator + I = ExpandedIntegers.begin(), E = ExpandedIntegers.end(); I != E; ++I){ + assert(I->first.Val != N); + RemapNode(I->second.first); + RemapNode(I->second.second); + } + + for (DenseMap >::iterator + I = ExpandedFloats.begin(), E = ExpandedFloats.end(); I != E; ++I) { + assert(I->first.Val != N); + RemapNode(I->second.first); + RemapNode(I->second.second); + } + + for (DenseMap >::iterator + I = SplitVectors.begin(), E = SplitVectors.end(); I != E; ++I) { + assert(I->first.Val != N); + RemapNode(I->second.first); + RemapNode(I->second.second); } + + for (DenseMap::iterator I = ReplacedNodes.begin(), + E = ReplacedNodes.end(); I != E; ++I) + RemapNode(I->second); + + for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) + ReplacedNodes.erase(SDOperand(N, i)); } void DAGTypeLegalizer::SetPromotedInteger(SDOperand Op, SDOperand Result) { - ExpungeNode(Result); AnalyzeNewNode(Result.Val); SDOperand &OpEntry = PromotedIntegers[Op]; @@ -450,7 +453,6 @@ } void DAGTypeLegalizer::SetSoftenedFloat(SDOperand Op, SDOperand Result) { - ExpungeNode(Result); AnalyzeNewNode(Result.Val); SDOperand &OpEntry = SoftenedFloats[Op]; @@ -459,7 +461,6 @@ } void DAGTypeLegalizer::SetScalarizedVector(SDOperand Op, SDOperand Result) { - ExpungeNode(Result); AnalyzeNewNode(Result.Val); SDOperand &OpEntry = ScalarizedVectors[Op]; @@ -479,9 +480,6 @@ void DAGTypeLegalizer::SetExpandedInteger(SDOperand Op, SDOperand Lo, SDOperand Hi) { - ExpungeNode(Lo); - ExpungeNode(Hi); - // Lo/Hi may have been newly allocated, if so, add nodeid's as relevant. AnalyzeNewNode(Lo.Val); AnalyzeNewNode(Hi.Val); @@ -505,9 +503,6 @@ void DAGTypeLegalizer::SetExpandedFloat(SDOperand Op, SDOperand Lo, SDOperand Hi) { - ExpungeNode(Lo); - ExpungeNode(Hi); - // Lo/Hi may have been newly allocated, if so, add nodeid's as relevant. AnalyzeNewNode(Lo.Val); AnalyzeNewNode(Hi.Val); @@ -531,9 +526,6 @@ void DAGTypeLegalizer::SetSplitVector(SDOperand Op, SDOperand Lo, SDOperand Hi) { - ExpungeNode(Lo); - ExpungeNode(Hi); - // Lo/Hi may have been newly allocated, if so, add nodeid's as relevant. AnalyzeNewNode(Lo.Val); AnalyzeNewNode(Hi.Val); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=53011&r1=53010&r2=53011&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Wed Jul 2 04:56:41 2008 @@ -161,10 +161,11 @@ AnalyzeNewNode(N); } - void NoteReplacement(SDOperand From, SDOperand To) { - ExpungeNode(From); - ExpungeNode(To); - ReplacedNodes[From] = To; + void NoteDeletion(SDNode *Old, SDNode *New) { + ExpungeNode(Old); + ExpungeNode(New); + for (unsigned i = 0, e = Old->getNumValues(); i != e; ++i) + ReplacedNodes[SDOperand(Old, i)] = SDOperand(New, i); } private: @@ -174,7 +175,7 @@ void ReplaceNodeWith(SDNode *From, SDNode *To); void RemapNode(SDOperand &N); - void ExpungeNode(SDOperand N); + void ExpungeNode(SDNode *N); // Common routines. SDOperand CreateStackStoreLoad(SDOperand Op, MVT DestVT); From baldrick at free.fr Wed Jul 2 05:04:12 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Jul 2008 10:04:12 -0000 Subject: [llvm-commits] [llvm] r53012 - /llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Message-ID: <200807021004.m62A4GVF004134@zion.cs.uiuc.edu> Author: baldrick Date: Wed Jul 2 05:03:53 2008 New Revision: 53012 URL: http://llvm.org/viewvc/llvm-project?rev=53012&view=rev Log: Fix typo compounded by a cut-and-pasto. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=53012&r1=53011&r2=53012&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Wed Jul 2 05:03:53 2008 @@ -335,8 +335,8 @@ case ISD::BIT_CONVERT: Res = SoftenFloatOp_BIT_CONVERT(N); break; case ISD::BR_CC: Res = SoftenFloatOp_BR_CC(N); break; - case ISD::SELECT_CC: Res = SoftenFloatOp_BR_CC(N); break; - case ISD::SETCC: Res = SoftenFloatOp_BR_CC(N); break; + case ISD::SELECT_CC: Res = SoftenFloatOp_SELECT_CC(N); break; + case ISD::SETCC: Res = SoftenFloatOp_SETCC(N); break; } } @@ -759,8 +759,8 @@ case ISD::EXTRACT_ELEMENT: Res = ExpandOp_EXTRACT_ELEMENT(N); break; case ISD::BR_CC: Res = ExpandFloatOp_BR_CC(N); break; - case ISD::SELECT_CC: Res = ExpandFloatOp_BR_CC(N); break; - case ISD::SETCC: Res = ExpandFloatOp_BR_CC(N); break; + case ISD::SELECT_CC: Res = ExpandFloatOp_SELECT_CC(N); break; + case ISD::SETCC: Res = ExpandFloatOp_SETCC(N); break; case ISD::FP_ROUND: Res = ExpandFloatOp_FP_ROUND(N); break; case ISD::FP_TO_SINT: Res = ExpandFloatOp_FP_TO_SINT(N); break; From matthijs at stdin.nl Wed Jul 2 08:55:23 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Wed, 02 Jul 2008 13:55:23 -0000 Subject: [llvm-commits] [llvm] r53018 - /llvm/trunk/docs/index.html Message-ID: <200807021355.m62DtW4T011587@zion.cs.uiuc.edu> Author: matthijs Date: Wed Jul 2 08:54:58 2008 New Revision: 53018 URL: http://llvm.org/viewvc/llvm-project?rev=53018&view=rev Log: Update link to testing guide to use the new title. Modified: llvm/trunk/docs/index.html Modified: llvm/trunk/docs/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/index.html?rev=53018&r1=53017&r2=53018&view=diff ============================================================================== --- llvm/trunk/docs/index.html (original) +++ llvm/trunk/docs/index.html Wed Jul 2 08:54:58 2008 @@ -105,8 +105,8 @@ Instructions for properly submitting information about any bugs you run into in the LLVM system. -
  • LLVM Test Suite Guide - A reference -manual for using the LLVM test suite.
  • +
  • LLVM Testing Infrastructure Guide - A reference +manual for using the LLVM testing infrastructure.
  • How to build the C/C++ front-end - Instructions for building the front-end from source.
  • From isanbard at gmail.com Wed Jul 2 10:18:57 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 2 Jul 2008 08:18:57 -0700 Subject: [llvm-commits] [llvm] r52994 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp In-Reply-To: <200807020843.06862.baldrick@free.fr> References: <200807012334.m61NYnqf006834@zion.cs.uiuc.edu> <200807020843.06862.baldrick@free.fr> Message-ID: On Jul 1, 2008, at 11:43 PM, Duncan Sands wrote: >> Darwin doesn't need exception handling information for the "move" >> info when >> debug information is being output, because it's leet! > > Does any target need it? I can't see why it would. I don't know. Dale put it in there at the beginning. If I recall correctly, it was because of discussions with you ;-). > By the way, there seems to > be some overloading of the term "frame moves". There are moves > that tell the > unwinder how to restore registers. But the debug info has > something similar > which tells where to find values for variables. So I'd rather talk > of EHMoves > rather than FrameMoves (though even better would be to remove this > parameter). > Sure. -bw From baldrick at free.fr Wed Jul 2 10:26:15 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 2 Jul 2008 17:26:15 +0200 Subject: [llvm-commits] [llvm] r52994 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp In-Reply-To: References: <200807012334.m61NYnqf006834@zion.cs.uiuc.edu> <200807020843.06862.baldrick@free.fr> Message-ID: <200807021726.15398.baldrick@free.fr> > >> Darwin doesn't need exception handling information for the "move" > >> info when > >> debug information is being output, because it's leet! > > > > Does any target need it? I can't see why it would. > > I don't know. Dale put it in there at the beginning. If I recall > correctly, it was because of discussions with you ;-). Yup, at that time I hadn't looked at debug frames at all, and wasn't sure whether the same frame moves info was being used for eh and for debugging. In fact they are separate. Shall I remove this parameter or would you like to? Ciao, Duncan. From isanbard at gmail.com Wed Jul 2 10:35:28 2008 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 2 Jul 2008 08:35:28 -0700 Subject: [llvm-commits] [llvm] r52994 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp In-Reply-To: <200807021726.15398.baldrick@free.fr> References: <200807012334.m61NYnqf006834@zion.cs.uiuc.edu> <200807020843.06862.baldrick@free.fr> <200807021726.15398.baldrick@free.fr> Message-ID: <33213ED8-226A-40D2-AD43-3044095C570A@gmail.com> On Jul 2, 2008, at 8:26 AM, Duncan Sands wrote: >>>> Darwin doesn't need exception handling information for the "move" >>>> info when >>>> debug information is being output, because it's leet! >>> >>> Does any target need it? I can't see why it would. >> >> I don't know. Dale put it in there at the beginning. If I recall >> correctly, it was because of discussions with you ;-). > > Yup, at that time I hadn't looked at debug frames at all, and > wasn't sure whether the same frame moves info was being used > for eh and for debugging. In fact they are separate. Shall > I remove this parameter or would you like to? > To be honest, my understanding of this is limited. I think it would be better if you do it. It would limit the chance for mistakes. :-) Also, I don't have access to a non-Mac box to do any testing. -bw From matthijs at stdin.nl Wed Jul 2 11:11:28 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Wed, 2 Jul 2008 18:11:28 +0200 Subject: [llvm-commits] [llvm] r52677 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll test/Transforms/DeadArgElim/deadretval2.ll test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: <20080702084001.GC7287@katherina.student.utwente.nl> References: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> <77A96C06-9C33-49DE-A06F-F8D4C48BC9F6@apple.com> <20080702084001.GC7287@katherina.student.utwente.nl> Message-ID: <20080702161128.GH7287@katherina.student.utwente.nl> Hi all, I've attached a new patch, which removes an overzealous assert which was not appropriated. Even, could you try _this_ patch against SPEC 2006? > I'm not completely sure how to do the reverse. I think the best approach is to > add a getArgumentNo() method that takes an operand number and returns the > number of the corresponding argument. Alternatively, it could take a use > iterator, Value* or Use* or something like that, but I think that will mostly > lead to inefficient code. I've implemented this, see the attached patch (all changes in CallSite.h). If there are no objections to this, I'll commit the CallSite changes seperately. Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: deadarg.diff Type: text/x-diff Size: 49191 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080702/a1177e25/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080702/a1177e25/attachment-0001.bin From matthijs at stdin.nl Wed Jul 2 11:16:24 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Wed, 2 Jul 2008 18:16:24 +0200 Subject: [llvm-commits] [llvm] r52537 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp In-Reply-To: References: <200806201516.m5KFGkRv024435@zion.cs.uiuc.edu> Message-ID: <20080702161624.GI7287@katherina.student.utwente.nl> Hi Chris, > > Don't let DeadArgElimination change the return type ({} into void > > and {T} > > into T) when no return values are actually dead. > Out of curiosity, why not? {x} -> x would eliminate extractvalue > instructions, so it seems that it would reduce the size of the IR. I just tried a bit to implement this, but this poses problems again when the result is used as is again. For example: %S = call { i32 } @foo() call void @bar({ i32 } %S) here the result of @foo was correctly marked live, but the code would still try to turn it into call i32 @foo() and then be surprised that %S was used by other stuff than extractvalues. I can solve this by, in addition to a list of Functions that really can't be modified at all, keeping a list of Functions whose return values really can't be modified at all (which is slightly different from having all return values live only for functions returning a struct with a single element, or perhaps for zero elements as well). However, I'm not really sure this is worth the effort. Perhaps this should be done in a different pass, really? Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080702/583aad70/attachment.bin From baldrick at free.fr Wed Jul 2 11:22:38 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 2 Jul 2008 18:22:38 +0200 Subject: [llvm-commits] =?iso-8859-15?q?=5Bllvm=5D_r52677_-_in_/llvm/trunk?= =?iso-8859-15?q?=3A=09lib/Transforms/IPO/DeadArgumentElimination=2Ecpp=09?= =?iso-8859-15?q?test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive=2Ell?= =?iso-8859-15?q?=09test/Transforms/DeadArgElim/deadretval2=2Ell=09test/Tr?= =?iso-8859-15?q?ansforms/DeadArgElim/multdeadretval=2Ell?= In-Reply-To: <20080702161128.GH7287@katherina.student.utwente.nl> References: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> <20080702084001.GC7287@katherina.student.utwente.nl> <20080702161128.GH7287@katherina.student.utwente.nl> Message-ID: <200807021822.38614.baldrick@free.fr> Hi, > I've implemented this, see the attached patch (all changes in CallSite.h). If > there are no objections to this, I'll commit the CallSite changes seperately. can you please post patches inline and not as attachments. It makes them easier to comment on. Thanks, Duncan. From clattner at apple.com Wed Jul 2 11:46:17 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 2 Jul 2008 09:46:17 -0700 Subject: [llvm-commits] [llvm] r52987 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp In-Reply-To: <200807020836.20593.baldrick@free.fr> References: <200807012208.m61M81Ml004300@zion.cs.uiuc.edu> <653051EC-EFF8-4688-92B1-40867AD5C6CE@apple.com> <16e5fdf90807011516k3e54849fl58e4fb7f1472ee41@mail.gmail.com> <200807020836.20593.baldrick@free.fr> Message-ID: <09CCAB95-E5EC-486D-BD97-4B9E10E3F613@apple.com> On Jul 1, 2008, at 11:36 PM, Duncan Sands wrote: >>>> - Don't use GlobalVariable::LinkageTypes when unsigned works. >>> >>> Is there some reason we need this? I strongly prefer the enum if it >>> works. >>> Makes things easier to read and harder to abuse. >>> >> It required pulling in the GlobalVariable.h header into the >> MachineDebugInfoDesc.h file. That's the only reason I can think of. > > I'm with Dale here. How about putting the enum in its own header > instead? It would be better to have a debug-info-specific enum value than to reuse the one in GlobalValue. Debug info (like assemblers) don't distinguish between linkonce and weak for example. The producer of the debug info should do this "lowering". -Chris From clattner at apple.com Wed Jul 2 11:50:35 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 2 Jul 2008 09:50:35 -0700 Subject: [llvm-commits] [llvm] r52537 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp In-Reply-To: <20080702161624.GI7287@katherina.student.utwente.nl> References: <200806201516.m5KFGkRv024435@zion.cs.uiuc.edu> <20080702161624.GI7287@katherina.student.utwente.nl> Message-ID: <192117C6-9780-4C96-9F1F-E055FFC033FE@apple.com> On Jul 2, 2008, at 9:16 AM, Matthijs Kooijman wrote: > Hi Chris, > >>> Don't let DeadArgElimination change the return type ({} into void >>> and {T} >>> into T) when no return values are actually dead. >> Out of curiosity, why not? {x} -> x would eliminate extractvalue >> instructions, so it seems that it would reduce the size of the IR. > I just tried a bit to implement this, but this poses problems again > when the > result is used as is again. For example: > %S = call { i32 } @foo() > call void @bar({ i32 } %S) > > here the result of @foo was correctly marked live, but the code > would still > try to turn it into call i32 @foo() and then be surprised that %S > was used by > other stuff than extractvalues. I can solve this by, in addition to > a list > of Functions that really can't be modified at all, keeping a list of > Functions > whose return values really can't be modified at all (which is slightly > different from having all return values live only for functions > returning a > struct with a single element, or perhaps for zero elements as well). I still think it would be preferable to lower this into: %S = call i32 @foo() %t = insertvalue {i32} undef, 0, i32 %S call void @bar({ i32 } %t) This is not an "optimization" by itself persay, but it *is* a canonicalization, and it is useful to have canonical forms for code. > However, I'm not really sure this is worth the effort. Perhaps this > should be > done in a different pass, really? Why in a different pass? -Chris From dalej at apple.com Wed Jul 2 11:58:18 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 2 Jul 2008 09:58:18 -0700 Subject: [llvm-commits] [llvm] r52537 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp In-Reply-To: <192117C6-9780-4C96-9F1F-E055FFC033FE@apple.com> References: <200806201516.m5KFGkRv024435@zion.cs.uiuc.edu> <20080702161624.GI7287@katherina.student.utwente.nl> <192117C6-9780-4C96-9F1F-E055FFC033FE@apple.com> Message-ID: <1E9986AA-55D4-479B-BE07-AAF16F5831A9@apple.com> On Jul 2, 2008, at 9:50 AMPDT, Chris Lattner wrote: > On Jul 2, 2008, at 9:16 AM, Matthijs Kooijman wrote: >> Hi Chris, >> >>>> Don't let DeadArgElimination change the return type ({} into void >>>> and {T} >>>> into T) when no return values are actually dead. >>> Out of curiosity, why not? {x} -> x would eliminate extractvalue >>> instructions, so it seems that it would reduce the size of the IR. Maybe I'm missing something, but wouldn't this assume call i32 and call {i32} use the same calling convention? I don't think we can assume that in general. >>> I just tried a bit to implement this, but this poses problems again >> when the >> result is used as is again. For example: >> %S = call { i32 } @foo() >> call void @bar({ i32 } %S) >> >> here the result of @foo was correctly marked live, but the code >> would still >> try to turn it into call i32 @foo() and then be surprised that %S >> was used by >> other stuff than extractvalues. I can solve this by, in addition to >> a list >> of Functions that really can't be modified at all, keeping a list of >> Functions >> whose return values really can't be modified at all (which is >> slightly >> different from having all return values live only for functions >> returning a >> struct with a single element, or perhaps for zero elements as well). > > I still think it would be preferable to lower this into: > > %S = call i32 @foo() > %t = insertvalue {i32} undef, 0, i32 %S > call void @bar({ i32 } %t) > > This is not an "optimization" by itself persay, but it *is* a > canonicalization, and it is useful to have canonical forms for code. > >> However, I'm not really sure this is worth the effort. Perhaps this >> should be >> done in a different pass, really? > > Why in a different pass? > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Wed Jul 2 12:01:57 2008 From: sabre at nondot.org (Chris Lattner) Date: Wed, 02 Jul 2008 17:01:57 -0000 Subject: [llvm-commits] [llvm] r53030 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200807021701.m62H1w5G017986@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 2 12:01:57 2008 New Revision: 53030 URL: http://llvm.org/viewvc/llvm-project?rev=53030&view=rev Log: instead of aborting on shifts of i1, just implicitly fold them. The dag combiner can produce a shift of i1 when folding icmp i1's. 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=53030&r1=53029&r2=53030&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jul 2 12:01:57 2008 @@ -2192,7 +2192,13 @@ assert(VT == N1.getValueType() && "Shift operators return type must be the same as their first arg"); assert(VT.isInteger() && N2.getValueType().isInteger() && - VT != MVT::i1 && "Shifts only work on integers"); + "Shifts only work on integers"); + + // Always fold shifts of i1 values so the code generator doesn't need to + // handle them. Since we know the size of the shift has to be less than the + // size of the value, the shift/rotate count is guaranteed to be zero. + if (VT == MVT::i1) + return N1; break; case ISD::FP_ROUND_INREG: { MVT EVT = cast(N2)->getVT(); From baldrick at free.fr Wed Jul 2 12:05:35 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 2 Jul 2008 19:05:35 +0200 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r52537=09-_/llvm/trunk/l?= =?iso-8859-1?q?ib/Transforms/IPO/DeadArgumentElimination=2Ecpp?= In-Reply-To: <1E9986AA-55D4-479B-BE07-AAF16F5831A9@apple.com> References: <200806201516.m5KFGkRv024435@zion.cs.uiuc.edu> <192117C6-9780-4C96-9F1F-E055FFC033FE@apple.com> <1E9986AA-55D4-479B-BE07-AAF16F5831A9@apple.com> Message-ID: <200807021905.36338.baldrick@free.fr> > Maybe I'm missing something, but wouldn't this assume call i32 and > call {i32} use the same calling convention? I don't think we can assume > that in general. I've noticed that llvm-gcc returns a complex number (i.e. { float, float }) as { double } and not double on some platforms. If this is for ABI reasons (and not a bug!) then it would be an example of what Dale is talking about. Ciao, Duncan. From dpatel at apple.com Wed Jul 2 12:05:45 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 2 Jul 2008 10:05:45 -0700 Subject: [llvm-commits] [llvm] r52537 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp In-Reply-To: <1E9986AA-55D4-479B-BE07-AAF16F5831A9@apple.com> References: <200806201516.m5KFGkRv024435@zion.cs.uiuc.edu> <20080702161624.GI7287@katherina.student.utwente.nl> <192117C6-9780-4C96-9F1F-E055FFC033FE@apple.com> <1E9986AA-55D4-479B-BE07-AAF16F5831A9@apple.com> Message-ID: On Jul 2, 2008, at 9:58 AM, Dale Johannesen wrote: > On Jul 2, 2008, at 9:50 AMPDT, Chris Lattner wrote: >> On Jul 2, 2008, at 9:16 AM, Matthijs Kooijman wrote: >>> Hi Chris, >>> >>>>> Don't let DeadArgElimination change the return type ({} into void >>>>> and {T} >>>>> into T) when no return values are actually dead. >>>> Out of curiosity, why not? {x} -> x would eliminate extractvalue >>>> instructions, so it seems that it would reduce the size of the IR. > > Maybe I'm missing something, but wouldn't this assume call i32 and > call {i32} use the same calling convention? I don't think we can > assume > that in general. This is not for externally visible functions. - Devang From wangmp at apple.com Wed Jul 2 12:07:14 2008 From: wangmp at apple.com (Mon P Wang) Date: Wed, 02 Jul 2008 17:07:14 -0000 Subject: [llvm-commits] [llvm] r53031 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200807021707.m62H7EDD018155@zion.cs.uiuc.edu> Author: wangmp Date: Wed Jul 2 12:07:12 2008 New Revision: 53031 URL: http://llvm.org/viewvc/llvm-project?rev=53031&view=rev Log: Fixed problem in EmitStackConvert where the source and target type have different alignment by creating a stack slot with the max alignment of source and target type. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=53031&r1=53030&r2=53031&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Jul 2 12:07:12 2008 @@ -574,9 +574,10 @@ void dump() const; /// CreateStackTemporary - Create a stack temporary, suitable for holding the - /// specified value type. - SDOperand CreateStackTemporary(MVT VT); - + /// specified value type. If minAlign is specified, the slot size will have + /// at least that alignment. + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 0); + /// FoldSetCC - Constant fold a setcc to true or false. SDOperand FoldSetCC(MVT VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=53031&r1=53030&r2=53031&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jul 2 12:07:12 2008 @@ -4872,35 +4872,41 @@ MVT SlotVT, MVT DestVT) { // Create the stack frame object. - SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT); - + unsigned SrcAlign = TLI.getTargetData()->getPrefTypeAlignment( + SrcOp.getValueType().getTypeForMVT()); + SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT, SrcAlign); + FrameIndexSDNode *StackPtrFI = cast(FIPtr); int SPFI = StackPtrFI->getIndex(); - + unsigned SrcSize = SrcOp.getValueType().getSizeInBits(); unsigned SlotSize = SlotVT.getSizeInBits(); unsigned DestSize = DestVT.getSizeInBits(); + const Type* SlotTy = SlotVT.getTypeForMVT(); + unsigned SlotAlign = TLI.getTargetData()->getPrefTypeAlignment(SlotTy); // Emit a store to the stack slot. Use a truncstore if the input value is // later than DestVT. SDOperand Store; + if (SrcSize > SlotSize) Store = DAG.getTruncStore(DAG.getEntryNode(), SrcOp, FIPtr, - PseudoSourceValue::getFixedStack(), - SPFI, SlotVT); + PseudoSourceValue::getFixedStack(), SPFI, SlotVT, + false, SlotAlign); else { assert(SrcSize == SlotSize && "Invalid store"); Store = DAG.getStore(DAG.getEntryNode(), SrcOp, FIPtr, - PseudoSourceValue::getFixedStack(), - SPFI); + PseudoSourceValue::getFixedStack(), SPFI, + false, SlotAlign); } // Result is a load from the stack slot. if (SlotSize == DestSize) - return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0); + return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0, false, SlotAlign); assert(SlotSize < DestSize && "Unknown extension!"); - return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT); + return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT, + false, SlotAlign); } SDOperand SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(SDNode *Node) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=53031&r1=53030&r2=53031&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jul 2 12:07:12 2008 @@ -1080,16 +1080,17 @@ /// CreateStackTemporary - Create a stack temporary, suitable for holding the /// specified value type. -SDOperand SelectionDAG::CreateStackTemporary(MVT VT) { +SDOperand SelectionDAG::CreateStackTemporary(MVT VT, unsigned minAlign) { MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo(); unsigned ByteSize = VT.getSizeInBits()/8; const Type *Ty = VT.getTypeForMVT(); - unsigned StackAlign = (unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty); + unsigned StackAlign = + std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty), minAlign); + int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign); return getFrameIndex(FrameIdx, TLI.getPointerTy()); } - SDOperand SelectionDAG::FoldSetCC(MVT VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond) { // These setcc operations always fold. From dalej at apple.com Wed Jul 2 12:08:58 2008 From: dalej at apple.com (Dale Johannesen) Date: Wed, 2 Jul 2008 10:08:58 -0700 Subject: [llvm-commits] [llvm] r52537 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp In-Reply-To: References: <200806201516.m5KFGkRv024435@zion.cs.uiuc.edu> <20080702161624.GI7287@katherina.student.utwente.nl> <192117C6-9780-4C96-9F1F-E055FFC033FE@apple.com> <1E9986AA-55D4-479B-BE07-AAF16F5831A9@apple.com> Message-ID: <0E4982D9-622A-4330-8E40-EC5EC7E69BD2@apple.com> On Jul 2, 2008, at 10:05 AMPDT, Devang Patel wrote: > > On Jul 2, 2008, at 9:58 AM, Dale Johannesen wrote: > >> On Jul 2, 2008, at 9:50 AMPDT, Chris Lattner wrote: >>> On Jul 2, 2008, at 9:16 AM, Matthijs Kooijman wrote: >>>> Hi Chris, >>>> >>>>>> Don't let DeadArgElimination change the return type ({} into void >>>>>> and {T} >>>>>> into T) when no return values are actually dead. >>>>> Out of curiosity, why not? {x} -> x would eliminate extractvalue >>>>> instructions, so it seems that it would reduce the size of the IR. >> >> Maybe I'm missing something, but wouldn't this assume call i32 and >> call {i32} use the same calling convention? I don't think we can >> assume >> that in general. > > This is not for externally visible functions. OK, that's what I'm missing, we can safely change the calling convention of static functions...provided all calls are changed, and caller and callee are changed in sync... From resistor at mac.com Wed Jul 2 12:20:31 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 02 Jul 2008 17:20:31 -0000 Subject: [llvm-commits] [llvm] r53032 - in /llvm/trunk: lib/Analysis/MemoryDependenceAnalysis.cpp lib/Transforms/Scalar/GVN.cpp test/Transforms/GVN/2008-07-02-Unreachable.ll Message-ID: <200807021720.m62HKXPg018649@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 2 12:20:16 2008 New Revision: 53032 URL: http://llvm.org/viewvc/llvm-project?rev=53032&view=rev Log: A better fix for PR2503 that doesn't pessimize GVN in the presence of unreachable blocks. Added: llvm/trunk/test/Transforms/GVN/2008-07-02-Unreachable.ll 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=53032&r1=53031&r2=53032&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Wed Jul 2 12:20:16 2008 @@ -19,7 +19,6 @@ #include "llvm/Instructions.h" #include "llvm/Function.h" #include "llvm/Analysis/AliasAnalysis.h" -#include "llvm/Analysis/Dominators.h" #include "llvm/Support/CFG.h" #include "llvm/Support/CommandLine.h" #include "llvm/Target/TargetData.h" @@ -83,7 +82,6 @@ AU.setPreservesAll(); AU.addRequiredTransitive(); AU.addRequiredTransitive(); - AU.addRequiredTransitive(); } /// getCallSiteDependency - Private helper for finding the local dependencies @@ -224,17 +222,6 @@ continue; } - // Don't recur upwards if the current block is unreachable. - // Instead, mark it as having no dependency on this path, - // which will block optzns from occuring. For this reason, - // eliminating unreachable blocks before running a memdep - // based optimization is recommended. - DominatorTree& DT = getAnalysis(); - if (!DT.isReachableFromEntry(BB)) { - resp.insert(std::make_pair(BB, None)); - continue; - } - // If we didn't find anything, recurse on the precessors of this block // Only do this for blocks with a small number of predecessors. bool predOnStack = false; Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=53032&r1=53031&r2=53032&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Wed Jul 2 12:20:16 2008 @@ -808,6 +808,11 @@ DenseMap::iterator V = Phis.find(BB); if (V != Phis.end() && !top_level) return V->second; + if (!getAnalysis().isReachableFromEntry(BB)) { + Phis[BB] = UndefValue::get(orig->getType()); + return UndefValue::get(orig->getType()); + } + BasicBlock* singlePred = BB->getSinglePredecessor(); if (singlePred) { Value *ret = GetValueForBlock(singlePred, orig, Phis); Added: llvm/trunk/test/Transforms/GVN/2008-07-02-Unreachable.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVN/2008-07-02-Unreachable.ll?rev=53032&view=auto ============================================================================== --- llvm/trunk/test/Transforms/GVN/2008-07-02-Unreachable.ll (added) +++ llvm/trunk/test/Transforms/GVN/2008-07-02-Unreachable.ll Wed Jul 2 12:20:16 2008 @@ -0,0 +1,36 @@ +; RUN: llvm-as < %s | opt -gvn | llvm-dis | grep undef +; PR2503 +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin9.3.0" + at g_3 = external global i8 ; [#uses=2] + +define i32 @func_1() nounwind { +entry: + br i1 false, label %ifelse, label %ifthen + +ifthen: ; preds = %entry + br label %ifend + +ifelse: ; preds = %entry + %tmp3 = load i8* @g_3 ; [#uses=0] + br label %forcond.thread + +forcond.thread: ; preds = %ifelse + br label %afterfor + +forcond: ; preds = %forinc + br i1 false, label %afterfor, label %forbody + +forbody: ; preds = %forcond + br label %forinc + +forinc: ; preds = %forbody + br label %forcond + +afterfor: ; preds = %forcond, %forcond.thread + %tmp10 = load i8* @g_3 ; [#uses=0] + br label %ifend + +ifend: ; preds = %afterfor, %ifthen + ret i32 0 +} From resistor at mac.com Wed Jul 2 12:30:14 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 02 Jul 2008 17:30:14 -0000 Subject: [llvm-commits] [llvm] r53033 - /llvm/trunk/include/llvm/ADT/DenseSet.h Message-ID: <200807021730.m62HUGc1019038@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 2 12:29:59 2008 New Revision: 53033 URL: http://llvm.org/viewvc/llvm-project?rev=53033&view=rev Log: Have DenseSet::insert return a bool indicating whether the insertion succeeded or not. Modified: llvm/trunk/include/llvm/ADT/DenseSet.h Modified: llvm/trunk/include/llvm/ADT/DenseSet.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseSet.h?rev=53033&r1=53032&r2=53033&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseSet.h (original) +++ llvm/trunk/include/llvm/ADT/DenseSet.h Wed Jul 2 12:29:59 2008 @@ -41,8 +41,8 @@ return TheMap.count(V); } - void insert(const ValueT &V) { - TheMap[V] = 0; + bool insert(const ValueT &V) { + return TheMap.insert(std::make_pair(V, 0)); } void erase(const ValueT &V) { From resistor at mac.com Wed Jul 2 12:32:04 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 02 Jul 2008 17:32:04 -0000 Subject: [llvm-commits] [llvm] r53034 - /llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Message-ID: <200807021732.m62HW44C019185@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 2 12:32:04 2008 New Revision: 53034 URL: http://llvm.org/viewvc/llvm-project?rev=53034&view=rev Log: Use DenseSet rather than SmallPtrSet for the alive set. Using SmallPtrSet with a huge "size" parameter is actually quite inefficient. Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=53034&r1=53033&r2=53034&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Wed Jul 2 12:32:04 2008 @@ -21,7 +21,7 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/InstIterator.h" #include "llvm/ADT/Statistic.h" -#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/SmallVector.h" using namespace llvm; @@ -33,7 +33,7 @@ static char ID; // Pass identification, replacement for typeid ADCE() : FunctionPass((intptr_t)&ID) {} - SmallPtrSet alive; + DenseSet alive; SmallVector worklist; virtual bool runOnFunction(Function& F); From evan.cheng at apple.com Wed Jul 2 12:36:56 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 2 Jul 2008 10:36:56 -0700 Subject: [llvm-commits] Slot alignment In-Reply-To: <200807020854.26505.baldrick@free.fr> References: <200807020854.26505.baldrick@free.fr> Message-ID: <5A3BB7F6-2528-4E5E-93F2-B295FBC0F0BE@apple.com> On Jul 1, 2008, at 11:54 PM, Duncan Sands wrote: > Hi, > >> SDOperand SelectionDAG::CreateStackTemporary(MVT VT) { >> + return CreateStackTemporary(VT, 1); > > while it doesn't hurt to use 1, you could also use 0 here. > >> + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1); > > Here too. Alignment of 0 doesn't really make sense. I am not sure I see the benefit of using 0 instead of 1. Evan > > > Ciao, > > Duncan. > > PS: Can you please include patches inline rather than > attaching them (if they are not too humungous) - that > makes it easier to add comments. Thanks! > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Wed Jul 2 12:41:05 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 02 Jul 2008 17:41:05 -0000 Subject: [llvm-commits] [llvm] r53035 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp Message-ID: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> Author: baldrick Date: Wed Jul 2 12:40:58 2008 New Revision: 53035 URL: http://llvm.org/viewvc/llvm-project?rev=53035&view=rev Log: Add a new getMergeValues method that does not need to be passed the list of value types, and use this where appropriate. Inappropriate places are where the value type list is already known and may be long, in which case the existing method is more efficient. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=53035&r1=53034&r2=53035&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Jul 2 12:40:58 2008 @@ -381,8 +381,14 @@ SDOperand Val, const Value* PtrVal, unsigned Alignment = 0); + /// getMergeValues - Create a MERGE_VALUES node from the given operands. + /// Allowed to return something different (and simpler) if Simplify is true. + SDOperand getMergeValues(SDOperandPtr Ops, unsigned NumOps, + bool Simplify = true); + /// getMergeValues - Create a MERGE_VALUES node from the given types and ops. /// Allowed to return something different (and simpler) if Simplify is true. + /// May be faster than the above version if VTs is known and NumOps is large. SDOperand getMergeValues(SDVTList VTs, SDOperandPtr Ops, unsigned NumOps, bool Simplify = true) { if (Simplify && NumOps == 1) Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=53035&r1=53034&r2=53035&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jul 2 12:40:58 2008 @@ -652,7 +652,7 @@ Result = DAG.getNode(ISD::FP_EXTEND, VT, Result); SDOperand Ops[] = { Result, Chain }; - return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), Ops, 2); + return DAG.getMergeValues(Ops, 2); } assert(LoadedVT.isInteger() && !LoadedVT.isVector() && "Unaligned load of unsupported type."); @@ -701,7 +701,7 @@ Hi.getValue(1)); SDOperand Ops[] = { Result, TF }; - return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), Ops, 2); + return DAG.getMergeValues(Ops, 2); } /// UnrollVectorOp - We know that the given vector has a legal type, however @@ -931,7 +931,7 @@ // Fall Thru case TargetLowering::Legal: { SDOperand Ops[] = { DAG.getConstant(0, VT), Tmp1 }; - Result = DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), Ops, 2); + Result = DAG.getMergeValues(Ops, 2); break; } } @@ -965,7 +965,7 @@ // Fall Thru case TargetLowering::Legal: { SDOperand Ops[] = { DAG.getConstant(0, VT), Tmp2 }; - Result = DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), Ops, 2); + Result = DAG.getMergeValues(Ops, 2); break; } } @@ -4728,16 +4728,15 @@ } SDOperand Dummy; - Tmp1 = ExpandLibCall(LC1, - DAG.getNode(ISD::MERGE_VALUES, VT, LHS, RHS).Val, + SDOperand Ops[2] = { LHS, RHS }; + Tmp1 = ExpandLibCall(LC1, DAG.getMergeValues(Ops, 2).Val, false /*sign irrelevant*/, Dummy); Tmp2 = DAG.getConstant(0, MVT::i32); CC = DAG.getCondCode(TLI.getCmpLibcallCC(LC1)); if (LC2 != RTLIB::UNKNOWN_LIBCALL) { Tmp1 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(Tmp1), Tmp1, Tmp2, CC); - LHS = ExpandLibCall(LC2, - DAG.getNode(ISD::MERGE_VALUES, VT, LHS, RHS).Val, + LHS = ExpandLibCall(LC2, DAG.getMergeValues(Ops, 2).Val, false /*sign irrelevant*/, Dummy); Tmp2 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(LHS), LHS, Tmp2, DAG.getCondCode(TLI.getCmpLibcallCC(LC2))); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=53035&r1=53034&r2=53035&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jul 2 12:40:58 2008 @@ -3074,6 +3074,20 @@ return SDOperand(N, 0); } +/// getMergeValues - Create a MERGE_VALUES node from the given operands. +/// Allowed to return something different (and simpler) if Simplify is true. +SDOperand SelectionDAG::getMergeValues(SDOperandPtr Ops, unsigned NumOps, + bool Simplify) { + if (Simplify && NumOps == 1) + return Ops[0]; + + SmallVector VTs; + VTs.reserve(NumOps); + for (unsigned i = 0; i < NumOps; ++i) + VTs.push_back(Ops[i].getValueType()); + return getNode(ISD::MERGE_VALUES, getVTList(&VTs[0], NumOps), Ops, NumOps); +} + SDOperand SelectionDAG::getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType, MVT VT, SDOperand Chain, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=53035&r1=53034&r2=53035&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 2 12:40:58 2008 @@ -1158,17 +1158,13 @@ if (isa(C) || isa(C)) { SmallVector Constants; - SmallVector ValueVTs; for (User::const_op_iterator OI = C->op_begin(), OE = C->op_end(); OI != OE; ++OI) { SDNode *Val = getValue(*OI).Val; - for (unsigned i = 0, e = Val->getNumValues(); i != e; ++i) { + for (unsigned i = 0, e = Val->getNumValues(); i != e; ++i) Constants.push_back(SDOperand(Val, i)); - ValueVTs.push_back(Val->getValueType(i)); - } } - return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), - &Constants[0], Constants.size()); + return DAG.getMergeValues(&Constants[0], Constants.size()); } if (const ArrayType *ATy = dyn_cast(C->getType())) { @@ -1179,7 +1175,6 @@ return SDOperand(); // empty array MVT EltVT = TLI.getValueType(ATy->getElementType()); SmallVector Constants(NumElts); - SmallVector ValueVTs(NumElts, EltVT); for (unsigned i = 0, e = NumElts; i != e; ++i) { if (isa(C)) Constants[i] = DAG.getNode(ISD::UNDEF, EltVT); @@ -1188,8 +1183,7 @@ else Constants[i] = DAG.getConstant(0, EltVT); } - return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), - &Constants[0], Constants.size()); + return DAG.getMergeValues(&Constants[0], Constants.size()); } if (const StructType *STy = dyn_cast(C->getType())) { @@ -1199,10 +1193,8 @@ if (NumElts == 0) return SDOperand(); // empty struct SmallVector Constants(NumElts); - SmallVector ValueVTs(NumElts); for (unsigned i = 0, e = NumElts; i != e; ++i) { MVT EltVT = TLI.getValueType(STy->getElementType(i)); - ValueVTs[i] = EltVT; if (isa(C)) Constants[i] = DAG.getNode(ISD::UNDEF, EltVT); else if (EltVT.isFloatingPoint()) @@ -1210,8 +1202,7 @@ else Constants[i] = DAG.getConstant(0, EltVT); } - return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), - &Constants[0], Constants.size()); + return DAG.getMergeValues(&Constants[0], Constants.size()); } const VectorType *VecTy = cast(V->getType()); @@ -3771,10 +3762,7 @@ ValueVT); Part += NumRegs; } - - if (ValueVTs.size() == 1) - return Values[0]; - + return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], ValueVTs.size()), &Values[0], ValueVTs.size()); } @@ -4944,13 +4932,7 @@ ComputeValueVTs(TLI, AI->getType(), ValueVTs); unsigned NumValues = ValueVTs.size(); if (!AI->use_empty()) { - SmallVector LegalValueVTs(NumValues); - for (unsigned VI = 0; VI != NumValues; ++VI) - LegalValueVTs[VI] = Args[a + VI].getValueType(); - SDL.setValue(AI, - SDL.DAG.getMergeValues(SDL.DAG.getVTList(&LegalValueVTs[0], - NumValues), - &Args[a], NumValues)); + SDL.setValue(AI, SDL.DAG.getMergeValues(&Args[a], NumValues)); // If this argument is live outside of the entry block, insert a copy from // whereever we got it to the vreg that other BB's will reference it as. DenseMap::iterator VMI=FuncInfo.ValueMap.find(AI); Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=53035&r1=53034&r2=53035&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Jul 2 12:40:58 2008 @@ -587,10 +587,6 @@ InFlag = Chain.getValue(1); } - std::vector NodeTys; - NodeTys.push_back(MVT::Other); // Returns a chain - NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. - std::vector Ops; Ops.push_back(Chain); Ops.push_back(Callee); @@ -603,7 +599,9 @@ if (InFlag.Val) Ops.push_back(InFlag); - Chain = DAG.getNode(CallOpc, NodeTys, &Ops[0], Ops.size()); + // Returns a chain and a flag for retval copy to use. + Chain = DAG.getNode(CallOpc, DAG.getVTList(MVT::Other, MVT::Flag), + &Ops[0], Ops.size()); InFlag = Chain.getValue(1); Chain = DAG.getCALLSEQ_END(Chain, @@ -614,7 +612,6 @@ InFlag = Chain.getValue(1); std::vector ResultVals; - NodeTys.clear(); // If the call has results, copy the values out of the ret val registers. switch (RetVT.getSimpleVT()) { @@ -629,33 +626,26 @@ Chain = DAG.getCopyFromReg(Chain, ARM::R1, MVT::i32, Chain.getValue(2)).getValue(1); ResultVals.push_back(Chain.getValue(0)); - NodeTys.push_back(MVT::i32); } - NodeTys.push_back(MVT::i32); break; case MVT::f32: Chain = DAG.getCopyFromReg(Chain, ARM::R0, MVT::i32, InFlag).getValue(1); ResultVals.push_back(DAG.getNode(ISD::BIT_CONVERT, MVT::f32, Chain.getValue(0))); - NodeTys.push_back(MVT::f32); break; case MVT::f64: { SDOperand Lo = DAG.getCopyFromReg(Chain, ARM::R0, MVT::i32, InFlag); SDOperand Hi = DAG.getCopyFromReg(Lo, ARM::R1, MVT::i32, Lo.getValue(2)); ResultVals.push_back(DAG.getNode(ARMISD::FMDRR, MVT::f64, Lo, Hi)); - NodeTys.push_back(MVT::f64); break; } } - NodeTys.push_back(MVT::Other); - if (ResultVals.empty()) return Chain; ResultVals.push_back(Chain); - SDOperand Res = DAG.getMergeValues(DAG.getVTList(&NodeTys[0], NodeTys.size()), - &ResultVals[0], ResultVals.size()); + SDOperand Res = DAG.getMergeValues(&ResultVals[0], ResultVals.size()); return Res.getValue(Op.ResNo); } Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=53035&r1=53034&r2=53035&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Wed Jul 2 12:40:58 2008 @@ -1177,10 +1177,6 @@ InFlag = Chain.getValue(1); } - std::vector NodeTys; - NodeTys.push_back(MVT::Other); // Returns a chain - NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. - SmallVector Ops; unsigned CallOpc = SPUISD::CALL; @@ -1231,7 +1227,9 @@ if (InFlag.Val) Ops.push_back(InFlag); - Chain = DAG.getNode(CallOpc, NodeTys, &Ops[0], Ops.size()); + // Returns a chain and a flag for retval copy to use. + Chain = DAG.getNode(CallOpc, DAG.getVTList(MVT::Other, MVT::Flag), + &Ops[0], Ops.size()); InFlag = Chain.getValue(1); Chain = DAG.getCALLSEQ_END(Chain, @@ -1243,7 +1241,6 @@ SDOperand ResultVals[3]; unsigned NumResults = 0; - NodeTys.clear(); // If the call has results, copy the values out of the ret val registers. switch (Op.Val->getValueType(0).getSimpleVT()) { @@ -1257,19 +1254,16 @@ Chain.getValue(2)).getValue(1); ResultVals[1] = Chain.getValue(0); NumResults = 2; - NodeTys.push_back(MVT::i32); } else { Chain = DAG.getCopyFromReg(Chain, SPU::R3, MVT::i32, InFlag).getValue(1); ResultVals[0] = Chain.getValue(0); NumResults = 1; } - NodeTys.push_back(MVT::i32); break; case MVT::i64: Chain = DAG.getCopyFromReg(Chain, SPU::R3, MVT::i64, InFlag).getValue(1); ResultVals[0] = Chain.getValue(0); NumResults = 1; - NodeTys.push_back(MVT::i64); break; case MVT::f32: case MVT::f64: @@ -1277,7 +1271,6 @@ InFlag).getValue(1); ResultVals[0] = Chain.getValue(0); NumResults = 1; - NodeTys.push_back(Op.Val->getValueType(0)); break; case MVT::v2f64: case MVT::v4f32: @@ -1288,20 +1281,16 @@ InFlag).getValue(1); ResultVals[0] = Chain.getValue(0); NumResults = 1; - NodeTys.push_back(Op.Val->getValueType(0)); break; } - - NodeTys.push_back(MVT::Other); - + // If the function returns void, just return the chain. if (NumResults == 0) return Chain; // Otherwise, merge everything together with a MERGE_VALUES node. ResultVals[NumResults++] = Chain; - SDOperand Res = DAG.getMergeValues(DAG.getVTList(&NodeTys[0], NodeTys.size()), - ResultVals, NumResults); + SDOperand Res = DAG.getMergeValues(ResultVals, NumResults); return Res.getValue(Op.ResNo); } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=53035&r1=53034&r2=53035&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Jul 2 12:40:58 2008 @@ -2752,7 +2752,7 @@ }; SDOperand Store = DAG.getNode(PPCISD::STCX, MVT::Other, Ops2, 4); SDOperand OutOps[] = { Load, Store }; - return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), OutOps, 2); + return DAG.getMergeValues(OutOps, 2); } SDOperand PPCTargetLowering::LowerAtomicCMP_SWAP(SDOperand Op, SelectionDAG &DAG) { @@ -2794,7 +2794,7 @@ }; SDOperand Store = DAG.getNode(PPCISD::STCX, MVT::Other, Ops3, 4); SDOperand OutOps[] = { Load, Store }; - return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), OutOps, 2); + return DAG.getMergeValues(OutOps, 2); } SDOperand PPCTargetLowering::LowerAtomicSWAP(SDOperand Op, SelectionDAG &DAG) { @@ -2826,7 +2826,7 @@ }; SDOperand Store = DAG.getNode(PPCISD::STCX, MVT::Other, Ops2, 4); SDOperand OutOps[] = { Load, Store }; - return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), OutOps, 2); + return DAG.getMergeValues(OutOps, 2); } /// LowerSELECT_CC - Lower floating point select_cc's into fsel instruction when @@ -3130,7 +3130,7 @@ SDOperand OutHi = DAG.getNode(ISD::OR, VT, Tmp4, Tmp6); SDOperand OutLo = DAG.getNode(PPCISD::SHL, VT, Lo, Amt); SDOperand OutOps[] = { OutLo, OutHi }; - return DAG.getMergeValues(DAG.getVTList(VT, VT), OutOps, 2); + return DAG.getMergeValues(OutOps, 2); } SDOperand PPCTargetLowering::LowerSRL_PARTS(SDOperand Op, SelectionDAG &DAG) { @@ -3158,7 +3158,7 @@ SDOperand OutLo = DAG.getNode(ISD::OR, VT, Tmp4, Tmp6); SDOperand OutHi = DAG.getNode(PPCISD::SRL, VT, Hi, Amt); SDOperand OutOps[] = { OutLo, OutHi }; - return DAG.getMergeValues(DAG.getVTList(VT, VT), OutOps, 2); + return DAG.getMergeValues(OutOps, 2); } SDOperand PPCTargetLowering::LowerSRA_PARTS(SDOperand Op, SelectionDAG &DAG) { @@ -3186,7 +3186,7 @@ SDOperand OutLo = DAG.getSelectCC(Tmp5, DAG.getConstant(0, AmtVT), Tmp4, Tmp6, ISD::SETLE); SDOperand OutOps[] = { OutLo, OutHi }; - return DAG.getMergeValues(DAG.getVTList(VT, VT), OutOps, 2); + return DAG.getMergeValues(OutOps, 2); } //===----------------------------------------------------------------------===// Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=53035&r1=53034&r2=53035&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Wed Jul 2 12:40:58 2008 @@ -446,7 +446,7 @@ } ResultVals.push_back(Chain); - + // Merge everything together with a MERGE_VALUES node. return DAG.getMergeValues(Op.Val->getVTList(), &ResultVals[0], ResultVals.size()); @@ -829,7 +829,7 @@ DAG.getNode(ISD::BIT_CONVERT, MVT::f64, V), V.getValue(1) }; - return DAG.getMergeValues(DAG.getVTList(MVT::f64, MVT::Other), Ops, 2); + return DAG.getMergeValues(Ops, 2); } static SDOperand LowerDYNAMIC_STACKALLOC(SDOperand Op, SelectionDAG &DAG) { @@ -846,7 +846,7 @@ SDOperand NewVal = DAG.getNode(ISD::ADD, MVT::i32, NewSP, DAG.getConstant(96, MVT::i32)); SDOperand Ops[2] = { NewVal, Chain }; - return DAG.getMergeValues(DAG.getVTList(MVT::i32, MVT::Other), Ops, 2); + return DAG.getMergeValues(Ops, 2); } Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=53035&r1=53034&r2=53035&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jul 2 12:40:58 2008 @@ -978,7 +978,7 @@ ResultVals.push_back(Val); } - + // Merge everything together with a MERGE_VALUES node. ResultVals.push_back(Chain); return DAG.getMergeValues(TheCall->getVTList(), &ResultVals[0], @@ -4382,7 +4382,7 @@ } SDOperand Ops[2] = { Lo, Hi }; - return DAG.getMergeValues(DAG.getVTList(VT, VT), Ops, 2); + return DAG.getMergeValues(Ops, 2); } SDOperand X86TargetLowering::LowerSINT_TO_FP(SDOperand Op, SelectionDAG &DAG) { @@ -4516,9 +4516,10 @@ // Return a load from the stack slot. SDOperand Res = DAG.getLoad(VT, FIST, StackSlot, NULL, 0); - // Use a MERGE_VALUES node to drop the chain result value. - return DAG.getMergeValues(DAG.getVTList(VT), &Res, 1, - false /* Require a node with one-result */).Val; + // Use MERGE_VALUES to drop the chain result value and get a node with one + // result. This requires turning off getMergeValues simplification, since + // otherwise it will give us Res back. + return DAG.getMergeValues(&Res, 1, false).Val; } SDOperand X86TargetLowering::LowerFABS(SDOperand Op, SelectionDAG &DAG) { @@ -4816,7 +4817,7 @@ Chain = DAG.getCopyFromReg(Chain, X86StackPtr, SPTy).getValue(1); SDOperand Ops1[2] = { Chain.getValue(0), Chain }; - return DAG.getMergeValues(DAG.getVTList(SPTy, MVT::Other), Ops1, 2); + return DAG.getMergeValues(Ops1, 2); } SDOperand @@ -5047,8 +5048,7 @@ DAG.getNode(ISD::OR, MVT::i64, rax, Tmp), rdx.getValue(1) }; - Tys = DAG.getVTList(MVT::i64, MVT::Other); - return DAG.getMergeValues(Tys, Ops, 2).Val; + return DAG.getMergeValues(Ops, 2).Val; } SDOperand eax = DAG.getCopyFromReg(rd, X86::EAX, MVT::i32, rd.getValue(1)); @@ -5060,7 +5060,7 @@ // Use a MERGE_VALUES to return the value and chain. Ops[1] = edx.getValue(1); - return DAG.getMergeValues(DAG.getVTList(MVT::i64, MVT::Other), Ops, 2).Val; + return DAG.getMergeValues(Ops, 2).Val; } SDOperand X86TargetLowering::LowerVASTART(SDOperand Op, SelectionDAG &DAG) { @@ -5441,7 +5441,7 @@ SDOperand Ops[] = { Trmp, DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains, 6) }; - return DAG.getMergeValues(Op.Val->getVTList(), Ops, 2); + return DAG.getMergeValues(Ops, 2); } else { const Function *Func = cast(cast(Op.getOperand(5))->getValue()); @@ -5509,7 +5509,7 @@ SDOperand Ops[] = { Trmp, DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains, 4) }; - return DAG.getMergeValues(Op.Val->getVTList(), Ops, 2); + return DAG.getMergeValues(Ops, 2); } } @@ -5697,7 +5697,7 @@ SDOperand OpsF[] = { cpOutL.getValue(0), cpOutH.getValue(0)}; SDOperand ResultVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, OpsF, 2); SDOperand Vals[2] = { ResultVal, cpOutH.getValue(1) }; - return DAG.getMergeValues(DAG.getVTList(MVT::i64, MVT::Other), Vals, 2).Val; + return DAG.getMergeValues(Vals, 2).Val; } SDNode* X86TargetLowering::ExpandATOMIC_LOAD_SUB(SDNode* Op, SelectionDAG &DAG) { From matthijs at stdin.nl Wed Jul 2 12:45:15 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Wed, 2 Jul 2008 19:45:15 +0200 Subject: [llvm-commits] [llvm] r52537 - /llvm/trunk/lib/Transforms/IPO/DeadArgumentElimination.cpp In-Reply-To: <1E9986AA-55D4-479B-BE07-AAF16F5831A9@apple.com> References: <200806201516.m5KFGkRv024435@zion.cs.uiuc.edu> <20080702161624.GI7287@katherina.student.utwente.nl> <192117C6-9780-4C96-9F1F-E055FFC033FE@apple.com> <1E9986AA-55D4-479B-BE07-AAF16F5831A9@apple.com> Message-ID: <20080702174515.GK7287@katherina.student.utwente.nl> > Maybe I'm missing something, but wouldn't this assume call i32 and > call {i32} use the same calling convention? I don't think we can assume > that in general. The pass is only processing internal functions and updating all callers, so calling conventions should not apply. Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080702/81a63ff2/attachment.bin From monping at apple.com Wed Jul 2 12:45:23 2008 From: monping at apple.com (Mon P Wang) Date: Wed, 2 Jul 2008 10:45:23 -0700 Subject: [llvm-commits] Slot alignment In-Reply-To: <5A3BB7F6-2528-4E5E-93F2-B295FBC0F0BE@apple.com> References: <200807020854.26505.baldrick@free.fr> <5A3BB7F6-2528-4E5E-93F2-B295FBC0F0BE@apple.com> Message-ID: <292ABC58-04A7-4AE8-B68E-18408CB6425A@apple.com> Hi, If I think of it as a maximum of two values where the first value is always positive, it indicates that we use the value of the alignment of VT. In terms of an alignment, it doesn't make any sense. Since I called it minAlign, it make more sense to set it to one. I'll fix this. -- Mon Ping On Jul 2, 2008, at 10:36 AM, Evan Cheng wrote: > > On Jul 1, 2008, at 11:54 PM, Duncan Sands wrote: > >> Hi, >> >>> SDOperand SelectionDAG::CreateStackTemporary(MVT VT) { >>> + return CreateStackTemporary(VT, 1); >> >> while it doesn't hurt to use 1, you could also use 0 here. >> >>> + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1); >> >> Here too. > > Alignment of 0 doesn't really make sense. I am not sure I see the > benefit of using 0 instead of 1. > > Evan > >> >> >> Ciao, >> >> Duncan. >> >> PS: Can you please include patches inline rather than >> attaching them (if they are not too humungous) - that >> makes it easier to add comments. Thanks! >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Wed Jul 2 12:49:08 2008 From: baldrick at free.fr (Duncan Sands) Date: Wed, 2 Jul 2008 19:49:08 +0200 Subject: [llvm-commits] Slot alignment In-Reply-To: <5A3BB7F6-2528-4E5E-93F2-B295FBC0F0BE@apple.com> References: <200807020854.26505.baldrick@free.fr> <5A3BB7F6-2528-4E5E-93F2-B295FBC0F0BE@apple.com> Message-ID: <200807021949.08960.baldrick@free.fr> Hi, > >> SDOperand SelectionDAG::CreateStackTemporary(MVT VT) { > >> + return CreateStackTemporary(VT, 1); > > > > while it doesn't hurt to use 1, you could also use 0 here. > > > >> + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1); > > > > Here too. > > Alignment of 0 doesn't really make sense. it is not an alignment, it is a minimum which is never achieved. > I am not sure I see the benefit of using 0 instead of 1. The optimizers can eliminate the comparison with the unsigned quantity Align. But as I said, it doesn't hurt to use 1. Ciao, Duncan. From wangmp at apple.com Wed Jul 2 12:50:19 2008 From: wangmp at apple.com (Mon P Wang) Date: Wed, 02 Jul 2008 17:50:19 -0000 Subject: [llvm-commits] [llvm] r53036 - /llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Message-ID: <200807021750.m62HoKGl019786@zion.cs.uiuc.edu> Author: wangmp Date: Wed Jul 2 12:50:10 2008 New Revision: 53036 URL: http://llvm.org/viewvc/llvm-project?rev=53036&view=rev Log: Make the default min align of CreateStackTemporary to be 1 Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=53036&r1=53035&r2=53036&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Jul 2 12:50:10 2008 @@ -582,7 +582,7 @@ /// CreateStackTemporary - Create a stack temporary, suitable for holding the /// specified value type. If minAlign is specified, the slot size will have /// at least that alignment. - SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 0); + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1); /// FoldSetCC - Constant fold a setcc to true or false. SDOperand FoldSetCC(MVT VT, SDOperand N1, From resistor at mac.com Wed Jul 2 12:55:31 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 02 Jul 2008 17:55:31 -0000 Subject: [llvm-commits] [test-suite] r53037 - in /test-suite/trunk/MultiSource/Benchmarks/BitBench: Makefile huffman/ Message-ID: <200807021755.m62HtX90019936@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 2 12:55:21 2008 New Revision: 53037 URL: http://llvm.org/viewvc/llvm-project?rev=53037&view=rev Log: Remove BitBench/huffman. It appears to be pretty broken (always segfaults due to excessive memory allocation). Removed: test-suite/trunk/MultiSource/Benchmarks/BitBench/huffman/ Modified: test-suite/trunk/MultiSource/Benchmarks/BitBench/Makefile Modified: test-suite/trunk/MultiSource/Benchmarks/BitBench/Makefile URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/BitBench/Makefile?rev=53037&r1=53036&r2=53037&view=diff ============================================================================== --- test-suite/trunk/MultiSource/Benchmarks/BitBench/Makefile (original) +++ test-suite/trunk/MultiSource/Benchmarks/BitBench/Makefile Wed Jul 2 12:55:21 2008 @@ -4,7 +4,7 @@ ## NOTE: This must remain in this order, so that the labels in the nightly ## tester gnuplot scripts are correct. -PARALLEL_DIRS := five11 drop3 huffman uudecode uuencode +PARALLEL_DIRS := five11 drop3 uudecode uuencode include $(LEVEL)/Makefile.programs From clattner at apple.com Wed Jul 2 13:04:20 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 2 Jul 2008 11:04:20 -0700 Subject: [llvm-commits] [llvm] r53032 - in /llvm/trunk: lib/Analysis/MemoryDependenceAnalysis.cpp lib/Transforms/Scalar/GVN.cpp test/Transforms/GVN/2008-07-02-Unreachable.ll In-Reply-To: <200807021720.m62HKXPg018649@zion.cs.uiuc.edu> References: <200807021720.m62HKXPg018649@zion.cs.uiuc.edu> Message-ID: <4E32F689-333E-42BF-8458-B0CD5CBB100B@apple.com> On Jul 2, 2008, at 10:20 AM, Owen Anderson wrote: > Author: resistor > Date: Wed Jul 2 12:20:16 2008 > New Revision: 53032 > > URL: http://llvm.org/viewvc/llvm-project?rev=53032&view=rev > Log: > A better fix for PR2503 that doesn't pessimize GVN in the presence > of unreachable blocks. Cool. > + if (!getAnalysis().isReachableFromEntry(BB)) { > + Phis[BB] = UndefValue::get(orig->getType()); > + return UndefValue::get(orig->getType()); how about: return Phis[BB] = UndefValue::get(orig->getType()); To avoid the redundant call? -Chris From resistor at mac.com Wed Jul 2 13:05:24 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 02 Jul 2008 18:05:24 -0000 Subject: [llvm-commits] [llvm] r53038 - in /llvm/trunk: lib/Transforms/Scalar/ADCE.cpp test/Transforms/ADCE/2008-07-02-Unreachable.ll Message-ID: <200807021805.m62I5ORs020296@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 2 13:05:19 2008 New Revision: 53038 URL: http://llvm.org/viewvc/llvm-project?rev=53038&view=rev Log: Add support to ADCE for pruning unreachable blocks. This addresses the final part of PR2509. Added: llvm/trunk/test/Transforms/ADCE/2008-07-02-Unreachable.ll Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=53038&r1=53037&r2=53038&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Wed Jul 2 13:05:19 2008 @@ -16,12 +16,15 @@ #define DEBUG_TYPE "adce" #include "llvm/Transforms/Scalar.h" +#include "llvm/BasicBlock.h" #include "llvm/Instructions.h" #include "llvm/Pass.h" +#include "llvm/Support/CFG.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/InstIterator.h" -#include "llvm/ADT/Statistic.h" #include "llvm/ADT/DenseSet.h" +#include "llvm/ADT/DepthFirstIterator.h" +#include "llvm/ADT/Statistic.h" #include "llvm/ADT/SmallVector.h" using namespace llvm; @@ -36,6 +39,9 @@ DenseSet alive; SmallVector worklist; + DenseSet reachable; + SmallVector unreachable; + virtual bool runOnFunction(Function& F); virtual void getAnalysisUsage(AnalysisUsage& AU) const { @@ -51,6 +57,42 @@ bool ADCE::runOnFunction(Function& F) { alive.clear(); worklist.clear(); + reachable.clear(); + unreachable.clear(); + + // First, collect the set of reachable blocks ... + for (df_iterator DI = df_begin(&F.getEntryBlock()), + DE = df_end(&F.getEntryBlock()); DI != DE; ++DI) + reachable.insert(*DI); + + // ... and then invert it into the list of unreachable ones. These + // blocks will be removed from the function. + for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) + if (!reachable.count(FI)) + unreachable.push_back(FI); + + // Prepare to remove blocks by removing the PHI node entries for those blocks + // in their successors, and remove them from reference counting. + for (SmallVector::iterator UI = unreachable.begin(), + UE = unreachable.end(); UI != UE; ++UI) { + BasicBlock* BB = *UI; + for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); + SI != SE; ++SI) { + BasicBlock* succ = *SI; + BasicBlock::iterator succ_inst = succ->begin(); + while (PHINode* P = dyn_cast(succ_inst)) { + P->removeIncomingValue(BB); + ++succ_inst; + } + } + + BB->dropAllReferences(); + } + + // Finally, erase the unreachable blocks. + for (SmallVector::iterator UI = unreachable.begin(), + UE = unreachable.end(); UI != UE; ++UI) + (*UI)->eraseFromParent(); // Collect the set of "root" instructions that are known live. for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) Added: llvm/trunk/test/Transforms/ADCE/2008-07-02-Unreachable.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ADCE/2008-07-02-Unreachable.ll?rev=53038&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ADCE/2008-07-02-Unreachable.ll (added) +++ llvm/trunk/test/Transforms/ADCE/2008-07-02-Unreachable.ll Wed Jul 2 13:05:19 2008 @@ -0,0 +1,37 @@ +; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis | not grep forcond +; PR2509 + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" +target triple = "i686-apple-darwin9.3.0" + at g_3 = external global i8 ; [#uses=2] + +define i32 @func_1() nounwind { +entry: + br i1 false, label %ifelse, label %ifthen + +ifthen: ; preds = %entry + br label %ifend + +ifelse: ; preds = %entry + %tmp3 = load i8* @g_3 ; [#uses=0] + br label %forcond.thread + +forcond.thread: ; preds = %ifelse + br label %afterfor + +forcond: ; preds = %forinc + br i1 false, label %afterfor, label %forbody + +forbody: ; preds = %forcond + br label %forinc + +forinc: ; preds = %forbody + br label %forcond + +afterfor: ; preds = %forcond, %forcond.thread + %tmp10 = load i8* @g_3 ; [#uses=0] + br label %ifend + +ifend: ; preds = %afterfor, %ifthen + ret i32 0 +} From clattner at apple.com Wed Jul 2 13:05:54 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 2 Jul 2008 11:05:54 -0700 Subject: [llvm-commits] [llvm] r53034 - /llvm/trunk/lib/Transforms/Scalar/ADCE.cpp In-Reply-To: <200807021732.m62HW44C019185@zion.cs.uiuc.edu> References: <200807021732.m62HW44C019185@zion.cs.uiuc.edu> Message-ID: On Jul 2, 2008, at 10:32 AM, Owen Anderson wrote: > Author: resistor > Date: Wed Jul 2 12:32:04 2008 > New Revision: 53034 > > URL: http://llvm.org/viewvc/llvm-project?rev=53034&view=rev > Log: > Use DenseSet rather than SmallPtrSet for the alive set. Using > SmallPtrSet > with a huge "size" parameter is actually quite inefficient. Huh? How is it slow? The slow part would be when the ctor runs because it has to memset out a set of 1024 elements. Have you tried changing it to be SmallPtrSet or something? When you exceed the size of the small set, it does use an efficient set for the pointers: more efficient than denseset. -Chris > > > Modified: > llvm/trunk/lib/Transforms/Scalar/ADCE.cpp > > Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=53034&r1=53033&r2=53034&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Wed Jul 2 12:32:04 2008 > @@ -21,7 +21,7 @@ > #include "llvm/Support/Compiler.h" > #include "llvm/Support/InstIterator.h" > #include "llvm/ADT/Statistic.h" > -#include "llvm/ADT/SmallPtrSet.h" > +#include "llvm/ADT/DenseSet.h" > #include "llvm/ADT/SmallVector.h" > > using namespace llvm; > @@ -33,7 +33,7 @@ > static char ID; // Pass identification, replacement for typeid > ADCE() : FunctionPass((intptr_t)&ID) {} > > - SmallPtrSet alive; > + DenseSet alive; > SmallVector worklist; > > virtual bool runOnFunction(Function& F); > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Wed Jul 2 13:15:31 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 02 Jul 2008 18:15:31 -0000 Subject: [llvm-commits] [llvm] r53040 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200807021815.m62IFWO3020730@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 2 13:15:31 2008 New Revision: 53040 URL: http://llvm.org/viewvc/llvm-project?rev=53040&view=rev Log: Avoid a redundant call. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=53040&r1=53039&r2=53040&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Wed Jul 2 13:15:31 2008 @@ -808,10 +808,10 @@ DenseMap::iterator V = Phis.find(BB); if (V != Phis.end() && !top_level) return V->second; - if (!getAnalysis().isReachableFromEntry(BB)) { - Phis[BB] = UndefValue::get(orig->getType()); - return UndefValue::get(orig->getType()); - } + // If the block is unreachable, just return undef, since this path + // can't actually occur at runtime. + if (!getAnalysis().isReachableFromEntry(BB)) + return Phis[BB] = UndefValue::get(orig->getType()); BasicBlock* singlePred = BB->getSinglePredecessor(); if (singlePred) { From resistor at mac.com Wed Jul 2 13:41:09 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 02 Jul 2008 18:41:09 -0000 Subject: [llvm-commits] [llvm] r53044 - /llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Message-ID: <200807021841.m62If9bm021824@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 2 13:41:09 2008 New Revision: 53044 URL: http://llvm.org/viewvc/llvm-project?rev=53044&view=rev Log: Use df_ext_iterator to capture the reachable set without allocating an extra set. Also, move large sets and vectors out of instance variables and onto the stack, and give them more reasonable sizes. Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=53044&r1=53043&r2=53044&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Wed Jul 2 13:41:09 2008 @@ -22,10 +22,11 @@ #include "llvm/Support/CFG.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/InstIterator.h" -#include "llvm/ADT/DenseSet.h" #include "llvm/ADT/DepthFirstIterator.h" -#include "llvm/ADT/Statistic.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Statistic.h" + using namespace llvm; @@ -36,12 +37,6 @@ static char ID; // Pass identification, replacement for typeid ADCE() : FunctionPass((intptr_t)&ID) {} - DenseSet alive; - SmallVector worklist; - - DenseSet reachable; - SmallVector unreachable; - virtual bool runOnFunction(Function& F); virtual void getAnalysisUsage(AnalysisUsage& AU) const { @@ -55,15 +50,17 @@ static RegisterPass X("adce", "Aggressive Dead Code Elimination"); bool ADCE::runOnFunction(Function& F) { - alive.clear(); - worklist.clear(); - reachable.clear(); - unreachable.clear(); + SmallPtrSet alive; + SmallVector worklist; + + SmallPtrSet reachable; + SmallVector unreachable; // First, collect the set of reachable blocks ... - for (df_iterator DI = df_begin(&F.getEntryBlock()), - DE = df_end(&F.getEntryBlock()); DI != DE; ++DI) - reachable.insert(*DI); + for (df_ext_iterator > + DI = df_ext_begin(&F.getEntryBlock(), reachable), + DE = df_ext_end(&F.getEntryBlock(), reachable); DI != DE; ++DI) + ; // Deliberately empty, df_ext_iterator will fill in the set. // ... and then invert it into the list of unreachable ones. These // blocks will be removed from the function. @@ -73,7 +70,7 @@ // Prepare to remove blocks by removing the PHI node entries for those blocks // in their successors, and remove them from reference counting. - for (SmallVector::iterator UI = unreachable.begin(), + for (SmallVector::iterator UI = unreachable.begin(), UE = unreachable.end(); UI != UE; ++UI) { BasicBlock* BB = *UI; for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); @@ -90,7 +87,7 @@ } // Finally, erase the unreachable blocks. - for (SmallVector::iterator UI = unreachable.begin(), + for (SmallVector::iterator UI = unreachable.begin(), UE = unreachable.end(); UI != UE; ++UI) (*UI)->eraseFromParent(); From resistor at mac.com Wed Jul 2 13:42:07 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 02 Jul 2008 18:42:07 -0000 Subject: [llvm-commits] [llvm] r53045 - /llvm/trunk/tools/llvm-ld/Optimize.cpp Message-ID: <200807021842.m62Ig7b3021878@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 2 13:42:07 2008 New Revision: 53045 URL: http://llvm.org/viewvc/llvm-project?rev=53045&view=rev Log: Use ADCE instead of just DCE. ADCE will better clean up after jump threading, for instance. Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp Modified: llvm/trunk/tools/llvm-ld/Optimize.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ld/Optimize.cpp?rev=53045&r1=53044&r2=53045&view=diff ============================================================================== --- llvm/trunk/tools/llvm-ld/Optimize.cpp (original) +++ llvm/trunk/tools/llvm-ld/Optimize.cpp Wed Jul 2 13:42:07 2008 @@ -179,7 +179,7 @@ if (!DisableOptimizations) { addPass(Passes, createInstructionCombiningPass()); addPass(Passes, createCFGSimplificationPass()); - addPass(Passes, createDeadCodeEliminationPass()); + addPass(Passes, createAggressiveDCEPass()); addPass(Passes, createGlobalDCEPass()); } From cfr at adobe.com Wed Jul 2 16:02:53 2008 From: cfr at adobe.com (Chuck Rose III) Date: Wed, 02 Jul 2008 21:02:53 -0000 Subject: [llvm-commits] [llvm] r53047 - in /llvm/trunk/win32: Bitcode/Bitcode.vcproj Configure/Configure.vcproj Support/Support.vcproj System/System.vcproj TableGen/TableGen.vcproj VMCore/VMCore.vcproj Message-ID: <200807022102.m62L2saV026446@zion.cs.uiuc.edu> Author: cfr Date: Wed Jul 2 16:02:51 2008 New Revision: 53047 URL: http://llvm.org/viewvc/llvm-project?rev=53047&view=rev Log: VStudio x64 build fixes. Looks like the x64 projects got out of date and this brings them up to code. I've built the project with these new vcproj files for win32 and x64 both debug and release. Modified: llvm/trunk/win32/Bitcode/Bitcode.vcproj llvm/trunk/win32/Configure/Configure.vcproj llvm/trunk/win32/Support/Support.vcproj llvm/trunk/win32/System/System.vcproj llvm/trunk/win32/TableGen/TableGen.vcproj llvm/trunk/win32/VMCore/VMCore.vcproj Modified: llvm/trunk/win32/Bitcode/Bitcode.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Bitcode/Bitcode.vcproj?rev=53047&r1=53046&r2=53047&view=diff ============================================================================== --- llvm/trunk/win32/Bitcode/Bitcode.vcproj (original) +++ llvm/trunk/win32/Bitcode/Bitcode.vcproj Wed Jul 2 16:02:51 2008 @@ -89,11 +89,11 @@ />
    @@ -276,9 +276,9 @@ > @@ -300,9 +300,9 @@ > Modified: llvm/trunk/win32/Support/Support.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Support/Support.vcproj?rev=53047&r1=53046&r2=53047&view=diff ============================================================================== --- llvm/trunk/win32/Support/Support.vcproj (original) +++ llvm/trunk/win32/Support/Support.vcproj Wed Jul 2 16:02:51 2008 @@ -90,11 +90,11 @@ /> - - - - - - Modified: llvm/trunk/win32/System/System.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/System/System.vcproj?rev=53047&r1=53046&r2=53047&view=diff ============================================================================== --- llvm/trunk/win32/System/System.vcproj (original) +++ llvm/trunk/win32/System/System.vcproj Wed Jul 2 16:02:51 2008 @@ -90,11 +90,10 @@ /> @@ -143,7 +133,6 @@ /> @@ -399,8 +399,8 @@ From resistor at mac.com Wed Jul 2 16:29:03 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 02 Jul 2008 21:29:03 -0000 Subject: [llvm-commits] [llvm] r53049 - /llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200807022129.m62LT4H8027541@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 2 16:28:58 2008 New Revision: 53049 URL: http://llvm.org/viewvc/llvm-project?rev=53049&view=rev Log: TwoAddressInstructionPass doesn't really require LiveVariables, it just needs to update it if it's already around. Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=53049&r1=53048&r2=53049&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed Jul 2 16:28:58 2008 @@ -74,7 +74,6 @@ TwoAddressInstructionPass() : MachineFunctionPass((intptr_t)&ID) {} virtual void getAnalysisUsage(AnalysisUsage &AU) const { - AU.addRequired(); AU.addPreserved(); AU.addPreservedID(MachineLoopInfoID); AU.addPreservedID(MachineDominatorsID); @@ -184,9 +183,12 @@ KillMO->setIsKill(false); KillMO = MI->findRegisterUseOperand(SavedReg, false, TRI); KillMO->setIsKill(true); - LiveVariables::VarInfo& VarInfo = LV->getVarInfo(SavedReg); - VarInfo.removeKill(KillMI); - VarInfo.Kills.push_back(MI); + + if (LV) { + LiveVariables::VarInfo& VarInfo = LV->getVarInfo(SavedReg); + VarInfo.removeKill(KillMI); + VarInfo.Kills.push_back(MI); + } // Move instruction to its destination. MBB->remove(MI); @@ -283,7 +285,7 @@ MRI = &MF.getRegInfo(); TII = TM.getInstrInfo(); TRI = TM.getRegisterInfo(); - LV = &getAnalysis(); + LV = getAnalysisToUpdate(); bool MadeChange = false; @@ -373,7 +375,32 @@ DOUT << "2addr: COMMUTED TO: " << *NewMI; // If the instruction changed to commute it, update livevar. if (NewMI != mi) { - LV->instructionChanged(mi, NewMI); // Update live variables + if (LV) { + // Update live variables + LV->instructionChanged(mi, NewMI); + } else { + // Update flags manually + for (unsigned i = 0, e = mi->getNumOperands(); + i != e; ++i) { + MachineOperand &MO = mi->getOperand(i); + if (MO.isRegister() && MO.getReg() && + TargetRegisterInfo::isVirtualRegister(MO.getReg())) { + unsigned Reg = MO.getReg(); + if (MO.isDef()) { + if (MO.isDead()) { + MO.setIsDead(false); + NewMI->addRegisterDead(Reg, TRI); + } + } + + if (MO.isKill()) { + MO.setIsKill(false); + NewMI->addRegisterKilled(Reg, TRI); + } + } + } + } + mbbi->insert(mi, NewMI); // Insert the new inst mbbi->erase(mi); // Nuke the old inst. mi = NewMI; @@ -443,17 +470,43 @@ DOUT << "\t\tprepend:\t"; DEBUG(prevMi->print(*cerr.stream(), &TM)); // Update live variables for regB. - LiveVariables::VarInfo& varInfoB = LV->getVarInfo(regB); - - // regB is used in this BB. - varInfoB.UsedBlocks[mbbi->getNumber()] = true; + if (LV) { + LiveVariables::VarInfo& varInfoB = LV->getVarInfo(regB); - if (LV->removeVirtualRegisterKilled(regB, mbbi, mi)) - LV->addVirtualRegisterKilled(regB, prevMi); + // regB is used in this BB. + varInfoB.UsedBlocks[mbbi->getNumber()] = true; - if (LV->removeVirtualRegisterDead(regB, mbbi, mi)) - LV->addVirtualRegisterDead(regB, prevMi); + if (LV->removeVirtualRegisterKilled(regB, mbbi, mi)) + LV->addVirtualRegisterKilled(regB, prevMi); + if (LV->removeVirtualRegisterDead(regB, mbbi, mi)) + LV->addVirtualRegisterDead(regB, prevMi); + } else { + // Manually update kill/dead flags. + bool RemovedKill = false; + bool RemovedDead = false; + for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { + MachineOperand &MO = mi->getOperand(i); + if (MO.isRegister() && MO.isKill() && MO.getReg() == regB) { + MO.setIsKill(false); + RemovedKill = true; + break; + } + + if (MO.isRegister() && MO.isDef() && MO.getReg() == regB) { + MO.setIsDead(false); + RemovedDead = true; + } + + if (RemovedKill && RemovedDead) break; + } + + if (RemovedKill) + prevMi->addRegisterKilled(regB, TRI); + if (RemovedDead) + prevMi->addRegisterDead(regB, TRI); + } + // Replace all occurences of regB with regA. for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { if (mi->getOperand(i).isRegister() && From gohman at apple.com Wed Jul 2 17:12:56 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 02 Jul 2008 22:12:56 -0000 Subject: [llvm-commits] [llvm] r53050 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp Message-ID: <200807022212.m62MCuQX028998@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 2 17:12:55 2008 New Revision: 53050 URL: http://llvm.org/viewvc/llvm-project?rev=53050&view=rev Log: Revert r52988. It broke 254.gap on x86-64. Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=53050&r1=53049&r2=53050&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed Jul 2 17:12:55 2008 @@ -738,7 +738,7 @@ const TargetRegisterInfo *RegInfo, bool AddIfNotFound) { bool isPhysReg = TargetRegisterInfo::isPhysicalRegister(IncomingReg); - bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); + bool Found = false; SmallVector DeadOps; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); @@ -749,15 +749,15 @@ continue; if (Reg == IncomingReg) { - MO.setIsKill(); - return true; - } - if (hasAliases && MO.isKill() && - TargetRegisterInfo::isPhysicalRegister(Reg)) { + if (!Found) // One kill of reg per instruction. + MO.setIsKill(); + Found = true; + } else if (isPhysReg && MO.isKill() && + TargetRegisterInfo::isPhysicalRegister(Reg)) { // A super-register kill already exists. if (RegInfo->isSuperRegister(IncomingReg, Reg)) - return true; - if (RegInfo->isSubRegister(IncomingReg, Reg)) + Found = true; + else if (RegInfo->isSubRegister(IncomingReg, Reg)) DeadOps.push_back(i); } } @@ -774,14 +774,14 @@ // If not found, this means an alias of one of the operands is killed. Add a // new implicit operand if required. - if (AddIfNotFound) { + if (!Found && AddIfNotFound) { addOperand(MachineOperand::CreateReg(IncomingReg, false /*IsDef*/, true /*IsImp*/, true /*IsKill*/)); return true; } - return false; + return Found; } bool MachineInstr::addRegisterDead(unsigned IncomingReg, @@ -789,6 +789,7 @@ bool AddIfNotFound) { bool isPhysReg = TargetRegisterInfo::isPhysicalRegister(IncomingReg); bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); + bool Found = false; SmallVector DeadOps; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); @@ -797,14 +798,13 @@ unsigned Reg = MO.getReg(); if (Reg == IncomingReg) { MO.setIsDead(); - return true; - } - if (hasAliases && MO.isDead() && - TargetRegisterInfo::isPhysicalRegister(Reg)) { + Found = true; + } else if (hasAliases && MO.isDead() && + TargetRegisterInfo::isPhysicalRegister(Reg)) { // There exists a super-register that's marked dead. if (RegInfo->isSuperRegister(IncomingReg, Reg)) - return true; - if (RegInfo->isSubRegister(IncomingReg, Reg)) + Found = true; + else if (RegInfo->isSubRegister(IncomingReg, Reg)) DeadOps.push_back(i); } } @@ -821,13 +821,13 @@ // If not found, this means an alias of one of the operand is dead. Add a // new implicit operand. - if (AddIfNotFound) { + if (!Found && AddIfNotFound) { addOperand(MachineOperand::CreateReg(IncomingReg, true/*IsDef*/, true/*IsImp*/,false/*IsKill*/, true/*IsDead*/)); return true; } - return false; + return Found; } /// copyKillDeadInfo - copies killed/dead information from one instr to another From echristo at apple.com Wed Jul 2 17:58:00 2008 From: echristo at apple.com (Eric Christopher) Date: Wed, 02 Jul 2008 22:58:00 -0000 Subject: [llvm-commits] [llvm] r53051 - /llvm/trunk/include/llvm/Support/IRBuilder.h Message-ID: <200807022258.m62Mw0qC030396@zion.cs.uiuc.edu> Author: echristo Date: Wed Jul 2 17:57:59 2008 New Revision: 53051 URL: http://llvm.org/viewvc/llvm-project?rev=53051&view=rev Log: Add a couple more helper functions to deal with creating global constant strings and pointers to global constant strings. Modified: llvm/trunk/include/llvm/Support/IRBuilder.h Modified: llvm/trunk/include/llvm/Support/IRBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=53051&r1=53050&r2=53051&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/IRBuilder.h (original) +++ llvm/trunk/include/llvm/Support/IRBuilder.h Wed Jul 2 17:57:59 2008 @@ -18,6 +18,8 @@ #include "llvm/BasicBlock.h" #include "llvm/Instructions.h" #include "llvm/Constants.h" +#include "llvm/GlobalVariable.h" +#include "llvm/Function.h" namespace llvm { @@ -308,7 +310,24 @@ return Insert(GetElementPtrInst::Create(Ptr, Idxs, Idxs+2), Name); } - + Value *CreateGlobalString(const char *Str = "", const char *Name = "") { + Constant *StrConstant = ConstantArray::get(Str, true); + GlobalVariable *gv = new llvm::GlobalVariable(StrConstant->getType(), + true, + GlobalValue::InternalLinkage, + StrConstant, + "", + BB->getParent()->getParent(), + false); + gv->setName(Name); + return gv; + } + Value *CreateGlobalStringPtr(const char *Str = "", const char *Name = "") { + Value *gv = CreateGlobalString(Str, Name); + Value *zero = llvm::ConstantInt::get(llvm::Type::Int32Ty, 0); + Value *Args[] = { zero, zero }; + return CreateGEP(gv, Args, Args+2, Name); + } //===--------------------------------------------------------------------===// // Instruction creation methods: Cast/Conversion Operators //===--------------------------------------------------------------------===// From dpatel at apple.com Wed Jul 2 17:58:55 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 02 Jul 2008 22:58:55 -0000 Subject: [llvm-commits] [llvm] r53052 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200807022258.m62MwtV9030433@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 2 17:58:54 2008 New Revision: 53052 URL: http://llvm.org/viewvc/llvm-project?rev=53052&view=rev Log: Preserve dom info while simplifing loop after the unswitch. 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=53052&r1=53051&r2=53052&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Jul 2 17:58:54 2008 @@ -757,6 +757,22 @@ } +/// addBBToDomFrontier - Helper function. Insert DFBB in Basic Block BB's +/// dominance frontier using iterator DFI. +static void addBBToDomFrontier(DominanceFrontier &DF, + DominanceFrontier::iterator &DFI, + BasicBlock *BB, BasicBlock *DFBB) { + if (DFI != DF.end()) { + DF.addToFrontier(DFI, DFBB); + return; + } + + DominanceFrontier::DomSetType NSet; + NSet.insert(DFBB); + DF.addBasicBlock(BB, NSet); + DFI = DF.find(BB); +} + /// UnswitchNontrivialCondition - We determined that the loop is profitable /// to unswitch when LIC equal Val. Split it into loop versions and test the /// condition outside of either loop. Return the loops created as Out1/Out2. @@ -1188,18 +1204,32 @@ // trying to update it is complicated. So instead we preserve the // loop structure and put the block on an dead code path. + BasicBlock *SISucc = SI->getSuccessor(i); BasicBlock* Old = SI->getParent(); BasicBlock* Split = SplitBlock(Old, SI, this); Instruction* OldTerm = Old->getTerminator(); - BranchInst::Create(Split, SI->getSuccessor(i), + BranchInst::Create(Split, SISucc, ConstantInt::getTrue(), OldTerm); + if (DT) { + // Now, SISucc is dominated by Old. + DT->changeImmediateDominator(SISucc, Old); + if (DF) { + // Now, Split does not dominate SISucc. + // SISucc is the only member in Split's DF. + DominanceFrontier::iterator S_DFI = DF->find(Split); + if (S_DFI != DF->end()) + S_DFI->second.clear(); + addBBToDomFrontier(*DF, S_DFI, Split, SISucc); + } + } + LPM->deleteSimpleAnalysisValue(Old->getTerminator(), L); Old->getTerminator()->eraseFromParent(); PHINode *PN; - for (BasicBlock::iterator II = SI->getSuccessor(i)->begin(); + for (BasicBlock::iterator II = SISucc->begin(); (PN = dyn_cast(II)); ++II) { Value *InVal = PN->removeIncomingValue(Split, false); PN->addIncoming(InVal, Old); From gohman at apple.com Wed Jul 2 18:23:19 2008 From: gohman at apple.com (Dan Gohman) Date: Wed, 02 Jul 2008 23:23:19 -0000 Subject: [llvm-commits] [llvm] r53057 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/ScheduleDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp utils/TableGen/DAGISelEmitter.cpp Message-ID: <200807022323.m62NNJLY031395@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 2 18:23:19 2008 New Revision: 53057 URL: http://llvm.org/viewvc/llvm-project?rev=53057&view=rev Log: Replace a few uses of SelectionDAG::getTargetNode with SelectionDAG::SelectNodeTo in the instruction selector. This updates existing nodes in place instead of creating new ones. Go back to selecting ISD::DBG_LABEL nodes into TargetInstrInfo::DBG_LABEL nodes instead of leaving them unselected, now that SelectNodeTo allows us to update them in place. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=53057&r1=53056&r2=53057&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Jul 2 18:23:19 2008 @@ -461,10 +461,19 @@ SDOperand Op1, SDOperand Op2, SDOperand Op3); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperandPtr Ops, unsigned NumOps); + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2); + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, + MVT VT2, SDOperandPtr Ops, unsigned NumOps); + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, + MVT VT2, MVT VT3, SDOperandPtr Ops, unsigned NumOps); + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, + MVT VT2, SDOperand Op1); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, SDOperand Op1, SDOperand Op2); SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, SDOperand Op1, SDOperand Op2, SDOperand Op3); + SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, SDVTList VTs, + SDOperandPtr Ops, unsigned NumOps); /// getTargetNode - These are used for target selectors to create a new node Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=53057&r1=53056&r2=53057&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Wed Jul 2 18:23:19 2008 @@ -885,16 +885,6 @@ assert(0 && "EntryToken should have been excluded from the schedule!"); break; case ISD::TokenFactor: // fall thru - case ISD::DECLARE: - case ISD::SRCVALUE: - break; - case ISD::DBG_LABEL: - BB->push_back(BuildMI(TII->get(TargetInstrInfo::DBG_LABEL)) - .addImm(cast(Node)->getLabelID())); - break; - case ISD::EH_LABEL: - BB->push_back(BuildMI(TII->get(TargetInstrInfo::EH_LABEL)) - .addImm(cast(Node)->getLabelID())); break; case ISD::CopyToReg: { unsigned SrcReg; @@ -951,34 +941,14 @@ switch (Flags & 7) { default: assert(0 && "Bad flags!"); - case 1: // Use of register. - for (; NumVals; --NumVals, ++i) { - unsigned Reg = cast(Node->getOperand(i))->getReg(); - MI->addOperand(MachineOperand::CreateReg(Reg, false)); - } - break; case 2: // Def of register. for (; NumVals; --NumVals, ++i) { unsigned Reg = cast(Node->getOperand(i))->getReg(); MI->addOperand(MachineOperand::CreateReg(Reg, true)); } break; - case 3: { // Immediate. - for (; NumVals; --NumVals, ++i) { - if (ConstantSDNode *CS = - dyn_cast(Node->getOperand(i))) { - MI->addOperand(MachineOperand::CreateImm(CS->getValue())); - } else if (GlobalAddressSDNode *GA = - dyn_cast(Node->getOperand(i))) { - MI->addOperand(MachineOperand::CreateGA(GA->getGlobal(), - GA->getOffset())); - } else { - BasicBlockSDNode *BB =cast(Node->getOperand(i)); - MI->addOperand(MachineOperand::CreateMBB(BB->getBasicBlock())); - } - } - break; - } + case 1: // Use of register. + case 3: // Immediate. case 4: // Addressing mode. // The addressing mode has been selected, just add all of the // operands to the machine instruction. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=53057&r1=53056&r2=53057&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jul 2 18:23:19 2008 @@ -3693,130 +3693,97 @@ SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT) { SDVTList VTs = getVTList(VT); - FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, (SDOperand*)0, 0); - void *IP = 0; - if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) - return ON; - - RemoveNodeFromCSEMaps(N); - - N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, SDOperandPtr(), 0); - - CSEMap.InsertNode(N, IP); - return N; + return SelectNodeTo(N, TargetOpc, VTs, (SDOperand*)0, 0); } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperand Op1) { - // If an identical node already exists, use it. SDVTList VTs = getVTList(VT); SDOperand Ops[] = { Op1 }; - - FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, 1); - void *IP = 0; - if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) - return ON; - - RemoveNodeFromCSEMaps(N); - N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, 1); - CSEMap.InsertNode(N, IP); - return N; + return SelectNodeTo(N, TargetOpc, VTs, Ops, 1); } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperand Op1, SDOperand Op2) { - // If an identical node already exists, use it. SDVTList VTs = getVTList(VT); SDOperand Ops[] = { Op1, Op2 }; - - FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, 2); - void *IP = 0; - if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) - return ON; - - RemoveNodeFromCSEMaps(N); - - N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, 2); - - CSEMap.InsertNode(N, IP); // Memoize the new node. - return N; + return SelectNodeTo(N, TargetOpc, VTs, Ops, 2); } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperand Op1, SDOperand Op2, SDOperand Op3) { - // If an identical node already exists, use it. SDVTList VTs = getVTList(VT); SDOperand Ops[] = { Op1, Op2, Op3 }; - FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, 3); - void *IP = 0; - if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) - return ON; - - RemoveNodeFromCSEMaps(N); - - N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, 3); - - CSEMap.InsertNode(N, IP); // Memoize the new node. - return N; + return SelectNodeTo(N, TargetOpc, VTs, Ops, 3); } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperandPtr Ops, unsigned NumOps) { - // If an identical node already exists, use it. SDVTList VTs = getVTList(VT); - FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, NumOps); - void *IP = 0; - if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) - return ON; - - RemoveNodeFromCSEMaps(N); - N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, NumOps); - - CSEMap.InsertNode(N, IP); // Memoize the new node. - return N; + return SelectNodeTo(N, TargetOpc, VTs, Ops, NumOps); +} + +SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT VT1, MVT VT2, SDOperandPtr Ops, + unsigned NumOps) { + SDVTList VTs = getVTList(VT1, VT2); + return SelectNodeTo(N, TargetOpc, VTs, Ops, NumOps); +} + +SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT VT1, MVT VT2) { + SDVTList VTs = getVTList(VT1, VT2); + return SelectNodeTo(N, TargetOpc, VTs, (SDOperand *)0, 0); +} + +SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT VT1, MVT VT2, MVT VT3, SDOperandPtr Ops, + unsigned NumOps) { + SDVTList VTs = getVTList(VT1, VT2, VT3); + return SelectNodeTo(N, TargetOpc, VTs, Ops, NumOps); +} + +SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + MVT VT1, MVT VT2, + SDOperand Op1) { + SDVTList VTs = getVTList(VT1, VT2); + SDOperand Ops[] = { Op1 }; + return SelectNodeTo(N, TargetOpc, VTs, Ops, 1); } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, SDOperand Op1, SDOperand Op2) { SDVTList VTs = getVTList(VT1, VT2); - FoldingSetNodeID ID; SDOperand Ops[] = { Op1, Op2 }; - AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, 2); - void *IP = 0; - if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) - return ON; - - RemoveNodeFromCSEMaps(N); - N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, 2); - CSEMap.InsertNode(N, IP); // Memoize the new node. - return N; + return SelectNodeTo(N, TargetOpc, VTs, Ops, 2); } SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2, SDOperand Op1, SDOperand Op2, SDOperand Op3) { - // If an identical node already exists, use it. SDVTList VTs = getVTList(VT1, VT2); SDOperand Ops[] = { Op1, Op2, Op3 }; + return SelectNodeTo(N, TargetOpc, VTs, Ops, 3); +} + +SDNode *SelectionDAG::SelectNodeTo(SDNode *N, unsigned TargetOpc, + SDVTList VTs, SDOperandPtr Ops, + unsigned NumOps) { + // If an identical node already exists, use it. FoldingSetNodeID ID; - AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, 3); + AddNodeIDNode(ID, ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, NumOps); void *IP = 0; if (SDNode *ON = CSEMap.FindNodeOrInsertPos(ID, IP)) return ON; RemoveNodeFromCSEMaps(N); - N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, 3); + N->MorphNodeTo(ISD::BUILTIN_OP_END+TargetOpc, VTs, Ops, NumOps); CSEMap.InsertNode(N, IP); // Memoize the new node. return N; } @@ -4109,8 +4076,7 @@ for (SDNode::use_iterator UI = From.Val->use_begin(), E = From.Val->use_end(); UI != E; ++UI) { SDNode *User = UI->getUser(); - if (!Users.count(User)) - Users.insert(User); + Users.insert(User); } // When one of the recursive merges deletes nodes from the graph, we need to Modified: llvm/trunk/utils/TableGen/DAGISelEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/DAGISelEmitter.cpp?rev=53057&r1=53056&r2=53057&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Wed Jul 2 18:23:19 2008 @@ -1860,8 +1860,26 @@ << "}\n\n"; OS << "SDNode *Select_UNDEF(const SDOperand &N) {\n" - << " return CurDAG->getTargetNode(TargetInstrInfo::IMPLICIT_DEF,\n" - << " N.getValueType());\n" + << " return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::IMPLICIT_DEF,\n" + << " N.getValueType());\n" + << "}\n\n"; + + OS << "SDNode *Select_DBG_LABEL(const SDOperand &N) {\n" + << " SDOperand Chain = N.getOperand(0);\n" + << " unsigned C = cast(N)->getLabelID();\n" + << " SDOperand Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n" + << " AddToISelQueue(Chain);\n" + << " return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::DBG_LABEL,\n" + << " MVT::Other, Tmp, Chain);\n" + << "}\n\n"; + + OS << "SDNode *Select_EH_LABEL(const SDOperand &N) {\n" + << " SDOperand Chain = N.getOperand(0);\n" + << " unsigned C = cast(N)->getLabelID();\n" + << " SDOperand Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n" + << " AddToISelQueue(Chain);\n" + << " return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::EH_LABEL,\n" + << " MVT::Other, Tmp, Chain);\n" << "}\n\n"; OS << "SDNode *Select_DECLARE(const SDOperand &N) {\n" @@ -1880,9 +1898,8 @@ << " SDOperand Tmp2 = " << "CurDAG->getTargetGlobalAddress(GV, TLI.getPointerTy());\n" << " AddToISelQueue(Chain);\n" - << " SDOperand Ops[] = { Tmp1, Tmp2, Chain };\n" - << " return CurDAG->getTargetNode(TargetInstrInfo::DECLARE,\n" - << " MVT::Other, Ops, 3);\n" + << " return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::DECLARE,\n" + << " MVT::Other, Tmp1, Tmp2, Chain);\n" << "}\n\n"; OS << "SDNode *Select_EXTRACT_SUBREG(const SDOperand &N) {\n" @@ -1891,9 +1908,8 @@ << " unsigned C = cast(N1)->getValue();\n" << " SDOperand Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n" << " AddToISelQueue(N0);\n" - << " SDOperand Ops[] = { N0, Tmp };\n" - << " return CurDAG->getTargetNode(TargetInstrInfo::EXTRACT_SUBREG,\n" - << " N.getValueType(), Ops, 2);\n" + << " return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::EXTRACT_SUBREG,\n" + << " N.getValueType(), N0, Tmp);\n" << "}\n\n"; OS << "SDNode *Select_INSERT_SUBREG(const SDOperand &N) {\n" @@ -1903,10 +1919,9 @@ << " unsigned C = cast(N2)->getValue();\n" << " SDOperand Tmp = CurDAG->getTargetConstant(C, MVT::i32);\n" << " AddToISelQueue(N1);\n" - << " SDOperand Ops[] = { N0, N1, Tmp };\n" << " AddToISelQueue(N0);\n" - << " return CurDAG->getTargetNode(TargetInstrInfo::INSERT_SUBREG,\n" - << " N.getValueType(), Ops, 3);\n" + << " return CurDAG->SelectNodeTo(N.Val, TargetInstrInfo::INSERT_SUBREG,\n" + << " N.getValueType(), N0, N1, Tmp);\n" << "}\n\n"; OS << "// The main instruction selector code.\n" @@ -1942,13 +1957,13 @@ << " case ISD::TokenFactor:\n" << " case ISD::CopyFromReg:\n" << " case ISD::CopyToReg: {\n" - << " case ISD::DBG_LABEL:\n" - << " case ISD::EH_LABEL:\n" << " for (unsigned i = 0, e = N.getNumOperands(); i != e; ++i)\n" << " AddToISelQueue(N.getOperand(i));\n" << " return NULL;\n" << " }\n" << " case ISD::INLINEASM: return Select_INLINEASM(N);\n" + << " case ISD::DBG_LABEL: return Select_DBG_LABEL(N);\n" + << " case ISD::EH_LABEL: return Select_EH_LABEL(N);\n" << " case ISD::DECLARE: return Select_DECLARE(N);\n" << " case ISD::EXTRACT_SUBREG: return Select_EXTRACT_SUBREG(N);\n" << " case ISD::INSERT_SUBREG: return Select_INSERT_SUBREG(N);\n" From resistor at mac.com Wed Jul 2 18:41:07 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 02 Jul 2008 23:41:07 -0000 Subject: [llvm-commits] [llvm] r53058 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/TwoAddressInstructionPass.cpp lib/Target/ARM/ARMInstrInfo.cpp lib/Target/ARM/ARMInstrInfo.h lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h Message-ID: <200807022341.m62Nf7vI031845@zion.cs.uiuc.edu> Author: resistor Date: Wed Jul 2 18:41:07 2008 New Revision: 53058 URL: http://llvm.org/viewvc/llvm-project?rev=53058&view=rev Log: Make LiveVariables even more optional, by making it optional in the call to TargetInstrInfo::convertToThreeAddressInstruction Also, if LV isn't around, then TwoAddr doesn't need to be updating flags, since they won't have been set in the first place. Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.h llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.h Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=53058&r1=53057&r2=53058&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Wed Jul 2 18:41:07 2008 @@ -143,7 +143,7 @@ /// virtual MachineInstr * convertToThreeAddress(MachineFunction::iterator &MFI, - MachineBasicBlock::iterator &MBBI, LiveVariables &LV) const { + MachineBasicBlock::iterator &MBBI, LiveVariables *LV) const { return 0; } Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=53058&r1=53057&r2=53058&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed Jul 2 18:41:07 2008 @@ -378,27 +378,6 @@ if (LV) { // Update live variables LV->instructionChanged(mi, NewMI); - } else { - // Update flags manually - for (unsigned i = 0, e = mi->getNumOperands(); - i != e; ++i) { - MachineOperand &MO = mi->getOperand(i); - if (MO.isRegister() && MO.getReg() && - TargetRegisterInfo::isVirtualRegister(MO.getReg())) { - unsigned Reg = MO.getReg(); - if (MO.isDef()) { - if (MO.isDead()) { - MO.setIsDead(false); - NewMI->addRegisterDead(Reg, TRI); - } - } - - if (MO.isKill()) { - MO.setIsKill(false); - NewMI->addRegisterKilled(Reg, TRI); - } - } - } } mbbi->insert(mi, NewMI); // Insert the new inst @@ -424,7 +403,7 @@ assert(TID.getOperandConstraint(i, TOI::TIED_TO) == -1); #endif - MachineInstr *NewMI = TII->convertToThreeAddress(mbbi, mi, *LV); + MachineInstr *NewMI = TII->convertToThreeAddress(mbbi, mi, LV); if (NewMI) { DOUT << "2addr: CONVERTING 2-ADDR: " << *mi; DOUT << "2addr: TO 3-ADDR: " << *NewMI; @@ -481,30 +460,6 @@ if (LV->removeVirtualRegisterDead(regB, mbbi, mi)) LV->addVirtualRegisterDead(regB, prevMi); - } else { - // Manually update kill/dead flags. - bool RemovedKill = false; - bool RemovedDead = false; - for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) { - MachineOperand &MO = mi->getOperand(i); - if (MO.isRegister() && MO.isKill() && MO.getReg() == regB) { - MO.setIsKill(false); - RemovedKill = true; - break; - } - - if (MO.isRegister() && MO.isDef() && MO.getReg() == regB) { - MO.setIsDead(false); - RemovedDead = true; - } - - if (RemovedKill && RemovedDead) break; - } - - if (RemovedKill) - prevMi->addRegisterKilled(regB, TRI); - if (RemovedDead) - prevMi->addRegisterDead(regB, TRI); } // Replace all occurences of regB with regA. Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=53058&r1=53057&r2=53058&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Wed Jul 2 18:41:07 2008 @@ -191,7 +191,7 @@ MachineInstr * ARMInstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI, MachineBasicBlock::iterator &MBBI, - LiveVariables &LV) const { + LiveVariables *LV) const { if (!EnableARM3Addr) return NULL; @@ -300,22 +300,25 @@ if (MO.isRegister() && MO.getReg() && TargetRegisterInfo::isVirtualRegister(MO.getReg())) { unsigned Reg = MO.getReg(); - LiveVariables::VarInfo &VI = LV.getVarInfo(Reg); - if (MO.isDef()) { - MachineInstr *NewMI = (Reg == WBReg) ? UpdateMI : MemMI; - if (MO.isDead()) - LV.addVirtualRegisterDead(Reg, NewMI); - } - if (MO.isUse() && MO.isKill()) { - for (unsigned j = 0; j < 2; ++j) { - // Look at the two new MI's in reverse order. - MachineInstr *NewMI = NewMIs[j]; - if (!NewMI->readsRegister(Reg)) - continue; - LV.addVirtualRegisterKilled(Reg, NewMI); - if (VI.removeKill(MI)) - VI.Kills.push_back(NewMI); - break; + + if (LV) { + LiveVariables::VarInfo &VI = LV->getVarInfo(Reg); + if (MO.isDef()) { + MachineInstr *NewMI = (Reg == WBReg) ? UpdateMI : MemMI; + if (MO.isDead()) + LV->addVirtualRegisterDead(Reg, NewMI); + } + if (MO.isUse() && MO.isKill()) { + for (unsigned j = 0; j < 2; ++j) { + // Look at the two new MI's in reverse order. + MachineInstr *NewMI = NewMIs[j]; + if (!NewMI->readsRegister(Reg)) + continue; + LV->addVirtualRegisterKilled(Reg, NewMI); + if (VI.removeKill(MI)) + VI.Kills.push_back(NewMI); + break; + } } } } Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.h?rev=53058&r1=53057&r2=53058&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.h (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Wed Jul 2 18:41:07 2008 @@ -153,7 +153,7 @@ virtual MachineInstr *convertToThreeAddress(MachineFunction::iterator &MFI, MachineBasicBlock::iterator &MBBI, - LiveVariables &LV) const; + LiveVariables *LV) const; // Branch analysis. virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=53058&r1=53057&r2=53058&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Wed Jul 2 18:41:07 2008 @@ -978,7 +978,7 @@ MachineInstr * X86InstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI, MachineBasicBlock::iterator &MBBI, - LiveVariables &LV) const { + LiveVariables *LV) const { MachineInstr *MI = MBBI; // All instructions input are two-addr instructions. Get the known operands. unsigned Dest = MI->getOperand(0).getReg(); @@ -1066,10 +1066,12 @@ MFI->insert(MBBI, Undef); MFI->insert(MBBI, Ins); // Insert the insert_subreg - LV.instructionChanged(MI, NewMI); // Update live variables - LV.addVirtualRegisterKilled(leaInReg, NewMI); + if (LV) { + LV->instructionChanged(MI, NewMI); // Update live variables + LV->addVirtualRegisterKilled(leaInReg, NewMI); + } MFI->insert(MBBI, NewMI); // Insert the new inst - LV.addVirtualRegisterKilled(leaOutReg, Ext); + if (LV) LV->addVirtualRegisterKilled(leaOutReg, Ext); MFI->insert(MBBI, Ext); // Insert the extract_subreg return Ext; } else { @@ -1180,7 +1182,7 @@ if (!NewMI) return 0; NewMI->copyKillDeadInfo(MI); - LV.instructionChanged(MI, NewMI); // Update live variables + if (LV) LV->instructionChanged(MI, NewMI); // Update live variables MFI->insert(MBBI, NewMI); // Insert the new inst return NewMI; } Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=53058&r1=53057&r2=53058&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Wed Jul 2 18:41:07 2008 @@ -295,7 +295,7 @@ /// virtual MachineInstr *convertToThreeAddress(MachineFunction::iterator &MFI, MachineBasicBlock::iterator &MBBI, - LiveVariables &LV) const; + LiveVariables *LV) const; /// commuteInstruction - We have a few instructions that must be hacked on to /// commute them. From evan.cheng at apple.com Wed Jul 2 18:45:06 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 2 Jul 2008 16:45:06 -0700 Subject: [llvm-commits] [llvm] r53058 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/TwoAddressInstructionPass.cpp lib/Target/ARM/ARMInstrInfo.cpp lib/Target/ARM/ARMInstrInfo.h lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h In-Reply-To: <200807022341.m62Nf7vI031845@zion.cs.uiuc.edu> References: <200807022341.m62Nf7vI031845@zion.cs.uiuc.edu> Message-ID: On Jul 2, 2008, at 4:41 PM, Owen Anderson wrote: > Author: resistor > Date: Wed Jul 2 18:41:07 2008 > New Revision: 53058 > > URL: http://llvm.org/viewvc/llvm-project?rev=53058&view=rev > Log: > Make LiveVariables even more optional, by making it optional in the > call to TargetInstrInfo::convertToThreeAddressInstruction > Also, if LV isn't around, then TwoAddr doesn't need to be updating > flags, since they won't have been set in the first place. Thanks. I was just about to ping you about this. You can't assume there aren't kill / dead markers on machineinstrs even if LV is not available. But commuteInstruction is supposed to copy the markers over. Evan > > > Modified: > llvm/trunk/include/llvm/Target/TargetInstrInfo.h > llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp > llvm/trunk/lib/Target/ARM/ARMInstrInfo.h > llvm/trunk/lib/Target/X86/X86InstrInfo.cpp > llvm/trunk/lib/Target/X86/X86InstrInfo.h > > Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=53058&r1=53057&r2=53058&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) > +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Wed Jul 2 > 18:41:07 2008 > @@ -143,7 +143,7 @@ > /// > virtual MachineInstr * > convertToThreeAddress(MachineFunction::iterator &MFI, > - MachineBasicBlock::iterator &MBBI, LiveVariables > &LV) const { > + MachineBasicBlock::iterator &MBBI, LiveVariables > *LV) const { > return 0; > } > > > Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=53058&r1=53057&r2=53058&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) > +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed Jul 2 > 18:41:07 2008 > @@ -378,27 +378,6 @@ > if (LV) { > // Update live variables > LV->instructionChanged(mi, NewMI); > - } else { > - // Update flags manually > - for (unsigned i = 0, e = mi->getNumOperands(); > - i != e; ++i) { > - MachineOperand &MO = mi->getOperand(i); > - if (MO.isRegister() && MO.getReg() && > - > TargetRegisterInfo::isVirtualRegister(MO.getReg())) { > - unsigned Reg = MO.getReg(); > - if (MO.isDef()) { > - if (MO.isDead()) { > - MO.setIsDead(false); > - NewMI->addRegisterDead(Reg, TRI); > - } > - } > - > - if (MO.isKill()) { > - MO.setIsKill(false); > - NewMI->addRegisterKilled(Reg, TRI); > - } > - } > - } > } > > mbbi->insert(mi, NewMI); // Insert the > new inst > @@ -424,7 +403,7 @@ > assert(TID.getOperandConstraint(i, TOI::TIED_TO) == > -1); > #endif > > - MachineInstr *NewMI = TII- > >convertToThreeAddress(mbbi, mi, *LV); > + MachineInstr *NewMI = TII- > >convertToThreeAddress(mbbi, mi, LV); > if (NewMI) { > DOUT << "2addr: CONVERTING 2-ADDR: " << *mi; > DOUT << "2addr: TO 3-ADDR: " << *NewMI; > @@ -481,30 +460,6 @@ > > if (LV->removeVirtualRegisterDead(regB, mbbi, mi)) > LV->addVirtualRegisterDead(regB, prevMi); > - } else { > - // Manually update kill/dead flags. > - bool RemovedKill = false; > - bool RemovedDead = false; > - for (unsigned i = 0, e = mi->getNumOperands(); i != e; + > +i) { > - MachineOperand &MO = mi->getOperand(i); > - if (MO.isRegister() && MO.isKill() && MO.getReg() == > regB) { > - MO.setIsKill(false); > - RemovedKill = true; > - break; > - } > - > - if (MO.isRegister() && MO.isDef() && MO.getReg() == > regB) { > - MO.setIsDead(false); > - RemovedDead = true; > - } > - > - if (RemovedKill && RemovedDead) break; > - } > - > - if (RemovedKill) > - prevMi->addRegisterKilled(regB, TRI); > - if (RemovedDead) > - prevMi->addRegisterDead(regB, TRI); > } > > // Replace all occurences of regB with regA. > > Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=53058&r1=53057&r2=53058&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Wed Jul 2 18:41:07 > 2008 > @@ -191,7 +191,7 @@ > MachineInstr * > ARMInstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI, > MachineBasicBlock::iterator &MBBI, > - LiveVariables &LV) const { > + LiveVariables *LV) const { > if (!EnableARM3Addr) > return NULL; > > @@ -300,22 +300,25 @@ > if (MO.isRegister() && MO.getReg() && > TargetRegisterInfo::isVirtualRegister(MO.getReg())) { > unsigned Reg = MO.getReg(); > - LiveVariables::VarInfo &VI = LV.getVarInfo(Reg); > - if (MO.isDef()) { > - MachineInstr *NewMI = (Reg == WBReg) ? UpdateMI : MemMI; > - if (MO.isDead()) > - LV.addVirtualRegisterDead(Reg, NewMI); > - } > - if (MO.isUse() && MO.isKill()) { > - for (unsigned j = 0; j < 2; ++j) { > - // Look at the two new MI's in reverse order. > - MachineInstr *NewMI = NewMIs[j]; > - if (!NewMI->readsRegister(Reg)) > - continue; > - LV.addVirtualRegisterKilled(Reg, NewMI); > - if (VI.removeKill(MI)) > - VI.Kills.push_back(NewMI); > - break; > + > + if (LV) { > + LiveVariables::VarInfo &VI = LV->getVarInfo(Reg); > + if (MO.isDef()) { > + MachineInstr *NewMI = (Reg == WBReg) ? UpdateMI : MemMI; > + if (MO.isDead()) > + LV->addVirtualRegisterDead(Reg, NewMI); > + } > + if (MO.isUse() && MO.isKill()) { > + for (unsigned j = 0; j < 2; ++j) { > + // Look at the two new MI's in reverse order. > + MachineInstr *NewMI = NewMIs[j]; > + if (!NewMI->readsRegister(Reg)) > + continue; > + LV->addVirtualRegisterKilled(Reg, NewMI); > + if (VI.removeKill(MI)) > + VI.Kills.push_back(NewMI); > + break; > + } > } > } > } > > Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.h?rev=53058&r1=53057&r2=53058&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.h (original) > +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.h Wed Jul 2 18:41:07 2008 > @@ -153,7 +153,7 @@ > > virtual MachineInstr > *convertToThreeAddress(MachineFunction::iterator &MFI, > > MachineBasicBlock::iterator &MBBI, > - LiveVariables &LV) > const; > + LiveVariables *LV) > const; > > // Branch analysis. > virtual bool AnalyzeBranch(MachineBasicBlock &MBB, > MachineBasicBlock *&TBB, > > Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=53058&r1=53057&r2=53058&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Wed Jul 2 18:41:07 > 2008 > @@ -978,7 +978,7 @@ > MachineInstr * > X86InstrInfo::convertToThreeAddress(MachineFunction::iterator &MFI, > MachineBasicBlock::iterator &MBBI, > - LiveVariables &LV) const { > + LiveVariables *LV) const { > MachineInstr *MI = MBBI; > // All instructions input are two-addr instructions. Get the > known operands. > unsigned Dest = MI->getOperand(0).getReg(); > @@ -1066,10 +1066,12 @@ > > MFI->insert(MBBI, Undef); > MFI->insert(MBBI, Ins); // Insert the insert_subreg > - LV.instructionChanged(MI, NewMI); // Update live variables > - LV.addVirtualRegisterKilled(leaInReg, NewMI); > + if (LV) { > + LV->instructionChanged(MI, NewMI); // Update live variables > + LV->addVirtualRegisterKilled(leaInReg, NewMI); > + } > MFI->insert(MBBI, NewMI); // Insert the new inst > - LV.addVirtualRegisterKilled(leaOutReg, Ext); > + if (LV) LV->addVirtualRegisterKilled(leaOutReg, Ext); > MFI->insert(MBBI, Ext); // Insert the extract_subreg > return Ext; > } else { > @@ -1180,7 +1182,7 @@ > if (!NewMI) return 0; > > NewMI->copyKillDeadInfo(MI); > - LV.instructionChanged(MI, NewMI); // Update live variables > + if (LV) LV->instructionChanged(MI, NewMI); // Update live > variables > MFI->insert(MBBI, NewMI); // Insert the new inst > return NewMI; > } > > Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.h?rev=53058&r1=53057&r2=53058&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86InstrInfo.h (original) > +++ llvm/trunk/lib/Target/X86/X86InstrInfo.h Wed Jul 2 18:41:07 2008 > @@ -295,7 +295,7 @@ > /// > virtual MachineInstr > *convertToThreeAddress(MachineFunction::iterator &MFI, > > MachineBasicBlock::iterator &MBBI, > - LiveVariables &LV) > const; > + LiveVariables *LV) > const; > > /// commuteInstruction - We have a few instructions that must be > hacked on to > /// commute them. > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Wed Jul 2 18:50:32 2008 From: resistor at mac.com (Owen Anderson) Date: Wed, 02 Jul 2008 16:50:32 -0700 Subject: [llvm-commits] [llvm] r53058 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/TwoAddressInstructionPass.cpp lib/Target/ARM/ARMInstrInfo.cpp lib/Target/ARM/ARMInstrInfo.h lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h In-Reply-To: References: <200807022341.m62Nf7vI031845@zion.cs.uiuc.edu> Message-ID: On Jul 2, 2008, at 4:45 PM, Evan Cheng wrote: > Thanks. I was just about to ping you about this. You can't assume > there aren't kill / dead markers on machineinstrs even if LV is not > available. But commuteInstruction is supposed to copy the markers > over. > How are they going to get there unless LV puts them there? --Owen From evan.cheng at apple.com Wed Jul 2 18:59:35 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 2 Jul 2008 16:59:35 -0700 Subject: [llvm-commits] [llvm] r53058 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/CodeGen/TwoAddressInstructionPass.cpp lib/Target/ARM/ARMInstrInfo.cpp lib/Target/ARM/ARMInstrInfo.h lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86InstrInfo.h In-Reply-To: References: <200807022341.m62Nf7vI031845@zion.cs.uiuc.edu> Message-ID: You can't assume there are not other passes that add kill / dead markers. Also, it's also possible LV was run but analysis info has since been destroyed. Evan On Jul 2, 2008, at 4:50 PM, Owen Anderson wrote: > On Jul 2, 2008, at 4:45 PM, Evan Cheng wrote: >> Thanks. I was just about to ping you about this. You can't assume >> there aren't kill / dead markers on machineinstrs even if LV is not >> available. But commuteInstruction is supposed to copy the markers >> over. >> > > How are they going to get there unless LV puts them there? > > --Owen > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Wed Jul 2 19:01:54 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 2 Jul 2008 17:01:54 -0700 Subject: [llvm-commits] [llvm] r53050 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp In-Reply-To: <200807022212.m62MCuQX028998@zion.cs.uiuc.edu> References: <200807022212.m62MCuQX028998@zion.cs.uiuc.edu> Message-ID: Doh. Did you keep the .s files around just in case? I'd like to see what's wrong. This means we have bugs elsewhere in all likelihood. Evan On Jul 2, 2008, at 3:12 PM, Dan Gohman wrote: > Author: djg > Date: Wed Jul 2 17:12:55 2008 > New Revision: 53050 > > URL: http://llvm.org/viewvc/llvm-project?rev=53050&view=rev > Log: > Revert r52988. It broke 254.gap on x86-64. > > Modified: > llvm/trunk/lib/CodeGen/MachineInstr.cpp > > Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=53050&r1=53049&r2=53050&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) > +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed Jul 2 17:12:55 2008 > @@ -738,7 +738,7 @@ > const TargetRegisterInfo > *RegInfo, > bool AddIfNotFound) { > bool isPhysReg = > TargetRegisterInfo::isPhysicalRegister(IncomingReg); > - bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); > + bool Found = false; > SmallVector DeadOps; > for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { > MachineOperand &MO = getOperand(i); > @@ -749,15 +749,15 @@ > continue; > > if (Reg == IncomingReg) { > - MO.setIsKill(); > - return true; > - } > - if (hasAliases && MO.isKill() && > - TargetRegisterInfo::isPhysicalRegister(Reg)) { > + if (!Found) // One kill of reg per instruction. > + MO.setIsKill(); > + Found = true; > + } else if (isPhysReg && MO.isKill() && > + TargetRegisterInfo::isPhysicalRegister(Reg)) { > // A super-register kill already exists. > if (RegInfo->isSuperRegister(IncomingReg, Reg)) > - return true; > - if (RegInfo->isSubRegister(IncomingReg, Reg)) > + Found = true; > + else if (RegInfo->isSubRegister(IncomingReg, Reg)) > DeadOps.push_back(i); > } > } > @@ -774,14 +774,14 @@ > > // If not found, this means an alias of one of the operands is > killed. Add a > // new implicit operand if required. > - if (AddIfNotFound) { > + if (!Found && AddIfNotFound) { > addOperand(MachineOperand::CreateReg(IncomingReg, > false /*IsDef*/, > true /*IsImp*/, > true /*IsKill*/)); > return true; > } > - return false; > + return Found; > } > > bool MachineInstr::addRegisterDead(unsigned IncomingReg, > @@ -789,6 +789,7 @@ > bool AddIfNotFound) { > bool isPhysReg = > TargetRegisterInfo::isPhysicalRegister(IncomingReg); > bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); > + bool Found = false; > SmallVector DeadOps; > for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { > MachineOperand &MO = getOperand(i); > @@ -797,14 +798,13 @@ > unsigned Reg = MO.getReg(); > if (Reg == IncomingReg) { > MO.setIsDead(); > - return true; > - } > - if (hasAliases && MO.isDead() && > - TargetRegisterInfo::isPhysicalRegister(Reg)) { > + Found = true; > + } else if (hasAliases && MO.isDead() && > + TargetRegisterInfo::isPhysicalRegister(Reg)) { > // There exists a super-register that's marked dead. > if (RegInfo->isSuperRegister(IncomingReg, Reg)) > - return true; > - if (RegInfo->isSubRegister(IncomingReg, Reg)) > + Found = true; > + else if (RegInfo->isSubRegister(IncomingReg, Reg)) > DeadOps.push_back(i); > } > } > @@ -821,13 +821,13 @@ > > // If not found, this means an alias of one of the operand is > dead. Add a > // new implicit operand. > - if (AddIfNotFound) { > + if (!Found && AddIfNotFound) { > addOperand(MachineOperand::CreateReg(IncomingReg, true/*IsDef*/, > true/*IsImp*/,false/ > *IsKill*/, > true/*IsDead*/)); > return true; > } > - return false; > + return Found; > } > > /// copyKillDeadInfo - copies killed/dead information from one instr > to another > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Wed Jul 2 19:04:51 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 03 Jul 2008 00:04:51 -0000 Subject: [llvm-commits] [llvm] r53060 - /llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Message-ID: <200807030004.m6304po2032530@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jul 2 19:04:51 2008 New Revision: 53060 URL: http://llvm.org/viewvc/llvm-project?rev=53060&view=rev Log: commuteInstruction should preserve dead markers. 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=53060&r1=53059&r2=53060&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Wed Jul 2 19:04:51 2008 @@ -1214,6 +1214,7 @@ unsigned A = MI->getOperand(0).getReg(); unsigned B = MI->getOperand(1).getReg(); unsigned C = MI->getOperand(2).getReg(); + bool AisDead = MI->getOperand(0).isDead(); bool BisKill = MI->getOperand(1).isKill(); bool CisKill = MI->getOperand(2).isKill(); // If machine instrs are no longer in two-address forms, update @@ -1225,7 +1226,8 @@ A = C; CisKill = false; } - return BuildMI(get(Opc), A).addReg(C, false, false, CisKill) + return BuildMI(get(Opc)).addReg(A, true, false, false, AisDead) + .addReg(C, false, false, CisKill) .addReg(B, false, false, BisKill).addImm(Size-Amt); } case X86::CMOVB16rr: From evan.cheng at apple.com Wed Jul 2 19:07:20 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 03 Jul 2008 00:07:20 -0000 Subject: [llvm-commits] [llvm] r53061 - in /llvm/trunk: include/llvm/CodeGen/LiveVariables.h lib/CodeGen/LiveVariables.cpp lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200807030007.m6307KxA032605@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jul 2 19:07:19 2008 New Revision: 53061 URL: http://llvm.org/viewvc/llvm-project?rev=53061&view=rev Log: - Add LiveVariables::replaceKillInstruction. This does a subset of instructionChanged. That is, it only update the VarInfo.kills if the new instruction is known to have the correct dead and kill markers. - CommuteInstruction copies kill / dead markers over to new instruction. So use replaceKillInstruction instead. Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h llvm/trunk/lib/CodeGen/LiveVariables.cpp llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveVariables.h?rev=53061&r1=53060&r2=53061&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveVariables.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveVariables.h Wed Jul 2 19:07:19 2008 @@ -189,6 +189,11 @@ /// the records for NewMI. void instructionChanged(MachineInstr *OldMI, MachineInstr *NewMI); + /// replaceKillInstruction - Update register kill info by replacing a kill + /// instruction with a new one. + void replaceKillInstruction(unsigned Reg, MachineInstr *OldMI, + MachineInstr *NewMI); + /// addVirtualRegisterKilled - Add information about the fact that the /// specified register is killed after being used by the specified /// instruction. If AddIfNotFound is true, add a implicit operand if it's Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=53061&r1=53060&r2=53061&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Wed Jul 2 19:07:19 2008 @@ -684,6 +684,15 @@ } } +/// replaceKillInstruction - Update register kill info by replacing a kill +/// instruction with a new one. +void LiveVariables::replaceKillInstruction(unsigned Reg, MachineInstr *OldMI, + MachineInstr *NewMI) { + VarInfo &VI = getVarInfo(Reg); + if (VI.removeKill(OldMI)) + VI.Kills.push_back(NewMI); // Yes, there was a kill of it +} + /// removeVirtualRegistersKilled - Remove all killed info for the specified /// instruction. void LiveVariables::removeVirtualRegistersKilled(MachineInstr *MI) { Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=53061&r1=53060&r2=53061&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Wed Jul 2 19:07:19 2008 @@ -375,10 +375,9 @@ DOUT << "2addr: COMMUTED TO: " << *NewMI; // If the instruction changed to commute it, update livevar. if (NewMI != mi) { - if (LV) { + if (LV) // Update live variables - LV->instructionChanged(mi, NewMI); - } + LV->replaceKillInstruction(regC, mi, NewMI); mbbi->insert(mi, NewMI); // Insert the new inst mbbi->erase(mi); // Nuke the old inst. From dpatel at apple.com Wed Jul 2 19:08:13 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 03 Jul 2008 00:08:13 -0000 Subject: [llvm-commits] [llvm] r53062 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200807030008.m6308D95032658@zion.cs.uiuc.edu> Author: dpatel Date: Wed Jul 2 19:08:13 2008 New Revision: 53062 URL: http://llvm.org/viewvc/llvm-project?rev=53062&view=rev Log: Undo previous patch. It is not that simple to fix dom info here. 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=53062&r1=53061&r2=53062&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Jul 2 19:08:13 2008 @@ -1204,32 +1204,18 @@ // trying to update it is complicated. So instead we preserve the // loop structure and put the block on an dead code path. - BasicBlock *SISucc = SI->getSuccessor(i); BasicBlock* Old = SI->getParent(); BasicBlock* Split = SplitBlock(Old, SI, this); Instruction* OldTerm = Old->getTerminator(); - BranchInst::Create(Split, SISucc, + BranchInst::Create(Split, SI->getSuccessor(i), ConstantInt::getTrue(), OldTerm); - if (DT) { - // Now, SISucc is dominated by Old. - DT->changeImmediateDominator(SISucc, Old); - if (DF) { - // Now, Split does not dominate SISucc. - // SISucc is the only member in Split's DF. - DominanceFrontier::iterator S_DFI = DF->find(Split); - if (S_DFI != DF->end()) - S_DFI->second.clear(); - addBBToDomFrontier(*DF, S_DFI, Split, SISucc); - } - } - LPM->deleteSimpleAnalysisValue(Old->getTerminator(), L); Old->getTerminator()->eraseFromParent(); PHINode *PN; - for (BasicBlock::iterator II = SISucc->begin(); + for (BasicBlock::iterator II = SI->getSuccessor(i)->begin(); (PN = dyn_cast(II)); ++II) { Value *InVal = PN->removeIncomingValue(Split, false); PN->addIncoming(InVal, Old); From evan.cheng at apple.com Wed Jul 2 19:28:27 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 03 Jul 2008 00:28:27 -0000 Subject: [llvm-commits] [llvm] r53063 - /llvm/trunk/lib/CodeGen/LiveVariables.cpp Message-ID: <200807030028.m630SRUh000799@zion.cs.uiuc.edu> Author: evancheng Date: Wed Jul 2 19:28:27 2008 New Revision: 53063 URL: http://llvm.org/viewvc/llvm-project?rev=53063&view=rev Log: Use std::replace instead of std::find and push_back. Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=53063&r1=53062&r2=53063&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Wed Jul 2 19:28:27 2008 @@ -689,8 +689,7 @@ void LiveVariables::replaceKillInstruction(unsigned Reg, MachineInstr *OldMI, MachineInstr *NewMI) { VarInfo &VI = getVarInfo(Reg); - if (VI.removeKill(OldMI)) - VI.Kills.push_back(NewMI); // Yes, there was a kill of it + std::replace(VI.Kills.begin(), VI.Kills.end(), OldMI, NewMI); } /// removeVirtualRegistersKilled - Remove all killed info for the specified From gohman at apple.com Wed Jul 2 19:51:05 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 03 Jul 2008 00:51:05 -0000 Subject: [llvm-commits] [llvm] r53064 - /llvm/trunk/lib/ExecutionEngine/JIT/JIT.h Message-ID: <200807030051.m630p51R001377@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 2 19:51:05 2008 New Revision: 53064 URL: http://llvm.org/viewvc/llvm-project?rev=53064&view=rev Log: Correct a comment. Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.h Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.h?rev=53064&r1=53063&r2=53064&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/JIT/JIT.h (original) +++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.h Wed Jul 2 19:51:05 2008 @@ -80,7 +80,7 @@ virtual Module *removeModuleProvider(ModuleProvider *MP, std::string *ErrInfo = 0); - /// run - Start execution with the specified function and arguments. + /// runFunction - Start execution with the specified function and arguments. /// virtual GenericValue runFunction(Function *F, const std::vector &ArgValues); From gohman at apple.com Wed Jul 2 19:52:03 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 03 Jul 2008 00:52:03 -0000 Subject: [llvm-commits] [llvm] r53065 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200807030052.m630q3wv001418@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 2 19:52:03 2008 New Revision: 53065 URL: http://llvm.org/viewvc/llvm-project?rev=53065&view=rev Log: Avoid unnecessarily copying APInt objects. 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=53065&r1=53064&r2=53065&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jul 2 19:52:03 2008 @@ -1601,7 +1601,7 @@ } case ISD::SREM: if (ConstantSDNode *Rem = dyn_cast(Op.getOperand(1))) { - APInt RA = Rem->getAPIntValue(); + const APInt &RA = Rem->getAPIntValue(); if (RA.isPowerOf2() || (-RA).isPowerOf2()) { APInt LowBits = RA.isStrictlyPositive() ? (RA - 1) : ~RA; APInt Mask2 = LowBits | APInt::getSignBit(BitWidth); @@ -1623,7 +1623,7 @@ return; case ISD::UREM: { if (ConstantSDNode *Rem = dyn_cast(Op.getOperand(1))) { - APInt RA = Rem->getAPIntValue(); + const APInt &RA = Rem->getAPIntValue(); if (RA.isPowerOf2()) { APInt LowBits = (RA - 1); APInt Mask2 = LowBits & Mask; @@ -2305,7 +2305,7 @@ if (N1C) { if (N2C) { - APInt C1 = N1C->getAPIntValue(), C2 = N2C->getAPIntValue(); + const APInt &C1 = N1C->getAPIntValue(), &C2 = N2C->getAPIntValue(); switch (Opcode) { case ISD::ADD: return getConstant(C1 + C2, VT); case ISD::SUB: return getConstant(C1 - C2, VT); From gohman at apple.com Wed Jul 2 19:53:09 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 03 Jul 2008 00:53:09 -0000 Subject: [llvm-commits] [llvm] r53066 - /llvm/trunk/lib/VMCore/Type.cpp Message-ID: <200807030053.m630r9EE001465@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 2 19:53:09 2008 New Revision: 53066 URL: http://llvm.org/viewvc/llvm-project?rev=53066&view=rev Log: Use operator new instead of new char[]. Modified: llvm/trunk/lib/VMCore/Type.cpp Modified: llvm/trunk/lib/VMCore/Type.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=53066&r1=53065&r2=53066&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Type.cpp (original) +++ llvm/trunk/lib/VMCore/Type.cpp Wed Jul 2 19:53:09 2008 @@ -90,7 +90,7 @@ // Finally, remove the memory as an array deallocation of the chars it was // constructed from. - delete [] reinterpret_cast(this); + operator delete(const_cast(this)); return; } @@ -1124,8 +1124,8 @@ if (FT) return FT; - FT = (FunctionType*) new char[sizeof(FunctionType) + - sizeof(PATypeHandle)*(Params.size()+1)]; + FT = (FunctionType*) operator new(sizeof(FunctionType) + + sizeof(PATypeHandle)*(Params.size()+1)); new (FT) FunctionType(ReturnType, Params, isVarArg); FunctionTypes->add(VT, FT); @@ -1266,8 +1266,8 @@ if (ST) return ST; // Value not found. Derive a new type! - ST = (StructType*) new char[sizeof(StructType) + - sizeof(PATypeHandle) * ETypes.size()]; + ST = (StructType*) operator new(sizeof(StructType) + + sizeof(PATypeHandle) * ETypes.size()); new (ST) StructType(ETypes, isPacked); StructTypes->add(STV, ST); From gohman at apple.com Wed Jul 2 19:59:36 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 03 Jul 2008 00:59:36 -0000 Subject: [llvm-commits] [llvm] r53067 - /llvm/trunk/include/llvm/ADT/DenseMap.h Message-ID: <200807030059.m630xbN3001696@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 2 19:59:36 2008 New Revision: 53067 URL: http://llvm.org/viewvc/llvm-project?rev=53067&view=rev Log: Use operator new instead of new char[]. 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=53067&r1=53066&r2=53067&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DenseMap.h (original) +++ llvm/trunk/include/llvm/ADT/DenseMap.h Wed Jul 2 19:59:36 2008 @@ -82,7 +82,7 @@ P->second.~ValueT(); P->first.~KeyT(); } - delete[] reinterpret_cast(Buckets); + operator delete(Buckets); } typedef DenseMapIterator iterator; @@ -210,9 +210,9 @@ NumTombstones = other.NumTombstones; if (NumBuckets) - delete[] reinterpret_cast(Buckets); - Buckets = reinterpret_cast(new char[sizeof(BucketT) * - other.NumBuckets]); + operator delete(Buckets); + Buckets = static_cast(operator new(sizeof(BucketT) * + other.NumBuckets)); if (KeyInfoT::isPod() && ValueInfoT::isPod()) memcpy(Buckets, other.Buckets, other.NumBuckets * sizeof(BucketT)); @@ -315,7 +315,7 @@ NumBuckets = InitBuckets; assert(InitBuckets && (InitBuckets & (InitBuckets-1)) == 0 && "# initial buckets must be a power of two!"); - Buckets = reinterpret_cast(new char[sizeof(BucketT)*InitBuckets]); + Buckets = static_cast(operator new(sizeof(BucketT)*InitBuckets)); // Initialize all the keys to EmptyKey. const KeyT EmptyKey = getEmptyKey(); for (unsigned i = 0; i != InitBuckets; ++i) @@ -330,7 +330,7 @@ while (NumBuckets <= AtLeast) NumBuckets <<= 1; NumTombstones = 0; - Buckets = reinterpret_cast(new char[sizeof(BucketT)*NumBuckets]); + Buckets = static_cast(operator new(sizeof(BucketT)*NumBuckets)); // Initialize all the keys to EmptyKey. const KeyT EmptyKey = getEmptyKey(); @@ -357,7 +357,7 @@ } // Free the old table. - delete[] reinterpret_cast(OldBuckets); + operator delete(OldBuckets); } void shrink_and_clear() { @@ -368,7 +368,7 @@ NumBuckets = NumEntries > 32 ? 1 << (Log2_32_Ceil(NumEntries) + 1) : 64; NumTombstones = 0; - Buckets = reinterpret_cast(new char[sizeof(BucketT)*NumBuckets]); + Buckets = static_cast(operator new(sizeof(BucketT)*NumBuckets)); // Initialize all the keys to EmptyKey. const KeyT EmptyKey = getEmptyKey(); @@ -387,7 +387,7 @@ } // Free the old table. - delete[] reinterpret_cast(OldBuckets); + operator delete(OldBuckets); NumEntries = 0; } From gohman at apple.com Wed Jul 2 20:18:51 2008 From: gohman at apple.com (Dan Gohman) Date: Thu, 03 Jul 2008 01:18:51 -0000 Subject: [llvm-commits] [llvm] r53068 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp Message-ID: <200807030118.m631IpDg002336@zion.cs.uiuc.edu> Author: djg Date: Wed Jul 2 20:18:51 2008 New Revision: 53068 URL: http://llvm.org/viewvc/llvm-project?rev=53068&view=rev Log: Reapply r52988, "Simplify addRegisterKilled and addRegisterDead." The 254.gap failure was not due to this mod. Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=53068&r1=53067&r2=53068&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Wed Jul 2 20:18:51 2008 @@ -738,7 +738,7 @@ const TargetRegisterInfo *RegInfo, bool AddIfNotFound) { bool isPhysReg = TargetRegisterInfo::isPhysicalRegister(IncomingReg); - bool Found = false; + bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); SmallVector DeadOps; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); @@ -749,15 +749,15 @@ continue; if (Reg == IncomingReg) { - if (!Found) // One kill of reg per instruction. - MO.setIsKill(); - Found = true; - } else if (isPhysReg && MO.isKill() && - TargetRegisterInfo::isPhysicalRegister(Reg)) { + MO.setIsKill(); + return true; + } + if (hasAliases && MO.isKill() && + TargetRegisterInfo::isPhysicalRegister(Reg)) { // A super-register kill already exists. if (RegInfo->isSuperRegister(IncomingReg, Reg)) - Found = true; - else if (RegInfo->isSubRegister(IncomingReg, Reg)) + return true; + if (RegInfo->isSubRegister(IncomingReg, Reg)) DeadOps.push_back(i); } } @@ -774,14 +774,14 @@ // If not found, this means an alias of one of the operands is killed. Add a // new implicit operand if required. - if (!Found && AddIfNotFound) { + if (AddIfNotFound) { addOperand(MachineOperand::CreateReg(IncomingReg, false /*IsDef*/, true /*IsImp*/, true /*IsKill*/)); return true; } - return Found; + return false; } bool MachineInstr::addRegisterDead(unsigned IncomingReg, @@ -789,7 +789,6 @@ bool AddIfNotFound) { bool isPhysReg = TargetRegisterInfo::isPhysicalRegister(IncomingReg); bool hasAliases = isPhysReg && RegInfo->getAliasSet(IncomingReg); - bool Found = false; SmallVector DeadOps; for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { MachineOperand &MO = getOperand(i); @@ -798,13 +797,14 @@ unsigned Reg = MO.getReg(); if (Reg == IncomingReg) { MO.setIsDead(); - Found = true; - } else if (hasAliases && MO.isDead() && - TargetRegisterInfo::isPhysicalRegister(Reg)) { + return true; + } + if (hasAliases && MO.isDead() && + TargetRegisterInfo::isPhysicalRegister(Reg)) { // There exists a super-register that's marked dead. if (RegInfo->isSuperRegister(IncomingReg, Reg)) - Found = true; - else if (RegInfo->isSubRegister(IncomingReg, Reg)) + return true; + if (RegInfo->isSubRegister(IncomingReg, Reg)) DeadOps.push_back(i); } } @@ -821,13 +821,13 @@ // If not found, this means an alias of one of the operand is dead. Add a // new implicit operand. - if (!Found && AddIfNotFound) { + if (AddIfNotFound) { addOperand(MachineOperand::CreateReg(IncomingReg, true/*IsDef*/, true/*IsImp*/,false/*IsKill*/, true/*IsDead*/)); return true; } - return Found; + return false; } /// copyKillDeadInfo - copies killed/dead information from one instr to another From evan.cheng at apple.com Wed Jul 2 20:22:58 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 2 Jul 2008 18:22:58 -0700 Subject: [llvm-commits] [llvm] r53035 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> References: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> Message-ID: <3FFA1FED-6CE4-4669-8ABE-340E10AAD092@apple.com> Hi Duncan, test/CodeGen/PowerPC/vec_misaligned.ll is not crashing in the Legalizer. Can you check if your patch is the cause? Thanks, Evan On Jul 2, 2008, at 10:41 AM, Duncan Sands wrote: > Author: baldrick > Date: Wed Jul 2 12:40:58 2008 > New Revision: 53035 > > URL: http://llvm.org/viewvc/llvm-project?rev=53035&view=rev > Log: > Add a new getMergeValues method that does not need > to be passed the list of value types, and use this > where appropriate. Inappropriate places are where > the value type list is already known and may be > long, in which case the existing method is more > efficient. > > Modified: > llvm/trunk/include/llvm/CodeGen/SelectionDAG.h > llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp > llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp > llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp > llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp > llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > > Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=53035&r1=53034&r2=53035&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) > +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Wed Jul 2 > 12:40:58 2008 > @@ -381,8 +381,14 @@ > SDOperand Val, const Value* PtrVal, > unsigned Alignment = 0); > > + /// getMergeValues - Create a MERGE_VALUES node from the given > operands. > + /// Allowed to return something different (and simpler) if > Simplify is true. > + SDOperand getMergeValues(SDOperandPtr Ops, unsigned NumOps, > + bool Simplify = true); > + > /// getMergeValues - Create a MERGE_VALUES node from the given > types and ops. > /// Allowed to return something different (and simpler) if > Simplify is true. > + /// May be faster than the above version if VTs is known and > NumOps is large. > SDOperand getMergeValues(SDVTList VTs, SDOperandPtr Ops, unsigned > NumOps, > bool Simplify = true) { > if (Simplify && NumOps == 1) > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=53035&r1=53034&r2=53035&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Jul 2 > 12:40:58 2008 > @@ -652,7 +652,7 @@ > Result = DAG.getNode(ISD::FP_EXTEND, VT, Result); > > SDOperand Ops[] = { Result, Chain }; > - return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), Ops, 2); > + return DAG.getMergeValues(Ops, 2); > } > assert(LoadedVT.isInteger() && !LoadedVT.isVector() && > "Unaligned load of unsupported type."); > @@ -701,7 +701,7 @@ > Hi.getValue(1)); > > SDOperand Ops[] = { Result, TF }; > - return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), Ops, 2); > + return DAG.getMergeValues(Ops, 2); > } > > /// UnrollVectorOp - We know that the given vector has a legal type, > however > @@ -931,7 +931,7 @@ > // Fall Thru > case TargetLowering::Legal: { > SDOperand Ops[] = { DAG.getConstant(0, VT), Tmp1 }; > - Result = DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), > Ops, 2); > + Result = DAG.getMergeValues(Ops, 2); > break; > } > } > @@ -965,7 +965,7 @@ > // Fall Thru > case TargetLowering::Legal: { > SDOperand Ops[] = { DAG.getConstant(0, VT), Tmp2 }; > - Result = DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), > Ops, 2); > + Result = DAG.getMergeValues(Ops, 2); > break; > } > } > @@ -4728,16 +4728,15 @@ > } > > SDOperand Dummy; > - Tmp1 = ExpandLibCall(LC1, > - DAG.getNode(ISD::MERGE_VALUES, VT, LHS, > RHS).Val, > + SDOperand Ops[2] = { LHS, RHS }; > + Tmp1 = ExpandLibCall(LC1, DAG.getMergeValues(Ops, 2).Val, > false /*sign irrelevant*/, Dummy); > Tmp2 = DAG.getConstant(0, MVT::i32); > CC = DAG.getCondCode(TLI.getCmpLibcallCC(LC1)); > if (LC2 != RTLIB::UNKNOWN_LIBCALL) { > Tmp1 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(Tmp1), > Tmp1, Tmp2, > CC); > - LHS = ExpandLibCall(LC2, > - DAG.getNode(ISD::MERGE_VALUES, VT, LHS, > RHS).Val, > + LHS = ExpandLibCall(LC2, DAG.getMergeValues(Ops, 2).Val, > false /*sign irrelevant*/, Dummy); > Tmp2 = DAG.getNode(ISD::SETCC, TLI.getSetCCResultType(LHS), > LHS, Tmp2, > DAG.getCondCode(TLI.getCmpLibcallCC(LC2))); > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=53035&r1=53034&r2=53035&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Jul 2 > 12:40:58 2008 > @@ -3074,6 +3074,20 @@ > return SDOperand(N, 0); > } > > +/// getMergeValues - Create a MERGE_VALUES node from the given > operands. > +/// Allowed to return something different (and simpler) if Simplify > is true. > +SDOperand SelectionDAG::getMergeValues(SDOperandPtr Ops, unsigned > NumOps, > + bool Simplify) { > + if (Simplify && NumOps == 1) > + return Ops[0]; > + > + SmallVector VTs; > + VTs.reserve(NumOps); > + for (unsigned i = 0; i < NumOps; ++i) > + VTs.push_back(Ops[i].getValueType()); > + return getNode(ISD::MERGE_VALUES, getVTList(&VTs[0], NumOps), > Ops, NumOps); > +} > + > SDOperand > SelectionDAG::getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType > ExtType, > MVT VT, SDOperand Chain, > > Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=53035&r1=53034&r2=53035&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp > (original) > +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed > Jul 2 12:40:58 2008 > @@ -1158,17 +1158,13 @@ > > if (isa(C) || isa(C)) { > SmallVector Constants; > - SmallVector ValueVTs; > for (User::const_op_iterator OI = C->op_begin(), OE = C- > >op_end(); > OI != OE; ++OI) { > SDNode *Val = getValue(*OI).Val; > - for (unsigned i = 0, e = Val->getNumValues(); i != e; ++i) { > + for (unsigned i = 0, e = Val->getNumValues(); i != e; ++i) > Constants.push_back(SDOperand(Val, i)); > - ValueVTs.push_back(Val->getValueType(i)); > - } > } > - return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], > ValueVTs.size()), > - &Constants[0], Constants.size()); > + return DAG.getMergeValues(&Constants[0], Constants.size()); > } > > if (const ArrayType *ATy = dyn_cast(C->getType())) { > @@ -1179,7 +1175,6 @@ > return SDOperand(); // empty array > MVT EltVT = TLI.getValueType(ATy->getElementType()); > SmallVector Constants(NumElts); > - SmallVector ValueVTs(NumElts, EltVT); > for (unsigned i = 0, e = NumElts; i != e; ++i) { > if (isa(C)) > Constants[i] = DAG.getNode(ISD::UNDEF, EltVT); > @@ -1188,8 +1183,7 @@ > else > Constants[i] = DAG.getConstant(0, EltVT); > } > - return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], > ValueVTs.size()), > - &Constants[0], Constants.size()); > + return DAG.getMergeValues(&Constants[0], Constants.size()); > } > > if (const StructType *STy = dyn_cast(C->getType())) { > @@ -1199,10 +1193,8 @@ > if (NumElts == 0) > return SDOperand(); // empty struct > SmallVector Constants(NumElts); > - SmallVector ValueVTs(NumElts); > for (unsigned i = 0, e = NumElts; i != e; ++i) { > MVT EltVT = TLI.getValueType(STy->getElementType(i)); > - ValueVTs[i] = EltVT; > if (isa(C)) > Constants[i] = DAG.getNode(ISD::UNDEF, EltVT); > else if (EltVT.isFloatingPoint()) > @@ -1210,8 +1202,7 @@ > else > Constants[i] = DAG.getConstant(0, EltVT); > } > - return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], > ValueVTs.size()), > - &Constants[0], Constants.size()); > + return DAG.getMergeValues(&Constants[0], Constants.size()); > } > > const VectorType *VecTy = cast(V->getType()); > @@ -3771,10 +3762,7 @@ > ValueVT); > Part += NumRegs; > } > - > - if (ValueVTs.size() == 1) > - return Values[0]; > - > + > return DAG.getMergeValues(DAG.getVTList(&ValueVTs[0], > ValueVTs.size()), > &Values[0], ValueVTs.size()); > } > @@ -4944,13 +4932,7 @@ > ComputeValueVTs(TLI, AI->getType(), ValueVTs); > unsigned NumValues = ValueVTs.size(); > if (!AI->use_empty()) { > - SmallVector LegalValueVTs(NumValues); > - for (unsigned VI = 0; VI != NumValues; ++VI) > - LegalValueVTs[VI] = Args[a + VI].getValueType(); > - SDL.setValue(AI, > - > SDL.DAG.getMergeValues(SDL.DAG.getVTList(&LegalValueVTs[0], > - > NumValues), > - &Args[a], NumValues)); > + SDL.setValue(AI, SDL.DAG.getMergeValues(&Args[a], NumValues)); > // If this argument is live outside of the entry block, insert > a copy from > // whereever we got it to the vreg that other BB's will > reference it as. > DenseMap::iterator > VMI=FuncInfo.ValueMap.find(AI); > > Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=53035&r1=53034&r2=53035&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Jul 2 > 12:40:58 2008 > @@ -587,10 +587,6 @@ > InFlag = Chain.getValue(1); > } > > - std::vector NodeTys; > - NodeTys.push_back(MVT::Other); // Returns a chain > - NodeTys.push_back(MVT::Flag); // Returns a flag for retval > copy to use. > - > std::vector Ops; > Ops.push_back(Chain); > Ops.push_back(Callee); > @@ -603,7 +599,9 @@ > > if (InFlag.Val) > Ops.push_back(InFlag); > - Chain = DAG.getNode(CallOpc, NodeTys, &Ops[0], Ops.size()); > + // Returns a chain and a flag for retval copy to use. > + Chain = DAG.getNode(CallOpc, DAG.getVTList(MVT::Other, MVT::Flag), > + &Ops[0], Ops.size()); > InFlag = Chain.getValue(1); > > Chain = DAG.getCALLSEQ_END(Chain, > @@ -614,7 +612,6 @@ > InFlag = Chain.getValue(1); > > std::vector ResultVals; > - NodeTys.clear(); > > // If the call has results, copy the values out of the ret val > registers. > switch (RetVT.getSimpleVT()) { > @@ -629,33 +626,26 @@ > Chain = DAG.getCopyFromReg(Chain, ARM::R1, MVT::i32, > Chain.getValue(2)).getValue(1); > ResultVals.push_back(Chain.getValue(0)); > - NodeTys.push_back(MVT::i32); > } > - NodeTys.push_back(MVT::i32); > break; > case MVT::f32: > Chain = DAG.getCopyFromReg(Chain, ARM::R0, MVT::i32, > InFlag).getValue(1); > ResultVals.push_back(DAG.getNode(ISD::BIT_CONVERT, MVT::f32, > Chain.getValue(0))); > - NodeTys.push_back(MVT::f32); > break; > case MVT::f64: { > SDOperand Lo = DAG.getCopyFromReg(Chain, ARM::R0, MVT::i32, > InFlag); > SDOperand Hi = DAG.getCopyFromReg(Lo, ARM::R1, MVT::i32, > Lo.getValue(2)); > ResultVals.push_back(DAG.getNode(ARMISD::FMDRR, MVT::f64, Lo, > Hi)); > - NodeTys.push_back(MVT::f64); > break; > } > } > > - NodeTys.push_back(MVT::Other); > - > if (ResultVals.empty()) > return Chain; > > ResultVals.push_back(Chain); > - SDOperand Res = DAG.getMergeValues(DAG.getVTList(&NodeTys[0], > NodeTys.size()), > - &ResultVals[0], > ResultVals.size()); > + SDOperand Res = DAG.getMergeValues(&ResultVals[0], > ResultVals.size()); > return Res.getValue(Op.ResNo); > } > > > Modified: llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp?rev=53035&r1=53034&r2=53035&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/CellSPU/SPUISelLowering.cpp Wed Jul 2 > 12:40:58 2008 > @@ -1177,10 +1177,6 @@ > InFlag = Chain.getValue(1); > } > > - std::vector NodeTys; > - NodeTys.push_back(MVT::Other); // Returns a chain > - NodeTys.push_back(MVT::Flag); // Returns a flag for retval > copy to use. > - > SmallVector Ops; > unsigned CallOpc = SPUISD::CALL; > > @@ -1231,7 +1227,9 @@ > > if (InFlag.Val) > Ops.push_back(InFlag); > - Chain = DAG.getNode(CallOpc, NodeTys, &Ops[0], Ops.size()); > + // Returns a chain and a flag for retval copy to use. > + Chain = DAG.getNode(CallOpc, DAG.getVTList(MVT::Other, MVT::Flag), > + &Ops[0], Ops.size()); > InFlag = Chain.getValue(1); > > Chain = DAG.getCALLSEQ_END(Chain, > @@ -1243,7 +1241,6 @@ > > SDOperand ResultVals[3]; > unsigned NumResults = 0; > - NodeTys.clear(); > > // If the call has results, copy the values out of the ret val > registers. > switch (Op.Val->getValueType(0).getSimpleVT()) { > @@ -1257,19 +1254,16 @@ > Chain.getValue(2)).getValue(1); > ResultVals[1] = Chain.getValue(0); > NumResults = 2; > - NodeTys.push_back(MVT::i32); > } else { > Chain = DAG.getCopyFromReg(Chain, SPU::R3, MVT::i32, > InFlag).getValue(1); > ResultVals[0] = Chain.getValue(0); > NumResults = 1; > } > - NodeTys.push_back(MVT::i32); > break; > case MVT::i64: > Chain = DAG.getCopyFromReg(Chain, SPU::R3, MVT::i64, > InFlag).getValue(1); > ResultVals[0] = Chain.getValue(0); > NumResults = 1; > - NodeTys.push_back(MVT::i64); > break; > case MVT::f32: > case MVT::f64: > @@ -1277,7 +1271,6 @@ > InFlag).getValue(1); > ResultVals[0] = Chain.getValue(0); > NumResults = 1; > - NodeTys.push_back(Op.Val->getValueType(0)); > break; > case MVT::v2f64: > case MVT::v4f32: > @@ -1288,20 +1281,16 @@ > InFlag).getValue(1); > ResultVals[0] = Chain.getValue(0); > NumResults = 1; > - NodeTys.push_back(Op.Val->getValueType(0)); > break; > } > - > - NodeTys.push_back(MVT::Other); > - > + > // If the function returns void, just return the chain. > if (NumResults == 0) > return Chain; > > // Otherwise, merge everything together with a MERGE_VALUES node. > ResultVals[NumResults++] = Chain; > - SDOperand Res = DAG.getMergeValues(DAG.getVTList(&NodeTys[0], > NodeTys.size()), > - ResultVals, NumResults); > + SDOperand Res = DAG.getMergeValues(ResultVals, NumResults); > return Res.getValue(Op.ResNo); > } > > > Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=53035&r1=53034&r2=53035&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Wed Jul 2 > 12:40:58 2008 > @@ -2752,7 +2752,7 @@ > }; > SDOperand Store = DAG.getNode(PPCISD::STCX, MVT::Other, Ops2, 4); > SDOperand OutOps[] = { Load, Store }; > - return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), OutOps, > 2); > + return DAG.getMergeValues(OutOps, 2); > } > > SDOperand PPCTargetLowering::LowerAtomicCMP_SWAP(SDOperand Op, > SelectionDAG &DAG) { > @@ -2794,7 +2794,7 @@ > }; > SDOperand Store = DAG.getNode(PPCISD::STCX, MVT::Other, Ops3, 4); > SDOperand OutOps[] = { Load, Store }; > - return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), OutOps, > 2); > + return DAG.getMergeValues(OutOps, 2); > } > > SDOperand PPCTargetLowering::LowerAtomicSWAP(SDOperand Op, > SelectionDAG &DAG) { > @@ -2826,7 +2826,7 @@ > }; > SDOperand Store = DAG.getNode(PPCISD::STCX, MVT::Other, Ops2, 4); > SDOperand OutOps[] = { Load, Store }; > - return DAG.getMergeValues(DAG.getVTList(VT, MVT::Other), OutOps, > 2); > + return DAG.getMergeValues(OutOps, 2); > } > > /// LowerSELECT_CC - Lower floating point select_cc's into fsel > instruction when > @@ -3130,7 +3130,7 @@ > SDOperand OutHi = DAG.getNode(ISD::OR, VT, Tmp4, Tmp6); > SDOperand OutLo = DAG.getNode(PPCISD::SHL, VT, Lo, Amt); > SDOperand OutOps[] = { OutLo, OutHi }; > - return DAG.getMergeValues(DAG.getVTList(VT, VT), OutOps, 2); > + return DAG.getMergeValues(OutOps, 2); > } > > SDOperand PPCTargetLowering::LowerSRL_PARTS(SDOperand Op, > SelectionDAG &DAG) { > @@ -3158,7 +3158,7 @@ > SDOperand OutLo = DAG.getNode(ISD::OR, VT, Tmp4, Tmp6); > SDOperand OutHi = DAG.getNode(PPCISD::SRL, VT, Hi, Amt); > SDOperand OutOps[] = { OutLo, OutHi }; > - return DAG.getMergeValues(DAG.getVTList(VT, VT), OutOps, 2); > + return DAG.getMergeValues(OutOps, 2); > } > > SDOperand PPCTargetLowering::LowerSRA_PARTS(SDOperand Op, > SelectionDAG &DAG) { > @@ -3186,7 +3186,7 @@ > SDOperand OutLo = DAG.getSelectCC(Tmp5, DAG.getConstant(0, AmtVT), > Tmp4, Tmp6, ISD::SETLE); > SDOperand OutOps[] = { OutLo, OutHi }; > - return DAG.getMergeValues(DAG.getVTList(VT, VT), OutOps, 2); > + return DAG.getMergeValues(OutOps, 2); > } > > // > = > = > = > ----------------------------------------------------------------------= > ==// > > Modified: llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp?rev=53035&r1=53034&r2=53035&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/Sparc/SparcISelLowering.cpp Wed Jul 2 > 12:40:58 2008 > @@ -446,7 +446,7 @@ > } > > ResultVals.push_back(Chain); > - > + > // Merge everything together with a MERGE_VALUES node. > return DAG.getMergeValues(Op.Val->getVTList(), &ResultVals[0], > ResultVals.size()); > @@ -829,7 +829,7 @@ > DAG.getNode(ISD::BIT_CONVERT, MVT::f64, V), > V.getValue(1) > }; > - return DAG.getMergeValues(DAG.getVTList(MVT::f64, MVT::Other), > Ops, 2); > + return DAG.getMergeValues(Ops, 2); > } > > static SDOperand LowerDYNAMIC_STACKALLOC(SDOperand Op, SelectionDAG > &DAG) { > @@ -846,7 +846,7 @@ > SDOperand NewVal = DAG.getNode(ISD::ADD, MVT::i32, NewSP, > DAG.getConstant(96, MVT::i32)); > SDOperand Ops[2] = { NewVal, Chain }; > - return DAG.getMergeValues(DAG.getVTList(MVT::i32, MVT::Other), > Ops, 2); > + return DAG.getMergeValues(Ops, 2); > } > > > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=53035&r1=53034&r2=53035&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Jul 2 > 12:40:58 2008 > @@ -978,7 +978,7 @@ > > ResultVals.push_back(Val); > } > - > + > // Merge everything together with a MERGE_VALUES node. > ResultVals.push_back(Chain); > return DAG.getMergeValues(TheCall->getVTList(), &ResultVals[0], > @@ -4382,7 +4382,7 @@ > } > > SDOperand Ops[2] = { Lo, Hi }; > - return DAG.getMergeValues(DAG.getVTList(VT, VT), Ops, 2); > + return DAG.getMergeValues(Ops, 2); > } > > SDOperand X86TargetLowering::LowerSINT_TO_FP(SDOperand Op, > SelectionDAG &DAG) { > @@ -4516,9 +4516,10 @@ > // Return a load from the stack slot. > SDOperand Res = DAG.getLoad(VT, FIST, StackSlot, NULL, 0); > > - // Use a MERGE_VALUES node to drop the chain result value. > - return DAG.getMergeValues(DAG.getVTList(VT), &Res, 1, > - false /* Require a node with one-result > */).Val; > + // Use MERGE_VALUES to drop the chain result value and get a node > with one > + // result. This requires turning off getMergeValues > simplification, since > + // otherwise it will give us Res back. > + return DAG.getMergeValues(&Res, 1, false).Val; > } > > SDOperand X86TargetLowering::LowerFABS(SDOperand Op, SelectionDAG > &DAG) { > @@ -4816,7 +4817,7 @@ > Chain = DAG.getCopyFromReg(Chain, X86StackPtr, SPTy).getValue(1); > > SDOperand Ops1[2] = { Chain.getValue(0), Chain }; > - return DAG.getMergeValues(DAG.getVTList(SPTy, MVT::Other), Ops1, > 2); > + return DAG.getMergeValues(Ops1, 2); > } > > SDOperand > @@ -5047,8 +5048,7 @@ > DAG.getNode(ISD::OR, MVT::i64, rax, Tmp), rdx.getValue(1) > }; > > - Tys = DAG.getVTList(MVT::i64, MVT::Other); > - return DAG.getMergeValues(Tys, Ops, 2).Val; > + return DAG.getMergeValues(Ops, 2).Val; > } > > SDOperand eax = DAG.getCopyFromReg(rd, X86::EAX, MVT::i32, > rd.getValue(1)); > @@ -5060,7 +5060,7 @@ > > // Use a MERGE_VALUES to return the value and chain. > Ops[1] = edx.getValue(1); > - return DAG.getMergeValues(DAG.getVTList(MVT::i64, MVT::Other), > Ops, 2).Val; > + return DAG.getMergeValues(Ops, 2).Val; > } > > SDOperand X86TargetLowering::LowerVASTART(SDOperand Op, SelectionDAG > &DAG) { > @@ -5441,7 +5441,7 @@ > > SDOperand Ops[] = > { Trmp, DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains, > 6) }; > - return DAG.getMergeValues(Op.Val->getVTList(), Ops, 2); > + return DAG.getMergeValues(Ops, 2); > } else { > const Function *Func = > cast(cast(Op.getOperand(5))- > >getValue()); > @@ -5509,7 +5509,7 @@ > > SDOperand Ops[] = > { Trmp, DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains, > 4) }; > - return DAG.getMergeValues(Op.Val->getVTList(), Ops, 2); > + return DAG.getMergeValues(Ops, 2); > } > } > > @@ -5697,7 +5697,7 @@ > SDOperand OpsF[] = { cpOutL.getValue(0), cpOutH.getValue(0)}; > SDOperand ResultVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, OpsF, > 2); > SDOperand Vals[2] = { ResultVal, cpOutH.getValue(1) }; > - return DAG.getMergeValues(DAG.getVTList(MVT::i64, MVT::Other), > Vals, 2).Val; > + return DAG.getMergeValues(Vals, 2).Val; > } > > SDNode* X86TargetLowering::ExpandATOMIC_LOAD_SUB(SDNode* Op, > SelectionDAG &DAG) { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Wed Jul 2 23:07:13 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 03 Jul 2008 04:07:13 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53073 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200807030407.m6347DMJ007493@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 2 23:07:13 2008 New Revision: 53073 URL: http://llvm.org/viewvc/llvm-project?rev=53073&view=rev Log: minor cleanups, no functionality change. 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=53073&r1=53072&r2=53073&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Jul 2 23:07:13 2008 @@ -84,7 +84,7 @@ // // LLVMValues is a vector of LLVM Values. GCC tree nodes keep track of LLVM // Values using this vector's index. It is easier to save and restore the index -// than the LLVM Value pointer while usig PCH. +// than the LLVM Value pointer while using PCH. // Collection of LLVM Values @@ -238,12 +238,14 @@ std::vector::reverse_iterator I, E; for (I = LLVMValues.rbegin(), E = LLVMValues.rend(); I != E; ++I) { - if (Value *V = *I) { - if (isa(V)) - break; - else - LLVMValuesMap.erase(V); - } + Value *V = *I; + if (V == 0) + continue; + + if (isa(V)) + break; + + LLVMValuesMap.erase(V); } LLVMValues.erase(I.base(), LLVMValues.end()); // Drop erased values From kremenek at apple.com Wed Jul 2 23:37:32 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 03 Jul 2008 04:37:32 -0000 Subject: [llvm-commits] [llvm] r53077 - /llvm/tags/checker/checker-53/ Message-ID: <200807030437.m634bW2Z008447@zion.cs.uiuc.edu> Author: kremenek Date: Wed Jul 2 23:37:31 2008 New Revision: 53077 URL: http://llvm.org/viewvc/llvm-project?rev=53077&view=rev Log: Tagging checker-53. Added: llvm/tags/checker/checker-53/ - copied from r53076, llvm/trunk/ From sabre at nondot.org Wed Jul 2 23:45:46 2008 From: sabre at nondot.org (Chris Lattner) Date: Thu, 03 Jul 2008 04:45:46 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53079 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200807030445.m634jkZl009083@zion.cs.uiuc.edu> Author: lattner Date: Wed Jul 2 23:45:46 2008 New Revision: 53079 URL: http://llvm.org/viewvc/llvm-project?rev=53079&view=rev Log: rewrite a chunk of the PCH related value mapping stuff, adding a new vector that just holds local values. This substantially speeds up the writeLLVMValues on large files. This speeds up: time ./cc1plus ~/instcombine.ii -O0 -o out2.bc -emit-llvm-bc -quiet From: 2.545u 0.187s 0:02.73 99.6% 0+0k 0+0io 0pf+0w To: 2.125u 0.204s 0:02.33 99.5% 0+0k 0+3io 0pf+0w .. which is about 18% faster. 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=53079&r1=53078&r2=53079&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Jul 2 23:45:46 2008 @@ -87,10 +87,12 @@ // than the LLVM Value pointer while using PCH. // Collection of LLVM Values - static std::vector LLVMValues; typedef DenseMap LLVMValuesMapTy; static LLVMValuesMapTy LLVMValuesMap; +/// LocalLLVMValueIDs - This is the set of local IDs we have in our mapping, +/// this allows us to efficiently identify and remove them. +static std::vector LocalLLVMValueIDs; // Remember the LLVM value for GCC tree node. void llvm_set_decl(tree Tr, Value *V) { @@ -110,10 +112,14 @@ return; } - unsigned Index = LLVMValues.size() + 1; LLVMValues.push_back(V); + unsigned Index = LLVMValues.size(); SET_DECL_LLVM_INDEX(Tr, Index); LLVMValuesMap[V] = Index; + + // Remember local values. + if (!isa(V)) + LocalLLVMValueIDs.push_back(Index); } // Return TRUE if there is a LLVM Value associate with GCC tree node. @@ -122,10 +128,7 @@ if (Index == 0) return false; - if (LLVMValues[Index - 1]) - return true; - - return false; + return LLVMValues[Index - 1] != 0; } // Get LLVM Value for the GCC tree node based on LLVMValues vector index. @@ -142,8 +145,8 @@ // If there was an error, we may have disabled creating LLVM values. if (Index == 0) return 0; } - assert ((Index - 1) < LLVMValues.size() && "Invalid LLVM value index"); - assert (LLVMValues[Index - 1] && "Trying to use deleted LLVM value!"); + assert((Index - 1) < LLVMValues.size() && "Invalid LLVM value index"); + assert(LLVMValues[Index - 1] && "Trying to use deleted LLVM value!"); return LLVMValues[Index - 1]; } @@ -151,6 +154,8 @@ /// changeLLVMValue - If Old exists in the LLVMValues map, rewrite it to New. /// At this point we know that New is not in the map. void changeLLVMValue(Value *Old, Value *New) { + assert(isa(Old) && isa(New) && + "Cannot change local values"); assert(!LLVMValuesMap.count(New) && "New cannot be in the map!"); // Find Old in the table. @@ -174,7 +179,6 @@ // Read LLVM Types string table void readLLVMValues() { - GlobalValue *V = TheModule->getNamedGlobal("llvm.pch.values"); if (!V) return; @@ -206,12 +210,10 @@ // Create a string table to hold these LLVM Values' names. This string // table will be used to recreate LTypes vector after loading PCH. void writeLLVMValues() { - if (LLVMValues.empty()) return; std::vector ValuesForPCH; - for (std::vector::iterator I = LLVMValues.begin(), E = LLVMValues.end(); I != E; ++I) { if (Constant *C = dyn_cast_or_null(*I)) @@ -234,33 +236,20 @@ /// eraseLocalLLVMValues - drop all non-global values from the LLVM values map. void eraseLocalLLVMValues() { - // Try to reduce the size of LLVMValues by removing local values from the end. - std::vector::reverse_iterator I, E; - - for (I = LLVMValues.rbegin(), E = LLVMValues.rend(); I != E; ++I) { - Value *V = *I; - if (V == 0) - continue; - - if (isa(V)) - break; - - LLVMValuesMap.erase(V); - } - - LLVMValues.erase(I.base(), LLVMValues.end()); // Drop erased values - - // Iterate over LLVMValuesMap since it may be much smaller than LLVMValues. - for (LLVMValuesMapTy::iterator I = LLVMValuesMap.begin(), - E = LLVMValuesMap.end(); I != E; ++I) { - assert(I->first && "Values map contains NULL!"); - if (!isa(I->first)) { - unsigned Index = I->second - 1; - assert(Index < LLVMValues.size() && LLVMValues[Index] == I->first && - "Inconsistent value map!"); - LLVMValues[Index] = NULL; - LLVMValuesMap.erase(I); + // Erase all the local values, these are stored in LocalLLVMValueIDs. + while (!LocalLLVMValueIDs.empty()) { + unsigned Idx = LocalLLVMValueIDs.back()-1; + LocalLLVMValueIDs.pop_back(); + + if (Value *V = LLVMValues[Idx]) { + assert(!isa(V) && "Found local value"); + LLVMValuesMap.erase(V); } + + if (Idx == LLVMValues.size()-1) + LLVMValues.pop_back(); + else + LLVMValues[Idx] = 0; } } @@ -271,7 +260,7 @@ /// "gimple_formal_tmp_reg". static bool isGimpleTemporary(tree decl) { return is_gimple_formal_tmp_reg(decl) && - !isAggregateTreeType(TREE_TYPE(decl)); + !isAggregateTreeType(TREE_TYPE(decl)); } /// isStructWithVarSizeArrayAtEnd - Return true if this StructType contains a From kremenek at apple.com Thu Jul 3 00:26:28 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 03 Jul 2008 05:26:28 -0000 Subject: [llvm-commits] [llvm] r53082 - /llvm/tags/checker/checker-54/ Message-ID: <200807030526.m635QSk6010531@zion.cs.uiuc.edu> Author: kremenek Date: Thu Jul 3 00:26:28 2008 New Revision: 53082 URL: http://llvm.org/viewvc/llvm-project?rev=53082&view=rev Log: Tagging checker-54. Added: llvm/tags/checker/checker-54/ - copied from r53081, llvm/trunk/ From dpatel at apple.com Thu Jul 3 00:55:03 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 03 Jul 2008 05:55:03 -0000 Subject: [llvm-commits] [llvm] r53085 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200807030555.m635t38V011468@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 3 00:55:03 2008 New Revision: 53085 URL: http://llvm.org/viewvc/llvm-project?rev=53085&view=rev Log: LoopUnswitch does not preserve dominator info in all cases. 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=53085&r1=53084&r2=53085&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Jul 3 00:55:03 2008 @@ -112,8 +112,9 @@ AU.addPreserved(); AU.addRequiredID(LCSSAID); AU.addPreservedID(LCSSAID); - AU.addPreserved(); - AU.addPreserved(); + // FIXME: Loop Unswitch does not preserve dominator info in all cases. + // AU.addPreserved(); + // AU.addPreserved(); } private: From clattner at apple.com Thu Jul 3 01:00:45 2008 From: clattner at apple.com (Chris Lattner) Date: Wed, 2 Jul 2008 23:00:45 -0700 Subject: [llvm-commits] [llvm] r53085 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp In-Reply-To: <200807030555.m635t38V011468@zion.cs.uiuc.edu> References: <200807030555.m635t38V011468@zion.cs.uiuc.edu> Message-ID: <1D3DA54A-B751-445A-AA74-1DD8D9CABE7C@apple.com> On Jul 2, 2008, at 10:55 PM, Devang Patel wrote: > Author: dpatel > Date: Thu Jul 3 00:55:03 2008 > New Revision: 53085 > > URL: http://llvm.org/viewvc/llvm-project?rev=53085&view=rev > Log: > LoopUnswitch does not preserve dominator info in all cases. Devang, In the short term, a horrible but "better than nothing" solution is for Unswitch to declare that it preserves domtree info... and have it call "recalculate" on the domtree analysis any time it actually unswitches a loop in a function. The advantage of this approach is that recalculation of domtree only happens if an unswitch happens. If you have: pass_a loopunswitch pass_b and all of them need dominfo, you will get: dominfo pass_a loopunswitch pass_b instead of: dominfo pass_a loopunswitch dominfo pass_b What do you think? -Chris > > > 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=53085&r1=53084&r2=53085&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Jul 3 > 00:55:03 2008 > @@ -112,8 +112,9 @@ > AU.addPreserved(); > AU.addRequiredID(LCSSAID); > AU.addPreservedID(LCSSAID); > - AU.addPreserved(); > - AU.addPreserved(); > + // FIXME: Loop Unswitch does not preserve dominator info in > all cases. > + // AU.addPreserved(); > + // AU.addPreserved(); > } > > private: > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dpatel at apple.com Thu Jul 3 01:47:26 2008 From: dpatel at apple.com (Devang Patel) Date: Wed, 2 Jul 2008 23:47:26 -0700 Subject: [llvm-commits] [llvm] r53085 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp In-Reply-To: <1D3DA54A-B751-445A-AA74-1DD8D9CABE7C@apple.com> References: <200807030555.m635t38V011468@zion.cs.uiuc.edu> <1D3DA54A-B751-445A-AA74-1DD8D9CABE7C@apple.com> Message-ID: <34246E15-2A3E-41A0-BF87-65F40869020D@apple.com> On Jul 2, 2008, at 11:00 PM, Chris Lattner wrote: > Devang, > > In the short term, a horrible but "better than nothing" solution is > for Unswitch to declare that it preserves domtree info... and have it > call "recalculate" on the domtree analysis any time it actually > unswitches a loop in a function. > > The advantage of this approach is that recalculation of domtree only > happens if an unswitch happens. If you have: > > pass_a > loopunswitch > pass_b > > and all of them need dominfo, you will get: > > dominfo > pass_a > loopunswitch > pass_b > > instead of: > > dominfo > pass_a > loopunswitch > dominfo > pass_b > > What do you think? good idea. Thanks! - Devang From dpatel at apple.com Thu Jul 3 01:48:22 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 03 Jul 2008 06:48:22 -0000 Subject: [llvm-commits] [llvm] r53086 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200807030648.m636mMhm013293@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 3 01:48:21 2008 New Revision: 53086 URL: http://llvm.org/viewvc/llvm-project?rev=53086&view=rev Log: Reconstruct dom info, if loop is unswitched. 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=53086&r1=53085&r2=53086&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Jul 3 01:48:21 2008 @@ -113,8 +113,8 @@ AU.addRequiredID(LCSSAID); AU.addPreservedID(LCSSAID); // FIXME: Loop Unswitch does not preserve dominator info in all cases. - // AU.addPreserved(); - // AU.addPreserved(); + AU.addPreserved(); + AU.addPreserved(); } private: @@ -206,7 +206,6 @@ DT = getAnalysisToUpdate(); currentLoop = L; bool Changed = false; - do { assert(currentLoop->isLCSSAForm()); redoLoop = false; @@ -459,7 +458,13 @@ } else { UnswitchNontrivialCondition(LoopCond, Val, currentLoop); } - + + // FIXME: Reconstruct dom info, because it is not preserved properly. + Function *F = loopHeader->getParent(); + if (DT) + DT->runOnFunction(*F); + if (DF) + DF->runOnFunction(*F); return true; } From dpatel at apple.com Thu Jul 3 01:50:05 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 03 Jul 2008 06:50:05 -0000 Subject: [llvm-commits] [llvm] r53087 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200807030650.m636o59H013402@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 3 01:50:04 2008 New Revision: 53087 URL: http://llvm.org/viewvc/llvm-project?rev=53087&view=rev Log: Remove extra FIXME 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=53087&r1=53086&r2=53087&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Jul 3 01:50:04 2008 @@ -112,7 +112,6 @@ AU.addPreserved(); AU.addRequiredID(LCSSAID); AU.addPreservedID(LCSSAID); - // FIXME: Loop Unswitch does not preserve dominator info in all cases. AU.addPreserved(); AU.addPreserved(); } From dpatel at apple.com Thu Jul 3 02:02:30 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 03 Jul 2008 07:02:30 -0000 Subject: [llvm-commits] [llvm] r53088 - /llvm/trunk/lib/Analysis/LoopPass.cpp Message-ID: <200807030702.m6372URo013869@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 3 02:02:30 2008 New Revision: 53088 URL: http://llvm.org/viewvc/llvm-project?rev=53088&view=rev Log: Keep track of inherited analysis (e.g. dominator tree). 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=53088&r1=53087&r2=53088&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/LoopPass.cpp (original) +++ llvm/trunk/lib/Analysis/LoopPass.cpp Thu Jul 3 02:02:30 2008 @@ -184,6 +184,9 @@ LI = &getAnalysis(); bool Changed = false; + // Collect inherited analysis from Module level pass manager. + populateInheritedAnalysis(TPM->activeStack); + // Populate Loop Queue for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) addLoopIntoQueue(*I, LQ); From dpatel at apple.com Thu Jul 3 02:04:22 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 03 Jul 2008 07:04:22 -0000 Subject: [llvm-commits] [llvm] r53089 - /llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp Message-ID: <200807030704.m6374MoG013958@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 3 02:04:22 2008 New Revision: 53089 URL: http://llvm.org/viewvc/llvm-project?rev=53089&view=rev Log: Preserve dom info. Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp?rev=53089&r1=53088&r2=53089&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnroll.cpp Thu Jul 3 02:04:22 2008 @@ -55,6 +55,12 @@ AU.addRequired(); AU.addPreservedID(LCSSAID); AU.addPreserved(); + // FIXME: Loop unroll requires LCSSA. And LCSSA requires dom info. + // If loop unroll does not preserve dom info then LCSSA pass on next + // loop will receive invalid dom info. + // For now, recreate dom info, if loop is unrolled. + AU.addPreserved(); + AU.addPreserved(); } }; } @@ -137,8 +143,17 @@ } // Unroll the loop. + Function *F = L->getHeader()->getParent(); if (!UnrollLoop(L, Count, LI, &LPM)) return false; + // FIXME: Reconstruct dom info, because it is not preserved properly. + DominatorTree *DT = getAnalysisToUpdate(); + if (DT) { + DT->runOnFunction(*F); + DominanceFrontier *DF = getAnalysisToUpdate(); + if (DF) + DF->runOnFunction(*F); + } return true; } From isanbard at gmail.com Thu Jul 3 02:10:03 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 03 Jul 2008 07:10:03 -0000 Subject: [llvm-commits] [llvm] r53090 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200807030710.m637A3k7014158@zion.cs.uiuc.edu> Author: void Date: Thu Jul 3 02:10:03 2008 New Revision: 53090 URL: http://llvm.org/viewvc/llvm-project?rev=53090&view=rev Log: Remove unused function. 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=53090&r1=53089&r2=53090&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Jul 3 02:10:03 2008 @@ -762,22 +762,6 @@ } -/// addBBToDomFrontier - Helper function. Insert DFBB in Basic Block BB's -/// dominance frontier using iterator DFI. -static void addBBToDomFrontier(DominanceFrontier &DF, - DominanceFrontier::iterator &DFI, - BasicBlock *BB, BasicBlock *DFBB) { - if (DFI != DF.end()) { - DF.addToFrontier(DFI, DFBB); - return; - } - - DominanceFrontier::DomSetType NSet; - NSet.insert(DFBB); - DF.addBasicBlock(BB, NSet); - DFI = DF.find(BB); -} - /// UnswitchNontrivialCondition - We determined that the loop is profitable /// to unswitch when LIC equal Val. Split it into loop versions and test the /// condition outside of either loop. Return the loops created as Out1/Out2. From asl at math.spbu.ru Thu Jul 3 02:43:14 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Thu, 03 Jul 2008 07:43:14 -0000 Subject: [llvm-commits] [llvm] r53091 - /llvm/trunk/lib/Target/X86/X86Subtarget.cpp Message-ID: <200807030743.m637hEvn019100@zion.cs.uiuc.edu> Author: asl Date: Thu Jul 3 02:43:14 2008 New Revision: 53091 URL: http://llvm.org/viewvc/llvm-project?rev=53091&view=rev Log: llvm-gcc sometimes marks external declarations hidden, because intializers are processed separately. Honour such situation and emit PIC relocations properly in such case. Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=53091&r1=53090&r2=53091&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Thu Jul 3 02:43:14 2008 @@ -47,7 +47,8 @@ // Extra load is needed for all externally visible. if (isDirectCall) return false; - if (GV->hasInternalLinkage() || GV->hasHiddenVisibility()) + if (GV->hasInternalLinkage() || + (GV->hasHiddenVisibility() && !GV->isDeclaration())) return false; return true; } else if (isTargetCygMing() || isTargetWindows()) { From matthijs at stdin.nl Thu Jul 3 02:46:42 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Thu, 03 Jul 2008 07:46:42 -0000 Subject: [llvm-commits] [llvm] r53092 - /llvm/trunk/lib/VMCore/Constants.cpp Message-ID: <200807030746.m637kgZC020731@zion.cs.uiuc.edu> Author: matthijs Date: Thu Jul 3 02:46:41 2008 New Revision: 53092 URL: http://llvm.org/viewvc/llvm-project?rev=53092&view=rev Log: Add newline at the end of Constants.cpp. Modified: llvm/trunk/lib/VMCore/Constants.cpp Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=53092&r1=53091&r2=53092&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Thu Jul 3 02:46:41 2008 @@ -2658,4 +2658,4 @@ // Delete the old constant! destroyConstant(); -} \ No newline at end of file +} From matthijs at stdin.nl Thu Jul 3 02:50:05 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Thu, 3 Jul 2008 09:50:05 +0200 Subject: [llvm-commits] [llvm] r53085 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp In-Reply-To: <1D3DA54A-B751-445A-AA74-1DD8D9CABE7C@apple.com> References: <200807030555.m635t38V011468@zion.cs.uiuc.edu> <1D3DA54A-B751-445A-AA74-1DD8D9CABE7C@apple.com> Message-ID: <20080703075005.GQ7287@katherina.student.utwente.nl> Hi Chris, > The advantage of this approach is that recalculation of domtree only > happens if an unswitch happens. If you have: On the other hand, it will then also happen if there are no other passes (directly) after loopunswitch that need dominfo...j -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080703/d0a5e6d2/attachment.bin From evan.cheng at apple.com Thu Jul 3 03:39:51 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 03 Jul 2008 08:39:51 -0000 Subject: [llvm-commits] [llvm] r53096 - /llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200807030839.m638dpp0027339@zion.cs.uiuc.edu> Author: evancheng Date: Thu Jul 3 03:39:51 2008 New Revision: 53096 URL: http://llvm.org/viewvc/llvm-project?rev=53096&view=rev Log: isel load folding is disabled at -fast. Now hoist the check up to the top level to save some time. 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=53096&r1=53095&r2=53096&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/DAGISelEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/DAGISelEmitter.cpp Thu Jul 3 03:39:51 2008 @@ -206,6 +206,28 @@ return false; } +static std::string getOpcodeName(Record *Op, CodeGenDAGPatterns &CGP) { + return CGP.getSDNodeInfo(Op).getEnumName(); +} + +static +bool DisablePatternForFastISel(TreePatternNode *N, CodeGenDAGPatterns &CGP) { + bool isStore = !N->isLeaf() && + getOpcodeName(N->getOperator(), CGP) == "ISD::STORE"; + if (!isStore && NodeHasProperty(N, SDNPHasChain, CGP)) + return false; + + bool HasChain = false; + for (unsigned i = 0, e = N->getNumChildren(); i != e; ++i) { + TreePatternNode *Child = N->getChild(i); + if (PatternHasProperty(Child, SDNPHasChain, CGP)) { + HasChain = true; + break; + } + } + return HasChain; +} + //===----------------------------------------------------------------------===// // Node Transformation emitter implementation. // @@ -404,6 +426,9 @@ // Record input varargs info. NumInputRootOps = N->getNumChildren(); + if (DisablePatternForFastISel(N, CGP)) + emitCheck("!FastISel"); + std::string PredicateCheck; for (unsigned i = 0, e = Predicates->getSize(); i != e; ++i) { if (DefInit *Pred = dynamic_cast(Predicates->getElement(i))) { @@ -480,10 +505,8 @@ // / [YY] // | ^ // [XX]-------| - bool NeedCheck = false; - if (P != Pattern) - NeedCheck = true; - else { + bool NeedCheck = P != Pattern; + if (!NeedCheck) { const SDNodeInfo &PInfo = CGP.getSDNodeInfo(P->getOperator()); NeedCheck = P->getOperator() == CGP.get_intrinsic_void_sdnode() || @@ -1548,10 +1571,6 @@ OS << std::string(Indent-2, ' ') << "}\n"; } -static std::string getOpcodeName(Record *Op, CodeGenDAGPatterns &CGP) { - return CGP.getSDNodeInfo(Op).getEnumName(); -} - static std::string getLegalCName(std::string OpName) { std::string::size_type pos = OpName.find("::"); if (pos != std::string::npos) From evan.cheng at apple.com Thu Jul 3 04:09:38 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 03 Jul 2008 09:09:38 -0000 Subject: [llvm-commits] [llvm] r53097 - in /llvm/trunk: include/llvm/CodeGen/ lib/CodeGen/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/CellSPU/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ Message-ID: <200807030909.m6399cCA028679@zion.cs.uiuc.edu> Author: evancheng Date: Thu Jul 3 04:09:37 2008 New Revision: 53097 URL: http://llvm.org/viewvc/llvm-project?rev=53097&view=rev Log: - Remove calls to copyKillDeadInfo which is an N^2 function. Instead, propagate kill / dead markers as new instructions are constructed in foldMemoryOperand, convertToThressAddress, etc. - Also remove LiveVariables::instructionChanged, etc. Replace all calls with cheaper calls which update VarInfo kill list. Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h llvm/trunk/include/llvm/CodeGen/MachineInstr.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/CodeGen/LiveVariables.cpp llvm/trunk/lib/CodeGen/MachineInstr.cpp llvm/trunk/lib/CodeGen/PHIElimination.cpp llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp llvm/trunk/lib/Target/X86/X86InstrBuilder.h llvm/trunk/lib/Target/X86/X86InstrInfo.cpp llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/LiveVariables.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveVariables.h?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/LiveVariables.h (original) +++ llvm/trunk/include/llvm/CodeGen/LiveVariables.h Thu Jul 3 04:09:37 2008 @@ -52,8 +52,7 @@ /// non-phi instructions that are the last users of the value. /// /// In the common case where a value is defined and killed in the same block, - /// DefInst is the defining inst, there is one killing instruction, and - /// AliveBlocks is empty. + /// There is one killing instruction, and AliveBlocks is empty. /// /// Otherwise, the value is live out of the block. If the value is live /// across any blocks, these blocks are listed in AliveBlocks. Blocks where @@ -68,16 +67,11 @@ /// but does include the predecessor block in the AliveBlocks set (unless that /// block also defines the value). This leads to the (perfectly sensical) /// situation where a value is defined in a block, and the last use is a phi - /// node in the successor. In this case, DefInst will be the defining - /// instruction, AliveBlocks is empty (the value is not live across any - /// blocks) and Kills is empty (phi nodes are not included). This is sensical - /// because the value must be live to the end of the block, but is not live in - /// any successor blocks. + /// node in the successor. In this case, AliveBlocks is empty (the value is + /// not live across any blocks) and Kills is empty (phi nodes are not + /// included). This is sensical because the value must be live to the end of + /// the block, but is not live in any successor blocks. struct VarInfo { - /// DefInst - The machine instruction that defines this register. - /// - MachineInstr *DefInst; - /// AliveBlocks - Set of blocks of which this value is alive completely /// through. This is a bit set which uses the basic block number as an /// index. @@ -97,7 +91,7 @@ /// std::vector Kills; - VarInfo() : DefInst(0), NumUses(0) {} + VarInfo() : NumUses(0) {} /// removeKill - Delete a kill corresponding to the specified /// machine instruction. Returns true if there was a kill @@ -183,12 +177,6 @@ //===--------------------------------------------------------------------===// // API to update live variable information - /// instructionChanged - When the address of an instruction changes, this - /// method should be called so that live variables can update its internal - /// data structures. This removes the records for OldMI, transfering them to - /// the records for NewMI. - void instructionChanged(MachineInstr *OldMI, MachineInstr *NewMI); - /// replaceKillInstruction - Update register kill info by replacing a kill /// instruction with a new one. void replaceKillInstruction(unsigned Reg, MachineInstr *OldMI, @@ -204,13 +192,11 @@ getVarInfo(IncomingReg).Kills.push_back(MI); } - /// removeVirtualRegisterKilled - Remove the specified virtual + /// removeVirtualRegisterKilled - Remove the specified kill of the virtual /// register from the live variable information. Returns true if the /// variable was marked as killed by the specified instruction, /// false otherwise. - bool removeVirtualRegisterKilled(unsigned reg, - MachineBasicBlock *MBB, - MachineInstr *MI) { + bool removeVirtualRegisterKilled(unsigned reg, MachineInstr *MI) { if (!getVarInfo(reg).removeKill(MI)) return false; @@ -238,16 +224,14 @@ void addVirtualRegisterDead(unsigned IncomingReg, MachineInstr *MI, bool AddIfNotFound = false) { if (MI->addRegisterDead(IncomingReg, TRI, AddIfNotFound)) - getVarInfo(IncomingReg).Kills.push_back(MI); + getVarInfo(IncomingReg).Kills.push_back(MI); } - /// removeVirtualRegisterDead - Remove the specified virtual + /// removeVirtualRegisterDead - Remove the specified kill of the virtual /// register from the live variable information. Returns true if the /// variable was marked dead at the specified instruction, false /// otherwise. - bool removeVirtualRegisterDead(unsigned reg, - MachineBasicBlock *MBB, - MachineInstr *MI) { + bool removeVirtualRegisterDead(unsigned reg, MachineInstr *MI) { if (!getVarInfo(reg).removeKill(MI)) return false; @@ -264,10 +248,6 @@ return true; } - /// removeVirtualRegistersDead - Remove all of the dead registers for the - /// specified instruction from the live variable information. - void removeVirtualRegistersDead(MachineInstr *MI); - virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Thu Jul 3 04:09:37 2008 @@ -234,13 +234,9 @@ bool addRegisterDead(unsigned IncomingReg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound = false); - /// copyKillDeadInfo - Copies killed/dead information from one instr to another - void copyKillDeadInfo(MachineInstr *OldMI, - const TargetRegisterInfo *RegInfo); - - /// isSafeToMove - Return true if it is safe to this instruction. If SawStore - /// true, it means there is a store (or call) between the instruction the - /// localtion and its intended destination. + /// isSafeToMove - Return true if it is safe to move this instruction. If + /// SawStore is set to true, it means that there is a store (or call) between + /// the instruction's location and its intended destination. bool isSafeToMove(const TargetInstrInfo *TII, bool &SawStore); // Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Thu Jul 3 04:09:37 2008 @@ -884,10 +884,6 @@ // Attempt to fold the memory reference into the instruction. If // we can do this, we don't need to insert spill code. - if (lv_) - lv_->instructionChanged(MI, fmi); - else - fmi->copyKillDeadInfo(MI, tri_); MachineBasicBlock &MBB = *MI->getParent(); if (isSS && !mf_->getFrameInfo()->isImmutableObjectIndex(Slot)) vrm.virtFolded(Reg, MI, fmi, (VirtRegMap::ModRef)MRInfo); @@ -1464,10 +1460,6 @@ addIntervalsForSpills(const LiveInterval &li, const MachineLoopInfo *loopInfo, VirtRegMap &vrm, float &SSWeight) { - // Since this is called after the analysis is done we don't know if - // LiveVariables is available - lv_ = getAnalysisToUpdate(); - assert(li.weight != HUGE_VALF && "attempt to spill already spilled interval!"); Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Thu Jul 3 04:09:37 2008 @@ -653,37 +653,6 @@ return false; } -/// instructionChanged - When the address of an instruction changes, this method -/// should be called so that live variables can update its internal data -/// structures. This removes the records for OldMI, transfering them to the -/// records for NewMI. -void LiveVariables::instructionChanged(MachineInstr *OldMI, - MachineInstr *NewMI) { - // If the instruction defines any virtual registers, update the VarInfo, - // kill and dead information for the instruction. - for (unsigned i = 0, e = OldMI->getNumOperands(); i != e; ++i) { - MachineOperand &MO = OldMI->getOperand(i); - if (MO.isRegister() && MO.getReg() && - TargetRegisterInfo::isVirtualRegister(MO.getReg())) { - unsigned Reg = MO.getReg(); - VarInfo &VI = getVarInfo(Reg); - if (MO.isDef()) { - if (MO.isDead()) { - MO.setIsDead(false); - addVirtualRegisterDead(Reg, NewMI); - } - } - if (MO.isKill()) { - MO.setIsKill(false); - addVirtualRegisterKilled(Reg, NewMI); - } - // If this is a kill of the value, update the VI kills list. - if (VI.removeKill(OldMI)) - VI.Kills.push_back(NewMI); // Yes, there was a kill of it - } - } -} - /// replaceKillInstruction - Update register kill info by replacing a kill /// instruction with a new one. void LiveVariables::replaceKillInstruction(unsigned Reg, MachineInstr *OldMI, @@ -708,22 +677,6 @@ } } -/// removeVirtualRegistersDead - Remove all of the dead registers for the -/// specified instruction from the live variable information. -void LiveVariables::removeVirtualRegistersDead(MachineInstr *MI) { - for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { - MachineOperand &MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDead()) { - MO.setIsDead(false); - unsigned Reg = MO.getReg(); - if (TargetRegisterInfo::isVirtualRegister(Reg)) { - bool removed = getVarInfo(Reg).removeKill(MI); - assert(removed && "kill not in register's VarInfo?"); - } - } - } -} - /// analyzePHINodes - Gather information about the PHI nodes in here. In /// particular, we want to map the variable information of a virtual register /// which is used in a PHI node. We map that to the BB the vreg is coming from. Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Jul 3 04:09:37 2008 @@ -647,9 +647,9 @@ } } -/// isSafeToMove - Return true if it is safe to this instruction. If SawStore is -/// set to true, it means that there is a store (or call) between the -/// instruction's location and its intended destination. +/// isSafeToMove - Return true if it is safe to move this instruction. If +/// SawStore is set to true, it means that there is a store (or call) between +/// the instruction's location and its intended destination. bool MachineInstr::isSafeToMove(const TargetInstrInfo *TII, bool &SawStore) { // Ignore stuff that we obviously can't move. if (TID->mayStore() || TID->isCall()) { @@ -829,27 +829,3 @@ } return false; } - -/// copyKillDeadInfo - copies killed/dead information from one instr to another -void MachineInstr::copyKillDeadInfo(MachineInstr *OldMI, - const TargetRegisterInfo *RegInfo) { - // If the instruction defines any virtual registers, update the VarInfo, - // kill and dead information for the instruction. - for (unsigned i = 0, e = OldMI->getNumOperands(); i != e; ++i) { - MachineOperand &MO = OldMI->getOperand(i); - if (MO.isRegister() && MO.getReg() && - TargetRegisterInfo::isVirtualRegister(MO.getReg())) { - unsigned Reg = MO.getReg(); - if (MO.isDef()) { - if (MO.isDead()) { - MO.setIsDead(false); - addRegisterDead(Reg, RegInfo); - } - } - if (MO.isKill()) { - MO.setIsKill(false); - addRegisterKilled(Reg, RegInfo); - } - } - } -} Modified: llvm/trunk/lib/CodeGen/PHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/PHIElimination.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/PHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/PHIElimination.cpp Thu Jul 3 04:09:37 2008 @@ -152,36 +152,44 @@ unsigned NumSrcs = (MPhi->getNumOperands() - 1) / 2; unsigned DestReg = MPhi->getOperand(0).getReg(); + bool isDead = MPhi->getOperand(0).isDead(); // Create a new register for the incoming PHI arguments. MachineFunction &MF = *MBB.getParent(); const TargetRegisterClass *RC = MF.getRegInfo().getRegClass(DestReg); - unsigned IncomingReg = MF.getRegInfo().createVirtualRegister(RC); + unsigned IncomingReg = 0; // Insert a register to register copy at the top of the current block (but // after any remaining phi nodes) which copies the new incoming register // into the phi node destination. const TargetInstrInfo *TII = MF.getTarget().getInstrInfo(); if (isSourceDefinedByImplicitDef(MPhi, MRI)) - // If all sources of a PHI node are implicit_def, just emit an implicit_def - // instead of a copy. - BuildMI(MBB, AfterPHIsIt, TII->get(TargetInstrInfo::IMPLICIT_DEF), DestReg); - else + // If all sources of a PHI node are implicit_def, just emit an + // implicit_def instead of a copy. + BuildMI(MBB, AfterPHIsIt, + TII->get(TargetInstrInfo::IMPLICIT_DEF), DestReg); + else { + IncomingReg = MF.getRegInfo().createVirtualRegister(RC); TII->copyRegToReg(MBB, AfterPHIsIt, DestReg, IncomingReg, RC, RC); + } // Update live variable information if there is any. LiveVariables *LV = getAnalysisToUpdate(); if (LV) { MachineInstr *PHICopy = prior(AfterPHIsIt); - // Increment use count of the newly created virtual register. - LV->getVarInfo(IncomingReg).NumUses++; + if (IncomingReg) { + // Increment use count of the newly created virtual register. + LV->getVarInfo(IncomingReg).NumUses++; + + // Add information to LiveVariables to know that the incoming value is + // killed. Note that because the value is defined in several places (once + // each for each incoming block), the "def" block and instruction fields + // for the VarInfo is not filled in. + LV->addVirtualRegisterKilled(IncomingReg, PHICopy); - // Add information to LiveVariables to know that the incoming value is - // killed. Note that because the value is defined in several places (once - // each for each incoming block), the "def" block and instruction fields for - // the VarInfo is not filled in. - LV->addVirtualRegisterKilled(IncomingReg, PHICopy); + LV->getVarInfo(IncomingReg).UsedBlocks[MBB.getNumber()] = true; + } // Since we are going to be deleting the PHI node, if it is the last use of // any registers, or if the value itself is dead, we need to move this @@ -189,12 +197,10 @@ LV->removeVirtualRegistersKilled(MPhi); // If the result is dead, update LV. - if (MPhi->registerDefIsDead(DestReg)) { + if (isDead) { LV->addVirtualRegisterDead(DestReg, PHICopy); - LV->removeVirtualRegistersDead(MPhi); + LV->removeVirtualRegisterDead(DestReg, MPhi); } - - LV->getVarInfo(IncomingReg).UsedBlocks[MBB.getNumber()] = true; } // Adjust the VRegPHIUseCount map to account for the removal of this PHI node. @@ -211,7 +217,7 @@ "Machine PHI Operands must all be virtual registers!"); // If source is defined by an implicit def, there is no need to insert a - // copy unless it's the only source. + // copy. MachineInstr *DefMI = MRI->getVRegDef(SrcReg); if (DefMI->getOpcode() == TargetInstrInfo::IMPLICIT_DEF) { ImpDefs.insert(DefMI); Modified: llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp (original) +++ llvm/trunk/lib/CodeGen/TwoAddressInstructionPass.cpp Thu Jul 3 04:09:37 2008 @@ -184,11 +184,8 @@ KillMO = MI->findRegisterUseOperand(SavedReg, false, TRI); KillMO->setIsKill(true); - if (LV) { - LiveVariables::VarInfo& VarInfo = LV->getVarInfo(SavedReg); - VarInfo.removeKill(KillMI); - VarInfo.Kills.push_back(MI); - } + if (LV) + LV->replaceKillInstruction(SavedReg, KillMI, MI); // Move instruction to its destination. MBB->remove(MI); @@ -454,10 +451,10 @@ // regB is used in this BB. varInfoB.UsedBlocks[mbbi->getNumber()] = true; - if (LV->removeVirtualRegisterKilled(regB, mbbi, mi)) + if (LV->removeVirtualRegisterKilled(regB, mi)) LV->addVirtualRegisterKilled(regB, prevMi); - if (LV->removeVirtualRegisterDead(regB, mbbi, mi)) + if (LV->removeVirtualRegisterDead(regB, mi)) LV->addVirtualRegisterDead(regB, prevMi); } Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.cpp Thu Jul 3 04:09:37 2008 @@ -677,30 +677,35 @@ unsigned PredReg = MI->getOperand(3).getReg(); if (OpNum == 0) { // move -> store unsigned SrcReg = MI->getOperand(1).getReg(); - NewMI = BuildMI(get(ARM::STR)).addReg(SrcReg).addFrameIndex(FI) - .addReg(0).addImm(0).addImm(Pred).addReg(PredReg); + bool isKill = MI->getOperand(1).isKill(); + NewMI = BuildMI(get(ARM::STR)).addReg(SrcReg, false, false, isKill) + .addFrameIndex(FI).addReg(0).addImm(0).addImm(Pred).addReg(PredReg); } else { // move -> load unsigned DstReg = MI->getOperand(0).getReg(); - NewMI = BuildMI(get(ARM::LDR), DstReg).addFrameIndex(FI).addReg(0) - .addImm(0).addImm(Pred).addReg(PredReg); + bool isDead = MI->getOperand(0).isDead(); + NewMI = BuildMI(get(ARM::LDR)).addReg(DstReg, true, false, false, isDead) + .addFrameIndex(FI).addReg(0).addImm(0).addImm(Pred).addReg(PredReg); } break; } case ARM::tMOVr: { if (OpNum == 0) { // move -> store unsigned SrcReg = MI->getOperand(1).getReg(); + bool isKill = MI->getOperand(1).isKill(); if (RI.isPhysicalRegister(SrcReg) && !RI.isLowRegister(SrcReg)) // tSpill cannot take a high register operand. break; - NewMI = BuildMI(get(ARM::tSpill)).addReg(SrcReg).addFrameIndex(FI) - .addImm(0); + NewMI = BuildMI(get(ARM::tSpill)).addReg(SrcReg, false, false, isKill) + .addFrameIndex(FI).addImm(0); } else { // move -> load unsigned DstReg = MI->getOperand(0).getReg(); if (RI.isPhysicalRegister(DstReg) && !RI.isLowRegister(DstReg)) // tRestore cannot target a high register operand. break; - NewMI = BuildMI(get(ARM::tRestore), DstReg).addFrameIndex(FI) - .addImm(0); + bool isDead = MI->getOperand(0).isDead(); + NewMI = BuildMI(get(ARM::tRestore)) + .addReg(DstReg, true, false, false, isDead) + .addFrameIndex(FI).addImm(0); } break; } @@ -723,19 +728,19 @@ unsigned PredReg = MI->getOperand(3).getReg(); if (OpNum == 0) { // move -> store unsigned SrcReg = MI->getOperand(1).getReg(); - NewMI = BuildMI(get(ARM::FSTD)).addReg(SrcReg).addFrameIndex(FI) - .addImm(0).addImm(Pred).addReg(PredReg); + bool isKill = MI->getOperand(1).isKill(); + NewMI = BuildMI(get(ARM::FSTD)).addReg(SrcReg, false, false, isKill) + .addFrameIndex(FI).addImm(0).addImm(Pred).addReg(PredReg); } else { // move -> load unsigned DstReg = MI->getOperand(0).getReg(); - NewMI = BuildMI(get(ARM::FLDD), DstReg).addFrameIndex(FI) - .addImm(0).addImm(Pred).addReg(PredReg); + bool isDead = MI->getOperand(0).isDead(); + NewMI = BuildMI(get(ARM::FLDD)).addReg(DstReg, true, false, false, isDead) + .addFrameIndex(FI).addImm(0).addImm(Pred).addReg(PredReg); } break; } } - if (NewMI) - NewMI->copyKillDeadInfo(MI); return NewMI; } Modified: llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.cpp Thu Jul 3 04:09:37 2008 @@ -269,23 +269,25 @@ if (MI->getOperand(1).getReg() == MI->getOperand(2).getReg()) { if (Ops[0] == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); + bool isKill = MI->getOperand(1).isKill(); Opc = (Opc == Alpha::BISr) ? Alpha::STQ : ((Opc == Alpha::CPYSS) ? Alpha::STS : Alpha::STT); - NewMI = BuildMI(get(Opc)).addReg(InReg).addFrameIndex(FrameIndex) + NewMI = BuildMI(get(Opc)).addReg(InReg, false, false, isKill) + .addFrameIndex(FrameIndex) .addReg(Alpha::F31); } else { // load -> move unsigned OutReg = MI->getOperand(0).getReg(); + bool isDead = MI->getOperand(0).isDead(); Opc = (Opc == Alpha::BISr) ? Alpha::LDQ : ((Opc == Alpha::CPYSS) ? Alpha::LDS : Alpha::LDT); - NewMI = BuildMI(get(Opc), OutReg).addFrameIndex(FrameIndex) + NewMI = BuildMI(get(Opc)).addReg(OutReg, true, false, false, isDead) + .addFrameIndex(FrameIndex) .addReg(Alpha::F31); } } break; } - if (NewMI) - NewMI->copyKillDeadInfo(MI); - return 0; + return NewMI; } static unsigned AlphaRevCondCode(unsigned Opcode) { Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.cpp Thu Jul 3 04:09:37 2008 @@ -412,20 +412,22 @@ && MI->getOperand(1).getReg() == MI->getOperand(2).getReg()) { if (OpNum == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); + bool isKill = MI->getOperand(1).isKill(); if (FrameIndex < SPUFrameInfo::maxFrameOffset()) { - NewMI = addFrameReference(BuildMI(TII.get(SPU::STQDr32)).addReg(InReg), + NewMI = addFrameReference(BuildMI(TII.get(SPU::STQDr32)) + .addReg(InReg, false, false, isKill), FrameIndex); } } else { // move -> load unsigned OutReg = MI->getOperand(0).getReg(); - Opc = (FrameIndex < SPUFrameInfo::maxFrameOffset()) ? SPU::STQDr32 : SPU::STQXr32; - NewMI = addFrameReference(BuildMI(TII.get(Opc), OutReg), FrameIndex); + bool isDead = MI->getOperand(0).isDead(); + Opc = (FrameIndex < SPUFrameInfo::maxFrameOffset()) + ? SPU::STQDr32 : SPU::STQXr32; + NewMI = addFrameReference(BuildMI(TII.get(Opc)) + .addReg(OutReg, true, false, false, isDead), FrameIndex); } } - if (NewMI) - NewMI->copyKillDeadInfo(MI); - return NewMI; #else return 0; Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp Thu Jul 3 04:09:37 2008 @@ -386,18 +386,22 @@ (MI->getOperand(1).getReg() == Mips::ZERO) && (MI->getOperand(2).isRegister())) { - if (Ops[0] == 0) // COPY -> STORE + if (Ops[0] == 0) { // COPY -> STORE + unsigned SrcReg = MI->getOperand(2).getReg(); + bool isKill = MI->getOperand(2).isKill(); NewMI = BuildMI(get(Mips::SW)).addFrameIndex(FI) - .addImm(0).addReg(MI->getOperand(2).getReg()); - else // COPY -> LOAD - NewMI = BuildMI(get(Mips::LW), MI->getOperand(0) - .getReg()).addImm(0).addFrameIndex(FI); + .addImm(0).addReg(SrcReg, false, false, isKill); + } else { // COPY -> LOAD + unsigned DstReg = MI->getOperand(0).getReg(); + bool isDead = MI->getOperand(0).isDead(); + NewMI = BuildMI(get(Mips::LW)) + .addReg(DstReg, true, false, false, isDead) + .addImm(0).addFrameIndex(FI); + } } break; } - if (NewMI) - NewMI->copyKillDeadInfo(MI); return NewMI; } Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp Thu Jul 3 04:09:37 2008 @@ -661,45 +661,62 @@ MI->getOperand(1).getReg() == MI->getOperand(2).getReg())) { if (OpNum == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); - NewMI = addFrameReference(BuildMI(get(PPC::STW)).addReg(InReg), + bool isKill = MI->getOperand(1).isKill(); + NewMI = addFrameReference(BuildMI(get(PPC::STW)) + .addReg(InReg, false, false, isKill), FrameIndex); } else { // move -> load unsigned OutReg = MI->getOperand(0).getReg(); - NewMI = addFrameReference(BuildMI(get(PPC::LWZ), OutReg), + bool isDead = MI->getOperand(0).isDead(); + NewMI = addFrameReference(BuildMI(get(PPC::LWZ)) + .addReg(OutReg, true, false, false, isDead), FrameIndex); } } else if ((Opc == PPC::OR8 && MI->getOperand(1).getReg() == MI->getOperand(2).getReg())) { if (OpNum == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); - NewMI = addFrameReference(BuildMI(get(PPC::STD)).addReg(InReg), + bool isKill = MI->getOperand(1).isKill(); + NewMI = addFrameReference(BuildMI(get(PPC::STD)) + .addReg(InReg, false, false, isKill), FrameIndex); } else { // move -> load unsigned OutReg = MI->getOperand(0).getReg(); - NewMI = addFrameReference(BuildMI(get(PPC::LD), OutReg), FrameIndex); + bool isDead = MI->getOperand(0).isDead(); + NewMI = addFrameReference(BuildMI(get(PPC::LD)) + .addReg(OutReg, true, false, false, isDead), + FrameIndex); } } else if (Opc == PPC::FMRD) { if (OpNum == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); - NewMI = addFrameReference(BuildMI(get(PPC::STFD)).addReg(InReg), + bool isKill = MI->getOperand(1).isKill(); + NewMI = addFrameReference(BuildMI(get(PPC::STFD)) + .addReg(InReg, false, false, isKill), FrameIndex); } else { // move -> load unsigned OutReg = MI->getOperand(0).getReg(); - NewMI = addFrameReference(BuildMI(get(PPC::LFD), OutReg), FrameIndex); + bool isDead = MI->getOperand(0).isDead(); + NewMI = addFrameReference(BuildMI(get(PPC::LFD)) + .addReg(OutReg, true, false, false, isDead), + FrameIndex); } } else if (Opc == PPC::FMRS) { if (OpNum == 0) { // move -> store unsigned InReg = MI->getOperand(1).getReg(); - NewMI = addFrameReference(BuildMI(get(PPC::STFS)).addReg(InReg), + bool isKill = MI->getOperand(1).isKill(); + NewMI = addFrameReference(BuildMI(get(PPC::STFS)) + .addReg(InReg, false, false, isKill), FrameIndex); } else { // move -> load unsigned OutReg = MI->getOperand(0).getReg(); - NewMI = addFrameReference(BuildMI(get(PPC::LFS), OutReg), FrameIndex); + bool isDead = MI->getOperand(0).isDead(); + NewMI = addFrameReference(BuildMI(get(PPC::LFS)) + .addReg(OutReg, true, false, false, isDead), + FrameIndex); } } - if (NewMI) - NewMI->copyKillDeadInfo(MI); return NewMI; } Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.cpp Thu Jul 3 04:09:37 2008 @@ -247,16 +247,19 @@ isFloat = true; // FALLTHROUGH case SP::FMOVD: - if (OpNum == 0) // COPY -> STORE + if (OpNum == 0) { // COPY -> STORE + unsigned SrcReg = MI->getOperand(1).getReg(); + bool isKill = MI->getOperand(1).isKill(); NewMI = BuildMI(get(isFloat ? SP::STFri : SP::STDFri)) - .addFrameIndex(FI).addImm(0).addReg(MI->getOperand(1).getReg()); - else // COPY -> LOAD - NewMI = BuildMI(get(isFloat ? SP::LDFri : SP::LDDFri), - MI->getOperand(0).getReg()).addFrameIndex(FI).addImm(0); + .addFrameIndex(FI).addImm(0).addReg(SrcReg, false, false, isKill); + } else { // COPY -> LOAD + unsigned DstReg = MI->getOperand(0).getReg(); + bool isDead = MI->getOperand(0).isDead(); + NewMI = BuildMI(get(isFloat ? SP::LDFri : SP::LDDFri)) + .addReg(DstReg, true, false, false, isDead).addFrameIndex(FI).addImm(0); + } break; } - if (NewMI) - NewMI->copyKillDeadInfo(MI); return NewMI; } Modified: llvm/trunk/lib/Target/X86/X86InstrBuilder.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrBuilder.h?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrBuilder.h (original) +++ llvm/trunk/lib/Target/X86/X86InstrBuilder.h Thu Jul 3 04:09:37 2008 @@ -70,15 +70,19 @@ /// displacement. An example is: DWORD PTR [EAX + 4]. /// inline const MachineInstrBuilder &addRegOffset(const MachineInstrBuilder &MIB, - unsigned Reg, int Offset) { - return MIB.addReg(Reg).addImm(1).addReg(0).addImm(Offset); + unsigned Reg, bool isKill, + int Offset) { + return MIB.addReg(Reg, false, false, isKill) + .addImm(1).addReg(0).addImm(Offset); } /// addRegReg - This function is used to add a memory reference of the form: /// [Reg + Reg]. inline const MachineInstrBuilder &addRegReg(const MachineInstrBuilder &MIB, - unsigned Reg1, unsigned Reg2) { - return MIB.addReg(Reg1).addImm(1).addReg(Reg2).addImm(0); + unsigned Reg1, bool isKill1, + unsigned Reg2, bool isKill2) { + return MIB.addReg(Reg1, false, false, isKill1).addImm(1) + .addReg(Reg2, false, false, isKill2).addImm(0); } inline const MachineInstrBuilder &addFullAddress(const MachineInstrBuilder &MIB, Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Thu Jul 3 04:09:37 2008 @@ -983,6 +983,8 @@ // All instructions input are two-addr instructions. Get the known operands. unsigned Dest = MI->getOperand(0).getReg(); unsigned Src = MI->getOperand(1).getReg(); + bool isDead = MI->getOperand(0).isDead(); + bool isKill = MI->getOperand(1).isKill(); MachineInstr *NewMI = NULL; // FIXME: 16-bit LEA's are really slow on Athlons, but not bad on P4's. When @@ -995,51 +997,47 @@ assert(MI->getNumOperands() == 4 && "Unknown shufps instruction!"); if (!TM.getSubtarget().hasSSE2()) return 0; - unsigned A = MI->getOperand(0).getReg(); unsigned B = MI->getOperand(1).getReg(); unsigned C = MI->getOperand(2).getReg(); - unsigned M = MI->getOperand(3).getImm(); if (B != C) return 0; - NewMI = BuildMI(get(X86::PSHUFDri), A).addReg(B).addImm(M); + unsigned A = MI->getOperand(0).getReg(); + unsigned M = MI->getOperand(3).getImm(); + NewMI = BuildMI(get(X86::PSHUFDri)).addReg(A, true, false, false, isDead) + .addReg(B, false, false, isKill).addImm(M); break; } case X86::SHL64ri: { assert(MI->getNumOperands() >= 3 && "Unknown shift instruction!"); // NOTE: LEA doesn't produce flags like shift does, but LLVM never uses // the flags produced by a shift yet, so this is safe. - unsigned Dest = MI->getOperand(0).getReg(); - unsigned Src = MI->getOperand(1).getReg(); unsigned ShAmt = MI->getOperand(2).getImm(); if (ShAmt == 0 || ShAmt >= 4) return 0; - - NewMI = BuildMI(get(X86::LEA64r), Dest) - .addReg(0).addImm(1 << ShAmt).addReg(Src).addImm(0); + + NewMI = BuildMI(get(X86::LEA64r)).addReg(Dest, true, false, false, isDead) + .addReg(0).addImm(1 << ShAmt).addReg(Src, false, false, isKill).addImm(0); break; } case X86::SHL32ri: { assert(MI->getNumOperands() >= 3 && "Unknown shift instruction!"); // NOTE: LEA doesn't produce flags like shift does, but LLVM never uses // the flags produced by a shift yet, so this is safe. - unsigned Dest = MI->getOperand(0).getReg(); - unsigned Src = MI->getOperand(1).getReg(); unsigned ShAmt = MI->getOperand(2).getImm(); if (ShAmt == 0 || ShAmt >= 4) return 0; - + unsigned Opc = TM.getSubtarget().is64Bit() ? X86::LEA64_32r : X86::LEA32r; - NewMI = BuildMI(get(Opc), Dest) - .addReg(0).addImm(1 << ShAmt).addReg(Src).addImm(0); + NewMI = BuildMI(get(Opc)).addReg(Dest, true, false, false, isDead) + .addReg(0).addImm(1 << ShAmt) + .addReg(Src, false, false, isKill).addImm(0); break; } case X86::SHL16ri: { assert(MI->getNumOperands() >= 3 && "Unknown shift instruction!"); // NOTE: LEA doesn't produce flags like shift does, but LLVM never uses // the flags produced by a shift yet, so this is safe. - unsigned Dest = MI->getOperand(0).getReg(); - unsigned Src = MI->getOperand(1).getReg(); unsigned ShAmt = MI->getOperand(2).getImm(); if (ShAmt == 0 || ShAmt >= 4) return 0; - + if (DisableLEA16) { // If 16-bit LEA is disabled, use 32-bit LEA via subregisters. MachineRegisterInfo &RegInfo = MFI->getParent()->getRegInfo(); @@ -1050,33 +1048,36 @@ // Build and insert into an implicit UNDEF value. This is OK because // well be shifting and then extracting the lower 16-bits. - MachineInstr *Undef = BuildMI(get(X86::IMPLICIT_DEF), leaInReg); + MachineInstr *Undef = BuildMI(get(X86::IMPLICIT_DEF), leaInReg); + MachineInstr *InsMI = BuildMI(get(X86::INSERT_SUBREG),leaInReg) + .addReg(leaInReg).addReg(Src, false, false, isKill) + .addImm(X86::SUBREG_16BIT); - MachineInstr *Ins = - BuildMI(get(X86::INSERT_SUBREG),leaInReg) - .addReg(leaInReg).addReg(Src).addImm(X86::SUBREG_16BIT); + NewMI = BuildMI(get(Opc), leaOutReg).addReg(0).addImm(1 << ShAmt) + .addReg(leaInReg, false, false, true).addImm(0); - NewMI = BuildMI(get(Opc), leaOutReg) - .addReg(0).addImm(1 << ShAmt).addReg(leaInReg).addImm(0); - - MachineInstr *Ext = - BuildMI(get(X86::EXTRACT_SUBREG), Dest) - .addReg(leaOutReg).addImm(X86::SUBREG_16BIT); - Ext->copyKillDeadInfo(MI); + MachineInstr *ExtMI = BuildMI(get(X86::EXTRACT_SUBREG)) + .addReg(Dest, true, false, false, isDead) + .addReg(leaOutReg, false, false, true).addImm(X86::SUBREG_16BIT); MFI->insert(MBBI, Undef); - MFI->insert(MBBI, Ins); // Insert the insert_subreg + MFI->insert(MBBI, InsMI); // Insert the insert_subreg + MFI->insert(MBBI, NewMI); // Insert the lea inst + MFI->insert(MBBI, ExtMI); // Insert the extract_subreg if (LV) { - LV->instructionChanged(MI, NewMI); // Update live variables - LV->addVirtualRegisterKilled(leaInReg, NewMI); + // Update live variables + LV->getVarInfo(leaInReg).Kills.push_back(NewMI); + LV->getVarInfo(leaOutReg).Kills.push_back(ExtMI); + if (isKill) + LV->replaceKillInstruction(Src, MI, InsMI); + if (isDead) + LV->replaceKillInstruction(Dest, MI, ExtMI); } - MFI->insert(MBBI, NewMI); // Insert the new inst - if (LV) LV->addVirtualRegisterKilled(leaOutReg, Ext); - MFI->insert(MBBI, Ext); // Insert the extract_subreg - return Ext; + return ExtMI; } else { - NewMI = BuildMI(get(X86::LEA16r), Dest) - .addReg(0).addImm(1 << ShAmt).addReg(Src).addImm(0); + NewMI = BuildMI(get(X86::LEA16r)).addReg(Dest, true, false, false, isDead) + .addReg(0).addImm(1 << ShAmt) + .addReg(Src, false, false, isKill).addImm(0); } break; } @@ -1095,58 +1096,79 @@ assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!"); unsigned Opc = MIOpc == X86::INC64r ? X86::LEA64r : (is64Bit ? X86::LEA64_32r : X86::LEA32r); - NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, 1); + NewMI = addRegOffset(BuildMI(get(Opc)) + .addReg(Dest, true, false, false, isDead), + Src, isKill, 1); break; } case X86::INC16r: case X86::INC64_16r: if (DisableLEA16) return 0; assert(MI->getNumOperands() >= 2 && "Unknown inc instruction!"); - NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, 1); + NewMI = addRegOffset(BuildMI(get(X86::LEA16r)) + .addReg(Dest, true, false, false, isDead), + Src, isKill, 1); break; case X86::DEC64r: case X86::DEC32r: { assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!"); unsigned Opc = MIOpc == X86::DEC64r ? X86::LEA64r : (is64Bit ? X86::LEA64_32r : X86::LEA32r); - NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, -1); + NewMI = addRegOffset(BuildMI(get(Opc)) + .addReg(Dest, true, false, false, isDead), + Src, isKill, -1); break; } case X86::DEC16r: case X86::DEC64_16r: if (DisableLEA16) return 0; assert(MI->getNumOperands() >= 2 && "Unknown dec instruction!"); - NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, -1); + NewMI = addRegOffset(BuildMI(get(X86::LEA16r)) + .addReg(Dest, true, false, false, isDead), + Src, isKill, -1); break; case X86::ADD64rr: case X86::ADD32rr: { assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); unsigned Opc = MIOpc == X86::ADD64rr ? X86::LEA64r : (is64Bit ? X86::LEA64_32r : X86::LEA32r); - NewMI = addRegReg(BuildMI(get(Opc), Dest), Src, - MI->getOperand(2).getReg()); + unsigned Src2 = MI->getOperand(2).getReg(); + bool isKill2 = MI->getOperand(2).isKill(); + NewMI = addRegReg(BuildMI(get(Opc)) + .addReg(Dest, true, false, false, isDead), + Src, isKill, Src2, isKill2); + if (LV && isKill2) + LV->replaceKillInstruction(Src2, MI, NewMI); break; } - case X86::ADD16rr: + case X86::ADD16rr: { if (DisableLEA16) return 0; assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); - NewMI = addRegReg(BuildMI(get(X86::LEA16r), Dest), Src, - MI->getOperand(2).getReg()); + unsigned Src2 = MI->getOperand(2).getReg(); + bool isKill2 = MI->getOperand(2).isKill(); + NewMI = addRegReg(BuildMI(get(X86::LEA16r)) + .addReg(Dest, true, false, false, isDead), + Src, isKill, Src2, isKill2); + if (LV && isKill2) + LV->replaceKillInstruction(Src2, MI, NewMI); break; + } case X86::ADD64ri32: case X86::ADD64ri8: assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); if (MI->getOperand(2).isImmediate()) - NewMI = addRegOffset(BuildMI(get(X86::LEA64r), Dest), Src, - MI->getOperand(2).getImm()); + NewMI = addRegOffset(BuildMI(get(X86::LEA64r)) + .addReg(Dest, true, false, false, isDead), + Src, isKill, MI->getOperand(2).getImm()); break; case X86::ADD32ri: case X86::ADD32ri8: assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); if (MI->getOperand(2).isImmediate()) { unsigned Opc = is64Bit ? X86::LEA64_32r : X86::LEA32r; - NewMI = addRegOffset(BuildMI(get(Opc), Dest), Src, - MI->getOperand(2).getImm()); + NewMI = addRegOffset(BuildMI(get(Opc)) + .addReg(Dest, true, false, false, isDead), + Src, isKill, MI->getOperand(2).getImm()); } break; case X86::ADD16ri: @@ -1154,8 +1176,9 @@ if (DisableLEA16) return 0; assert(MI->getNumOperands() >= 3 && "Unknown add instruction!"); if (MI->getOperand(2).isImmediate()) - NewMI = addRegOffset(BuildMI(get(X86::LEA16r), Dest), Src, - MI->getOperand(2).getImm()); + NewMI = addRegOffset(BuildMI(get(X86::LEA16r)) + .addReg(Dest, true, false, false, isDead), + Src, isKill, MI->getOperand(2).getImm()); break; case X86::SHL16ri: if (DisableLEA16) return 0; @@ -1171,7 +1194,10 @@ unsigned Opc = MIOpc == X86::SHL64ri ? X86::LEA64r : (MIOpc == X86::SHL32ri ? (is64Bit ? X86::LEA64_32r : X86::LEA32r) : X86::LEA16r); - NewMI = addFullAddress(BuildMI(get(Opc), Dest), AM); + NewMI = addFullAddress(BuildMI(get(Opc)) + .addReg(Dest, true, false, false, isDead), AM); + if (isKill) + NewMI->getOperand(3).setIsKill(true); } break; } @@ -1181,8 +1207,13 @@ if (!NewMI) return 0; - NewMI->copyKillDeadInfo(MI); - if (LV) LV->instructionChanged(MI, NewMI); // Update live variables + if (LV) { // Update live variables + if (isKill) + LV->replaceKillInstruction(Src, MI, NewMI); + if (isDead) + LV->replaceKillInstruction(Dest, MI, NewMI); + } + MFI->insert(MBBI, NewMI); // Insert the new inst return NewMI; } @@ -1507,7 +1538,7 @@ MachineOperand &MO) { if (MO.isRegister()) MIB = MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit(), - false, false, MO.getSubReg()); + MO.isKill(), MO.isDead(), MO.getSubReg()); else if (MO.isImmediate()) MIB = MIB.addImm(MO.getImm()); else if (MO.isFrameIndex()) @@ -1769,8 +1800,8 @@ } void X86InstrInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl &Addr, - const TargetRegisterClass *RC, + SmallVectorImpl &Addr, + const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const { unsigned Opc = getLoadRegOpcode(RC, RI.getStackAlignment()); MachineInstrBuilder MIB = BuildMI(get(Opc), DestReg); @@ -1906,10 +1937,8 @@ NewMI = MakeM0Inst(*this, X86::MOV64mi32, MOs, MI); else if (MI->getOpcode() == X86::MOV8r0) NewMI = MakeM0Inst(*this, X86::MOV8mi, MOs, MI); - if (NewMI) { - NewMI->copyKillDeadInfo(MI); + if (NewMI) return NewMI; - } OpcodeTablePtr = &RegOp2MemOpTable0; } else if (i == 1) { @@ -1928,7 +1957,6 @@ NewMI = FuseTwoAddrInst(I->second, MOs, MI, *this); else NewMI = FuseInst(I->second, i, MOs, MI, *this); - NewMI->copyKillDeadInfo(MI); return NewMI; } } Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=53097&r1=53096&r2=53097&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Thu Jul 3 04:09:37 2008 @@ -750,7 +750,7 @@ .addExternalSymbol("_alloca"); // Restore EAX MachineInstr *MI = addRegOffset(BuildMI(TII.get(X86::MOV32rm),X86::EAX), - StackPtr, NumBytes-4); + StackPtr, false, NumBytes-4); MBB.insert(MBBI, MI); } } else { @@ -846,7 +846,7 @@ if (CSSize) { unsigned Opc = Is64Bit ? X86::LEA64r : X86::LEA32r; MachineInstr *MI = addRegOffset(BuildMI(TII.get(Opc), StackPtr), - FramePtr, -CSSize); + FramePtr, false, -CSSize); MBB.insert(MBBI, MI); } else BuildMI(MBB, MBBI, TII.get(Is64Bit ? X86::MOV64rr : X86::MOV32rr),StackPtr). From matthijs at stdin.nl Thu Jul 3 06:20:04 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Thu, 3 Jul 2008 13:20:04 +0200 Subject: [llvm-commits] [llvm] r52677 - in /llvm/trunk:?lib/Transforms/IPO/DeadArgumentElimination.cpp?test/Tra nsforms/DeadArgElim/2008-06-23-DeadAfterLive.ll?test/Transforms/Dead ArgElim/deadretval2.ll?test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: <200807021822.38614.baldrick@free.fr> References: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> <20080702084001.GC7287@katherina.student.utwente.nl> <20080702161128.GH7287@katherina.student.utwente.nl> <200807021822.38614.baldrick@free.fr> Message-ID: <20080703112004.GS7287@katherina.student.utwente.nl> Hi Duncan, > can you please post patches inline and not as attachments. > It makes them easier to comment on. Sorry for that, my own mailreader automatically includes text attachments in replies :-) Also, since this patch has been commented on a few times before, I mainly sent it so people could apply and test it (which is easier with attachments I guess...). I would like to have some comments about the last (CallSite part), so here it is again, now inline. Gr. Matthijs Index: lib/Transforms/IPO/DeadArgumentElimination.cpp =================================================================== --- lib/Transforms/IPO/DeadArgumentElimination.cpp (revision 52952) +++ lib/Transforms/IPO/DeadArgumentElimination.cpp (working copy) @@ -10,10 +10,10 @@ // This pass deletes dead arguments from internal functions. Dead argument // elimination removes arguments which are directly dead, as well as arguments // only passed into function calls as dead arguments of other functions. This -// pass also deletes dead arguments in a similar way. +// pass also deletes dead return values in a similar way. // // This pass is often useful as a cleanup pass to run after aggressive -// interprocedural passes, which add possibly-dead arguments. +// interprocedural passes, which add possibly-dead arguments or return values. // //===----------------------------------------------------------------------===// @@ -42,41 +42,80 @@ /// DAE - The dead argument elimination pass. /// class VISIBILITY_HIDDEN DAE : public ModulePass { + public: + + /// Struct that represent either a (part of a) return value or a function + /// argument. Used so that arguments and return values can be used + /// interchangably. + struct RetOrArg { + RetOrArg(const Function* F, unsigned Idx, bool IsArg) : F(F), Idx(Idx), + IsArg(IsArg) {} + const Function *F; + unsigned Idx; + bool IsArg; + + /// Make RetOrArg comparable, so we can put it into a map + bool operator<(const RetOrArg &O) const { + if (F != O.F) + return F < O.F; + else if (Idx != O.Idx) + return Idx < O.Idx; + else + return IsArg < O.IsArg; + } + + /// Make RetOrArg comparable, so we can easily iterate the multimap + bool operator==(const RetOrArg &O) const { + return F == O.F && Idx == O.Idx && IsArg == O.IsArg; + } + + std::string getString() { + // Temp debug function, ugly static allocation happening here. + char IdxStr[100]; + snprintf(IdxStr, 99, "%d\n", Idx); + return std::string((IsArg ? "Argument #" : "Return value #")) + IdxStr + " of function " + F->getName(); + } + }; + /// Liveness enum - During our initial pass over the program, we determine - /// that things are either definately alive, definately dead, or in need of - /// interprocedural analysis (MaybeLive). - /// - enum Liveness { Live, MaybeLive, Dead }; + /// that things are either alive or maybe alive. We don't mark anything + /// explicitly dead (even if we know they are), since anything not alive + /// with no registered uses (in Uses) will never be marked alive and will + /// thus become dead in the end. + enum Liveness { Live, MaybeLive }; - /// LiveArguments, MaybeLiveArguments, DeadArguments - These sets contain - /// all of the arguments in the program. The Dead set contains arguments - /// which are completely dead (never used in the function). The MaybeLive - /// set contains arguments which are only passed into other function calls, - /// thus may be live and may be dead. The Live set contains arguments which - /// are known to be alive. - /// - std::set DeadArguments, MaybeLiveArguments, LiveArguments; + /// Convenience wrapper + RetOrArg CreateRet(const Function *F, unsigned Idx) { + return RetOrArg(F, Idx, false); + } + /// Convenience wrapper + RetOrArg CreateArg(const Function *F, unsigned Idx) { + return RetOrArg(F, Idx, true); + } - /// DeadRetVal, MaybeLiveRetVal, LifeRetVal - These sets contain all of the - /// functions in the program. The Dead set contains functions whose return - /// value is known to be dead. The MaybeLive set contains functions whose - /// return values are only used by return instructions, and the Live set - /// contains functions whose return values are used, functions that are - /// external, and functions that already return void. - /// - std::set DeadRetVal, MaybeLiveRetVal, LiveRetVal; + typedef std::multimap UseMap; + /// This map maps a return value or argument to all return values or + /// arguments it uses. + /// For example (indices are left out for clarity): + /// - Uses[ret F] = ret G + /// This means that F calls G, and F returns the value returned by G. + /// - Uses[arg F] = ret G + /// This means that some function calls G and passes its result as an + /// argument to F. + /// - Uses[ret F] = arg F + /// This means that F returns one of its own arguments. + /// - Uses[arg F] = arg G + /// This means that G calls F and passes one of its own (G's) arguments + /// directly to F. + UseMap Uses; - /// InstructionsToInspect - As we mark arguments and return values - /// MaybeLive, we keep track of which instructions could make the values - /// live here. Once the entire program has had the return value and - /// arguments analyzed, this set is scanned to promote the MaybeLive objects - /// to be Live if they really are used. - std::vector InstructionsToInspect; + typedef std::set LiveSet; - /// CallSites - Keep track of the call sites of functions that have - /// MaybeLive arguments or return values. - std::multimap CallSites; + /// This set contains all values that have been determined to be live + LiveSet LiveValues; + typedef SmallVector UseVector; + public: static char ID; // Pass identification, replacement for typeid DAE() : ModulePass((intptr_t)&ID) {} @@ -85,20 +124,21 @@ virtual bool ShouldHackArguments() const { return false; } private: - Liveness getArgumentLiveness(const Argument &A); - bool isMaybeLiveArgumentNowLive(Argument *Arg); + Liveness IsMaybeLive(RetOrArg Use, UseVector &MaybeLiveUses); + Liveness SurveyUse(Value::use_iterator U, UseVector &MaybeLiveUses, + unsigned RetValNum = 0); + Liveness SurveyUses(Value *V, UseVector &MaybeLiveUses); + void SurveyFunction(Function &F); + void MarkValue(const RetOrArg &RA, Liveness L, + const UseVector &MaybeLiveUses); + void MarkLive(RetOrArg RA); + bool RemoveDeadStuffFromFunction(Function *F); bool DeleteDeadVarargs(Function &Fn); - void SurveyFunction(Function &Fn); - - void MarkArgumentLive(Argument *Arg); - void MarkRetValLive(Function *F); - void MarkReturnInstArgumentLive(ReturnInst *RI); - - void RemoveDeadArgumentsFromFunction(Function *F); }; } + char DAE::ID = 0; static RegisterPass X("deadargelim", "Dead Argument Elimination"); @@ -155,7 +195,7 @@ // remove the "..." and adjust all the calls. // Start by computing a new prototype for the function, which is the same as - // the old function, but has fewer arguments. + // the old function, but doesn't have isVarArg set. const FunctionType *FTy = Fn.getFunctionType(); std::vector Params(FTy->param_begin(), FTy->param_end()); FunctionType *NFTy = FunctionType::get(FTy->getReturnType(), Params, false); @@ -233,74 +273,155 @@ return true; } +/// Convenience function that returns the number of return values. It returns 0 +/// for void functions and 1 for functions not returning a struct. It returns +/// the number of struct elements for functions returning a struct. +static unsigned NumRetVals(const Function *F) { + if (F->getReturnType() == Type::VoidTy) + return 0; + else if (const StructType *STy = dyn_cast(F->getReturnType())) + return STy->getNumElements(); + else + return 1; +} -static inline bool CallPassesValueThoughVararg(Instruction *Call, - const Value *Arg) { - CallSite CS = CallSite::get(Call); - const Type *CalledValueTy = CS.getCalledValue()->getType(); - const Type *FTy = cast(CalledValueTy)->getElementType(); - unsigned NumFixedArgs = cast(FTy)->getNumParams(); - for (CallSite::arg_iterator AI = CS.arg_begin()+NumFixedArgs; - AI != CS.arg_end(); ++AI) - if (AI->get() == Arg) - return true; - return false; +/// IsMaybeAlive - This checks Use for liveness. If Use is live, returns Live, +/// else returns MaybeLive. Also, adds Use to MaybeLiveUses in the latter case. +DAE::Liveness DAE::IsMaybeLive(RetOrArg Use, UseVector &MaybeLiveUses) { + // We're live if our use is already marked as live + if (LiveValues.count(Use)) + return Live; + + // We're maybe live otherwise, but remember that we must become live if + // Use becomes live. + MaybeLiveUses.push_back(Use); + return MaybeLive; } -// getArgumentLiveness - Inspect an argument, determining if is known Live -// (used in a computation), MaybeLive (only passed as an argument to a call), or -// Dead (not used). -DAE::Liveness DAE::getArgumentLiveness(const Argument &A) { - const Function *F = A.getParent(); + +/// SurveyUse - This looks at a single use of an argument or return value +/// and determines if it should be alive or not. Adds this use to MaybeLiveUses +/// if it causes the used value to become MaybeAlive. +/// +/// RetValNum is the return value number to use when this use is used in a +/// return instruction. This is used in the recursion, you should always leave +/// it at 0. +DAE::Liveness DAE::SurveyUse(Value::use_iterator U, UseVector &MaybeLiveUses, + unsigned RetValNum) { + Value *V = *U; + if (ReturnInst *RI = dyn_cast(V)) { + // The value is returned from another function. It's only live when the + // caller's return value is live + RetOrArg Use = CreateRet(RI->getParent()->getParent(), RetValNum); + // We might be live, depending on the liveness of Use + return IsMaybeLive(Use, MaybeLiveUses); + } + if (InsertValueInst *IV = dyn_cast(V)) { + if (U.getOperandNo() != InsertValueInst::getAggregateOperandIndex() + && IV->hasIndices()) + // The use we are examining is inserted into an aggregate. Our liveness + // depends on all uses of that aggregate, but if it is used as a return + // value, only index at which we were inserted counts. + RetValNum = *IV->idx_begin(); + + // Note that if we are used as the aggregate operand to the insertvalue, + // we don't change RetValNum, but do survey all our uses. + + Liveness Result = MaybeLive; + for (Value::use_iterator I = IV->use_begin(), + E = V->use_end(); I != E; ++I) { + Result = SurveyUse(I, MaybeLiveUses, RetValNum); + if (Result == Live) + break; + } + return Result; + } + CallSite CS = CallSite::get(V); + if (CS.getInstruction()) { + Function *F = CS.getCalledFunction(); + if (F) { + // Used in a direct call - // If this is the return value of a struct function, it's not really dead. - if (F->hasStructRetAttr() && &*(F->arg_begin()) == &A) - return Live; - - if (A.use_empty()) // First check, directly dead? - return Dead; + // Find the argument number. + unsigned ArgNo = CS.getArgumentNo(U.getOperandNo()); - // Scan through all of the uses, looking for non-argument passing uses. - for (Value::use_const_iterator I = A.use_begin(), E = A.use_end(); I!=E;++I) { - // Return instructions do not immediately effect liveness. - if (isa(*I)) - continue; + // Check for vararg. to skip the first operand to call (the + // function itself). + if (ArgNo >= F->getFunctionType()->getNumParams()) + // The value is passed in through a vararg! Must be live. + return Live; - CallSite CS = CallSite::get(const_cast(*I)); - if (!CS.getInstruction()) { - // If its used by something that is not a call or invoke, it's alive! - return Live; + assert(CS.getArgument(ArgNo) == CS.getInstruction()->getOperand(U.getOperandNo()) && "Argument is not where we expected it"); + + // Value passed to a normal call. It's only live when the corresponding + // argument to the called function turns out live + RetOrArg Use = CreateArg(F, ArgNo); + return IsMaybeLive(Use, MaybeLiveUses); + } } - // If it's an indirect call, mark it alive... - Function *Callee = CS.getCalledFunction(); - if (!Callee) return Live; + // Used in any other way? Value must be live. + return Live; +} - // Check to see if it's passed through a va_arg area: if so, we cannot - // remove it. - if (CallPassesValueThoughVararg(CS.getInstruction(), &A)) - return Live; // If passed through va_arg area, we cannot remove it +/// SurveyUses - This looks at all the uses of the given return value +/// (possibly a partial return value from a function returning a struct). +/// Returns the Liveness deduced from the uses of this value. +/// +/// Adds all uses that cause the result to be MaybeLive to MaybeLiveRetUses. +DAE::Liveness DAE::SurveyUses(Value *V, UseVector &MaybeLiveUses) { + // Assume it's dead (which will only hold if there are no uses at all..) + Liveness Result = MaybeLive; + // Check each use + for (Value::use_iterator I = V->use_begin(), + E = V->use_end(); I != E; ++I) { + Result = SurveyUse(I, MaybeLiveUses); + if (Result == Live) + break; } - - return MaybeLive; // It must be used, but only as argument to a function + return Result; } - // SurveyFunction - This performs the initial survey of the specified function, // checking out whether or not it uses any of its incoming arguments or whether // any callers use the return value. This fills in the -// (Dead|MaybeLive|Live)(Arguments|RetVal) sets. +// LiveValues set and Uses map. // // We consider arguments of non-internal functions to be intrinsically alive as // well as arguments to functions which have their "address taken". // void DAE::SurveyFunction(Function &F) { bool FunctionIntrinsicallyLive = false; - Liveness RetValLiveness = F.getReturnType() == Type::VoidTy ? Live : Dead; + unsigned RetCount = NumRetVals(&F); + // Assume all return values are dead + typedef SmallVector RetVals; + RetVals RetValLiveness(RetCount, MaybeLive); - if (!F.hasInternalLinkage() && - (!ShouldHackArguments() || F.isIntrinsic())) + // These vectors maps each return value to the uses that make it MaybeLive, so + // we can add those to the MaybeLiveRetVals list if the return value + // really turns out to be MaybeLive. Initializes to RetCount empty vectors + typedef SmallVector RetUses; + // Intialized to a list of RetCount empty lists + RetUses MaybeLiveRetUses(RetCount); + + for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB) + if (ReturnInst *RI = dyn_cast(BB->getTerminator())) + if (RI->getNumOperands() != 0 && RI->getOperand(0)->getType() + != F.getFunctionType()->getReturnType()) { + // We don't support old style multiple return values + FunctionIntrinsicallyLive = true; + break; + } + + if (!F.hasInternalLinkage() && (!ShouldHackArguments() || F.isIntrinsic())) FunctionIntrinsicallyLive = true; - else + + if (!FunctionIntrinsicallyLive) { + DOUT << "DAE - Inspecting callers for fn: " << F.getName() << "\n"; + // Keep track of the number of live retvals, so we can skip checks once all + // of them turn out to be live. + unsigned NumLiveRetVals = 0; + const Type *STy = dyn_cast(F.getReturnType()); + // Loop all uses of the function for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) { // If the function is PASSED IN as an argument, its address has been taken if (I.getOperandNo() != 0) { @@ -316,190 +437,142 @@ break; } - // Check to see if the return value is used... - if (RetValLiveness != Live) - for (Value::use_iterator I = TheCall->use_begin(), - E = TheCall->use_end(); I != E; ++I) - if (isa(cast(*I))) { - RetValLiveness = MaybeLive; - } else if (isa(cast(*I)) || - isa(cast(*I))) { - if (CallPassesValueThoughVararg(cast(*I), TheCall) || - !CallSite::get(cast(*I)).getCalledFunction()) { - RetValLiveness = Live; + // If we end up here, we are looking at a direct call to our function. + + // Now, check how our return value(s) is/are used in this caller. Don't + // bother checking return values if all of them are live already + if (NumLiveRetVals != RetCount) { + if (STy) { + // Check all uses of the return value + for (Value::use_iterator I = TheCall->use_begin(), + E = TheCall->use_end(); I != E; ++I) { + ExtractValueInst *Ext = dyn_cast(*I); + if (Ext && Ext->hasIndices()) { + // This use uses a part of our return value, survey the uses of + // that part and store the results for this index only. + unsigned Idx = *Ext->idx_begin(); + if (RetValLiveness[Idx] != Live) { + RetValLiveness[Idx] = SurveyUses(Ext, MaybeLiveRetUses[Idx]); + if (RetValLiveness[Idx] == Live) + NumLiveRetVals++; + } + } else { + // Used by something else than extractvalue. Mark all + // return values as live. + for (unsigned i = 0; i != RetCount; ++i ) + RetValLiveness[i] = Live; + NumLiveRetVals = RetCount; break; - } else { - RetValLiveness = MaybeLive; } - } else { - RetValLiveness = Live; - break; } + } else { + // Single return value + RetValLiveness[0] = SurveyUses(TheCall, MaybeLiveRetUses[0]); + if (RetValLiveness[0] == Live) + NumLiveRetVals = RetCount; + } + } } - + } if (FunctionIntrinsicallyLive) { - DOUT << " Intrinsically live fn: " << F.getName() << "\n"; + DOUT << "DAE - Intrinsically live fn: " << F.getName() << "\n"; + // Mark all arguments as live + unsigned i = 0; for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); - AI != E; ++AI) - LiveArguments.insert(AI); - LiveRetVal.insert(&F); + AI != E; ++AI, ++i) + MarkLive(CreateArg(&F, i)); + // Mark all return values as live + i = 0; + for (unsigned i = 0, e = RetValLiveness.size(); i != e; ++i) + MarkLive(CreateRet(&F, i)); return; } - switch (RetValLiveness) { - case Live: LiveRetVal.insert(&F); break; - case MaybeLive: MaybeLiveRetVal.insert(&F); break; - case Dead: DeadRetVal.insert(&F); break; + // Now we've inspected all callers, record the liveness of our return values. + for (unsigned i = 0, e = RetValLiveness.size(); i != e; ++i) { + RetOrArg Ret = CreateRet(&F, i); + // Mark the result down + MarkValue(Ret, RetValLiveness[i], MaybeLiveRetUses[i]); } + DOUT << "DAE - Inspecting args for fn: " << F.getName() << "\n"; - DOUT << " Inspecting args for fn: " << F.getName() << "\n"; + // Now, check all of our arguments + unsigned i = 0; + UseVector MaybeLiveArgUses; + for (Function::arg_iterator AI = F.arg_begin(), + E = F.arg_end(); AI != E; ++AI, ++i) { + // See what the effect of this use is (recording any uses that cause + // MaybeLive in MaybeLiveArgUses) + Liveness Result = SurveyUses(AI, MaybeLiveArgUses); + RetOrArg Arg = CreateArg(&F, i); + // Mark the result down + MarkValue(Arg, Result, MaybeLiveArgUses); + // Clear the vector again for the next iteration + MaybeLiveArgUses.clear(); + } +} - // If it is not intrinsically alive, we know that all users of the - // function are call sites. Mark all of the arguments live which are - // directly used, and keep track of all of the call sites of this function - // if there are any arguments we assume that are dead. - // - bool AnyMaybeLiveArgs = false; - for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); - AI != E; ++AI) - switch (getArgumentLiveness(*AI)) { - case Live: - DOUT << " Arg live by use: " << AI->getName() << "\n"; - LiveArguments.insert(AI); - break; - case Dead: - DOUT << " Arg definitely dead: " << AI->getName() <<"\n"; - DeadArguments.insert(AI); - break; +/// MarkValue - This function marks the liveness of RA depending on L. If L is +/// MaybeLive, it also records any uses in MaybeLiveUses such that RA will be +/// marked live if any use in MaybeLiveUses gets marked live later on. +void DAE::MarkValue(const RetOrArg &RA, Liveness L, + const UseVector &MaybeLiveUses) { + switch (L) { + case Live: MarkLive(RA); break; case MaybeLive: - DOUT << " Arg only passed to calls: " << AI->getName() << "\n"; - AnyMaybeLiveArgs = true; - MaybeLiveArguments.insert(AI); + { + // Note any uses of this value, so this return value can be + // marked live whenever one of the uses becomes live. + UseMap::iterator Where = Uses.begin(); + for (UseVector::const_iterator UI = MaybeLiveUses.begin(), + UE = MaybeLiveUses.end(); UI != UE; ++UI) + Where = Uses.insert(Where, UseMap::value_type(*UI, RA)); break; } - - // If there are any "MaybeLive" arguments, we need to check callees of - // this function when/if they become alive. Record which functions are - // callees... - if (AnyMaybeLiveArgs || RetValLiveness == MaybeLive) - for (Value::use_iterator I = F.use_begin(), E = F.use_end(); - I != E; ++I) { - if (AnyMaybeLiveArgs) - CallSites.insert(std::make_pair(&F, CallSite::get(*I))); - - if (RetValLiveness == MaybeLive) - for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); - UI != E; ++UI) - InstructionsToInspect.push_back(cast(*UI)); - } -} - -// isMaybeLiveArgumentNowLive - Check to see if Arg is alive. At this point, we -// know that the only uses of Arg are to be passed in as an argument to a -// function call or return. Check to see if the formal argument passed in is in -// the LiveArguments set. If so, return true. -// -bool DAE::isMaybeLiveArgumentNowLive(Argument *Arg) { - for (Value::use_iterator I = Arg->use_begin(), E = Arg->use_end(); I!=E; ++I){ - if (isa(*I)) { - if (LiveRetVal.count(Arg->getParent())) return true; - continue; - } - - CallSite CS = CallSite::get(*I); - - // We know that this can only be used for direct calls... - Function *Callee = CS.getCalledFunction(); - - // Loop over all of the arguments (because Arg may be passed into the call - // multiple times) and check to see if any are now alive... - CallSite::arg_iterator CSAI = CS.arg_begin(); - for (Function::arg_iterator AI = Callee->arg_begin(), E = Callee->arg_end(); - AI != E; ++AI, ++CSAI) - // If this is the argument we are looking for, check to see if it's alive - if (*CSAI == Arg && LiveArguments.count(AI)) - return true; } - return false; } -/// MarkArgumentLive - The MaybeLive argument 'Arg' is now known to be alive. -/// Mark it live in the specified sets and recursively mark arguments in callers -/// live that are needed to pass in a value. -/// -void DAE::MarkArgumentLive(Argument *Arg) { - std::set::iterator It = MaybeLiveArguments.lower_bound(Arg); - if (It == MaybeLiveArguments.end() || *It != Arg) return; +/// MarkLive - Mark the given return value or argument as live. Additionally, +/// mark any values that are used by this value (according to Uses) live as +/// well. +void DAE::MarkLive(RetOrArg RA) { + if (!LiveValues.insert(RA).second) + return; // We were already marked Live - DOUT << " MaybeLive argument now live: " << Arg->getName() <<"\n"; - MaybeLiveArguments.erase(It); - LiveArguments.insert(Arg); + if (RA.IsArg) + DOUT << "DAE - Marking argument " << RA.Idx << " to function " + << RA.F->getNameStart() << " live\n"; + else + DOUT << "DAE - Marking return value " << RA.Idx << " of function " + << RA.F->getNameStart() << " live\n"; - // Loop over all of the call sites of the function, making any arguments - // passed in to provide a value for this argument live as necessary. - // - Function *Fn = Arg->getParent(); - unsigned ArgNo = std::distance(Fn->arg_begin(), Function::arg_iterator(Arg)); + // We don't use upper_bound (or equal_range) here, because our recursive call + // to ourselves is likely to mark the upper_bound (which is the first value + // not belonging to RA) to become erased and the iterator invalidated. + UseMap::iterator Begin = Uses.lower_bound(RA); + UseMap::iterator E = Uses.end(); + UseMap::iterator I; + for (I = Begin; I != E && I->first == RA; ++I) + MarkLive(I->second); - std::multimap::iterator I = CallSites.lower_bound(Fn); - for (; I != CallSites.end() && I->first == Fn; ++I) { - CallSite CS = I->second; - Value *ArgVal = *(CS.arg_begin()+ArgNo); - if (Argument *ActualArg = dyn_cast(ArgVal)) { - MarkArgumentLive(ActualArg); - } else { - // If the value passed in at this call site is a return value computed by - // some other call site, make sure to mark the return value at the other - // call site as being needed. - CallSite ArgCS = CallSite::get(ArgVal); - if (ArgCS.getInstruction()) - if (Function *Fn = ArgCS.getCalledFunction()) - MarkRetValLive(Fn); - } - } + // Erase RA from the Uses map (from the lower bound to wherever we ended up + // after the loop). + Uses.erase(Begin, I); } -/// MarkArgumentLive - The MaybeLive return value for the specified function is -/// now known to be alive. Propagate this fact to the return instructions which -/// produce it. -void DAE::MarkRetValLive(Function *F) { - assert(F && "Shame shame, we can't have null pointers here!"); - - // Check to see if we already knew it was live - std::set::iterator I = MaybeLiveRetVal.lower_bound(F); - if (I == MaybeLiveRetVal.end() || *I != F) return; // It's already alive! - - DOUT << " MaybeLive retval now live: " << F->getName() << "\n"; - - MaybeLiveRetVal.erase(I); - LiveRetVal.insert(F); // It is now known to be live! - - // Loop over all of the functions, noticing that the return value is now live. - for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) - if (ReturnInst *RI = dyn_cast(BB->getTerminator())) - MarkReturnInstArgumentLive(RI); -} - -void DAE::MarkReturnInstArgumentLive(ReturnInst *RI) { - Value *Op = RI->getOperand(0); - if (Argument *A = dyn_cast(Op)) { - MarkArgumentLive(A); - } else if (CallInst *CI = dyn_cast(Op)) { - if (Function *F = CI->getCalledFunction()) - MarkRetValLive(F); - } else if (InvokeInst *II = dyn_cast(Op)) { - if (Function *F = II->getCalledFunction()) - MarkRetValLive(F); - } -} - -// RemoveDeadArgumentsFromFunction - We know that F has dead arguments, as +// RemoveDeadStuffFromFunction - Remove any arguments and return values from F +// that are not in LiveValues. This function is a noop for any Function created +// by this function before, or any function that was not inspected for liveness. // specified by the DeadArguments list. Transform the function and all of the // callees of the function to not have these arguments. // -void DAE::RemoveDeadArgumentsFromFunction(Function *F) { +bool DAE::RemoveDeadStuffFromFunction(Function *F) { + // Quick exit path for external functions + if (!F->hasInternalLinkage() && (!ShouldHackArguments() || F->isIntrinsic())) + return false; + // Start by computing a new prototype for the function, which is the same as - // the old function, but has fewer arguments. + // the old function, but has fewer arguments and a different return type. const FunctionType *FTy = F->getFunctionType(); std::vector Params; @@ -510,28 +583,94 @@ // The existing function return attributes. ParameterAttributes RAttrs = PAL.getParamAttrs(0); - // Make the function return void if the return value is dead. + + // Find out the new return value + const Type *RetTy = FTy->getReturnType(); - if (DeadRetVal.count(F)) { - RetTy = Type::VoidTy; - RAttrs &= ~ParamAttr::typeIncompatible(RetTy); - DeadRetVal.erase(F); + const Type *NRetTy = NULL; + unsigned RetCount = NumRetVals(F); + // Explicitely track if anything changed, for debugging + bool Changed = false; + // -1 means unused, other numbers are the new index + SmallVector NewRetIdxs(RetCount, -1); + std::vector RetTypes; + if (RetTy != Type::VoidTy) { + const StructType *STy = dyn_cast(RetTy); + if (STy) + // Look at each of the original return values individually + for (unsigned i = 0; i != RetCount; ++i) { + RetOrArg Ret = CreateRet(F, i); + if (LiveValues.erase(Ret)) { + RetTypes.push_back(STy->getElementType(i)); + NewRetIdxs[i] = RetTypes.size() - 1; + } else { + ++NumRetValsEliminated; + DOUT << "DAE - Removing return value " << i << " from " + << F->getNameStart() << "\n"; + Changed = true; + } + } + else + // We used to return a single value + if (LiveValues.erase(CreateRet(F, 0))) { + RetTypes.push_back(RetTy); + NewRetIdxs[0] = 0; + } else { + DOUT << "DAE - Removing return value from " << F->getNameStart() + << "\n"; + ++NumRetValsEliminated; + Changed = true; + } + if (RetTypes.size() > 1 || (STy && STy->getNumElements()==RetTypes.size())) + // More than one return type? Return a struct with them. Also, if we used + // to return a struct and didn't change the number of return values, + // return a struct again. This prevents changing {something} into something + // and {} into void. + // Make the new struct packed if we used to return a packed struct + // already. + NRetTy = StructType::get(RetTypes, STy->isPacked()); + else if (RetTypes.size() == 1) + // One return type? Just a simple value then, but only if we didn't use to + // return a struct with that simple value before. + NRetTy = RetTypes.front(); + else if (RetTypes.size() == 0) + // No return types? Make it void, but only if we didn't use to return {}. + NRetTy = Type::VoidTy; + } else { + NRetTy = Type::VoidTy; } + assert(NRetTy && "No new return type found?"); + + // Remove any incompatible attributes + RAttrs &= ~ParamAttr::typeIncompatible(NRetTy); if (RAttrs) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, RAttrs)); + // Remember which arguments are still alive + SmallVector ArgAlive(FTy->getNumParams(), false); // Construct the new parameter list from non-dead arguments. Also construct - // a new set of parameter attributes to correspond. - unsigned index = 1; - for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; - ++I, ++index) - if (!DeadArguments.count(I)) { + // a new set of parameter attributes to correspond. Skip the first parameter + // attribute, since that belongs to the return value. + unsigned i = 0; + for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); + I != E; ++I, ++i) { + RetOrArg Arg = CreateArg(F, i); + if (LiveValues.erase(Arg)) { Params.push_back(I->getType()); - - if (ParameterAttributes Attrs = PAL.getParamAttrs(index)) + ArgAlive[i] = true; + + // Get the original parameter attributes (skipping the first one, that is + // for the return value + if (ParameterAttributes Attrs = PAL.getParamAttrs(i + 1)) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Params.size(), Attrs)); + } else { + ++NumArgumentsEliminated; + DOUT << "DAE - Removing argument " << i << " (" << I->getNameStart() + << ") from " << F->getNameStart() << "\n"; + Changed = true; } + } // Reconstruct the ParamAttrsList based on the vector we constructed. PAListPtr NewPAL = PAListPtr::get(ParamAttrsVec.begin(), ParamAttrsVec.end()); @@ -539,19 +678,33 @@ // Work around LLVM bug PR56: the CWriter cannot emit varargs functions which // have zero fixed arguments. // + // Not that we apply this hack for a vararg fuction that does not have any + // arguments anymore, but did have them before (so don't bother fixing + // functions that were already broken wrt CWriter). bool ExtraArgHack = false; - if (Params.empty() && FTy->isVarArg()) { + if (Params.empty() && FTy->isVarArg() && FTy->getNumParams() != 0) { ExtraArgHack = true; Params.push_back(Type::Int32Ty); } // Create the new function type based on the recomputed parameters. - FunctionType *NFTy = FunctionType::get(RetTy, Params, FTy->isVarArg()); + FunctionType *NFTy = FunctionType::get(NRetTy, Params, FTy->isVarArg()); + // No change? + if (NFTy == FTy) + return false; + + // The function type is only allowed to be different if we actually left out + // an argument or return value. + assert(Changed && "Function type changed while no arguments or return values" + "were removed!"); + // Create the new function body and insert it into the module... Function *NF = Function::Create(NFTy, F->getLinkage()); NF->copyAttributesFrom(F); NF->setParamAttrs(NewPAL); + // Insert the new function before the old function, so we won't be processing + // it again. F->getParent()->getFunctionList().insert(F, NF); NF->takeName(F); @@ -562,6 +715,7 @@ while (!F->use_empty()) { CallSite CS = CallSite::get(F->use_back()); Instruction *Call = CS.getInstruction(); + ParamAttrsVec.clear(); const PAListPtr &CallPAL = CS.getParamAttrs(); @@ -572,14 +726,17 @@ if (RAttrs) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(0, RAttrs)); - // Loop over the operands, deleting dead ones... - CallSite::arg_iterator AI = CS.arg_begin(); - index = 1; - for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); - I != E; ++I, ++AI, ++index) - if (!DeadArguments.count(I)) { // Remove operands for dead arguments - Args.push_back(*AI); - if (ParameterAttributes Attrs = CallPAL.getParamAttrs(index)) + // Declare these outside of the loops, so we can reuse them for the second + // loop, which loops the varargs + CallSite::arg_iterator I = CS.arg_begin(); + unsigned i = 0; + // Loop over those operands, corresponding to the normal arguments to the + // original function, and add those that are still alive. + for (unsigned e = FTy->getNumParams(); i != e; ++I, ++i) + if (ArgAlive[i]) { + Args.push_back(*I); + // Get original parameter attributes, but skip return attributes + if (ParameterAttributes Attrs = CallPAL.getParamAttrs(i + 1)) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs)); } @@ -587,9 +744,9 @@ Args.push_back(UndefValue::get(Type::Int32Ty)); // Push any varargs arguments on the list. Don't forget their attributes. - for (; AI != CS.arg_end(); ++AI) { - Args.push_back(*AI); - if (ParameterAttributes Attrs = CallPAL.getParamAttrs(index++)) + for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) { + Args.push_back(*I); + if (ParameterAttributes Attrs = CallPAL.getParamAttrs(i + 1)) ParamAttrsVec.push_back(ParamAttrsWithIndex::get(Args.size(), Attrs)); } @@ -613,11 +770,55 @@ Args.clear(); if (!Call->use_empty()) { - if (New->getType() == Type::VoidTy) - Call->replaceAllUsesWith(Constant::getNullValue(Call->getType())); - else { + if (New->getType() == Call->getType()) { + // Return type not changed? Just replace users then Call->replaceAllUsesWith(New); New->takeName(Call); + } else if (New->getType() == Type::VoidTy) { + // Our return value has uses, but they will get removed later on. + // Replace by null for now. + Call->replaceAllUsesWith(Constant::getNullValue(Call->getType())); + } else { + assert(isa(RetTy) && "Return type changed, but not into a" + "void. The old return type must have" + "been a struct!"); + // The original return value was a struct, update all uses (which are + // all extractvalue instructions). + for (Value::use_iterator I = Call->use_begin(), E = Call->use_end(); + I != E;) { + assert(isa(*I) && "Return value not only used by" + "extractvalue?"); + ExtractValueInst *EV = cast(*I); + // Increment now, since we're about to throw away this use. + ++I; + assert(EV->hasIndices() && "Return value used by extractvalue without" + "indices?"); + unsigned Idx = *EV->idx_begin(); + if (NewRetIdxs[Idx] != -1) { + if (RetTypes.size() > 1) { + // We're still returning a struct, create a new extractvalue + // instruction with the first index updated + std::vector NewIdxs(EV->idx_begin(), EV->idx_end()); + NewIdxs[0] = NewRetIdxs[Idx]; + Value *NEV = ExtractValueInst::Create(New, NewIdxs.begin(), + NewIdxs.end(), "retval", + EV); + EV->replaceAllUsesWith(NEV); + EV->eraseFromParent(); + } else { + // We are now only returning a simple value, remove the + // extractvalue + EV->replaceAllUsesWith(New); + EV->eraseFromParent(); + } + } else { + // Value unused, replace uses by null for now, they will get removed + // later on + EV->replaceAllUsesWith(Constant::getNullValue(EV->getType())); + EV->eraseFromParent(); + } + } + New->takeName(Call); } } @@ -632,13 +833,11 @@ NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList()); // Loop over the argument list, transfering uses of the old arguments over to - // the new arguments, also transfering over the names as well. While we're at - // it, remove the dead arguments from the DeadArguments list. - // + // the new arguments, also transfering over the names as well. + i = 0; for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), - I2 = NF->arg_begin(); - I != E; ++I) - if (!DeadArguments.count(I)) { + I2 = NF->arg_begin(); I != E; ++I, ++i) + if (ArgAlive[i]) { // If this is a live argument, move the name and users over to the new // version. I->replaceAllUsesWith(I2); @@ -646,10 +845,8 @@ ++I2; } else { // If this argument is dead, replace any uses of it with null constants - // (these are guaranteed to only be operands to call instructions which - // will later be simplified). + // (these are guaranteed to become unused later on) I->replaceAllUsesWith(Constant::getNullValue(I->getType())); - DeadArguments.erase(I); } // If we change the return value of the function we must rewrite any return @@ -657,16 +854,52 @@ if (F->getReturnType() != NF->getReturnType()) for (Function::iterator BB = NF->begin(), E = NF->end(); BB != E; ++BB) if (ReturnInst *RI = dyn_cast(BB->getTerminator())) { - ReturnInst::Create(0, RI); + Value *RetVal; + + if (NFTy->getReturnType() == Type::VoidTy) { + RetVal = 0; + } else { + assert (isa(RetTy)); + // The original return value was a struct, insert + // extractvalue/insertvalue chains to extract only the values we need + // to return and insert them into our new result. + // This does generate messy code, but we'll let it to instcombine to + // clean that up + Value *OldRet = RI->getOperand(0); + // Start out building up our return value from undef + RetVal = llvm::UndefValue::get(NRetTy); + for (unsigned i = 0; i != RetCount; ++i) + if (NewRetIdxs[i] != -1) { + ExtractValueInst *EV = ExtractValueInst::Create(OldRet, i, + "newret", RI); + if (RetTypes.size() > 1) { + // We're still returning a struct, so reinsert the value into + // our new return value at the new index + + RetVal = InsertValueInst::Create(RetVal, EV, NewRetIdxs[i], + "oldret"); + } else { + // We are now only returning a simple value, so just return the + // extracted value + RetVal = EV; + } + } + } + // Replace the return instruction with one returning the new return + // value (possibly 0 if we became void). + ReturnInst::Create(RetVal, RI); BB->getInstList().erase(RI); } // Now that the old function is dead, delete it. F->eraseFromParent(); + + return true; } bool DAE::runOnModule(Module &M) { bool Changed = false; + // First pass: Do a simple check to see if any functions can have their "..." // removed. We can do this if they never call va_start. This loop cannot be // fused with the next loop, because deleting a function invalidates @@ -677,7 +910,7 @@ if (F.getFunctionType()->isVarArg()) Changed |= DeleteDeadVarargs(F); } - + // Second phase:loop through the module, determining which arguments are live. // We assume all arguments are dead unless proven otherwise (allowing us to // determine that dead arguments passed into recursive functions are dead). @@ -685,86 +918,14 @@ DOUT << "DAE - Determining liveness\n"; for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) SurveyFunction(*I); - - // Loop over the instructions to inspect, propagating liveness among arguments - // and return values which are MaybeLive. - while (!InstructionsToInspect.empty()) { - Instruction *I = InstructionsToInspect.back(); - InstructionsToInspect.pop_back(); - - if (ReturnInst *RI = dyn_cast(I)) { - // For return instructions, we just have to check to see if the return - // value for the current function is known now to be alive. If so, any - // arguments used by it are now alive, and any call instruction return - // value is alive as well. - if (LiveRetVal.count(RI->getParent()->getParent())) - MarkReturnInstArgumentLive(RI); - - } else { - CallSite CS = CallSite::get(I); - assert(CS.getInstruction() && "Unknown instruction for the I2I list!"); - - Function *Callee = CS.getCalledFunction(); - - // If we found a call or invoke instruction on this list, that means that - // an argument of the function is a call instruction. If the argument is - // live, then the return value of the called instruction is now live. - // - CallSite::arg_iterator AI = CS.arg_begin(); // ActualIterator - for (Function::arg_iterator FI = Callee->arg_begin(), - E = Callee->arg_end(); FI != E; ++AI, ++FI) { - // If this argument is another call... - CallSite ArgCS = CallSite::get(*AI); - if (ArgCS.getInstruction() && LiveArguments.count(FI)) - if (Function *Callee = ArgCS.getCalledFunction()) - MarkRetValLive(Callee); - } - } + + // Now, remove all dead arguments and return values from each function in + // turn + for (Module::iterator I = M.begin(), E = M.end(); I != E; ) { + // Increment now, because the function will probably get removed (ie + // replaced by a new one) + Function *F = I++; + Changed |= RemoveDeadStuffFromFunction(F); } - - // Now we loop over all of the MaybeLive arguments, promoting them to be live - // arguments if one of the calls that uses the arguments to the calls they are - // passed into requires them to be live. Of course this could make other - // arguments live, so process callers recursively. - // - // Because elements can be removed from the MaybeLiveArguments set, copy it to - // a temporary vector. - // - std::vector TmpArgList(MaybeLiveArguments.begin(), - MaybeLiveArguments.end()); - for (unsigned i = 0, e = TmpArgList.size(); i != e; ++i) { - Argument *MLA = TmpArgList[i]; - if (MaybeLiveArguments.count(MLA) && - isMaybeLiveArgumentNowLive(MLA)) - MarkArgumentLive(MLA); - } - - // Recover memory early... - CallSites.clear(); - - // At this point, we know that all arguments in DeadArguments and - // MaybeLiveArguments are dead. If the two sets are empty, there is nothing - // to do. - if (MaybeLiveArguments.empty() && DeadArguments.empty() && - MaybeLiveRetVal.empty() && DeadRetVal.empty()) - return Changed; - - // Otherwise, compact into one set, and start eliminating the arguments from - // the functions. - DeadArguments.insert(MaybeLiveArguments.begin(), MaybeLiveArguments.end()); - MaybeLiveArguments.clear(); - DeadRetVal.insert(MaybeLiveRetVal.begin(), MaybeLiveRetVal.end()); - MaybeLiveRetVal.clear(); - - LiveArguments.clear(); - LiveRetVal.clear(); - - NumArgumentsEliminated += DeadArguments.size(); - NumRetValsEliminated += DeadRetVal.size(); - while (!DeadArguments.empty()) - RemoveDeadArgumentsFromFunction((*DeadArguments.begin())->getParent()); - - while (!DeadRetVal.empty()) - RemoveDeadArgumentsFromFunction(*DeadRetVal.begin()); - return true; + return Changed; } Index: include/llvm/Support/CallSite.h =================================================================== --- include/llvm/Support/CallSite.h (revision 52952) +++ include/llvm/Support/CallSite.h (working copy) @@ -124,12 +124,18 @@ void setArgument(unsigned ArgNo, Value* newVal) { assert(I && "Not a call or invoke instruction!"); assert(arg_begin() + ArgNo < arg_end() && "Argument # out of range!"); - if (I->getOpcode() == Instruction::Call) - I->setOperand(ArgNo+1, newVal); // Skip Function - else - I->setOperand(ArgNo+3, newVal); // Skip Function, BB, BB + I->setOperand(getArgumentOffset() + ArgNo, newVal); } - + + /// Given an operand number, returns the argument that corresponds to it. + /// OperandNo must be a valid operand number that actually corresponds to an + /// argument. + unsigned getArgumentNo(unsigned OperandNo) const { + assert(OperandNo >= getArgumentOffset() && "Operand number passed was not a " + "valid argument"); + return OperandNo - getArgumentOffset(); + } + /// hasArgument - Returns true if this CallSite passes the given Value* as an /// argument to the called function. bool hasArgument(const Value *Arg) const; @@ -140,14 +146,11 @@ /// arg_begin/arg_end - Return iterators corresponding to the actual argument /// list for a call site. - /// arg_iterator arg_begin() const { assert(I && "Not a call or invoke instruction!"); - if (I->getOpcode() == Instruction::Call) - return I->op_begin()+1; // Skip Function - else - return I->op_begin()+3; // Skip Function, BB, BB + return I->op_begin() + getArgumentOffset(); // Skip Function } + arg_iterator arg_end() const { return I->op_end(); } bool arg_empty() const { return arg_end() == arg_begin(); } unsigned arg_size() const { return unsigned(arg_end() - arg_begin()); } @@ -155,6 +158,15 @@ bool operator<(const CallSite &CS) const { return getInstruction() < CS.getInstruction(); } + +private: + /// Returns the operand number of the first argument + unsigned getArgumentOffset() const { + if (I->getOpcode() == Instruction::Call) + return 1; // Skip Function + else + return 3; // Skip Function, BB, BB + } }; } // End llvm namespace -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080703/75ab7a26/attachment.bin From baldrick at free.fr Thu Jul 3 04:06:14 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 3 Jul 2008 11:06:14 +0200 Subject: [llvm-commits] [llvm] r53035 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <3FFA1FED-6CE4-4669-8ABE-340E10AAD092@apple.com> References: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> <3FFA1FED-6CE4-4669-8ABE-340E10AAD092@apple.com> Message-ID: <200807031106.15621.baldrick@free.fr> Hi Evan, > test/CodeGen/PowerPC/vec_misaligned.ll is not crashing in the > Legalizer. Can you check if your patch is the cause? it was caused by r53031: r53031 | wangmp | 2008-07-02 19:07:12 +0200 (Wed, 02 Jul 2008) | 4 lines Fixed problem in EmitStackConvert where the source and target type have different alignment by creating a stack slot with the max alignment of source and target type. Best wishes, Duncan. From baldrick at free.fr Thu Jul 3 07:03:39 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 3 Jul 2008 14:03:39 +0200 Subject: [llvm-commits] [llvm] r52677 - in /llvm/trunk:?lib/Transforms/IPO/DeadArgumentElimination.cpp?test/Tra nsforms/DeadArgElim/2008-06-23-DeadAfterLive.ll?test/Transforms/Dead ArgElim/deadretval2.ll?test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: <20080703112004.GS7287@katherina.student.utwente.nl> References: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> <200807021822.38614.baldrick@free.fr> <20080703112004.GS7287@katherina.student.utwente.nl> Message-ID: <200807031403.39891.baldrick@free.fr> Hi, > + /// Struct that represent either a (part of a) return value or a function -> Struct that represents (part of) either a return value or a function > + return std::string((IsArg ? "Argument #" : "Return value #")) + IdxStr + " of function " + F->getName(); This line is too long. > + typedef std::multimap UseMap; > + /// This map maps a return value or argument to all return values or This map maps -> This maps > +/// IsMaybeAlive - This checks Use for liveness. If Use is live, returns Live, > +/// else returns MaybeLive. Also, adds Use to MaybeLiveUses in the latter case. I don't much like predicates that modify state. Maybe you could change the name to MarkMaybeAlive or something like that, so conceptually the return value becomes information about the operation performed. > + // We're live if our use is already marked as live Plenty of comments don't end in full stops. > + assert(CS.getArgument(ArgNo) == CS.getInstruction()->getOperand(U.getOperandNo()) && "Argument is not where we expected it"); This line is too long. > + // These vectors maps each return value to the uses that make it MaybeLive, so These vectors maps -> These vectors map > + // Intialized to a list of RetCount empty lists Intialized -> Initialized > +// that are not in LiveValues. This function is a noop for any Function created > +// by this function before, or any function that was not inspected for liveness. Too many uses of function! How about: This is a noop for any Function created here before, or any Function that was not inspected for liveness. > + // Explicitely track if anything changed, for debugging Explicitely -> Explicitly > + // Remove any incompatible attributes > + RAttrs &= ~ParamAttr::typeIncompatible(NRetTy); If they are incompatible, maybe this means the transform should not be performed? > + // Not that we apply this hack for a vararg fuction that does not have any Not that -> Note that > + CallSite::arg_iterator I = CS.arg_begin(); > + unsigned i = 0; > + // Loop over those operands, corresponding to the normal arguments to the > + // original function, and add those that are still alive. > + for (unsigned e = FTy->getNumParams(); i != e; ++I, ++i) How about controlling the loop using I not i, i.e. define E = CS.arg_end() and test I != E ? > + for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) { I think you forgot to reset i to zero. > + // This does generate messy code, but we'll let it to instcombine to We'll let it to -> We'll leave it to > + /// Given an operand number, returns the argument that corresponds to it. > + /// OperandNo must be a valid operand number that actually corresponds to an > + /// argument. How about working with argument numbers rather than operand numbers? Then this wouldn't be needed (and everything would start at 0). > + /// Returns the operand number of the first argument > + unsigned getArgumentOffset() const { How about marking this "inline"? Ciao, Duncan. From baldrick at free.fr Thu Jul 3 04:35:58 2008 From: baldrick at free.fr (Duncan Sands) Date: Thu, 3 Jul 2008 11:35:58 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r53079 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200807030445.m634jkZl009083@zion.cs.uiuc.edu> References: <200807030445.m634jkZl009083@zion.cs.uiuc.edu> Message-ID: <200807031135.58882.baldrick@free.fr> Hi Chris, > +/// LocalLLVMValueIDs - This is the set of local IDs we have in our mapping, > +/// this allows us to efficiently identify and remove them. how about adding an explanation of what a local value is? > + if (Value *V = LLVMValues[Idx]) { > + assert(!isa(V) && "Found local value"); Shouldn't this be "Found global value!"? Ciao, Duncan. From kremenek at apple.com Thu Jul 3 10:42:30 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 03 Jul 2008 15:42:30 -0000 Subject: [llvm-commits] [llvm] r53101 - /llvm/tags/checker/checker-55/ Message-ID: <200807031542.m63FgVAK012241@zion.cs.uiuc.edu> Author: kremenek Date: Thu Jul 3 10:42:24 2008 New Revision: 53101 URL: http://llvm.org/viewvc/llvm-project?rev=53101&view=rev Log: Tagging checker-55. Added: llvm/tags/checker/checker-55/ - copied from r53100, llvm/trunk/ From matthijs at stdin.nl Thu Jul 3 10:52:35 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Thu, 3 Jul 2008 17:52:35 +0200 Subject: [llvm-commits] [llvm] r52677 - in /llvm/trunk:?lib/Transforms/IPO/DeadArgumentElimination.cpp?test/Tra nsforms/DeadArgElim/2008-06-23-DeadAfterLive.ll?test/Transforms/Dead ArgElim/deadretval2.ll?test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: <200807031403.39891.baldrick@free.fr> References: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> <200807021822.38614.baldrick@free.fr> <20080703112004.GS7287@katherina.student.utwente.nl> <200807031403.39891.baldrick@free.fr> Message-ID: <20080703155235.GW7287@katherina.student.utwente.nl> Hi Duncan, thanks for your comments. I'll reply where appropriate, and fix the rest. > > +/// IsMaybeAlive - This checks Use for liveness. If Use is live, returns Live, > > +/// else returns MaybeLive. Also, adds Use to MaybeLiveUses in the latter case. > > I don't much like predicates that modify state. Maybe you could change the name > to MarkMaybeAlive or something like that, so conceptually the return value becomes > information about the operation performed. Sounds reasonable, though MarkMaybeAlive is not quite right. It does not modify any global state (ie, instance variables), just the passed-by-reference argument (which can be seen as a part of its result, even). > Plenty of comments don't end in full stops. What's official policy on this? Any comment should have a full stop? Or just comments that are complete sentences? > > +// that are not in LiveValues. This function is a noop for any Function created > > +// by this function before, or any function that was not inspected for liveness. > > Too many uses of function! How about: > This is a noop for any Function created here before, or any Function that was not inspected for liveness. Actually, I think this comment is out of date. I'll remove it alltogether :-) > > + // Remove any incompatible attributes > > + RAttrs &= ~ParamAttr::typeIncompatible(NRetTy); > If they are incompatible, maybe this means the transform should not > be performed? This is what the old code did :-) Originally, this was mainly for removing attributes concerning the return type. Ie, if the return type was turned from i32 into void, a sext attribute can be safely removed. From looking at the typeIncompatible function, this only concerns attributes for integer and pointer types, so nothing for struct types. To make this safe for the future, I'll only remove those attributes when the new type is void, and assert nothing incompatible is present otherwise. > > + CallSite::arg_iterator I = CS.arg_begin(); > > + unsigned i = 0; > > + // Loop over those operands, corresponding to the normal arguments to the > > + // original function, and add those that are still alive. > > + for (unsigned e = FTy->getNumParams(); i != e; ++I, ++i) > > How about controlling the loop using I not i, i.e. define E = CS.arg_end() > and test I != E ? This breaks for varargs (in which case the CS has more arguments than the function has paramters). > > + for (CallSite::arg_iterator E = CS.arg_end(); I != E; ++I, ++i) { > I think you forgot to reset i to zero. Nope, this is again for the varargs case. I'll improve the comments :-) > > + /// Given an operand number, returns the argument that corresponds to it. > > + /// OperandNo must be a valid operand number that actually corresponds to an > > + /// argument. > > How about working with argument numbers rather than operand numbers? Then > this wouldn't be needed (and everything would start at 0). How do you mean this? The DAE pass is working with argument numbers internally, and that is exactly why I need this function (to get the argument number). In the particular case where I need this function, I need to find the argument number from a use_iterator, which only knows the operand number. > > + /// Returns the operand number of the first argument > > + unsigned getArgumentOffset() const { > How about marking this "inline"? Shouldn't the compiler notice this by itself? Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080703/2dc60a50/attachment.bin From clattner at apple.com Thu Jul 3 11:40:36 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 3 Jul 2008 09:40:36 -0700 Subject: [llvm-commits] [llvm] r53085 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp In-Reply-To: <20080703075005.GQ7287@katherina.student.utwente.nl> References: <200807030555.m635t38V011468@zion.cs.uiuc.edu> <1D3DA54A-B751-445A-AA74-1DD8D9CABE7C@apple.com> <20080703075005.GQ7287@katherina.student.utwente.nl> Message-ID: <04B48AD8-E380-4D36-BBFC-E26C5A7967A1@apple.com> On Jul 3, 2008, at 12:50 AM, Matthijs Kooijman wrote: > Hi Chris, > >> The advantage of this approach is that recalculation of domtree only >> happens if an unswitch happens. If you have: > On the other hand, it will then also happen if there are no other > passes > (directly) after loopunswitch that need dominfo...j You're right of course, which we can verify by looking at the pass ordering llvm-gcc happens to use. The right fix is to make unswitch update dominfo correctly. -Chris From clattner at apple.com Thu Jul 3 11:41:09 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 3 Jul 2008 09:41:09 -0700 Subject: [llvm-commits] [llvm] r53086 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp In-Reply-To: <200807030648.m636mMhm013293@zion.cs.uiuc.edu> References: <200807030648.m636mMhm013293@zion.cs.uiuc.edu> Message-ID: <6D7B4B7E-D217-4DCA-B73A-927027263328@apple.com> On Jul 2, 2008, at 11:48 PM, Devang Patel wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=53086&view=rev > Log: > Reconstruct dom info, if loop is unswitched. > > @@ -113,8 +113,8 @@ > AU.addRequiredID(LCSSAID); > AU.addPreservedID(LCSSAID); > // FIXME: Loop Unswitch does not preserve dominator info in > all cases. > + AU.addPreserved(); > + AU.addPreserved(); This fixme should go away? -Chris > > } > > private: > @@ -206,7 +206,6 @@ > DT = getAnalysisToUpdate(); > currentLoop = L; > bool Changed = false; > - > do { > assert(currentLoop->isLCSSAForm()); > redoLoop = false; > @@ -459,7 +458,13 @@ > } else { > UnswitchNontrivialCondition(LoopCond, Val, currentLoop); > } > - > + > + // FIXME: Reconstruct dom info, because it is not preserved > properly. > + Function *F = loopHeader->getParent(); > + if (DT) > + DT->runOnFunction(*F); > + if (DF) > + DF->runOnFunction(*F); > return true; > } > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Thu Jul 3 11:42:14 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 3 Jul 2008 09:42:14 -0700 Subject: [llvm-commits] [llvm] r53087 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp In-Reply-To: <200807030650.m636o59H013402@zion.cs.uiuc.edu> References: <200807030650.m636o59H013402@zion.cs.uiuc.edu> Message-ID: <1B21BF6E-DD04-46B0-9EEB-0F6A123F51D2@apple.com> On Jul 2, 2008, at 11:50 PM, Devang Patel wrote: > Author: dpatel > Date: Thu Jul 3 01:50:04 2008 > New Revision: 53087 > > URL: http://llvm.org/viewvc/llvm-project?rev=53087&view=rev > Log: > Remove extra FIXME :) Thanks. One other question: does the "trivial unswitch" code correctly update dom info? If so, it would be nice to not rebuild dom info when it happens. Also, is it possible to rebuild dom info a max of once per "runOnFunction" instead of once per unswitched loop? -Chris From clattner at apple.com Thu Jul 3 11:45:39 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 3 Jul 2008 09:45:39 -0700 Subject: [llvm-commits] [llvm] r53035 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <200807031106.15621.baldrick@free.fr> References: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> <3FFA1FED-6CE4-4669-8ABE-340E10AAD092@apple.com> <200807031106.15621.baldrick@free.fr> Message-ID: <599CE6E2-534B-4615-8816-BBC290BCD995@apple.com> On Jul 3, 2008, at 2:06 AM, Duncan Sands wrote: > Hi Evan, > >> test/CodeGen/PowerPC/vec_misaligned.ll is not crashing in the >> Legalizer. Can you check if your patch is the cause? > > it was caused by r53031: > > r53031 | wangmp | 2008-07-02 19:07:12 +0200 (Wed, 02 Jul 2008) | 4 > lines > > Fixed problem in EmitStackConvert where the source and target type > have different alignment by creating a stack slot with the max > alignment of source and target type. If this patch is still causing breakage, please revert it. Mon Ping can track down the problem and reapply when it is fixed. -Chris From clattner at apple.com Thu Jul 3 11:46:37 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 3 Jul 2008 09:46:37 -0700 Subject: [llvm-commits] [llvm] r52677 - in /llvm/trunk:?lib/Transforms/IPO/DeadArgumentElimination.cpp?test/Tra nsforms/DeadArgElim/2008-06-23-DeadAfterLive.ll?test/Transforms/Dead ArgElim/deadretval2.ll?test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: <20080703155235.GW7287@katherina.student.utwente.nl> References: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> <200807021822.38614.baldrick@free.fr> <20080703112004.GS7287@katherina.student.utwente.nl> <200807031403.39891.baldrick@free.fr> <20080703155235.GW7287@katherina.student.utwente.nl> Message-ID: <3210A703-D7EF-473F-87DC-89C93455A83D@apple.com> On Jul 3, 2008, at 8:52 AM, Matthijs Kooijman wrote: >>> >>> + /// Returns the operand number of the first argument >>> + unsigned getArgumentOffset() const { >> How about marking this "inline"? > Shouldn't the compiler notice this by itself? > All methods that are defined in the body of a class are implicitly inline. -Chris From resistor at mac.com Thu Jul 3 12:21:49 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 03 Jul 2008 17:21:49 -0000 Subject: [llvm-commits] [llvm] r53104 - in /llvm/trunk: lib/Transforms/Scalar/ADCE.cpp test/Transforms/ADCE/2008-07-02-Unreachable.ll Message-ID: <200807031721.m63HLoe7015760@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 3 12:21:41 2008 New Revision: 53104 URL: http://llvm.org/viewvc/llvm-project?rev=53104&view=rev Log: Remove the ability for ADCE to remove unreachable blocks in loop nests, because, as Eli pointed out, SimplifyCFG already does this. Removed: llvm/trunk/test/Transforms/ADCE/2008-07-02-Unreachable.ll Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=53104&r1=53103&r2=53104&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Thu Jul 3 12:21:41 2008 @@ -53,44 +53,6 @@ SmallPtrSet alive; SmallVector worklist; - SmallPtrSet reachable; - SmallVector unreachable; - - // First, collect the set of reachable blocks ... - for (df_ext_iterator > - DI = df_ext_begin(&F.getEntryBlock(), reachable), - DE = df_ext_end(&F.getEntryBlock(), reachable); DI != DE; ++DI) - ; // Deliberately empty, df_ext_iterator will fill in the set. - - // ... and then invert it into the list of unreachable ones. These - // blocks will be removed from the function. - for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ++FI) - if (!reachable.count(FI)) - unreachable.push_back(FI); - - // Prepare to remove blocks by removing the PHI node entries for those blocks - // in their successors, and remove them from reference counting. - for (SmallVector::iterator UI = unreachable.begin(), - UE = unreachable.end(); UI != UE; ++UI) { - BasicBlock* BB = *UI; - for (succ_iterator SI = succ_begin(BB), SE = succ_end(BB); - SI != SE; ++SI) { - BasicBlock* succ = *SI; - BasicBlock::iterator succ_inst = succ->begin(); - while (PHINode* P = dyn_cast(succ_inst)) { - P->removeIncomingValue(BB); - ++succ_inst; - } - } - - BB->dropAllReferences(); - } - - // Finally, erase the unreachable blocks. - for (SmallVector::iterator UI = unreachable.begin(), - UE = unreachable.end(); UI != UE; ++UI) - (*UI)->eraseFromParent(); - // Collect the set of "root" instructions that are known live. for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) if (isa(I.getInstructionIterator()) || Removed: llvm/trunk/test/Transforms/ADCE/2008-07-02-Unreachable.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ADCE/2008-07-02-Unreachable.ll?rev=53103&view=auto ============================================================================== --- llvm/trunk/test/Transforms/ADCE/2008-07-02-Unreachable.ll (original) +++ llvm/trunk/test/Transforms/ADCE/2008-07-02-Unreachable.ll (removed) @@ -1,37 +0,0 @@ -; RUN: llvm-as < %s | opt -adce -simplifycfg | llvm-dis | not grep forcond -; PR2509 - -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" -target triple = "i686-apple-darwin9.3.0" - at g_3 = external global i8 ; [#uses=2] - -define i32 @func_1() nounwind { -entry: - br i1 false, label %ifelse, label %ifthen - -ifthen: ; preds = %entry - br label %ifend - -ifelse: ; preds = %entry - %tmp3 = load i8* @g_3 ; [#uses=0] - br label %forcond.thread - -forcond.thread: ; preds = %ifelse - br label %afterfor - -forcond: ; preds = %forinc - br i1 false, label %afterfor, label %forbody - -forbody: ; preds = %forcond - br label %forinc - -forinc: ; preds = %forbody - br label %forcond - -afterfor: ; preds = %forcond, %forcond.thread - %tmp10 = load i8* @g_3 ; [#uses=0] - br label %ifend - -ifend: ; preds = %afterfor, %ifthen - ret i32 0 -} From dalej at apple.com Thu Jul 3 12:30:45 2008 From: dalej at apple.com (Dale Johannesen) Date: Thu, 03 Jul 2008 17:30:45 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53105 - /llvm-gcc-4.2/trunk/gcc/tree-inline.c Message-ID: <200807031730.m63HUljS016126@zion.cs.uiuc.edu> Author: johannes Date: Thu Jul 3 12:30:32 2008 New Revision: 53105 URL: http://llvm.org/viewvc/llvm-project?rev=53105&view=rev Log: Fix a bug in gcc's inliner; wasn't remapping the type of parameters with variably modified types, which refer to variables elsewhere in the callee; the references need to be remapped. This caused incorrect codegen with llvm, but not gcc, because of our greater use of array notation. gcc.c-torture/execute/pr22061-1.c Modified: llvm-gcc-4.2/trunk/gcc/tree-inline.c Modified: llvm-gcc-4.2/trunk/gcc/tree-inline.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-inline.c?rev=53105&r1=53104&r2=53105&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/tree-inline.c (original) +++ llvm-gcc-4.2/trunk/gcc/tree-inline.c Thu Jul 3 12:30:32 2008 @@ -1022,8 +1022,11 @@ /* If the parameter is never assigned to, we may not need to create a new variable here at all. Instead, we may be able to just use the argument value. */ +/* LLVM LOCAL begin fix handling of parameters with variably modified types */ + /* We need the copy if it has a variably modified type. */ if (TREE_READONLY (p) && !TREE_ADDRESSABLE (p) + && !variably_modified_type_p (TREE_TYPE (p), id->src_fn) && value && !TREE_SIDE_EFFECTS (value)) { /* We may produce non-gimple trees by adding NOPs or introduce @@ -1049,6 +1052,13 @@ function. */ var = copy_decl_to_var (p, id); + /* But, we must remap variably modified types, which depend on local + variables in this function and are NOT visible to the calling + function. */ + if (variably_modified_type_p (TREE_TYPE (p), id->src_fn)) + TREE_TYPE (var) = remap_type(TREE_TYPE (p), id); +/* LLVM LOCAL end fix handling of parameters with variably modified types */ + /* See if the frontend wants to pass this by invisible reference. If so, our new VAR_DECL will have REFERENCE_TYPE, and we need to replace uses of the PARM_DECL with dereferences. */ From dpatel at apple.com Thu Jul 3 12:37:52 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 03 Jul 2008 17:37:52 -0000 Subject: [llvm-commits] [llvm] r53106 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200807031737.m63HbrWB016421@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 3 12:37:52 2008 New Revision: 53106 URL: http://llvm.org/viewvc/llvm-project?rev=53106&view=rev Log: Do not try to update dominator info while manipulating CFG. This code does not handle all cases and keeps invalid dom info around some cases, which misleads other passes down stream. Right now, dom info is recaluclated in the end if the loop is switched. 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=53106&r1=53105&r2=53106&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Jul 3 12:37:52 2008 @@ -77,21 +77,13 @@ BasicBlock *loopHeader; BasicBlock *loopPreheader; - /// LoopDF - Loop's dominance frontier. This set is a collection of - /// loop exiting blocks' DF member blocks. However this does set does not - /// includes basic blocks that are inside loop. - SmallPtrSet LoopDF; - - /// OrigLoopExitMap - This is used to map loop exiting block with - /// corresponding loop exit block, before updating CFG. - DenseMap OrigLoopExitMap; - // LoopBlocks contains all of the basic blocks of the loop, including the // preheader of the loop, the body of the loop, and the exit blocks of the // loop, in that order. std::vector LoopBlocks; // NewBlocks contained cloned copy of basic blocks from LoopBlocks. std::vector NewBlocks; + public: static char ID; // Pass ID, replacement for typeid explicit LoopUnswitch(bool Os = false) : @@ -134,14 +126,8 @@ /// Split all of the edges from inside the loop to their exit blocks. /// Update the appropriate Phi nodes as we do so. - void SplitExitEdges(Loop *L, const SmallVector &ExitBlocks, - SmallVector &MiddleBlocks); + void SplitExitEdges(Loop *L, const SmallVector &ExitBlocks); - /// If BB's dominance frontier has a member that is not part of loop L then - /// remove it. Add NewDFMember in BB's dominance frontier. - void ReplaceLoopExternalDFMember(Loop *L, BasicBlock *BB, - BasicBlock *NewDFMember); - bool UnswitchIfProfitable(Value *LoopCond, Constant *Val); unsigned getLoopUnswitchCost(Value *LIC); void UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val, @@ -480,87 +466,6 @@ } } -// CloneDomInfo - NewBB is cloned from Orig basic block. Now clone Dominator -// Info. -// -// If Orig block's immediate dominator is mapped in VM then use corresponding -// immediate dominator from the map. Otherwise Orig block's dominator is also -// NewBB's dominator. -// -// OrigPreheader is loop pre-header before this pass started -// updating CFG. NewPrehader is loops new pre-header. However, after CFG -// manipulation, loop L may not exist. So rely on input parameter NewPreheader. -static void CloneDomInfo(BasicBlock *NewBB, BasicBlock *Orig, - BasicBlock *NewPreheader, BasicBlock *OrigPreheader, - BasicBlock *OrigHeader, - DominatorTree *DT, DominanceFrontier *DF, - DenseMap &VM) { - - // If NewBB alreay has found its place in domiantor tree then no need to do - // anything. - if (DT->getNode(NewBB)) - return; - - // If Orig does not have any immediate domiantor then its clone, NewBB, does - // not need any immediate dominator. - DomTreeNode *OrigNode = DT->getNode(Orig); - if (!OrigNode) - return; - DomTreeNode *OrigIDomNode = OrigNode->getIDom(); - if (!OrigIDomNode) - return; - - BasicBlock *OrigIDom = NULL; - - // If Orig is original loop header then its immediate dominator is - // NewPreheader. - if (Orig == OrigHeader) - OrigIDom = NewPreheader; - - // If Orig is new pre-header then its immediate dominator is - // original pre-header. - else if (Orig == NewPreheader) - OrigIDom = OrigPreheader; - - // Otherwise ask DT to find Orig's immediate dominator. - else - OrigIDom = OrigIDomNode->getBlock(); - - // Initially use Orig's immediate dominator as NewBB's immediate dominator. - BasicBlock *NewIDom = OrigIDom; - DenseMap::iterator I = VM.find(OrigIDom); - if (I != VM.end()) { - NewIDom = cast(I->second); - - // If NewIDom does not have corresponding dominatore tree node then - // get one. - if (!DT->getNode(NewIDom)) - CloneDomInfo(NewIDom, OrigIDom, NewPreheader, OrigPreheader, - OrigHeader, DT, DF, VM); - } - - DT->addNewBlock(NewBB, NewIDom); - - // Copy cloned dominance frontiner set - DominanceFrontier::DomSetType NewDFSet; - if (DF) { - DominanceFrontier::iterator DFI = DF->find(Orig); - if ( DFI != DF->end()) { - DominanceFrontier::DomSetType S = DFI->second; - for (DominanceFrontier::DomSetType::iterator I = S.begin(), E = S.end(); - I != E; ++I) { - BasicBlock *BB = *I; - DenseMap::iterator IDM = VM.find(BB); - if (IDM != VM.end()) - NewDFSet.insert(cast(IDM->second)); - else - NewDFSet.insert(BB); - } - } - DF->addBasicBlock(NewBB, NewDFSet); - } -} - /// CloneLoop - Recursively clone the specified loop and all of its children, /// mapping the blocks with the specified map. static Loop *CloneLoop(Loop *L, Loop *PL, DenseMap &VM, @@ -602,7 +507,6 @@ BranchInst::Create(TrueDest, FalseDest, BranchVal, InsertPt); } - /// UnswitchTrivialCondition - Given a loop that has a trivial unswitchable /// condition in it (a cond branch from its header block to its latch block, /// where the path through the loop that doesn't execute its body has no @@ -636,27 +540,6 @@ // insert the new conditional branch. EmitPreheaderBranchOnCondition(Cond, Val, NewExit, NewPH, loopPreheader->getTerminator()); - if (DT) { - DT->changeImmediateDominator(NewExit, loopPreheader); - DT->changeImmediateDominator(NewPH, loopPreheader); - } - - if (DF) { - // NewExit is now part of NewPH and Loop Header's dominance - // frontier. - DominanceFrontier::iterator DFI = DF->find(NewPH); - if (DFI != DF->end()) - DF->addToFrontier(DFI, NewExit); - DFI = DF->find(loopHeader); - DF->addToFrontier(DFI, NewExit); - - // ExitBlock does not have successors then NewExit is part of - // its dominance frontier. - if (succ_begin(ExitBlock) == succ_end(ExitBlock)) { - DFI = DF->find(ExitBlock); - DF->addToFrontier(DFI, NewExit); - } - } LPM->deleteSimpleAnalysisValue(loopPreheader->getTerminator(), L); loopPreheader->getTerminator()->eraseFromParent(); @@ -670,93 +553,52 @@ ++NumTrivial; } -/// ReplaceLoopExternalDFMember - -/// If BB's dominance frontier has a member that is not part of loop L then -/// remove it. Add NewDFMember in BB's dominance frontier. -void LoopUnswitch::ReplaceLoopExternalDFMember(Loop *L, BasicBlock *BB, - BasicBlock *NewDFMember) { - - DominanceFrontier::iterator DFI = DF->find(BB); - if (DFI == DF->end()) - return; - - DominanceFrontier::DomSetType &DFSet = DFI->second; - for (DominanceFrontier::DomSetType::iterator DI = DFSet.begin(), - DE = DFSet.end(); DI != DE;) { - BasicBlock *B = *DI++; - if (L->contains(B)) - continue; - - DF->removeFromFrontier(DFI, B); - LoopDF.insert(B); - } - - DF->addToFrontier(DFI, NewDFMember); -} - /// SplitExitEdges - Split all of the edges from inside the loop to their exit /// blocks. Update the appropriate Phi nodes as we do so. void LoopUnswitch::SplitExitEdges(Loop *L, - const SmallVector &ExitBlocks, - SmallVector &MiddleBlocks) { + const SmallVector &ExitBlocks) +{ for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) { BasicBlock *ExitBlock = ExitBlocks[i]; std::vector Preds(pred_begin(ExitBlock), pred_end(ExitBlock)); for (unsigned j = 0, e = Preds.size(); j != e; ++j) { - BasicBlock* MiddleBlock = SplitEdge(Preds[j], ExitBlock, this); - MiddleBlocks.push_back(MiddleBlock); + BasicBlock* NewExitBlock = SplitEdge(Preds[j], ExitBlock, this); BasicBlock* StartBlock = Preds[j]; BasicBlock* EndBlock; - if (MiddleBlock->getSinglePredecessor() == ExitBlock) { - EndBlock = MiddleBlock; - MiddleBlock = EndBlock->getSinglePredecessor();; + if (NewExitBlock->getSinglePredecessor() == ExitBlock) { + EndBlock = NewExitBlock; + NewExitBlock = EndBlock->getSinglePredecessor();; } else { EndBlock = ExitBlock; } - OrigLoopExitMap[StartBlock] = EndBlock; - std::set InsertedPHIs; PHINode* OldLCSSA = 0; for (BasicBlock::iterator I = EndBlock->begin(); (OldLCSSA = dyn_cast(I)); ++I) { - Value* OldValue = OldLCSSA->getIncomingValueForBlock(MiddleBlock); + Value* OldValue = OldLCSSA->getIncomingValueForBlock(NewExitBlock); PHINode* NewLCSSA = PHINode::Create(OldLCSSA->getType(), OldLCSSA->getName() + ".us-lcssa", - MiddleBlock->getTerminator()); + NewExitBlock->getTerminator()); NewLCSSA->addIncoming(OldValue, StartBlock); - OldLCSSA->setIncomingValue(OldLCSSA->getBasicBlockIndex(MiddleBlock), + OldLCSSA->setIncomingValue(OldLCSSA->getBasicBlockIndex(NewExitBlock), NewLCSSA); InsertedPHIs.insert(NewLCSSA); } BasicBlock::iterator InsertPt = EndBlock->getFirstNonPHI(); - for (BasicBlock::iterator I = MiddleBlock->begin(); + for (BasicBlock::iterator I = NewExitBlock->begin(); (OldLCSSA = dyn_cast(I)) && InsertedPHIs.count(OldLCSSA) == 0; ++I) { PHINode *NewLCSSA = PHINode::Create(OldLCSSA->getType(), OldLCSSA->getName() + ".us-lcssa", InsertPt); OldLCSSA->replaceAllUsesWith(NewLCSSA); - NewLCSSA->addIncoming(OldLCSSA, MiddleBlock); + NewLCSSA->addIncoming(OldLCSSA, NewExitBlock); } - if (DF && DT) { - // StartBlock -- > MiddleBlock -- > EndBlock - // StartBlock is loop exiting block. EndBlock will become merge point - // of two loop exits after loop unswitch. - - // If StartBlock's DF member includes a block that is not loop member - // then replace that DF member with EndBlock. - - // If MiddleBlock's DF member includes a block that is not loop member - // tnen replace that DF member with EndBlock. - - ReplaceLoopExternalDFMember(L, StartBlock, EndBlock); - ReplaceLoopExternalDFMember(L, MiddleBlock, EndBlock); - } } } @@ -789,8 +631,7 @@ // Split all of the edges from inside the loop to their exit blocks. Update // the appropriate Phi nodes as we do so. - SmallVector MiddleBlocks; - SplitExitEdges(L, ExitBlocks, MiddleBlocks); + SplitExitEdges(L, ExitBlocks); // The exit blocks may have been changed due to edge splitting, recompute. ExitBlocks.clear(); @@ -811,21 +652,6 @@ LPM->cloneBasicBlockSimpleAnalysis(LoopBlocks[i], New, L); } - // OutSiders are basic block that are dominated by original header and - // at the same time they are not part of loop. - SmallPtrSet OutSiders; - if (DT) { - DomTreeNode *OrigHeaderNode = DT->getNode(loopHeader); - for(std::vector::iterator DI = OrigHeaderNode->begin(), - DE = OrigHeaderNode->end(); DI != DE; ++DI) { - BasicBlock *B = (*DI)->getBlock(); - - DenseMap::iterator VI = ValueMap.find(B); - if (VI == ValueMap.end()) - OutSiders.insert(B); - } - } - // Splice the newly inserted blocks into the function right before the // original preheader. F->getBasicBlockList().splice(LoopBlocks[0], F->getBasicBlockList(), @@ -849,7 +675,7 @@ assert(NewExit->getTerminator()->getNumSuccessors() == 1 && "Exit block should have been split to have one successor!"); BasicBlock *ExitSucc = NewExit->getTerminator()->getSuccessor(0); - + // If the successor of the exit block had PHI nodes, add an entry for // NewExit. PHINode *PN; @@ -878,94 +704,6 @@ LPM->deleteSimpleAnalysisValue(OldBR, L); OldBR->eraseFromParent(); - // Update dominator info - if (DF && DT) { - - SmallVector ExitingBlocks; - L->getExitingBlocks(ExitingBlocks); - - // Clone dominator info for all cloned basic block. - for (unsigned i = 0, e = LoopBlocks.size(); i != e; ++i) { - BasicBlock *LBB = LoopBlocks[i]; - BasicBlock *NBB = NewBlocks[i]; - CloneDomInfo(NBB, LBB, NewPreheader, loopPreheader, - loopHeader, DT, DF, ValueMap); - - // If LBB's dominance frontier includes DFMember - // such that DFMember is also a member of LoopDF then - // - Remove DFMember from LBB's dominance frontier - // - Copy loop exiting blocks', that are dominated by BB, - // dominance frontier member in BB's dominance frontier - - DominanceFrontier::iterator LBBI = DF->find(LBB); - DominanceFrontier::iterator NBBI = DF->find(NBB); - if (LBBI == DF->end()) - continue; - - DominanceFrontier::DomSetType &LBSet = LBBI->second; - for (DominanceFrontier::DomSetType::iterator LI = LBSet.begin(), - LE = LBSet.end(); LI != LE; /* NULL */) { - BasicBlock *B = *LI++; - if (B == LBB && B == loopHeader) - continue; - bool removeB = false; - if (!LoopDF.count(B)) - continue; - - // If LBB dominates loop exits then insert loop exit block's DF - // into B's DF. - for(SmallVector::iterator - LExitI = ExitingBlocks.begin(), - LExitE = ExitingBlocks.end(); LExitI != LExitE; ++LExitI) { - BasicBlock *E = *LExitI; - - if (!DT->dominates(LBB,E)) - continue; - - DenseMap::iterator DFBI = - OrigLoopExitMap.find(E); - if (DFBI == OrigLoopExitMap.end()) - continue; - - BasicBlock *DFB = DFBI->second; - DF->addToFrontier(LBBI, DFB); - DF->addToFrontier(NBBI, DFB); - removeB = true; - } - - // If B's replacement is inserted in DF then now is the time to remove - // B. - if (removeB) { - DF->removeFromFrontier(LBBI, B); - if (L->contains(B)) - DF->removeFromFrontier(NBBI, cast(ValueMap[B])); - else - DF->removeFromFrontier(NBBI, B); - } - } - - } - - // MiddleBlocks are dominated by original pre header. SplitEdge updated - // MiddleBlocks' dominance frontier appropriately. - for (unsigned i = 0, e = MiddleBlocks.size(); i != e; ++i) { - BasicBlock *MBB = MiddleBlocks[i]; - if (!MBB->getSinglePredecessor()) - DT->changeImmediateDominator(MBB, loopPreheader); - } - - // All Outsiders are now dominated by original pre header. - for (SmallPtrSet::iterator OI = OutSiders.begin(), - OE = OutSiders.end(); OI != OE; ++OI) { - BasicBlock *OB = *OI; - DT->changeImmediateDominator(OB, loopPreheader); - } - - // New loop headers are dominated by original preheader - DT->changeImmediateDominator(NewBlocks[0], loopPreheader); - DT->changeImmediateDominator(LoopBlocks[0], loopPreheader); - } - LoopProcessWorklist.push_back(NewLoop); redoLoop = true; @@ -977,6 +715,7 @@ // deleted. If so, don't simplify it. if (!LoopProcessWorklist.empty() && LoopProcessWorklist.back() == NewLoop) RewriteLoopBodyWithConditionConstant(NewLoop, LIC, Val, true); + } /// RemoveFromWorklist - Remove all instances of I from the worklist vector @@ -1130,8 +869,6 @@ RemoveLoopFromWorklist(L); } - - // RewriteLoopBodyWithConditionConstant - We know either that the value LIC has // the value specified by Val in the specified loop, or we know it does NOT have // that value. Rewrite any uses of LIC or of properties correlated to it. @@ -1193,18 +930,19 @@ // trying to update it is complicated. So instead we preserve the // loop structure and put the block on an dead code path. + BasicBlock *SISucc = SI->getSuccessor(i); BasicBlock* Old = SI->getParent(); BasicBlock* Split = SplitBlock(Old, SI, this); Instruction* OldTerm = Old->getTerminator(); - BranchInst::Create(Split, SI->getSuccessor(i), + BranchInst::Create(Split, SISucc, ConstantInt::getTrue(), OldTerm); LPM->deleteSimpleAnalysisValue(Old->getTerminator(), L); Old->getTerminator()->eraseFromParent(); PHINode *PN; - for (BasicBlock::iterator II = SI->getSuccessor(i)->begin(); + for (BasicBlock::iterator II = SISucc->begin(); (PN = dyn_cast(II)); ++II) { Value *InVal = PN->removeIncomingValue(Split, false); PN->addIncoming(InVal, Old); From resistor at mac.com Thu Jul 3 12:44:34 2008 From: resistor at mac.com (Owen Anderson) Date: Thu, 03 Jul 2008 17:44:34 -0000 Subject: [llvm-commits] [llvm] r53108 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp Message-ID: <200807031744.m63HiYjW016703@zion.cs.uiuc.edu> Author: resistor Date: Thu Jul 3 12:44:33 2008 New Revision: 53108 URL: http://llvm.org/viewvc/llvm-project?rev=53108&view=rev Log: Use information already present in the ValueTable to fast-fail when we know there won't be a value number match. This speeds up GVN on a case where there are very few redundancies by ~25%. Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=53108&r1=53107&r2=53108&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Thu Jul 3 12:44:33 2008 @@ -166,6 +166,7 @@ void setAliasAnalysis(AliasAnalysis* A) { AA = A; } void setMemDep(MemoryDependenceAnalysis* M) { MD = M; } void setDomTree(DominatorTree* D) { DT = D; } + uint32_t getNextUnusedValueNumber() { return nextValueNumber; } }; } @@ -1058,11 +1059,12 @@ return changed; } + uint32_t nextNum = VN.getNextUnusedValueNumber(); unsigned num = VN.lookup_or_add(I); // Allocations are always uniquely numbered, so we can save time and memory // by fast failing them. - if (isa(I)) { + if (isa(I) || isa(I)) { localAvail[I->getParent()]->table.insert(std::make_pair(num, I)); return false; } @@ -1082,6 +1084,13 @@ } else { localAvail[I->getParent()]->table.insert(std::make_pair(num, I)); } + + // If the number we were assigned was a brand new VN, then we don't + // need to do a lookup to see if the number already exists + // somewhere in the domtree: it can't! + } else if (num == nextNum) { + localAvail[I->getParent()]->table.insert(std::make_pair(num, I)); + // Perform value-number based elimination } else if (Value* repl = lookupNumber(I->getParent(), num)) { // Remove it! @@ -1092,7 +1101,7 @@ I->replaceAllUsesWith(repl); toErase.push_back(I); return true; - } else if (!I->isTerminator()) { + } else { localAvail[I->getParent()]->table.insert(std::make_pair(num, I)); } From evan.cheng at apple.com Thu Jul 3 13:10:54 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 3 Jul 2008 11:10:54 -0700 Subject: [llvm-commits] [llvm] r53091 - /llvm/trunk/lib/Target/X86/X86Subtarget.cpp In-Reply-To: <200807030743.m637hEvn019100@zion.cs.uiuc.edu> References: <200807030743.m637hEvn019100@zion.cs.uiuc.edu> Message-ID: <85F97352-DF48-4023-8F45-CF63FEBD983C@apple.com> Hi Anton, This broke x86-64-pic-8.ll. Can you take a look? I'll back it out for now. Thanks, Evan On Jul 3, 2008, at 12:43 AM, Anton Korobeynikov wrote: > Author: asl > Date: Thu Jul 3 02:43:14 2008 > New Revision: 53091 > > URL: http://llvm.org/viewvc/llvm-project?rev=53091&view=rev > Log: > llvm-gcc sometimes marks external declarations hidden, because > intializers are > processed separately. Honour such situation and emit PIC relocations > properly > in such case. > > Modified: > llvm/trunk/lib/Target/X86/X86Subtarget.cpp > > Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=53091&r1=53090&r2=53091&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Thu Jul 3 02:43:14 > 2008 > @@ -47,7 +47,8 @@ > // Extra load is needed for all externally visible. > if (isDirectCall) > return false; > - if (GV->hasInternalLinkage() || GV->hasHiddenVisibility()) > + if (GV->hasInternalLinkage() || > + (GV->hasHiddenVisibility() && !GV->isDeclaration())) > return false; > return true; > } else if (isTargetCygMing() || isTargetWindows()) { > > > _______________________________________________ > 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 Thu Jul 3 13:11:29 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 03 Jul 2008 18:11:29 -0000 Subject: [llvm-commits] [llvm] r53109 - /llvm/trunk/lib/Target/X86/X86Subtarget.cpp Message-ID: <200807031811.m63IBTdR017741@zion.cs.uiuc.edu> Author: evancheng Date: Thu Jul 3 13:11:29 2008 New Revision: 53109 URL: http://llvm.org/viewvc/llvm-project?rev=53109&view=rev Log: Back out 53091 for now. Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp Modified: llvm/trunk/lib/Target/X86/X86Subtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86Subtarget.cpp?rev=53109&r1=53108&r2=53109&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86Subtarget.cpp (original) +++ llvm/trunk/lib/Target/X86/X86Subtarget.cpp Thu Jul 3 13:11:29 2008 @@ -47,8 +47,7 @@ // Extra load is needed for all externally visible. if (isDirectCall) return false; - if (GV->hasInternalLinkage() || - (GV->hasHiddenVisibility() && !GV->isDeclaration())) + if (GV->hasInternalLinkage() || GV->hasHiddenVisibility()) return false; return true; } else if (isTargetCygMing() || isTargetWindows()) { From evan.cheng at apple.com Thu Jul 3 13:20:15 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 03 Jul 2008 18:20:15 -0000 Subject: [llvm-commits] [llvm] r53110 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200807031820.m63IKFdN018086@zion.cs.uiuc.edu> Author: evancheng Date: Thu Jul 3 13:20:14 2008 New Revision: 53110 URL: http://llvm.org/viewvc/llvm-project?rev=53110&view=rev Log: Backed out 53031. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=53110&r1=53109&r2=53110&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Thu Jul 3 13:20:14 2008 @@ -589,9 +589,8 @@ void dump() const; /// CreateStackTemporary - Create a stack temporary, suitable for holding the - /// specified value type. If minAlign is specified, the slot size will have - /// at least that alignment. - SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1); + /// specified value type. + SDOperand CreateStackTemporary(MVT VT); /// FoldSetCC - Constant fold a setcc to true or false. SDOperand FoldSetCC(MVT VT, SDOperand N1, Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=53110&r1=53109&r2=53110&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Jul 3 13:20:14 2008 @@ -4871,41 +4871,35 @@ MVT SlotVT, MVT DestVT) { // Create the stack frame object. - unsigned SrcAlign = TLI.getTargetData()->getPrefTypeAlignment( - SrcOp.getValueType().getTypeForMVT()); - SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT, SrcAlign); - + SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT); + FrameIndexSDNode *StackPtrFI = cast(FIPtr); int SPFI = StackPtrFI->getIndex(); - + unsigned SrcSize = SrcOp.getValueType().getSizeInBits(); unsigned SlotSize = SlotVT.getSizeInBits(); unsigned DestSize = DestVT.getSizeInBits(); - const Type* SlotTy = SlotVT.getTypeForMVT(); - unsigned SlotAlign = TLI.getTargetData()->getPrefTypeAlignment(SlotTy); // Emit a store to the stack slot. Use a truncstore if the input value is // later than DestVT. SDOperand Store; - if (SrcSize > SlotSize) Store = DAG.getTruncStore(DAG.getEntryNode(), SrcOp, FIPtr, - PseudoSourceValue::getFixedStack(), SPFI, SlotVT, - false, SlotAlign); + PseudoSourceValue::getFixedStack(), + SPFI, SlotVT); else { assert(SrcSize == SlotSize && "Invalid store"); Store = DAG.getStore(DAG.getEntryNode(), SrcOp, FIPtr, - PseudoSourceValue::getFixedStack(), SPFI, - false, SlotAlign); + PseudoSourceValue::getFixedStack(), + SPFI); } // Result is a load from the stack slot. if (SlotSize == DestSize) - return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0, false, SlotAlign); + return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0); assert(SlotSize < DestSize && "Unknown extension!"); - return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT, - false, SlotAlign); + return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT); } SDOperand SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(SDNode *Node) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=53110&r1=53109&r2=53110&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Jul 3 13:20:14 2008 @@ -1080,17 +1080,16 @@ /// CreateStackTemporary - Create a stack temporary, suitable for holding the /// specified value type. -SDOperand SelectionDAG::CreateStackTemporary(MVT VT, unsigned minAlign) { +SDOperand SelectionDAG::CreateStackTemporary(MVT VT) { MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo(); unsigned ByteSize = VT.getSizeInBits()/8; const Type *Ty = VT.getTypeForMVT(); - unsigned StackAlign = - std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty), minAlign); - + unsigned StackAlign = (unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty); int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign); return getFrameIndex(FrameIdx, TLI.getPointerTy()); } + SDOperand SelectionDAG::FoldSetCC(MVT VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond) { // These setcc operations always fold. From evan.cheng at apple.com Thu Jul 3 13:20:30 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 3 Jul 2008 11:20:30 -0700 Subject: [llvm-commits] [llvm] r53035 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <599CE6E2-534B-4615-8816-BBC290BCD995@apple.com> References: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> <3FFA1FED-6CE4-4669-8ABE-340E10AAD092@apple.com> <200807031106.15621.baldrick@free.fr> <599CE6E2-534B-4615-8816-BBC290BCD995@apple.com> Message-ID: This is backed out for now. Mon Ping, please take a look. Evan On Jul 3, 2008, at 9:45 AM, Chris Lattner wrote: > > On Jul 3, 2008, at 2:06 AM, Duncan Sands wrote: > >> Hi Evan, >> >>> test/CodeGen/PowerPC/vec_misaligned.ll is not crashing in the >>> Legalizer. Can you check if your patch is the cause? >> >> it was caused by r53031: >> >> r53031 | wangmp | 2008-07-02 19:07:12 +0200 (Wed, 02 Jul 2008) | 4 >> lines >> >> Fixed problem in EmitStackConvert where the source and target type >> have different alignment by creating a stack slot with the max >> alignment of source and target type. > > If this patch is still causing breakage, please revert it. Mon Ping > can track down the problem and reapply when it is fixed. > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From isanbard at gmail.com Thu Jul 3 13:23:43 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 03 Jul 2008 18:23:43 -0000 Subject: [llvm-commits] [llvm] r53111 - /llvm/tags/Apple/llvmCore-2052/ Message-ID: <200807031823.m63INhBK018243@zion.cs.uiuc.edu> Author: void Date: Thu Jul 3 13:23:43 2008 New Revision: 53111 URL: http://llvm.org/viewvc/llvm-project?rev=53111&view=rev Log: Creating llvmCore-2052 branch Added: llvm/tags/Apple/llvmCore-2052/ - copied from r53110, llvm/trunk/ From isanbard at gmail.com Thu Jul 3 13:23:49 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 03 Jul 2008 18:23:49 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53112 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2052/ Message-ID: <200807031823.m63INn5S018256@zion.cs.uiuc.edu> Author: void Date: Thu Jul 3 13:23:49 2008 New Revision: 53112 URL: http://llvm.org/viewvc/llvm-project?rev=53112&view=rev Log: Creating llvmgcc42-2052 branch Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2052/ - copied from r53111, llvm-gcc-4.2/trunk/ From asl at math.spbu.ru Thu Jul 3 13:26:35 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Thu, 03 Jul 2008 22:26:35 +0400 Subject: [llvm-commits] [llvm] r53091 - /llvm/trunk/lib/Target/X86/X86Subtarget.cpp In-Reply-To: <85F97352-DF48-4023-8F45-CF63FEBD983C@apple.com> References: <200807030743.m637hEvn019100@zion.cs.uiuc.edu> <85F97352-DF48-4023-8F45-CF63FEBD983C@apple.com> Message-ID: <1215109595.13608.1.camel@localhost> Hi, Evan > This broke x86-64-pic-8.ll. Can you take a look? I'll back it out for > now. I just reverted part of behaviour, which was pre-June. This, for example, fixed build of Qt in hared mode. I'll have a look, however, I'm pretty sure, that test needs to be fixed. -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From bruno.cardoso at gmail.com Thu Jul 3 14:58:07 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Thu, 3 Jul 2008 16:58:07 -0300 Subject: [llvm-commits] [llvm-gcc] [PATCH] psp allegrex support In-Reply-To: <9855FDB0-75FB-4E38-A652-E8293E516A96@apple.com> References: <275e64e40806271205g5a3bef98n4418589f3b97a415@mail.gmail.com> <275e64e40806271206u48935983y817593a594437c9e@mail.gmail.com> <6D59F959-FA2B-4033-BE1E-ED421E833D7D@apple.com> <275e64e40806271405n15bc821bk41d6fe7f438442ee@mail.gmail.com> <275e64e40806280011u70341c5cr69865580f98e4e91@mail.gmail.com> <275e64e40806280021h497d4844i6d4545af38e500f0@mail.gmail.com> <9855FDB0-75FB-4E38-A652-E8293E516A96@apple.com> Message-ID: <275e64e40807031258p1e82f23v2c83b98fc49fb17f@mail.gmail.com> New patch version. Eric, what do you think? -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." -------------- next part -------------- A non-text attachment was scrubbed... Name: allegrex.patch Type: application/octet-stream Size: 6639 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080703/562a47a7/attachment.obj From monping at apple.com Thu Jul 3 15:09:57 2008 From: monping at apple.com (Mon P Wang) Date: Thu, 3 Jul 2008 13:09:57 -0700 Subject: [llvm-commits] [llvm] r53035 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: References: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> <3FFA1FED-6CE4-4669-8ABE-340E10AAD092@apple.com> <200807031106.15621.baldrick@free.fr> <599CE6E2-534B-4615-8816-BBC290BCD995@apple.com> Message-ID: <320689A9-CF1D-451C-9AB0-31B3737AD1CE@apple.com> Thanks, I'll take a look and see what is wrong with it. -- Mon Ping On Jul 3, 2008, at 11:20 AM, Evan Cheng wrote: > This is backed out for now. Mon Ping, please take a look. > > Evan > > On Jul 3, 2008, at 9:45 AM, Chris Lattner wrote: > >> >> On Jul 3, 2008, at 2:06 AM, Duncan Sands wrote: >> >>> Hi Evan, >>> >>>> test/CodeGen/PowerPC/vec_misaligned.ll is not crashing in the >>>> Legalizer. Can you check if your patch is the cause? >>> >>> it was caused by r53031: >>> >>> r53031 | wangmp | 2008-07-02 19:07:12 +0200 (Wed, 02 Jul 2008) | 4 >>> lines >>> >>> Fixed problem in EmitStackConvert where the source and target type >>> have different alignment by creating a stack slot with the max >>> alignment of source and target type. >> >> If this patch is still causing breakage, please revert it. Mon Ping >> can track down the problem and reapply when it is fixed. >> >> -Chris >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dpatel at apple.com Thu Jul 3 17:09:24 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 03 Jul 2008 22:09:24 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53113 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h Message-ID: <200807032209.m63M9OE7026032@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 3 17:09:23 2008 New Revision: 53113 URL: http://llvm.org/viewvc/llvm-project?rev=53113&view=rev Log: Supply -mllvm to the linker. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=53113&r1=53112&r2=53113&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Thu Jul 3 17:09:23 2008 @@ -390,6 +390,9 @@ %{!mmacosx-version-min=*:-macosx_version_min %(darwin_minversion)} \ %{mmacosx-version-min=*:-macosx_version_min %*} \ "/* APPLE LOCAL end mainline 2007-02-20 5005743 */" \ + "/* APPLE LOCAL begin llvm */" \ + %{Zmllvm*:-mllvm %*} \ + "/* APPLE LOCAL end llvm */" \ %{nomultidefs} \ %{Zmulti_module:-multi_module} %{Zsingle_module:-single_module} \ %{Zmultiply_defined*:-multiply_defined %*} \ From kremenek at apple.com Thu Jul 3 17:26:23 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 03 Jul 2008 22:26:23 -0000 Subject: [llvm-commits] [llvm] r53116 - /llvm/tags/checker/checker-56/ Message-ID: <200807032226.m63MQNNm026541@zion.cs.uiuc.edu> Author: kremenek Date: Thu Jul 3 17:26:23 2008 New Revision: 53116 URL: http://llvm.org/viewvc/llvm-project?rev=53116&view=rev Log: Tagging checker-56. Added: llvm/tags/checker/checker-56/ - copied from r53115, llvm/trunk/ From dpatel at apple.com Thu Jul 3 17:53:14 2008 From: dpatel at apple.com (Devang Patel) Date: Thu, 03 Jul 2008 22:53:14 -0000 Subject: [llvm-commits] [llvm] r53119 - in /llvm/trunk: include/llvm-c/lto.h tools/lto/LTOCodeGenerator.cpp tools/lto/LTOCodeGenerator.h tools/lto/lto.cpp Message-ID: <200807032253.m63MrEH5027588@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 3 17:53:14 2008 New Revision: 53119 URL: http://llvm.org/viewvc/llvm-project?rev=53119&view=rev Log: Provide a hook to set the code generation debug options to investigate lto failures. Modified: llvm/trunk/include/llvm-c/lto.h llvm/trunk/tools/lto/LTOCodeGenerator.cpp llvm/trunk/tools/lto/LTOCodeGenerator.h llvm/trunk/tools/lto/lto.cpp Modified: llvm/trunk/include/llvm-c/lto.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/lto.h?rev=53119&r1=53118&r2=53119&view=diff ============================================================================== --- llvm/trunk/include/llvm-c/lto.h (original) +++ llvm/trunk/include/llvm-c/lto.h Thu Jul 3 17:53:14 2008 @@ -227,6 +227,11 @@ lto_codegen_compile(lto_code_gen_t cg, size_t* length); +/** + * Sets options to help debug codegen bugs. + */ +extern void +lto_codegen_debug_options(lto_code_gen_t cg, const char *); #ifdef __cplusplus } #endif Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=53119&r1=53118&r2=53119&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Thu Jul 3 17:53:14 2008 @@ -40,6 +40,7 @@ #include "llvm/Target/TargetAsmInfo.h" #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/Scalar.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/Config/config.h" @@ -116,7 +117,6 @@ return true; } - void LTOCodeGenerator::addMustPreserveSymbol(const char* sym) { _mustPreserveSymbols[sym] = 1; @@ -334,6 +334,18 @@ break; } + for (unsigned opt_index = 0, opt_size = _codegenOptions.size(); + opt_index < opt_size; ++opt_index) { + std::vector cgOpts; + std::string &optString = _codegenOptions[opt_index]; + for (std::string Opt = getToken(optString); + !Opt.empty(); Opt = getToken(optString)) + cgOpts.push_back(Opt.c_str()); + + int pseudo_argc = cgOpts.size()-1; + cl::ParseCommandLineOptions(pseudo_argc, (char**)&cgOpts[0]); + } + // Instantiate the pass manager to organize the passes. PassManager passes; Modified: llvm/trunk/tools/lto/LTOCodeGenerator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.h?rev=53119&r1=53118&r2=53119&view=diff ============================================================================== --- llvm/trunk/tools/lto/LTOCodeGenerator.h (original) +++ llvm/trunk/tools/lto/LTOCodeGenerator.h Thu Jul 3 17:53:14 2008 @@ -17,6 +17,7 @@ #include "llvm/Linker.h" #include "llvm/ADT/StringMap.h" +#include "llvm/ADT/SmallVector.h" #include @@ -38,7 +39,9 @@ bool writeMergedModules(const char* path, std::string& errMsg); const void* compile(size_t* length, std::string& errMsg); - + void setCodeGenDebugOptions(const char *opts) { + _codegenOptions.push_back(std::string(opts)); + } private: bool generateAssemblyCode(std::ostream& out, std::string& errMsg); @@ -56,6 +59,7 @@ lto_codegen_model _codeModel; StringSet _mustPreserveSymbols; llvm::MemoryBuffer* _nativeObjectFile; + llvm::SmallVector _codegenOptions; }; #endif // LTO_CODE_GENERATOR_H Modified: llvm/trunk/tools/lto/lto.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/lto.cpp?rev=53119&r1=53118&r2=53119&view=diff ============================================================================== --- llvm/trunk/tools/lto/lto.cpp (original) +++ llvm/trunk/tools/lto/lto.cpp Thu Jul 3 17:53:14 2008 @@ -237,5 +237,11 @@ return cg->compile(length, sLastErrorString); } +extern void +lto_codegen_debug_options(lto_code_gen_t cg, const char * opt) +{ + cg->setCodeGenDebugOptions(opt); +} + From isanbard at gmail.com Thu Jul 3 17:53:42 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 03 Jul 2008 22:53:42 -0000 Subject: [llvm-commits] [llvm] r53120 - in /llvm/trunk: include/llvm/CodeGen/MachineDebugInfoDesc.h include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/DwarfWriter.cpp lib/CodeGen/MachineDebugInfoDesc.cpp lib/CodeGen/MachineModuleInfo.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp lib/VMCore/IntrinsicInst.cpp Message-ID: <200807032253.m63MrgOZ027616@zion.cs.uiuc.edu> Author: void Date: Thu Jul 3 17:53:42 2008 New Revision: 53120 URL: http://llvm.org/viewvc/llvm-project?rev=53120&view=rev Log: Revert my previous check-in that split up MachineModuleInfo. It turns out to slow the compiler down at -O0 some 30% or more. Ooops. Removed: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h llvm/trunk/lib/CodeGen/DwarfWriter.cpp llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp llvm/trunk/lib/VMCore/IntrinsicInst.cpp Removed: llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h?rev=53119&view=auto ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineDebugInfoDesc.h (removed) @@ -1,707 +0,0 @@ -//===-- llvm/CodeGen/MachineDebugInfoDesc.h ---------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// Debug descriptor information for a module. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CODEGEN_MACHINEDEBUGINFODESC_H -#define LLVM_CODEGEN_MACHINEDEBUGINFODESC_H - -#include "llvm/GlobalValue.h" -#include "llvm/Support/DataTypes.h" -#include -#include - -namespace llvm { - -//===----------------------------------------------------------------------===// -// Forward declarations. -class DIVisitor; -class GlobalVariable; - -//===----------------------------------------------------------------------===// -// Debug info description constants. - -enum { - LLVMDebugVersion = (6 << 16), // Current version of debug information. - LLVMDebugVersion5 = (5 << 16), // Constant for version 5. - LLVMDebugVersion4 = (4 << 16), // Constant for version 4. - LLVMDebugVersionMask = 0xffff0000 // Mask for version number. -}; - -//===----------------------------------------------------------------------===// -/// DebugInfoDesc - This class is the base class for debug info descriptors. - -class DebugInfoDesc { - // Content indicator. Dwarf values are used but that does not limit use to - // Dwarf writers. - unsigned Tag; -protected: - explicit DebugInfoDesc(unsigned T) : Tag(T | LLVMDebugVersion) {} -public: - virtual ~DebugInfoDesc(); - - // Accessors - unsigned getTag() const { return Tag & ~LLVMDebugVersionMask; } - unsigned getVersion() const { return Tag & LLVMDebugVersionMask; } - void setTag(unsigned T) { Tag = T | LLVMDebugVersion; } - - /// TagFromGlobal - Returns the tag number from a debug info descriptor - /// GlobalVariable. Return DIIValid if operand is not an unsigned int. - static unsigned TagFromGlobal(GlobalVariable *GV); - - /// VersionFromGlobal - Returns the version number from a debug info - /// descriptor GlobalVariable. Return DIIValid if operand is not an unsigned - /// int. - static unsigned VersionFromGlobal(GlobalVariable *GV); - - /// DescFactory - Create an instance of debug info descriptor based on Tag. - /// Return NULL if not a recognized Tag. - static DebugInfoDesc *DescFactory(unsigned Tag); - - /// getLinkage - get linkage appropriate for this type of descriptor. - /// - virtual GlobalValue::LinkageTypes getLinkage() const; - - //===--------------------------------------------------------------------===// - // Subclasses should supply the following virtual methods. - - /// ApplyToFields - Target the vistor to the fields of the descriptor. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const = 0; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const = 0; - -#ifndef NDEBUG - virtual void dump() = 0; -#endif - - //===--------------------------------------------------------------------===// - // Subclasses should supply the following static methods. - - // Implement isa/cast/dyncast. - static bool classof(const DebugInfoDesc *) { return true; } -}; - -//===----------------------------------------------------------------------===// -/// AnchorDesc - Descriptors of this class act as markers for identifying -/// descriptors of certain groups. -class AnchoredDesc; -class AnchorDesc : public DebugInfoDesc { - // Tag number of descriptors anchored by this object. - unsigned AnchorTag; -public: - AnchorDesc(); - explicit AnchorDesc(AnchoredDesc *D); - - // Accessors - unsigned getAnchorTag() const { return AnchorTag; } - - /// getLinkage - get linkage appropriate for this type of descriptor. - /// - virtual GlobalValue::LinkageTypes getLinkage() const; - - /// ApplyToFields - Target the visitor to the fields of the AnchorDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const; - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.anchor.type"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif - - // Implement isa/cast/dyncast. - static bool classof(const AnchorDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); -}; - -//===----------------------------------------------------------------------===// -/// AnchoredDesc - This class manages anchors for a variety of top level -/// descriptors. -class AnchoredDesc : public DebugInfoDesc { - // Anchor for all descriptors of the same type. - DebugInfoDesc *Anchor; -protected: - explicit AnchoredDesc(unsigned T); -public: - // Accessors. - AnchorDesc *getAnchor() const { return static_cast(Anchor); } - void setAnchor(AnchorDesc *A) { Anchor = static_cast(A); } - - //===--------------------------------------------------------------------===// - // Subclasses should supply the following virtual methods. - - /// getAnchorString - Return a string used to label descriptor's anchor. - /// - virtual const char *getAnchorString() const = 0; - - /// ApplyToFields - Target the visitor to the fields of the AnchoredDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); -}; - -//===----------------------------------------------------------------------===// -/// CompileUnitDesc - This class packages debug information associated with a -/// source/header file. -class CompileUnitDesc : public AnchoredDesc { - unsigned Language; // Language number (ex. DW_LANG_C89.) - std::string FileName; // Source file name. - std::string Directory; // Source file directory. - std::string Producer; // Compiler string. -public: - CompileUnitDesc(); - - // Accessors - unsigned getLanguage() const { return Language; } - const std::string &getFileName() const { return FileName; } - const std::string &getDirectory() const { return Directory; } - const std::string &getProducer() const { return Producer; } - void setLanguage(unsigned L) { Language = L; } - void setFileName(const std::string &FN) { FileName = FN; } - void setDirectory(const std::string &D) { Directory = D; } - void setProducer(const std::string &P) { Producer = P; } - - // FIXME - Need translation unit getter/setter. - - /// ApplyToFields - Target the visitor to the fields of the CompileUnitDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const { - return "llvm.dbg.compile_unit"; - } - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.compile_unit.type"; - } - - /// getAnchorString - Return a string used to label this descriptor's anchor. - /// - const char *getAnchorString() const { - return "llvm.dbg.compile_units"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif - - // Implement isa/cast/dyncast. - static bool classof(const CompileUnitDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); -}; - -//===----------------------------------------------------------------------===// -/// TypeDesc - This class packages debug information associated with a type. -/// -class TypeDesc : public DebugInfoDesc { - enum { - FlagPrivate = 1 << 0, - FlagProtected = 1 << 1 - }; - DebugInfoDesc *Context; // Context debug descriptor. - std::string Name; // Type name (may be empty.) - DebugInfoDesc *File; // Defined compile unit (may be NULL.) - unsigned Line; // Defined line# (may be zero.) - uint64_t Size; // Type bit size (may be zero.) - uint64_t Align; // Type bit alignment (may be zero.) - uint64_t Offset; // Type bit offset (may be zero.) - unsigned Flags; // Miscellaneous flags. -public: - explicit TypeDesc(unsigned T); - - // Accessors - DebugInfoDesc *getContext() const { return Context; } - const std::string &getName() const { return Name; } - CompileUnitDesc *getFile() const { - return static_cast(File); - } - unsigned getLine() const { return Line; } - uint64_t getSize() const { return Size; } - uint64_t getAlign() const { return Align; } - uint64_t getOffset() const { return Offset; } - bool isPrivate() const { - return (Flags & FlagPrivate) != 0; - } - bool isProtected() const { - return (Flags & FlagProtected) != 0; - } - void setContext(DebugInfoDesc *C) { Context = C; } - void setName(const std::string &N) { Name = N; } - void setFile(CompileUnitDesc *U) { - File = static_cast(U); - } - void setLine(unsigned L) { Line = L; } - void setSize(uint64_t S) { Size = S; } - void setAlign(uint64_t A) { Align = A; } - void setOffset(uint64_t O) { Offset = O; } - void setIsPrivate() { Flags |= FlagPrivate; } - void setIsProtected() { Flags |= FlagProtected; } - - /// ApplyToFields - Target the visitor to the fields of the TypeDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const { - return "llvm.dbg.type"; - } - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.type.type"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif -}; - -//===----------------------------------------------------------------------===// -/// BasicTypeDesc - This class packages debug information associated with a -/// basic type (eg. int, bool, double.) -class BasicTypeDesc : public TypeDesc { - unsigned Encoding; // Type encoding. -public: - BasicTypeDesc(); - - // Accessors - unsigned getEncoding() const { return Encoding; } - void setEncoding(unsigned E) { Encoding = E; } - - /// ApplyToFields - Target the visitor to the fields of the BasicTypeDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const { - return "llvm.dbg.basictype"; - } - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.basictype.type"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif - - // Implement isa/cast/dyncast. - static bool classof(const BasicTypeDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); -}; - -//===----------------------------------------------------------------------===// -/// DerivedTypeDesc - This class packages debug information associated with a -/// derived types (eg., typedef, pointer, reference.) -class DerivedTypeDesc : public TypeDesc { - DebugInfoDesc *FromType; // Type derived from. -public: - explicit DerivedTypeDesc(unsigned T); - - // Accessors - TypeDesc *getFromType() const { - return static_cast(FromType); - } - void setFromType(TypeDesc *F) { - FromType = static_cast(F); - } - - /// ApplyToFields - Target the visitor to the fields of the DerivedTypeDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const { - return "llvm.dbg.derivedtype"; - } - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.derivedtype.type"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif - - // Implement isa/cast/dyncast. - static bool classof(const DerivedTypeDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); -}; - -//===----------------------------------------------------------------------===// -/// CompositeTypeDesc - This class packages debug information associated with a -/// array/struct types (eg., arrays, struct, union, enums.) -class CompositeTypeDesc : public DerivedTypeDesc { - std::vector Elements; // Information used to compose type. -public: - explicit CompositeTypeDesc(unsigned T); - - // Accessors - std::vector &getElements() { return Elements; } - - /// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const { - return "llvm.dbg.compositetype"; - } - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.compositetype.type"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif - - // Implement isa/cast/dyncast. - static bool classof(const CompositeTypeDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); -}; - -//===----------------------------------------------------------------------===// -/// SubrangeDesc - This class packages debug information associated with integer -/// value ranges. -class SubrangeDesc : public DebugInfoDesc { - int64_t Lo; // Low value of range. - int64_t Hi; // High value of range. -public: - SubrangeDesc(); - - // Accessors - int64_t getLo() const { return Lo; } - int64_t getHi() const { return Hi; } - void setLo(int64_t L) { Lo = L; } - void setHi(int64_t H) { Hi = H; } - - /// ApplyToFields - Target the visitor to the fields of the SubrangeDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const { - return "llvm.dbg.subrange"; - } - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.subrange.type"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif - - // Implement isa/cast/dyncast. - static bool classof(const SubrangeDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); -}; - -//===----------------------------------------------------------------------===// -/// EnumeratorDesc - This class packages debug information associated with -/// named integer constants. -class EnumeratorDesc : public DebugInfoDesc { - std::string Name; // Enumerator name. - int64_t Value; // Enumerator value. -public: - EnumeratorDesc(); - - // Accessors - const std::string &getName() const { return Name; } - int64_t getValue() const { return Value; } - void setName(const std::string &N) { Name = N; } - void setValue(int64_t V) { Value = V; } - - /// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const { - return "llvm.dbg.enumerator"; - } - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.enumerator.type"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif - - // Implement isa/cast/dyncast. - static bool classof(const EnumeratorDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); -}; - -//===----------------------------------------------------------------------===// -/// VariableDesc - This class packages debug information associated with a -/// subprogram variable. -/// -class VariableDesc : public DebugInfoDesc { - DebugInfoDesc *Context; // Context debug descriptor. - std::string Name; // Type name (may be empty.) - DebugInfoDesc *File; // Defined compile unit (may be NULL.) - unsigned Line; // Defined line# (may be zero.) - DebugInfoDesc *TyDesc; // Type of variable. -public: - explicit VariableDesc(unsigned T); - - // Accessors - DebugInfoDesc *getContext() const { return Context; } - const std::string &getName() const { return Name; } - CompileUnitDesc *getFile() const { - return static_cast(File); - } - unsigned getLine() const { return Line; } - TypeDesc *getType() const { - return static_cast(TyDesc); - } - void setContext(DebugInfoDesc *C) { Context = C; } - void setName(const std::string &N) { Name = N; } - void setFile(CompileUnitDesc *U) { - File = static_cast(U); - } - void setLine(unsigned L) { Line = L; } - void setType(TypeDesc *T) { - TyDesc = static_cast(T); - } - - /// ApplyToFields - Target the visitor to the fields of the VariableDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const { - return "llvm.dbg.variable"; - } - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.variable.type"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif - - // Implement isa/cast/dyncast. - static bool classof(const VariableDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); -}; - -//===----------------------------------------------------------------------===// -/// GlobalDesc - This class is the base descriptor for global functions and -/// variables. -class GlobalDesc : public AnchoredDesc { - DebugInfoDesc *Context; // Context debug descriptor. - std::string Name; // Global name. - std::string FullName; // Fully qualified name. - std::string LinkageName; // Name for binding to MIPS linkage. - DebugInfoDesc *File; // Defined compile unit (may be NULL.) - unsigned Line; // Defined line# (may be zero.) - DebugInfoDesc *TyDesc; // Type debug descriptor. - bool IsStatic; // Is the global a static. - bool IsDefinition; // Is the global defined in context. -protected: - explicit GlobalDesc(unsigned T); -public: - // Accessors - DebugInfoDesc *getContext() const { return Context; } - const std::string &getName() const { return Name; } - const std::string &getFullName() const { return FullName; } - const std::string &getLinkageName() const { return LinkageName; } - CompileUnitDesc *getFile() const { - return static_cast(File); - } - unsigned getLine() const { return Line; } - TypeDesc *getType() const { - return static_cast(TyDesc); - } - bool isStatic() const { return IsStatic; } - bool isDefinition() const { return IsDefinition; } - void setContext(DebugInfoDesc *C) { Context = C; } - void setName(const std::string &N) { Name = N; } - void setFullName(const std::string &N) { FullName = N; } - void setLinkageName(const std::string &N) { LinkageName = N; } - void setFile(CompileUnitDesc *U) { - File = static_cast(U); - } - void setLine(unsigned L) { Line = L; } - void setType(TypeDesc *T) { - TyDesc = static_cast(T); - } - void setIsStatic(bool IS) { IsStatic = IS; } - void setIsDefinition(bool ID) { IsDefinition = ID; } - - /// ApplyToFields - Target the visitor to the fields of the GlobalDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); -}; - -//===----------------------------------------------------------------------===// -/// GlobalVariableDesc - This class packages debug information associated with a -/// GlobalVariable. -class GlobalVariableDesc : public GlobalDesc { - GlobalVariable *Global; // llvm global. -public: - GlobalVariableDesc(); - - // Accessors. - GlobalVariable *getGlobalVariable() const { return Global; } - void setGlobalVariable(GlobalVariable *GV) { Global = GV; } - - /// ApplyToFields - Target the visitor to the fields of the - /// GlobalVariableDesc. - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const { - return "llvm.dbg.global_variable"; - } - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.global_variable.type"; - } - - /// getAnchorString - Return a string used to label this descriptor's anchor. - /// - const char *getAnchorString() const { - return "llvm.dbg.global_variables"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif - - // Implement isa/cast/dyncast. - static bool classof(const GlobalVariableDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); -}; - -//===----------------------------------------------------------------------===// -/// SubprogramDesc - This class packages debug information associated with a -/// subprogram/function. -struct SubprogramDesc : public GlobalDesc { - SubprogramDesc(); - - /// ApplyToFields - Target the visitor to the fields of the SubprogramDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const { - return "llvm.dbg.subprogram"; - } - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.subprogram.type"; - } - - /// getAnchorString - Return a string used to label this descriptor's anchor. - /// - const char *getAnchorString() const { - return "llvm.dbg.subprograms"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif - - // Implement isa/cast/dyncast. - static bool classof(const SubprogramDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); -}; - -//===----------------------------------------------------------------------===// -/// BlockDesc - This descriptor groups variables and blocks nested in a block. -/// -class BlockDesc : public DebugInfoDesc { - DebugInfoDesc *Context; // Context debug descriptor. -public: - BlockDesc(); - - // Accessors - DebugInfoDesc *getContext() const { return Context; } - void setContext(DebugInfoDesc *C) { Context = C; } - - /// ApplyToFields - Target the visitor to the fields of the BlockDesc. - /// - virtual void ApplyToFields(DIVisitor *Visitor); - - /// getDescString - Return a string used to compose global names and labels. - /// - virtual const char *getDescString() const { - return "llvm.dbg.block"; - } - - /// getTypeString - Return a string used to label this descriptor's type. - /// - virtual const char *getTypeString() const { - return "llvm.dbg.block.type"; - } - -#ifndef NDEBUG - virtual void dump(); -#endif - - // Implement isa/cast/dyncast. - static bool classof(const BlockDesc *) { return true; } - static bool classof(const DebugInfoDesc *D); -}; - -} // End llvm namespace - -#endif Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=53120&r1=53119&r2=53120&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Thu Jul 3 17:53:42 2008 @@ -31,21 +31,19 @@ #ifndef LLVM_CODEGEN_MACHINEMODULEINFO_H #define LLVM_CODEGEN_MACHINEMODULEINFO_H -#include "llvm/GlobalValue.h" -#include "llvm/Pass.h" -#include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/Support/Dwarf.h" +#include "llvm/Support/DataTypes.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/UniqueVector.h" -#include "llvm/Support/DataTypes.h" -#include "llvm/Support/Dwarf.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/GlobalValue.h" +#include "llvm/Pass.h" namespace llvm { //===----------------------------------------------------------------------===// // Forward declarations. -class AnchoredDesc; -class CompileUnitDesc; class Constant; class DebugInfoDesc; class GlobalVariable; @@ -55,7 +53,16 @@ class Module; class PointerType; class StructType; -class VariableDesc; + +//===----------------------------------------------------------------------===// +// Debug info constants. + +enum { + LLVMDebugVersion = (6 << 16), // Current version of debug information. + LLVMDebugVersion5 = (5 << 16), // Constant for version 5. + LLVMDebugVersion4 = (4 << 16), // Constant for version 4. + LLVMDebugVersionMask = 0xffff0000 // Mask for version number. +}; //===----------------------------------------------------------------------===// /// DIVisitor - Subclasses of this class apply steps to each of the fields in @@ -83,6 +90,662 @@ }; //===----------------------------------------------------------------------===// +/// DebugInfoDesc - This class is the base class for debug info descriptors. +/// +class DebugInfoDesc { +private: + unsigned Tag; // Content indicator. Dwarf values are + // used but that does not limit use to + // Dwarf writers. + +protected: + explicit DebugInfoDesc(unsigned T) : Tag(T | LLVMDebugVersion) {} + +public: + virtual ~DebugInfoDesc() {} + + // Accessors + unsigned getTag() const { return Tag & ~LLVMDebugVersionMask; } + unsigned getVersion() const { return Tag & LLVMDebugVersionMask; } + void setTag(unsigned T) { Tag = T | LLVMDebugVersion; } + + /// TagFromGlobal - Returns the tag number from a debug info descriptor + /// GlobalVariable. Return DIIValid if operand is not an unsigned int. + static unsigned TagFromGlobal(GlobalVariable *GV); + + /// VersionFromGlobal - Returns the version number from a debug info + /// descriptor GlobalVariable. Return DIIValid if operand is not an unsigned + /// int. + static unsigned VersionFromGlobal(GlobalVariable *GV); + + /// DescFactory - Create an instance of debug info descriptor based on Tag. + /// Return NULL if not a recognized Tag. + static DebugInfoDesc *DescFactory(unsigned Tag); + + /// getLinkage - get linkage appropriate for this type of descriptor. + /// + virtual GlobalValue::LinkageTypes getLinkage() const; + + //===--------------------------------------------------------------------===// + // Subclasses should supply the following static methods. + + // Implement isa/cast/dyncast. + static bool classof(const DebugInfoDesc *) { return true; } + + //===--------------------------------------------------------------------===// + // Subclasses should supply the following virtual methods. + + /// ApplyToFields - Target the vistor to the fields of the descriptor. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const = 0; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const = 0; + +#ifndef NDEBUG + virtual void dump() = 0; +#endif +}; + +//===----------------------------------------------------------------------===// +/// AnchorDesc - Descriptors of this class act as markers for identifying +/// descriptors of certain groups. +class AnchoredDesc; +class AnchorDesc : public DebugInfoDesc { +private: + unsigned AnchorTag; // Tag number of descriptors anchored + // by this object. + +public: + AnchorDesc(); + explicit AnchorDesc(AnchoredDesc *D); + + // Accessors + unsigned getAnchorTag() const { return AnchorTag; } + + // Implement isa/cast/dyncast. + static bool classof(const AnchorDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); + + /// getLinkage - get linkage appropriate for this type of descriptor. + /// + virtual GlobalValue::LinkageTypes getLinkage() const; + + /// ApplyToFields - Target the visitor to the fields of the AnchorDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// +/// AnchoredDesc - This class manages anchors for a variety of top level +/// descriptors. +class AnchoredDesc : public DebugInfoDesc { +private: + DebugInfoDesc *Anchor; // Anchor for all descriptors of the + // same type. + +protected: + + explicit AnchoredDesc(unsigned T); + +public: + // Accessors. + AnchorDesc *getAnchor() const { return static_cast(Anchor); } + void setAnchor(AnchorDesc *A) { Anchor = static_cast(A); } + + //===--------------------------------------------------------------------===// + // Subclasses should supply the following virtual methods. + + /// getAnchorString - Return a string used to label descriptor's anchor. + /// + virtual const char *getAnchorString() const = 0; + + /// ApplyToFields - Target the visitor to the fields of the AnchoredDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); +}; + +//===----------------------------------------------------------------------===// +/// CompileUnitDesc - This class packages debug information associated with a +/// source/header file. +class CompileUnitDesc : public AnchoredDesc { +private: + unsigned Language; // Language number (ex. DW_LANG_C89.) + std::string FileName; // Source file name. + std::string Directory; // Source file directory. + std::string Producer; // Compiler string. + +public: + CompileUnitDesc(); + + + // Accessors + unsigned getLanguage() const { return Language; } + const std::string &getFileName() const { return FileName; } + const std::string &getDirectory() const { return Directory; } + const std::string &getProducer() const { return Producer; } + void setLanguage(unsigned L) { Language = L; } + void setFileName(const std::string &FN) { FileName = FN; } + void setDirectory(const std::string &D) { Directory = D; } + void setProducer(const std::string &P) { Producer = P; } + + // FIXME - Need translation unit getter/setter. + + // Implement isa/cast/dyncast. + static bool classof(const CompileUnitDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); + + /// ApplyToFields - Target the visitor to the fields of the CompileUnitDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + + /// getAnchorString - Return a string used to label this descriptor's anchor. + /// + static const char *const AnchorString; + virtual const char *getAnchorString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// +/// TypeDesc - This class packages debug information associated with a type. +/// +class TypeDesc : public DebugInfoDesc { +private: + enum { + FlagPrivate = 1 << 0, + FlagProtected = 1 << 1 + }; + DebugInfoDesc *Context; // Context debug descriptor. + std::string Name; // Type name (may be empty.) + DebugInfoDesc *File; // Defined compile unit (may be NULL.) + unsigned Line; // Defined line# (may be zero.) + uint64_t Size; // Type bit size (may be zero.) + uint64_t Align; // Type bit alignment (may be zero.) + uint64_t Offset; // Type bit offset (may be zero.) + unsigned Flags; // Miscellaneous flags. + +public: + explicit TypeDesc(unsigned T); + + // Accessors + DebugInfoDesc *getContext() const { return Context; } + const std::string &getName() const { return Name; } + CompileUnitDesc *getFile() const { + return static_cast(File); + } + unsigned getLine() const { return Line; } + uint64_t getSize() const { return Size; } + uint64_t getAlign() const { return Align; } + uint64_t getOffset() const { return Offset; } + bool isPrivate() const { + return (Flags & FlagPrivate) != 0; + } + bool isProtected() const { + return (Flags & FlagProtected) != 0; + } + void setContext(DebugInfoDesc *C) { Context = C; } + void setName(const std::string &N) { Name = N; } + void setFile(CompileUnitDesc *U) { + File = static_cast(U); + } + void setLine(unsigned L) { Line = L; } + void setSize(uint64_t S) { Size = S; } + void setAlign(uint64_t A) { Align = A; } + void setOffset(uint64_t O) { Offset = O; } + void setIsPrivate() { Flags |= FlagPrivate; } + void setIsProtected() { Flags |= FlagProtected; } + + /// ApplyToFields - Target the visitor to the fields of the TypeDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// +/// BasicTypeDesc - This class packages debug information associated with a +/// basic type (eg. int, bool, double.) +class BasicTypeDesc : public TypeDesc { +private: + unsigned Encoding; // Type encoding. + +public: + BasicTypeDesc(); + + // Accessors + unsigned getEncoding() const { return Encoding; } + void setEncoding(unsigned E) { Encoding = E; } + + // Implement isa/cast/dyncast. + static bool classof(const BasicTypeDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); + + /// ApplyToFields - Target the visitor to the fields of the BasicTypeDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + + +//===----------------------------------------------------------------------===// +/// DerivedTypeDesc - This class packages debug information associated with a +/// derived types (eg., typedef, pointer, reference.) +class DerivedTypeDesc : public TypeDesc { +private: + DebugInfoDesc *FromType; // Type derived from. + +public: + explicit DerivedTypeDesc(unsigned T); + + // Accessors + TypeDesc *getFromType() const { + return static_cast(FromType); + } + void setFromType(TypeDesc *F) { + FromType = static_cast(F); + } + + // Implement isa/cast/dyncast. + static bool classof(const DerivedTypeDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); + + /// ApplyToFields - Target the visitor to the fields of the DerivedTypeDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// +/// CompositeTypeDesc - This class packages debug information associated with a +/// array/struct types (eg., arrays, struct, union, enums.) +class CompositeTypeDesc : public DerivedTypeDesc { +private: + std::vector Elements;// Information used to compose type. + +public: + explicit CompositeTypeDesc(unsigned T); + + // Accessors + std::vector &getElements() { return Elements; } + + // Implement isa/cast/dyncast. + static bool classof(const CompositeTypeDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); + + /// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// +/// SubrangeDesc - This class packages debug information associated with integer +/// value ranges. +class SubrangeDesc : public DebugInfoDesc { +private: + int64_t Lo; // Low value of range. + int64_t Hi; // High value of range. + +public: + SubrangeDesc(); + + // Accessors + int64_t getLo() const { return Lo; } + int64_t getHi() const { return Hi; } + void setLo(int64_t L) { Lo = L; } + void setHi(int64_t H) { Hi = H; } + + // Implement isa/cast/dyncast. + static bool classof(const SubrangeDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); + + /// ApplyToFields - Target the visitor to the fields of the SubrangeDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// +/// EnumeratorDesc - This class packages debug information associated with +/// named integer constants. +class EnumeratorDesc : public DebugInfoDesc { +private: + std::string Name; // Enumerator name. + int64_t Value; // Enumerator value. + +public: + EnumeratorDesc(); + + // Accessors + const std::string &getName() const { return Name; } + int64_t getValue() const { return Value; } + void setName(const std::string &N) { Name = N; } + void setValue(int64_t V) { Value = V; } + + // Implement isa/cast/dyncast. + static bool classof(const EnumeratorDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); + + /// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// +/// VariableDesc - This class packages debug information associated with a +/// subprogram variable. +/// +class VariableDesc : public DebugInfoDesc { +private: + DebugInfoDesc *Context; // Context debug descriptor. + std::string Name; // Type name (may be empty.) + DebugInfoDesc *File; // Defined compile unit (may be NULL.) + unsigned Line; // Defined line# (may be zero.) + DebugInfoDesc *TyDesc; // Type of variable. + +public: + explicit VariableDesc(unsigned T); + + // Accessors + DebugInfoDesc *getContext() const { return Context; } + const std::string &getName() const { return Name; } + CompileUnitDesc *getFile() const { + return static_cast(File); + } + unsigned getLine() const { return Line; } + TypeDesc *getType() const { + return static_cast(TyDesc); + } + void setContext(DebugInfoDesc *C) { Context = C; } + void setName(const std::string &N) { Name = N; } + void setFile(CompileUnitDesc *U) { + File = static_cast(U); + } + void setLine(unsigned L) { Line = L; } + void setType(TypeDesc *T) { + TyDesc = static_cast(T); + } + + // Implement isa/cast/dyncast. + static bool classof(const VariableDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); + + /// ApplyToFields - Target the visitor to the fields of the VariableDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// +/// GlobalDesc - This class is the base descriptor for global functions and +/// variables. +class GlobalDesc : public AnchoredDesc { +private: + DebugInfoDesc *Context; // Context debug descriptor. + std::string Name; // Global name. + std::string FullName; // Fully qualified name. + std::string LinkageName; // Name for binding to MIPS linkage. + DebugInfoDesc *File; // Defined compile unit (may be NULL.) + unsigned Line; // Defined line# (may be zero.) + DebugInfoDesc *TyDesc; // Type debug descriptor. + bool IsStatic; // Is the global a static. + bool IsDefinition; // Is the global defined in context. + +protected: + explicit GlobalDesc(unsigned T); + +public: + // Accessors + DebugInfoDesc *getContext() const { return Context; } + const std::string &getName() const { return Name; } + const std::string &getFullName() const { return FullName; } + const std::string &getLinkageName() const { return LinkageName; } + CompileUnitDesc *getFile() const { + return static_cast(File); + } + unsigned getLine() const { return Line; } + TypeDesc *getType() const { + return static_cast(TyDesc); + } + bool isStatic() const { return IsStatic; } + bool isDefinition() const { return IsDefinition; } + void setContext(DebugInfoDesc *C) { Context = C; } + void setName(const std::string &N) { Name = N; } + void setFullName(const std::string &N) { FullName = N; } + void setLinkageName(const std::string &N) { LinkageName = N; } + void setFile(CompileUnitDesc *U) { + File = static_cast(U); + } + void setLine(unsigned L) { Line = L; } + void setType(TypeDesc *T) { + TyDesc = static_cast(T); + } + void setIsStatic(bool IS) { IsStatic = IS; } + void setIsDefinition(bool ID) { IsDefinition = ID; } + + /// ApplyToFields - Target the visitor to the fields of the GlobalDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); +}; + +//===----------------------------------------------------------------------===// +/// GlobalVariableDesc - This class packages debug information associated with a +/// GlobalVariable. +class GlobalVariableDesc : public GlobalDesc { +private: + GlobalVariable *Global; // llvm global. + +public: + GlobalVariableDesc(); + + // Accessors. + GlobalVariable *getGlobalVariable() const { return Global; } + void setGlobalVariable(GlobalVariable *GV) { Global = GV; } + + // Implement isa/cast/dyncast. + static bool classof(const GlobalVariableDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); + + /// ApplyToFields - Target the visitor to the fields of the + /// GlobalVariableDesc. + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + + /// getAnchorString - Return a string used to label this descriptor's anchor. + /// + static const char *const AnchorString; + virtual const char *getAnchorString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// +/// SubprogramDesc - This class packages debug information associated with a +/// subprogram/function. +class SubprogramDesc : public GlobalDesc { +private: + +public: + SubprogramDesc(); + + // Accessors + + // Implement isa/cast/dyncast. + static bool classof(const SubprogramDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); + + /// ApplyToFields - Target the visitor to the fields of the SubprogramDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + + /// getAnchorString - Return a string used to label this descriptor's anchor. + /// + static const char *const AnchorString; + virtual const char *getAnchorString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// +/// BlockDesc - This descriptor groups variables and blocks nested in a block. +/// +class BlockDesc : public DebugInfoDesc { +private: + DebugInfoDesc *Context; // Context debug descriptor. + +public: + BlockDesc(); + + // Accessors + DebugInfoDesc *getContext() const { return Context; } + void setContext(DebugInfoDesc *C) { Context = C; } + + // Implement isa/cast/dyncast. + static bool classof(const BlockDesc *) { return true; } + static bool classof(const DebugInfoDesc *D); + + /// ApplyToFields - Target the visitor to the fields of the BlockDesc. + /// + virtual void ApplyToFields(DIVisitor *Visitor); + + /// getDescString - Return a string used to compose global names and labels. + /// + virtual const char *getDescString() const; + + /// getTypeString - Return a string used to label this descriptor's type. + /// + virtual const char *getTypeString() const; + +#ifndef NDEBUG + virtual void dump(); +#endif +}; + +//===----------------------------------------------------------------------===// /// DIDeserializer - This class is responsible for casting GlobalVariables /// into DebugInfoDesc objects. class DIDeserializer { @@ -489,13 +1152,28 @@ /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the /// named GlobalVariable. - void getGlobalVariablesUsing(Module &M, const std::string &RootName, - std::vector &Result); + std::vector + getGlobalVariablesUsing(Module &M, const std::string &RootName); /// getAnchoredDescriptors - Return a vector of anchored debug descriptors. /// - void getAnchoredDescriptors(Module &M, const AnchoredDesc *Desc, - std::vector &AnchoredDescs); + template std::vector getAnchoredDescriptors(Module &M) { + T Desc; + std::vector Globals = + getGlobalVariablesUsing(M, Desc.getAnchorString()); + std::vector AnchoredDescs; + for (unsigned i = 0, N = Globals.size(); i < N; ++i) { + GlobalVariable *GV = Globals[i]; + + // FIXME - In the short term, changes are too drastic to continue. + if (DebugInfoDesc::TagFromGlobal(GV) == Desc.getTag() && + DebugInfoDesc::VersionFromGlobal(GV) == LLVMDebugVersion) { + AnchoredDescs.push_back(cast(DR.Deserialize(GV))); + } + } + + return AnchoredDescs; + } /// RecordRegionStart - Indicate the start of a region. /// Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=53120&r1=53119&r2=53120&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Thu Jul 3 17:53:42 2008 @@ -20,7 +20,6 @@ #include "llvm/Module.h" #include "llvm/Type.h" #include "llvm/CodeGen/AsmPrinter.h" -#include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineLocation.h" @@ -2631,23 +2630,25 @@ /// ConstructGlobalDIEs - Create DIEs for each of the externally visible /// global variables. void ConstructGlobalDIEs() { - std::vector GlobalVariables; - GlobalVariableDesc GVD; - MMI->getAnchoredDescriptors(*M, &GVD, GlobalVariables); + std::vector GlobalVariables = + MMI->getAnchoredDescriptors(*M); - for (unsigned i = 0, N = GlobalVariables.size(); i < N; ++i) - NewGlobalVariable((GlobalVariableDesc *)GlobalVariables[i]); + for (unsigned i = 0, N = GlobalVariables.size(); i < N; ++i) { + GlobalVariableDesc *GVD = GlobalVariables[i]; + NewGlobalVariable(GVD); + } } /// ConstructSubprogramDIEs - Create DIEs for each of the externally visible /// subprograms. void ConstructSubprogramDIEs() { - std::vector Subprograms; - SubprogramDesc SPD; - MMI->getAnchoredDescriptors(*M, &SPD, Subprograms); + std::vector Subprograms = + MMI->getAnchoredDescriptors(*M); - for (unsigned i = 0, N = Subprograms.size(); i < N; ++i) - NewSubprogram((SubprogramDesc*)Subprograms[i]); + for (unsigned i = 0, N = Subprograms.size(); i < N; ++i) { + SubprogramDesc *SPD = Subprograms[i]; + NewSubprogram(SPD); + } } public: Removed: llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp?rev=53119&view=auto ============================================================================== --- llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineDebugInfoDesc.cpp (removed) @@ -1,575 +0,0 @@ -//===-- llvm/CodeGen/MachineDebugInfoDesc.cpp -------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "llvm/CodeGen/MachineDebugInfoDesc.h" -#include "llvm/CodeGen/MachineModuleInfo.h" -#include "llvm/Constants.h" -#include "llvm/GlobalVariable.h" -#include "llvm/Support/Dwarf.h" -#include "llvm/Support/Streams.h" - -using namespace llvm; -using namespace llvm::dwarf; - -/// getUIntOperand - Return ith operand if it is an unsigned integer. -/// -static ConstantInt *getUIntOperand(const GlobalVariable *GV, unsigned i) { - // Make sure the GlobalVariable has an initializer. - if (!GV->hasInitializer()) return NULL; - - // Get the initializer constant. - ConstantStruct *CI = dyn_cast(GV->getInitializer()); - if (!CI) return NULL; - - // Check if there is at least i + 1 operands. - unsigned N = CI->getNumOperands(); - if (i >= N) return NULL; - - // Check constant. - return dyn_cast(CI->getOperand(i)); -} - -//===----------------------------------------------------------------------===// - -/// Supply a home for the DebugInfoDesc's v-table. -DebugInfoDesc::~DebugInfoDesc() {} - -/// TagFromGlobal - Returns the tag number from a debug info descriptor -/// GlobalVariable. Return DIIValid if operand is not an unsigned int. -unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) { - ConstantInt *C = getUIntOperand(GV, 0); - return C ? ((unsigned)C->getZExtValue() & ~LLVMDebugVersionMask) : - (unsigned)DW_TAG_invalid; -} - -/// VersionFromGlobal - Returns the version number from a debug info -/// descriptor GlobalVariable. Return DIIValid if operand is not an unsigned -/// int. -unsigned DebugInfoDesc::VersionFromGlobal(GlobalVariable *GV) { - ConstantInt *C = getUIntOperand(GV, 0); - return C ? ((unsigned)C->getZExtValue() & LLVMDebugVersionMask) : - (unsigned)DW_TAG_invalid; -} - -/// DescFactory - Create an instance of debug info descriptor based on Tag. -/// Return NULL if not a recognized Tag. -DebugInfoDesc *DebugInfoDesc::DescFactory(unsigned Tag) { - switch (Tag) { - case DW_TAG_anchor: return new AnchorDesc(); - case DW_TAG_compile_unit: return new CompileUnitDesc(); - case DW_TAG_variable: return new GlobalVariableDesc(); - case DW_TAG_subprogram: return new SubprogramDesc(); - case DW_TAG_lexical_block: return new BlockDesc(); - case DW_TAG_base_type: return new BasicTypeDesc(); - case DW_TAG_typedef: - case DW_TAG_pointer_type: - case DW_TAG_reference_type: - case DW_TAG_const_type: - case DW_TAG_volatile_type: - case DW_TAG_restrict_type: - case DW_TAG_member: - case DW_TAG_inheritance: return new DerivedTypeDesc(Tag); - case DW_TAG_array_type: - case DW_TAG_structure_type: - case DW_TAG_union_type: - case DW_TAG_enumeration_type: - case DW_TAG_vector_type: - case DW_TAG_subroutine_type: return new CompositeTypeDesc(Tag); - case DW_TAG_subrange_type: return new SubrangeDesc(); - case DW_TAG_enumerator: return new EnumeratorDesc(); - case DW_TAG_return_variable: - case DW_TAG_arg_variable: - case DW_TAG_auto_variable: return new VariableDesc(Tag); - default: break; - } - return NULL; -} - -/// getLinkage - get linkage appropriate for this type of descriptor. -GlobalValue::LinkageTypes DebugInfoDesc::getLinkage() const { - return GlobalValue::InternalLinkage; -} - -/// ApplyToFields - Target the vistor to the fields of the descriptor. -void DebugInfoDesc::ApplyToFields(DIVisitor *Visitor) { - Visitor->Apply(Tag); -} - -//===----------------------------------------------------------------------===// - -AnchorDesc::AnchorDesc() - : DebugInfoDesc(DW_TAG_anchor), AnchorTag(0) {} - -AnchorDesc::AnchorDesc(AnchoredDesc *D) - : DebugInfoDesc(DW_TAG_anchor), AnchorTag(D->getTag()) {} - -// Implement isa/cast/dyncast. -bool AnchorDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_anchor; -} - -/// getLinkage - get linkage appropriate for this type of descriptor. -GlobalValue::LinkageTypes AnchorDesc::getLinkage() const { - return GlobalValue::LinkOnceLinkage; -} - -/// ApplyToFields - Target the visitor to the fields of the TransUnitDesc. -void AnchorDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - Visitor->Apply(AnchorTag); -} - -/// getDescString - Return a string used to compose global names and labels. A -/// global variable name needs to be defined for each debug descriptor that is -/// anchored. NOTE: that each global variable named here also needs to be added -/// to the list of names left external in the internalizer. -/// -/// ExternalNames.insert("llvm.dbg.compile_units"); -/// ExternalNames.insert("llvm.dbg.global_variables"); -/// ExternalNames.insert("llvm.dbg.subprograms"); -const char *AnchorDesc::getDescString() const { - switch (AnchorTag) { - case DW_TAG_compile_unit: { - CompileUnitDesc CUD; - return CUD.getAnchorString(); - } - case DW_TAG_variable: { - GlobalVariableDesc GVD; - return GVD.getAnchorString(); - } - case DW_TAG_subprogram: { - SubprogramDesc SPD; - return SPD.getAnchorString(); - } - default: break; - } - - assert(0 && "Tag does not have a case for anchor string"); - return ""; -} - -#ifndef NDEBUG -void AnchorDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "AnchorTag(" << AnchorTag << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -AnchoredDesc::AnchoredDesc(unsigned T) - : DebugInfoDesc(T), Anchor(NULL) {} - -/// ApplyToFields - Target the visitor to the fields of the AnchoredDesc. -void AnchoredDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - Visitor->Apply(Anchor); -} - -//===----------------------------------------------------------------------===// - -CompileUnitDesc::CompileUnitDesc() - : AnchoredDesc(DW_TAG_compile_unit), Language(0), FileName(""), - Directory(""), Producer("") {} - -// Implement isa/cast/dyncast. -bool CompileUnitDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_compile_unit; -} - -/// ApplyToFields - Target the visitor to the fields of the CompileUnitDesc. -/// -void CompileUnitDesc::ApplyToFields(DIVisitor *Visitor) { - AnchoredDesc::ApplyToFields(Visitor); - - // Handle cases out of sync with compiler. - if (getVersion() == 0) { - unsigned DebugVersion; - Visitor->Apply(DebugVersion); - } - - Visitor->Apply(Language); - Visitor->Apply(FileName); - Visitor->Apply(Directory); - Visitor->Apply(Producer); -} - -#ifndef NDEBUG -void CompileUnitDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Anchor(" << getAnchor() << "), " - << "Language(" << Language << "), " - << "FileName(\"" << FileName << "\"), " - << "Directory(\"" << Directory << "\"), " - << "Producer(\"" << Producer << "\")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -TypeDesc::TypeDesc(unsigned T) - : DebugInfoDesc(T), Context(NULL), Name(""), File(NULL), Line(0), Size(0), - Align(0), Offset(0), Flags(0) {} - -/// ApplyToFields - Target the visitor to the fields of the TypeDesc. -/// -void TypeDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - Visitor->Apply(Context); - Visitor->Apply(Name); - Visitor->Apply(File); - Visitor->Apply(Line); - Visitor->Apply(Size); - Visitor->Apply(Align); - Visitor->Apply(Offset); - if (getVersion() > LLVMDebugVersion4) Visitor->Apply(Flags); -} - -#ifndef NDEBUG -void TypeDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Context(" << Context << "), " - << "Name(\"" << Name << "\"), " - << "File(" << File << "), " - << "Line(" << Line << "), " - << "Size(" << Size << "), " - << "Align(" << Align << "), " - << "Offset(" << Offset << "), " - << "Flags(" << Flags << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -BasicTypeDesc::BasicTypeDesc() - : TypeDesc(DW_TAG_base_type), Encoding(0) {} - -// Implement isa/cast/dyncast. -bool BasicTypeDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_base_type; -} - -/// ApplyToFields - Target the visitor to the fields of the BasicTypeDesc. -void BasicTypeDesc::ApplyToFields(DIVisitor *Visitor) { - TypeDesc::ApplyToFields(Visitor); - Visitor->Apply(Encoding); -} - -#ifndef NDEBUG -void BasicTypeDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Context(" << getContext() << "), " - << "Name(\"" << getName() << "\"), " - << "Size(" << getSize() << "), " - << "Encoding(" << Encoding << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -DerivedTypeDesc::DerivedTypeDesc(unsigned T) - : TypeDesc(T), FromType(NULL) {} - -// Implement isa/cast/dyncast. -bool DerivedTypeDesc::classof(const DebugInfoDesc *D) { - unsigned T = D->getTag(); - switch (T) { - case DW_TAG_typedef: - case DW_TAG_pointer_type: - case DW_TAG_reference_type: - case DW_TAG_const_type: - case DW_TAG_volatile_type: - case DW_TAG_restrict_type: - case DW_TAG_member: - case DW_TAG_inheritance: - return true; - default: break; - } - return false; -} - -/// ApplyToFields - Target the visitor to the fields of the DerivedTypeDesc. -void DerivedTypeDesc::ApplyToFields(DIVisitor *Visitor) { - TypeDesc::ApplyToFields(Visitor); - Visitor->Apply(FromType); -} - -#ifndef NDEBUG -void DerivedTypeDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Context(" << getContext() << "), " - << "Name(\"" << getName() << "\"), " - << "Size(" << getSize() << "), " - << "File(" << getFile() << "), " - << "Line(" << getLine() << "), " - << "FromType(" << FromType << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -CompositeTypeDesc::CompositeTypeDesc(unsigned T) - : DerivedTypeDesc(T), Elements() {} - -// Implement isa/cast/dyncast. -bool CompositeTypeDesc::classof(const DebugInfoDesc *D) { - unsigned T = D->getTag(); - switch (T) { - case DW_TAG_array_type: - case DW_TAG_structure_type: - case DW_TAG_union_type: - case DW_TAG_enumeration_type: - case DW_TAG_vector_type: - case DW_TAG_subroutine_type: - return true; - default: break; - } - return false; -} - -/// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc. -/// -void CompositeTypeDesc::ApplyToFields(DIVisitor *Visitor) { - DerivedTypeDesc::ApplyToFields(Visitor); - Visitor->Apply(Elements); -} - -#ifndef NDEBUG -void CompositeTypeDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Context(" << getContext() << "), " - << "Name(\"" << getName() << "\"), " - << "Size(" << getSize() << "), " - << "File(" << getFile() << "), " - << "Line(" << getLine() << "), " - << "FromType(" << getFromType() << "), " - << "Elements.size(" << Elements.size() << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -SubrangeDesc::SubrangeDesc() - : DebugInfoDesc(DW_TAG_subrange_type), Lo(0), Hi(0) {} - -// Implement isa/cast/dyncast. -bool SubrangeDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_subrange_type; -} - -/// ApplyToFields - Target the visitor to the fields of the SubrangeDesc. -void SubrangeDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - Visitor->Apply(Lo); - Visitor->Apply(Hi); -} - -#ifndef NDEBUG -void SubrangeDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Lo(" << Lo << "), " - << "Hi(" << Hi << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -EnumeratorDesc::EnumeratorDesc() - : DebugInfoDesc(DW_TAG_enumerator), Name(""), Value(0) {} - -// Implement isa/cast/dyncast. -bool EnumeratorDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_enumerator; -} - -/// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc. -void EnumeratorDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - Visitor->Apply(Name); - Visitor->Apply(Value); -} - -#ifndef NDEBUG -void EnumeratorDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Name(" << Name << "), " - << "Value(" << Value << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -VariableDesc::VariableDesc(unsigned T) - : DebugInfoDesc(T), Context(NULL), Name(""), File(NULL), Line(0), TyDesc(0) -{} - -// Implement isa/cast/dyncast. -bool VariableDesc::classof(const DebugInfoDesc *D) { - unsigned T = D->getTag(); - switch (T) { - case DW_TAG_auto_variable: - case DW_TAG_arg_variable: - case DW_TAG_return_variable: - return true; - default: break; - } - return false; -} - -/// ApplyToFields - Target the visitor to the fields of the VariableDesc. -void VariableDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - Visitor->Apply(Context); - Visitor->Apply(Name); - Visitor->Apply(File); - Visitor->Apply(Line); - Visitor->Apply(TyDesc); -} - -#ifndef NDEBUG -void VariableDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Context(" << Context << "), " - << "Name(\"" << Name << "\"), " - << "File(" << File << "), " - << "Line(" << Line << "), " - << "TyDesc(" << TyDesc << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -GlobalDesc::GlobalDesc(unsigned T) - : AnchoredDesc(T), Context(0), Name(""), FullName(""), LinkageName(""), - File(NULL), Line(0), TyDesc(NULL), IsStatic(false), IsDefinition(false) {} - -/// ApplyToFields - Target the visitor to the fields of the global. -/// -void GlobalDesc::ApplyToFields(DIVisitor *Visitor) { - AnchoredDesc::ApplyToFields(Visitor); - Visitor->Apply(Context); - Visitor->Apply(Name); - Visitor->Apply(FullName); - Visitor->Apply(LinkageName); - Visitor->Apply(File); - Visitor->Apply(Line); - Visitor->Apply(TyDesc); - Visitor->Apply(IsStatic); - Visitor->Apply(IsDefinition); -} - -//===----------------------------------------------------------------------===// - -GlobalVariableDesc::GlobalVariableDesc() - : GlobalDesc(DW_TAG_variable), Global(NULL) {} - -// Implement isa/cast/dyncast. -bool GlobalVariableDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_variable; -} - -/// ApplyToFields - Target the visitor to the fields of the GlobalVariableDesc. -void GlobalVariableDesc::ApplyToFields(DIVisitor *Visitor) { - GlobalDesc::ApplyToFields(Visitor); - Visitor->Apply(Global); -} - -#ifndef NDEBUG -void GlobalVariableDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Anchor(" << getAnchor() << "), " - << "Name(\"" << getName() << "\"), " - << "FullName(\"" << getFullName() << "\"), " - << "LinkageName(\"" << getLinkageName() << "\"), " - << "File(" << getFile() << ")," - << "Line(" << getLine() << ")," - << "Type(" << getType() << "), " - << "IsStatic(" << (isStatic() ? "true" : "false") << "), " - << "IsDefinition(" << (isDefinition() ? "true" : "false") << "), " - << "Global(" << Global << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -SubprogramDesc::SubprogramDesc() - : GlobalDesc(DW_TAG_subprogram) {} - -// Implement isa/cast/dyncast. -bool SubprogramDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_subprogram; -} - -/// ApplyToFields - Target the visitor to the fields of the SubprogramDesc. -void SubprogramDesc::ApplyToFields(DIVisitor *Visitor) { - GlobalDesc::ApplyToFields(Visitor); -} - -#ifndef NDEBUG -void SubprogramDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << "), " - << "Anchor(" << getAnchor() << "), " - << "Name(\"" << getName() << "\"), " - << "FullName(\"" << getFullName() << "\"), " - << "LinkageName(\"" << getLinkageName() << "\"), " - << "File(" << getFile() << ")," - << "Line(" << getLine() << ")," - << "Type(" << getType() << "), " - << "IsStatic(" << (isStatic() ? "true" : "false") << "), " - << "IsDefinition(" << (isDefinition() ? "true" : "false") << ")\n"; -} -#endif - -//===----------------------------------------------------------------------===// - -BlockDesc::BlockDesc() - : DebugInfoDesc(DW_TAG_lexical_block), Context(NULL) {} - -// Implement isa/cast/dyncast. -bool BlockDesc::classof(const DebugInfoDesc *D) { - return D->getTag() == DW_TAG_lexical_block; -} - -/// ApplyToFields - Target the visitor to the fields of the BlockDesc. -void BlockDesc::ApplyToFields(DIVisitor *Visitor) { - DebugInfoDesc::ApplyToFields(Visitor); - - Visitor->Apply(Context); -} - -#ifndef NDEBUG -void BlockDesc::dump() { - cerr << getDescString() << " " - << "Version(" << getVersion() << "), " - << "Tag(" << getTag() << ")," - << "Context(" << Context << ")\n"; -} -#endif Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=53120&r1=53119&r2=53120&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Thu Jul 3 17:53:42 2008 @@ -14,7 +14,6 @@ #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineLocation.h" -#include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetOptions.h" @@ -53,9 +52,10 @@ /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the /// named GlobalVariable. -static void -getGlobalVariablesUsing(Module &M, const std::string &RootName, - std::vector &Result) { +static std::vector +getGlobalVariablesUsing(Module &M, const std::string &RootName) { + std::vector Result; // GlobalVariables matching criteria. + std::vector FieldTypes; FieldTypes.push_back(Type::Int32Ty); FieldTypes.push_back(Type::Int32Ty); @@ -65,8 +65,11 @@ StructType::get(FieldTypes)); // If present and linkonce then scan for users. - if (UseRoot && UseRoot->hasLinkOnceLinkage()) + if (UseRoot && UseRoot->hasLinkOnceLinkage()) { getGlobalVariablesUsing(UseRoot, Result); + } + + return Result; } /// isStringValue - Return true if the given value can be coerced to a string. @@ -131,6 +134,24 @@ return false; } +/// getUIntOperand - Return ith operand if it is an unsigned integer. +/// +static ConstantInt *getUIntOperand(GlobalVariable *GV, unsigned i) { + // Make sure the GlobalVariable has an initializer. + if (!GV->hasInitializer()) return NULL; + + // Get the initializer constant. + ConstantStruct *CI = dyn_cast(GV->getInitializer()); + if (!CI) return NULL; + + // Check if there is at least i + 1 operands. + unsigned N = CI->getNumOperands(); + if (i >= N) return NULL; + + // Check constant. + return dyn_cast(CI->getOperand(i)); +} + //===----------------------------------------------------------------------===// /// ApplyToFields - Target the visitor to each field of the debug information @@ -250,7 +271,10 @@ public: DISerializeVisitor(DISerializer &S, std::vector &E) - : DIVisitor(), SR(S), Elements(E) {} + : DIVisitor() + , SR(S) + , Elements(E) + {} /// Apply - Set the value of each of the fields. /// @@ -303,7 +327,7 @@ ArrayType *AT = ArrayType::get(EmptyTy, N); std::vector ArrayElements; - for (unsigned i = 0; i < N; ++i) { + for (unsigned i = 0, N = Field.size(); i < N; ++i) { if (DebugInfoDesc *Element = Field[i]) { GlobalVariable *GVE = SR.Serialize(Element); Constant *CE = ConstantExpr::getBitCast(GVE, EmptyTy); @@ -334,7 +358,10 @@ public: DIGetTypesVisitor(DISerializer &S, std::vector &F) - : DIVisitor(), SR(S), Fields(F) {} + : DIVisitor() + , SR(S) + , Fields(F) + {} /// Apply - Set the value of each of the fields. /// @@ -457,6 +484,763 @@ //===----------------------------------------------------------------------===// +/// TagFromGlobal - Returns the tag number from a debug info descriptor +/// GlobalVariable. Return DIIValid if operand is not an unsigned int. +unsigned DebugInfoDesc::TagFromGlobal(GlobalVariable *GV) { + ConstantInt *C = getUIntOperand(GV, 0); + return C ? ((unsigned)C->getZExtValue() & ~LLVMDebugVersionMask) : + (unsigned)DW_TAG_invalid; +} + +/// VersionFromGlobal - Returns the version number from a debug info +/// descriptor GlobalVariable. Return DIIValid if operand is not an unsigned +/// int. +unsigned DebugInfoDesc::VersionFromGlobal(GlobalVariable *GV) { + ConstantInt *C = getUIntOperand(GV, 0); + return C ? ((unsigned)C->getZExtValue() & LLVMDebugVersionMask) : + (unsigned)DW_TAG_invalid; +} + +/// DescFactory - Create an instance of debug info descriptor based on Tag. +/// Return NULL if not a recognized Tag. +DebugInfoDesc *DebugInfoDesc::DescFactory(unsigned Tag) { + switch (Tag) { + case DW_TAG_anchor: return new AnchorDesc(); + case DW_TAG_compile_unit: return new CompileUnitDesc(); + case DW_TAG_variable: return new GlobalVariableDesc(); + case DW_TAG_subprogram: return new SubprogramDesc(); + case DW_TAG_lexical_block: return new BlockDesc(); + case DW_TAG_base_type: return new BasicTypeDesc(); + case DW_TAG_typedef: + case DW_TAG_pointer_type: + case DW_TAG_reference_type: + case DW_TAG_const_type: + case DW_TAG_volatile_type: + case DW_TAG_restrict_type: + case DW_TAG_member: + case DW_TAG_inheritance: return new DerivedTypeDesc(Tag); + case DW_TAG_array_type: + case DW_TAG_structure_type: + case DW_TAG_union_type: + case DW_TAG_enumeration_type: + case DW_TAG_vector_type: + case DW_TAG_subroutine_type: return new CompositeTypeDesc(Tag); + case DW_TAG_subrange_type: return new SubrangeDesc(); + case DW_TAG_enumerator: return new EnumeratorDesc(); + case DW_TAG_return_variable: + case DW_TAG_arg_variable: + case DW_TAG_auto_variable: return new VariableDesc(Tag); + default: break; + } + return NULL; +} + +/// getLinkage - get linkage appropriate for this type of descriptor. +/// +GlobalValue::LinkageTypes DebugInfoDesc::getLinkage() const { + return GlobalValue::InternalLinkage; +} + +/// ApplyToFields - Target the vistor to the fields of the descriptor. +/// +void DebugInfoDesc::ApplyToFields(DIVisitor *Visitor) { + Visitor->Apply(Tag); +} + +//===----------------------------------------------------------------------===// + +AnchorDesc::AnchorDesc() +: DebugInfoDesc(DW_TAG_anchor) +, AnchorTag(0) +{} +AnchorDesc::AnchorDesc(AnchoredDesc *D) +: DebugInfoDesc(DW_TAG_anchor) +, AnchorTag(D->getTag()) +{} + +// Implement isa/cast/dyncast. +bool AnchorDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_anchor; +} + +/// getLinkage - get linkage appropriate for this type of descriptor. +/// +GlobalValue::LinkageTypes AnchorDesc::getLinkage() const { + return GlobalValue::LinkOnceLinkage; +} + +/// ApplyToFields - Target the visitor to the fields of the TransUnitDesc. +/// +void AnchorDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + + Visitor->Apply(AnchorTag); +} + +/// getDescString - Return a string used to compose global names and labels. A +/// A global variable name needs to be defined for each debug descriptor that is +/// anchored. NOTE: that each global variable named here also needs to be added +/// to the list of names left external in the internalizer. +/// ExternalNames.insert("llvm.dbg.compile_units"); +/// ExternalNames.insert("llvm.dbg.global_variables"); +/// ExternalNames.insert("llvm.dbg.subprograms"); +const char *AnchorDesc::getDescString() const { + switch (AnchorTag) { + case DW_TAG_compile_unit: return CompileUnitDesc::AnchorString; + case DW_TAG_variable: return GlobalVariableDesc::AnchorString; + case DW_TAG_subprogram: return SubprogramDesc::AnchorString; + default: break; + } + + assert(0 && "Tag does not have a case for anchor string"); + return ""; +} + +/// getTypeString - Return a string used to label this descriptors type. +/// +const char *AnchorDesc::getTypeString() const { + return "llvm.dbg.anchor.type"; +} + +#ifndef NDEBUG +void AnchorDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "AnchorTag(" << AnchorTag << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +AnchoredDesc::AnchoredDesc(unsigned T) +: DebugInfoDesc(T) +, Anchor(NULL) +{} + +/// ApplyToFields - Target the visitor to the fields of the AnchoredDesc. +/// +void AnchoredDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + + Visitor->Apply(Anchor); +} + +//===----------------------------------------------------------------------===// + +CompileUnitDesc::CompileUnitDesc() +: AnchoredDesc(DW_TAG_compile_unit) +, Language(0) +, FileName("") +, Directory("") +, Producer("") +{} + +// Implement isa/cast/dyncast. +bool CompileUnitDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_compile_unit; +} + +/// ApplyToFields - Target the visitor to the fields of the CompileUnitDesc. +/// +void CompileUnitDesc::ApplyToFields(DIVisitor *Visitor) { + AnchoredDesc::ApplyToFields(Visitor); + + // Handle cases out of sync with compiler. + if (getVersion() == 0) { + unsigned DebugVersion; + Visitor->Apply(DebugVersion); + } + + Visitor->Apply(Language); + Visitor->Apply(FileName); + Visitor->Apply(Directory); + Visitor->Apply(Producer); +} + +/// getDescString - Return a string used to compose global names and labels. +/// +const char *CompileUnitDesc::getDescString() const { + return "llvm.dbg.compile_unit"; +} + +/// getTypeString - Return a string used to label this descriptors type. +/// +const char *CompileUnitDesc::getTypeString() const { + return "llvm.dbg.compile_unit.type"; +} + +/// getAnchorString - Return a string used to label this descriptor's anchor. +/// +const char *const CompileUnitDesc::AnchorString = "llvm.dbg.compile_units"; +const char *CompileUnitDesc::getAnchorString() const { + return AnchorString; +} + +#ifndef NDEBUG +void CompileUnitDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Anchor(" << getAnchor() << "), " + << "Language(" << Language << "), " + << "FileName(\"" << FileName << "\"), " + << "Directory(\"" << Directory << "\"), " + << "Producer(\"" << Producer << "\")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +TypeDesc::TypeDesc(unsigned T) +: DebugInfoDesc(T) +, Context(NULL) +, Name("") +, File(NULL) +, Line(0) +, Size(0) +, Align(0) +, Offset(0) +, Flags(0) +{} + +/// ApplyToFields - Target the visitor to the fields of the TypeDesc. +/// +void TypeDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + + Visitor->Apply(Context); + Visitor->Apply(Name); + Visitor->Apply(File); + Visitor->Apply(Line); + Visitor->Apply(Size); + Visitor->Apply(Align); + Visitor->Apply(Offset); + if (getVersion() > LLVMDebugVersion4) Visitor->Apply(Flags); +} + +/// getDescString - Return a string used to compose global names and labels. +/// +const char *TypeDesc::getDescString() const { + return "llvm.dbg.type"; +} + +/// getTypeString - Return a string used to label this descriptor's type. +/// +const char *TypeDesc::getTypeString() const { + return "llvm.dbg.type.type"; +} + +#ifndef NDEBUG +void TypeDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Context(" << Context << "), " + << "Name(\"" << Name << "\"), " + << "File(" << File << "), " + << "Line(" << Line << "), " + << "Size(" << Size << "), " + << "Align(" << Align << "), " + << "Offset(" << Offset << "), " + << "Flags(" << Flags << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +BasicTypeDesc::BasicTypeDesc() +: TypeDesc(DW_TAG_base_type) +, Encoding(0) +{} + +// Implement isa/cast/dyncast. +bool BasicTypeDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_base_type; +} + +/// ApplyToFields - Target the visitor to the fields of the BasicTypeDesc. +/// +void BasicTypeDesc::ApplyToFields(DIVisitor *Visitor) { + TypeDesc::ApplyToFields(Visitor); + + Visitor->Apply(Encoding); +} + +/// getDescString - Return a string used to compose global names and labels. +/// +const char *BasicTypeDesc::getDescString() const { + return "llvm.dbg.basictype"; +} + +/// getTypeString - Return a string used to label this descriptor's type. +/// +const char *BasicTypeDesc::getTypeString() const { + return "llvm.dbg.basictype.type"; +} + +#ifndef NDEBUG +void BasicTypeDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Context(" << getContext() << "), " + << "Name(\"" << getName() << "\"), " + << "Size(" << getSize() << "), " + << "Encoding(" << Encoding << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +DerivedTypeDesc::DerivedTypeDesc(unsigned T) +: TypeDesc(T) +, FromType(NULL) +{} + +// Implement isa/cast/dyncast. +bool DerivedTypeDesc::classof(const DebugInfoDesc *D) { + unsigned T = D->getTag(); + switch (T) { + case DW_TAG_typedef: + case DW_TAG_pointer_type: + case DW_TAG_reference_type: + case DW_TAG_const_type: + case DW_TAG_volatile_type: + case DW_TAG_restrict_type: + case DW_TAG_member: + case DW_TAG_inheritance: + return true; + default: break; + } + return false; +} + +/// ApplyToFields - Target the visitor to the fields of the DerivedTypeDesc. +/// +void DerivedTypeDesc::ApplyToFields(DIVisitor *Visitor) { + TypeDesc::ApplyToFields(Visitor); + + Visitor->Apply(FromType); +} + +/// getDescString - Return a string used to compose global names and labels. +/// +const char *DerivedTypeDesc::getDescString() const { + return "llvm.dbg.derivedtype"; +} + +/// getTypeString - Return a string used to label this descriptor's type. +/// +const char *DerivedTypeDesc::getTypeString() const { + return "llvm.dbg.derivedtype.type"; +} + +#ifndef NDEBUG +void DerivedTypeDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Context(" << getContext() << "), " + << "Name(\"" << getName() << "\"), " + << "Size(" << getSize() << "), " + << "File(" << getFile() << "), " + << "Line(" << getLine() << "), " + << "FromType(" << FromType << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +CompositeTypeDesc::CompositeTypeDesc(unsigned T) +: DerivedTypeDesc(T) +, Elements() +{} + +// Implement isa/cast/dyncast. +bool CompositeTypeDesc::classof(const DebugInfoDesc *D) { + unsigned T = D->getTag(); + switch (T) { + case DW_TAG_array_type: + case DW_TAG_structure_type: + case DW_TAG_union_type: + case DW_TAG_enumeration_type: + case DW_TAG_vector_type: + case DW_TAG_subroutine_type: + return true; + default: break; + } + return false; +} + +/// ApplyToFields - Target the visitor to the fields of the CompositeTypeDesc. +/// +void CompositeTypeDesc::ApplyToFields(DIVisitor *Visitor) { + DerivedTypeDesc::ApplyToFields(Visitor); + + Visitor->Apply(Elements); +} + +/// getDescString - Return a string used to compose global names and labels. +/// +const char *CompositeTypeDesc::getDescString() const { + return "llvm.dbg.compositetype"; +} + +/// getTypeString - Return a string used to label this descriptor's type. +/// +const char *CompositeTypeDesc::getTypeString() const { + return "llvm.dbg.compositetype.type"; +} + +#ifndef NDEBUG +void CompositeTypeDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Context(" << getContext() << "), " + << "Name(\"" << getName() << "\"), " + << "Size(" << getSize() << "), " + << "File(" << getFile() << "), " + << "Line(" << getLine() << "), " + << "FromType(" << getFromType() << "), " + << "Elements.size(" << Elements.size() << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +SubrangeDesc::SubrangeDesc() +: DebugInfoDesc(DW_TAG_subrange_type) +, Lo(0) +, Hi(0) +{} + +// Implement isa/cast/dyncast. +bool SubrangeDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_subrange_type; +} + +/// ApplyToFields - Target the visitor to the fields of the SubrangeDesc. +/// +void SubrangeDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + + Visitor->Apply(Lo); + Visitor->Apply(Hi); +} + +/// getDescString - Return a string used to compose global names and labels. +/// +const char *SubrangeDesc::getDescString() const { + return "llvm.dbg.subrange"; +} + +/// getTypeString - Return a string used to label this descriptor's type. +/// +const char *SubrangeDesc::getTypeString() const { + return "llvm.dbg.subrange.type"; +} + +#ifndef NDEBUG +void SubrangeDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Lo(" << Lo << "), " + << "Hi(" << Hi << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +EnumeratorDesc::EnumeratorDesc() +: DebugInfoDesc(DW_TAG_enumerator) +, Name("") +, Value(0) +{} + +// Implement isa/cast/dyncast. +bool EnumeratorDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_enumerator; +} + +/// ApplyToFields - Target the visitor to the fields of the EnumeratorDesc. +/// +void EnumeratorDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + + Visitor->Apply(Name); + Visitor->Apply(Value); +} + +/// getDescString - Return a string used to compose global names and labels. +/// +const char *EnumeratorDesc::getDescString() const { + return "llvm.dbg.enumerator"; +} + +/// getTypeString - Return a string used to label this descriptor's type. +/// +const char *EnumeratorDesc::getTypeString() const { + return "llvm.dbg.enumerator.type"; +} + +#ifndef NDEBUG +void EnumeratorDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Name(" << Name << "), " + << "Value(" << Value << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +VariableDesc::VariableDesc(unsigned T) +: DebugInfoDesc(T) +, Context(NULL) +, Name("") +, File(NULL) +, Line(0) +, TyDesc(0) +{} + +// Implement isa/cast/dyncast. +bool VariableDesc::classof(const DebugInfoDesc *D) { + unsigned T = D->getTag(); + switch (T) { + case DW_TAG_auto_variable: + case DW_TAG_arg_variable: + case DW_TAG_return_variable: + return true; + default: break; + } + return false; +} + +/// ApplyToFields - Target the visitor to the fields of the VariableDesc. +/// +void VariableDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + + Visitor->Apply(Context); + Visitor->Apply(Name); + Visitor->Apply(File); + Visitor->Apply(Line); + Visitor->Apply(TyDesc); +} + +/// getDescString - Return a string used to compose global names and labels. +/// +const char *VariableDesc::getDescString() const { + return "llvm.dbg.variable"; +} + +/// getTypeString - Return a string used to label this descriptor's type. +/// +const char *VariableDesc::getTypeString() const { + return "llvm.dbg.variable.type"; +} + +#ifndef NDEBUG +void VariableDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Context(" << Context << "), " + << "Name(\"" << Name << "\"), " + << "File(" << File << "), " + << "Line(" << Line << "), " + << "TyDesc(" << TyDesc << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +GlobalDesc::GlobalDesc(unsigned T) +: AnchoredDesc(T) +, Context(0) +, Name("") +, FullName("") +, LinkageName("") +, File(NULL) +, Line(0) +, TyDesc(NULL) +, IsStatic(false) +, IsDefinition(false) +{} + +/// ApplyToFields - Target the visitor to the fields of the global. +/// +void GlobalDesc::ApplyToFields(DIVisitor *Visitor) { + AnchoredDesc::ApplyToFields(Visitor); + + Visitor->Apply(Context); + Visitor->Apply(Name); + Visitor->Apply(FullName); + Visitor->Apply(LinkageName); + Visitor->Apply(File); + Visitor->Apply(Line); + Visitor->Apply(TyDesc); + Visitor->Apply(IsStatic); + Visitor->Apply(IsDefinition); +} + +//===----------------------------------------------------------------------===// + +GlobalVariableDesc::GlobalVariableDesc() +: GlobalDesc(DW_TAG_variable) +, Global(NULL) +{} + +// Implement isa/cast/dyncast. +bool GlobalVariableDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_variable; +} + +/// ApplyToFields - Target the visitor to the fields of the GlobalVariableDesc. +/// +void GlobalVariableDesc::ApplyToFields(DIVisitor *Visitor) { + GlobalDesc::ApplyToFields(Visitor); + + Visitor->Apply(Global); +} + +/// getDescString - Return a string used to compose global names and labels. +/// +const char *GlobalVariableDesc::getDescString() const { + return "llvm.dbg.global_variable"; +} + +/// getTypeString - Return a string used to label this descriptors type. +/// +const char *GlobalVariableDesc::getTypeString() const { + return "llvm.dbg.global_variable.type"; +} + +/// getAnchorString - Return a string used to label this descriptor's anchor. +/// +const char *const GlobalVariableDesc::AnchorString = "llvm.dbg.global_variables"; +const char *GlobalVariableDesc::getAnchorString() const { + return AnchorString; +} + +#ifndef NDEBUG +void GlobalVariableDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Anchor(" << getAnchor() << "), " + << "Name(\"" << getName() << "\"), " + << "FullName(\"" << getFullName() << "\"), " + << "LinkageName(\"" << getLinkageName() << "\"), " + << "File(" << getFile() << ")," + << "Line(" << getLine() << ")," + << "Type(" << getType() << "), " + << "IsStatic(" << (isStatic() ? "true" : "false") << "), " + << "IsDefinition(" << (isDefinition() ? "true" : "false") << "), " + << "Global(" << Global << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +SubprogramDesc::SubprogramDesc() +: GlobalDesc(DW_TAG_subprogram) +{} + +// Implement isa/cast/dyncast. +bool SubprogramDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_subprogram; +} + +/// ApplyToFields - Target the visitor to the fields of the +/// SubprogramDesc. +void SubprogramDesc::ApplyToFields(DIVisitor *Visitor) { + GlobalDesc::ApplyToFields(Visitor); +} + +/// getDescString - Return a string used to compose global names and labels. +/// +const char *SubprogramDesc::getDescString() const { + return "llvm.dbg.subprogram"; +} + +/// getTypeString - Return a string used to label this descriptors type. +/// +const char *SubprogramDesc::getTypeString() const { + return "llvm.dbg.subprogram.type"; +} + +/// getAnchorString - Return a string used to label this descriptor's anchor. +/// +const char *const SubprogramDesc::AnchorString = "llvm.dbg.subprograms"; +const char *SubprogramDesc::getAnchorString() const { + return AnchorString; +} + +#ifndef NDEBUG +void SubprogramDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << "), " + << "Anchor(" << getAnchor() << "), " + << "Name(\"" << getName() << "\"), " + << "FullName(\"" << getFullName() << "\"), " + << "LinkageName(\"" << getLinkageName() << "\"), " + << "File(" << getFile() << ")," + << "Line(" << getLine() << ")," + << "Type(" << getType() << "), " + << "IsStatic(" << (isStatic() ? "true" : "false") << "), " + << "IsDefinition(" << (isDefinition() ? "true" : "false") << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + +BlockDesc::BlockDesc() +: DebugInfoDesc(DW_TAG_lexical_block) +, Context(NULL) +{} + +// Implement isa/cast/dyncast. +bool BlockDesc::classof(const DebugInfoDesc *D) { + return D->getTag() == DW_TAG_lexical_block; +} + +/// ApplyToFields - Target the visitor to the fields of the BlockDesc. +/// +void BlockDesc::ApplyToFields(DIVisitor *Visitor) { + DebugInfoDesc::ApplyToFields(Visitor); + + Visitor->Apply(Context); +} + +/// getDescString - Return a string used to compose global names and labels. +/// +const char *BlockDesc::getDescString() const { + return "llvm.dbg.block"; +} + +/// getTypeString - Return a string used to label this descriptors type. +/// +const char *BlockDesc::getTypeString() const { + return "llvm.dbg.block.type"; +} + +#ifndef NDEBUG +void BlockDesc::dump() { + cerr << getDescString() << " " + << "Version(" << getVersion() << "), " + << "Tag(" << getTag() << ")," + << "Context(" << Context << ")\n"; +} +#endif + +//===----------------------------------------------------------------------===// + DebugInfoDesc *DIDeserializer::Deserialize(Value *V) { return Deserialize(getGlobalVariable(V)); } @@ -505,7 +1289,8 @@ if (EmptyStructPtrTy) return EmptyStructPtrTy; // Construct the pointer to empty structure type. - const StructType *EmptyStructTy = StructType::get(NULL, NULL); + const StructType *EmptyStructTy = + StructType::get(std::vector()); // Construct the pointer to empty structure type. EmptyStructPtrTy = PointerType::getUnqual(EmptyStructTy); @@ -522,7 +1307,6 @@ if (!Ty) { // Set up fields vector. std::vector Fields; - // Get types of fields. DIGetTypesVisitor GTAM(*this, Fields); GTAM.ApplyToFields(DD); @@ -580,9 +1364,8 @@ const StructType *Ty = getTagType(DD); // Create the GlobalVariable early to prevent infinite recursion. - GlobalVariable *GV = - new GlobalVariable(Ty, true, DD->getLinkage(), - NULL, DD->getDescString(), M); + GlobalVariable *GV = new GlobalVariable(Ty, true, DD->getLinkage(), + NULL, DD->getDescString(), M); GV->setSection("llvm.metadata"); // Insert new GlobalVariable in DescGlobals map. @@ -590,11 +1373,10 @@ // Set up elements vector std::vector Elements; - // Add fields. DISerializeVisitor SRAM(*this, Elements); SRAM.ApplyToFields(DD); - + // Set the globals initializer. GV->setInitializer(ConstantStruct::get(Ty, Elements)); @@ -707,8 +1489,8 @@ //===----------------------------------------------------------------------===// DebugScope::~DebugScope() { - for (unsigned i = 0, e = Scopes.size(); i < e; ++i) delete Scopes[i]; - for (unsigned i = 0, e = Variables.size(); i < e; ++i) delete Variables[i]; + for (unsigned i = 0, N = Scopes.size(); i < N; ++i) delete Scopes[i]; + for (unsigned j = 0, M = Variables.size(); j < M; ++j) delete Variables[j]; } //===----------------------------------------------------------------------===// @@ -811,12 +1593,11 @@ /// SetupCompileUnits - Set up the unique vector of compile units. /// void MachineModuleInfo::SetupCompileUnits(Module &M) { - std::vector CUList; - CompileUnitDesc CUD; - getAnchoredDescriptors(M, &CUD, CUList); + std::vectorCU = getAnchoredDescriptors(M); - for (unsigned i = 0, e = CUList.size(); i < e; i++) - CompileUnits.insert((CompileUnitDesc*)CUList[i]); + for (unsigned i = 0, N = CU.size(); i < N; i++) { + CompileUnits.insert(CU[i]); + } } /// getCompileUnits - Return a vector of debug compile units. @@ -825,31 +1606,12 @@ return CompileUnits; } -/// getAnchoredDescriptors - Return a vector of anchored debug descriptors. -/// -void -MachineModuleInfo::getAnchoredDescriptors(Module &M, const AnchoredDesc *Desc, - std::vector &AnchoredDescs) { - std::vector Globals; - getGlobalVariablesUsing(M, Desc->getAnchorString(), Globals); - - for (unsigned i = 0, e = Globals.size(); i < e; ++i) { - GlobalVariable *GV = Globals[i]; - - // FIXME - In the short term, changes are too drastic to continue. - if (DebugInfoDesc::TagFromGlobal(GV) == Desc->getTag() && - DebugInfoDesc::VersionFromGlobal(GV) == LLVMDebugVersion) - AnchoredDescs.push_back(DR.Deserialize(GV)); - } -} - /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the /// named GlobalVariable. -void +std::vector MachineModuleInfo::getGlobalVariablesUsing(Module &M, - const std::string &RootName, - std::vector &Globals) { - return ::getGlobalVariablesUsing(M, RootName, Globals); + const std::string &RootName) { + return ::getGlobalVariablesUsing(M, RootName); } /// RecordSourceLine - Records location information and associates it with a @@ -935,10 +1697,9 @@ /// getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the /// specified MachineBasicBlock. -LandingPadInfo & -MachineModuleInfo::getOrCreateLandingPadInfo(MachineBasicBlock *LandingPad) { +LandingPadInfo &MachineModuleInfo::getOrCreateLandingPadInfo + (MachineBasicBlock *LandingPad) { unsigned N = LandingPads.size(); - for (unsigned i = 0; i < N; ++i) { LandingPadInfo &LP = LandingPads[i]; if (LP.LandingPadBlock == LandingPad) @@ -974,7 +1735,7 @@ LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad); LP.Personality = Personality; - for (unsigned i = 0, e = Personalities.size(); i < e; ++i) + for (unsigned i = 0; i < Personalities.size(); ++i) if (Personalities[i] == Personality) return; @@ -995,12 +1756,9 @@ void MachineModuleInfo::addFilterTypeInfo(MachineBasicBlock *LandingPad, std::vector &TyInfo) { LandingPadInfo &LP = getOrCreateLandingPadInfo(LandingPad); - unsigned TyInfoSize = TyInfo.size(); - std::vector IdsInFilter(TyInfoSize); - - for (unsigned I = 0; I != TyInfoSize; ++I) + std::vector IdsInFilter (TyInfo.size()); + for (unsigned I = 0, E = TyInfo.size(); I != E; ++I) IdsInFilter[I] = getTypeIDFor(TyInfo[I]); - LP.TypeIds.push_back(getFilterIDFor(IdsInFilter)); } @@ -1025,7 +1783,7 @@ continue; } - for (unsigned j = 0; j != LandingPads[i].BeginLabels.size(); ) { + for (unsigned j=0; j != LandingPads[i].BeginLabels.size(); ) { unsigned BeginLabel = MappedLabel(LandingPad.BeginLabels[j]); unsigned EndLabel = MappedLabel(LandingPad.EndLabels[j]); @@ -1059,9 +1817,8 @@ /// getTypeIDFor - Return the type id for the specified typeinfo. This is /// function wide. unsigned MachineModuleInfo::getTypeIDFor(GlobalVariable *TI) { - for (unsigned i = 0, e = TypeInfos.size(); i != e; ++i) - if (TypeInfos[i] == TI) - return i + 1; + for (unsigned i = 0, N = TypeInfos.size(); i != N; ++i) + if (TypeInfos[i] == TI) return i + 1; TypeInfos.push_back(TI); return TypeInfos.size(); @@ -1091,10 +1848,8 @@ // Add the new filter. int FilterID = -(1 + FilterIds.size()); FilterIds.reserve(FilterIds.size() + TyIds.size() + 1); - for (unsigned I = 0, N = TyIds.size(); I != N; ++I) FilterIds.push_back(TyIds[I]); - FilterEnds.push_back(FilterIds.size()); FilterIds.push_back(0); // terminator return FilterID; @@ -1113,15 +1868,16 @@ const Function* Personality = NULL; // Scan landing pads. If there is at least one non-NULL personality - use it. - for (unsigned i = 0, e = LandingPads.size(); i != e; ++i) + for (unsigned i = 0; i != LandingPads.size(); ++i) if (LandingPads[i].Personality) { Personality = LandingPads[i].Personality; break; } - for (unsigned i = 0, e = Personalities.size(); i < e; ++i) + for (unsigned i = 0; i < Personalities.size(); ++i) { if (Personalities[i] == Personality) return i; + } // This should never happen assert(0 && "Personality function should be set!"); @@ -1193,3 +1949,4 @@ FunctionPass *createDebugLabelFoldingPass() { return new DebugLabelFolder(); } } + Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=53120&r1=53119&r2=53120&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Jul 3 17:53:42 2008 @@ -27,7 +27,6 @@ #include "llvm/IntrinsicInst.h" #include "llvm/ParameterAttributes.h" #include "llvm/CodeGen/Collector.h" -#include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineInstrBuilder.h" Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp?rev=53120&r1=53119&r2=53120&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Thu Jul 3 17:53:42 2008 @@ -18,7 +18,7 @@ #include "llvm/CodeGen/ScheduleDAG.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineFunction.h" -#include "llvm/CodeGen/MachineDebugInfoDesc.h" +#include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/Target/TargetRegisterInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Support/GraphWriter.h" Modified: llvm/trunk/lib/VMCore/IntrinsicInst.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/IntrinsicInst.cpp?rev=53120&r1=53119&r2=53120&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/IntrinsicInst.cpp (original) +++ llvm/trunk/lib/VMCore/IntrinsicInst.cpp Thu Jul 3 17:53:42 2008 @@ -29,7 +29,6 @@ #include "llvm/Constants.h" #include "llvm/GlobalVariable.h" #include "llvm/Analysis/ValueTracking.h" -#include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/CodeGen/MachineModuleInfo.h" using namespace llvm; From isanbard at gmail.com Thu Jul 3 17:55:09 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 03 Jul 2008 22:55:09 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53122 - in /llvm-gcc-4.2/trunk/gcc: c-incpath.c config.gcc config/i386/darwin64.h llvm-debug.cpp llvm-debug.h Message-ID: <200807032255.m63Mt9uU027690@zion.cs.uiuc.edu> Author: void Date: Thu Jul 3 17:55:09 2008 New Revision: 53122 URL: http://llvm.org/viewvc/llvm-project?rev=53122&view=rev Log: Revert my previous check-in that split up MachineModuleInfo. It turns out to slow the compiler down at -O0 some 30% or more. Ooops. Modified: llvm-gcc-4.2/trunk/gcc/c-incpath.c llvm-gcc-4.2/trunk/gcc/config.gcc llvm-gcc-4.2/trunk/gcc/config/i386/darwin64.h llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp llvm-gcc-4.2/trunk/gcc/llvm-debug.h Modified: llvm-gcc-4.2/trunk/gcc/c-incpath.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-incpath.c?rev=53122&r1=53121&r2=53122&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/c-incpath.c (original) +++ llvm-gcc-4.2/trunk/gcc/c-incpath.c Thu Jul 3 17:55:09 2008 @@ -176,13 +176,14 @@ } } - /* APPLE LOCAL begin headermaps 3871393 */ +#include + /* Private function that hashes the contents of the null-terminated string in a case-insensitive way. For use by headermaps only. */ static inline -uint32 hmap_hash_string (const char *str) +uint32_t hmap_hash_string (const char *str) { const char *sp; unsigned hash_code = 0; @@ -296,9 +297,9 @@ struct hmap_header_map *headermap; const char *strings; struct hmap_bucket *buckets; - uint32 bucket_mask; - uint32 i; - uint32 key_offset; + uint32_t bucket_mask; + uint32_t i; + uint32_t key_offset; headermap = (struct hmap_header_map *)dir->header_map; strings = ((const char *)headermap) + headermap->strings_offset; Modified: llvm-gcc-4.2/trunk/gcc/config.gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config.gcc?rev=53122&r1=53121&r2=53122&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config.gcc (original) +++ llvm-gcc-4.2/trunk/gcc/config.gcc Thu Jul 3 17:55:09 2008 @@ -1064,6 +1064,8 @@ # Deleted with_arch # APPLE LOCAL mainline with_cpu=${with_cpu:-core2} + # APPLE LOCAL Macintosh alignment 2002-2-19 --ff + extra_options="${extra_options} i386/darwin.opt" tmake_file="t-darwin ${cpu_type}/t-darwin64 t-slibgcc-darwin" tm_file="${tm_file} ${cpu_type}/darwin64.h" ;; Modified: llvm-gcc-4.2/trunk/gcc/config/i386/darwin64.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/darwin64.h?rev=53122&r1=53121&r2=53122&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/darwin64.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/darwin64.h Thu Jul 3 17:55:09 2008 @@ -30,6 +30,7 @@ #undef SUBTARGET_EXTRA_SPECS #define SUBTARGET_EXTRA_SPECS \ + DARWIN_EXTRA_SPECS \ { "darwin_arch", DARWIN_ARCH_SPEC }, \ { "darwin_crt2", "" }, \ { "darwin_subarch", DARWIN_SUBARCH_SPEC }, Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=53122&r1=53121&r2=53122&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Thu Jul 3 17:55:09 2008 @@ -880,26 +880,23 @@ MachineModuleInfo MMI; MMI.AnalyzeModule(*TheModule); - std::vector Subprograms; - SubprogramDesc SPD; - MMI.getAnchoredDescriptors(*TheModule, &SPD, Subprograms); + std::vector Subprograms = + MMI.getAnchoredDescriptors(*TheModule); if (!Subprograms.empty()) - SubprogramAnchor = ((SubprogramDesc*)Subprograms[0])->getAnchor(); + SubprogramAnchor = Subprograms[0]->getAnchor(); - std::vector CUs; - CompileUnitDesc CUD; - MMI.getAnchoredDescriptors(*TheModule, &CUD, CUs); + std::vector CUs = + MMI.getAnchoredDescriptors(*TheModule); if (!CUs.empty()) - CompileUnitAnchor = ((CompileUnitDesc*)CUs[0])->getAnchor(); + CompileUnitAnchor = CUs[0]->getAnchor(); - std::vector GVs; - GlobalVariableDesc GVD; - MMI.getAnchoredDescriptors(*TheModule, &GVD, GVs); + std::vector GVs = + MMI.getAnchoredDescriptors(*TheModule); if (!GVs.empty()) - GlobalVariableAnchor = ((GlobalVariableDesc*)GVs[0])->getAnchor(); + GlobalVariableAnchor = GVs[0]->getAnchor(); const std::map &GlobalDescs = MMI.getDIDeserializer()->getGlobalDescs(); Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.h?rev=53122&r1=53121&r2=53122&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Thu Jul 3 17:55:09 2008 @@ -28,7 +28,6 @@ #ifndef LLVM_DEBUG_H #define LLVM_DEBUG_H -#include "llvm/CodeGen/MachineDebugInfoDesc.h" #include "llvm/CodeGen/MachineModuleInfo.h" extern "C" { From isanbard at gmail.com Thu Jul 3 18:13:02 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 03 Jul 2008 23:13:02 -0000 Subject: [llvm-commits] [llvm] r53123 - in /llvm/trunk: include/llvm/CodeGen/MachineModuleInfo.h lib/CodeGen/DwarfWriter.cpp lib/CodeGen/MachineModuleInfo.cpp Message-ID: <200807032313.m63ND2bH028210@zion.cs.uiuc.edu> Author: void Date: Thu Jul 3 18:13:02 2008 New Revision: 53123 URL: http://llvm.org/viewvc/llvm-project?rev=53123&view=rev Log: Don't return std::vector by value, but pass it in by reference to be filled. Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h llvm/trunk/lib/CodeGen/DwarfWriter.cpp llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h?rev=53123&r1=53122&r2=53123&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h (original) +++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfo.h Thu Jul 3 18:13:02 2008 @@ -1152,16 +1152,17 @@ /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the /// named GlobalVariable. - std::vector - getGlobalVariablesUsing(Module &M, const std::string &RootName); + void getGlobalVariablesUsing(Module &M, const std::string &RootName, + std::vector &Result); /// getAnchoredDescriptors - Return a vector of anchored debug descriptors. /// - template std::vector getAnchoredDescriptors(Module &M) { + template + void getAnchoredDescriptors(Module &M, std::vector &AnchoredDescs) { T Desc; - std::vector Globals = - getGlobalVariablesUsing(M, Desc.getAnchorString()); - std::vector AnchoredDescs; + std::vector Globals; + getGlobalVariablesUsing(M, Desc.getAnchorString(), Globals); + for (unsigned i = 0, N = Globals.size(); i < N; ++i) { GlobalVariable *GV = Globals[i]; @@ -1171,8 +1172,6 @@ AnchoredDescs.push_back(cast(DR.Deserialize(GV))); } } - - return AnchoredDescs; } /// RecordRegionStart - Indicate the start of a region. Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=53123&r1=53122&r2=53123&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Thu Jul 3 18:13:02 2008 @@ -2630,8 +2630,8 @@ /// ConstructGlobalDIEs - Create DIEs for each of the externally visible /// global variables. void ConstructGlobalDIEs() { - std::vector GlobalVariables = - MMI->getAnchoredDescriptors(*M); + std::vector GlobalVariables; + MMI->getAnchoredDescriptors(*M, GlobalVariables); for (unsigned i = 0, N = GlobalVariables.size(); i < N; ++i) { GlobalVariableDesc *GVD = GlobalVariables[i]; @@ -2642,8 +2642,8 @@ /// ConstructSubprogramDIEs - Create DIEs for each of the externally visible /// subprograms. void ConstructSubprogramDIEs() { - std::vector Subprograms = - MMI->getAnchoredDescriptors(*M); + std::vector Subprograms; + MMI->getAnchoredDescriptors(*M, Subprograms); for (unsigned i = 0, N = Subprograms.size(); i < N; ++i) { SubprogramDesc *SPD = Subprograms[i]; Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=53123&r1=53122&r2=53123&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Thu Jul 3 18:13:02 2008 @@ -52,10 +52,9 @@ /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the /// named GlobalVariable. -static std::vector -getGlobalVariablesUsing(Module &M, const std::string &RootName) { - std::vector Result; // GlobalVariables matching criteria. - +static void +getGlobalVariablesUsing(Module &M, const std::string &RootName, + std::vector &Result) { std::vector FieldTypes; FieldTypes.push_back(Type::Int32Ty); FieldTypes.push_back(Type::Int32Ty); @@ -65,11 +64,8 @@ StructType::get(FieldTypes)); // If present and linkonce then scan for users. - if (UseRoot && UseRoot->hasLinkOnceLinkage()) { + if (UseRoot && UseRoot->hasLinkOnceLinkage()) getGlobalVariablesUsing(UseRoot, Result); - } - - return Result; } /// isStringValue - Return true if the given value can be coerced to a string. @@ -1593,7 +1589,8 @@ /// SetupCompileUnits - Set up the unique vector of compile units. /// void MachineModuleInfo::SetupCompileUnits(Module &M) { - std::vectorCU = getAnchoredDescriptors(M); + std::vector CU; + getAnchoredDescriptors(M, CU); for (unsigned i = 0, N = CU.size(); i < N; i++) { CompileUnits.insert(CU[i]); @@ -1608,10 +1605,11 @@ /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the /// named GlobalVariable. -std::vector +void MachineModuleInfo::getGlobalVariablesUsing(Module &M, - const std::string &RootName) { - return ::getGlobalVariablesUsing(M, RootName); + const std::string &RootName, + std::vector&Result){ + return ::getGlobalVariablesUsing(M, RootName, Result); } /// RecordSourceLine - Records location information and associates it with a From isanbard at gmail.com Thu Jul 3 18:13:57 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 03 Jul 2008 23:13:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53124 - /llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Message-ID: <200807032313.m63NDv7I028250@zion.cs.uiuc.edu> Author: void Date: Thu Jul 3 18:13:57 2008 New Revision: 53124 URL: http://llvm.org/viewvc/llvm-project?rev=53124&view=rev Log: Pass in std::vector by reference instead of returning by value. Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=53124&r1=53123&r2=53124&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Thu Jul 3 18:13:57 2008 @@ -880,20 +880,20 @@ MachineModuleInfo MMI; MMI.AnalyzeModule(*TheModule); - std::vector Subprograms = - MMI.getAnchoredDescriptors(*TheModule); + std::vector Subprograms; + MMI.getAnchoredDescriptors(*TheModule, Subprograms); if (!Subprograms.empty()) SubprogramAnchor = Subprograms[0]->getAnchor(); - std::vector CUs = - MMI.getAnchoredDescriptors(*TheModule); + std::vector CUs; + MMI.getAnchoredDescriptors(*TheModule, CUs); if (!CUs.empty()) CompileUnitAnchor = CUs[0]->getAnchor(); - std::vector GVs = - MMI.getAnchoredDescriptors(*TheModule); + std::vector GVs; + MMI.getAnchoredDescriptors(*TheModule, GVs); if (!GVs.empty()) GlobalVariableAnchor = GVs[0]->getAnchor(); From kremenek at apple.com Thu Jul 3 18:27:19 2008 From: kremenek at apple.com (Ted Kremenek) Date: Thu, 03 Jul 2008 23:27:19 -0000 Subject: [llvm-commits] [llvm] r53126 - /llvm/tags/checker/checker-57/ Message-ID: <200807032327.m63NRJki028747@zion.cs.uiuc.edu> Author: kremenek Date: Thu Jul 3 18:27:19 2008 New Revision: 53126 URL: http://llvm.org/viewvc/llvm-project?rev=53126&view=rev Log: Tagging checker-57. Added: llvm/tags/checker/checker-57/ - copied from r53125, llvm/trunk/ From isanbard at gmail.com Thu Jul 3 18:36:34 2008 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 03 Jul 2008 23:36:34 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53128 - in /llvm-gcc-4.2/trunk/gcc: llvm-debug.cpp llvm-debug.h Message-ID: <200807032336.m63NaYbi029168@zion.cs.uiuc.edu> Author: void Date: Thu Jul 3 18:36:34 2008 New Revision: 53128 URL: http://llvm.org/viewvc/llvm-project?rev=53128&view=rev Log: Use DenseMap for a small speedup. Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp llvm-gcc-4.2/trunk/gcc/llvm-debug.h Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp?rev=53128&r1=53127&r2=53128&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.cpp Thu Jul 3 18:36:34 2008 @@ -452,7 +452,7 @@ if (TREE_CODE(type) == VOID_TYPE) return NULL; // Check to see if the compile unit already has created this type. - TypeDesc *&Slot = TypeCache[type]; + TypeDesc *Slot = TypeCache[type]; if (Slot) return Slot; // Ty will have contain the resulting type. @@ -473,7 +473,7 @@ // typedefs are derived from some other type. DerivedTypeDesc *DerivedTy = new DerivedTypeDesc(DW_TAG_typedef); // Set the slot early to prevent recursion difficulties. - Slot = Ty = DerivedTy; + TypeCache[type] = Ty = DerivedTy; // Handle derived type. TypeDesc *FromTy = getOrCreateType(DECL_ORIGINAL_TYPE(Name), Unit); DerivedTy->setFromType(FromTy); @@ -503,7 +503,7 @@ Ty = DerivedTy; // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, DerivedTy); + TypeCache[type] = AddTypeQualifiers(type, Unit, DerivedTy); // Handle the derived type. TypeDesc *FromTy = getOrCreateType(TREE_TYPE(type), Unit); DerivedTy->setFromType(FromTy); @@ -525,7 +525,7 @@ Ty = SubrTy; // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, SubrTy); + TypeCache[type] = AddTypeQualifiers(type, Unit, SubrTy); // Prepare to add the arguments for the subroutine. std::vector &Elements = SubrTy->getElements(); @@ -560,14 +560,14 @@ Ty = ArrayTy = new CompositeTypeDesc(DW_TAG_vector_type); // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, ArrayTy); + TypeCache[type] = AddTypeQualifiers(type, Unit, ArrayTy); // Use the element type of the from this point. type = TREE_TYPE(TYPE_FIELDS(TYPE_DEBUG_REPRESENTATION_TYPE(type))); } else { Ty = ArrayTy = new CompositeTypeDesc(DW_TAG_array_type); // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, ArrayTy); + TypeCache[type] = AddTypeQualifiers(type, Unit, ArrayTy); } // Prepare to add the dimensions of the array. @@ -603,7 +603,7 @@ CompositeTypeDesc *Enum = new CompositeTypeDesc(DW_TAG_enumeration_type); Ty = Enum; // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, Enum); + TypeCache[type] = AddTypeQualifiers(type, Unit, Enum); // Prepare to add the enumeration values. std::vector &Elements = Enum->getElements(); @@ -633,7 +633,7 @@ Ty = StructTy; // Set the slot early to prevent recursion difficulties. // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, StructTy); + TypeCache[type] = AddTypeQualifiers(type, Unit, StructTy); // Prepare to add the fields. std::vector &Elements = StructTy->getElements(); @@ -762,7 +762,7 @@ BasicTypeDesc *BTy = new BasicTypeDesc(); Ty = BTy; // Any other use of the type should include the qualifiers. - Slot = AddTypeQualifiers(type, Unit, BTy); + TypeCache[type] = AddTypeQualifiers(type, Unit, BTy); // The encoding specific to the type. unsigned Encoding = 0; @@ -818,9 +818,8 @@ Ty->setOffset(Offset); } - DEBUGASSERT(Slot && "Unimplemented type"); - - return Slot; + DEBUGASSERT(TypeCache[type] && "Unimplemented type"); + return TypeCache[type]; } /// getOrCreateCompileUnit - Get the compile unit from the cache or create a new Modified: llvm-gcc-4.2/trunk/gcc/llvm-debug.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-debug.h?rev=53128&r1=53127&r2=53128&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-debug.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-debug.h Thu Jul 3 18:36:34 2008 @@ -60,7 +60,7 @@ std::map CompileUnitCache; // Cache of previously constructed // CompileUnits. - std::map TypeCache; + DenseMap TypeCache; // Cache of previously constructed // Types. Function *StopPointFn; // llvm.dbg.stoppoint From dalej at apple.com Thu Jul 3 19:28:08 2008 From: dalej at apple.com (Dale Johannesen) Date: Fri, 04 Jul 2008 00:28:08 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c Message-ID: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> Author: johannes Date: Thu Jul 3 19:28:07 2008 New Revision: 53130 URL: http://llvm.org/viewvc/llvm-project?rev=53130&view=rev Log: Do not emit unreferenced static functions at -O0. This is the gcc-4.0 behavior, changed deliberately in gcc-4.2, see PR 24561. After discussion Chris, Evan and I agreed the 4.0 behavior is better so we're going back to that. Note this applies to C++, not C by default, because you also need -funit-at-a-time (default in C++ only). Modified: llvm-gcc-4.2/trunk/gcc/cgraphunit.c Modified: llvm-gcc-4.2/trunk/gcc/cgraphunit.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cgraphunit.c?rev=53130&r1=53129&r2=53130&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/cgraphunit.c (original) +++ llvm-gcc-4.2/trunk/gcc/cgraphunit.c Thu Jul 3 19:28:07 2008 @@ -232,9 +232,19 @@ in the original implementation and it is unclear whether we want to change the behavior here. */ if (((TREE_PUBLIC (decl) +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM + /* Don't keep static functions at -O0. Note that gcc-4.0 removes such + functions; gcc-4.2 does not. Radar 6037815. See also PR 24561. + + For this to be effective, -funit-at-a-time must also be on. This + is the default in C++/ObjC++, but not C/ObjC. */ || (!optimize && !node->local.disregard_inline_limits && !DECL_DECLARED_INLINE_P (decl) - && !node->origin)) + && !node->origin) +#endif + ) +/* LLVM LOCAL end */ && !flag_whole_program) && !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl)) return true; From dpatel at apple.com Thu Jul 3 19:46:39 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 04 Jul 2008 00:46:39 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53131 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200807040046.m640kdff031350@zion.cs.uiuc.edu> Author: dpatel Date: Thu Jul 3 19:46:39 2008 New Revision: 53131 URL: http://llvm.org/viewvc/llvm-project?rev=53131&view=rev Log: Expand BUILT_IN_OBJECT_SIZE. 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=53131&r1=53130&r2=53131&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Jul 3 19:46:39 2008 @@ -4334,6 +4334,27 @@ case BUILT_IN_UNWIND_INIT: return EmitBuiltinUnwindInit(exp, Result); + case BUILT_IN_OBJECT_SIZE: { + tree ArgList = TREE_OPERAND (exp, 1); + if (!validate_arglist(ArgList, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) { + error("Invalid builtin_object_size argument types"); + return false; + } + tree ObjSizeTree = TREE_VALUE (TREE_CHAIN (ArgList)); + STRIP_NOPS (ObjSizeTree); + if (TREE_CODE (ObjSizeTree) != INTEGER_CST + || tree_int_cst_sgn (ObjSizeTree) < 0 + || compare_tree_int (ObjSizeTree, 3) > 0) { + error("Invalid second builtin_object_size argument"); + return false; + } + + if (tree_low_cst (ObjSizeTree, 0) < 2) + Result = ConstantInt::get(Type::Int32Ty, 0); + else + Result = ConstantInt::getAllOnesValue(Type::Int32Ty); + return true; + } // Unary bit counting intrinsics. // NOTE: do not merge these case statements. That will cause the memoized // Function* to be incorrectly shared across the different typed functions. From clattner at apple.com Thu Jul 3 21:58:17 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 3 Jul 2008 19:58:17 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> Message-ID: <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> On Jul 3, 2008, at 5:28 PM, Dale Johannesen wrote: > Author: johannes > Date: Thu Jul 3 19:28:07 2008 > New Revision: 53130 > > URL: http://llvm.org/viewvc/llvm-project?rev=53130&view=rev > Log: > Do not emit unreferenced static functions at -O0. > This is the gcc-4.0 behavior, changed deliberately > in gcc-4.2, see PR 24561. After discussion Chris, > Evan and I agreed the 4.0 behavior is better so > we're going back to that. > > Note this applies to C++, not C by default, because > you also need -funit-at-a-time (default in C++ only). FWIW, the major issue here is that emitting dead static functions at - O0 -g pulls in debug info for them. For a simple file that includes something like this is majority of the debug info, regardless of whether streams are used or not. Thanks for tracking this down Dale! -Chris From clattner at apple.com Thu Jul 3 22:00:01 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 3 Jul 2008 20:00:01 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53131 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200807040046.m640kdff031350@zion.cs.uiuc.edu> References: <200807040046.m640kdff031350@zion.cs.uiuc.edu> Message-ID: <61FBDF6B-2B28-48D8-A82C-2D110C7440FC@apple.com> On Jul 3, 2008, at 5:46 PM, Devang Patel wrote: > > URL: http://llvm.org/viewvc/llvm-project?rev=53131&view=rev > Log: > Expand BUILT_IN_OBJECT_SIZE. Hey Devang, > + if (tree_low_cst (ObjSizeTree, 0) < 2) > + Result = ConstantInt::get(Type::Int32Ty, 0); > + else > + Result = ConstantInt::getAllOnesValue(Type::Int32Ty); > + return true; > + } Isn't this backwards? GCC has: object_size_type = tree_low_cst (ost, 0); return object_size_type < 2 ? constm1_rtx : const0_rtx; -Chris From echristo at apple.com Thu Jul 3 22:48:31 2008 From: echristo at apple.com (Eric Christopher) Date: Thu, 3 Jul 2008 20:48:31 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> Message-ID: On Jul 3, 2008, at 7:58 PM, Chris Lattner wrote: > > On Jul 3, 2008, at 5:28 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Thu Jul 3 19:28:07 2008 >> New Revision: 53130 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=53130&view=rev >> Log: >> Do not emit unreferenced static functions at -O0. >> This is the gcc-4.0 behavior, changed deliberately >> in gcc-4.2, see PR 24561. After discussion Chris, >> Evan and I agreed the 4.0 behavior is better so >> we're going back to that. >> >> Note this applies to C++, not C by default, because >> you also need -funit-at-a-time (default in C++ only). > > FWIW, the major issue here is that emitting dead static functions at - > O0 -g pulls in debug info for them. For a simple file that includes > something like this is majority of the debug info, > regardless of whether streams are used or not. > > Thanks for tracking this down Dale! I don't know that I agree with this. For example: struct foo { ... } static void debug_foo (struct foo) { printf(...) ... } You've just made it impossible to print out (without additional work) struct foo from within gdb if foo is only used in one file and therefore doesn't need a non-static debug routine. Worse, this isn't obvious - especially at O0. -eric From clattner at apple.com Fri Jul 4 00:11:45 2008 From: clattner at apple.com (Chris Lattner) Date: Thu, 3 Jul 2008 22:11:45 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> Message-ID: <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> On Jul 3, 2008, at 8:48 PM, Eric Christopher wrote: >> Thanks for tracking this down Dale! > > I don't know that I agree with this. For example: > > struct foo > { > ... > } > > static void debug_foo (struct foo) > { > printf(...) > ... > } > > You've just made it impossible to print out (without additional work) > struct foo from within gdb if foo is only used in one file and > therefore doesn't need a non-static debug routine. Worse, this isn't > obvious - especially at O0. Make the function non-static. Note that this only changes behavior when compiling C++, not C. In C++ the same thing already happens for inline functions and many other cases. -Chris From monping at apple.com Fri Jul 4 01:43:51 2008 From: monping at apple.com (Mon P Wang) Date: Thu, 3 Jul 2008 23:43:51 -0700 Subject: [llvm-commits] [llvm] r53035 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <320689A9-CF1D-451C-9AB0-31B3737AD1CE@apple.com> References: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> <3FFA1FED-6CE4-4669-8ABE-340E10AAD092@apple.com> <200807031106.15621.baldrick@free.fr> <599CE6E2-534B-4615-8816-BBC290BCD995@apple.com> <320689A9-CF1D-451C-9AB0-31B3737AD1CE@apple.com> Message-ID: Hi, The problem with the patch I commit was thought the stack alignment of the slot was correct, the stores we generated for the StackConvert assumed the larger alignment. It makes more sense to use the alignment of source when we store and the alignment of the destination type when we load. This avoids the problem for that and I get the same failure with and without the patch in tests. Sorry for the mistake. -- Mon Ping Index: include/llvm/CodeGen/SelectionDAG.h =================================================================== --- include/llvm/CodeGen/SelectionDAG.h (revision 53112) +++ include/llvm/CodeGen/SelectionDAG.h (working copy) @@ -589,9 +589,10 @@ void dump() const; /// CreateStackTemporary - Create a stack temporary, suitable for holding the - /// specified value type. - SDOperand CreateStackTemporary(MVT VT); - + /// specified value type. If minAlign is specified, the slot size will have + /// at least that alignment. + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1); + /// FoldSetCC - Constant fold a setcc to true or false. SDOperand FoldSetCC(MVT VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond); Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp (revision 53112) +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp (working copy) @@ -1080,16 +1080,17 @@ /// CreateStackTemporary - Create a stack temporary, suitable for holding the /// specified value type. -SDOperand SelectionDAG::CreateStackTemporary(MVT VT) { +SDOperand SelectionDAG::CreateStackTemporary(MVT VT, unsigned minAlign) { MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo(); unsigned ByteSize = VT.getSizeInBits()/8; const Type *Ty = VT.getTypeForMVT(); - unsigned StackAlign = (unsigned)TLI.getTargetData()- >getPrefTypeAlignment(Ty); + unsigned StackAlign = + std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty), minAlign); + int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign); return getFrameIndex(FrameIdx, TLI.getPointerTy()); } - SDOperand SelectionDAG::FoldSetCC(MVT VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond) { // These setcc operations always fold. Index: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp =================================================================== --- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (revision 53112) +++ lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (working copy) @@ -4871,35 +4871,41 @@ MVT SlotVT, MVT DestVT) { // Create the stack frame object. - SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT); - + unsigned SrcAlign = TLI.getTargetData()->getPrefTypeAlignment( + SrcOp.getValueType().getTypeForMVT()); + SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT, SrcAlign); + FrameIndexSDNode *StackPtrFI = cast(FIPtr); int SPFI = StackPtrFI->getIndex(); - + unsigned SrcSize = SrcOp.getValueType().getSizeInBits(); unsigned SlotSize = SlotVT.getSizeInBits(); unsigned DestSize = DestVT.getSizeInBits(); + unsigned DestAlign = TLI.getTargetData()->getPrefTypeAlignment( + DestVT.getTypeForMVT()); // Emit a store to the stack slot. Use a truncstore if the input value is // later than DestVT. SDOperand Store; + if (SrcSize > SlotSize) Store = DAG.getTruncStore(DAG.getEntryNode(), SrcOp, FIPtr, - PseudoSourceValue::getFixedStack(), - SPFI, SlotVT); + PseudoSourceValue::getFixedStack(), SPFI, SlotVT, + false, SrcAlign); else { assert(SrcSize == SlotSize && "Invalid store"); Store = DAG.getStore(DAG.getEntryNode(), SrcOp, FIPtr, - PseudoSourceValue::getFixedStack(), - SPFI); + PseudoSourceValue::getFixedStack(), SPFI, + false, SrcAlign); } // Result is a load from the stack slot. if (SlotSize == DestSize) - return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0); + return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0, false, DestAlign); assert(SlotSize < DestSize && "Unknown extension!"); - return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT); + return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT, + false, DestAlign); } On Jul 3, 2008, at 1:09 PM, Mon P Wang wrote: > > Thanks, I'll take a look and see what is wrong with it. > > -- Mon Ping > > On Jul 3, 2008, at 11:20 AM, Evan Cheng wrote: > >> This is backed out for now. Mon Ping, please take a look. >> >> Evan >> >> On Jul 3, 2008, at 9:45 AM, Chris Lattner wrote: >> >>> >>> On Jul 3, 2008, at 2:06 AM, Duncan Sands wrote: >>> >>>> Hi Evan, >>>> >>>>> test/CodeGen/PowerPC/vec_misaligned.ll is not crashing in the >>>>> Legalizer. Can you check if your patch is the cause? >>>> >>>> it was caused by r53031: >>>> >>>> r53031 | wangmp | 2008-07-02 19:07:12 +0200 (Wed, 02 Jul 2008) | 4 >>>> lines >>>> >>>> Fixed problem in EmitStackConvert where the source and target type >>>> have different alignment by creating a stack slot with the max >>>> alignment of source and target type. >>> >>> If this patch is still causing breakage, please revert it. Mon Ping >>> can track down the problem and reapply when it is fixed. >>> >>> -Chris >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From echristo at apple.com Fri Jul 4 01:57:16 2008 From: echristo at apple.com (Eric Christopher) Date: Thu, 3 Jul 2008 23:57:16 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> Message-ID: >> > > Make the function non-static. Note that this only changes behavior > when compiling C++, not C. In C++ the same thing already happens for > inline functions and many other cases. Should only happen for static inlines in C++, but at any rate -fkeep- inline-functions will usually solve that. Can you make this triggerable based on that then or maybe a -fkeep-static-functions or something? It's also a change of behavior that could confuse people ... -eric From evan.cheng at apple.com Fri Jul 4 01:59:33 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 3 Jul 2008 23:59:33 -0700 Subject: [llvm-commits] [llvm] r52677 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll test/Transforms/DeadArgElim/deadretval2.ll test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: <20080702161128.GH7287@katherina.student.utwente.nl> References: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> <77A96C06-9C33-49DE-A06F-F8D4C48BC9F6@apple.com> <20080702084001.GC7287@katherina.student.utwente.nl> <20080702161128.GH7287@katherina.student.utwente.nl> Message-ID: Hi Matthijs, This patch works. But I didn't pay close attention to its impact on performance and compile time. Did you run it on MultiSource/ Applications? Do you see any real difference in either cateogry? Thanks, Evan On Jul 2, 2008, at 9:11 AM, Matthijs Kooijman wrote: > Hi all, > > I've attached a new patch, which removes an overzealous assert which > was not > appropriated. Even, could you try _this_ patch against SPEC 2006? > >> I'm not completely sure how to do the reverse. I think the best >> approach is to >> add a getArgumentNo() method that takes an operand number and >> returns the >> number of the corresponding argument. Alternatively, it could take >> a use >> iterator, Value* or Use* or something like that, but I think that >> will mostly >> lead to inefficient code. > I've implemented this, see the attached patch (all changes in > CallSite.h). If > there are no objections to this, I'll commit the CallSite changes > seperately. > > Gr. > > Matthijs > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Fri Jul 4 02:01:48 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 4 Jul 2008 00:01:48 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53113 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h In-Reply-To: <200807032209.m63M9OE7026032@zion.cs.uiuc.edu> References: <200807032209.m63M9OE7026032@zion.cs.uiuc.edu> Message-ID: Hi Devang, Does this work for older Mac OS X ld? That is, would older ld silently ignore the options? Thanks, Evan On Jul 3, 2008, at 3:09 PM, Devang Patel wrote: > Author: dpatel > Date: Thu Jul 3 17:09:23 2008 > New Revision: 53113 > > URL: http://llvm.org/viewvc/llvm-project?rev=53113&view=rev > Log: > Supply -mllvm to the linker. > > Modified: > llvm-gcc-4.2/trunk/gcc/config/darwin.h > > Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=53113&r1=53112&r2=53113&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) > +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Thu Jul 3 17:09:23 2008 > @@ -390,6 +390,9 @@ > %{!mmacosx-version-min=*:-macosx_version_min % > (darwin_minversion)} \ > %{mmacosx-version-min=*:-macosx_version_min %*} \ > "/* APPLE LOCAL end mainline 2007-02-20 5005743 */" \ > + "/* APPLE LOCAL begin llvm */" \ > + %{Zmllvm*:-mllvm %*} \ > + "/* APPLE LOCAL end llvm */" \ > %{nomultidefs} \ > %{Zmulti_module:-multi_module} %{Zsingle_module:-single_module} \ > %{Zmultiply_defined*:-multiply_defined %*} \ > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From echristo at apple.com Fri Jul 4 02:03:10 2008 From: echristo at apple.com (Eric Christopher) Date: Fri, 4 Jul 2008 00:03:10 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53113 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h In-Reply-To: References: <200807032209.m63M9OE7026032@zion.cs.uiuc.edu> Message-ID: <7C4BFF3C-DC8F-4790-A3CB-40FDC04A93C3@apple.com> On Jul 4, 2008, at 12:01 AM, Evan Cheng wrote: > Hi Devang, > > Does this work for older Mac OS X ld? That is, would older ld silently > ignore the options? And, uh, what's it do? -eric From evan.cheng at apple.com Fri Jul 4 02:54:10 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 4 Jul 2008 00:54:10 -0700 Subject: [llvm-commits] [llvm] r53035 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: References: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> <3FFA1FED-6CE4-4669-8ABE-340E10AAD092@apple.com> <200807031106.15621.baldrick@free.fr> <599CE6E2-534B-4615-8816-BBC290BCD995@apple.com> <320689A9-CF1D-451C-9AB0-31B3737AD1CE@apple.com> Message-ID: Thanks Mon Ping. Please commit. Evan On Jul 3, 2008, at 11:43 PM, Mon P Wang wrote: > Hi, > > The problem with the patch I commit was thought the stack alignment of > the slot was correct, the stores we generated for the StackConvert > assumed the larger alignment. It makes more sense to use the > alignment of source when we store and the alignment of the destination > type when we load. This avoids the problem for that and I get the same > failure with and without the patch in tests. Sorry for the mistake. > > > -- Mon Ping > > > Index: include/llvm/CodeGen/SelectionDAG.h > =================================================================== > --- include/llvm/CodeGen/SelectionDAG.h (revision 53112) > +++ include/llvm/CodeGen/SelectionDAG.h (working copy) > @@ -589,9 +589,10 @@ > void dump() const; > > /// CreateStackTemporary - Create a stack temporary, suitable for > holding the > - /// specified value type. > - SDOperand CreateStackTemporary(MVT VT); > - > + /// specified value type. If minAlign is specified, the slot size > will have > + /// at least that alignment. > + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1); > + > /// FoldSetCC - Constant fold a setcc to true or false. > SDOperand FoldSetCC(MVT VT, SDOperand N1, > SDOperand N2, ISD::CondCode Cond); > Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp > =================================================================== > --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp (revision 53112) > +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp (working copy) > @@ -1080,16 +1080,17 @@ > > /// CreateStackTemporary - Create a stack temporary, suitable for > holding the > /// specified value type. > -SDOperand SelectionDAG::CreateStackTemporary(MVT VT) { > +SDOperand SelectionDAG::CreateStackTemporary(MVT VT, unsigned > minAlign) { > MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo(); > unsigned ByteSize = VT.getSizeInBits()/8; > const Type *Ty = VT.getTypeForMVT(); > - unsigned StackAlign = (unsigned)TLI.getTargetData()- >> getPrefTypeAlignment(Ty); > + unsigned StackAlign = > + std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty), > minAlign); > + > int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign); > return getFrameIndex(FrameIdx, TLI.getPointerTy()); > } > > - > SDOperand SelectionDAG::FoldSetCC(MVT VT, SDOperand N1, > SDOperand N2, ISD::CondCode Cond) { > // These setcc operations always fold. > Index: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp > =================================================================== > --- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (revision 53112) > +++ lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (working copy) > @@ -4871,35 +4871,41 @@ > MVT SlotVT, > MVT DestVT) { > // Create the stack frame object. > - SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT); > - > + unsigned SrcAlign = TLI.getTargetData()->getPrefTypeAlignment( > + > SrcOp.getValueType().getTypeForMVT()); > + SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT, SrcAlign); > + > FrameIndexSDNode *StackPtrFI = cast(FIPtr); > int SPFI = StackPtrFI->getIndex(); > - > + > unsigned SrcSize = SrcOp.getValueType().getSizeInBits(); > unsigned SlotSize = SlotVT.getSizeInBits(); > unsigned DestSize = DestVT.getSizeInBits(); > + unsigned DestAlign = TLI.getTargetData()->getPrefTypeAlignment( > + > DestVT.getTypeForMVT()); > > // Emit a store to the stack slot. Use a truncstore if the input > value is > // later than DestVT. > SDOperand Store; > + > if (SrcSize > SlotSize) > Store = DAG.getTruncStore(DAG.getEntryNode(), SrcOp, FIPtr, > - PseudoSourceValue::getFixedStack(), > - SPFI, SlotVT); > + PseudoSourceValue::getFixedStack(), > SPFI, SlotVT, > + false, SrcAlign); > else { > assert(SrcSize == SlotSize && "Invalid store"); > Store = DAG.getStore(DAG.getEntryNode(), SrcOp, FIPtr, > - PseudoSourceValue::getFixedStack(), > - SPFI); > + PseudoSourceValue::getFixedStack(), SPFI, > + false, SrcAlign); > } > > // Result is a load from the stack slot. > if (SlotSize == DestSize) > - return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0); > + return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0, false, > DestAlign); > > assert(SlotSize < DestSize && "Unknown extension!"); > - return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, > SlotVT); > + return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, > SlotVT, > + false, DestAlign); > } > > > On Jul 3, 2008, at 1:09 PM, Mon P Wang wrote: > >> >> Thanks, I'll take a look and see what is wrong with it. >> >> -- Mon Ping >> >> On Jul 3, 2008, at 11:20 AM, Evan Cheng wrote: >> >>> This is backed out for now. Mon Ping, please take a look. >>> >>> Evan >>> >>> On Jul 3, 2008, at 9:45 AM, Chris Lattner wrote: >>> >>>> >>>> On Jul 3, 2008, at 2:06 AM, Duncan Sands wrote: >>>> >>>>> Hi Evan, >>>>> >>>>>> test/CodeGen/PowerPC/vec_misaligned.ll is not crashing in the >>>>>> Legalizer. Can you check if your patch is the cause? >>>>> >>>>> it was caused by r53031: >>>>> >>>>> r53031 | wangmp | 2008-07-02 19:07:12 +0200 (Wed, 02 Jul 2008) | 4 >>>>> lines >>>>> >>>>> Fixed problem in EmitStackConvert where the source and target type >>>>> have different alignment by creating a stack slot with the max >>>>> alignment of source and target type. >>>> >>>> If this patch is still causing breakage, please revert it. Mon >>>> Ping >>>> can track down the problem and reapply when it is fixed. >>>> >>>> -Chris >>>> _______________________________________________ >>>> llvm-commits mailing list >>>> llvm-commits at cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Fri Jul 4 02:55:15 2008 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 4 Jul 2008 00:55:15 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> Message-ID: <126ABF12-0185-4254-8D48-C56EDFC8D4D0@apple.com> Wouldn't attribute "used" work in keeping the function from being dce? Evan On Jul 3, 2008, at 10:11 PM, Chris Lattner wrote: > On Jul 3, 2008, at 8:48 PM, Eric Christopher wrote: >>> Thanks for tracking this down Dale! >> >> I don't know that I agree with this. For example: >> >> struct foo >> { >> ... >> } >> >> static void debug_foo (struct foo) >> { >> printf(...) >> ... >> } >> >> You've just made it impossible to print out (without additional work) >> struct foo from within gdb if foo is only used in one file and >> therefore doesn't need a non-static debug routine. Worse, this isn't >> obvious - especially at O0. > > Make the function non-static. Note that this only changes behavior > when compiling C++, not C. In C++ the same thing already happens for > inline functions and many other cases. > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From echristo at apple.com Fri Jul 4 02:58:38 2008 From: echristo at apple.com (Eric Christopher) Date: Fri, 4 Jul 2008 00:58:38 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: <126ABF12-0185-4254-8D48-C56EDFC8D4D0@apple.com> References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> <126ABF12-0185-4254-8D48-C56EDFC8D4D0@apple.com> Message-ID: <1100965A-4BBA-4E8D-917B-C60DF6C9AD65@apple.com> On Jul 4, 2008, at 12:55 AM, Evan Cheng wrote: > Wouldn't attribute "used" work in keeping the function from being dce? Yup :) It's why I said "without additional changes". I mean, the fact that it deletes unused functions at O3 is annoying enough when I'm trying to dump an llvm type with a release build. :) -eric From matthijs at stdin.nl Fri Jul 4 03:33:45 2008 From: matthijs at stdin.nl (Matthijs Kooijman) Date: Fri, 4 Jul 2008 10:33:45 +0200 Subject: [llvm-commits] [llvm] r52677 - in /llvm/trunk: lib/Transforms/IPO/DeadArgumentElimination.cpp test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll test/Transforms/DeadArgElim/deadretval2.ll test/Transforms/DeadArgElim/multdeadretval.ll In-Reply-To: References: <200806241630.m5OGUROm009102@zion.cs.uiuc.edu> <77A96C06-9C33-49DE-A06F-F8D4C48BC9F6@apple.com> <20080702084001.GC7287@katherina.student.utwente.nl> <20080702161128.GH7287@katherina.student.utwente.nl> Message-ID: <20080704083344.GX7287@katherina.student.utwente.nl> Hi Evan, > This patch works. But I didn't pay close attention to its impact on > performance and compile time. Did you run it on MultiSource/ > Applications? Do you see any real difference in either cateogry? Yeah, I did that on previous versions and didn't see any significant differences (on average, I think the compile times actually improved slightly). Since then, I've only changed the patch by adding bugfixes small bugfixes, so I think there should be no further change. I'll do another comparison later today (possibly after committing). Gr. Matthijs -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080704/85e0851e/attachment.bin From baldrick at free.fr Fri Jul 4 04:55:48 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 04 Jul 2008 09:55:48 -0000 Subject: [llvm-commits] [llvm] r53134 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp Message-ID: <200807040955.m649tm6H027949@zion.cs.uiuc.edu> Author: baldrick Date: Fri Jul 4 04:55:48 2008 New Revision: 53134 URL: http://llvm.org/viewvc/llvm-project?rev=53134&view=rev Log: Linux also does not require exception handling moves in order to get correct debug info. Since I can't imagine how any target could possibly be any different, I've just stripped out the option: now all the world's like Darwin! Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h llvm/trunk/lib/CodeGen/DwarfWriter.cpp llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp llvm/trunk/lib/Target/TargetAsmInfo.cpp llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=53134&r1=53133&r2=53134&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Fri Jul 4 04:55:48 2008 @@ -413,11 +413,6 @@ /// const char *DwarfExceptionSection; // Defaults to ".gcc_except_table". - /// DebugInfoRequireFrameMoveInfo - Does debugging info require frame move - /// info. - /// - bool DebugInfoRequireFrameMoveInfo; // Defaults to "true" - //===--- CBE Asm Translation Table -----------------------------------===// const char *const *AsmTransCBE; // Defaults to empty @@ -703,9 +698,6 @@ const char *getDwarfExceptionSection() const { return DwarfExceptionSection; } - bool doesDebugInfoRequireFrameMoveInfo() const { - return DebugInfoRequireFrameMoveInfo; - } const char *const *getAsmCBE() const { return AsmTransCBE; } Modified: llvm/trunk/lib/CodeGen/DwarfWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/DwarfWriter.cpp?rev=53134&r1=53133&r2=53134&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/DwarfWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/DwarfWriter.cpp Fri Jul 4 04:55:48 2008 @@ -3512,9 +3512,7 @@ shouldEmitTable = true; // See if we need frame move info. - if ((MMI->hasDebugInfo() && TAI->doesDebugInfoRequireFrameMoveInfo()) || - !MF->getFunction()->doesNotThrow() || - UnwindTablesMandatory) + if (!MF->getFunction()->doesNotThrow() || UnwindTablesMandatory) shouldEmitMoves = true; if (shouldEmitMoves || shouldEmitTable) Modified: llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp?rev=53134&r1=53133&r2=53134&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Fri Jul 4 04:55:48 2008 @@ -66,7 +66,6 @@ DwarfEHFrameSection = ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support"; DwarfExceptionSection = ".section __DATA,__gcc_except_tab"; - DebugInfoRequireFrameMoveInfo = false; GlobalEHDirective = "\t.globl\t"; SupportsWeakOmittedEHFrame = false; Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=53134&r1=53133&r2=53134&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Fri Jul 4 04:55:48 2008 @@ -111,7 +111,6 @@ DwarfMacInfoSection(".debug_macinfo"), DwarfEHFrameSection(".eh_frame"), DwarfExceptionSection(".gcc_except_table"), - DebugInfoRequireFrameMoveInfo(true), AsmTransCBE(0) { } Modified: llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp?rev=53134&r1=53133&r2=53134&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86TargetAsmInfo.cpp Fri Jul 4 04:55:48 2008 @@ -124,7 +124,6 @@ DwarfEHFrameSection = ".section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support"; DwarfExceptionSection = ".section __DATA,__gcc_except_tab"; - DebugInfoRequireFrameMoveInfo = false; break; case X86Subtarget::isELF: From baldrick at free.fr Fri Jul 4 06:48:04 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 04 Jul 2008 11:48:04 -0000 Subject: [llvm-commits] [llvm] r53137 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/SelectionDAG/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/PowerPC/ lib/Target/X86/ Message-ID: <200807041148.m64Bm5C4031813@zion.cs.uiuc.edu> Author: baldrick Date: Fri Jul 4 06:47:58 2008 New Revision: 53137 URL: http://llvm.org/viewvc/llvm-project?rev=53137&view=rev Log: Rather than having a different custom legalization hook for each way in which a result type can be legalized (promotion, expansion, softening etc), just use one: ReplaceNodeResults, which returns a node with exactly the same result types as the node passed to it, but presumably with a bunch of custom code behind the scenes. No change if the new LegalizeTypes infrastructure is not turned on. Modified: llvm/trunk/include/llvm/Target/TargetLowering.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp llvm/trunk/lib/Target/ARM/ARMISelLowering.h llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h Modified: llvm/trunk/include/llvm/Target/TargetLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetLowering.h?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetLowering.h (original) +++ llvm/trunk/include/llvm/Target/TargetLowering.h Fri Jul 4 06:47:58 2008 @@ -1055,19 +1055,19 @@ /// implement this. The default implementation of this aborts. virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG); - /// ExpandOperationResult - This callback is invoked for operations that are + /// ReplaceNodeResults - This callback is invoked for operations that are /// unsupported by the target, which are registered to use 'custom' lowering, - /// and whose result type needs to be expanded. This must return a node whose - /// results precisely match the results of the input node. This typically - /// involves a MERGE_VALUES node and/or BUILD_PAIR. + /// and whose result type is illegal. This must return a node whose results + /// precisely match the results of the input node. This typically involves a + /// MERGE_VALUES node and/or BUILD_PAIR. /// /// If the target has no operations that require custom lowering, it need not - /// implement this. The default implementation of this aborts. - virtual SDNode *ExpandOperationResult(SDNode *N, SelectionDAG &DAG) { - assert(0 && "ExpandOperationResult not implemented for this target!"); + /// implement this. The default implementation aborts. + virtual SDNode *ReplaceNodeResults(SDNode *N, SelectionDAG &DAG) { + assert(0 && "ReplaceNodeResults not implemented for this target!"); return 0; } - + /// IsEligibleForTailCallOptimization - Check whether the call is eligible for /// tail call optimization. Targets which want to do tail call optimization /// should override this function. @@ -1107,11 +1107,6 @@ return Chain; } - /// CustomPromoteOperation - This callback is invoked for operations that are - /// unsupported by the target, are registered to use 'custom' lowering, and - /// whose type needs to be promoted. - virtual SDOperand CustomPromoteOperation(SDOperand Op, SelectionDAG &DAG); - /// getTargetNodeName() - This method returns the name of a target specific /// DAG node. virtual const char *getTargetNodeName(unsigned Opcode) const; Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Jul 4 06:47:58 2008 @@ -1236,7 +1236,7 @@ AddLegalizedOperand(SDOperand(Node, 0), Result.getValue(0)); AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1)); return Result.getValue(Op.ResNo); - } + } case ISD::ATOMIC_LOAD_ADD: case ISD::ATOMIC_LOAD_SUB: case ISD::ATOMIC_LOAD_AND: @@ -1254,14 +1254,14 @@ for (unsigned int x = 0; x < num_operands; ++x) Ops[x] = LegalizeOp(Node->getOperand(x)); Result = DAG.UpdateNodeOperands(Result, &Ops[0], num_operands); - + switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) { default: assert(0 && "This action is not supported yet!"); case TargetLowering::Custom: Result = TLI.LowerOperation(Result, DAG); break; case TargetLowering::Expand: - Result = SDOperand(TLI.ExpandOperationResult(Op.Val, DAG),0); + Result = SDOperand(TLI.ReplaceNodeResults(Op.Val, DAG),0); break; case TargetLowering::Legal: break; @@ -1269,7 +1269,7 @@ AddLegalizedOperand(SDOperand(Node, 0), Result.getValue(0)); AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1)); return Result.getValue(Op.ResNo); - } + } case ISD::Constant: { ConstantSDNode *CN = cast(Node); unsigned opAction = @@ -4399,7 +4399,7 @@ Tmp2 = Node->getOperand(1); // Get the pointer. if (TLI.getOperationAction(ISD::VAARG, VT) == TargetLowering::Custom) { Tmp3 = DAG.getVAArg(VT, Tmp1, Tmp2, Node->getOperand(2)); - Result = TLI.CustomPromoteOperation(Tmp3, DAG); + Result = TLI.LowerOperation(Tmp3, DAG); } else { const Value *V = cast(Node->getOperand(2))->getValue(); SDOperand VAList = DAG.getLoad(TLI.getPointerTy(), Tmp1, Tmp2, V, 0); @@ -5640,15 +5640,15 @@ // Okay, we found the operation and type to use. SDOperand Operation = DAG.getNode(OpToUse, NewOutTy, LegalOp); - + // If the operation produces an invalid type, it must be custom lowered. Use // the target lowering hooks to expand it. Just keep the low part of the // expanded operation, we know that we're truncating anyway. if (getTypeAction(NewOutTy) == Expand) { - Operation = SDOperand(TLI.ExpandOperationResult(Operation.Val, DAG), 0); + Operation = SDOperand(TLI.ReplaceNodeResults(Operation.Val, DAG), 0); assert(Operation.Val && "Didn't return anything"); } - + // Truncate the result of the extended FP_TO_*INT operation to the desired // size. return DAG.getNode(ISD::TRUNCATE, DestVT, Operation); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp Fri Jul 4 06:47:58 2008 @@ -48,20 +48,17 @@ cerr << "\n"); SDOperand R = SDOperand(); - // FIXME: Custom lowering for float-to-int? -#if 0 - // See if the target wants to custom convert this node to an integer. - if (TLI.getOperationAction(N->getOpcode(), N->getValueType(0)) == + // See if the target wants to custom expand this node. + if (TLI.getOperationAction(N->getOpcode(), N->getValueType(ResNo)) == TargetLowering::Custom) { // If the target wants to, allow it to lower this itself. - if (SDNode *P = TLI.FloatToIntOperationResult(N, DAG)) { + if (SDNode *P = TLI.ReplaceNodeResults(N, DAG)) { // Everything that once used N now uses P. We are guaranteed that the // result value types of N and the result value types of P match. ReplaceNodeWith(N, P); return; } } -#endif switch (N->getOpcode()) { default: @@ -315,12 +312,9 @@ cerr << "\n"); SDOperand Res(0, 0); - // FIXME: Custom lowering for float-to-int? -#if 0 if (TLI.getOperationAction(N->getOpcode(), N->getOperand(OpNo).getValueType()) == TargetLowering::Custom) - Res = TLI.LowerOperation(SDOperand(N, 0), DAG); -#endif + Res = TLI.LowerOperation(SDOperand(N, OpNo), DAG); if (Res.Val == 0) { switch (N->getOpcode()) { @@ -517,10 +511,10 @@ Lo = Hi = SDOperand(); // See if the target wants to custom expand this node. - if (TLI.getOperationAction(N->getOpcode(), N->getValueType(0)) == - TargetLowering::Custom) { + if (TLI.getOperationAction(N->getOpcode(), N->getValueType(ResNo)) == + TargetLowering::Custom) { // If the target wants to, allow it to lower this itself. - if (SDNode *P = TLI.ExpandOperationResult(N, DAG)) { + if (SDNode *P = TLI.ReplaceNodeResults(N, DAG)) { // Everything that once used N now uses P. We are guaranteed that the // result value types of N and the result value types of P match. ReplaceNodeWith(N, P); @@ -742,7 +736,7 @@ if (TLI.getOperationAction(N->getOpcode(), N->getOperand(OpNo).getValueType()) == TargetLowering::Custom) - Res = TLI.LowerOperation(SDOperand(N, 0), DAG); + Res = TLI.LowerOperation(SDOperand(N, OpNo), DAG); if (Res.Val == 0) { switch (N->getOpcode()) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Fri Jul 4 06:47:58 2008 @@ -34,6 +34,18 @@ DEBUG(cerr << "Promote integer result: "; N->dump(&DAG); cerr << "\n"); SDOperand Result = SDOperand(); + // See if the target wants to custom expand this node. + if (TLI.getOperationAction(N->getOpcode(), N->getValueType(ResNo)) == + TargetLowering::Custom) { + // If the target wants to, allow it to lower this itself. + if (SDNode *P = TLI.ReplaceNodeResults(N, DAG)) { + // Everything that once used N now uses P. We are guaranteed that the + // result value types of N and the result value types of P match. + ReplaceNodeWith(N, P); + return; + } + } + switch (N->getOpcode()) { default: #ifndef NDEBUG @@ -453,41 +465,48 @@ /// node may need promotion or expansion as well as the specified one. bool DAGTypeLegalizer::PromoteIntegerOperand(SDNode *N, unsigned OpNo) { DEBUG(cerr << "Promote integer operand: "; N->dump(&DAG); cerr << "\n"); - SDOperand Res; - switch (N->getOpcode()) { - default: -#ifndef NDEBUG - cerr << "PromoteIntegerOperand Op #" << OpNo << ": "; - N->dump(&DAG); cerr << "\n"; -#endif - assert(0 && "Do not know how to promote this operator's operand!"); - abort(); + SDOperand Res(0, 0); - case ISD::ANY_EXTEND: Res = PromoteIntOp_ANY_EXTEND(N); break; - case ISD::ZERO_EXTEND: Res = PromoteIntOp_ZERO_EXTEND(N); break; - case ISD::SIGN_EXTEND: Res = PromoteIntOp_SIGN_EXTEND(N); break; - case ISD::TRUNCATE: Res = PromoteIntOp_TRUNCATE(N); break; - case ISD::FP_EXTEND: Res = PromoteIntOp_FP_EXTEND(N); break; - case ISD::FP_ROUND: Res = PromoteIntOp_FP_ROUND(N); break; - case ISD::SINT_TO_FP: - case ISD::UINT_TO_FP: Res = PromoteIntOp_INT_TO_FP(N); break; - case ISD::BUILD_PAIR: Res = PromoteIntOp_BUILD_PAIR(N); break; - - case ISD::BRCOND: Res = PromoteIntOp_BRCOND(N, OpNo); break; - case ISD::BR_CC: Res = PromoteIntOp_BR_CC(N, OpNo); break; - case ISD::SELECT: Res = PromoteIntOp_SELECT(N, OpNo); break; - case ISD::SELECT_CC: Res = PromoteIntOp_SELECT_CC(N, OpNo); break; - case ISD::SETCC: Res = PromoteIntOp_SETCC(N, OpNo); break; - - case ISD::STORE: Res = PromoteIntOp_STORE(cast(N), - OpNo); break; - - case ISD::BUILD_VECTOR: Res = PromoteIntOp_BUILD_VECTOR(N); break; - case ISD::INSERT_VECTOR_ELT: - Res = PromoteIntOp_INSERT_VECTOR_ELT(N, OpNo); - break; + if (TLI.getOperationAction(N->getOpcode(), N->getOperand(OpNo).getValueType()) + == TargetLowering::Custom) + Res = TLI.LowerOperation(SDOperand(N, OpNo), DAG); + + if (Res.Val == 0) { + switch (N->getOpcode()) { + default: + #ifndef NDEBUG + cerr << "PromoteIntegerOperand Op #" << OpNo << ": "; + N->dump(&DAG); cerr << "\n"; + #endif + assert(0 && "Do not know how to promote this operator's operand!"); + abort(); + + case ISD::ANY_EXTEND: Res = PromoteIntOp_ANY_EXTEND(N); break; + case ISD::ZERO_EXTEND: Res = PromoteIntOp_ZERO_EXTEND(N); break; + case ISD::SIGN_EXTEND: Res = PromoteIntOp_SIGN_EXTEND(N); break; + case ISD::TRUNCATE: Res = PromoteIntOp_TRUNCATE(N); break; + case ISD::FP_EXTEND: Res = PromoteIntOp_FP_EXTEND(N); break; + case ISD::FP_ROUND: Res = PromoteIntOp_FP_ROUND(N); break; + case ISD::SINT_TO_FP: + case ISD::UINT_TO_FP: Res = PromoteIntOp_INT_TO_FP(N); break; + case ISD::BUILD_PAIR: Res = PromoteIntOp_BUILD_PAIR(N); break; + + case ISD::BRCOND: Res = PromoteIntOp_BRCOND(N, OpNo); break; + case ISD::BR_CC: Res = PromoteIntOp_BR_CC(N, OpNo); break; + case ISD::SELECT: Res = PromoteIntOp_SELECT(N, OpNo); break; + case ISD::SELECT_CC: Res = PromoteIntOp_SELECT_CC(N, OpNo); break; + case ISD::SETCC: Res = PromoteIntOp_SETCC(N, OpNo); break; + + case ISD::STORE: Res = PromoteIntOp_STORE(cast(N), + OpNo); break; + + case ISD::BUILD_VECTOR: Res = PromoteIntOp_BUILD_VECTOR(N); break; + case ISD::INSERT_VECTOR_ELT: + Res = PromoteIntOp_INSERT_VECTOR_ELT(N, OpNo); + break; - case ISD::MEMBARRIER: Res = PromoteIntOp_MEMBARRIER(N); break; + case ISD::MEMBARRIER: Res = PromoteIntOp_MEMBARRIER(N); break; + } } // If the result is null, the sub-method took care of registering results etc. @@ -777,10 +796,10 @@ Lo = Hi = SDOperand(); // See if the target wants to custom expand this node. - if (TLI.getOperationAction(N->getOpcode(), N->getValueType(0)) == - TargetLowering::Custom) { + if (TLI.getOperationAction(N->getOpcode(), N->getValueType(ResNo)) == + TargetLowering::Custom) { // If the target wants to, allow it to lower this itself. - if (SDNode *P = TLI.ExpandOperationResult(N, DAG)) { + if (SDNode *P = TLI.ReplaceNodeResults(N, DAG)) { // Everything that once used N now uses P. We are guaranteed that the // result value types of N and the result value types of P match. ReplaceNodeWith(N, P); @@ -1626,7 +1645,7 @@ if (TLI.getOperationAction(N->getOpcode(), N->getOperand(OpNo).getValueType()) == TargetLowering::Custom) - Res = TLI.LowerOperation(SDOperand(N, 0), DAG); + Res = TLI.LowerOperation(SDOperand(N, OpNo), DAG); if (Res.Val == 0) { switch (N->getOpcode()) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp Fri Jul 4 06:47:58 2008 @@ -32,21 +32,6 @@ cerr << "\n"); SDOperand R = SDOperand(); - // FIXME: Custom lowering for scalarization? -#if 0 - // See if the target wants to custom expand this node. - if (TLI.getOperationAction(N->getOpcode(), N->getValueType(0)) == - TargetLowering::Custom) { - // If the target wants to, allow it to lower this itself. - if (SDNode *P = TLI.ExpandOperationResult(N, DAG)) { - // Everything that once used N now uses P. We are guaranteed that the - // result value types of N and the result value types of P match. - ReplaceNodeWith(N, P); - return; - } - } -#endif - switch (N->getOpcode()) { default: #ifndef NDEBUG @@ -167,13 +152,6 @@ cerr << "\n"); SDOperand Res(0, 0); - // FIXME: Should we support custom lowering for scalarization? -#if 0 - if (TLI.getOperationAction(N->getOpcode(), N->getValueType(0)) == - TargetLowering::Custom) - Res = TLI.LowerOperation(SDOperand(N, 0), DAG); -#endif - if (Res.Val == 0) { switch (N->getOpcode()) { default: @@ -253,20 +231,6 @@ DEBUG(cerr << "Split node result: "; N->dump(&DAG); cerr << "\n"); SDOperand Lo, Hi; -#if 0 - // See if the target wants to custom expand this node. - if (TLI.getOperationAction(N->getOpcode(), N->getValueType(0)) == - TargetLowering::Custom) { - // If the target wants to, allow it to lower this itself. - if (SDNode *P = TLI.ExpandOperationResult(N, DAG)) { - // Everything that once used N now uses P. We are guaranteed that the - // result value types of N and the result value types of P match. - ReplaceNodeWith(N, P); - return; - } - } -#endif - switch (N->getOpcode()) { default: #ifndef NDEBUG @@ -573,12 +537,6 @@ DEBUG(cerr << "Split node operand: "; N->dump(&DAG); cerr << "\n"); SDOperand Res(0, 0); -#if 0 - if (TLI.getOperationAction(N->getOpcode(), N->getValueType(0)) == - TargetLowering::Custom) - Res = TLI.LowerOperation(SDOperand(N, 0), DAG); -#endif - if (Res.Val == 0) { switch (N->getOpcode()) { default: Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Jul 4 06:47:58 2008 @@ -4843,12 +4843,6 @@ return SDOperand(); } -SDOperand TargetLowering::CustomPromoteOperation(SDOperand Op, - SelectionDAG &DAG) { - assert(0 && "CustomPromoteOperation not implemented for this target!"); - abort(); - return SDOperand(); -} //===----------------------------------------------------------------------===// // SelectionDAGISel code Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Fri Jul 4 06:47:58 2008 @@ -1418,9 +1418,9 @@ } -/// ExpandOperationResult - Provide custom lowering hooks for expanding -/// operations. -SDNode *ARMTargetLowering::ExpandOperationResult(SDNode *N, SelectionDAG &DAG) { +/// ReplaceNodeResults - Provide custom lowering hooks for nodes with illegal +/// result types. +SDNode *ARMTargetLowering::ReplaceNodeResults(SDNode *N, SelectionDAG &DAG) { switch (N->getOpcode()) { default: assert(0 && "Don't know how to custom expand this!"); abort(); case ISD::BIT_CONVERT: return ExpandBIT_CONVERT(N, DAG); Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.h?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMISelLowering.h (original) +++ llvm/trunk/lib/Target/ARM/ARMISelLowering.h Fri Jul 4 06:47:58 2008 @@ -76,7 +76,7 @@ explicit ARMTargetLowering(TargetMachine &TM); virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG); - virtual SDNode *ExpandOperationResult(SDNode *N, SelectionDAG &DAG); + virtual SDNode *ReplaceNodeResults(SDNode *N, SelectionDAG &DAG); virtual SDOperand PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const; Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.cpp Fri Jul 4 06:47:58 2008 @@ -392,6 +392,34 @@ return std::make_pair(RetVal, Chain); } +void AlphaTargetLowering::LowerVAARG(SDNode *N, SDOperand &Chain, + SDOperand &DataPtr, SelectionDAG &DAG) { + Chain = N->getOperand(0); + SDOperand VAListP = N->getOperand(1); + const Value *VAListS = cast(N->getOperand(2))->getValue(); + + SDOperand Base = DAG.getLoad(MVT::i64, Chain, VAListP, VAListS, 0); + SDOperand Tmp = DAG.getNode(ISD::ADD, MVT::i64, VAListP, + DAG.getConstant(8, MVT::i64)); + SDOperand Offset = DAG.getExtLoad(ISD::SEXTLOAD, MVT::i64, Base.getValue(1), + Tmp, NULL, 0, MVT::i32); + DataPtr = DAG.getNode(ISD::ADD, MVT::i64, Base, Offset); + if (N->getValueType(0).isFloatingPoint()) + { + //if fp && Offset < 6*8, then subtract 6*8 from DataPtr + SDOperand FPDataPtr = DAG.getNode(ISD::SUB, MVT::i64, DataPtr, + DAG.getConstant(8*6, MVT::i64)); + SDOperand CC = DAG.getSetCC(MVT::i64, Offset, + DAG.getConstant(8*6, MVT::i64), ISD::SETLT); + DataPtr = DAG.getNode(ISD::SELECT, MVT::i64, CC, FPDataPtr, DataPtr); + } + + SDOperand NewOffset = DAG.getNode(ISD::ADD, MVT::i64, Offset, + DAG.getConstant(8, MVT::i64)); + Chain = DAG.getTruncStore(Offset.getValue(1), NewOffset, Tmp, NULL, 0, + MVT::i32); +} + /// LowerOperation - Provide custom lowering hooks for some operations. /// SDOperand AlphaTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { @@ -493,37 +521,15 @@ break; case ISD::VAARG: { - SDOperand Chain = Op.getOperand(0); - SDOperand VAListP = Op.getOperand(1); - const Value *VAListS = cast(Op.getOperand(2))->getValue(); - - SDOperand Base = DAG.getLoad(MVT::i64, Chain, VAListP, VAListS, 0); - SDOperand Tmp = DAG.getNode(ISD::ADD, MVT::i64, VAListP, - DAG.getConstant(8, MVT::i64)); - SDOperand Offset = DAG.getExtLoad(ISD::SEXTLOAD, MVT::i64, Base.getValue(1), - Tmp, NULL, 0, MVT::i32); - SDOperand DataPtr = DAG.getNode(ISD::ADD, MVT::i64, Base, Offset); - if (Op.getValueType().isFloatingPoint()) - { - //if fp && Offset < 6*8, then subtract 6*8 from DataPtr - SDOperand FPDataPtr = DAG.getNode(ISD::SUB, MVT::i64, DataPtr, - DAG.getConstant(8*6, MVT::i64)); - SDOperand CC = DAG.getSetCC(MVT::i64, Offset, - DAG.getConstant(8*6, MVT::i64), ISD::SETLT); - DataPtr = DAG.getNode(ISD::SELECT, MVT::i64, CC, FPDataPtr, DataPtr); - } + SDOperand Chain, DataPtr; + LowerVAARG(Op.Val, Chain, DataPtr, DAG); - SDOperand NewOffset = DAG.getNode(ISD::ADD, MVT::i64, Offset, - DAG.getConstant(8, MVT::i64)); - SDOperand Update = DAG.getTruncStore(Offset.getValue(1), NewOffset, - Tmp, NULL, 0, MVT::i32); - SDOperand Result; if (Op.getValueType() == MVT::i32) - Result = DAG.getExtLoad(ISD::SEXTLOAD, MVT::i64, Update, DataPtr, + Result = DAG.getExtLoad(ISD::SEXTLOAD, MVT::i64, Chain, DataPtr, NULL, 0, MVT::i32); else - Result = DAG.getLoad(Op.getValueType(), Update, DataPtr, NULL, 0); + Result = DAG.getLoad(Op.getValueType(), Chain, DataPtr, NULL, 0); return Result; } case ISD::VACOPY: { @@ -564,14 +570,15 @@ return SDOperand(); } -SDOperand AlphaTargetLowering::CustomPromoteOperation(SDOperand Op, - SelectionDAG &DAG) { - assert(Op.getValueType() == MVT::i32 && - Op.getOpcode() == ISD::VAARG && +SDNode *AlphaTargetLowering::ReplaceNodeResults(SDNode *N, + SelectionDAG &DAG) { + assert(N->getValueType(0) == MVT::i32 && + N->getOpcode() == ISD::VAARG && "Unknown node to custom promote!"); - - // The code in LowerOperation already handles i32 vaarg - return LowerOperation(Op, DAG); + + SDOperand Chain, DataPtr; + LowerVAARG(N, Chain, DataPtr, DAG); + return DAG.getLoad(N->getValueType(0), Chain, DataPtr, NULL, 0).Val; } Modified: llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h (original) +++ llvm/trunk/lib/Target/Alpha/AlphaISelLowering.h Fri Jul 4 06:47:58 2008 @@ -72,9 +72,9 @@ /// LowerOperation - Provide custom lowering hooks for some operations. /// virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG); - virtual SDOperand CustomPromoteOperation(SDOperand Op, SelectionDAG &DAG); + virtual SDNode *ReplaceNodeResults(SDNode *N, SelectionDAG &DAG); - //Friendly names for dumps + // Friendly names for dumps const char *getTargetNodeName(unsigned Opcode) const; /// LowerCallTo - This hook lowers an abstract call to a function into an @@ -94,6 +94,12 @@ MachineBasicBlock *EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *BB); + + private: + // Helpers for custom lowering. + void LowerVAARG(SDNode *N, SDOperand &Chain, SDOperand &DataPtr, + SelectionDAG &DAG); + }; } Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.cpp Fri Jul 4 06:47:58 2008 @@ -3964,7 +3964,7 @@ return SDOperand(); } -SDNode *PPCTargetLowering::ExpandOperationResult(SDNode *N, SelectionDAG &DAG) { +SDNode *PPCTargetLowering::ReplaceNodeResults(SDNode *N, SelectionDAG &DAG) { switch (N->getOpcode()) { default: assert(0 && "Wasn't expecting to be able to lower this!"); case ISD::FP_TO_SINT: return LowerFP_TO_SINT(SDOperand(N, 0), DAG).Val; Modified: llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h (original) +++ llvm/trunk/lib/Target/PowerPC/PPCISelLowering.h Fri Jul 4 06:47:58 2008 @@ -273,7 +273,7 @@ /// virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG); - virtual SDNode *ExpandOperationResult(SDNode *N, SelectionDAG &DAG); + virtual SDNode *ReplaceNodeResults(SDNode *N, SelectionDAG &DAG); virtual SDOperand PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Jul 4 06:47:58 2008 @@ -5762,8 +5762,9 @@ } } -/// ExpandOperation - Provide custom lowering hooks for expanding operations. -SDNode *X86TargetLowering::ExpandOperationResult(SDNode *N, SelectionDAG &DAG) { +/// ReplaceNodeResults - Replace a node with an illegal result type +/// with a new node built out of custom code. +SDNode *X86TargetLowering::ReplaceNodeResults(SDNode *N, SelectionDAG &DAG) { switch (N->getOpcode()) { default: assert(0 && "Should not custom lower this!"); case ISD::FP_TO_SINT: return ExpandFP_TO_SINT(N, DAG); Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=53137&r1=53136&r2=53137&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Fri Jul 4 06:47:58 2008 @@ -352,10 +352,10 @@ /// virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG); - /// ExpandOperation - Custom lower the specified operation, splitting the - /// value into two pieces. + /// ReplaceNodeResults - Replace a node with an illegal result type + /// with a new node built out of custom code. /// - virtual SDNode *ExpandOperationResult(SDNode *N, SelectionDAG &DAG); + virtual SDNode *ReplaceNodeResults(SDNode *N, SelectionDAG &DAG); virtual SDOperand PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const; From baldrick at free.fr Fri Jul 4 11:36:10 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 4 Jul 2008 18:36:10 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c Message-ID: <200807041836.11150.baldrick@free.fr> Hi Dale, > Do not emit unreferenced static functions at - O0. > This is the gcc-4.0 behavior, changed deliberately > in gcc-4.2, see PR 24561. After discussion Chris, > Evan and I agreed the 4.0 behavior is better so > we're going back to that. is there a similar issue with dead static globals? Also, how much of a win is this? Thanks, Duncan. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080704/3144d8d9/attachment.html From duncan.sands at math.u-psud.fr Fri Jul 4 11:38:38 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Fri, 4 Jul 2008 18:38:38 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c Message-ID: <200807041838.38772.duncan.sands@math.u-psud.fr> Sorry, problems with my email client :) Here it is again, hopefully readable... Hi Dale, > Do not emit unreferenced static functions at -O0. > This is the gcc-4.0 behavior, changed deliberately > in gcc-4.2, see PR 24561. After discussion Chris, > Evan and I agreed the 4.0 behavior is better so > we're going back to that. is there a similar issue with dead static globals? Also, how much of a win is this? Thanks, Duncan. From baldrick at free.fr Fri Jul 4 11:40:57 2008 From: baldrick at free.fr (Duncan Sands) Date: Fri, 4 Jul 2008 18:40:57 +0200 Subject: [llvm-commits] [llvm-gcc-4.2] r53131 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200807041840.58102.baldrick@free.fr> Hi Devang, > + case BUILT_IN_OBJECT_SIZE: { > + tree ArgList = TREE_OPERAND (exp, 1); > + if (!validate_arglist(ArgList, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE)) { > + error("Invalid builtin_object_size argument types"); > + return false; > + } > + tree ObjSizeTree = TREE_VALUE (TREE_CHAIN (ArgList)); > + STRIP_NOPS (ObjSizeTree); > + if (TREE_CODE (ObjSizeTree) != INTEGER_CST > + || tree_int_cst_sgn (ObjSizeTree) < 0 > + || compare_tree_int (ObjSizeTree, 3) > 0) { > + error("Invalid second builtin_object_size argument"); > + return false; > + } > + > + if (tree_low_cst (ObjSizeTree, 0) < 2) > + Result = ConstantInt::get(Type::Int32Ty, 0); > + else > + Result = ConstantInt::getAllOnesValue(Type::Int32Ty); > + return true; > + } it looks like this returns either 0 or -1. I guess how it works is that fold or someone turns this into the object size if it can, and if it reaches here that means the size is unknown. Is that right? Ciao, Duncan. From espindola at google.com Fri Jul 4 13:08:44 2008 From: espindola at google.com (Rafael Espindola) Date: Fri, 4 Jul 2008 19:08:44 +0100 Subject: [llvm-commits] getting -with-sysroot to work Message-ID: <38a0d8450807041108q249ee5ces68f1af5ee1566e14@mail.gmail.com> Compiling llvm-gcc with --with-sysroot causes the resulting compiler to fail to find its own headers (like stddef.h). I was able to make it work by removing an Apple local change. I am sure Apple needs this for some reason. Maybe we can try to make it generic (a configure flag at least) and include it on mainline GCC? Cheers, -- Rafael Avila de Espindola Google Ireland Ltd. Gordon House Barrow Street Dublin 4 Ireland Registered in Dublin, Ireland Registration Number: 36804 -------------- next part -------------- A non-text attachment was scrubbed... Name: sysroot.patch Type: text/x-diff Size: 474 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080704/9edb726c/attachment.bin From duncan.sands at math.u-psud.fr Fri Jul 4 13:41:02 2008 From: duncan.sands at math.u-psud.fr (Duncan Sands) Date: Fri, 4 Jul 2008 20:41:02 +0200 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm=5D_r53035_-_in_/llvm/trunk?= =?iso-8859-1?q?=3A_include/llvm/CodeGen/SelectionDAG=2Eh=09lib/CodeGen/Se?= =?iso-8859-1?q?lectionDAG/LegalizeDAG=2Ecpp_lib/CodeGen/SelectionDAG/Sele?= =?iso-8859-1?q?ctionDAG=2Ecpp_lib/CodeGen/SelectionDAG/SelectionDAGISel?= =?iso-8859-1?q?=2Ecpp_lib/Target/ARM/ARMISelLowering=2Ecpp=09lib/Target/C?= =?iso-8859-1?q?ellSPU/SPUISelLowering=2Ecpp_lib/Target/PowerPC/PPCISelLow?= =?iso-8859-1?q?ering=2Ecpp=09lib/Target/Sparc/SparcISelLowering=2Ecpp_lib?= =?iso-8859-1?q?/Target/X86/X86ISelLowering=2Ecpp?= In-Reply-To: References: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> <320689A9-CF1D-451C-9AB0-31B3737AD1CE@apple.com> Message-ID: <200807042041.02925.duncan.sands@math.u-psud.fr> Hi, do you have a testcase? This problem might occur with LegalizeTypes too. Thanks, Duncan. From dalej at apple.com Fri Jul 4 13:42:28 2008 From: dalej at apple.com (Dale Johannesen) Date: Fri, 4 Jul 2008 11:42:28 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: <126ABF12-0185-4254-8D48-C56EDFC8D4D0@apple.com> References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> <126ABF12-0185-4254-8D48-C56EDFC8D4D0@apple.com> Message-ID: On Jul 4, 2008, at 12:55 AM, Evan Cheng wrote: > Wouldn't attribute "used" work in keeping the function from being dce? > > Evan > > On Jul 3, 2008, at 10:11 PM, Chris Lattner wrote: > >> On Jul 3, 2008, at 8:48 PM, Eric Christopher wrote: >>>> Thanks for tracking this down Dale! >>> >>> I don't know that I agree with this. For example: >>> >>> struct foo >>> { >>> ... >>> } >>> >>> static void debug_foo (struct foo) >>> { >>> printf(...) >>> ... >>> } >>> >>> You've just made it impossible to print out (without additional >>> work) >>> struct foo from within gdb if foo is only used in one file and >>> therefore doesn't need a non-static debug routine. Worse, this isn't >>> obvious - especially at O0. If debug_foo is dead, and there are no objects of type foo or foo* (either of which would cause the type to be emitted), why would you want to do this? (Apple-centric view): Also, this is not a change in behavior from the viewpoint of most users; it restores the 4.0 behavior. g++'s behavior changed from 3.3 to 4.0, and changed back from 4.0 to 4.2; I'm not aware of any bug reports about either change. So I don't believe this is important to users. >> Make the function non-static. Note that this only changes behavior >> when compiling C++, not C. In C++ the same thing already happens for >> inline functions and many other cases. This won't work when LTO is on, will it? You need the explicit "used" (actually, I'm not sure whether LTO honors that, but it ought to). From echristo at apple.com Fri Jul 4 13:46:21 2008 From: echristo at apple.com (Eric Christopher) Date: Fri, 4 Jul 2008 11:46:21 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> <126ABF12-0185-4254-8D48-C56EDFC8D4D0@apple.com> Message-ID: >>>> > > If debug_foo is dead, and there are no objects of type foo or foo* > (either of which would cause the type to be emitted), why would you > want to do this? As I said, for debugging purposes, i.e. within gdb calling the function. Think debug_tree from gcc. > (Apple-centric view): Also, this is not a change in behavior from the > viewpoint of most users; it restores the 4.0 behavior. g++'s behavior > changed from 3.3 to 4.0, and changed back from 4.0 to 4.2; I'm not > aware of any bug reports about either change. So I don't believe this > is important to users. > Enh. Drove me nuts when it happened. I had to mark functions __attribute__((used)). >>> Make the function non-static. Note that this only changes behavior >>> when compiling C++, not C. In C++ the same thing already happens >>> for >>> inline functions and many other cases. > > This won't work when LTO is on, will it? You need the explicit > "used" (actually, I'm not sure whether LTO honors that, but it ought > to). Well, hopefully people aren't using LTO with O0. That'd just be a little weird. :) -eric From isanbard at gmail.com Fri Jul 4 18:42:23 2008 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 4 Jul 2008 16:42:23 -0700 Subject: [llvm-commits] [llvm] r53134 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/CodeGen/DwarfWriter.cpp lib/Target/PowerPC/PPCTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp lib/Target/X86/X86TargetAsmInfo.cpp In-Reply-To: <200807040955.m649tm6H027949@zion.cs.uiuc.edu> References: <200807040955.m649tm6H027949@zion.cs.uiuc.edu> Message-ID: <1262BE5D-DE8C-4123-8431-D845E6FB8433@gmail.com> On Jul 4, 2008, at 2:55 AM, Duncan Sands wrote: > Author: baldrick > Date: Fri Jul 4 04:55:48 2008 > New Revision: 53134 > > URL: http://llvm.org/viewvc/llvm-project?rev=53134&view=rev > Log: > Linux also does not require exception handling > moves in order to get correct debug info. Since > I can't imagine how any target could possibly > be any different, I've just stripped out the > option: now all the world's like Darwin! > As well it should! ;-) Thanks, Duncan! -bw From dpatel at apple.com Fri Jul 4 21:12:39 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 4 Jul 2008 19:12:39 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53113 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h In-Reply-To: References: <200807032209.m63M9OE7026032@zion.cs.uiuc.edu> Message-ID: On Jul 4, 2008, at 12:01 AM, Evan Cheng wrote: > Hi Devang, > > Does this work for older Mac OS X ld? That is, would older ld silently > ignore the options? GCC drive does not know about ld versions. The older linker will complain and fail. This is a debugging aid for compiler folks. Feel free to add configure test to check whether linker supports this flag or not. I think, that is unnecessary but I'll not stop anyone :) - Devang From dpatel at apple.com Fri Jul 4 21:18:12 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 4 Jul 2008 19:18:12 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53113 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h In-Reply-To: <7C4BFF3C-DC8F-4790-A3CB-40FDC04A93C3@apple.com> References: <200807032209.m63M9OE7026032@zion.cs.uiuc.edu> <7C4BFF3C-DC8F-4790-A3CB-40FDC04A93C3@apple.com> Message-ID: <6598257E-5F68-44D6-80C7-75922C7C0FBD@apple.com> On Jul 4, 2008, at 12:03 AM, Eric Christopher wrote: > > On Jul 4, 2008, at 12:01 AM, Evan Cheng wrote: > >> Hi Devang, >> >> Does this work for older Mac OS X ld? That is, would older ld >> silently >> ignore the options? > > And, uh, what's it do? On the llvm-gcc command line -mllvm is a blanket debugging option for compiler developers that lets them set llvm codegen flags for debugging optimizer/codegen bugs. Now, we are extending it to let folks investigate LTO bugs. - Devang From dpatel at apple.com Fri Jul 4 21:18:57 2008 From: dpatel at apple.com (Devang Patel) Date: Sat, 05 Jul 2008 02:18:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53142 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200807050218.m652Iv6A026796@zion.cs.uiuc.edu> Author: dpatel Date: Fri Jul 4 21:18:56 2008 New Revision: 53142 URL: http://llvm.org/viewvc/llvm-project?rev=53142&view=rev Log: Oops. 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=53142&r1=53141&r2=53142&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Jul 4 21:18:56 2008 @@ -4350,9 +4350,9 @@ } if (tree_low_cst (ObjSizeTree, 0) < 2) - Result = ConstantInt::get(Type::Int32Ty, 0); - else Result = ConstantInt::getAllOnesValue(Type::Int32Ty); + else + Result = ConstantInt::get(Type::Int32Ty, 0); return true; } // Unary bit counting intrinsics. From dpatel at apple.com Fri Jul 4 21:19:24 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 4 Jul 2008 19:19:24 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53131 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <61FBDF6B-2B28-48D8-A82C-2D110C7440FC@apple.com> References: <200807040046.m640kdff031350@zion.cs.uiuc.edu> <61FBDF6B-2B28-48D8-A82C-2D110C7440FC@apple.com> Message-ID: <5452A9AC-1E34-4A27-A2B1-2BD93EAD89A9@apple.com> On Jul 3, 2008, at 8:00 PM, Chris Lattner wrote: > On Jul 3, 2008, at 5:46 PM, Devang Patel wrote: >> >> URL: http://llvm.org/viewvc/llvm-project?rev=53131&view=rev >> Log: >> Expand BUILT_IN_OBJECT_SIZE. > > Hey Devang, > >> + if (tree_low_cst (ObjSizeTree, 0) < 2) >> + Result = ConstantInt::get(Type::Int32Ty, 0); >> + else >> + Result = ConstantInt::getAllOnesValue(Type::Int32Ty); >> + return true; >> + } > > Isn't this backwards? GCC has: > > object_size_type = tree_low_cst (ost, 0); > return object_size_type < 2 ? constm1_rtx : const0_rtx; Oops. Fixed. - Devang From dpatel at apple.com Fri Jul 4 21:19:42 2008 From: dpatel at apple.com (Devang Patel) Date: Fri, 4 Jul 2008 19:19:42 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53131 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp In-Reply-To: <200807041840.58102.baldrick@free.fr> References: <200807041840.58102.baldrick@free.fr> Message-ID: <63465731-F2B6-44E2-99B6-E77A48E9BFED@apple.com> On Jul 4, 2008, at 9:40 AM, Duncan Sands wrote: > it looks like this returns either 0 or -1. I guess how it > works is that fold or someone turns this into the object size > if it can, and if it reaches here that means the size is > unknown. Is that right? Yes, that's my understanding. - Devang From dalej at apple.com Fri Jul 4 21:29:08 2008 From: dalej at apple.com (Dale Johannesen) Date: Fri, 4 Jul 2008 19:29:08 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> <126ABF12-0185-4254-8D48-C56EDFC8D4D0@apple.com> Message-ID: <1C5C1BB4-12EC-4CA2-AB99-042BE2F17BC1@apple.com> On Jul 4, 2008, at 11:46 AM, Eric Christopher wrote: >>>>> >> >> If debug_foo is dead, and there are no objects of type foo or foo* >> (either of which would cause the type to be emitted), why would you >> want to do this? > > As I said, for debugging purposes, i.e. within gdb calling the > function. > Think debug_tree from gcc. Ah, it wasn't clear from your original mail you were talking about debugger-callable functions, at least to me. Yes, we do need to consider those, and that's the main argument given in the PR for the 4.2 behavior. In practice, however, gcc's debug functions are all declared global, which is one reason I found the argument unpersuasive. I don't know about -O0, but many compilers remove dead static functions at higher optimization levels; making those functions static would be ineffective if you want to have any chance of debugging the optimized version. Therefore, I expect people usually declare them global, as gcc does. The lack of bug reports is supporting evidence. >> (Apple-centric view): Also, this is not a change in behavior from >> the >> viewpoint of most users; it restores the 4.0 behavior. g++'s >> behavior >> changed from 3.3 to 4.0, and changed back from 4.0 to 4.2; I'm not >> aware of any bug reports about either change. So I don't believe >> this >> is important to users. >> > > Enh. Drove me nuts when it happened. I had to mark functions > __attribute__((used)). Did you file a bug report? >>>> Make the function non-static. Note that this only changes behavior >>>> when compiling C++, not C. In C++ the same thing already happens >>>> for >>>> inline functions and many other cases. >> >> This won't work when LTO is on, will it? You need the explicit >> "used" (actually, I'm not sure whether LTO honors that, but it ought >> to). > > Well, hopefully people aren't using LTO with O0. That'd just be a > little weird. :) Sure, but the point is what to tell users to do. My expectation is that compilers (not just gcc and llvm) are going to get ever more aggressive about removing dead stuff, so we should recommend "used". From sabre at nondot.org Sat Jul 5 12:02:51 2008 From: sabre at nondot.org (Chris Lattner) Date: Sat, 5 Jul 2008 10:02:51 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> <126ABF12-0185-4254-8D48-C56EDFC8D4D0@apple.com> Message-ID: <68C77EF0-EE67-4E2F-825F-63C9810AB4BE@nondot.org> On Jul 4, 2008, at 11:46 AM, Eric Christopher wrote: >>>>> >> >> If debug_foo is dead, and there are no objects of type foo or foo* >> (either of which would cause the type to be emitted), why would you >> want to do this? > > As I said, for debugging purposes, i.e. within gdb calling the > function. > Think debug_tree from gcc. > >>>> Make the function non-static. Note that this only changes behavior >>>> when compiling C++, not C. In C++ the same thing already happens >>>> for >>>> inline functions and many other cases. >> >> This won't work when LTO is on, will it? You need the explicit >> "used" (actually, I'm not sure whether LTO honors that, but it ought >> to). > > Well, hopefully people aren't using LTO with O0. That'd just be a > little weird. :) Eric, this is only a change for C++ and it is a change back to the previous behavior. C++ also "suffers" from inline functions not being being emitted if not used, so it seems reasonable for static functions to behave the same way. This obviously follows some user's expectations. The reason this matters is that real libstdc++ headers have static functions and they obviously don't expect them to be emitted (they really are not debugging hooks). Emitting them really does bloat executables and significantly slow down the compiler (extra codegen + tons of extra debug info), so this really does impact real users. Emitted dead functions on the basis that they might be debug hooks is a theoretical benefit to theoretical users who have a better solution to their problem anyway. Pragmatically, I strongly believe that we should not emit them: there are many workarounds for real debugging hooks, and developers who have ever used or cared about G++ 4.0 are already using them. Finally, why should we try to emit debugging hooks at -O0 only? We do care about debugging at higher levels even though the experience is admittedly (far) from perfect there. -Chris From sabre at nondot.org Sat Jul 5 12:06:56 2008 From: sabre at nondot.org (Chris Lattner) Date: Sat, 5 Jul 2008 10:06:56 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53113 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h In-Reply-To: References: <200807032209.m63M9OE7026032@zion.cs.uiuc.edu> Message-ID: On Jul 4, 2008, at 12:01 AM, Evan Cheng wrote: > Hi Devang, > > Does this work for older Mac OS X ld? That is, would older ld silently > ignore the options? I think the answer is "don't do that". -mllvm and lto only work with the new linker, so don't use them with the old one :) -Chris From sabre at nondot.org Sat Jul 5 12:07:02 2008 From: sabre at nondot.org (Chris Lattner) Date: Sat, 5 Jul 2008 10:07:02 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> <126ABF12-0185-4254-8D48-C56EDFC8D4D0@apple.com> Message-ID: <7DB0EC0A-A0A9-4146-BA43-1FE5D9B41F57@nondot.org> On Jul 4, 2008, at 11:42 AM, Dale Johannesen wrote: >>> >>> Make the function non-static. Note that this only changes behavior >>> when compiling C++, not C. In C++ the same thing already happens >>> for >>> inline functions and many other cases. > > This won't work when LTO is on, will it? You need the explicit > "used" (actually, I'm not sure whether LTO honors that, but it ought > to). LTO does honor "used" fwiw. -Chris From echristo at apple.com Sat Jul 5 13:02:33 2008 From: echristo at apple.com (Eric Christopher) Date: Sat, 5 Jul 2008 11:02:33 -0700 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: <68C77EF0-EE67-4E2F-825F-63C9810AB4BE@nondot.org> References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> <126ABF12-0185-4254-8D48-C56EDFC8D4D0@apple.com> <68C77EF0-EE67-4E2F-825F-63C9810AB4BE@nondot.org> Message-ID: <670DC465-7BB0-467B-A4AA-8CD03CBB776A@apple.com> On Jul 5, 2008, at 10:02 AM, Chris Lattner wrote: > Eric, this is only a change for C++ and it is a change back to the > previous behavior. C++ also "suffers" from inline functions not being > being emitted if not used, so it seems reasonable for static functions > to behave the same way. This obviously follows some user's > expectations. Dale's last message was pretty convincing. I was just letting it percolate a bit. > The reason this matters is that real libstdc++ headers have static > functions and they obviously don't expect them to be emitted (they > really are not debugging hooks). Emitting them really does bloat > executables and significantly slow down the compiler (extra codegen + > tons of extra debug info), so this really does impact real users. > Emitted dead functions on the basis that they might be debug hooks is > a theoretical benefit to theoretical users who have a better solution > to their problem anyway. *nod* OK. I'll stop arguing :) -eric From bruno.cardoso at gmail.com Sat Jul 5 14:05:22 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Sat, 05 Jul 2008 19:05:22 -0000 Subject: [llvm-commits] [llvm] r53146 - in /llvm/trunk/lib/Target/Mips: Mips.td MipsAsmPrinter.cpp MipsCallingConv.td MipsISelDAGToDAG.cpp MipsISelLowering.cpp MipsISelLowering.h MipsInstrFPU.td MipsInstrFormats.td MipsInstrInfo.cpp MipsInstrInfo.h MipsInstrInfo.td MipsMachineFunction.h MipsRegisterInfo.cpp MipsRegisterInfo.td MipsSubtarget.cpp MipsSubtarget.h MipsTargetMachine.cpp Message-ID: <200807051905.m65J5N9K001409@zion.cs.uiuc.edu> Author: bruno Date: Sat Jul 5 14:05:21 2008 New Revision: 53146 URL: http://llvm.org/viewvc/llvm-project?rev=53146&view=rev Log: Several changes to Mips backend, experimental fp support being the most important. - Cleanup in the Subtarget info with addition of new features, not all support yet, but they allow the future inclusion of features easier. Among new features, we have : Arch family info (mips1, mips2, ...), ABI info (o32, eabi), 64-bit integer and float registers, allegrex vector FPU (VFPU), single float only support. - TargetMachine now detects allegrex core. - Added allegrex (Mips32r2) sext_inreg instructions. - *Added Float Point Instructions*, handling single float only, and aliased accesses for 32-bit FPUs. - Some cleanup in FP instruction formats and FP register classes. - Calling conventions improved to support mips 32-bit EABI. - Added Asm Printer support for fp cond codes. - Added support for sret copy to a return register. - EABI support added into LowerCALL and FORMAL_ARGS. - MipsFunctionInfo now keeps a virtual register per function to track the sret on function entry until function ret. - MipsInstrInfo FP support into methods (isMoveInstr, isLoadFromStackSlot, ...), FP cond codes mapping and initial FP Branch Analysis. - Two new Mips SDNode to handle fp branch and compare instructions : FPBrcond, FPCmp - MipsTargetLowering : handling different FP classes, Allegrex support, sret return copy, no homing location within EABI, non 32-bit stack objects arguments, and asm constraint for float. Added: llvm/trunk/lib/Target/Mips/MipsInstrFPU.td Modified: llvm/trunk/lib/Target/Mips/Mips.td llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp llvm/trunk/lib/Target/Mips/MipsCallingConv.td llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp llvm/trunk/lib/Target/Mips/MipsISelLowering.h llvm/trunk/lib/Target/Mips/MipsInstrFormats.td llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp llvm/trunk/lib/Target/Mips/MipsInstrInfo.h llvm/trunk/lib/Target/Mips/MipsInstrInfo.td llvm/trunk/lib/Target/Mips/MipsMachineFunction.h llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp llvm/trunk/lib/Target/Mips/MipsRegisterInfo.td llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp llvm/trunk/lib/Target/Mips/MipsSubtarget.h llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Modified: llvm/trunk/lib/Target/Mips/Mips.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Mips.td?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/Mips.td (original) +++ llvm/trunk/lib/Target/Mips/Mips.td Sat Jul 5 14:05:21 2008 @@ -16,7 +16,7 @@ include "../Target.td" //===----------------------------------------------------------------------===// -// Descriptions +// Register File, Calling Conv, Instruction Descriptions //===----------------------------------------------------------------------===// include "MipsRegisterInfo.td" @@ -30,22 +30,43 @@ } //===----------------------------------------------------------------------===// -// CPU Directives // +// Mips Subtarget features // //===----------------------------------------------------------------------===// -// Not currently supported, but work as SubtargetFeature placeholder. -def FeatureMipsIII : SubtargetFeature<"mips3", "IsMipsIII", "true", - "MipsIII ISA Support">; +def FeatureGP64Bit : SubtargetFeature<"gp64", "IsGP64bit", "true", + "General Purpose Registers are 64-bit wide.">; +def FeatureFP64Bit : SubtargetFeature<"fp64", "IsFP64bit", "true", + "Support 64-bit FP registers.">; +def FeatureSingleFloat : SubtargetFeature<"single-float", "IsSingleFloat", + "true", "Only supports single precision float">; +def FeatureAllegrexVFPU : SubtargetFeature<"allegrex-vfpu", "HasAllegrexVFPU", + "true", "Enable Allegrex VFPU instructions.">; +def FeatureMips2 : SubtargetFeature<"mips2", "MipsArchVersion", "Mips2", + "Mips2 ISA Support">; +def FeatureO32 : SubtargetFeature<"o32", "MipsABI", "O32", + "Enable o32 ABI">; +def FeatureEABI : SubtargetFeature<"eabi", "MipsABI", "EABI", + "Enable eabi ABI">; //===----------------------------------------------------------------------===// // Mips processors supported. //===----------------------------------------------------------------------===// -def : Processor<"mips1", MipsGenericItineraries, []>; -def : Processor<"r2000", MipsGenericItineraries, []>; -def : Processor<"r3000", MipsGenericItineraries, []>; +class Proc Features> + : Processor; + +def : Proc<"mips1", []>; +def : Proc<"r2000", []>; +def : Proc<"r3000", []>; + +def : Proc<"mips2", [FeatureMips2]>; +def : Proc<"r6000", [FeatureMips2]>; + +// Allegrex is a 32bit subset of r4000, both for interger and fp registers, +// but much more similar to Mips2 than Mips3. +def : Proc<"allegrex", [FeatureMips2, FeatureSingleFloat, FeatureAllegrexVFPU, + FeatureEABI]>; def Mips : Target { let InstructionSet = MipsInstrInfo; } - Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Sat Jul 5 14:05:21 2008 @@ -62,6 +62,8 @@ void printOperand(const MachineInstr *MI, int opNum); void printMemOperand(const MachineInstr *MI, int opNum, const char *Modifier = 0); + void printFCCOperand(const MachineInstr *MI, int opNum, + const char *Modifier = 0); unsigned int getSavedRegsBitmask(bool isFloat, MachineFunction &MF); void printHex32(unsigned int Value); @@ -428,6 +430,13 @@ O << ")"; } +void MipsAsmPrinter:: +printFCCOperand(const MachineInstr *MI, int opNum, const char *Modifier) +{ + const MachineOperand& MO = MI->getOperand(opNum); + O << Mips::MipsFCCToString((Mips::CondCode)MO.getImm()); +} + bool MipsAsmPrinter:: doInitialization(Module &M) { Modified: llvm/trunk/lib/Target/Mips/MipsCallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsCallingConv.td?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsCallingConv.td (original) +++ llvm/trunk/lib/Target/Mips/MipsCallingConv.td Sat Jul 5 14:05:21 2008 @@ -14,26 +14,76 @@ CCIf().", F), A>; //===----------------------------------------------------------------------===// -// Mips Return Value Calling Convention +// Mips O32 Calling Convention //===----------------------------------------------------------------------===// -def RetCC_Mips : CallingConv<[ +def CC_MipsO32 : CallingConv<[ + // Promote i8/i16 arguments to i32. + CCIfType<[i8, i16], CCPromoteToType>, + + // The first 4 integer arguments are passed in integer registers. + CCIfType<[i32], CCAssignToReg<[A0, A1, A2, A3]>>, + + // Integer values get stored in stack slots that are 4 bytes in + // size and 4-byte aligned. + CCIfType<[i32], CCAssignToStack<4, 4>> +]>; + +def RetCC_MipsO32 : CallingConv<[ // i32 are returned in registers V0, V1 CCIfType<[i32], CCAssignToReg<[V0, V1]>> ]>; - //===----------------------------------------------------------------------===// -// Mips Argument Calling Conventions +// Mips EABI Calling Convention //===----------------------------------------------------------------------===// -def CC_Mips : CallingConv<[ +def CC_MipsEABI : CallingConv<[ // Promote i8/i16 arguments to i32. CCIfType<[i8, i16], CCPromoteToType>, - // The first 4 integer arguments are passed in integer registers. - CCIfType<[i32], CCAssignToReg<[A0, A1, A2, A3]>>, + // Integer arguments are passed in integer registers. + CCIfType<[i32], CCAssignToReg<[A0, A1, A2, A3, T0, T1, T2, T3]>>, + + // Single fp arguments are passed in pairs within 32-bit mode + CCIfType<[f32], CCIfSubtarget<"isSingleFloat()", + CCAssignToReg<[F12, F13, F14, F15, F16, F17, F18, F19]>>>, + + CCIfType<[f32], CCIfSubtarget<"isNotSingleFloat()", + CCAssignToReg<[F12, F14, F16, F18]>>>, + + // The first 4 doubl fp arguments are passed in single fp registers. + CCIfType<[f64], CCIfSubtarget<"isNotSingleFloat()", + CCAssignToReg<[D6, D7, D8, D9]>>>, // Integer values get stored in stack slots that are 4 bytes in // size and 4-byte aligned. - CCIfType<[i32], CCAssignToStack<4, 4>> + CCIfType<[i32, f32], CCAssignToStack<4, 4>>, + + // Integer values get stored in stack slots that are 8 bytes in + // size and 8-byte aligned. + CCIfType<[f64], CCIfSubtarget<"isNotSingleFloat()", CCAssignToStack<8, 8>>> +]>; + +def RetCC_MipsEABI : CallingConv<[ + // i32 are returned in registers V0, V1 + CCIfType<[i32], CCAssignToReg<[V0, V1]>>, + + // f32 are returned in registers F0, F1 + CCIfType<[f32], CCAssignToReg<[F0, F1]>>, + + // f64 are returned in register D0 + CCIfType<[f64], CCIfSubtarget<"isNotSingleFloat()", CCAssignToReg<[D0]>>> ]>; +//===----------------------------------------------------------------------===// +// Mips Calling Convention Dispatch +//===----------------------------------------------------------------------===// + +def CC_Mips : CallingConv<[ + CCIfSubtarget<"isABI_EABI()", CCDelegateTo>, + CCDelegateTo +]>; + +def RetCC_Mips : CallingConv<[ + CCIfSubtarget<"isABI_EABI()", CCDelegateTo>, + CCDelegateTo +]>; Modified: llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelDAGToDAG.cpp Sat Jul 5 14:05:21 2008 @@ -58,13 +58,12 @@ /// Subtarget - Keep a pointer to the MipsSubtarget around so that we can /// make the right decision when generating code for different targets. - //TODO: add initialization on constructor - //const MipsSubtarget *Subtarget; + const MipsSubtarget &Subtarget; public: - MipsDAGToDAGISel(MipsTargetMachine &tm) : - SelectionDAGISel(MipsLowering), - TM(tm), MipsLowering(*TM.getTargetLowering()) {} + MipsDAGToDAGISel(MipsTargetMachine &tm) : SelectionDAGISel(MipsLowering), + TM(tm), MipsLowering(*TM.getTargetLowering()), + Subtarget(tm.getSubtarget()) {} virtual void InstructionSelect(SelectionDAG &SD); Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.cpp Sat Jul 5 14:05:21 2008 @@ -17,6 +17,7 @@ #include "MipsISelLowering.h" #include "MipsMachineFunction.h" #include "MipsTargetMachine.h" +#include "MipsSubtarget.h" #include "llvm/DerivedTypes.h" #include "llvm/Function.h" #include "llvm/Intrinsics.h" @@ -44,6 +45,8 @@ case MipsISD::Lo : return "MipsISD::Lo"; case MipsISD::Ret : return "MipsISD::Ret"; case MipsISD::SelectCC : return "MipsISD::SelectCC"; + case MipsISD::FPBrcond : return "MipsISD::FPBrcond"; + case MipsISD::FPCmp : return "MipsISD::FPCmp"; default : return NULL; } } @@ -51,6 +54,8 @@ MipsTargetLowering:: MipsTargetLowering(MipsTargetMachine &TM): TargetLowering(TM) { + Subtarget = &TM.getSubtarget(); + // Mips does not have i1 type, so use i32 for // setcc operations results (slt, sgt, ...). setSetCCResultContents(ZeroOrOneSetCCResult); @@ -61,12 +66,24 @@ // Set up the register classes addRegisterClass(MVT::i32, Mips::CPURegsRegisterClass); + // When dealing with single precision only, use libcalls + if (!Subtarget->isSingleFloat()) { + addRegisterClass(MVT::f32, Mips::AFGR32RegisterClass); + if (!Subtarget->isFP64bit()) + addRegisterClass(MVT::f64, Mips::AFGR64RegisterClass); + } else + addRegisterClass(MVT::f32, Mips::FGR32RegisterClass); + // Custom setOperationAction(ISD::GlobalAddress, MVT::i32, Custom); setOperationAction(ISD::GlobalTLSAddress, MVT::i32, Custom); setOperationAction(ISD::RET, MVT::Other, Custom); setOperationAction(ISD::JumpTable, MVT::i32, Custom); setOperationAction(ISD::SELECT_CC, MVT::i32, Custom); + setOperationAction(ISD::SELECT_CC, MVT::f32, Custom); + + if (Subtarget->isSingleFloat()) + setOperationAction(ISD::SELECT_CC, MVT::f64, Expand); // Load extented operations for i1 types must be promoted setLoadXAction(ISD::EXTLOAD, MVT::i1, Promote); @@ -80,6 +97,11 @@ setOperationAction(ISD::SELECT, MVT::i32, Expand); setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i1, Expand); + if (!Subtarget->isAllegrex()) { + setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i8, Expand); + setOperationAction(ISD::SIGN_EXTEND_INREG, MVT::i16, Expand); + } + // Mips not supported intrinsics. setOperationAction(ISD::MEMBARRIER, MVT::Other, Expand); @@ -323,7 +345,7 @@ /// LowerCCCCallTo - functions arguments are copied from virtual /// regs to (physical regs)/(stack frame), CALLSEQ_START and /// CALLSEQ_END are emitted. -/// TODO: isVarArg, isTailCall, sret. +/// TODO: isVarArg, isTailCall. SDOperand MipsTargetLowering:: LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG, unsigned CC) { @@ -351,10 +373,14 @@ Chain = DAG.getCALLSEQ_START(Chain,DAG.getConstant(NumBytes, getPointerTy())); - SmallVector, 8> RegsToPass; + // With EABI is it possible to have 16 args on registers. + SmallVector, 16> RegsToPass; SmallVector MemOpChains; - int LastStackLoc = 0; + // First/LastArgStackLoc contains the first/last + // "at stack" argument location. + int LastArgStackLoc = 0; + unsigned FirstStackArgLoc = (Subtarget->isABI_EABI() ? 0 : 16); // Walk the register/memloc assignments, inserting copies/loads. for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) { @@ -385,14 +411,16 @@ continue; } + // Register cant get to this point... assert(VA.isMemLoc()); // Create the frame index object for this incoming parameter // This guarantees that when allocating Local Area the firsts - // 16 bytes which are alwayes reserved won't be overwritten. - LastStackLoc = (16 + VA.getLocMemOffset()); + // 16 bytes which are alwayes reserved won't be overwritten + // if O32 ABI is used. For EABI the first address is zero. + LastArgStackLoc = (FirstStackArgLoc + VA.getLocMemOffset()); int FI = MFI->CreateFixedObject(VA.getValVT().getSizeInBits()/8, - LastStackLoc); + LastArgStackLoc); SDOperand PtrOff = DAG.getFrameIndex(FI,getPointerTy()); @@ -401,8 +429,8 @@ MemOpChains.push_back(DAG.getStore(Chain, Arg, PtrOff, NULL, 0)); } - // Transform all store nodes into one single node because - // all store nodes are independent of each other. + // Transform all store nodes into one single node because all store + // nodes are independent of each other. if (!MemOpChains.empty()) Chain = DAG.getNode(ISD::TokenFactor, MVT::Other, &MemOpChains[0], MemOpChains.size()); @@ -460,18 +488,18 @@ // emited CALL's to restore GP. if (getTargetMachine().getRelocationModel() == Reloc::PIC_) { // Function can have an arbitrary number of calls, so - // hold the LastStackLoc with the biggest offset. + // hold the LastArgStackLoc with the biggest offset. int FI; MipsFunctionInfo *MipsFI = MF.getInfo(); - if (LastStackLoc >= MipsFI->getGPStackOffset()) { - LastStackLoc = (!LastStackLoc) ? (16) : (LastStackLoc+4); + if (LastArgStackLoc >= MipsFI->getGPStackOffset()) { + LastArgStackLoc = (!LastArgStackLoc) ? (16) : (LastArgStackLoc+4); // Create the frame index only once. SPOffset here can be anything // (this will be fixed on processFunctionBeforeFrameFinalized) if (MipsFI->getGPStackOffset() == -1) { FI = MFI->CreateFixedObject(4, 0); MipsFI->setGPFI(FI); } - MipsFI->setGPStackOffset(LastStackLoc); + MipsFI->setGPStackOffset(LastArgStackLoc); } // Reload GP value. @@ -543,7 +571,7 @@ /// LowerCCCArguments - transform physical registers into /// virtual registers and generate load operations for /// arguments places on the stack. -/// TODO: isVarArg, sret +/// TODO: isVarArg SDOperand MipsTargetLowering:: LowerCCCArguments(SDOperand Op, SelectionDAG &DAG) { @@ -566,9 +594,11 @@ CCState CCInfo(CC, isVarArg, getTargetMachine(), ArgLocs); CCInfo.AnalyzeFormalArguments(Op.Val, CC_Mips); - SmallVector ArgValues; + SmallVector ArgValues; SDOperand StackPtr; + unsigned FirstStackArgLoc = (Subtarget->isABI_EABI() ? 0 : 16); + for (unsigned i = 0, e = ArgLocs.size(); i != e; ++i) { CCValAssign &VA = ArgLocs[i]; @@ -579,9 +609,17 @@ TargetRegisterClass *RC; if (RegVT == MVT::i32) - RC = Mips::CPURegsRegisterClass; - else - assert(0 && "support only Mips::CPURegsRegisterClass"); + RC = Mips::CPURegsRegisterClass; + else if (RegVT == MVT::f32) { + if (Subtarget->isSingleFloat()) + RC = Mips::FGR32RegisterClass; + else + RC = Mips::AFGR32RegisterClass; + } else if (RegVT == MVT::f64) { + if (!Subtarget->isSingleFloat()) + RC = Mips::AFGR64RegisterClass; + } else + assert(0 && "RegVT not supported by FORMAL_ARGUMENTS Lowering"); // Transform the arguments stored on // physical registers into virtual ones @@ -605,8 +643,7 @@ // To meet ABI, when VARARGS are passed on registers, the registers // must have their values written to the caller stack frame. - if (isVarArg) { - + if ((isVarArg) && (Subtarget->isABI_O32())) { if (StackPtr.Val == 0) StackPtr = DAG.getRegister(StackReg, getPointerTy()); @@ -627,7 +664,8 @@ ArgValues.push_back(DAG.getStore(Root, ArgValue, PtrOff, NULL, 0)); } - } else { + } else { // VA.isRegLoc() + // sanity check assert(VA.isMemLoc()); @@ -639,14 +677,30 @@ // be used on emitPrologue) to avoid mis-calc of the first stack // offset on PEI::calculateFrameObjectOffsets. // Arguments are always 32-bit. - int FI = MFI->CreateFixedObject(4, 0); - MipsFI->recordLoadArgsFI(FI, -(4+(16+VA.getLocMemOffset()))); + unsigned ArgSize = VA.getLocVT().getSizeInBits()/8; + int FI = MFI->CreateFixedObject(ArgSize, 0); + MipsFI->recordLoadArgsFI(FI, -(ArgSize+ + (FirstStackArgLoc + VA.getLocMemOffset()))); // Create load nodes to retrieve arguments from the stack SDOperand FIN = DAG.getFrameIndex(FI, getPointerTy()); ArgValues.push_back(DAG.getLoad(VA.getValVT(), Root, FIN, NULL, 0)); } } + + // The mips ABIs for returning structs by value requires that we copy + // the sret argument into $v0 for the return. Save the argument into + // a virtual register so that we can access it from the return points. + if (DAG.getMachineFunction().getFunction()->hasStructRetAttr()) { + unsigned Reg = MipsFI->getSRetReturnReg(); + if (!Reg) { + Reg = MF.getRegInfo().createVirtualRegister(getRegClassFor(MVT::i32)); + MipsFI->setSRetReturnReg(Reg); + } + SDOperand Copy = DAG.getCopyToReg(DAG.getEntryNode(), Reg, ArgValues[0]); + Root = DAG.getNode(ISD::TokenFactor, MVT::Other, Copy, Root); + } + ArgValues.push_back(Root); // Return the new list of results. @@ -699,6 +753,23 @@ Flag = Chain.getValue(1); } + // The mips ABIs for returning structs by value requires that we copy + // the sret argument into $v0 for the return. We saved the argument into + // a virtual register in the entry block, so now we copy the value out + // and into $v0. + if (DAG.getMachineFunction().getFunction()->hasStructRetAttr()) { + MachineFunction &MF = DAG.getMachineFunction(); + MipsFunctionInfo *MipsFI = MF.getInfo(); + unsigned Reg = MipsFI->getSRetReturnReg(); + + if (!Reg) + assert(0 && "sret virtual register not created in the entry block"); + SDOperand Val = DAG.getCopyFromReg(Chain, Reg, getPointerTy()); + + Chain = DAG.getCopyToReg(Chain, Mips::V0, Val, Flag); + Flag = Chain.getValue(1); + } + // Return on Mips is always a "jr $ra" if (Flag.Val) return DAG.getNode(MipsISD::Ret, MVT::Other, @@ -717,19 +788,20 @@ MipsTargetLowering::ConstraintType MipsTargetLowering:: getConstraintType(const std::string &Constraint) const { + // Mips specific constrainy + // GCC config/mips/constraints.md + // + // 'd' : An address register. Equivalent to r + // unless generating MIPS16 code. + // 'y' : Equivalent to r; retained for + // backwards compatibility. + // 'f' : Float Point registers. if (Constraint.size() == 1) { - // Mips specific constrainy - // GCC config/mips/constraints.md - // - // 'd' : An address register. Equivalent to r - // unless generating MIPS16 code. - // 'y' : Equivalent to r; retained for - // backwards compatibility. - // switch (Constraint[0]) { default : break; case 'd': case 'y': + case 'f': return C_RegisterClass; break; } @@ -737,6 +809,9 @@ return TargetLowering::getConstraintType(Constraint); } +/// getRegClassForInlineAsmConstraint - Given a constraint letter (e.g. "r"), +/// return a list of registers that can be used to satisfy the constraint. +/// This should only be used for C_RegisterClass constraints. std::pair MipsTargetLowering:: getRegForInlineAsmConstraint(const std::string &Constraint, MVT VT) const { @@ -744,12 +819,23 @@ switch (Constraint[0]) { case 'r': return std::make_pair(0U, Mips::CPURegsRegisterClass); - break; + case 'f': + if (VT == MVT::f32) + if (Subtarget->isSingleFloat()) + return std::make_pair(0U, Mips::FGR32RegisterClass); + else + return std::make_pair(0U, Mips::AFGR32RegisterClass); + if (VT == MVT::f64) + if ((!Subtarget->isSingleFloat()) && (!Subtarget->isFP64bit())) + return std::make_pair(0U, Mips::AFGR64RegisterClass); } } return TargetLowering::getRegForInlineAsmConstraint(Constraint, VT); } +/// Given a register class constraint, like 'r', if this corresponds directly +/// to an LLVM register class, return a register of 0 and the register class +/// pointer. std::vector MipsTargetLowering:: getRegClassForInlineAsmConstraint(const std::string &Constraint, MVT VT) const @@ -763,15 +849,29 @@ // GCC Mips Constraint Letters case 'd': case 'y': - return make_vector(Mips::V0, Mips::V1, Mips::A0, - Mips::A1, Mips::A2, Mips::A3, - Mips::T0, Mips::T1, Mips::T2, - Mips::T3, Mips::T4, Mips::T5, - Mips::T6, Mips::T7, Mips::S0, - Mips::S1, Mips::S2, Mips::S3, - Mips::S4, Mips::S5, Mips::S6, - Mips::S7, Mips::T8, Mips::T9, 0); - break; + return make_vector(Mips::T0, Mips::T1, Mips::T2, Mips::T3, + Mips::T4, Mips::T5, Mips::T6, Mips::T7, Mips::S0, Mips::S1, + Mips::S2, Mips::S3, Mips::S4, Mips::S5, Mips::S6, Mips::S7, + Mips::T8, 0); + + case 'f': + if (VT == MVT::f32) + if (Subtarget->isSingleFloat()) + return make_vector(Mips::F2, Mips::F3, Mips::F4, Mips::F5, + Mips::F6, Mips::F7, Mips::F8, Mips::F9, Mips::F10, Mips::F11, + Mips::F20, Mips::F21, Mips::F22, Mips::F23, Mips::F24, + Mips::F25, Mips::F26, Mips::F27, Mips::F28, Mips::F29, + Mips::F30, Mips::F31, 0); + else + return make_vector(Mips::F2, Mips::F4, Mips::F6, Mips::F8, + Mips::F10, Mips::F20, Mips::F22, Mips::F24, Mips::F26, + Mips::F28, Mips::F30, 0); + + if (VT == MVT::f64) + if ((!Subtarget->isSingleFloat()) && (!Subtarget->isFP64bit())) + return make_vector(Mips::D1, Mips::D2, Mips::D3, Mips::D4, + Mips::D5, Mips::D10, Mips::D11, Mips::D12, Mips::D13, + Mips::D14, Mips::D15, 0); } return std::vector(); } Modified: llvm/trunk/lib/Target/Mips/MipsISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsISelLowering.h?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsISelLowering.h (original) +++ llvm/trunk/lib/Target/Mips/MipsISelLowering.h Sat Jul 5 14:05:21 2008 @@ -40,6 +40,12 @@ // Select CC Pseudo Instruction SelectCC, + // Float Point Branch Conditional + FPBrcond, + + // Float Point Compare + FPCmp, + // Return Ret }; @@ -69,6 +75,9 @@ MVT getSetCCResultType(const SDOperand &) const; private: + // Subtarget Info + const MipsSubtarget *Subtarget; + // Lower Operand helpers SDOperand LowerCCCArguments(SDOperand Op, SelectionDAG &DAG); SDOperand LowerCCCCallTo(SDOperand Op, SelectionDAG &DAG, unsigned CC); Added: llvm/trunk/lib/Target/Mips/MipsInstrFPU.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrFPU.td?rev=53146&view=auto ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrFPU.td (added) +++ llvm/trunk/lib/Target/Mips/MipsInstrFPU.td Sat Jul 5 14:05:21 2008 @@ -0,0 +1,296 @@ +//===- MipsInstrFPU.td - Mips FPU Instruction Information -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains the Mips implementation of the TargetInstrInfo class. +// +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// +// Float Point Instructions +// ------------------------ +// * 64bit fp: +// - 32 64-bit registers (default mode) +// - 16 even 32-bit registers (32-bit compatible mode) for +// single and double access. +// * 32bit fp: +// - 16 even 32-bit registers - single and double (aliased) +// - 32 32-bit registers (within single-only mode) +//===----------------------------------------------------------------------===// + +// Float Point Compare and Branch +def SDT_MipsFPBrcond : SDTypeProfile<0, 3, [SDTCisSameAs<0, 2>, SDTCisInt<0>, + SDTCisVT<1, OtherVT>]>; +def SDT_MipsFPCmp : SDTypeProfile<0, 3, [SDTCisSameAs<0, 1>, SDTCisFP<0>, + SDTCisInt<2>]>; +def MipsFPBrcond : SDNode<"MipsISD::FPBrcond", SDT_MipsFPBrcond, + [SDNPHasChain]>; +def MipsFPCmp : SDNode<"MipsISD::FPCmp", SDT_MipsFPCmp>; + +// Operand for printing out a condition code. +let PrintMethod = "printFCCOperand" in + def condcode : Operand; + +//===----------------------------------------------------------------------===// +// Feature predicates. +//===----------------------------------------------------------------------===// + +def In32BitMode : Predicate<"!Subtarget.isFP64bit()">; +def In64BitMode : Predicate<"Subtarget.isFP64bit()">; +def IsSingleFloat : Predicate<"Subtarget.isSingleFloat()">; +def IsNotSingleFloat : Predicate<"!Subtarget.isSingleFloat()">; + +//===----------------------------------------------------------------------===// +// Instruction Class Templates +// +// A set of multiclasses is used to address this in one shot. +// SO32 - single precision only, uses all 32 32-bit fp registers +// require FGR32 Register Class and IsSingleFloat +// AS32 - 16 even fp registers are used for single precision +// require AFGR32 Register Class and In32BitMode +// S64 - 32 64 bit registers are used to hold 32-bit single precision values. +// require FGR64 Register Class and In64BitMode +// D32 - 16 even fp registers are used for double precision +// require AFGR64 Register Class and In32BitMode +// D64 - 32 64 bit registers are used to hold 64-bit double precision values. +// require FGR64 Register Class and In64BitMode +// +// Only SO32, AS32 and D32 are supported right now. +// +//===----------------------------------------------------------------------===// + +multiclass FFR1_1 funct, string asmstr> +{ + def _SO32 : FFR<0x11, funct, 0x0, (outs FGR32:$fd), (ins FGR32:$fs), + !strconcat(asmstr, ".s $fd, $fs"), []>, Requires<[IsSingleFloat]>; + + def _AS32 : FFR<0x11, funct, 0x0, (outs AFGR32:$fd), (ins AFGR32:$fs), + !strconcat(asmstr, ".s $fd, $fs"), []>, Requires<[In32BitMode]>; + + def _D32 : FFR<0x11, funct, 0x1, (outs AFGR64:$fd), (ins AFGR64:$fs), + !strconcat(asmstr, ".d $fd, $fs"), []>, Requires<[In32BitMode]>; +} + +multiclass FFR1_2 funct, string asmstr, SDNode FOp> +{ + def _SO32 : FFR<0x11, funct, 0x0, (outs FGR32:$fd), (ins FGR32:$fs), + !strconcat(asmstr, ".s $fd, $fs"), + [(set FGR32:$fd, (FOp FGR32:$fs))]>, Requires<[IsSingleFloat]>; + + def _AS32 : FFR<0x11, funct, 0x0, (outs AFGR32:$fd), (ins AFGR32:$fs), + !strconcat(asmstr, ".s $fd, $fs"), + [(set AFGR32:$fd, (FOp AFGR32:$fs))]>, Requires<[In32BitMode]>; + + def _D32 : FFR<0x11, funct, 0x1, (outs AFGR64:$fd), (ins AFGR64:$fs), + !strconcat(asmstr, ".d $fd, $fs"), + [(set AFGR64:$fd, (FOp AFGR64:$fs))]>, Requires<[In32BitMode]>; +} + +class FFR1_3 funct, bits<5> fmt, RegisterClass RcSrc, + RegisterClass RcDst, string asmstr>: + FFR<0x11, funct, fmt, (outs RcSrc:$fd), (ins RcDst:$fs), + !strconcat(asmstr, " $fd, $fs"), []>; + + +multiclass FFR1_4 funct, string asmstr, SDNode FOp> { + def _SO32 : FFR<0x11, funct, 0x0, (outs FGR32:$fd), (ins FGR32:$fs, FGR32:$ft), + !strconcat(asmstr, ".s $fd, $fs, $ft"), + [(set FGR32:$fd, (FOp FGR32:$fs, FGR32:$ft))]>, + Requires<[IsSingleFloat]>; + + def _AS32 : FFR<0x11, funct, 0x0, (outs AFGR32:$fd), + (ins AFGR32:$fs, AFGR32:$ft), + !strconcat(asmstr, ".s $fd, $fs, $ft"), + [(set AFGR32:$fd, (FOp AFGR32:$fs, AFGR32:$ft))]>, + Requires<[In32BitMode]>; + + def _D32 : FFR<0x11, funct, 0x1, (outs AFGR64:$fd), + (ins AFGR64:$fs, AFGR64:$ft), + !strconcat(asmstr, ".d $fd, $fs, $ft"), + [(set AFGR64:$fd, (FOp AFGR64:$fs, AFGR64:$ft))]>, + Requires<[In32BitMode]>; +} + +//===----------------------------------------------------------------------===// +// Float Point Instructions +//===----------------------------------------------------------------------===// + +let ft = 0 in { + defm FLOOR_W : FFR1_1<0b001111, "floor.w">; + defm CEIL_W : FFR1_1<0b001110, "ceil.w">; + defm ROUND_W : FFR1_1<0b001100, "round.w">; + defm TRUNC_W : FFR1_1<0b001101, "trunc.w">; + defm CVTW : FFR1_1<0b100100, "cvt.w">; + defm FMOV : FFR1_1<0b000110, "mov">; + + defm FABS : FFR1_2<0b000101, "abs", fabs>; + defm FNEG : FFR1_2<0b000111, "neg", fneg>; + defm FSQRT : FFR1_2<0b000100, "sqrt", fsqrt>; + + let Predicates = [IsNotSingleFloat] in { + /// Ceil to long signed integer + def CEIL_LS : FFR1_3<0b001010, 0x0, AFGR32, AFGR32, "ceil.l">; + def CEIL_LD : FFR1_3<0b001010, 0x1, AFGR64, AFGR64, "ceil.l">; + + /// Round to long signed integer + def ROUND_LS : FFR1_3<0b001000, 0x0, AFGR32, AFGR32, "round.l">; + def ROUND_LD : FFR1_3<0b001000, 0x1, AFGR64, AFGR64, "round.l">; + + /// Floor to long signed integer + def FLOOR_LS : FFR1_3<0b001011, 0x0, AFGR32, AFGR32, "floor.l">; + def FLOOR_LD : FFR1_3<0b001011, 0x1, AFGR64, AFGR64, "floor.l">; + + /// Trunc to long signed integer + def TRUNC_LS : FFR1_3<0b001001, 0x0, AFGR32, AFGR32, "trunc.l">; + def TRUNC_LD : FFR1_3<0b001001, 0x1, AFGR64, AFGR64, "trunc.l">; + + /// Convert to long signed integer + def CVTL_S : FFR1_3<0b100101, 0x0, AFGR32, AFGR32, "cvt.l">; + def CVTL_D : FFR1_3<0b100101, 0x1, AFGR64, AFGR64, "cvt.l">; + + /// Convert to Double Precison + def CVTD_S32 : FFR1_3<0b100001, 0x0, AFGR64, FGR32, "cvt.d.s">; + def CVTD_W32 : FFR1_3<0b100001, 0x2, AFGR64, FGR32, "cvt.d.w">; + def CVTD_L32 : FFR1_3<0b100001, 0x3, AFGR64, AFGR64, "cvt.d.l">; + + /// Convert to Single Precison + def CVTS_D32 : FFR1_3<0b100000, 0x1, FGR32, AFGR64, "cvt.s.d">; + def CVTS_L32 : FFR1_3<0b100000, 0x3, FGR32, AFGR64, "cvt.s.l">; + } + + /// Convert to Single Precison + def CVTS_W32 : FFR1_3<0b100000, 0x2, FGR32, FGR32, "cvt.s.w">, + Requires<[IsSingleFloat]>; +} + +// The odd-numbered registers are only referenced when doing loads, +// stores, and moves between floating-point and integer registers. +// When defining instructions, we reference all 32-bit registers, +// regardless of register aliasing. +let fd = 0 in { + /// Move Control Registers From/To CPU Registers + ///def CFC1 : FFR<0x11, 0x0, 0x2, (outs CPURegs:$rt), (ins FGR32:$fs), + /// "cfc1 $rt, $fs", []>; + + ///def CTC1 : FFR<0x11, 0x0, 0x6, (outs CPURegs:$rt), (ins FGR32:$fs), + /// "ctc1 $rt, $fs", []>; + /// + ///def CFC1A : FFR<0x11, 0x0, 0x2, (outs CPURegs:$rt), (ins AFGR32:$fs), + /// "cfc1 $rt, $fs", []>; + + ///def CTC1A : FFR<0x11, 0x0, 0x6, (outs CPURegs:$rt), (ins AFGR32:$fs), + /// "ctc1 $rt, $fs", []>; + + def MFC1 : FFR<0x11, 0x00, 0x00, (outs CPURegs:$rt), (ins FGR32:$fs), + "mfc1 $rt, $fs", []>; + + def MTC1 : FFR<0x11, 0x00, 0x04, (outs FGR32:$fs), (ins CPURegs:$rt), + "mtc1 $fs, $rt", []>; + + def MFC1A : FFR<0x11, 0x00, 0x00, (outs CPURegs:$rt), (ins AFGR32:$fs), + "mfc1 $rt, $fs", []>; + + def MTC1A : FFR<0x11, 0x00, 0x04, (outs AFGR32:$fs), (ins CPURegs:$rt), + "mtc1 $fs, $rt", []>; +} + +/// Float Point Memory Instructions +let Predicates = [IsNotSingleFloat] in { + def LDC1 : FFI<0b110101, (outs AFGR64:$ft), (ins mem:$addr), + "ldc1 $ft, $addr", [(set AFGR64:$ft, (load addr:$addr))]>; + + def SDC1 : FFI<0b111101, (outs), (ins AFGR64:$ft, mem:$addr), + "sdc1 $ft, $addr", [(store AFGR64:$ft, addr:$addr)]>; +} + +// LWC1 and SWC1 can always be emited with odd registers. +def LWC1 : FFI<0b110001, (outs FGR32:$ft), (ins mem:$addr), "lwc1 $ft, $addr", + [(set FGR32:$ft, (load addr:$addr))]>; +def SWC1 : FFI<0b111001, (outs), (ins FGR32:$ft, mem:$addr), "swc1 $ft, $addr", + [(store FGR32:$ft, addr:$addr)]>; + +def LWC1A : FFI<0b110001, (outs AFGR32:$ft), (ins mem:$addr), "lwc1 $ft, $addr", + [(set AFGR32:$ft, (load addr:$addr))]>; +def SWC1A : FFI<0b111001, (outs), (ins AFGR32:$ft, mem:$addr), "swc1 $ft, $addr", + [(store AFGR32:$ft, addr:$addr)]>; + +/// Floating-point Aritmetic +defm FADD : FFR1_4<0x10, "add", fadd>; +defm FDIV : FFR1_4<0x03, "div", fdiv>; +defm FMUL : FFR1_4<0x02, "mul", fmul>; +defm FSUB : FFR1_4<0x01, "sub", fsub>; + +//===----------------------------------------------------------------------===// +// Float Point Branch Codes +//===----------------------------------------------------------------------===// +// Mips branch codes. These correspond to condcode in MipsInstrInfo.h. +// They must be kept in synch. +def MIPS_BRANCH_F : PatLeaf<(i32 0)>; +def MIPS_BRANCH_T : PatLeaf<(i32 1)>; +def MIPS_BRANCH_FL : PatLeaf<(i32 2)>; +def MIPS_BRANCH_TL : PatLeaf<(i32 3)>; + +/// Float Point Branch of False/True (Likely) +let isBranch=1, isTerminator=1, hasDelaySlot=1, base=0x8, Uses=[FCR31] in { + class FBRANCH : FFI<0x11, (ops), + (ins brtarget:$dst), !strconcat(asmstr, " $dst"), + [(MipsFPBrcond op, bb:$dst, FCR31)]>; +} +def BC1F : FBRANCH; +def BC1T : FBRANCH; +def BC1FL : FBRANCH; +def BC1TL : FBRANCH; + +//===----------------------------------------------------------------------===// +// Float Point Flag Conditions +//===----------------------------------------------------------------------===// +// Mips condition codes. They must correspond to condcode in MipsInstrInfo.h. +// They must be kept in synch. +def MIPS_FCOND_F : PatLeaf<(i32 0)>; +def MIPS_FCOND_UN : PatLeaf<(i32 1)>; +def MIPS_FCOND_EQ : PatLeaf<(i32 2)>; +def MIPS_FCOND_UEQ : PatLeaf<(i32 3)>; +def MIPS_FCOND_OLT : PatLeaf<(i32 4)>; +def MIPS_FCOND_ULT : PatLeaf<(i32 5)>; +def MIPS_FCOND_OLE : PatLeaf<(i32 6)>; +def MIPS_FCOND_ULE : PatLeaf<(i32 7)>; +def MIPS_FCOND_SF : PatLeaf<(i32 8)>; +def MIPS_FCOND_NGLE : PatLeaf<(i32 9)>; +def MIPS_FCOND_SEQ : PatLeaf<(i32 10)>; +def MIPS_FCOND_NGL : PatLeaf<(i32 11)>; +def MIPS_FCOND_LT : PatLeaf<(i32 12)>; +def MIPS_FCOND_NGE : PatLeaf<(i32 13)>; +def MIPS_FCOND_LE : PatLeaf<(i32 14)>; +def MIPS_FCOND_NGT : PatLeaf<(i32 15)>; + +/// Floating Point Compare +let hasDelaySlot = 1, Defs=[FCR31] in { + +//multiclass FCC1_1 + + def FCMP_SO32 : FCC<0x0, (outs), (ins FGR32:$fs, FGR32:$ft, condcode:$cc), + "c.$cc.s $fs $ft", [(MipsFPCmp FGR32:$fs, FGR32:$ft, imm:$cc), + (implicit FCR31)]>, Requires<[IsSingleFloat]>; + + def FCMP_AS32 : FCC<0x0, (outs), (ins AFGR32:$fs, AFGR32:$ft, condcode:$cc), + "c.$cc.s $fs $ft", [(MipsFPCmp AFGR32:$fs, AFGR32:$ft, imm:$cc), + (implicit FCR31)]>, Requires<[In32BitMode]>; + + def FCMP_D32 : FCC<0x1, (outs), (ins AFGR64:$fs, AFGR64:$ft, condcode:$cc), + "c.$cc.d $fs $ft", [(MipsFPCmp AFGR64:$fs, AFGR64:$ft, imm:$cc), + (implicit FCR31)]>, Requires<[In32BitMode]>; +} + +//===----------------------------------------------------------------------===// +// Float Point Patterns +//===----------------------------------------------------------------------===// +def : Pat<(f32 (sint_to_fp CPURegs:$src)), (CVTS_W32 (MTC1 CPURegs:$src))>; +def : Pat<(f64 (sint_to_fp CPURegs:$src)), (CVTD_W32 (MTC1 CPURegs:$src))>; +def : Pat<(i32 (fp_to_sint FGR32:$src)), (MFC1 (CVTW_SO32 FGR32:$src))>; +def : Pat<(i32 (fp_to_sint AFGR32:$src)), (MFC1 (CVTW_AS32 AFGR32:$src))>; + Modified: llvm/trunk/lib/Target/Mips/MipsInstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrFormats.td?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrFormats.td (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrFormats.td Sat Jul 5 14:05:21 2008 @@ -120,8 +120,8 @@ //===----------------------------------------------------------------------===// class FFR op, bits<6> _funct, bits<5> _fmt, dag outs, dag ins, - string asmstr, list pattern, InstrItinClass itin> : - MipsInst + string asmstr, list pattern> : + MipsInst { bits<5> fd; bits<5> fs; @@ -141,21 +141,42 @@ } //===----------------------------------------------------------------------===// -// Format FI instruction class in Mips : <|opcode|fmt|ft|immediate|> +// Format FI instruction class in Mips : <|opcode|base|ft|immediate|> //===----------------------------------------------------------------------===// -class FFI op, bits<5> _fmt, dag outs, dag ins, string asmstr, - list pattern, InstrItinClass itin>: - MipsInst +class FFI op, dag outs, dag ins, string asmstr, list pattern>: + MipsInst { bits<5> ft; - bits<5> fmt; + bits<5> base; bits<16> imm16; let opcode = op; + + let Inst{25-21} = base; + let Inst{20-16} = ft; + let Inst{15-0} = imm16; +} + +//===----------------------------------------------------------------------===// +// Compare instruction class in Mips : <|010001|fmt|ft|fs|0000011|condcode|> +//===----------------------------------------------------------------------===// + +class FCC _fmt, dag outs, dag ins, string asmstr, list pattern> : + MipsInst +{ + bits<5> fs; + bits<5> ft; + bits<4> cc; + bits<5> fmt; + + let opcode = 0x11; let fmt = _fmt; let Inst{25-21} = fmt; let Inst{20-16} = ft; - let Inst{15-0} = imm16; + let Inst{15-11} = fs; + let Inst{10-6} = 0; + let Inst{5-4} = 0b11; + let Inst{3-0} = cc; } Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.cpp Sat Jul 5 14:05:21 2008 @@ -19,7 +19,6 @@ using namespace llvm; -// TODO: Add the subtarget support on this constructor MipsInstrInfo::MipsInstrInfo(MipsTargetMachine &tm) : TargetInstrInfoImpl(MipsInsts, array_lengthof(MipsInsts)), TM(tm), RI(*this) {} @@ -35,8 +34,7 @@ { // addu $dst, $src, $zero || addu $dst, $zero, $src // or $dst, $src, $zero || or $dst, $zero, $src - if ((MI.getOpcode() == Mips::ADDu) || (MI.getOpcode() == Mips::OR)) - { + if ((MI.getOpcode() == Mips::ADDu) || (MI.getOpcode() == Mips::OR)) { if (MI.getOperand(1).getReg() == Mips::ZERO) { DstReg = MI.getOperand(0).getReg(); SrcReg = MI.getOperand(2).getReg(); @@ -48,9 +46,20 @@ } } + // mov $fpDst, $fpSrc + // mfc $gpDst, $fpSrc + // mtc $fpDst, $gpSrc + if (MI.getOpcode() == Mips::FMOV_SO32 || MI.getOpcode() == Mips::FMOV_AS32 || + MI.getOpcode() == Mips::FMOV_D32 || MI.getOpcode() == Mips::MFC1A || + MI.getOpcode() == Mips::MFC1 || MI.getOpcode() == Mips::MTC1A || + MI.getOpcode() == Mips::MTC1 ) { + DstReg = MI.getOperand(0).getReg(); + SrcReg = MI.getOperand(1).getReg(); + return true; + } + // addiu $dst, $src, 0 - if (MI.getOpcode() == Mips::ADDiu) - { + if (MI.getOpcode() == Mips::ADDiu) { if ((MI.getOperand(1).isRegister()) && (isZeroImm(MI.getOperand(2)))) { DstReg = MI.getOperand(0).getReg(); SrcReg = MI.getOperand(1).getReg(); @@ -68,12 +77,11 @@ unsigned MipsInstrInfo:: isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const { - if (MI->getOpcode() == Mips::LW) - { + if ((MI->getOpcode() == Mips::LW) || (MI->getOpcode() == Mips::LWC1) || + (MI->getOpcode() == Mips::LWC1A) || (MI->getOpcode() == Mips::LDC1)) { if ((MI->getOperand(2).isFrameIndex()) && // is a stack slot (MI->getOperand(1).isImmediate()) && // the imm is zero - (isZeroImm(MI->getOperand(1)))) - { + (isZeroImm(MI->getOperand(1)))) { FrameIndex = MI->getOperand(2).getIndex(); return MI->getOperand(0).getReg(); } @@ -90,11 +98,11 @@ unsigned MipsInstrInfo:: isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const { - if (MI->getOpcode() == Mips::SW) { + if ((MI->getOpcode() == Mips::SW) || (MI->getOpcode() == Mips::SWC1) || + (MI->getOpcode() == Mips::SWC1A) || (MI->getOpcode() == Mips::SDC1)) { if ((MI->getOperand(0).isFrameIndex()) && // is a stack slot (MI->getOperand(1).isImmediate()) && // the imm is zero - (isZeroImm(MI->getOperand(1)))) - { + (isZeroImm(MI->getOperand(1)))) { FrameIndex = MI->getOperand(0).getIndex(); return MI->getOperand(2).getReg(); } @@ -110,6 +118,208 @@ BuildMI(MBB, MI, get(Mips::NOP)); } +void MipsInstrInfo:: +copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, + unsigned DestReg, unsigned SrcReg, + const TargetRegisterClass *DestRC, + const TargetRegisterClass *SrcRC) const { + if (DestRC != SrcRC) { + if ((DestRC == Mips::CPURegsRegisterClass) && + (SrcRC == Mips::FGR32RegisterClass)) + BuildMI(MBB, I, get(Mips::MFC1), DestReg).addReg(SrcReg); + else if ((DestRC == Mips::CPURegsRegisterClass) && + (SrcRC == Mips::AFGR32RegisterClass)) + BuildMI(MBB, I, get(Mips::MFC1A), DestReg).addReg(SrcReg); + else if ((DestRC == Mips::FGR32RegisterClass) && + (SrcRC == Mips::CPURegsRegisterClass)) + BuildMI(MBB, I, get(Mips::MTC1), DestReg).addReg(SrcReg); + else if ((DestRC == Mips::AFGR32RegisterClass) && + (SrcRC == Mips::CPURegsRegisterClass)) + BuildMI(MBB, I, get(Mips::MTC1A), DestReg).addReg(SrcReg); + else + assert (0 && "DestRC != SrcRC, Can't copy this register"); + } + + if (DestRC == Mips::CPURegsRegisterClass) + BuildMI(MBB, I, get(Mips::ADDu), DestReg).addReg(Mips::ZERO) + .addReg(SrcReg); + else if (DestRC == Mips::FGR32RegisterClass) + BuildMI(MBB, I, get(Mips::FMOV_SO32), DestReg).addReg(SrcReg); + else if (DestRC == Mips::AFGR32RegisterClass) + BuildMI(MBB, I, get(Mips::FMOV_AS32), DestReg).addReg(SrcReg); + else if (DestRC == Mips::AFGR64RegisterClass) + BuildMI(MBB, I, get(Mips::FMOV_D32), DestReg).addReg(SrcReg); + else + assert (0 && "Can't copy this register"); +} + +void MipsInstrInfo:: +storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, + unsigned SrcReg, bool isKill, int FI, + const TargetRegisterClass *RC) const +{ + unsigned Opc; + if (RC == Mips::CPURegsRegisterClass) + Opc = Mips::SW; + else if (RC == Mips::FGR32RegisterClass) + Opc = Mips::SWC1; + else if (RC == Mips::AFGR32RegisterClass) + Opc = Mips::SWC1A; + else if (RC == Mips::AFGR64RegisterClass) + Opc = Mips::SDC1; + else + assert(0 && "Can't store this register to stack slot"); + + BuildMI(MBB, I, get(Opc)).addReg(SrcReg, false, false, isKill) + .addImm(0).addFrameIndex(FI); +} + +void MipsInstrInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, + bool isKill, SmallVectorImpl &Addr, + const TargetRegisterClass *RC, SmallVectorImpl &NewMIs) const +{ + unsigned Opc; + if (RC == Mips::CPURegsRegisterClass) + Opc = Mips::SW; + else if (RC == Mips::FGR32RegisterClass) + Opc = Mips::SWC1; + else if (RC == Mips::AFGR32RegisterClass) + Opc = Mips::SWC1A; + else if (RC == Mips::AFGR64RegisterClass) + Opc = Mips::SDC1; + else + assert(0 && "Can't store this register"); + + MachineInstrBuilder MIB = BuildMI(get(Opc)) + .addReg(SrcReg, false, false, isKill); + for (unsigned i = 0, e = Addr.size(); i != e; ++i) { + MachineOperand &MO = Addr[i]; + if (MO.isRegister()) + MIB.addReg(MO.getReg()); + else if (MO.isImmediate()) + MIB.addImm(MO.getImm()); + else + MIB.addFrameIndex(MO.getIndex()); + } + NewMIs.push_back(MIB); + return; +} + +void MipsInstrInfo:: +loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, + unsigned DestReg, int FI, + const TargetRegisterClass *RC) const +{ + unsigned Opc; + if (RC == Mips::CPURegsRegisterClass) + Opc = Mips::LW; + else if (RC == Mips::FGR32RegisterClass) + Opc = Mips::LWC1; + else if (RC == Mips::AFGR32RegisterClass) + Opc = Mips::LWC1A; + else if (RC == Mips::AFGR64RegisterClass) + Opc = Mips::LDC1; + else + assert(0 && "Can't load this register from stack slot"); + + BuildMI(MBB, I, get(Opc), DestReg).addImm(0).addFrameIndex(FI); +} + +void MipsInstrInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, + SmallVectorImpl &Addr, + const TargetRegisterClass *RC, + SmallVectorImpl &NewMIs) const { + unsigned Opc; + if (RC == Mips::CPURegsRegisterClass) + Opc = Mips::LW; + else if (RC == Mips::FGR32RegisterClass) + Opc = Mips::LWC1; + else if (RC == Mips::AFGR32RegisterClass) + Opc = Mips::LWC1A; + else if (RC == Mips::AFGR64RegisterClass) + Opc = Mips::LDC1; + else + assert(0 && "Can't load this register"); + + MachineInstrBuilder MIB = BuildMI(get(Opc), DestReg); + for (unsigned i = 0, e = Addr.size(); i != e; ++i) { + MachineOperand &MO = Addr[i]; + if (MO.isRegister()) + MIB.addReg(MO.getReg()); + else if (MO.isImmediate()) + MIB.addImm(MO.getImm()); + else + MIB.addFrameIndex(MO.getIndex()); + } + NewMIs.push_back(MIB); + return; +} + +MachineInstr *MipsInstrInfo:: +foldMemoryOperand(MachineFunction &MF, + MachineInstr* MI, + SmallVectorImpl &Ops, int FI) const +{ + if (Ops.size() != 1) return NULL; + + MachineInstr *NewMI = NULL; + + switch (MI->getOpcode()) { + case Mips::ADDu: + if ((MI->getOperand(0).isRegister()) && + (MI->getOperand(1).isRegister()) && + (MI->getOperand(1).getReg() == Mips::ZERO) && + (MI->getOperand(2).isRegister())) { + if (Ops[0] == 0) { // COPY -> STORE + unsigned SrcReg = MI->getOperand(2).getReg(); + bool isKill = MI->getOperand(2).isKill(); + NewMI = BuildMI(get(Mips::SW)).addFrameIndex(FI) + .addImm(0).addReg(SrcReg, false, false, isKill); + } else { // COPY -> LOAD + unsigned DstReg = MI->getOperand(0).getReg(); + bool isDead = MI->getOperand(0).isDead(); + NewMI = BuildMI(get(Mips::LW)) + .addReg(DstReg, true, false, false, isDead) + .addImm(0).addFrameIndex(FI); + } + } + break; + case Mips::FMOV_SO32: + case Mips::FMOV_AS32: + case Mips::FMOV_D32: + if ((MI->getOperand(0).isRegister()) && + (MI->getOperand(1).isRegister())) { + const TargetRegisterClass *RC = RI.getRegClass(MI->getOperand(0).getReg()); + unsigned StoreOpc, LoadOpc; + + if (RC == Mips::FGR32RegisterClass) { + LoadOpc = Mips::LWC1; StoreOpc = Mips::SWC1; + } else if (RC == Mips::AFGR32RegisterClass) { + LoadOpc = Mips::LWC1A; StoreOpc = Mips::SWC1A; + } else if (RC == Mips::AFGR64RegisterClass) { + LoadOpc = Mips::LDC1; StoreOpc = Mips::SDC1; + } else + assert(0 && "foldMemoryOperand register unknown"); + + if (Ops[0] == 0) { // COPY -> STORE + unsigned SrcReg = MI->getOperand(1).getReg(); + bool isKill = MI->getOperand(1).isKill(); + NewMI = BuildMI(get(StoreOpc)).addFrameIndex(FI) + .addImm(0).addReg(SrcReg, false, false, isKill); + } else { // COPY -> LOAD + unsigned DstReg = MI->getOperand(0).getReg(); + bool isDead = MI->getOperand(0).isDead(); + NewMI = BuildMI(get(LoadOpc)) + .addReg(DstReg, true, false, false, isDead) + .addImm(0).addFrameIndex(FI); + } + } + break; + } + + return NewMI; +} + //===----------------------------------------------------------------------===// // Branch Analysis //===----------------------------------------------------------------------===// @@ -120,12 +330,12 @@ { switch (BrOpc) { default: return Mips::COND_INVALID; - case Mips::BEQ : return Mips::COND_E; - case Mips::BNE : return Mips::COND_NE; - case Mips::BGTZ : return Mips::COND_GZ; - case Mips::BGEZ : return Mips::COND_GEZ; - case Mips::BLTZ : return Mips::COND_LZ; - case Mips::BLEZ : return Mips::COND_LEZ; + case Mips::BEQ : return Mips::COND_E; + case Mips::BNE : return Mips::COND_NE; + case Mips::BGTZ : return Mips::COND_GZ; + case Mips::BGEZ : return Mips::COND_GEZ; + case Mips::BLTZ : return Mips::COND_LZ; + case Mips::BLEZ : return Mips::COND_LEZ; } } @@ -156,6 +366,22 @@ case Mips::COND_GEZ : return Mips::COND_LZ; case Mips::COND_LZ : return Mips::COND_GEZ; case Mips::COND_LEZ : return Mips::COND_GZ; + case Mips::FCOND_F : return Mips::FCOND_T; + case Mips::FCOND_UN : return Mips::FCOND_OR; + case Mips::FCOND_EQ : return Mips::FCOND_NEQ; + case Mips::FCOND_UEQ: return Mips::FCOND_OGL; + case Mips::FCOND_OLT: return Mips::FCOND_UGE; + case Mips::FCOND_ULT: return Mips::FCOND_OGE; + case Mips::FCOND_OLE: return Mips::FCOND_UGT; + case Mips::FCOND_ULE: return Mips::FCOND_OGT; + case Mips::FCOND_SF: return Mips::FCOND_ST; + case Mips::FCOND_NGLE:return Mips::FCOND_GLE; + case Mips::FCOND_SEQ: return Mips::FCOND_SNE; + case Mips::FCOND_NGL: return Mips::FCOND_GL; + case Mips::FCOND_LT: return Mips::FCOND_NLT; + case Mips::FCOND_NGE: return Mips::FCOND_GE; + case Mips::FCOND_LE: return Mips::FCOND_NLE; + case Mips::FCOND_NGT: return Mips::FCOND_GT; } } @@ -287,124 +513,6 @@ return 2; } -void MipsInstrInfo:: -copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, - unsigned DestReg, unsigned SrcReg, - const TargetRegisterClass *DestRC, - const TargetRegisterClass *SrcRC) const { - if (DestRC != SrcRC) { - cerr << "Not yet supported!"; - abort(); - } - - if (DestRC == Mips::CPURegsRegisterClass) - BuildMI(MBB, I, get(Mips::ADDu), DestReg).addReg(Mips::ZERO) - .addReg(SrcReg); - else - assert (0 && "Can't copy this register"); -} - -void MipsInstrInfo:: -storeRegToStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, - unsigned SrcReg, bool isKill, int FI, - const TargetRegisterClass *RC) const -{ - if (RC == Mips::CPURegsRegisterClass) - BuildMI(MBB, I, get(Mips::SW)).addReg(SrcReg, false, false, isKill) - .addImm(0).addFrameIndex(FI); - else - assert(0 && "Can't store this register to stack slot"); -} - -void MipsInstrInfo::storeRegToAddr(MachineFunction &MF, unsigned SrcReg, - bool isKill, - SmallVectorImpl &Addr, - const TargetRegisterClass *RC, - SmallVectorImpl &NewMIs) const { - if (RC != Mips::CPURegsRegisterClass) - assert(0 && "Can't store this register"); - MachineInstrBuilder MIB = BuildMI(get(Mips::SW)) - .addReg(SrcReg, false, false, isKill); - for (unsigned i = 0, e = Addr.size(); i != e; ++i) { - MachineOperand &MO = Addr[i]; - if (MO.isRegister()) - MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) - MIB.addImm(MO.getImm()); - else - MIB.addFrameIndex(MO.getIndex()); - } - NewMIs.push_back(MIB); - return; -} - -void MipsInstrInfo:: -loadRegFromStackSlot(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, - unsigned DestReg, int FI, - const TargetRegisterClass *RC) const -{ - if (RC == Mips::CPURegsRegisterClass) - BuildMI(MBB, I, get(Mips::LW), DestReg).addImm(0).addFrameIndex(FI); - else - assert(0 && "Can't load this register from stack slot"); -} - -void MipsInstrInfo::loadRegFromAddr(MachineFunction &MF, unsigned DestReg, - SmallVectorImpl &Addr, - const TargetRegisterClass *RC, - SmallVectorImpl &NewMIs) const { - if (RC != Mips::CPURegsRegisterClass) - assert(0 && "Can't load this register"); - MachineInstrBuilder MIB = BuildMI(get(Mips::LW), DestReg); - for (unsigned i = 0, e = Addr.size(); i != e; ++i) { - MachineOperand &MO = Addr[i]; - if (MO.isRegister()) - MIB.addReg(MO.getReg()); - else if (MO.isImmediate()) - MIB.addImm(MO.getImm()); - else - MIB.addFrameIndex(MO.getIndex()); - } - NewMIs.push_back(MIB); - return; -} - -MachineInstr *MipsInstrInfo:: -foldMemoryOperand(MachineFunction &MF, - MachineInstr* MI, - SmallVectorImpl &Ops, int FI) const -{ - if (Ops.size() != 1) return NULL; - - MachineInstr *NewMI = NULL; - - switch (MI->getOpcode()) - { - case Mips::ADDu: - if ((MI->getOperand(0).isRegister()) && - (MI->getOperand(1).isRegister()) && - (MI->getOperand(1).getReg() == Mips::ZERO) && - (MI->getOperand(2).isRegister())) - { - if (Ops[0] == 0) { // COPY -> STORE - unsigned SrcReg = MI->getOperand(2).getReg(); - bool isKill = MI->getOperand(2).isKill(); - NewMI = BuildMI(get(Mips::SW)).addFrameIndex(FI) - .addImm(0).addReg(SrcReg, false, false, isKill); - } else { // COPY -> LOAD - unsigned DstReg = MI->getOperand(0).getReg(); - bool isDead = MI->getOperand(0).isDead(); - NewMI = BuildMI(get(Mips::LW)) - .addReg(DstReg, true, false, false, isDead) - .addImm(0).addFrameIndex(FI); - } - } - break; - } - - return NewMI; -} - unsigned MipsInstrInfo:: RemoveBranch(MachineBasicBlock &MBB) const { @@ -456,5 +564,3 @@ Cond[0].setImm(GetOppositeBranchCondition((Mips::CondCode)Cond[0].getImm())); return false; } - - Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.h?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.h (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.h Sat Jul 5 14:05:21 2008 @@ -24,6 +24,45 @@ // Mips Condition Codes enum CondCode { + // To be used with float branch True + FCOND_F, + FCOND_UN, + FCOND_EQ, + FCOND_UEQ, + FCOND_OLT, + FCOND_ULT, + FCOND_OLE, + FCOND_ULE, + FCOND_SF, + FCOND_NGLE, + FCOND_SEQ, + FCOND_NGL, + FCOND_LT, + FCOND_NGE, + FCOND_LE, + FCOND_NGT, + + // To be used with float branch False + // This conditions have the same mnemonic as the + // above ones, but are used with a branch False; + FCOND_T, + FCOND_OR, + FCOND_NEQ, + FCOND_OGL, + FCOND_UGE, + FCOND_OGE, + FCOND_UGT, + FCOND_OGT, + FCOND_ST, + FCOND_GLE, + FCOND_SNE, + FCOND_GL, + FCOND_NLT, + FCOND_GE, + FCOND_NLE, + FCOND_GT, + + // Only integer conditions COND_E, COND_GZ, COND_GEZ, @@ -40,6 +79,45 @@ /// e.g. turning COND_E to COND_NE. CondCode GetOppositeBranchCondition(Mips::CondCode CC); + /// MipsCCToString - Map each FP condition code to its string + inline static const char *MipsFCCToString(Mips::CondCode CC) + { + switch (CC) { + default: assert(0 && "Unknown condition code"); + case FCOND_F: + case FCOND_T: return "f"; + case FCOND_UN: + case FCOND_OR: return "un"; + case FCOND_EQ: + case FCOND_NEQ: return "eq"; + case FCOND_UEQ: + case FCOND_OGL: return "ueq"; + case FCOND_OLT: + case FCOND_UGE: return "olt"; + case FCOND_ULT: + case FCOND_OGE: return "ult"; + case FCOND_OLE: + case FCOND_UGT: return "ole"; + case FCOND_ULE: + case FCOND_OGT: return "ule"; + case FCOND_SF: + case FCOND_ST: return "sf"; + case FCOND_NGLE: + case FCOND_GLE: return "ngle"; + case FCOND_SEQ: + case FCOND_SNE: return "seq"; + case FCOND_NGL: + case FCOND_GL: return "ngl"; + case FCOND_LT: + case FCOND_NLT: return "lt"; + case FCOND_NGE: + case FCOND_GE: return "ge"; + case FCOND_LE: + case FCOND_NLE: return "nle"; + case FCOND_NGT: + case FCOND_GT: return "gt"; + } + } } class MipsInstrInfo : public TargetInstrInfoImpl { Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Sat Jul 5 14:05:21 2008 @@ -17,10 +17,16 @@ // Mips profiles and nodes //===----------------------------------------------------------------------===// +def SDT_MipsRet : SDTypeProfile<0, 1, [SDTCisInt<0>]>; +def SDT_MipsJmpLink : SDTypeProfile<0, 1, [SDTCisVT<0, iPTR>]>; +def SDT_MipsSelectCC : SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>, + SDTCisSameAs<1, 2>, SDTCisInt<3>]>; +def SDT_MipsCallSeqStart : SDCallSeqStart<[SDTCisVT<0, i32>]>; +def SDT_MipsCallSeqEnd : SDCallSeqEnd<[SDTCisVT<0, i32>, SDTCisVT<1, i32>]>; + // Call -def SDT_MipsJmpLink : SDTypeProfile<0, 1, [SDTCisVT<0, iPTR>]>; -def MipsJmpLink : SDNode<"MipsISD::JmpLink",SDT_MipsJmpLink, [SDNPHasChain, - SDNPOutFlag]>; +def MipsJmpLink : SDNode<"MipsISD::JmpLink",SDT_MipsJmpLink, [SDNPHasChain, + SDNPOutFlag]>; // Hi and Lo nodes are used to handle global addresses. Used on // MipsISelLowering to lower stuff like GlobalAddress, ExternalSymbol @@ -29,29 +35,22 @@ def MipsLo : SDNode<"MipsISD::Lo", SDTIntUnaryOp>; // Return -def SDT_MipsRet : SDTypeProfile<0, 1, [SDTCisInt<0>]>; -def MipsRet : SDNode<"MipsISD::Ret", SDT_MipsRet, [SDNPHasChain, - SDNPOptInFlag]>; +def MipsRet : SDNode<"MipsISD::Ret", SDT_MipsRet, [SDNPHasChain, + SDNPOptInFlag]>; // These are target-independent nodes, but have target-specific formats. -def SDT_MipsCallSeqStart : SDCallSeqStart<[SDTCisVT<0, i32>]>; -def SDT_MipsCallSeqEnd : SDCallSeqEnd<[SDTCisVT<0, i32>, - SDTCisVT<1, i32>]>; +def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_MipsCallSeqStart, + [SDNPHasChain, SDNPOutFlag]>; +def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_MipsCallSeqEnd, + [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; -def callseq_start : SDNode<"ISD::CALLSEQ_START", SDT_MipsCallSeqStart, - [SDNPHasChain, SDNPOutFlag]>; -def callseq_end : SDNode<"ISD::CALLSEQ_END", SDT_MipsCallSeqEnd, - [SDNPHasChain, SDNPOptInFlag, SDNPOutFlag]>; - -// Select CC -def SDT_MipsSelectCC : SDTypeProfile<1, 3, [SDTCisSameAs<0, 1>, - SDTCisSameAs<1, 2>, SDTCisInt<3>]>; -def MipsSelectCC : SDNode<"MipsISD::SelectCC", SDT_MipsSelectCC>; +// Select Condition Code +def MipsSelectCC : SDNode<"MipsISD::SelectCC", SDT_MipsSelectCC>; //===----------------------------------------------------------------------===// // Mips Instruction Predicate Definitions. //===----------------------------------------------------------------------===// -def IsStatic : Predicate<"TM.getRelocationModel() == Reloc::Static">; +def IsAllegrex : Predicate<"Subtarget.isAllegrex()">; //===----------------------------------------------------------------------===// // Mips Operand, Complex Patterns and Transformations Definitions. @@ -63,7 +62,6 @@ def uimm16 : Operand; def simm16 : Operand; def shamt : Operand; -def addrlabel : Operand; // Address operand def mem : Operand { @@ -345,6 +343,12 @@ instr_asm, [(set CPURegs:$dst, addr:$addr)], IIAlu>; +class SignExtInReg func, string instr_asm, ValueType vt>: + FR< 0x3f, func, (outs CPURegs:$dst), (ins CPURegs:$src), + !strconcat(instr_asm, " $dst, $src"), + [(set CPURegs:$dst, (sext_inreg CPURegs:$src, vt))], NoItinerary>; + + //===----------------------------------------------------------------------===// // Pseudo instructions //===----------------------------------------------------------------------===// @@ -352,11 +356,11 @@ // As stack alignment is always done with addiu, we need a 16-bit immediate let Defs = [SP], Uses = [SP] in { def ADJCALLSTACKDOWN : MipsPseudo<(outs), (ins uimm16:$amt), - "!ADJCALLSTACKDOWN $amt", - [(callseq_start imm:$amt)]>; + "!ADJCALLSTACKDOWN $amt", + [(callseq_start imm:$amt)]>; def ADJCALLSTACKUP : MipsPseudo<(outs), (ins uimm16:$amt1, uimm16:$amt2), - "!ADJCALLSTACKUP $amt1", - [(callseq_end imm:$amt1, imm:$amt2)]>; + "!ADJCALLSTACKUP $amt1", + [(callseq_end imm:$amt1, imm:$amt2)]>; } // When handling PIC code the assembler needs .cpload and .cprestore @@ -364,10 +368,10 @@ // are used, we have the same behavior, but get also a bunch of warnings // from the assembler. def CPLOAD : MipsPseudo<(outs), (ins CPURegs:$reg), - ".set noreorder\n\t.cpload $reg\n\t.set reorder\n", - []>; + ".set noreorder\n\t.cpload $reg\n\t.set reorder\n", + []>; def CPRESTORE : MipsPseudo<(outs), (ins uimm16:$loc), - ".cprestore $loc\n", []>; + ".cprestore $loc\n", []>; // The supported Mips ISAs dont have any instruction close to the SELECT_CC // operation. The solution is to create a Mips pseudo SELECT_CC instruction @@ -474,19 +478,6 @@ def MTHI : MoveFromTo<0x11, "mthi">; def MTLO : MoveFromTo<0x13, "mtlo">; -// Count Leading -// CLO/CLZ are part of the newer MIPS32(tm) instruction -// set and not older Mips I keep this for future use -// though. -//def CLO : CountLeading<0x21, "clo">; -//def CLZ : CountLeading<0x20, "clz">; - -// MADD*/MSUB* are not part of MipsI either. -//def MADD : MArithR<0x00, "madd">; -//def MADDU : MArithR<0x01, "maddu">; -//def MSUB : MArithR<0x04, "msub">; -//def MSUBU : MArithR<0x05, "msubu">; - // No operation let addr=0 in def NOP : FJ<0, (outs), (ins), "nop", [], IIAlu>; @@ -506,6 +497,27 @@ // can be matched. It's similar to Sparc LEA_ADDRi def LEA_ADDiu : EffectiveAddress<"addiu $dst, ${addr:stackloc}">; +// Count Leading +// CLO/CLZ are part of the newer MIPS32(tm) instruction +// set and not older Mips I keep this for future use +// though. +//def CLO : CountLeading<0x21, "clo">; +//def CLZ : CountLeading<0x20, "clz">; + +// MADD*/MSUB* are not part of MipsI either. +//def MADD : MArithR<0x00, "madd">; +//def MADDU : MArithR<0x01, "maddu">; +//def MSUB : MArithR<0x04, "msub">; +//def MSUBU : MArithR<0x05, "msubu">; + +let Predicates = [IsAllegrex] in { + let shamt = 0x10, rs = 0 in + def SEB : SignExtInReg<0x21, "seb", i8>; + + let shamt = 0x18, rs = 0 in + def SEH : SignExtInReg<0x20, "seh", i16>; +} + //===----------------------------------------------------------------------===// // Arbitrary patterns that map to one or more instructions //===----------------------------------------------------------------------===// @@ -546,7 +558,7 @@ def : Pat<(add CPURegs:$hi, (MipsLo tjumptable:$lo)), (ADDiu CPURegs:$hi, tjumptable:$lo)>; -// Mips does not have not, so we increase the operation +// Mips does not have "not", so we expand our way def : Pat<(not CPURegs:$in), (NOR CPURegs:$in, ZERO)>; @@ -558,10 +570,7 @@ // peepholes def : Pat<(store (i32 0), addr:$dst), (SW ZERO, addr:$dst)>; -/// -/// brcond patterns -/// - +// brcond patterns // direct match equal/notequal zero branches def : Pat<(brcond (setne CPURegs:$lhs, 0), bb:$dst), (BNE CPURegs:$lhs, ZERO, bb:$dst)>; @@ -601,12 +610,8 @@ def : Pat<(brcond CPURegs:$cond, bb:$dst), (BNE CPURegs:$cond, ZERO, bb:$dst)>; -/// /// setcc patterns, only matched when there /// is no brcond following a setcc operation -/// - -// setcc 2 register operands def : Pat<(setle CPURegs:$lhs, CPURegs:$rhs), (XORi (SLT CPURegs:$rhs, CPURegs:$lhs), 1)>; def : Pat<(setule CPURegs:$lhs, CPURegs:$rhs), @@ -630,8 +635,14 @@ (XORi (OR (SLT CPURegs:$lhs, CPURegs:$rhs), (SLT CPURegs:$rhs, CPURegs:$lhs)), 1)>; -// setcc reg/imm operands def : Pat<(setge CPURegs:$lhs, immSExt16:$rhs), (XORi (SLTi CPURegs:$lhs, immSExt16:$rhs), 1)>; def : Pat<(setuge CPURegs:$lhs, immZExt16:$rhs), (XORi (SLTiu CPURegs:$lhs, immZExt16:$rhs), 1)>; + +//===----------------------------------------------------------------------===// +// Floating Point Support +//===----------------------------------------------------------------------===// + +include "MipsInstrFPU.td" + Modified: llvm/trunk/lib/Target/Mips/MipsMachineFunction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsMachineFunction.h?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsMachineFunction.h (original) +++ llvm/trunk/lib/Target/Mips/MipsMachineFunction.h Sat Jul 5 14:05:21 2008 @@ -25,12 +25,12 @@ class MipsFunctionInfo : public MachineFunctionInfo { private: - /// Holds for each function where on the stack - /// the Frame Pointer must be saved + /// Holds for each function where on the stack the Frame Pointer must be + /// saved. int FPStackOffset; - /// Holds for each function where on the stack - /// the Return Address must be saved + /// Holds for each function where on the stack the Return Address must be + /// saved. int RAStackOffset; /// MipsFIHolder - Holds a FrameIndex and it's Stack Pointer Offset @@ -43,31 +43,34 @@ : FI(FrameIndex), SPOffset(StackPointerOffset) {} }; - /// When PIC is used the GP must be saved on the stack - /// on the function prologue and must be reloaded from this - /// stack location after every call. A reference to its stack - /// location and frame index must be kept to be used on - /// emitPrologue and processFunctionBeforeFrameFinalized. + /// When PIC is used the GP must be saved on the stack on the function + /// prologue and must be reloaded from this stack location after every + /// call. A reference to its stack location and frame index must be kept + /// to be used on emitPrologue and processFunctionBeforeFrameFinalized. MipsFIHolder GPHolder; - // On LowerFORMAL_ARGUMENTS the stack size is unknown, - // so the Stack Pointer Offset calculation of "not in - // register arguments" must be postponed to emitPrologue. + // On LowerFORMAL_ARGUMENTS the stack size is unknown, so the Stack + // Pointer Offset calculation of "not in register arguments" must be + // postponed to emitPrologue. SmallVector FnLoadArgs; bool HasLoadArgs; - // When VarArgs, we must write registers back to caller - // stack, preserving on register arguments. Since the - // stack size is unknown on LowerFORMAL_ARGUMENTS, - // the Stack Pointer Offset calculation must be + // When VarArgs, we must write registers back to caller stack, preserving + // on register arguments. Since the stack size is unknown on + // LowerFORMAL_ARGUMENTS, the Stack Pointer Offset calculation must be // postponed to emitPrologue. SmallVector FnStoreVarArgs; bool HasStoreVarArgs; + /// SRetReturnReg - Some subtargets require that sret lowering includes + /// returning the value of the returned struct in a register. This field + /// holds the virtual register into which the sret argument is passed. + unsigned SRetReturnReg; + public: MipsFunctionInfo(MachineFunction& MF) - : FPStackOffset(0), RAStackOffset(0), GPHolder(-1,-1), - HasLoadArgs(false), HasStoreVarArgs(false) + : FPStackOffset(0), RAStackOffset(0), GPHolder(-1,-1), HasLoadArgs(false), + HasStoreVarArgs(false), SRetReturnReg(0) {} int getFPStackOffset() const { return FPStackOffset; } @@ -109,6 +112,8 @@ MFI->setObjectOffset( FnStoreVarArgs[i].FI, FnStoreVarArgs[i].SPOffset ); } + unsigned getSRetReturnReg() const { return SRetReturnReg; } + void setSRetReturnReg(unsigned Reg) { SRetReturnReg = Reg; } }; } // end of namespace llvm Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.cpp Sat Jul 5 14:05:21 2008 @@ -32,14 +32,12 @@ #include "llvm/Support/Debug.h" #include "llvm/ADT/BitVector.h" #include "llvm/ADT/STLExtras.h" -//#include "MipsSubtarget.h" using namespace llvm; -// TODO: add subtarget support MipsRegisterInfo::MipsRegisterInfo(const TargetInstrInfo &tii) : MipsGenRegisterInfo(Mips::ADJCALLSTACKDOWN, Mips::ADJCALLSTACKUP), - TII(tii) {} + TII(tii) {} /// getRegisterNumbering - Given the enum value for some register, e.g. /// Mips::RA, return the number that it corresponds to (e.g. 31). @@ -47,38 +45,38 @@ getRegisterNumbering(unsigned RegEnum) { switch (RegEnum) { - case Mips::ZERO : return 0; - case Mips::AT : return 1; - case Mips::V0 : return 2; - case Mips::V1 : return 3; - case Mips::A0 : return 4; - case Mips::A1 : return 5; - case Mips::A2 : return 6; - case Mips::A3 : return 7; - case Mips::T0 : return 8; - case Mips::T1 : return 9; - case Mips::T2 : return 10; - case Mips::T3 : return 11; - case Mips::T4 : return 12; - case Mips::T5 : return 13; - case Mips::T6 : return 14; - case Mips::T7 : return 15; - case Mips::T8 : return 16; - case Mips::T9 : return 17; - case Mips::S0 : return 18; - case Mips::S1 : return 19; - case Mips::S2 : return 20; - case Mips::S3 : return 21; - case Mips::S4 : return 22; - case Mips::S5 : return 23; - case Mips::S6 : return 24; - case Mips::S7 : return 25; - case Mips::K0 : return 26; - case Mips::K1 : return 27; - case Mips::GP : return 28; - case Mips::SP : return 29; - case Mips::FP : return 30; - case Mips::RA : return 31; + case Mips::ZERO : case Mips::F0 : return 0; + case Mips::AT : case Mips::F1 : return 1; + case Mips::V0 : case Mips::F2 : return 2; + case Mips::V1 : case Mips::F3 : return 3; + case Mips::A0 : case Mips::F4 : return 4; + case Mips::A1 : case Mips::F5 : return 5; + case Mips::A2 : case Mips::F6 : return 6; + case Mips::A3 : case Mips::F7 : return 7; + case Mips::T0 : case Mips::F8 : return 8; + case Mips::T1 : case Mips::F9 : return 9; + case Mips::T2 : case Mips::F10: return 10; + case Mips::T3 : case Mips::F11: return 11; + case Mips::T4 : case Mips::F12: return 12; + case Mips::T5 : case Mips::F13: return 13; + case Mips::T6 : case Mips::F14: return 14; + case Mips::T7 : case Mips::F15: return 15; + case Mips::T8 : case Mips::F16: return 16; + case Mips::T9 : case Mips::F17: return 17; + case Mips::S0 : case Mips::F18: return 18; + case Mips::S1 : case Mips::F19: return 19; + case Mips::S2 : case Mips::F20: return 20; + case Mips::S3 : case Mips::F21: return 21; + case Mips::S4 : case Mips::F22: return 22; + case Mips::S5 : case Mips::F23: return 23; + case Mips::S6 : case Mips::F24: return 24; + case Mips::S7 : case Mips::F25: return 25; + case Mips::K0 : case Mips::F26: return 26; + case Mips::K1 : case Mips::F27: return 27; + case Mips::GP : case Mips::F28: return 28; + case Mips::SP : case Mips::F29: return 29; + case Mips::FP : case Mips::F30: return 30; + case Mips::RA : case Mips::F31: return 31; default: assert(0 && "Unknown register number!"); } return 0; // Not reached @@ -94,11 +92,12 @@ const unsigned* MipsRegisterInfo:: getCalleeSavedRegs(const MachineFunction *MF) const { - // Mips calle-save register range is $16-$26(s0-s7) + // Mips callee-save register range is $16-$23(s0-s7) static const unsigned CalleeSavedRegs[] = { Mips::S0, Mips::S1, Mips::S2, Mips::S3, Mips::S4, Mips::S5, Mips::S6, Mips::S7, 0 }; + return CalleeSavedRegs; } @@ -271,6 +270,8 @@ int FPOffset, RAOffset; // Allocate space for saved RA and FP when needed + // FIXME: within 64-bit registers, change hardcoded + // sizes for RA and FP offsets. if ((hasFP(MF)) && (MFI->hasCalls())) { FPOffset = NumBytes; RAOffset = (NumBytes+4); @@ -283,8 +284,7 @@ FPOffset = NumBytes; RAOffset = 0; NumBytes += 4; - } else { - // No calls and no fp. + } else { // No calls and no fp. RAOffset = FPOffset = 0; } Modified: llvm/trunk/lib/Target/Mips/MipsRegisterInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsRegisterInfo.td?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsRegisterInfo.td (original) +++ llvm/trunk/lib/Target/Mips/MipsRegisterInfo.td Sat Jul 5 14:05:21 2008 @@ -17,50 +17,123 @@ let Namespace = "Mips"; } -//===----------------------------------------------------------------------===// -// General Purpose Registers -//===----------------------------------------------------------------------===// - // Mips CPU Registers class MipsGPRReg num, string n> : MipsReg { let Num = num; } -// CPU GPR Registers -def ZERO : MipsGPRReg< 0, "ZERO">, DwarfRegNum<[0]>; -def AT : MipsGPRReg< 1, "AT">, DwarfRegNum<[1]>; -def V0 : MipsGPRReg< 2, "2">, DwarfRegNum<[2]>; -def V1 : MipsGPRReg< 3, "3">, DwarfRegNum<[3]>; -def A0 : MipsGPRReg< 4, "4">, DwarfRegNum<[5]>; -def A1 : MipsGPRReg< 5, "5">, DwarfRegNum<[5]>; -def A2 : MipsGPRReg< 6, "6">, DwarfRegNum<[6]>; -def A3 : MipsGPRReg< 7, "7">, DwarfRegNum<[7]>; -def T0 : MipsGPRReg< 8, "8">, DwarfRegNum<[8]>; -def T1 : MipsGPRReg< 9, "9">, DwarfRegNum<[9]>; -def T2 : MipsGPRReg< 10, "10">, DwarfRegNum<[10]>; -def T3 : MipsGPRReg< 11, "11">, DwarfRegNum<[11]>; -def T4 : MipsGPRReg< 12, "12">, DwarfRegNum<[12]>; -def T5 : MipsGPRReg< 13, "13">, DwarfRegNum<[13]>; -def T6 : MipsGPRReg< 14, "14">, DwarfRegNum<[14]>; -def T7 : MipsGPRReg< 15, "15">, DwarfRegNum<[15]>; -def S0 : MipsGPRReg< 16, "16">, DwarfRegNum<[16]>; -def S1 : MipsGPRReg< 17, "17">, DwarfRegNum<[17]>; -def S2 : MipsGPRReg< 18, "18">, DwarfRegNum<[18]>; -def S3 : MipsGPRReg< 19, "19">, DwarfRegNum<[19]>; -def S4 : MipsGPRReg< 20, "20">, DwarfRegNum<[20]>; -def S5 : MipsGPRReg< 21, "21">, DwarfRegNum<[21]>; -def S6 : MipsGPRReg< 22, "22">, DwarfRegNum<[22]>; -def S7 : MipsGPRReg< 23, "23">, DwarfRegNum<[23]>; -def T8 : MipsGPRReg< 24, "24">, DwarfRegNum<[24]>; -def T9 : MipsGPRReg< 25, "25">, DwarfRegNum<[25]>; -def K0 : MipsGPRReg< 26, "26">, DwarfRegNum<[26]>; -def K1 : MipsGPRReg< 27, "27">, DwarfRegNum<[27]>; -def GP : MipsGPRReg< 28, "GP">, DwarfRegNum<[28]>; -def SP : MipsGPRReg< 29, "SP">, DwarfRegNum<[29]>; -def FP : MipsGPRReg< 30, "FP">, DwarfRegNum<[30]>; -def RA : MipsGPRReg< 31, "RA">, DwarfRegNum<[31]>; +// Mips 32-bit FPU Registers +class FPR num, string n> : MipsReg { + let Num = num; +} + +// Mips 64-bit (aliased) FPU Registers +class AFPR num, string n, list aliases> : MipsReg { + let Num = num; + let Aliases = aliases; +} + +//===----------------------------------------------------------------------===// +// Registers +//===----------------------------------------------------------------------===// + +let Namespace = "Mips" in { + + // General Purpose Registers + def ZERO : MipsGPRReg< 0, "ZERO">, DwarfRegNum<[0]>; + def AT : MipsGPRReg< 1, "AT">, DwarfRegNum<[1]>; + def V0 : MipsGPRReg< 2, "2">, DwarfRegNum<[2]>; + def V1 : MipsGPRReg< 3, "3">, DwarfRegNum<[3]>; + def A0 : MipsGPRReg< 4, "4">, DwarfRegNum<[5]>; + def A1 : MipsGPRReg< 5, "5">, DwarfRegNum<[5]>; + def A2 : MipsGPRReg< 6, "6">, DwarfRegNum<[6]>; + def A3 : MipsGPRReg< 7, "7">, DwarfRegNum<[7]>; + def T0 : MipsGPRReg< 8, "8">, DwarfRegNum<[8]>; + def T1 : MipsGPRReg< 9, "9">, DwarfRegNum<[9]>; + def T2 : MipsGPRReg< 10, "10">, DwarfRegNum<[10]>; + def T3 : MipsGPRReg< 11, "11">, DwarfRegNum<[11]>; + def T4 : MipsGPRReg< 12, "12">, DwarfRegNum<[12]>; + def T5 : MipsGPRReg< 13, "13">, DwarfRegNum<[13]>; + def T6 : MipsGPRReg< 14, "14">, DwarfRegNum<[14]>; + def T7 : MipsGPRReg< 15, "15">, DwarfRegNum<[15]>; + def S0 : MipsGPRReg< 16, "16">, DwarfRegNum<[16]>; + def S1 : MipsGPRReg< 17, "17">, DwarfRegNum<[17]>; + def S2 : MipsGPRReg< 18, "18">, DwarfRegNum<[18]>; + def S3 : MipsGPRReg< 19, "19">, DwarfRegNum<[19]>; + def S4 : MipsGPRReg< 20, "20">, DwarfRegNum<[20]>; + def S5 : MipsGPRReg< 21, "21">, DwarfRegNum<[21]>; + def S6 : MipsGPRReg< 22, "22">, DwarfRegNum<[22]>; + def S7 : MipsGPRReg< 23, "23">, DwarfRegNum<[23]>; + def T8 : MipsGPRReg< 24, "24">, DwarfRegNum<[24]>; + def T9 : MipsGPRReg< 25, "25">, DwarfRegNum<[25]>; + def K0 : MipsGPRReg< 26, "26">, DwarfRegNum<[26]>; + def K1 : MipsGPRReg< 27, "27">, DwarfRegNum<[27]>; + def GP : MipsGPRReg< 28, "GP">, DwarfRegNum<[28]>; + def SP : MipsGPRReg< 29, "SP">, DwarfRegNum<[29]>; + def FP : MipsGPRReg< 30, "FP">, DwarfRegNum<[30]>; + def RA : MipsGPRReg< 31, "RA">, DwarfRegNum<[31]>; + + /// Mips Single point precision FPU Registers + def F0 : FPR< 0, "F0">, DwarfRegNum<[32]>; + def F1 : FPR< 1, "F1">, DwarfRegNum<[33]>; + def F2 : FPR< 2, "F2">, DwarfRegNum<[34]>; + def F3 : FPR< 3, "F3">, DwarfRegNum<[35]>; + def F4 : FPR< 4, "F4">, DwarfRegNum<[36]>; + def F5 : FPR< 5, "F5">, DwarfRegNum<[37]>; + def F6 : FPR< 6, "F6">, DwarfRegNum<[38]>; + def F7 : FPR< 7, "F7">, DwarfRegNum<[39]>; + def F8 : FPR< 8, "F8">, DwarfRegNum<[40]>; + def F9 : FPR< 9, "F9">, DwarfRegNum<[41]>; + def F10 : FPR<10, "F10">, DwarfRegNum<[42]>; + def F11 : FPR<11, "F11">, DwarfRegNum<[43]>; + def F12 : FPR<12, "F12">, DwarfRegNum<[44]>; + def F13 : FPR<13, "F13">, DwarfRegNum<[45]>; + def F14 : FPR<14, "F14">, DwarfRegNum<[46]>; + def F15 : FPR<15, "F15">, DwarfRegNum<[47]>; + def F16 : FPR<16, "F16">, DwarfRegNum<[48]>; + def F17 : FPR<17, "F17">, DwarfRegNum<[49]>; + def F18 : FPR<18, "F18">, DwarfRegNum<[50]>; + def F19 : FPR<19, "F19">, DwarfRegNum<[51]>; + def F20 : FPR<20, "F20">, DwarfRegNum<[52]>; + def F21 : FPR<21, "F21">, DwarfRegNum<[53]>; + def F22 : FPR<22, "F22">, DwarfRegNum<[54]>; + def F23 : FPR<23, "F23">, DwarfRegNum<[55]>; + def F24 : FPR<24, "F24">, DwarfRegNum<[56]>; + def F25 : FPR<25, "F25">, DwarfRegNum<[57]>; + def F26 : FPR<26, "F26">, DwarfRegNum<[58]>; + def F27 : FPR<27, "F27">, DwarfRegNum<[59]>; + def F28 : FPR<28, "F28">, DwarfRegNum<[60]>; + def F29 : FPR<29, "F29">, DwarfRegNum<[61]>; + def F30 : FPR<30, "F30">, DwarfRegNum<[62]>; + def F31 : FPR<31, "F31">, DwarfRegNum<[63]>; + + /// Mips Double point precision FPU Registers (aliased + /// with the single precision to hold 64 bit values) + def D0 : AFPR< 0, "F0", [F0, F1]>, DwarfRegNum<[32]>; + def D1 : AFPR< 2, "F2", [F2, F3]>, DwarfRegNum<[34]>; + def D2 : AFPR< 4, "F4", [F4, F5]>, DwarfRegNum<[36]>; + def D3 : AFPR< 6, "F6", [F6, F7]>, DwarfRegNum<[38]>; + def D4 : AFPR< 8, "F8", [F8, F9]>, DwarfRegNum<[40]>; + def D5 : AFPR<10, "F10", [F10, F11]>, DwarfRegNum<[42]>; + def D6 : AFPR<12, "F12", [F12, F13]>, DwarfRegNum<[44]>; + def D7 : AFPR<14, "F14", [F14, F15]>, DwarfRegNum<[46]>; + def D8 : AFPR<16, "F16", [F16, F17]>, DwarfRegNum<[48]>; + def D9 : AFPR<18, "F18", [F18, F19]>, DwarfRegNum<[50]>; + def D10 : AFPR<20, "F20", [F20, F21]>, DwarfRegNum<[52]>; + def D11 : AFPR<22, "F22", [F22, F23]>, DwarfRegNum<[54]>; + def D12 : AFPR<24, "F24", [F24, F25]>, DwarfRegNum<[56]>; + def D13 : AFPR<26, "F26", [F26, F27]>, DwarfRegNum<[58]>; + def D14 : AFPR<28, "F28", [F28, F29]>, DwarfRegNum<[60]>; + def D15 : AFPR<30, "F30", [F30, F31]>, DwarfRegNum<[62]>; + + // Status flags register + def FCR31 : Register<"FCR31">; +} + +//===----------------------------------------------------------------------===// +// Register Classes +//===----------------------------------------------------------------------===// -// CPU Registers Class def CPURegs : RegisterClass<"Mips", [i32], 32, // Return Values and Arguments [V0, V1, A0, A1, A2, A3, @@ -83,51 +156,14 @@ }]; } -//===----------------------------------------------------------------------===// -// Floating Point Unit Registers (Single Precision) -//===----------------------------------------------------------------------===// - -/// Mips Single point precision FPU Register Format -class MipsFPUReg num, string n> : MipsReg { - let Num = num; -} - -/// Mips Single point precision FPU Registers -def F0 : MipsFPUReg< 0, "F0">, DwarfRegNum<[32]>; -def F1 : MipsFPUReg< 1, "F1">, DwarfRegNum<[33]>; -def F2 : MipsFPUReg< 2, "F2">, DwarfRegNum<[34]>; -def F3 : MipsFPUReg< 3, "F3">, DwarfRegNum<[35]>; -def F4 : MipsFPUReg< 4, "F4">, DwarfRegNum<[36]>; -def F5 : MipsFPUReg< 5, "F5">, DwarfRegNum<[37]>; -def F6 : MipsFPUReg< 6, "F6">, DwarfRegNum<[38]>; -def F7 : MipsFPUReg< 7, "F7">, DwarfRegNum<[39]>; -def F8 : MipsFPUReg< 8, "F8">, DwarfRegNum<[40]>; -def F9 : MipsFPUReg< 9, "F9">, DwarfRegNum<[41]>; -def F10 : MipsFPUReg<10, "F10">, DwarfRegNum<[42]>; -def F11 : MipsFPUReg<11, "F11">, DwarfRegNum<[43]>; -def F12 : MipsFPUReg<12, "F12">, DwarfRegNum<[44]>; -def F13 : MipsFPUReg<13, "F13">, DwarfRegNum<[45]>; -def F14 : MipsFPUReg<14, "F14">, DwarfRegNum<[46]>; -def F15 : MipsFPUReg<15, "F15">, DwarfRegNum<[47]>; -def F16 : MipsFPUReg<16, "F16">, DwarfRegNum<[48]>; -def F17 : MipsFPUReg<17, "F17">, DwarfRegNum<[49]>; -def F18 : MipsFPUReg<18, "F18">, DwarfRegNum<[50]>; -def F19 : MipsFPUReg<19, "F19">, DwarfRegNum<[51]>; -def F20 : MipsFPUReg<20, "F20">, DwarfRegNum<[52]>; -def F21 : MipsFPUReg<21, "F21">, DwarfRegNum<[53]>; -def F22 : MipsFPUReg<22, "F22">, DwarfRegNum<[54]>; -def F23 : MipsFPUReg<23, "F23">, DwarfRegNum<[55]>; -def F24 : MipsFPUReg<24, "F24">, DwarfRegNum<[56]>; -def F25 : MipsFPUReg<25, "F25">, DwarfRegNum<[57]>; -def F26 : MipsFPUReg<26, "F26">, DwarfRegNum<[58]>; -def F27 : MipsFPUReg<27, "F27">, DwarfRegNum<[59]>; -def F28 : MipsFPUReg<28, "F28">, DwarfRegNum<[60]>; -def F29 : MipsFPUReg<29, "F29">, DwarfRegNum<[61]>; -def F30 : MipsFPUReg<30, "F30">, DwarfRegNum<[62]>; -def F31 : MipsFPUReg<31, "F31">, DwarfRegNum<[63]>; - -/// FPU Single Point Precision Registers Class -def FPUDRegs : RegisterClass<"Mips", [f32], 32, +// * 64bit fp: +// - FGR64 = 32 64-bit registers (default mode) +// - AFGR32/AFGR64 = 16 even 32-bit registers (32-bit compatible mode) for +// single and double access. +// * 32bit fp: +// - AFGR32/AFGR64 = 16 even 32-bit registers - single and double +// - FGR32 = 32 32-bit registers (within single-only mode) +def FGR32 : RegisterClass<"Mips", [f32], 32, // Return Values and Arguments [F0, F1, F2, F3, F12, F13, F14, F15, // Not preserved across procedure calls @@ -141,45 +177,37 @@ iterator allocation_order_end(const MachineFunction &MF) const; }]; let MethodBodies = [{ - FPUDRegsClass::iterator - FPUDRegsClass::allocation_order_end(const MachineFunction &MF) const { + FGR32Class::iterator + FGR32Class::allocation_order_end(const MachineFunction &MF) const { // The last register on the list above is reserved return end()-1; } }]; } -//===----------------------------------------------------------------------===// -// Floating Point Unit Registers (Double Precision) -//===----------------------------------------------------------------------===// - -/// Mips Double point precision FPU Register Format -class MipsFPUDReg num, string n, list aliases> : MipsReg { - let Num = num; - let Aliases = aliases; +def AFGR32 : RegisterClass<"Mips", [f32], 32, + // Return Values and Arguments + [F0, F2, F12, F14, + // Not preserved across procedure calls + F4, F6, F8, F10, F16, F18, + // Callee save + F20, F22, F24, F26, F28, F30, + // Reserved + F31]> +{ + let MethodProtos = [{ + iterator allocation_order_end(const MachineFunction &MF) const; + }]; + let MethodBodies = [{ + AFGR32Class::iterator + AFGR32Class::allocation_order_end(const MachineFunction &MF) const { + // The last register on the list above is reserved + return end()-1; + } + }]; } -/// Mips Double point precision FPU Registers (aliased -/// with the single precision to hold 64 bit values) -def D0 : MipsFPUDReg< 0, "F0", [F0, F1]>, DwarfRegNum<[32]>; -def D1 : MipsFPUDReg< 2, "F2", [F2, F3]>, DwarfRegNum<[34]>; -def D2 : MipsFPUDReg< 4, "F4", [F4, F5]>, DwarfRegNum<[36]>; -def D3 : MipsFPUDReg< 6, "F6", [F6, F7]>, DwarfRegNum<[38]>; -def D4 : MipsFPUDReg< 8, "F8", [F8, F9]>, DwarfRegNum<[40]>; -def D5 : MipsFPUDReg<10, "F10", [F10, F11]>, DwarfRegNum<[42]>; -def D6 : MipsFPUDReg<12, "F12", [F12, F13]>, DwarfRegNum<[44]>; -def D7 : MipsFPUDReg<14, "F14", [F14, F15]>, DwarfRegNum<[46]>; -def D8 : MipsFPUDReg<16, "F16", [F16, F17]>, DwarfRegNum<[48]>; -def D9 : MipsFPUDReg<18, "F18", [F18, F19]>, DwarfRegNum<[50]>; -def D10 : MipsFPUDReg<20, "F20", [F20, F21]>, DwarfRegNum<[52]>; -def D11 : MipsFPUDReg<22, "F22", [F22, F23]>, DwarfRegNum<[54]>; -def D12 : MipsFPUDReg<24, "F24", [F24, F25]>, DwarfRegNum<[56]>; -def D13 : MipsFPUDReg<26, "F26", [F26, F27]>, DwarfRegNum<[58]>; -def D14 : MipsFPUDReg<28, "F28", [F28, F29]>, DwarfRegNum<[60]>; -def D15 : MipsFPUDReg<30, "F30", [F30, F31]>, DwarfRegNum<[62]>; - -/// FPU Single Point Precision Registers Class -def FPURegs : RegisterClass<"Mips", [f32], 32, +def AFGR64 : RegisterClass<"Mips", [f64], 64, // Return Values and Arguments [D0, D1, D6, D7, // Not preserved across procedure calls @@ -193,10 +221,15 @@ iterator allocation_order_end(const MachineFunction &MF) const; }]; let MethodBodies = [{ - FPURegsClass::iterator - FPURegsClass::allocation_order_end(const MachineFunction &MF) const { + AFGR64Class::iterator + AFGR64Class::allocation_order_end(const MachineFunction &MF) const { // The last register on the list above is reserved return end()-1; } }]; } + +def CCR : RegisterClass<"Mips", [i32], 32, [FCR31]> { + let CopyCost = -1; // Don't allow copying of status registers. +} + Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsSubtarget.cpp Sat Jul 5 14:05:21 2008 @@ -14,15 +14,29 @@ #include "MipsSubtarget.h" #include "Mips.h" #include "MipsGenSubtarget.inc" +#include "llvm/Module.h" using namespace llvm; MipsSubtarget::MipsSubtarget(const TargetMachine &TM, const Module &M, const std::string &FS, bool little) : - IsMipsIII(false), - IsLittle(little) + MipsArchVersion(Mips1), MipsABI(O32), IsLittle(little), IsSingleFloat(false), + IsFP64bit(false), IsGP64bit(false), HasAllegrexVFPU(false), IsAllegrex(false) { std::string CPU = "mips1"; // Parse features string. ParseSubtargetFeatures(FS, CPU); + + // When only the target triple is specified and is + // a allegrex target, set the features. We also match + // big and little endian allegrex cores (dont really + // know if a big one exists) + const std::string& TT = M.getTargetTriple(); + if (TT.find("mipsallegrex") != std::string::npos) { + MipsABI = EABI; + IsSingleFloat = true; + MipsArchVersion = Mips2; + HasAllegrexVFPU = true; // Enables Allegrex Vector FPU (not supported yet) + IsAllegrex = true; + } } Modified: llvm/trunk/lib/Target/Mips/MipsSubtarget.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsSubtarget.h?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsSubtarget.h (original) +++ llvm/trunk/lib/Target/Mips/MipsSubtarget.h Sat Jul 5 14:05:21 2008 @@ -26,11 +26,48 @@ protected: - bool IsMipsIII; + enum MipsArchEnum { + Mips1, Mips2, Mips3, Mips4, Mips32, Mips32r2 + }; + + enum MipsABIEnum { + O32, EABI + }; + + // Mips architecture version + MipsArchEnum MipsArchVersion; + + // Mips supported ABIs + MipsABIEnum MipsABI; + + // IsLittle - The target is Little Endian bool IsLittle; + + // IsSingleFloat - The target only supports single precision float + // point operations. This enable the target to use all 32 32-bit + // float point registers instead of only using even ones. + bool IsSingleFloat; + + // IsFP64bit - The target processor has 64-bit float point registers. + bool IsFP64bit; + + // IsFP64bit - General-purpose registers are 64 bits wide + bool IsGP64bit; + + // HasAllegrexVFPU - Allegrex processor has a vector float point unit. + bool HasAllegrexVFPU; + + // IsAllegrex - The target processor is a Allegrex core. + bool IsAllegrex; + InstrItineraryData InstrItins; public: + + /// Only O32 and EABI supported right now. + bool isABI_EABI() const { return MipsABI == EABI; } + bool isABI_O32() const { return MipsABI == O32; } + /// This constructor initializes the data members to match that /// of the specified module. MipsSubtarget(const TargetMachine &TM, const Module &M, @@ -40,12 +77,17 @@ /// subtarget options. Definition of function is auto generated by tblgen. void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU); - /// isMipsIII - Return true if the selected CPU supports MipsIII ISA - /// support. - bool isMipsIII() const { return IsMipsIII; } + bool hasMips2Ops() const { return MipsArchVersion >= Mips2; } - /// isMipsIII - Return true if the target is little endian. bool isLittle() const { return IsLittle; } + bool isFP64bit() const { return IsFP64bit; }; + bool isGP64bit() const { return IsGP64bit; }; + bool isGP32bit() const { return !IsGP64bit; }; + bool isSingleFloat() const { return IsSingleFloat; }; + bool isNotSingleFloat() const { return !IsSingleFloat; }; + bool hasAllegrexVFPU() const { return HasAllegrexVFPU; }; + bool isAllegrex() const { return IsAllegrex; }; + }; } // End llvm namespace Modified: llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp?rev=53146&r1=53145&r2=53146&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp (original) +++ llvm/trunk/lib/Target/Mips/MipsTargetMachine.cpp Sat Jul 5 14:05:21 2008 @@ -34,8 +34,7 @@ // On function prologue, the stack is created by decrementing // its pointer. Once decremented, all references are done with positive // offset from the stack/frame pointer, so StackGrowsUp is used. -// When using CodeModel::Large the behaviour -// +// Using CodeModel::Large enables different CALL behavior. MipsTargetMachine:: MipsTargetMachine(const Module &M, const std::string &FS, bool isLittle=false): Subtarget(*this, M, FS, isLittle), @@ -59,22 +58,33 @@ unsigned MipsTargetMachine:: getModuleMatchQuality(const Module &M) { - // We strongly match "mips-*". + // We strongly match "mips*-*". std::string TT = M.getTargetTriple(); if (TT.size() >= 5 && std::string(TT.begin(), TT.begin()+5) == "mips-") return 20; + if (TT.size() >= 13 && std::string(TT.begin(), + TT.begin()+13) == "mipsallegrex-") + return 20; + return 0; } -// return 0 and must specify -march to gen MIPSel code. +// return 0 and must specify -march to gen MIPSEL code. unsigned MipselTargetMachine:: getModuleMatchQuality(const Module &M) { - // We strongly match "mipsel-*". + // We strongly match "mips*el-*". std::string TT = M.getTargetTriple(); if (TT.size() >= 7 && std::string(TT.begin(), TT.begin()+7) == "mipsel-") return 20; + + if (TT.size() >= 15 && std::string(TT.begin(), + TT.begin()+15) == "mipsallegrexel-") + return 20; + + if (TT.size() == 3 && std::string(TT.begin(), TT.begin()+3) == "psp") + return 20; return 0; } From bruno.cardoso at gmail.com Sat Jul 5 14:08:31 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Sat, 05 Jul 2008 19:08:31 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53147 - in /llvm-gcc-4.2/trunk: config.sub gcc/Makefile.in gcc/config.gcc gcc/config/mips/mips.c gcc/config/mips/mips.h gcc/config/mips/psp.h gcc/config/mips/t-allegrex Message-ID: <200807051908.m65J8V42001510@zion.cs.uiuc.edu> Author: bruno Date: Sat Jul 5 14:08:31 2008 New Revision: 53147 URL: http://llvm.org/viewvc/llvm-project?rev=53147&view=rev Log: Mips allegrex core support. Added: llvm-gcc-4.2/trunk/gcc/config/mips/psp.h llvm-gcc-4.2/trunk/gcc/config/mips/t-allegrex Modified: llvm-gcc-4.2/trunk/config.sub llvm-gcc-4.2/trunk/gcc/Makefile.in llvm-gcc-4.2/trunk/gcc/config.gcc llvm-gcc-4.2/trunk/gcc/config/mips/mips.c llvm-gcc-4.2/trunk/gcc/config/mips/mips.h Modified: llvm-gcc-4.2/trunk/config.sub URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/config.sub?rev=53147&r1=53146&r2=53147&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/config.sub (original) +++ llvm-gcc-4.2/trunk/config.sub Sat Jul 5 14:08:31 2008 @@ -267,6 +267,7 @@ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ + | mipsallegrex | mipsallegrexel \ | mn10200 | mn10300 \ | mt \ | msp430 \ @@ -348,6 +349,7 @@ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mipsallegrex-* | mipsallegrexel-* \ | mmix-* \ | mt-* \ | msp430-* \ @@ -690,6 +692,10 @@ basic_machine=m68k-atari os=-mint ;; + psp) + basic_machine=mipsallegrexel-psp + os=-elf + ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=53147&r1=53146&r2=53147&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Sat Jul 5 14:08:31 2008 @@ -1140,8 +1140,7 @@ ia64-*-*) echo ia64;; \ i[34567]86-*-*) echo x86;; \ x86_64-*-*) echo x86;; \ - mips-*-*) echo mips;; \ - mipsel-*-*) echo mipsel;; \ + mips*-*-*) echo mips;; \ powerpc*-*-*) echo powerpc;; \ sparc-*-*) echo sparc;; \ sparcv9-*-*) echo sparc;; \ Modified: llvm-gcc-4.2/trunk/gcc/config.gcc URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config.gcc?rev=53147&r1=53146&r2=53147&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config.gcc (original) +++ llvm-gcc-4.2/trunk/gcc/config.gcc Sat Jul 5 14:08:31 2008 @@ -1700,6 +1700,18 @@ tmake_file=mips/t-r3900 use_fixproto=yes ;; +mipsallegrex*) + tm_file="elfos.h ${tm_file} mips/elf.h" + tmake_file=mips/t-allegrex + target_cpu_default="MASK_SINGLE_FLOAT|MASK_DIVIDE_BREAKS" + tm_defines="${tm_defines} MIPS_ISA_DEFAULT=2 MIPS_CPU_STRING_DEFAULT=\\\"allegrex\\\" MIPS_ABI_DEFAULT=ABI_EABI" + case ${target} in + mipsallegrex*-psp-elf*) + tm_file="${tm_file} mips/psp.h" + ;; + esac + use_fixproto=yes + ;; mmix-knuth-mmixware) need_64bit_hwint=yes ;; Modified: llvm-gcc-4.2/trunk/gcc/config/mips/mips.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/mips/mips.c?rev=53147&r1=53146&r2=53147&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/mips/mips.c (original) +++ llvm-gcc-4.2/trunk/gcc/config/mips/mips.c Sat Jul 5 14:08:31 2008 @@ -721,6 +721,7 @@ /* MIPS II */ { "r6000", PROCESSOR_R6000, 2 }, + { "allegrex", PROCESSOR_ALLEGREX, 2 }, /* MIPS III */ { "r4000", PROCESSOR_R4000, 3 }, Modified: llvm-gcc-4.2/trunk/gcc/config/mips/mips.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/mips/mips.h?rev=53147&r1=53146&r2=53147&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/mips/mips.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/mips/mips.h Sat Jul 5 14:08:31 2008 @@ -60,6 +60,7 @@ PROCESSOR_SB1, PROCESSOR_SB1A, PROCESSOR_SR71000, + PROCESSOR_ALLEGREX, PROCESSOR_MAX }; @@ -212,6 +213,7 @@ #define TARGET_SB1 (mips_arch == PROCESSOR_SB1 \ || mips_arch == PROCESSOR_SB1A) #define TARGET_SR71K (mips_arch == PROCESSOR_SR71000) +#define TARGET_ALLEGREX (mips_arch == PROCESSOR_ALLEGREX) /* Scheduling target defines. */ #define TUNE_MIPS3000 (mips_tune == PROCESSOR_R3000) @@ -227,6 +229,7 @@ #define TUNE_MIPS9000 (mips_tune == PROCESSOR_R9000) #define TUNE_SB1 (mips_tune == PROCESSOR_SB1 \ || mips_tune == PROCESSOR_SB1A) +#define TUNE_ALLEGREX (mips_tune == PROCESSOR_ALLEGREX) /* True if the pre-reload scheduler should try to create chains of multiply-add or multiply-subtract instructions. For example, @@ -270,6 +273,9 @@ #define TARGET_IRIX 0 #define TARGET_IRIX6 0 +/* PSP */ +#define TARGET_PSP 0 + /* Define preprocessor macros for the -march and -mtune options. PREFIX is either _MIPS_ARCH or _MIPS_TUNE, INFO is the selected processor. If INFO's canonical name is "foo", define PREFIX to @@ -339,6 +345,13 @@ if (TARGET_DSP) \ builtin_define ("__mips_dsp"); \ \ + if (TARGET_PSP) \ + { \ + builtin_define ("PSP=1"); \ + builtin_define ("__psp__=1"); \ + builtin_define ("_PSP=1"); \ + } \ + \ MIPS_CPP_SET_PROCESSOR ("_MIPS_ARCH", mips_arch_info); \ MIPS_CPP_SET_PROCESSOR ("_MIPS_TUNE", mips_tune_info); \ \ Added: llvm-gcc-4.2/trunk/gcc/config/mips/psp.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/mips/psp.h?rev=53147&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/mips/psp.h (added) +++ llvm-gcc-4.2/trunk/gcc/config/mips/psp.h Sat Jul 5 14:08:31 2008 @@ -0,0 +1,31 @@ +/* Support for Sony's Playstation Portable (PSP). + Copyright (C) 2005 Free Software Foundation, Inc. + Contributed by Marcus R. Brown + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GCC is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to +the Free Software Foundation, 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. */ + +#undef TARGET_PSP +#define TARGET_PSP 1 + +/* Override the startfile spec to include crt0.o. */ +#undef STARTFILE_SPEC +#define STARTFILE_SPEC "crt0%O%s crti%O%s crtbegin%O%s" + +/* Get rid of the .pdr section. */ +#undef SUBTARGET_ASM_SPEC +#define SUBTARGET_ASM_SPEC "-mno-pdr" Added: llvm-gcc-4.2/trunk/gcc/config/mips/t-allegrex URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/mips/t-allegrex?rev=53147&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/mips/t-allegrex (added) +++ llvm-gcc-4.2/trunk/gcc/config/mips/t-allegrex Sat Jul 5 14:08:31 2008 @@ -0,0 +1,29 @@ +# Suppress building libgcc1.a, since the MIPS compiler port is complete +# and does not need anything from libgcc1.a. +LIBGCC1 = +CROSS_LIBGCC1 = + +EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o crti.o crtn.o +# Don't let CTOR_LIST end up in sdata section. +CRTSTUFF_T_CFLAGS = -G 0 + +# Assemble startup files. +$(T)crti.o: $(srcdir)/config/mips/crti.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ + -c -o $(T)crti.o -x assembler-with-cpp $(srcdir)/config/mips/crti.asm + +$(T)crtn.o: $(srcdir)/config/mips/crtn.asm $(GCC_PASSES) + $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(MULTILIB_CFLAGS) $(INCLUDES) \ + -c -o $(T)crtn.o -x assembler-with-cpp $(srcdir)/config/mips/crtn.asm + +# We must build libgcc2.a with -G 0, in case the user wants to link +# without the $gp register. +TARGET_LIBGCC2_CFLAGS = -G 0 + +# Build the libraries for both hard and soft floating point + +MULTILIB_OPTIONS = +MULTILIB_DIRNAMES = + +LIBGCC = stmp-multilib +INSTALL_LIBGCC = install-multilib From wangmp at apple.com Sat Jul 5 14:57:42 2008 From: wangmp at apple.com (Mon P Wang) Date: Sat, 5 Jul 2008 12:57:42 -0700 Subject: [llvm-commits] [llvm] r53035 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/Target/ARM/ARMISelLowering.cpp lib/Target/CellSPU/SPUISelLowering.cpp lib/Target/PowerPC/PPCISelLowering.cpp lib/Target/Sparc/SparcISelLowering.cpp lib/Target/X86/X86ISelLowering.cpp In-Reply-To: <200807042041.02925.duncan.sands@math.u-psud.fr> References: <200807021741.m62Hf7YB019514@zion.cs.uiuc.edu> <320689A9-CF1D-451C-9AB0-31B3737AD1CE@apple.com> <200807042041.02925.duncan.sands@math.u-psud.fr> Message-ID: <12DE7596-F9DA-4A63-9825-F6778882F33E@apple.com> Hi Duncan, I ran into the problem when I was playing with "widening*" vector types. It is something I haven't submitted a patch for so my test case will not work for you at this point. What problem do you think will occur in LegalizeTypes? If you can let me know, I can do a quick look into it. -- Mon Ping * By widening a vector type, I mean assume one have a series of 3xi32 vector operations when the hardware supports 4xi32 vector operations. In this case, it is more efficient to widen the 3xi32 to a 4xi32 (by copy the last element value in the 4th position) and using the 4xi32 vector operations and undo the widening when one copies the results back to memory. On Jul 4, 2008, at 11:41 AM, Duncan Sands wrote: > Hi, do you have a testcase? This problem might > occur with LegalizeTypes too. > > Thanks, > > Duncan. From bruno.cardoso at gmail.com Sat Jul 5 15:23:59 2008 From: bruno.cardoso at gmail.com (Bruno Cardoso Lopes) Date: Sat, 5 Jul 2008 17:23:59 -0300 Subject: [llvm-commits] [llvm-gcc] [PATCH] mips eabi byval support Message-ID: <275e64e40807051323x64cfa812p9091290945c52c58@mail.gmail.com> Added support for passing aggregates with byval if size greater than a register, as defined by mips eabi. -- Bruno Cardoso Lopes http://www.brunocardoso.cc "When faced with untenable alternatives, you should consider your imperative." -------------- next part -------------- A non-text attachment was scrubbed... Name: mips-byval.patch Type: application/octet-stream Size: 4397 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20080705/e8cc4eae/attachment.obj From wangmp at apple.com Sat Jul 5 15:40:31 2008 From: wangmp at apple.com (Mon P Wang) Date: Sat, 05 Jul 2008 20:40:31 -0000 Subject: [llvm-commits] [llvm] r53150 - in /llvm/trunk: include/llvm/CodeGen/SelectionDAG.h lib/CodeGen/SelectionDAG/LegalizeDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp Message-ID: <200807052040.m65KeVBw004285@zion.cs.uiuc.edu> Author: wangmp Date: Sat Jul 5 15:40:31 2008 New Revision: 53150 URL: http://llvm.org/viewvc/llvm-project?rev=53150&view=rev Log: Fixed generating incorrect aligned stores that I backout of r53031 that fixed problems in EmitStackConvert where the source and target type have different alignment by creating a stack slot with the max alignment of source and target type. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAG.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAG.h?rev=53150&r1=53149&r2=53150&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAG.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAG.h Sat Jul 5 15:40:31 2008 @@ -589,9 +589,10 @@ void dump() const; /// CreateStackTemporary - Create a stack temporary, suitable for holding the - /// specified value type. - SDOperand CreateStackTemporary(MVT VT); - + /// specified value type. If minAlign is specified, the slot size will have + /// at least that alignment. + SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1); + /// FoldSetCC - Constant fold a setcc to true or false. SDOperand FoldSetCC(MVT VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond); Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=53150&r1=53149&r2=53150&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sat Jul 5 15:40:31 2008 @@ -4871,35 +4871,41 @@ MVT SlotVT, MVT DestVT) { // Create the stack frame object. - SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT); - + unsigned SrcAlign = TLI.getTargetData()->getPrefTypeAlignment( + SrcOp.getValueType().getTypeForMVT()); + SDOperand FIPtr = DAG.CreateStackTemporary(SlotVT, SrcAlign); + FrameIndexSDNode *StackPtrFI = cast(FIPtr); int SPFI = StackPtrFI->getIndex(); - + unsigned SrcSize = SrcOp.getValueType().getSizeInBits(); unsigned SlotSize = SlotVT.getSizeInBits(); unsigned DestSize = DestVT.getSizeInBits(); + unsigned DestAlign = TLI.getTargetData()->getPrefTypeAlignment( + DestVT.getTypeForMVT()); // Emit a store to the stack slot. Use a truncstore if the input value is // later than DestVT. SDOperand Store; + if (SrcSize > SlotSize) Store = DAG.getTruncStore(DAG.getEntryNode(), SrcOp, FIPtr, - PseudoSourceValue::getFixedStack(), - SPFI, SlotVT); + PseudoSourceValue::getFixedStack(), SPFI, SlotVT, + false, SrcAlign); else { assert(SrcSize == SlotSize && "Invalid store"); Store = DAG.getStore(DAG.getEntryNode(), SrcOp, FIPtr, - PseudoSourceValue::getFixedStack(), - SPFI); + PseudoSourceValue::getFixedStack(), SPFI, + false, SrcAlign); } // Result is a load from the stack slot. if (SlotSize == DestSize) - return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0); + return DAG.getLoad(DestVT, Store, FIPtr, NULL, 0, false, DestAlign); assert(SlotSize < DestSize && "Unknown extension!"); - return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT); + return DAG.getExtLoad(ISD::EXTLOAD, DestVT, Store, FIPtr, NULL, 0, SlotVT, + false, DestAlign); } SDOperand SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(SDNode *Node) { Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=53150&r1=53149&r2=53150&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Sat Jul 5 15:40:31 2008 @@ -1080,16 +1080,17 @@ /// CreateStackTemporary - Create a stack temporary, suitable for holding the /// specified value type. -SDOperand SelectionDAG::CreateStackTemporary(MVT VT) { +SDOperand SelectionDAG::CreateStackTemporary(MVT VT, unsigned minAlign) { MachineFrameInfo *FrameInfo = getMachineFunction().getFrameInfo(); unsigned ByteSize = VT.getSizeInBits()/8; const Type *Ty = VT.getTypeForMVT(); - unsigned StackAlign = (unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty); + unsigned StackAlign = + std::max((unsigned)TLI.getTargetData()->getPrefTypeAlignment(Ty), minAlign); + int FrameIdx = FrameInfo->CreateStackObject(ByteSize, StackAlign); return getFrameIndex(FrameIdx, TLI.getPointerTy()); } - SDOperand SelectionDAG::FoldSetCC(MVT VT, SDOperand N1, SDOperand N2, ISD::CondCode Cond) { // These setcc operations always fold. From nicholas at mxc.ca Sat Jul 5 16:19:35 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 05 Jul 2008 21:19:35 -0000 Subject: [llvm-commits] [llvm] r53151 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/cast-mul-select.ll Message-ID: <200807052119.m65LJZcT005447@zion.cs.uiuc.edu> Author: nicholas Date: Sat Jul 5 16:19:34 2008 New Revision: 53151 URL: http://llvm.org/viewvc/llvm-project?rev=53151&view=rev Log: Fix missed optimization opportunity when analyzing cast of mul and select. Added: llvm/trunk/test/Transforms/InstCombine/cast-mul-select.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=53151&r1=53150&r2=53151&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sat Jul 5 16:19:34 2008 @@ -6917,6 +6917,7 @@ switch (I->getOpcode()) { case Instruction::Add: case Instruction::Sub: + case Instruction::Mul: case Instruction::And: case Instruction::Or: case Instruction::Xor: @@ -6926,14 +6927,6 @@ CanEvaluateInDifferentType(I->getOperand(1), Ty, CastOpc, NumCastsRemoved); - case Instruction::Mul: - // A multiply can be truncated by truncating its operands. - return Ty->getBitWidth() < OrigTy->getBitWidth() && - CanEvaluateInDifferentType(I->getOperand(0), Ty, CastOpc, - NumCastsRemoved) && - CanEvaluateInDifferentType(I->getOperand(1), Ty, CastOpc, - NumCastsRemoved); - case Instruction::Shl: // If we are truncating the result of this SHL, and if it's a shift of a // constant amount, we can always perform a SHL in a smaller type. @@ -6970,7 +6963,13 @@ if (I->getOpcode() == CastOpc) return true; break; - + case Instruction::Select: { + SelectInst *SI = cast(I); + return CanEvaluateInDifferentType(SI->getTrueValue(), Ty, CastOpc, + NumCastsRemoved) && + CanEvaluateInDifferentType(SI->getFalseValue(), Ty, CastOpc, + NumCastsRemoved); + } case Instruction::PHI: { // We can change a phi if we can change all operands. PHINode *PN = cast(I); @@ -7028,6 +7027,12 @@ Res = CastInst::Create(cast(I)->getOpcode(), I->getOperand(0), Ty); break; + case Instruction::Select: { + Value *True = EvaluateInDifferentType(I->getOperand(1), Ty, isSigned); + Value *False = EvaluateInDifferentType(I->getOperand(2), Ty, isSigned); + Res = SelectInst::Create(I->getOperand(0), True, False); + break; + } case Instruction::PHI: { PHINode *OPN = cast(I); PHINode *NPN = PHINode::Create(Ty); Added: llvm/trunk/test/Transforms/InstCombine/cast-mul-select.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast-mul-select.ll?rev=53151&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/cast-mul-select.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/cast-mul-select.ll Sat Jul 5 16:19:34 2008 @@ -0,0 +1,29 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | notcast + +define i32 @mul(i32 %x, i32 %y) { + %A = trunc i32 %x to i8 + %B = trunc i32 %y to i8 + %C = mul i8 %A, %B + %D = zext i8 %C to i32 + ret i32 %D +} + +define i32 @select1(i1 %cond, i32 %x, i32 %y, i32 %z) { + %A = trunc i32 %x to i8 + %B = trunc i32 %y to i8 + %C = trunc i32 %z to i8 + %D = add i8 %A, %B + %E = select i1 %cond, i8 %C, i8 %D + %F = zext i8 %E to i32 + ret i32 %F +} + +define i8 @select2(i1 %cond, i8 %x, i8 %y, i8 %z) { + %A = zext i8 %x to i32 + %B = zext i8 %y to i32 + %C = zext i8 %z to i32 + %D = add i32 %A, %B + %E = select i1 %cond, i32 %C, i32 %D + %F = trunc i32 %E to i8 + ret i8 %F +} From asl at math.spbu.ru Sat Jul 5 16:39:14 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 05 Jul 2008 21:39:14 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53152 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp llvm-internal.h Message-ID: <200807052139.m65LdEhu005980@zion.cs.uiuc.edu> Author: asl Date: Sat Jul 5 16:39:14 2008 New Revision: 53152 URL: http://llvm.org/viewvc/llvm-project?rev=53152&view=rev Log: Improve visibility support - don't propagate visibility for external symbols, unless user explicitely wants so. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp 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-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=53152&r1=53151&r2=53152&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Sat Jul 5 16:39:14 2008 @@ -104,6 +104,22 @@ bool OptimizationPassesCreated = false; static void destroyOptimizationPasses(); +// Forward decl visibility style to global. +void handleVisibility(tree decl, GlobalValue *GV) { + // If decl has visibility specified explicitely (via attribute) - honour + // it. Otherwise (e.g. visibility specified via -fvisibility=hidden) honour + // only if symbol is local. + if (TREE_PUBLIC(decl) && + (DECL_VISIBILITY_SPECIFIED(decl) || !DECL_EXTERNAL(decl))) { + if (DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN) + GV->setVisibility(GlobalValue::HiddenVisibility); + else if (DECL_VISIBILITY(decl) == VISIBILITY_PROTECTED) + GV->setVisibility(GlobalValue::ProtectedVisibility); + else if (DECL_VISIBILITY(decl) == VISIBILITY_DEFAULT) + GV->setVisibility(Function::DefaultVisibility); + } +} + void llvm_initialize_backend(void) { // Initialize LLVM options. std::vector Args; @@ -756,13 +772,8 @@ GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), Linkage, "", Aliasee, TheModule); - // Handle visibility style - if (TREE_PUBLIC(decl)) { - if (DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN) - GA->setVisibility(GlobalValue::HiddenVisibility); - else if (DECL_VISIBILITY(decl) == VISIBILITY_PROTECTED) - GA->setVisibility(GlobalValue::ProtectedVisibility); - } + + handleVisibility(decl, GA); if (V->getType() == GA->getType()) V->replaceAllUsesWith(GA); @@ -1009,13 +1020,7 @@ TARGET_ADJUST_LLVM_LINKAGE(GV,decl); #endif /* TARGET_ADJUST_LLVM_LINKAGE */ - // Handle visibility style - if (TREE_PUBLIC(decl)) { - if (DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN) - GV->setVisibility(GlobalValue::HiddenVisibility); - else if (DECL_VISIBILITY(decl) == VISIBILITY_PROTECTED) - GV->setVisibility(GlobalValue::ProtectedVisibility); - } + handleVisibility(decl, GV); // Set the section for the global. if (TREE_CODE(decl) == VAR_DECL) { @@ -1201,13 +1206,7 @@ TARGET_ADJUST_LLVM_LINKAGE(FnEntry,decl); #endif /* TARGET_ADJUST_LLVM_LINKAGE */ - // Handle visibility style - if (TREE_PUBLIC(decl)) { - if (DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN) - FnEntry->setVisibility(GlobalValue::HiddenVisibility); - else if (DECL_VISIBILITY(decl) == VISIBILITY_PROTECTED) - FnEntry->setVisibility(GlobalValue::ProtectedVisibility); - } + handleVisibility(decl, FnEntry); // If FnEntry got renamed, then there is already an object with this name // in the symbol table. If this happens, the old one must be a forward @@ -1253,14 +1252,7 @@ TARGET_ADJUST_LLVM_LINKAGE(GV,decl); #endif /* TARGET_ADJUST_LLVM_LINKAGE */ - // Handle visibility style - if (TREE_PUBLIC(decl)) { - if (DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN) - GV->setVisibility(GlobalValue::HiddenVisibility); - else if (DECL_VISIBILITY(decl) == VISIBILITY_PROTECTED) - GV->setVisibility(GlobalValue::ProtectedVisibility); - } - + handleVisibility(decl, GV); } else { // If the global has a name, prevent multiple vars with the same name from // being created. @@ -1278,13 +1270,7 @@ TARGET_ADJUST_LLVM_LINKAGE(GV,decl); #endif /* TARGET_ADJUST_LLVM_LINKAGE */ - // Handle visibility style - if (TREE_PUBLIC(decl)) { - if (DECL_VISIBILITY(decl) == VISIBILITY_HIDDEN) - GV->setVisibility(GlobalValue::HiddenVisibility); - else if (DECL_VISIBILITY(decl) == VISIBILITY_PROTECTED) - GV->setVisibility(GlobalValue::ProtectedVisibility); - } + handleVisibility(decl, GV); // If GV got renamed, then there is already an object with this name in // the symbol table. If this happens, the old one must be a forward 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=53152&r1=53151&r2=53152&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sat Jul 5 16:39:14 2008 @@ -592,14 +592,7 @@ "Calling convention disagreement between prototype and impl!"); // The visibility can be changed from the last time we've seen this // function. Set to current. - if (TREE_PUBLIC(FnDecl)) { - if (DECL_VISIBILITY(FnDecl) == VISIBILITY_HIDDEN) - Fn->setVisibility(Function::HiddenVisibility); - else if (DECL_VISIBILITY(FnDecl) == VISIBILITY_PROTECTED) - Fn->setVisibility(Function::ProtectedVisibility); - else if (DECL_VISIBILITY(FnDecl) == VISIBILITY_DEFAULT) - Fn->setVisibility(Function::DefaultVisibility); - } + handleVisibility(FnDecl, Fn); } else { Function *FnEntry = TheModule->getFunction(Name); if (FnEntry) { @@ -646,12 +639,7 @@ #endif /* TARGET_ADJUST_LLVM_LINKAGE */ // Handle visibility style - if (TREE_PUBLIC(FnDecl)) { - if (DECL_VISIBILITY(FnDecl) == VISIBILITY_HIDDEN) - Fn->setVisibility(Function::HiddenVisibility); - else if (DECL_VISIBILITY(FnDecl) == VISIBILITY_PROTECTED) - Fn->setVisibility(Function::ProtectedVisibility); - } + handleVisibility(FnDecl, Fn); // Handle functions in specified sections. if (DECL_SECTION_NAME(FnDecl)) 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=53152&r1=53151&r2=53152&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Sat Jul 5 16:39:14 2008 @@ -111,6 +111,7 @@ void writeLLVMValues(); void clearTargetBuiltinCache(); const char* extractRegisterName(union tree_node*); +void handleVisibility(union tree_node* decl, GlobalValue *GV); struct StructTypeConversionInfo; From nicholas at mxc.ca Sat Jul 5 17:41:38 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 05 Jul 2008 22:41:38 -0000 Subject: [llvm-commits] [llvm] r53153 - /llvm/trunk/include/llvm/OperandTraits.h Message-ID: <200807052241.m65MfcAW007683@zion.cs.uiuc.edu> Author: nicholas Date: Sat Jul 5 17:41:37 2008 New Revision: 53153 URL: http://llvm.org/viewvc/llvm-project?rev=53153&view=rev Log: 80col Modified: llvm/trunk/include/llvm/OperandTraits.h Modified: llvm/trunk/include/llvm/OperandTraits.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/OperandTraits.h?rev=53153&r1=53152&r2=53153&view=diff ============================================================================== --- llvm/trunk/include/llvm/OperandTraits.h (original) +++ llvm/trunk/include/llvm/OperandTraits.h Sat Jul 5 17:41:37 2008 @@ -1,4 +1,4 @@ -//===-- llvm/OperandTraits.h - OperandTraits class definition ---------------------*- C++ -*-===// +//===-- llvm/OperandTraits.h - OperandTraits class definition ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // From asl at math.spbu.ru Sat Jul 5 18:03:21 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 05 Jul 2008 23:03:21 -0000 Subject: [llvm-commits] [llvm] r53154 - /llvm/trunk/lib/Linker/LinkModules.cpp Message-ID: <200807052303.m65N3LGr008298@zion.cs.uiuc.edu> Author: asl Date: Sat Jul 5 18:03:21 2008 New Revision: 53154 URL: http://llvm.org/viewvc/llvm-project?rev=53154&view=rev Log: Properly link alias and function decls. This fixes PR2146 Modified: llvm/trunk/lib/Linker/LinkModules.cpp Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=53154&r1=53153&r2=53154&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Sat Jul 5 18:03:21 2008 @@ -899,21 +899,30 @@ for (Module::const_iterator I = Src->begin(), E = Src->end(); I != E; ++I) { const Function *SF = I; // SrcFunction - Function *DF = 0; + GlobalValue *DGV = 0; Value *MappedDF; // If this function is internal or has no name, it doesn't participate in // linkage. if (SF->hasName() && !SF->hasInternalLinkage()) { // Check to see if may have to link the function. - DF = Dest->getFunction(SF->getName()); - if (DF && DF->hasInternalLinkage()) - DF = 0; + DGV = Dest->getFunction(SF->getName()); } - + + // Check to see if may have to link the function with the alias + if (!DGV && SF->hasName() && !SF->hasInternalLinkage()) { + DGV = Dest->getNamedAlias(SF->getName()); + if (DGV && DGV->getType() != SF->getType()) + // If types don't agree due to opaque types, try to resolve them. + RecursiveResolveTypes(SF->getType(), DGV->getType()); + } + + if (DGV && DGV->hasInternalLinkage()) + DGV = 0; + // If there is no linkage to be performed, just bring over SF without // modifying it. - if (DF == 0) { + if (DGV == 0) { // Function does not already exist, simply insert an function signature // identical to SF into the dest module. Function *NewDF = Function::Create(SF->getFunctionType(), @@ -930,9 +939,19 @@ // ... and remember this mapping... ValueMap[SF] = NewDF; continue; + } else if (GlobalAlias *DGA = dyn_cast(DGV)) { + // SF is global, but DF is alias. The only valid mapping is when SF is + // external declaration, which is effectively a no-op. + if (!SF->isDeclaration()) + return Error(Err, "Function-Alias Collision on '" + SF->getName() + + "': symbol multiple defined"); + + // Make sure to remember this mapping... + ValueMap[SF] = DGA; + continue; } - - + + Function* DF = cast(DGV); // If types don't agree because of opaque, try to resolve them. if (SF->getType() != DF->getType()) RecursiveResolveTypes(SF->getType(), DF->getType()); From asl at math.spbu.ru Sat Jul 5 18:03:46 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 05 Jul 2008 23:03:46 -0000 Subject: [llvm-commits] [llvm] r53155 - in /llvm/trunk/test/Linker: 2008-07-06-AliasFnDecl.ll 2008-07-06-AliasFnDecl2.ll Message-ID: <200807052303.m65N3kDZ008319@zion.cs.uiuc.edu> Author: asl Date: Sat Jul 5 18:03:46 2008 New Revision: 53155 URL: http://llvm.org/viewvc/llvm-project?rev=53155&view=rev Log: Testcase for PR2146 Added: llvm/trunk/test/Linker/2008-07-06-AliasFnDecl.ll llvm/trunk/test/Linker/2008-07-06-AliasFnDecl2.ll Added: llvm/trunk/test/Linker/2008-07-06-AliasFnDecl.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2008-07-06-AliasFnDecl.ll?rev=53155&view=auto ============================================================================== --- llvm/trunk/test/Linker/2008-07-06-AliasFnDecl.ll (added) +++ llvm/trunk/test/Linker/2008-07-06-AliasFnDecl.ll Sat Jul 5 18:03:46 2008 @@ -0,0 +1,14 @@ +; PR2146 +; RUN: llvm-as %s -o %t1.bc -f +; RUN: llvm-as %p/2008-07-06-AliasFnDecl2.ll -o %t2.bc -f +; RUN: llvm-link %t1.bc %t2.bc -f -o %t3.bc + + at b = alias void ()* @a + +define void @a() nounwind { +entry: + br label %return + +return: + ret void +} Added: llvm/trunk/test/Linker/2008-07-06-AliasFnDecl2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2008-07-06-AliasFnDecl2.ll?rev=53155&view=auto ============================================================================== --- llvm/trunk/test/Linker/2008-07-06-AliasFnDecl2.ll (added) +++ llvm/trunk/test/Linker/2008-07-06-AliasFnDecl2.ll Sat Jul 5 18:03:46 2008 @@ -0,0 +1,13 @@ +; This file is used by 2008-07-06-AliasFnDecl2.ll +; RUN: true + +define void @c() nounwind { +entry: + call void @b( ) nounwind + br label %return + +return: + ret void +} + +declare void @b() From nicholas at mxc.ca Sat Jul 5 18:08:16 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sat, 05 Jul 2008 16:08:16 -0700 Subject: [llvm-commits] [llvm] r50943 - in /llvm/trunk: CREDITS.TXT include/llvm/Constants.h include/llvm/GlobalAlias.h include/llvm/GlobalVariable.h include/llvm/InstrTypes.h include/llvm/Instruction.h include/llvm/Instructions.h include/llvm/OperandTraits.h include/llvm/Use.h include/llvm/User.h include/llvm/Value.h lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Reader/BitcodeReader.h lib/VMCore/ConstantFold.cpp lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp lib/VMCore/Instructions.cpp lib/VMCore/Use.cpp In-Reply-To: <79023444-4AB6-44D8-833B-299E24C9B7E5@mac.com> References: <79023444-4AB6-44D8-833B-299E24C9B7E5@mac.com> Message-ID: <486FFEE0.8090001@mxc.ca> Gabor Greif wrote: > Nicholas, and all who still keep branches from > the time where BasicBlock was still derived from User, > now that I have checked in the use-diet changes, you > will have some minor complication when synchronizing > with trunk. Thanks for keeping me posted! I've encountered a small problem, which is that I'm not sure what to pass to User's constructor when defining the constructor for BasicBlock. I've derived BasicBlock from User, and chosen OptionalOperand and added all the various accessors and such. Does that mean I should use OptionalOperandTraits::allocate() as the OpList parameter? Or do I need to declare my own elsewhere? Also, what is "vty" (the second param to User's constructor)? Nick From asl at math.spbu.ru Sat Jul 5 18:33:22 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 05 Jul 2008 23:33:22 -0000 Subject: [llvm-commits] [llvm] r53156 - /llvm/trunk/lib/Linker/LinkModules.cpp Message-ID: <200807052333.m65NXM3Q009161@zion.cs.uiuc.edu> Author: asl Date: Sat Jul 5 18:33:22 2008 New Revision: 53156 URL: http://llvm.org/viewvc/llvm-project?rev=53156&view=rev Log: Override weak stuff during linking of aliases. This fixes PR2463. Modified: llvm/trunk/lib/Linker/LinkModules.cpp Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=53156&r1=53155&r2=53156&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Sat Jul 5 18:33:22 2008 @@ -760,8 +760,12 @@ return Error(Err, "Alias Collision on '" + SGA->getName()+ "': aliases have different aliasees"); } else if (GlobalVariable *DGVar = dyn_cast_or_null(DGV)) { - // The only allowed way is to link alias with external declaration. - if (DGVar->isDeclaration()) { + // The only allowed way is to link alias with external declaration or weak + // symbol.. + if (DGVar->isDeclaration() || + DGVar->hasWeakLinkage() || + DGVar->hasLinkOnceLinkage() || + DGVar->hasCommonLinkage()) { // But only if aliasee is global too... if (!isa(DAliasee)) return Error(Err, "Global-Alias Collision on '" + SGA->getName() + @@ -788,8 +792,12 @@ return Error(Err, "Global-Alias Collision on '" + SGA->getName() + "': symbol multiple defined"); } else if (Function *DF = dyn_cast_or_null(DGV)) { - // The only allowed way is to link alias with external declaration. - if (DF->isDeclaration()) { + // The only allowed way is to link alias with external declaration or weak + // symbol... + if (DF->isDeclaration() || + DF->hasWeakLinkage() || + DF->hasLinkOnceLinkage() || + DF->hasCommonLinkage()) { // But only if aliasee is function too... if (!isa(DAliasee)) return Error(Err, "Function-Alias Collision on '" + SGA->getName() + @@ -940,14 +948,19 @@ ValueMap[SF] = NewDF; continue; } else if (GlobalAlias *DGA = dyn_cast(DGV)) { - // SF is global, but DF is alias. The only valid mapping is when SF is - // external declaration, which is effectively a no-op. - if (!SF->isDeclaration()) + // SF is function, but DF is alias. + // The only valid mappings are: + // - SF is external declaration, which is effectively a no-op. + // - SF is weak, when we just need to throw SF out. + if (!SF->isDeclaration() && + !SF->hasWeakLinkage() && + !SF->hasLinkOnceLinkage() && + !SF->hasCommonLinkage()) return Error(Err, "Function-Alias Collision on '" + SF->getName() + "': symbol multiple defined"); // Make sure to remember this mapping... - ValueMap[SF] = DGA; + ValueMap[SF] = ConstantExpr::getBitCast(DGA, SF->getType()); continue; } From asl at math.spbu.ru Sat Jul 5 18:33:40 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 05 Jul 2008 23:33:40 -0000 Subject: [llvm-commits] [llvm] r53157 - in /llvm/trunk/test/Linker: 2008-07-06-AliasWeakDest.ll 2008-07-06-AliasWeakDest2.ll Message-ID: <200807052333.m65NXfmg009180@zion.cs.uiuc.edu> Author: asl Date: Sat Jul 5 18:33:40 2008 New Revision: 53157 URL: http://llvm.org/viewvc/llvm-project?rev=53157&view=rev Log: Testcase for PR2463 Added: llvm/trunk/test/Linker/2008-07-06-AliasWeakDest.ll llvm/trunk/test/Linker/2008-07-06-AliasWeakDest2.ll Added: llvm/trunk/test/Linker/2008-07-06-AliasWeakDest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2008-07-06-AliasWeakDest.ll?rev=53157&view=auto ============================================================================== --- llvm/trunk/test/Linker/2008-07-06-AliasWeakDest.ll (added) +++ llvm/trunk/test/Linker/2008-07-06-AliasWeakDest.ll Sat Jul 5 18:33:40 2008 @@ -0,0 +1,15 @@ +; PR2463 +; RUN: llvm-as %s -o %t1.bc -f +; RUN: llvm-as %p/2008-07-06-AliasWeakDest2.ll -o %t2.bc -f +; RUN: llvm-link %t1.bc %t2.bc -f -o %t3.bc +; RUN: llvm-link %t2.bc %t1.bc -f -o %t4.bc + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" +target triple = "i386-pc-linux-gnu" + + at sched_clock = alias i64 ()* @native_sched_clock + +define i64 @native_sched_clock() nounwind { +entry: + ret i64 0 +} Added: llvm/trunk/test/Linker/2008-07-06-AliasWeakDest2.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/2008-07-06-AliasWeakDest2.ll?rev=53157&view=auto ============================================================================== --- llvm/trunk/test/Linker/2008-07-06-AliasWeakDest2.ll (added) +++ llvm/trunk/test/Linker/2008-07-06-AliasWeakDest2.ll Sat Jul 5 18:33:40 2008 @@ -0,0 +1,17 @@ +; This file is used by 2008-07-06-AliasWeakDest2.ll +; RUN: true + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" +target triple = "i386-pc-linux-gnu" + + +define i64 @sched_clock_cpu(i32 inreg %cpu) nounwind { +entry: + %tmp = call i64 @sched_clock( ) nounwind ; + ret i64 %tmp +} + +define weak i64 @sched_clock() { +entry: + ret i64 1 +} From asl at math.spbu.ru Sat Jul 5 18:48:30 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 05 Jul 2008 23:48:30 -0000 Subject: [llvm-commits] [llvm] r53158 - in /llvm/trunk: include/llvm/GlobalValue.h lib/Linker/LinkModules.cpp Message-ID: <200807052348.m65NmVKM009577@zion.cs.uiuc.edu> Author: asl Date: Sat Jul 5 18:48:30 2008 New Revision: 53158 URL: http://llvm.org/viewvc/llvm-project?rev=53158&view=rev Log: Add convenient helper for checking whether global is weak in linker sense having weak or linkonce or common or extweak LLVM linkage. Modified: llvm/trunk/include/llvm/GlobalValue.h llvm/trunk/lib/Linker/LinkModules.cpp Modified: llvm/trunk/include/llvm/GlobalValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalValue.h?rev=53158&r1=53157&r2=53158&view=diff ============================================================================== --- llvm/trunk/include/llvm/GlobalValue.h (original) +++ llvm/trunk/include/llvm/GlobalValue.h Sat Jul 5 18:48:30 2008 @@ -110,6 +110,15 @@ void setLinkage(LinkageTypes LT) { Linkage = LT; } LinkageTypes getLinkage() const { return Linkage; } + /// isWeakForLinker - Determines if symbol is weak for linker having weak or + /// linkonce or common or extweak LLVM linkage. + bool isWeakForLinker() const { + return (Linkage == WeakLinkage || + Linkage == LinkOnceLinkage || + Linkage == CommonLinkage || + Linkage == ExternalWeakLinkage); + } + /// copyAttributesFrom - copy all additional attributes (those not needed to /// create a GlobalValue) from the GlobalValue Src to this one. virtual void copyAttributesFrom(const GlobalValue *Src); Modified: llvm/trunk/lib/Linker/LinkModules.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=53158&r1=53157&r2=53158&view=diff ============================================================================== --- llvm/trunk/lib/Linker/LinkModules.cpp (original) +++ llvm/trunk/lib/Linker/LinkModules.cpp Sat Jul 5 18:48:30 2008 @@ -483,11 +483,10 @@ "': can only link appending global with another appending global!"); LinkFromSrc = true; // Special cased. LT = Src->getLinkage(); - } else if (Src->hasWeakLinkage() || Src->hasLinkOnceLinkage() || - Src->hasCommonLinkage()) { + } else if (Src->isWeakForLinker()) { // At this point we know that Dest has LinkOnce, External*, Weak, Common, // or DLL* linkage. - if ((Dest->hasLinkOnceLinkage() && + if ((Dest->hasLinkOnceLinkage() && (Src->hasWeakLinkage() || Src->hasCommonLinkage())) || Dest->hasExternalWeakLinkage()) { LinkFromSrc = true; @@ -496,8 +495,7 @@ LinkFromSrc = false; LT = Dest->getLinkage(); } - } else if (Dest->hasWeakLinkage() || Dest->hasLinkOnceLinkage() || - Dest->hasCommonLinkage()) { + } else if (Dest->isWeakForLinker()) { // At this point we know that Src has External* or DLL* linkage. if (Src->hasExternalWeakLinkage()) { LinkFromSrc = false; @@ -762,10 +760,7 @@ } else if (GlobalVariable *DGVar = dyn_cast_or_null(DGV)) { // The only allowed way is to link alias with external declaration or weak // symbol.. - if (DGVar->isDeclaration() || - DGVar->hasWeakLinkage() || - DGVar->hasLinkOnceLinkage() || - DGVar->hasCommonLinkage()) { + if (DGVar->isDeclaration() || DGVar->isWeakForLinker()) { // But only if aliasee is global too... if (!isa(DAliasee)) return Error(Err, "Global-Alias Collision on '" + SGA->getName() + @@ -794,10 +789,7 @@ } else if (Function *DF = dyn_cast_or_null(DGV)) { // The only allowed way is to link alias with external declaration or weak // symbol... - if (DF->isDeclaration() || - DF->hasWeakLinkage() || - DF->hasLinkOnceLinkage() || - DF->hasCommonLinkage()) { + if (DF->isDeclaration() || DF->isWeakForLinker()) { // But only if aliasee is function too... if (!isa(DAliasee)) return Error(Err, "Function-Alias Collision on '" + SGA->getName() + @@ -874,12 +866,10 @@ if (DGV->getInitializer() != SInit) return Error(Err, "Global Variable Collision on '" + SGV->getName() + "': global variables have different initializers"); - } else if (DGV->hasLinkOnceLinkage() || DGV->hasWeakLinkage() || - DGV->hasCommonLinkage()) { + } else if (DGV->isWeakForLinker()) { // Nothing is required, mapped values will take the new global // automatically. - } else if (SGV->hasLinkOnceLinkage() || SGV->hasWeakLinkage() || - SGV->hasCommonLinkage()) { + } else if (SGV->isWeakForLinker()) { // Nothing is required, mapped values will take the new global // automatically. } else if (DGV->hasAppendingLinkage()) { @@ -952,10 +942,7 @@ // The only valid mappings are: // - SF is external declaration, which is effectively a no-op. // - SF is weak, when we just need to throw SF out. - if (!SF->isDeclaration() && - !SF->hasWeakLinkage() && - !SF->hasLinkOnceLinkage() && - !SF->hasCommonLinkage()) + if (!SF->isDeclaration() && !SF->isWeakForLinker()) return Error(Err, "Function-Alias Collision on '" + SF->getName() + "': symbol multiple defined"); @@ -1042,21 +1029,19 @@ } // At this point we know that DF has LinkOnce, Weak, or External* linkage. - if (SF->hasWeakLinkage() || SF->hasLinkOnceLinkage() || - SF->hasCommonLinkage()) { + if (SF->isWeakForLinker()) { ValueMap[SF] = MappedDF; // Linkonce+Weak = Weak // *+External Weak = * - if ((DF->hasLinkOnceLinkage() && + if ((DF->hasLinkOnceLinkage() && (SF->hasWeakLinkage() || SF->hasCommonLinkage())) || DF->hasExternalWeakLinkage()) DF->setLinkage(SF->getLinkage()); continue; } - if (DF->hasWeakLinkage() || DF->hasLinkOnceLinkage() || - DF->hasCommonLinkage()) { + if (DF->isWeakForLinker()) { // At this point we know that SF has LinkOnce or External* linkage. ValueMap[SF] = MappedDF; From asl at math.spbu.ru Sun Jul 6 05:13:18 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sun, 06 Jul 2008 10:13:18 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53159 - /llvm-gcc-4.2/trunk/gcc/genmodes.c Message-ID: <200807061013.m66ADI9N030394@zion.cs.uiuc.edu> Author: asl Date: Sun Jul 6 05:13:12 2008 New Revision: 53159 URL: http://llvm.org/viewvc/llvm-project?rev=53159&view=rev Log: Another workaround for bogus MS CRT Modified: llvm-gcc-4.2/trunk/gcc/genmodes.c Modified: llvm-gcc-4.2/trunk/gcc/genmodes.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/genmodes.c?rev=53159&r1=53158&r2=53159&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/genmodes.c (original) +++ llvm-gcc-4.2/trunk/gcc/genmodes.c Sun Jul 6 05:13:12 2008 @@ -822,8 +822,9 @@ for (c = 0; c < MAX_MODE_CLASS; c++) for (m = modes[c]; m; m = m->next) { - int count_; - printf (" %smode,%n", m->name, &count_); + /* LLVM LOCAL begin mainline */ + int count_ = printf (" %smode,", m->name); + /* LLVM LOCAL end mainline */ printf ("%*s/* %s:%d */\n", 27 - count_, "", trim_filename (m->file), m->line); } From dberlin at dberlin.org Sun Jul 6 13:06:17 2008 From: dberlin at dberlin.org (Daniel Berlin) Date: Sun, 6 Jul 2008 14:06:17 -0400 Subject: [llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c In-Reply-To: <68C77EF0-EE67-4E2F-825F-63C9810AB4BE@nondot.org> References: <200807040028.m640S8aJ030715@zion.cs.uiuc.edu> <535B97E5-3F37-4C31-AEB4-034CC594E922@apple.com> <1D0796DB-760A-4DA3-B93A-1BF76124552D@apple.com> <126ABF12-0185-4254-8D48-C56EDFC8D4D0@apple.com> <68C77EF0-EE67-4E2F-825F-63C9810AB4BE@nondot.org> Message-ID: <4aca3dc20807061106y521cea9mdb2f72c2027618e2@mail.gmail.com> > at we should not emit them: there > are many workarounds for real debugging hooks, and developers who have > ever used or cared about G++ 4.0 are already using them. This is true even inside gcc itself. Debug functions these days usually look like void debug_pre_expr (pre_expr); /* Like print_pre_expr but always prints to stderr. */ void debug_pre_expr (pre_expr e) { print_pre_expr (stderr, e); fprintf (stderr, "\n"); } to avoid exactly this problem. From asl at math.spbu.ru Sun Jul 6 15:37:03 2008 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sun, 06 Jul 2008 20:37:03 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r53162 - /llvm-gcc-4.2/trunk/gcc/config/sol2.h Message-ID: <200807062037.m66Kb4BY016315@zion.cs.uiuc.edu> Author: asl Date: Sun Jul 6 15:37:03 2008 New Revision: 53162 URL: http://llvm.org/viewvc/llvm-project?rev=53162&view=rev Log: Propagate relocation model for solaris. Patch by Nathan Keynes! Modified: llvm-gcc-4.2/trunk/gcc/config/sol2.h Modified: llvm-gcc-4.2/trunk/gcc/config/sol2.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/sol2.h?rev=53162&r1=53161&r2=53162&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/sol2.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/sol2.h Sun Jul 6 15:37:03 2008 @@ -243,3 +243,15 @@ /* Allow macro expansion in #pragma pack. */ #define HANDLE_PRAGMA_PACK_WITH_EXPANSION + +/* LLVM LOCAL begin */ +#ifdef ENABLE_LLVM + +/* Supporting PIC codegen for solaris targets */ +#define LLVM_SET_TARGET_OPTIONS(argvec) \ + if (flag_pic) \ + argvec.push_back ("--relocation-model=pic"); \ + else \ + argvec.push_back ("--relocation-model=static"); +#endif +/* LLVM LOCAL end */ From nicholas at mxc.ca Sun Jul 6 15:45:51 2008 From: nicholas at mxc.ca (Nick Lewycky) Date: Sun, 06 Jul 2008 20:45:51 -0000 Subject: [llvm-commits] [llvm] r53163 [1/7] - in /llvm/branches/non-call-eh: ./ autoconf/ bindings/ocaml/llvm/ docs/ docs/CommandGuide/ docs/tutorial/ examples/BrainF/ examples/Fibonacci/ examples/HowToUseJIT/ examples/ModuleMaker/ examples/ParallelJIT/ include/llvm-c/ include/llvm/ include/llvm/ADT/ include/llvm/Analysis/ include/llvm/Bitcode/ include/llvm/CodeGen/ include/llvm/Debugger/ include/llvm/ExecutionEngine/ include/llvm/Support/ include/llvm/System/ include/llvm/Target/ include/llvm/Transforms/ include/llvm/Transform... Message-ID: <200807062046.m66KkiNL018292@zion.cs.uiuc.edu> Author: nicholas Date: Sun Jul 6 15:45:41 2008 New Revision: 53163 URL: http://llvm.org/viewvc/llvm-project?rev=53163&view=rev Log: Merge head into the non-call-eh branch. Result doesn't build yet. Added: llvm/branches/non-call-eh/include/llvm/ADT/ImmutableList.h llvm/branches/non-call-eh/include/llvm/ADT/PriorityQueue.h llvm/branches/non-call-eh/include/llvm/ADT/ScopedHashTable.h llvm/branches/non-call-eh/include/llvm/ADT/StringSet.h llvm/branches/non-call-eh/include/llvm/ADT/hash_map.h.in llvm/branches/non-call-eh/include/llvm/ADT/hash_set.h.in llvm/branches/non-call-eh/include/llvm/ADT/ilist.h llvm/branches/non-call-eh/include/llvm/ADT/iterator llvm/branches/non-call-eh/include/llvm/ADT/iterator.h.in llvm/branches/non-call-eh/include/llvm/Analysis/LibCallAliasAnalysis.h llvm/branches/non-call-eh/include/llvm/Analysis/LibCallSemantics.h llvm/branches/non-call-eh/include/llvm/Analysis/LoopVR.h llvm/branches/non-call-eh/include/llvm/Analysis/SparsePropagation.h llvm/branches/non-call-eh/include/llvm/Analysis/ValueTracking.h llvm/branches/non-call-eh/include/llvm/CodeGen/DAGISelHeader.h llvm/branches/non-call-eh/include/llvm/CodeGen/LiveStackAnalysis.h llvm/branches/non-call-eh/include/llvm/OperandTraits.h llvm/branches/non-call-eh/include/llvm/System/Solaris.h llvm/branches/non-call-eh/include/llvm/Transforms/Utils/UnrollLoop.h llvm/branches/non-call-eh/lib/Analysis/LibCallAliasAnalysis.cpp llvm/branches/non-call-eh/lib/Analysis/LibCallSemantics.cpp llvm/branches/non-call-eh/lib/Analysis/LoopVR.cpp llvm/branches/non-call-eh/lib/Analysis/SparsePropagation.cpp llvm/branches/non-call-eh/lib/Analysis/ValueTracking.cpp llvm/branches/non-call-eh/lib/CodeGen/LiveStackAnalysis.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp llvm/branches/non-call-eh/lib/CodeGen/StackSlotColoring.cpp llvm/branches/non-call-eh/lib/Target/CppBackend/ (with props) llvm/branches/non-call-eh/lib/Target/CppBackend/CPPBackend.cpp llvm/branches/non-call-eh/lib/Target/CppBackend/CPPTargetMachine.h llvm/branches/non-call-eh/lib/Target/CppBackend/Makefile llvm/branches/non-call-eh/lib/Target/Mips/MipsInstrFPU.td llvm/branches/non-call-eh/lib/Target/PIC16/ (with props) llvm/branches/non-call-eh/lib/Target/PIC16/Makefile llvm/branches/non-call-eh/lib/Target/PIC16/PIC16.h llvm/branches/non-call-eh/lib/Target/PIC16/PIC16.td llvm/branches/non-call-eh/lib/Target/PIC16/PIC16AsmPrinter.cpp llvm/branches/non-call-eh/lib/Target/PIC16/PIC16CallingConv.td llvm/branches/non-call-eh/lib/Target/PIC16/PIC16ConstantPoolValue.cpp llvm/branches/non-call-eh/lib/Target/PIC16/PIC16ConstantPoolValue.h llvm/branches/non-call-eh/lib/Target/PIC16/PIC16ISelDAGToDAG.cpp llvm/branches/non-call-eh/lib/Target/PIC16/PIC16ISelLowering.cpp llvm/branches/non-call-eh/lib/Target/PIC16/PIC16ISelLowering.h llvm/branches/non-call-eh/lib/Target/PIC16/PIC16InstrFormats.td llvm/branches/non-call-eh/lib/Target/PIC16/PIC16InstrInfo.cpp llvm/branches/non-call-eh/lib/Target/PIC16/PIC16InstrInfo.h llvm/branches/non-call-eh/lib/Target/PIC16/PIC16InstrInfo.td llvm/branches/non-call-eh/lib/Target/PIC16/PIC16RegisterInfo.cpp llvm/branches/non-call-eh/lib/Target/PIC16/PIC16RegisterInfo.h llvm/branches/non-call-eh/lib/Target/PIC16/PIC16RegisterInfo.td llvm/branches/non-call-eh/lib/Target/PIC16/PIC16Subtarget.cpp llvm/branches/non-call-eh/lib/Target/PIC16/PIC16Subtarget.h llvm/branches/non-call-eh/lib/Target/PIC16/PIC16TargetAsmInfo.cpp llvm/branches/non-call-eh/lib/Target/PIC16/PIC16TargetAsmInfo.h llvm/branches/non-call-eh/lib/Target/PIC16/PIC16TargetMachine.cpp llvm/branches/non-call-eh/lib/Target/PIC16/PIC16TargetMachine.h llvm/branches/non-call-eh/lib/Transforms/Scalar/LoopDeletion.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/SimplifyCFGPass.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/SimplifyLibCalls.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/UnrollLoop.cpp llvm/branches/non-call-eh/lib/VMCore/Use.cpp llvm/branches/non-call-eh/test/Analysis/BasicAA/2008-06-02-GEPTailCrash.ll llvm/branches/non-call-eh/test/Analysis/BasicAA/no-escape-call.ll llvm/branches/non-call-eh/test/Analysis/PostDominators/ (with props) llvm/branches/non-call-eh/test/Analysis/PostDominators/2006-09-26-PostDominanceFrontier.ll llvm/branches/non-call-eh/test/Analysis/PostDominators/2007-04-17-PostDominanceFrontier.ll llvm/branches/non-call-eh/test/Analysis/PostDominators/2007-04-20-PostDom-Reset.ll llvm/branches/non-call-eh/test/Analysis/PostDominators/dg.exp llvm/branches/non-call-eh/test/Analysis/PostDominators/pr1098.ll llvm/branches/non-call-eh/test/Analysis/ScalarEvolution/2008-05-25-NegativeStepToZero.ll llvm/branches/non-call-eh/test/Analysis/ScalarEvolution/2008-06-12-BinomialInt64.ll llvm/branches/non-call-eh/test/Assembler/aggregate-constant-values.ll llvm/branches/non-call-eh/test/Assembler/aggregate-return-single-value.ll llvm/branches/non-call-eh/test/Assembler/huge-array.ll llvm/branches/non-call-eh/test/Assembler/insertextractvalue.ll llvm/branches/non-call-eh/test/Bitcode/sse2_loadl_pd.ll llvm/branches/non-call-eh/test/Bitcode/sse2_loadl_pd.ll.bc llvm/branches/non-call-eh/test/Bitcode/sse2_movs_d.ll llvm/branches/non-call-eh/test/Bitcode/sse2_movs_d.ll.bc llvm/branches/non-call-eh/test/Bitcode/sse2_punpck_qdq.ll llvm/branches/non-call-eh/test/Bitcode/sse2_punpck_qdq.ll.bc llvm/branches/non-call-eh/test/Bitcode/sse2_shuf_pd.ll llvm/branches/non-call-eh/test/Bitcode/sse2_shuf_pd.ll.bc llvm/branches/non-call-eh/test/Bitcode/sse2_unpck_pd.ll llvm/branches/non-call-eh/test/Bitcode/sse2_unpck_pd.ll.bc llvm/branches/non-call-eh/test/CodeGen/ARM/2008-05-19-LiveIntervalsBug.ll llvm/branches/non-call-eh/test/CodeGen/ARM/2008-05-19-ScavengerAssert.ll llvm/branches/non-call-eh/test/CodeGen/CBackend/2008-05-21-MRV-InlineAsm.ll llvm/branches/non-call-eh/test/CodeGen/CBackend/2008-05-31-BoolOverflow.ll llvm/branches/non-call-eh/test/CodeGen/CBackend/2008-06-04-IndirectMem.ll llvm/branches/non-call-eh/test/CodeGen/CellSPU/and_ops_more.ll llvm/branches/non-call-eh/test/CodeGen/Generic/getresult-undef.ll llvm/branches/non-call-eh/test/CodeGen/Generic/multiple-return-values-cross-block-with-invoke.ll llvm/branches/non-call-eh/test/CodeGen/Generic/select-cc.ll llvm/branches/non-call-eh/test/CodeGen/PowerPC/2008-04-23-CoalescerCrash.ll llvm/branches/non-call-eh/test/CodeGen/PowerPC/2008-05-01-ppc_fp128.ll llvm/branches/non-call-eh/test/CodeGen/PowerPC/2008-06-19-LegalizerCrash.ll llvm/branches/non-call-eh/test/CodeGen/PowerPC/2008-06-21-F128LoadStore.ll llvm/branches/non-call-eh/test/CodeGen/PowerPC/2008-06-23-LiveVariablesCrash.ll llvm/branches/non-call-eh/test/CodeGen/PowerPC/tailcall1-64.ll llvm/branches/non-call-eh/test/CodeGen/PowerPC/tailcall1.ll llvm/branches/non-call-eh/test/CodeGen/PowerPC/tailcallpic1.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-04-24-MemCpyBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-04-24-pblendw-fold-crash.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-04-26-Asm-Optimize-Imm.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-04-28-CoalescerBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-04-28-CyclicSchedUnit.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-05-01-InvalidOrdCompare.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-05-06-SpillerBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-05-09-PHIElimBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-05-09-ShuffleLoweringBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-05-12-tailmerge-5.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-05-21-CoalescerBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-05-22-FoldUnalignedLoad.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-05-28-CoalescerBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-05-28-LocalRegAllocBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-06-04-MemCpyLoweringBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-06-13-NotVolatileLoadStore.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-06-13-SpillerCommuting.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-06-13-VolatileLoadStore.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-06-16-SubregsBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-06-18-BadShuffle.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-06-25-VecISelBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/asm-indirect-mem.ll llvm/branches/non-call-eh/test/CodeGen/X86/atomic_op.ll llvm/branches/non-call-eh/test/CodeGen/X86/combine-lds.ll llvm/branches/non-call-eh/test/CodeGen/X86/commute-intrinsic.ll llvm/branches/non-call-eh/test/CodeGen/X86/extractelement-load.ll llvm/branches/non-call-eh/test/CodeGen/X86/fold-call.ll llvm/branches/non-call-eh/test/CodeGen/X86/inline-asm-mrv.ll llvm/branches/non-call-eh/test/CodeGen/X86/isnan.ll llvm/branches/non-call-eh/test/CodeGen/X86/isnan2.ll llvm/branches/non-call-eh/test/CodeGen/X86/memcpy-2.ll llvm/branches/non-call-eh/test/CodeGen/X86/memmove-4.ll llvm/branches/non-call-eh/test/CodeGen/X86/memset.ll llvm/branches/non-call-eh/test/CodeGen/X86/mmx-arg-passing.ll llvm/branches/non-call-eh/test/CodeGen/X86/mmx-arg-passing2.ll llvm/branches/non-call-eh/test/CodeGen/X86/pmul.ll llvm/branches/non-call-eh/test/CodeGen/X86/pr2326.ll llvm/branches/non-call-eh/test/CodeGen/X86/remat-mov0.ll llvm/branches/non-call-eh/test/CodeGen/X86/subclass-coalesce.ll llvm/branches/non-call-eh/test/CodeGen/X86/tailcallstack64.ll llvm/branches/non-call-eh/test/CodeGen/X86/twoaddr-remat.ll llvm/branches/non-call-eh/test/CodeGen/X86/uint_to_fp.ll llvm/branches/non-call-eh/test/CodeGen/X86/variadic-node-pic.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_insert-5.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_insert-6.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_insert_4.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_loadhl.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-C.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-D.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-E.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-F.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-G.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-H.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-I.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_shift3.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_shuffle-18.ll llvm/branches/non-call-eh/test/CodeGen/X86/vortex-bug.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-pic-1.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-pic-10.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-pic-11.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-pic-2.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-pic-3.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-pic-4.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-pic-5.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-pic-6.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-pic-7.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-pic-8.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-pic-9.ll llvm/branches/non-call-eh/test/CodeGen/X86/x86-64-sret-return.ll llvm/branches/non-call-eh/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll llvm/branches/non-call-eh/test/FrontendC/ (with props) llvm/branches/non-call-eh/test/FrontendC++/ (with props) llvm/branches/non-call-eh/test/FrontendC++/2003-08-20-ExceptionFail.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-08-21-EmptyClass.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-08-24-Cleanup.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-08-27-TypeNamespaces.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-08-28-ForwardType.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-08-28-SaveExprBug.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-08-29-ArgPassingBug.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-08-31-StructLayout.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-09-22-CompositeExprValue.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-09-29-ArgumentNumberMismatch.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-09-30-CommaExprBug.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-09-30-ForIncrementExprBug.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-09-30-ForIncrementExprBug2.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-09-30-NestedFunctionDecl.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-10-17-BoolBitfields.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-10-21-InnerClass.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-10-27-VirtualBaseClassCrash.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-11-02-WeakLinkage.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-11-04-ArrayConstructors.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-11-04-CatchLabelName.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-11-08-ArrayAddress.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-11-09-ConstructorTypeSafety.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-11-18-EnumArray.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-11-18-MemberInitializationCasting.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-11-18-PtrMemConstantInitializer.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-11-25-ReturningOpaqueByValue.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-11-27-MultipleInheritanceThunk.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-11-29-DuplicatedCleanupTest.cpp llvm/branches/non-call-eh/test/FrontendC++/2003-12-08-ArrayOfPtrToMemberFunc.cpp llvm/branches/non-call-eh/test/FrontendC++/2004-01-11-DynamicInitializedConstant.cpp llvm/branches/non-call-eh/test/FrontendC++/2004-03-08-ReinterpretCastCopy.cpp llvm/branches/non-call-eh/test/FrontendC++/2004-03-09-UnmangledBuiltinMethods.cpp llvm/branches/non-call-eh/test/FrontendC++/2004-03-15-CleanupsAndGotos.cpp llvm/branches/non-call-eh/test/FrontendC++/2004-06-08-LateTemplateInstantiation.cpp llvm/branches/non-call-eh/test/FrontendC++/2004-09-27-CompilerCrash.cpp llvm/branches/non-call-eh/test/FrontendC++/2004-09-27-DidntEmitTemplate.cpp llvm/branches/non-call-eh/test/FrontendC++/2004-11-27-EmitsUnusedInlineFunctions.cpp llvm/branches/non-call-eh/test/FrontendC++/2004-11-27-ExceptionCleanupAssertion.cpp llvm/branches/non-call-eh/test/FrontendC++/2004-11-27-FriendDefaultArgCrash.cpp llvm/branches/non-call-eh/test/FrontendC++/2004-11-27-InlineAsmFunctionRedefinition.cpp llvm/branches/non-call-eh/test/FrontendC++/2005-01-03-StaticInitializers.cpp llvm/branches/non-call-eh/test/FrontendC++/2005-02-11-AnonymousUnion.cpp llvm/branches/non-call-eh/test/FrontendC++/2005-02-13-BadDynamicInit.cpp llvm/branches/non-call-eh/test/FrontendC++/2005-02-14-BitFieldOffset.cpp llvm/branches/non-call-eh/test/FrontendC++/2005-02-19-BitfieldStructCrash.cpp llvm/branches/non-call-eh/test/FrontendC++/2005-02-19-UnnamedVirtualThunkArgument.cpp llvm/branches/non-call-eh/test/FrontendC++/2005-02-20-BrokenReferenceTest.cpp llvm/branches/non-call-eh/test/FrontendC++/2005-02-27-PlacementArrayNewCrash.cpp llvm/branches/non-call-eh/test/FrontendC++/2005-07-21-VirtualBaseAccess.cpp llvm/branches/non-call-eh/test/FrontendC++/2006-03-01-GimplifyCrash.cpp llvm/branches/non-call-eh/test/FrontendC++/2006-03-06-C++RecurseCrash.cpp llvm/branches/non-call-eh/test/FrontendC++/2006-09-08-powi.cpp llvm/branches/non-call-eh/test/FrontendC++/2006-09-12-OpaqueStructCrash.cpp llvm/branches/non-call-eh/test/FrontendC++/2006-09-27-Debug-Protection.cpp llvm/branches/non-call-eh/test/FrontendC++/2006-10-30-ClassBitfield.cpp llvm/branches/non-call-eh/test/FrontendC++/2006-11-06-StackTrace.cpp llvm/branches/non-call-eh/test/FrontendC++/2006-11-20-GlobalSymbols.cpp llvm/branches/non-call-eh/test/FrontendC++/2006-11-30-ConstantExprCrash.cpp llvm/branches/non-call-eh/test/FrontendC++/2006-11-30-NoCompileUnit.cpp llvm/branches/non-call-eh/test/FrontendC++/2006-11-30-Pubnames.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-01-02-UnboundedArray.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-01-06-ELF-Thunk-Sections.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-01-06-PtrMethodInit.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-03-27-FunctionVarRename.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-04-05-PackedBitFields-1.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap-2.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-04-05-PackedBitFieldsOverlap.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-04-05-PackedBitFieldsSmall.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-04-05-StructPackedFieldUnpacked.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-04-10-PackedUnion.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-04-11-InlineStorageClassC++.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-04-14-FNoBuiltin.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-04-31-TryCatch.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-05-03-VectorInit.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-05-16-ReverseBitFieldCrash.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-05-23-TryFinally.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-07-04-NestedCatches.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-07-29-RestrictPtrArg.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-07-29-RestrictRefArg.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-08-01-RestrictMethod.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-09-10-RecursiveTypeResolution.cpp llvm/branches/non-call-eh/test/FrontendC++/2007-10-01-StructResize.cpp llvm/branches/non-call-eh/test/FrontendC++/2008-01-11-BadWarning.cpp llvm/branches/non-call-eh/test/FrontendC++/2008-01-12-VecInit.cpp llvm/branches/non-call-eh/test/FrontendC++/2008-02-13-sret.cpp llvm/branches/non-call-eh/test/FrontendC++/2008-05-07-CrazyOffsetOf.cpp llvm/branches/non-call-eh/test/FrontendC++/dg.exp llvm/branches/non-call-eh/test/FrontendC++/ptr-to-method-devirt.cpp llvm/branches/non-call-eh/test/FrontendC/2002-01-23-LoadQISIReloadFailure.c llvm/branches/non-call-eh/test/FrontendC/2002-01-24-ComplexSpaceInType.c llvm/branches/non-call-eh/test/FrontendC/2002-01-24-HandleCallInsnSEGV.c llvm/branches/non-call-eh/test/FrontendC/2002-02-13-ConditionalInCall.c llvm/branches/non-call-eh/test/FrontendC/2002-02-13-ReloadProblem.c llvm/branches/non-call-eh/test/FrontendC/2002-02-13-TypeVarNameCollision.c llvm/branches/non-call-eh/test/FrontendC/2002-02-13-UnnamedLocal.c llvm/branches/non-call-eh/test/FrontendC/2002-02-14-EntryNodePreds.c llvm/branches/non-call-eh/test/FrontendC/2002-02-16-RenamingTest.c llvm/branches/non-call-eh/test/FrontendC/2002-02-17-ArgumentAddress.c llvm/branches/non-call-eh/test/FrontendC/2002-02-18-64bitConstant.c llvm/branches/non-call-eh/test/FrontendC/2002-02-18-StaticData.c llvm/branches/non-call-eh/test/FrontendC/2002-03-11-LargeCharInString.c llvm/branches/non-call-eh/test/FrontendC/2002-03-12-ArrayInitialization.c llvm/branches/non-call-eh/test/FrontendC/2002-03-12-StructInitialize.c llvm/branches/non-call-eh/test/FrontendC/2002-03-12-StructInitializer.c llvm/branches/non-call-eh/test/FrontendC/2002-03-14-BrokenPHINode.c llvm/branches/non-call-eh/test/FrontendC/2002-03-14-BrokenSSA.c llvm/branches/non-call-eh/test/FrontendC/2002-03-14-QuotesInStrConst.c llvm/branches/non-call-eh/test/FrontendC/2002-04-07-SwitchStmt.c llvm/branches/non-call-eh/test/FrontendC/2002-04-08-LocalArray.c llvm/branches/non-call-eh/test/FrontendC/2002-04-09-StructRetVal.c llvm/branches/non-call-eh/test/FrontendC/2002-04-10-StructParameters.c llvm/branches/non-call-eh/test/FrontendC/2002-05-23-StaticValues.c llvm/branches/non-call-eh/test/FrontendC/2002-05-23-TypeNameCollision.c llvm/branches/non-call-eh/test/FrontendC/2002-05-24-Alloca.c llvm/branches/non-call-eh/test/FrontendC/2002-06-25-FWriteInterfaceFailure.c llvm/branches/non-call-eh/test/FrontendC/2002-07-14-MiscListTests.c llvm/branches/non-call-eh/test/FrontendC/2002-07-14-MiscTests.c llvm/branches/non-call-eh/test/FrontendC/2002-07-14-MiscTests2.c llvm/branches/non-call-eh/test/FrontendC/2002-07-14-MiscTests3.c llvm/branches/non-call-eh/test/FrontendC/2002-07-16-HardStringInit.c llvm/branches/non-call-eh/test/FrontendC/2002-07-17-StringConstant.c llvm/branches/non-call-eh/test/FrontendC/2002-07-29-Casts.c llvm/branches/non-call-eh/test/FrontendC/2002-07-30-SubregSetAssertion.c llvm/branches/non-call-eh/test/FrontendC/2002-07-30-UnionTest.c llvm/branches/non-call-eh/test/FrontendC/2002-07-30-VarArgsCallFailure.c llvm/branches/non-call-eh/test/FrontendC/2002-07-31-BadAssert.c llvm/branches/non-call-eh/test/FrontendC/2002-07-31-SubregFailure.c llvm/branches/non-call-eh/test/FrontendC/2002-08-02-UnionTest.c llvm/branches/non-call-eh/test/FrontendC/2002-08-19-RecursiveLocals.c llvm/branches/non-call-eh/test/FrontendC/2002-09-08-PointerShifts.c llvm/branches/non-call-eh/test/FrontendC/2002-09-18-UnionProblem.c llvm/branches/non-call-eh/test/FrontendC/2002-09-19-StarInLabel.c llvm/branches/non-call-eh/test/FrontendC/2002-10-12-TooManyArguments.c llvm/branches/non-call-eh/test/FrontendC/2002-12-15-GlobalBoolTest.c llvm/branches/non-call-eh/test/FrontendC/2002-12-15-GlobalConstantTest.c llvm/branches/non-call-eh/test/FrontendC/2002-12-15-GlobalRedefinition.c llvm/branches/non-call-eh/test/FrontendC/2002-12-15-StructParameters.c llvm/branches/non-call-eh/test/FrontendC/2003-01-30-UnionInit.c llvm/branches/non-call-eh/test/FrontendC/2003-03-03-DeferredType.c llvm/branches/non-call-eh/test/FrontendC/2003-06-22-UnionCrash.c llvm/branches/non-call-eh/test/FrontendC/2003-06-23-GCC-fold-infinite-recursion.c llvm/branches/non-call-eh/test/FrontendC/2003-06-26-CFECrash.c llvm/branches/non-call-eh/test/FrontendC/2003-06-29-MultipleFunctionDefinition.c llvm/branches/non-call-eh/test/FrontendC/2003-07-22-ArrayAccessTypeSafety.c llvm/branches/non-call-eh/test/FrontendC/2003-08-06-BuiltinSetjmpLongjmp.c llvm/branches/non-call-eh/test/FrontendC/2003-08-17-DeadCodeShortCircuit.c llvm/branches/non-call-eh/test/FrontendC/2003-08-18-SigSetJmp.c llvm/branches/non-call-eh/test/FrontendC/2003-08-18-StructAsValue.c llvm/branches/non-call-eh/test/FrontendC/2003-08-20-BadBitfieldRef.c llvm/branches/non-call-eh/test/FrontendC/2003-08-20-PrototypeMismatch.c llvm/branches/non-call-eh/test/FrontendC/2003-08-20-vfork-bug.c llvm/branches/non-call-eh/test/FrontendC/2003-08-21-BinOp-Type-Mismatch.c llvm/branches/non-call-eh/test/FrontendC/2003-08-21-StmtExpr.c llvm/branches/non-call-eh/test/FrontendC/2003-08-21-WideString.c llvm/branches/non-call-eh/test/FrontendC/2003-08-23-LocalUnionTest.c llvm/branches/non-call-eh/test/FrontendC/2003-08-29-BitFieldStruct.c llvm/branches/non-call-eh/test/FrontendC/2003-08-29-HugeCharConst.c llvm/branches/non-call-eh/test/FrontendC/2003-08-29-StructLayoutBug.c llvm/branches/non-call-eh/test/FrontendC/2003-08-30-AggregateInitializer.c llvm/branches/non-call-eh/test/FrontendC/2003-08-30-LargeIntegerBitfieldMember.c llvm/branches/non-call-eh/test/FrontendC/2003-09-18-BitfieldTests.c llvm/branches/non-call-eh/test/FrontendC/2003-09-30-StructLayout.c llvm/branches/non-call-eh/test/FrontendC/2003-10-02-UnionLValueError.c llvm/branches/non-call-eh/test/FrontendC/2003-10-06-NegateExprType.c llvm/branches/non-call-eh/test/FrontendC/2003-10-09-UnionInitializerBug.c llvm/branches/non-call-eh/test/FrontendC/2003-10-28-ident.c llvm/branches/non-call-eh/test/FrontendC/2003-10-29-AsmRename.c llvm/branches/non-call-eh/test/FrontendC/2003-11-01-C99-CompoundLiteral.c llvm/branches/non-call-eh/test/FrontendC/2003-11-01-EmptyStructCrash.c llvm/branches/non-call-eh/test/FrontendC/2003-11-01-GlobalUnionInit.c llvm/branches/non-call-eh/test/FrontendC/2003-11-03-AddrArrayElement.c llvm/branches/non-call-eh/test/FrontendC/2003-11-04-EmptyStruct.c llvm/branches/non-call-eh/test/FrontendC/2003-11-04-OutOfMemory.c llvm/branches/non-call-eh/test/FrontendC/2003-11-08-PointerSubNotGetelementptr.c llvm/branches/non-call-eh/test/FrontendC/2003-11-12-VoidString.c llvm/branches/non-call-eh/test/FrontendC/2003-11-13-TypeSafety.c llvm/branches/non-call-eh/test/FrontendC/2003-11-16-StaticArrayInit.c llvm/branches/non-call-eh/test/FrontendC/2003-11-18-CondExprLValue.c llvm/branches/non-call-eh/test/FrontendC/2003-11-19-AddressOfRegister.c llvm/branches/non-call-eh/test/FrontendC/2003-11-19-BitFieldArray.c llvm/branches/non-call-eh/test/FrontendC/2003-11-20-Bitfields.c llvm/branches/non-call-eh/test/FrontendC/2003-11-20-ComplexDivision.c llvm/branches/non-call-eh/test/FrontendC/2003-11-20-UnionBitfield.c llvm/branches/non-call-eh/test/FrontendC/2003-11-26-PointerShift.c llvm/branches/non-call-eh/test/FrontendC/2003-11-27-ConstructorCast.c llvm/branches/non-call-eh/test/FrontendC/2003-11-27-UnionCtorInitialization.c llvm/branches/non-call-eh/test/FrontendC/2003-12-14-ExternInlineSupport.c llvm/branches/non-call-eh/test/FrontendC/2004-01-01-UnknownInitSize.c llvm/branches/non-call-eh/test/FrontendC/2004-01-08-ExternInlineRedefine.c llvm/branches/non-call-eh/test/FrontendC/2004-02-12-LargeAggregateCopy.c llvm/branches/non-call-eh/test/FrontendC/2004-02-13-BuiltinFrameReturnAddress.c llvm/branches/non-call-eh/test/FrontendC/2004-02-13-IllegalVararg.c llvm/branches/non-call-eh/test/FrontendC/2004-02-13-Memset.c llvm/branches/non-call-eh/test/FrontendC/2004-02-14-ZeroInitializer.c llvm/branches/non-call-eh/test/FrontendC/2004-02-20-Builtins.c llvm/branches/non-call-eh/test/FrontendC/2004-03-07-ComplexDivEquals.c llvm/branches/non-call-eh/test/FrontendC/2004-03-07-ExternalConstant.c llvm/branches/non-call-eh/test/FrontendC/2004-03-09-LargeArrayInitializers.c llvm/branches/non-call-eh/test/FrontendC/2004-03-15-SimpleIndirectGoto.c llvm/branches/non-call-eh/test/FrontendC/2004-03-16-AsmRegisterCrash.c llvm/branches/non-call-eh/test/FrontendC/2004-05-07-VarArrays.c llvm/branches/non-call-eh/test/FrontendC/2004-05-21-IncompleteEnum.c llvm/branches/non-call-eh/test/FrontendC/2004-06-08-OpaqueStructArg.c llvm/branches/non-call-eh/test/FrontendC/2004-06-17-UnorderedBuiltins.c llvm/branches/non-call-eh/test/FrontendC/2004-06-17-UnorderedCompares.c llvm/branches/non-call-eh/test/FrontendC/2004-06-18-VariableLengthArrayOfStructures.c llvm/branches/non-call-eh/test/FrontendC/2004-07-06-FunctionCast.c llvm/branches/non-call-eh/test/FrontendC/2004-08-06-LargeStructTest.c llvm/branches/non-call-eh/test/FrontendC/2004-11-25-UnnamedBitfieldPadding.c llvm/branches/non-call-eh/test/FrontendC/2004-11-27-InvalidConstantExpr.c llvm/branches/non-call-eh/test/FrontendC/2004-11-27-StaticFunctionRedeclare.c llvm/branches/non-call-eh/test/FrontendC/2004-11-27-VariableSizeInStructure.c llvm/branches/non-call-eh/test/FrontendC/2005-01-02-ConstantInits.c llvm/branches/non-call-eh/test/FrontendC/2005-01-02-PointerDifference.c llvm/branches/non-call-eh/test/FrontendC/2005-01-02-VAArgError-ICE.c llvm/branches/non-call-eh/test/FrontendC/2005-02-20-AggregateSAVEEXPR.c llvm/branches/non-call-eh/test/FrontendC/2005-02-27-MarkGlobalConstant.c llvm/branches/non-call-eh/test/FrontendC/2005-03-05-OffsetOfHack.c llvm/branches/non-call-eh/test/FrontendC/2005-03-06-OffsetOfStructCrash.c llvm/branches/non-call-eh/test/FrontendC/2005-03-11-Prefetch.c llvm/branches/non-call-eh/test/FrontendC/2005-04-09-ComplexOps.c llvm/branches/non-call-eh/test/FrontendC/2005-05-06-CountBuiltins.c llvm/branches/non-call-eh/test/FrontendC/2005-05-10-GlobalUnionInit.c llvm/branches/non-call-eh/test/FrontendC/2005-06-15-ExpandGotoInternalProblem.c llvm/branches/non-call-eh/test/FrontendC/2005-07-20-SqrtNoErrno.c llvm/branches/non-call-eh/test/FrontendC/2005-07-26-UnionInitCrash.c llvm/branches/non-call-eh/test/FrontendC/2005-07-28-IncorrectWeakGlobal.c llvm/branches/non-call-eh/test/FrontendC/2005-09-20-ComplexConstants.c llvm/branches/non-call-eh/test/FrontendC/2005-09-24-AsmUserPrefix.c llvm/branches/non-call-eh/test/FrontendC/2005-09-24-BitFieldCrash.c llvm/branches/non-call-eh/test/FrontendC/2005-10-18-VariableSizedElementCrash.c llvm/branches/non-call-eh/test/FrontendC/2005-12-04-AttributeUsed.c llvm/branches/non-call-eh/test/FrontendC/2005-12-04-DeclarationLineNumbers.c llvm/branches/non-call-eh/test/FrontendC/2006-01-13-Includes.c llvm/branches/non-call-eh/test/FrontendC/2006-01-13-StackSave.c llvm/branches/non-call-eh/test/FrontendC/2006-01-16-BitCountIntrinsicsUnsigned.c llvm/branches/non-call-eh/test/FrontendC/2006-01-23-FileScopeAsm.c llvm/branches/non-call-eh/test/FrontendC/2006-03-03-MissingInitializer.c llvm/branches/non-call-eh/test/FrontendC/2006-03-16-VectorCtor.c llvm/branches/non-call-eh/test/FrontendC/2006-03-17-KnRMismatch.c llvm/branches/non-call-eh/test/FrontendC/2006-05-01-AppleAlignmentPragma.c llvm/branches/non-call-eh/test/FrontendC/2006-05-19-SingleEltReturn.c llvm/branches/non-call-eh/test/FrontendC/2006-07-31-PR854.c llvm/branches/non-call-eh/test/FrontendC/2006-09-11-BitfieldRefCrash.c llvm/branches/non-call-eh/test/FrontendC/2006-09-18-fwrite-cast-crash.c llvm/branches/non-call-eh/test/FrontendC/2006-09-21-IncompleteElementType.c llvm/branches/non-call-eh/test/FrontendC/2006-09-25-DebugFilename.c llvm/branches/non-call-eh/test/FrontendC/2006-09-25-DebugFilename.h llvm/branches/non-call-eh/test/FrontendC/2006-09-28-SimpleAsm.c llvm/branches/non-call-eh/test/FrontendC/2006-10-30-ArrayCrash.c llvm/branches/non-call-eh/test/FrontendC/2006-12-14-ordered_expr.c llvm/branches/non-call-eh/test/FrontendC/2007-01-06-KNR-Proto.c llvm/branches/non-call-eh/test/FrontendC/2007-01-20-VectorICE.c llvm/branches/non-call-eh/test/FrontendC/2007-01-24-InlineAsmCModifier.c llvm/branches/non-call-eh/test/FrontendC/2007-02-04-AddrLValue-2.c llvm/branches/non-call-eh/test/FrontendC/2007-02-04-AddrLValue.c llvm/branches/non-call-eh/test/FrontendC/2007-02-04-EmptyStruct.c llvm/branches/non-call-eh/test/FrontendC/2007-02-04-WITH_SIZE_EXPR.c llvm/branches/non-call-eh/test/FrontendC/2007-02-05-nested.c llvm/branches/non-call-eh/test/FrontendC/2007-02-07-AddrLabel.c llvm/branches/non-call-eh/test/FrontendC/2007-02-16-VariableSizeStructArg.c llvm/branches/non-call-eh/test/FrontendC/2007-02-16-VoidPtrDiff.c llvm/branches/non-call-eh/test/FrontendC/2007-02-16-WritableStrings.c llvm/branches/non-call-eh/test/FrontendC/2007-02-25-C-DotDotDot.c llvm/branches/non-call-eh/test/FrontendC/2007-03-01-VarSizeArrayIdx.c llvm/branches/non-call-eh/test/FrontendC/2007-03-05-DataLayout.c llvm/branches/non-call-eh/test/FrontendC/2007-03-06-VarSizeInStruct1.c llvm/branches/non-call-eh/test/FrontendC/2007-03-06-VarSizeInStruct2.c llvm/branches/non-call-eh/test/FrontendC/2007-03-26-BitfieldAfterZeroWidth.c llvm/branches/non-call-eh/test/FrontendC/2007-03-26-ZeroWidthBitfield.c llvm/branches/non-call-eh/test/FrontendC/2007-03-27-ArrayCompatible.c llvm/branches/non-call-eh/test/FrontendC/2007-03-27-VarLengthArray.c llvm/branches/non-call-eh/test/FrontendC/2007-04-05-PackedBitFields-2.c llvm/branches/non-call-eh/test/FrontendC/2007-04-05-PackedBitFields.c llvm/branches/non-call-eh/test/FrontendC/2007-04-05-PackedStruct.c llvm/branches/non-call-eh/test/FrontendC/2007-04-05-PadBeforeZeroLengthField.c llvm/branches/non-call-eh/test/FrontendC/2007-04-05-UnPackedStruct.c llvm/branches/non-call-eh/test/FrontendC/2007-04-11-InlineAsmStruct.c llvm/branches/non-call-eh/test/FrontendC/2007-04-11-InlineAsmUnion.c llvm/branches/non-call-eh/test/FrontendC/2007-04-11-InlineStorageClassC89.c llvm/branches/non-call-eh/test/FrontendC/2007-04-11-InlineStorageClassC99.c llvm/branches/non-call-eh/test/FrontendC/2007-04-11-PR1321.c llvm/branches/non-call-eh/test/FrontendC/2007-04-13-InlineAsmStruct2.c llvm/branches/non-call-eh/test/FrontendC/2007-04-13-InlineAsmUnion2.c llvm/branches/non-call-eh/test/FrontendC/2007-04-14-FNoBuiltin.c llvm/branches/non-call-eh/test/FrontendC/2007-04-17-ZeroSizeBitFields.c llvm/branches/non-call-eh/test/FrontendC/2007-04-24-VolatileStructCopy.c llvm/branches/non-call-eh/test/FrontendC/2007-04-24-bit-not-expr.c llvm/branches/non-call-eh/test/FrontendC/2007-04-24-str-const.c llvm/branches/non-call-eh/test/FrontendC/2007-05-07-NestedStructReturn.c llvm/branches/non-call-eh/test/FrontendC/2007-05-07-PaddingElements.c llvm/branches/non-call-eh/test/FrontendC/2007-05-08-PCH.c llvm/branches/non-call-eh/test/FrontendC/2007-05-11-str-const.c llvm/branches/non-call-eh/test/FrontendC/2007-05-15-PaddingElement.c llvm/branches/non-call-eh/test/FrontendC/2007-05-16-EmptyStruct.c llvm/branches/non-call-eh/test/FrontendC/2007-05-29-UnionCopy.c llvm/branches/non-call-eh/test/FrontendC/2007-06-05-NoInlineAttribute.c llvm/branches/non-call-eh/test/FrontendC/2007-06-15-AnnotateAttribute.c llvm/branches/non-call-eh/test/FrontendC/2007-06-18-SextAttrAggregate.c llvm/branches/non-call-eh/test/FrontendC/2007-07-29-RestrictPtrArg.c llvm/branches/non-call-eh/test/FrontendC/2007-08-01-LoadStoreAlign.c llvm/branches/non-call-eh/test/FrontendC/2007-08-21-ComplexCst.c llvm/branches/non-call-eh/test/FrontendC/2007-08-22-CTTZ.c llvm/branches/non-call-eh/test/FrontendC/2007-09-05-ConstCtor.c llvm/branches/non-call-eh/test/FrontendC/2007-09-12-PragmaPack.c llvm/branches/non-call-eh/test/FrontendC/2007-09-14-NegatePointer.c llvm/branches/non-call-eh/test/FrontendC/2007-09-17-WeakRef.c llvm/branches/non-call-eh/test/FrontendC/2007-09-20-GcrootAttribute.c llvm/branches/non-call-eh/test/FrontendC/2007-09-26-Alignment.c llvm/branches/non-call-eh/test/FrontendC/2007-09-27-ComplexIntCompare.c llvm/branches/non-call-eh/test/FrontendC/2007-09-28-PackedUnionMember.c llvm/branches/non-call-eh/test/FrontendC/2007-10-01-BuildArrayRef.c llvm/branches/non-call-eh/test/FrontendC/2007-10-02-VolatileArray.c llvm/branches/non-call-eh/test/FrontendC/2007-10-15-VoidPtr.c llvm/branches/non-call-eh/test/FrontendC/2007-10-30-Volatile.c llvm/branches/non-call-eh/test/FrontendC/2007-11-07-AlignedMemcpy.c llvm/branches/non-call-eh/test/FrontendC/2007-11-07-CopyAggregateAlign.c llvm/branches/non-call-eh/test/FrontendC/2007-11-07-ZeroAggregateAlign.c llvm/branches/non-call-eh/test/FrontendC/2007-11-27-SExtZExt.c llvm/branches/non-call-eh/test/FrontendC/2007-11-28-GlobalInitializer.c llvm/branches/non-call-eh/test/FrontendC/2007-12-16-AsmNoUnwind.c llvm/branches/non-call-eh/test/FrontendC/2007-12-VarArrayDebug.c llvm/branches/non-call-eh/test/FrontendC/2008-01-04-WideBitfield.c llvm/branches/non-call-eh/test/FrontendC/2008-01-07-UnusualIntSize.c llvm/branches/non-call-eh/test/FrontendC/2008-01-11-ChainConsistency.c llvm/branches/non-call-eh/test/FrontendC/2008-01-21-PackedBitFields.c llvm/branches/non-call-eh/test/FrontendC/2008-01-21-PackedStructField.c llvm/branches/non-call-eh/test/FrontendC/2008-01-24-StructAlignAndBitFields.c llvm/branches/non-call-eh/test/FrontendC/2008-01-25-ByValReadNone.c llvm/branches/non-call-eh/test/FrontendC/2008-01-25-ZeroSizedAggregate.c llvm/branches/non-call-eh/test/FrontendC/2008-01-28-PragmaMark.c llvm/branches/non-call-eh/test/FrontendC/2008-01-28-UnionSize.c llvm/branches/non-call-eh/test/FrontendC/2008-02-11-AnnotateBuiltin.c llvm/branches/non-call-eh/test/FrontendC/2008-03-03-CtorAttrType.c llvm/branches/non-call-eh/test/FrontendC/2008-03-05-syncPtr.c llvm/branches/non-call-eh/test/FrontendC/2008-03-24-BitField-And-Alloca.c llvm/branches/non-call-eh/test/FrontendC/2008-03-26-PackedBitFields.c llvm/branches/non-call-eh/test/FrontendC/2008-04-08-NoExceptions.c llvm/branches/non-call-eh/test/FrontendC/2008-05-06-CFECrash.c llvm/branches/non-call-eh/test/FrontendC/2008-05-12-TempUsedBeforeDef.c llvm/branches/non-call-eh/test/FrontendC/2008-05-19-AlwaysInline.c llvm/branches/non-call-eh/test/FrontendC/BasicInstrs.c llvm/branches/non-call-eh/test/FrontendC/attribute_constructor.c llvm/branches/non-call-eh/test/FrontendC/block-copy.c llvm/branches/non-call-eh/test/FrontendC/dg.exp llvm/branches/non-call-eh/test/FrontendC/exact-div-expr.c llvm/branches/non-call-eh/test/FrontendC/extern-weak.c llvm/branches/non-call-eh/test/FrontendC/funccall.c llvm/branches/non-call-eh/test/FrontendC/hidden-visibility.c llvm/branches/non-call-eh/test/FrontendC/inline-asm-mrv.c llvm/branches/non-call-eh/test/FrontendC/libcalls.c llvm/branches/non-call-eh/test/FrontendC/nested-functions.c llvm/branches/non-call-eh/test/FrontendC/sret.c llvm/branches/non-call-eh/test/FrontendC/sret2.c llvm/branches/non-call-eh/test/FrontendC/unaligned-memcpy.c llvm/branches/non-call-eh/test/FrontendFortran/ llvm/branches/non-call-eh/test/FrontendFortran/cpow.f90 llvm/branches/non-call-eh/test/FrontendFortran/dg.exp llvm/branches/non-call-eh/test/LLVMC/ (with props) llvm/branches/non-call-eh/test/LLVMC/dg.exp llvm/branches/non-call-eh/test/LLVMC/false.c llvm/branches/non-call-eh/test/LLVMC/hello.c llvm/branches/non-call-eh/test/LLVMC/hello.cpp llvm/branches/non-call-eh/test/LLVMC/opt-test.c llvm/branches/non-call-eh/test/LLVMC/sink.c llvm/branches/non-call-eh/test/LLVMC/test_data/ llvm/branches/non-call-eh/test/LLVMC/test_data/false.cpp llvm/branches/non-call-eh/test/LLVMC/test_data/false2.cpp llvm/branches/non-call-eh/test/LLVMC/test_data/together.c llvm/branches/non-call-eh/test/LLVMC/together.cpp llvm/branches/non-call-eh/test/LLVMC/wall.c llvm/branches/non-call-eh/test/Linker/2008-06-13-LinkOnceRedefinition.ll llvm/branches/non-call-eh/test/Linker/2008-06-26-AddressSpace.ll llvm/branches/non-call-eh/test/Other/2008-06-04-FieldSizeInPacked.ll llvm/branches/non-call-eh/test/Transforms/DeadArgElim/2008-06-23-DeadAfterLive.ll llvm/branches/non-call-eh/test/Transforms/DeadArgElim/keepalive.ll llvm/branches/non-call-eh/test/Transforms/DeadArgElim/multdeadretval.ll llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/volatile-load.ll llvm/branches/non-call-eh/test/Transforms/GVN/2008-07-02-Unreachable.ll llvm/branches/non-call-eh/test/Transforms/GVN/local-pre.ll llvm/branches/non-call-eh/test/Transforms/GVN/nonlocal-cse.ll llvm/branches/non-call-eh/test/Transforms/GlobalOpt/2008-04-26-SROA-Global-Align.ll llvm/branches/non-call-eh/test/Transforms/IPConstantProp/2008-06-09-WeakProp.ll llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-argument.ll llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2008-06-15-SCEVExpanderBug.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-22-ByValBitcast.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-28-VolatileStore.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-29-VolatileLoadDontMerge.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-04-29-VolatileLoadMerge.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-08-LiveStoreDelete.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-08-StrLenSink.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-09-SinkOfInvoke.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-17-InfLoop.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-18-FoldIntToPtr.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-22-IDivVector.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-22-NegValVector.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-23-CompareFold.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-31-AddBool.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-05-31-Bools.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-08-ICmpPHI.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-13-InfiniteLoopStore.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-13-ReadOnlyCallStore.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-19-UncondLoad.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-21-CompareMiscomp.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-06-24-StackRestore.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/add-shrink.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/add-sitofp.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/cast-mul-select.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/extractvalue.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/fp-ret-bitcast.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/getelementptr-seteq.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/memset.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/mul-masked-bits.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/sext-misc.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/shl-icmp.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/sitofp.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/srem-simplify-bug.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/udiv-simplify-bug-0.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/udiv-simplify-bug-1.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/urem-simplify-bug.ll llvm/branches/non-call-eh/test/Transforms/Internalize/ (with props) llvm/branches/non-call-eh/test/Transforms/Internalize/2008-05-09-AllButMain.ll llvm/branches/non-call-eh/test/Transforms/Internalize/2008-05-09-AllButMain.ll.apifile llvm/branches/non-call-eh/test/Transforms/Internalize/dg.exp llvm/branches/non-call-eh/test/Transforms/JumpThreading/ (with props) llvm/branches/non-call-eh/test/Transforms/JumpThreading/2008-04-24-InfLoop.ll llvm/branches/non-call-eh/test/Transforms/JumpThreading/2008-05-05-MRV-Crash.ll llvm/branches/non-call-eh/test/Transforms/JumpThreading/and-and-cond.ll llvm/branches/non-call-eh/test/Transforms/JumpThreading/and-cond.ll llvm/branches/non-call-eh/test/Transforms/JumpThreading/basic.ll llvm/branches/non-call-eh/test/Transforms/JumpThreading/compare.ll llvm/branches/non-call-eh/test/Transforms/JumpThreading/dg.exp llvm/branches/non-call-eh/test/Transforms/LICM/2008-05-20-AliasSetVAArg.ll llvm/branches/non-call-eh/test/Transforms/LoopDeletion/ (with props) llvm/branches/non-call-eh/test/Transforms/LoopDeletion/2007-07-23-InfiniteLoop.ll llvm/branches/non-call-eh/test/Transforms/LoopDeletion/2008-05-06-Phi.ll llvm/branches/non-call-eh/test/Transforms/LoopDeletion/dcetest.ll llvm/branches/non-call-eh/test/Transforms/LoopDeletion/dg.exp llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/2008-05-19-IndVar.ll llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/2008-06-03-DomFrontier.ll llvm/branches/non-call-eh/test/Transforms/LoopRotate/LRCrash-5.ll llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-0.ll llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/change-compare-stride-trickiness-1.ll llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dead-phi.ll llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/2008-06-02-DomInfo.ll llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/2008-06-17-DomFrontier.ll llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/2008-04-29-SRetRemoval.ll llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/2008-06-01-MemCpy-MemMove.ll llvm/branches/non-call-eh/test/Transforms/PruneEH/2008-06-02-Weak.ll llvm/branches/non-call-eh/test/Transforms/SCCP/2008-04-22-multiple-ret-sccp.ll llvm/branches/non-call-eh/test/Transforms/SCCP/2008-05-23-UndefCallFold.ll llvm/branches/non-call-eh/test/Transforms/SRETPromotion/2008-06-04-function-pointer-passing.ll llvm/branches/non-call-eh/test/Transforms/SRETPromotion/2008-06-05-non-call-use.ll llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2008-06-05-loadstore-agg.ll llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2008-06-22-LargeArray.ll llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-04-23-MergeMultipleResultRet.ll llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-04-27-MultipleReturnCrash.ll llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2008-05-16-PHIBlockMerge.ll llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/SpeculativeExec.ll llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/2008-05-19-memcmp.ll llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/abs.ll llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/exp2.ll llvm/branches/non-call-eh/test/Transforms/TailDup/2008-05-13-InfiniteLoop.ll llvm/branches/non-call-eh/test/Transforms/TailDup/2008-06-11-AvoidDupLoopHeader.ll llvm/branches/non-call-eh/tools/llvmc2/Action.cpp llvm/branches/non-call-eh/tools/llvmc2/Action.h llvm/branches/non-call-eh/tools/llvmc2/AutoGenerated.cpp llvm/branches/non-call-eh/tools/llvmc2/AutoGenerated.h llvm/branches/non-call-eh/tools/llvmc2/CompilationGraph.cpp llvm/branches/non-call-eh/tools/llvmc2/CompilationGraph.h llvm/branches/non-call-eh/tools/llvmc2/Error.h llvm/branches/non-call-eh/tools/llvmc2/Graph.td llvm/branches/non-call-eh/tools/llvmc2/Tool.h llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Reference.rst llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Tutorial.rst llvm/branches/non-call-eh/tools/llvmc2/doc/Makefile llvm/branches/non-call-eh/tools/llvmc2/examples/ llvm/branches/non-call-eh/tools/llvmc2/examples/Clang.td llvm/branches/non-call-eh/tools/llvmc2/examples/Simple.td llvm/branches/non-call-eh/tools/llvmc2/llvmc.cpp llvm/branches/non-call-eh/tools/lto/ (with props) llvm/branches/non-call-eh/tools/lto/LTOCodeGenerator.cpp llvm/branches/non-call-eh/tools/lto/LTOCodeGenerator.h llvm/branches/non-call-eh/tools/lto/LTOModule.cpp llvm/branches/non-call-eh/tools/lto/LTOModule.h llvm/branches/non-call-eh/tools/lto/Makefile llvm/branches/non-call-eh/tools/lto/lto.cpp llvm/branches/non-call-eh/tools/lto/lto.exports llvm/branches/non-call-eh/utils/TableGen/LLVMCConfigurationEmitter.cpp llvm/branches/non-call-eh/utils/TableGen/LLVMCConfigurationEmitter.h llvm/branches/non-call-eh/utils/llvm.grm llvm/branches/non-call-eh/win32/common.vsprops Removed: llvm/branches/non-call-eh/docs/CommandGuide/llvm2cpp.pod llvm/branches/non-call-eh/docs/CommandGuide/llvmc.pod llvm/branches/non-call-eh/include/llvm/ADT/hash_map.in llvm/branches/non-call-eh/include/llvm/ADT/hash_set.in llvm/branches/non-call-eh/include/llvm/ADT/ilist llvm/branches/non-call-eh/include/llvm/ADT/iterator.in llvm/branches/non-call-eh/include/llvm/LinkTimeOptimizer.h llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeTypesExpand.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeTypesFloatToInt.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeTypesPromote.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeTypesScalarize.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeTypesSplit.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/SimplifyLibCalls.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/SimplifyCFG.cpp llvm/branches/non-call-eh/test/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll llvm/branches/non-call-eh/test/Analysis/Dominators/2007-04-17-PostDominanceFrontier.ll llvm/branches/non-call-eh/test/Analysis/Dominators/2007-04-20-PostDom-Reset.ll llvm/branches/non-call-eh/test/C++Frontend/ llvm/branches/non-call-eh/test/CFrontend/ llvm/branches/non-call-eh/test/CodeGen/X86/isnan.llx llvm/branches/non-call-eh/test/Feature/unwindto.ll llvm/branches/non-call-eh/test/Transforms/ADCE/2003-12-19-MergeReturn.ll llvm/branches/non-call-eh/test/Transforms/ADCE/2007-07-23-InfiniteLoop.ll llvm/branches/non-call-eh/test/Transforms/ADCE/adcetest.ll llvm/branches/non-call-eh/test/Transforms/ADCE/dead-phi-edge.ll llvm/branches/non-call-eh/test/Transforms/Inline/unwindto.ll llvm/branches/non-call-eh/test/Transforms/LoopRotate/pr1154.ll llvm/branches/non-call-eh/test/Transforms/PruneEH/unwindto.ll llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/unwindto.ll llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemMove.ll llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemSet.ll llvm/branches/non-call-eh/tools/llvm2cpp/CppWriter.cpp llvm/branches/non-call-eh/tools/llvm2cpp/CppWriter.h llvm/branches/non-call-eh/tools/llvm2cpp/Makefile llvm/branches/non-call-eh/tools/llvm2cpp/llvm2cpp.cpp llvm/branches/non-call-eh/tools/llvmc/ llvm/branches/non-call-eh/tools/llvmc2/Core.cpp llvm/branches/non-call-eh/tools/llvmc2/Core.h llvm/branches/non-call-eh/tools/llvmc2/Example.td llvm/branches/non-call-eh/tools/llvmc2/ExampleWithOpt.td llvm/branches/non-call-eh/tools/llvmc2/Tools.cpp llvm/branches/non-call-eh/tools/llvmc2/Tools.h llvm/branches/non-call-eh/tools/llvmc2/Utility.cpp llvm/branches/non-call-eh/tools/llvmc2/Utility.h llvm/branches/non-call-eh/tools/llvmc2/llvmcc.cpp llvm/branches/non-call-eh/tools/lto2/ llvm/branches/non-call-eh/utils/TableGen/LLVMCCConfigurationEmitter.cpp llvm/branches/non-call-eh/utils/TableGen/LLVMCCConfigurationEmitter.h Modified: llvm/branches/non-call-eh/CREDITS.TXT llvm/branches/non-call-eh/LICENSE.TXT llvm/branches/non-call-eh/Makefile llvm/branches/non-call-eh/Makefile.rules llvm/branches/non-call-eh/autoconf/configure.ac llvm/branches/non-call-eh/bindings/ocaml/llvm/llvm_ocaml.c llvm/branches/non-call-eh/configure llvm/branches/non-call-eh/docs/CodeGenerator.html llvm/branches/non-call-eh/docs/CodingStandards.html llvm/branches/non-call-eh/docs/CommandGuide/Makefile llvm/branches/non-call-eh/docs/CommandGuide/index.html llvm/branches/non-call-eh/docs/CommandGuide/llvm-ld.pod llvm/branches/non-call-eh/docs/CommandGuide/llvmgcc.pod llvm/branches/non-call-eh/docs/CommandLine.html llvm/branches/non-call-eh/docs/CompilerDriver.html llvm/branches/non-call-eh/docs/DeveloperPolicy.html llvm/branches/non-call-eh/docs/GCCFEBuildInstrs.html llvm/branches/non-call-eh/docs/GarbageCollection.html llvm/branches/non-call-eh/docs/GettingStarted.html llvm/branches/non-call-eh/docs/LangRef.html llvm/branches/non-call-eh/docs/Passes.html llvm/branches/non-call-eh/docs/ProgrammersManual.html llvm/branches/non-call-eh/docs/ReleaseNotes.html llvm/branches/non-call-eh/docs/SourceLevelDebugging.html llvm/branches/non-call-eh/docs/TestingGuide.html llvm/branches/non-call-eh/docs/index.html llvm/branches/non-call-eh/docs/tutorial/JITTutorial1.html llvm/branches/non-call-eh/docs/tutorial/JITTutorial2.html llvm/branches/non-call-eh/docs/tutorial/LangImpl3.html llvm/branches/non-call-eh/docs/tutorial/LangImpl4.html llvm/branches/non-call-eh/docs/tutorial/LangImpl5.html llvm/branches/non-call-eh/docs/tutorial/LangImpl6.html llvm/branches/non-call-eh/docs/tutorial/LangImpl7.html llvm/branches/non-call-eh/docs/tutorial/OCamlLangImpl3.html llvm/branches/non-call-eh/examples/BrainF/BrainF.cpp llvm/branches/non-call-eh/examples/Fibonacci/fibonacci.cpp llvm/branches/non-call-eh/examples/HowToUseJIT/HowToUseJIT.cpp llvm/branches/non-call-eh/examples/ModuleMaker/ModuleMaker.cpp llvm/branches/non-call-eh/examples/ParallelJIT/ParallelJIT.cpp llvm/branches/non-call-eh/include/llvm-c/BitWriter.h llvm/branches/non-call-eh/include/llvm-c/Core.h llvm/branches/non-call-eh/include/llvm-c/ExecutionEngine.h llvm/branches/non-call-eh/include/llvm-c/lto.h llvm/branches/non-call-eh/include/llvm/ADT/ (props changed) llvm/branches/non-call-eh/include/llvm/ADT/APFloat.h llvm/branches/non-call-eh/include/llvm/ADT/APInt.h llvm/branches/non-call-eh/include/llvm/ADT/BitVector.h llvm/branches/non-call-eh/include/llvm/ADT/DenseMap.h llvm/branches/non-call-eh/include/llvm/ADT/DenseSet.h llvm/branches/non-call-eh/include/llvm/ADT/DepthFirstIterator.h llvm/branches/non-call-eh/include/llvm/ADT/EquivalenceClasses.h llvm/branches/non-call-eh/include/llvm/ADT/FoldingSet.h llvm/branches/non-call-eh/include/llvm/ADT/HashExtras.h llvm/branches/non-call-eh/include/llvm/ADT/ImmutableMap.h llvm/branches/non-call-eh/include/llvm/ADT/PostOrderIterator.h llvm/branches/non-call-eh/include/llvm/ADT/SCCIterator.h llvm/branches/non-call-eh/include/llvm/ADT/STLExtras.h llvm/branches/non-call-eh/include/llvm/ADT/SmallPtrSet.h llvm/branches/non-call-eh/include/llvm/ADT/SmallVector.h llvm/branches/non-call-eh/include/llvm/ADT/SparseBitVector.h llvm/branches/non-call-eh/include/llvm/ADT/Statistic.h llvm/branches/non-call-eh/include/llvm/ADT/StringExtras.h llvm/branches/non-call-eh/include/llvm/ADT/StringMap.h llvm/branches/non-call-eh/include/llvm/ADT/UniqueVector.h llvm/branches/non-call-eh/include/llvm/Analysis/AliasAnalysis.h llvm/branches/non-call-eh/include/llvm/Analysis/AliasSetTracker.h llvm/branches/non-call-eh/include/llvm/Analysis/CallGraph.h llvm/branches/non-call-eh/include/llvm/Analysis/ConstantFolding.h llvm/branches/non-call-eh/include/llvm/Analysis/ConstantsScanner.h llvm/branches/non-call-eh/include/llvm/Analysis/DominatorInternals.h llvm/branches/non-call-eh/include/llvm/Analysis/Dominators.h llvm/branches/non-call-eh/include/llvm/Analysis/FindUsedTypes.h llvm/branches/non-call-eh/include/llvm/Analysis/LoopInfo.h llvm/branches/non-call-eh/include/llvm/Analysis/Passes.h llvm/branches/non-call-eh/include/llvm/Analysis/PostDominators.h llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolution.h llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolutionExpander.h llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolutionExpressions.h llvm/branches/non-call-eh/include/llvm/Analysis/ValueNumbering.h llvm/branches/non-call-eh/include/llvm/Argument.h llvm/branches/non-call-eh/include/llvm/AutoUpgrade.h llvm/branches/non-call-eh/include/llvm/BasicBlock.h llvm/branches/non-call-eh/include/llvm/Bitcode/Archive.h llvm/branches/non-call-eh/include/llvm/Bitcode/BitCodes.h llvm/branches/non-call-eh/include/llvm/Bitcode/BitstreamReader.h llvm/branches/non-call-eh/include/llvm/Bitcode/BitstreamWriter.h llvm/branches/non-call-eh/include/llvm/Bitcode/Deserialize.h llvm/branches/non-call-eh/include/llvm/Bitcode/LLVMBitCodes.h llvm/branches/non-call-eh/include/llvm/CodeGen/AsmPrinter.h llvm/branches/non-call-eh/include/llvm/CodeGen/CallingConvLower.h llvm/branches/non-call-eh/include/llvm/CodeGen/LinkAllCodegenComponents.h llvm/branches/non-call-eh/include/llvm/CodeGen/LiveInterval.h llvm/branches/non-call-eh/include/llvm/CodeGen/LiveIntervalAnalysis.h llvm/branches/non-call-eh/include/llvm/CodeGen/LiveVariables.h llvm/branches/non-call-eh/include/llvm/CodeGen/MachineBasicBlock.h llvm/branches/non-call-eh/include/llvm/CodeGen/MachineCodeEmitter.h llvm/branches/non-call-eh/include/llvm/CodeGen/MachineFrameInfo.h llvm/branches/non-call-eh/include/llvm/CodeGen/MachineFunction.h llvm/branches/non-call-eh/include/llvm/CodeGen/MachineInstr.h llvm/branches/non-call-eh/include/llvm/CodeGen/MachineJumpTableInfo.h llvm/branches/non-call-eh/include/llvm/CodeGen/MachineLoopInfo.h llvm/branches/non-call-eh/include/llvm/CodeGen/MachineModuleInfo.h llvm/branches/non-call-eh/include/llvm/CodeGen/MachineOperand.h llvm/branches/non-call-eh/include/llvm/CodeGen/MachineRegisterInfo.h llvm/branches/non-call-eh/include/llvm/CodeGen/Passes.h llvm/branches/non-call-eh/include/llvm/CodeGen/RuntimeLibcalls.h llvm/branches/non-call-eh/include/llvm/CodeGen/SchedGraphCommon.h llvm/branches/non-call-eh/include/llvm/CodeGen/ScheduleDAG.h llvm/branches/non-call-eh/include/llvm/CodeGen/SchedulerRegistry.h llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAG.h llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAGISel.h llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAGNodes.h llvm/branches/non-call-eh/include/llvm/CodeGen/ValueTypes.h llvm/branches/non-call-eh/include/llvm/Constant.h llvm/branches/non-call-eh/include/llvm/Constants.h llvm/branches/non-call-eh/include/llvm/Debugger/Debugger.h llvm/branches/non-call-eh/include/llvm/Debugger/SourceFile.h llvm/branches/non-call-eh/include/llvm/DerivedTypes.h llvm/branches/non-call-eh/include/llvm/ExecutionEngine/ExecutionEngine.h llvm/branches/non-call-eh/include/llvm/Function.h llvm/branches/non-call-eh/include/llvm/GlobalAlias.h llvm/branches/non-call-eh/include/llvm/GlobalValue.h llvm/branches/non-call-eh/include/llvm/GlobalVariable.h llvm/branches/non-call-eh/include/llvm/InstrTypes.h llvm/branches/non-call-eh/include/llvm/Instruction.def llvm/branches/non-call-eh/include/llvm/Instruction.h llvm/branches/non-call-eh/include/llvm/Instructions.h llvm/branches/non-call-eh/include/llvm/IntrinsicInst.h llvm/branches/non-call-eh/include/llvm/Intrinsics.h llvm/branches/non-call-eh/include/llvm/Intrinsics.td llvm/branches/non-call-eh/include/llvm/IntrinsicsX86.td llvm/branches/non-call-eh/include/llvm/LinkAllPasses.h llvm/branches/non-call-eh/include/llvm/Module.h llvm/branches/non-call-eh/include/llvm/ModuleProvider.h llvm/branches/non-call-eh/include/llvm/ParameterAttributes.h llvm/branches/non-call-eh/include/llvm/Pass.h llvm/branches/non-call-eh/include/llvm/PassManager.h llvm/branches/non-call-eh/include/llvm/PassManagers.h llvm/branches/non-call-eh/include/llvm/PassSupport.h llvm/branches/non-call-eh/include/llvm/Support/AlignOf.h llvm/branches/non-call-eh/include/llvm/Support/Allocator.h llvm/branches/non-call-eh/include/llvm/Support/CFG.h llvm/branches/non-call-eh/include/llvm/Support/CallSite.h llvm/branches/non-call-eh/include/llvm/Support/CommandLine.h llvm/branches/non-call-eh/include/llvm/Support/Dwarf.h llvm/branches/non-call-eh/include/llvm/Support/GraphWriter.h llvm/branches/non-call-eh/include/llvm/Support/IRBuilder.h llvm/branches/non-call-eh/include/llvm/Support/InstVisitor.h llvm/branches/non-call-eh/include/llvm/Support/Mangler.h llvm/branches/non-call-eh/include/llvm/Support/MathExtras.h llvm/branches/non-call-eh/include/llvm/Support/MemoryBuffer.h llvm/branches/non-call-eh/include/llvm/Support/OutputBuffer.h llvm/branches/non-call-eh/include/llvm/Support/PassNameParser.h llvm/branches/non-call-eh/include/llvm/Support/PatternMatch.h llvm/branches/non-call-eh/include/llvm/Support/Streams.h llvm/branches/non-call-eh/include/llvm/Support/Timer.h llvm/branches/non-call-eh/include/llvm/System/Alarm.h llvm/branches/non-call-eh/include/llvm/System/DynamicLibrary.h llvm/branches/non-call-eh/include/llvm/System/Memory.h llvm/branches/non-call-eh/include/llvm/System/Path.h llvm/branches/non-call-eh/include/llvm/System/Process.h llvm/branches/non-call-eh/include/llvm/System/Program.h llvm/branches/non-call-eh/include/llvm/System/Signals.h llvm/branches/non-call-eh/include/llvm/Target/TargetAsmInfo.h llvm/branches/non-call-eh/include/llvm/Target/TargetInstrDesc.h llvm/branches/non-call-eh/include/llvm/Target/TargetInstrInfo.h llvm/branches/non-call-eh/include/llvm/Target/TargetJITInfo.h llvm/branches/non-call-eh/include/llvm/Target/TargetLowering.h llvm/branches/non-call-eh/include/llvm/Target/TargetMachine.h llvm/branches/non-call-eh/include/llvm/Target/TargetOptions.h llvm/branches/non-call-eh/include/llvm/Target/TargetRegisterInfo.h llvm/branches/non-call-eh/include/llvm/Transforms/IPO.h llvm/branches/non-call-eh/include/llvm/Transforms/Scalar.h llvm/branches/non-call-eh/include/llvm/Transforms/Utils/BasicBlockUtils.h llvm/branches/non-call-eh/include/llvm/Transforms/Utils/FunctionUtils.h llvm/branches/non-call-eh/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h llvm/branches/non-call-eh/include/llvm/Type.h llvm/branches/non-call-eh/include/llvm/Use.h llvm/branches/non-call-eh/include/llvm/User.h llvm/branches/non-call-eh/include/llvm/Value.h llvm/branches/non-call-eh/include/llvm/ValueSymbolTable.h llvm/branches/non-call-eh/lib/Analysis/AliasAnalysis.cpp llvm/branches/non-call-eh/lib/Analysis/AliasAnalysisCounter.cpp llvm/branches/non-call-eh/lib/Analysis/AliasAnalysisEvaluator.cpp llvm/branches/non-call-eh/lib/Analysis/AliasDebugger.cpp llvm/branches/non-call-eh/lib/Analysis/AliasSetTracker.cpp llvm/branches/non-call-eh/lib/Analysis/BasicAliasAnalysis.cpp llvm/branches/non-call-eh/lib/Analysis/CFGPrinter.cpp llvm/branches/non-call-eh/lib/Analysis/ConstantFolding.cpp llvm/branches/non-call-eh/lib/Analysis/IPA/Andersens.cpp llvm/branches/non-call-eh/lib/Analysis/IPA/CallGraph.cpp llvm/branches/non-call-eh/lib/Analysis/IPA/CallGraphSCCPass.cpp llvm/branches/non-call-eh/lib/Analysis/IPA/FindUsedTypes.cpp llvm/branches/non-call-eh/lib/Analysis/IPA/GlobalsModRef.cpp llvm/branches/non-call-eh/lib/Analysis/InstCount.cpp llvm/branches/non-call-eh/lib/Analysis/IntervalPartition.cpp llvm/branches/non-call-eh/lib/Analysis/LoadValueNumbering.cpp llvm/branches/non-call-eh/lib/Analysis/LoopInfo.cpp llvm/branches/non-call-eh/lib/Analysis/LoopPass.cpp llvm/branches/non-call-eh/lib/Analysis/MemoryDependenceAnalysis.cpp llvm/branches/non-call-eh/lib/Analysis/PostDominators.cpp llvm/branches/non-call-eh/lib/Analysis/ProfileInfo.cpp llvm/branches/non-call-eh/lib/Analysis/ProfileInfoLoaderPass.cpp llvm/branches/non-call-eh/lib/Analysis/ScalarEvolution.cpp llvm/branches/non-call-eh/lib/Analysis/ScalarEvolutionExpander.cpp llvm/branches/non-call-eh/lib/Analysis/ValueNumbering.cpp llvm/branches/non-call-eh/lib/Archive/ArchiveReader.cpp llvm/branches/non-call-eh/lib/Archive/ArchiveWriter.cpp llvm/branches/non-call-eh/lib/AsmParser/LLLexer.cpp llvm/branches/non-call-eh/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/branches/non-call-eh/lib/AsmParser/llvmAsmParser.h.cvs llvm/branches/non-call-eh/lib/AsmParser/llvmAsmParser.y llvm/branches/non-call-eh/lib/AsmParser/llvmAsmParser.y.cvs llvm/branches/non-call-eh/lib/Bitcode/Reader/BitcodeReader.cpp llvm/branches/non-call-eh/lib/Bitcode/Reader/BitcodeReader.h llvm/branches/non-call-eh/lib/Bitcode/Reader/Deserialize.cpp llvm/branches/non-call-eh/lib/Bitcode/Writer/BitWriter.cpp llvm/branches/non-call-eh/lib/Bitcode/Writer/BitcodeWriter.cpp llvm/branches/non-call-eh/lib/Bitcode/Writer/ValueEnumerator.cpp llvm/branches/non-call-eh/lib/CodeGen/AsmPrinter.cpp llvm/branches/non-call-eh/lib/CodeGen/BranchFolding.cpp llvm/branches/non-call-eh/lib/CodeGen/Collector.cpp llvm/branches/non-call-eh/lib/CodeGen/CollectorMetadata.cpp llvm/branches/non-call-eh/lib/CodeGen/DwarfWriter.cpp llvm/branches/non-call-eh/lib/CodeGen/ELFWriter.cpp llvm/branches/non-call-eh/lib/CodeGen/IfConversion.cpp llvm/branches/non-call-eh/lib/CodeGen/IntrinsicLowering.cpp llvm/branches/non-call-eh/lib/CodeGen/LLVMTargetMachine.cpp llvm/branches/non-call-eh/lib/CodeGen/LiveInterval.cpp llvm/branches/non-call-eh/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/branches/non-call-eh/lib/CodeGen/LiveVariables.cpp llvm/branches/non-call-eh/lib/CodeGen/LowerSubregs.cpp llvm/branches/non-call-eh/lib/CodeGen/MachOWriter.cpp llvm/branches/non-call-eh/lib/CodeGen/MachineBasicBlock.cpp llvm/branches/non-call-eh/lib/CodeGen/MachineDominators.cpp llvm/branches/non-call-eh/lib/CodeGen/MachineInstr.cpp llvm/branches/non-call-eh/lib/CodeGen/MachineLICM.cpp llvm/branches/non-call-eh/lib/CodeGen/MachineLoopInfo.cpp llvm/branches/non-call-eh/lib/CodeGen/MachineModuleInfo.cpp llvm/branches/non-call-eh/lib/CodeGen/MachineSink.cpp llvm/branches/non-call-eh/lib/CodeGen/OcamlCollector.cpp llvm/branches/non-call-eh/lib/CodeGen/PHIElimination.cpp llvm/branches/non-call-eh/lib/CodeGen/Passes.cpp llvm/branches/non-call-eh/lib/CodeGen/PrologEpilogInserter.cpp llvm/branches/non-call-eh/lib/CodeGen/README.txt llvm/branches/non-call-eh/lib/CodeGen/RegAllocBigBlock.cpp llvm/branches/non-call-eh/lib/CodeGen/RegAllocLinearScan.cpp llvm/branches/non-call-eh/lib/CodeGen/RegAllocLocal.cpp llvm/branches/non-call-eh/lib/CodeGen/RegisterCoalescer.cpp llvm/branches/non-call-eh/lib/CodeGen/RegisterScavenging.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/CallingConvLower.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/DAGCombiner.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/LegalizeTypes.h llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp llvm/branches/non-call-eh/lib/CodeGen/SelectionDAG/TargetLowering.cpp llvm/branches/non-call-eh/lib/CodeGen/ShadowStackCollector.cpp llvm/branches/non-call-eh/lib/CodeGen/SimpleRegisterCoalescing.cpp llvm/branches/non-call-eh/lib/CodeGen/SimpleRegisterCoalescing.h llvm/branches/non-call-eh/lib/CodeGen/StrongPHIElimination.cpp llvm/branches/non-call-eh/lib/CodeGen/TargetInstrInfoImpl.cpp llvm/branches/non-call-eh/lib/CodeGen/TwoAddressInstructionPass.cpp llvm/branches/non-call-eh/lib/CodeGen/UnreachableBlockElim.cpp llvm/branches/non-call-eh/lib/CodeGen/VirtRegMap.cpp llvm/branches/non-call-eh/lib/CodeGen/VirtRegMap.h llvm/branches/non-call-eh/lib/Debugger/ProgramInfo.cpp llvm/branches/non-call-eh/lib/Debugger/SourceLanguage-Unknown.cpp llvm/branches/non-call-eh/lib/ExecutionEngine/ExecutionEngine.cpp llvm/branches/non-call-eh/lib/ExecutionEngine/ExecutionEngineBindings.cpp llvm/branches/non-call-eh/lib/ExecutionEngine/Interpreter/Interpreter.cpp llvm/branches/non-call-eh/lib/ExecutionEngine/JIT/Intercept.cpp llvm/branches/non-call-eh/lib/ExecutionEngine/JIT/JIT.cpp llvm/branches/non-call-eh/lib/ExecutionEngine/JIT/JIT.h llvm/branches/non-call-eh/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp llvm/branches/non-call-eh/lib/ExecutionEngine/JIT/JITEmitter.cpp llvm/branches/non-call-eh/lib/ExecutionEngine/JIT/JITMemoryManager.cpp llvm/branches/non-call-eh/lib/ExecutionEngine/JIT/TargetSelect.cpp llvm/branches/non-call-eh/lib/Linker/LinkModules.cpp llvm/branches/non-call-eh/lib/Support/APFloat.cpp llvm/branches/non-call-eh/lib/Support/APInt.cpp llvm/branches/non-call-eh/lib/Support/Allocator.cpp llvm/branches/non-call-eh/lib/Support/CommandLine.cpp llvm/branches/non-call-eh/lib/Support/ConstantRange.cpp llvm/branches/non-call-eh/lib/Support/Debug.cpp llvm/branches/non-call-eh/lib/Support/Dwarf.cpp llvm/branches/non-call-eh/lib/Support/FileUtilities.cpp llvm/branches/non-call-eh/lib/Support/FoldingSet.cpp llvm/branches/non-call-eh/lib/Support/MemoryBuffer.cpp llvm/branches/non-call-eh/lib/Support/Statistic.cpp llvm/branches/non-call-eh/lib/Support/Streams.cpp llvm/branches/non-call-eh/lib/Support/StringExtras.cpp llvm/branches/non-call-eh/lib/Support/Timer.cpp llvm/branches/non-call-eh/lib/System/Alarm.cpp llvm/branches/non-call-eh/lib/System/DynamicLibrary.cpp llvm/branches/non-call-eh/lib/System/Memory.cpp llvm/branches/non-call-eh/lib/System/Mutex.cpp llvm/branches/non-call-eh/lib/System/Path.cpp llvm/branches/non-call-eh/lib/System/Process.cpp llvm/branches/non-call-eh/lib/System/Program.cpp llvm/branches/non-call-eh/lib/System/Signals.cpp llvm/branches/non-call-eh/lib/System/Unix/Memory.inc llvm/branches/non-call-eh/lib/System/Unix/Path.inc llvm/branches/non-call-eh/lib/System/Unix/Program.inc llvm/branches/non-call-eh/lib/System/Unix/Signals.inc llvm/branches/non-call-eh/lib/System/Unix/Unix.h llvm/branches/non-call-eh/lib/System/Win32/DynamicLibrary.inc llvm/branches/non-call-eh/lib/System/Win32/Path.inc llvm/branches/non-call-eh/lib/System/Win32/Program.inc llvm/branches/non-call-eh/lib/Target/ARM/ARMAsmPrinter.cpp llvm/branches/non-call-eh/lib/Target/ARM/ARMISelDAGToDAG.cpp llvm/branches/non-call-eh/lib/Target/ARM/ARMISelLowering.cpp llvm/branches/non-call-eh/lib/Target/ARM/ARMISelLowering.h llvm/branches/non-call-eh/lib/Target/ARM/ARMInstrInfo.cpp llvm/branches/non-call-eh/lib/Target/ARM/ARMInstrInfo.h llvm/branches/non-call-eh/lib/Target/ARM/ARMTargetAsmInfo.cpp llvm/branches/non-call-eh/lib/Target/ARM/ARMTargetMachine.cpp llvm/branches/non-call-eh/lib/Target/ARM/ARMTargetMachine.h llvm/branches/non-call-eh/lib/Target/Alpha/Alpha.h llvm/branches/non-call-eh/lib/Target/Alpha/AlphaAsmPrinter.cpp llvm/branches/non-call-eh/lib/Target/Alpha/AlphaISelDAGToDAG.cpp llvm/branches/non-call-eh/lib/Target/Alpha/AlphaISelLowering.cpp llvm/branches/non-call-eh/lib/Target/Alpha/AlphaISelLowering.h llvm/branches/non-call-eh/lib/Target/Alpha/AlphaInstrInfo.cpp llvm/branches/non-call-eh/lib/Target/Alpha/AlphaInstrInfo.h llvm/branches/non-call-eh/lib/Target/Alpha/AlphaInstrInfo.td llvm/branches/non-call-eh/lib/Target/Alpha/AlphaTargetMachine.cpp llvm/branches/non-call-eh/lib/Target/Alpha/AlphaTargetMachine.h llvm/branches/non-call-eh/lib/Target/CBackend/CBackend.cpp llvm/branches/non-call-eh/lib/Target/CellSPU/SPUAsmPrinter.cpp llvm/branches/non-call-eh/lib/Target/CellSPU/SPUFrameInfo.h llvm/branches/non-call-eh/lib/Target/CellSPU/SPUISelDAGToDAG.cpp llvm/branches/non-call-eh/lib/Target/CellSPU/SPUISelLowering.cpp llvm/branches/non-call-eh/lib/Target/CellSPU/SPUISelLowering.h llvm/branches/non-call-eh/lib/Target/CellSPU/SPUInstrInfo.cpp llvm/branches/non-call-eh/lib/Target/CellSPU/SPUInstrInfo.h llvm/branches/non-call-eh/lib/Target/CellSPU/SPUInstrInfo.td llvm/branches/non-call-eh/lib/Target/CellSPU/SPUNodes.td llvm/branches/non-call-eh/lib/Target/CellSPU/SPUOperands.td llvm/branches/non-call-eh/lib/Target/CellSPU/SPURegisterInfo.cpp llvm/branches/non-call-eh/lib/Target/CellSPU/SPUTargetMachine.h llvm/branches/non-call-eh/lib/Target/IA64/IA64AsmPrinter.cpp llvm/branches/non-call-eh/lib/Target/IA64/IA64ISelDAGToDAG.cpp llvm/branches/non-call-eh/lib/Target/IA64/IA64ISelLowering.cpp llvm/branches/non-call-eh/lib/Target/IA64/IA64ISelLowering.h llvm/branches/non-call-eh/lib/Target/IA64/IA64InstrInfo.h llvm/branches/non-call-eh/lib/Target/IA64/IA64TargetMachine.cpp llvm/branches/non-call-eh/lib/Target/IA64/IA64TargetMachine.h llvm/branches/non-call-eh/lib/Target/MSIL/MSILWriter.cpp llvm/branches/non-call-eh/lib/Target/Mips/Mips.td llvm/branches/non-call-eh/lib/Target/Mips/MipsAsmPrinter.cpp llvm/branches/non-call-eh/lib/Target/Mips/MipsCallingConv.td llvm/branches/non-call-eh/lib/Target/Mips/MipsISelDAGToDAG.cpp llvm/branches/non-call-eh/lib/Target/Mips/MipsISelLowering.cpp llvm/branches/non-call-eh/lib/Target/Mips/MipsISelLowering.h llvm/branches/non-call-eh/lib/Target/Mips/MipsInstrFormats.td llvm/branches/non-call-eh/lib/Target/Mips/MipsInstrInfo.cpp llvm/branches/non-call-eh/lib/Target/Mips/MipsInstrInfo.h llvm/branches/non-call-eh/lib/Target/Mips/MipsInstrInfo.td llvm/branches/non-call-eh/lib/Target/Mips/MipsMachineFunction.h llvm/branches/non-call-eh/lib/Target/Mips/MipsRegisterInfo.cpp llvm/branches/non-call-eh/lib/Target/Mips/MipsRegisterInfo.td llvm/branches/non-call-eh/lib/Target/Mips/MipsSubtarget.cpp llvm/branches/non-call-eh/lib/Target/Mips/MipsSubtarget.h llvm/branches/non-call-eh/lib/Target/Mips/MipsTargetMachine.cpp llvm/branches/non-call-eh/lib/Target/Mips/MipsTargetMachine.h llvm/branches/non-call-eh/lib/Target/PowerPC/PPCAsmPrinter.cpp llvm/branches/non-call-eh/lib/Target/PowerPC/PPCCodeEmitter.cpp llvm/branches/non-call-eh/lib/Target/PowerPC/PPCISelDAGToDAG.cpp llvm/branches/non-call-eh/lib/Target/PowerPC/PPCISelLowering.cpp llvm/branches/non-call-eh/lib/Target/PowerPC/PPCISelLowering.h llvm/branches/non-call-eh/lib/Target/PowerPC/PPCInstr64Bit.td llvm/branches/non-call-eh/lib/Target/PowerPC/PPCInstrInfo.cpp llvm/branches/non-call-eh/lib/Target/PowerPC/PPCInstrInfo.h llvm/branches/non-call-eh/lib/Target/PowerPC/PPCInstrInfo.td llvm/branches/non-call-eh/lib/Target/PowerPC/PPCJITInfo.cpp llvm/branches/non-call-eh/lib/Target/PowerPC/PPCMachineFunctionInfo.h llvm/branches/non-call-eh/lib/Target/PowerPC/PPCRegisterInfo.cpp llvm/branches/non-call-eh/lib/Target/PowerPC/PPCRegisterInfo.td llvm/branches/non-call-eh/lib/Target/PowerPC/PPCSubtarget.cpp llvm/branches/non-call-eh/lib/Target/PowerPC/PPCTargetAsmInfo.cpp llvm/branches/non-call-eh/lib/Target/PowerPC/PPCTargetMachine.cpp llvm/branches/non-call-eh/lib/Target/PowerPC/PPCTargetMachine.h llvm/branches/non-call-eh/lib/Target/PowerPC/README_ALTIVEC.txt llvm/branches/non-call-eh/lib/Target/README.txt llvm/branches/non-call-eh/lib/Target/Sparc/SparcAsmPrinter.cpp llvm/branches/non-call-eh/lib/Target/Sparc/SparcISelDAGToDAG.cpp llvm/branches/non-call-eh/lib/Target/Sparc/SparcISelLowering.cpp llvm/branches/non-call-eh/lib/Target/Sparc/SparcISelLowering.h llvm/branches/non-call-eh/lib/Target/Sparc/SparcInstrInfo.cpp llvm/branches/non-call-eh/lib/Target/Sparc/SparcInstrInfo.h llvm/branches/non-call-eh/lib/Target/Sparc/SparcTargetMachine.cpp llvm/branches/non-call-eh/lib/Target/Sparc/SparcTargetMachine.h llvm/branches/non-call-eh/lib/Target/Target.td llvm/branches/non-call-eh/lib/Target/TargetAsmInfo.cpp llvm/branches/non-call-eh/lib/Target/TargetData.cpp llvm/branches/non-call-eh/lib/Target/TargetMachine.cpp llvm/branches/non-call-eh/lib/Target/TargetRegisterInfo.cpp llvm/branches/non-call-eh/lib/Target/TargetSelectionDAG.td llvm/branches/non-call-eh/lib/Target/X86/README-SSE.txt llvm/branches/non-call-eh/lib/Target/X86/README-X86-64.txt llvm/branches/non-call-eh/lib/Target/X86/README.txt llvm/branches/non-call-eh/lib/Target/X86/X86.h llvm/branches/non-call-eh/lib/Target/X86/X86ATTAsmPrinter.cpp llvm/branches/non-call-eh/lib/Target/X86/X86ATTAsmPrinter.h llvm/branches/non-call-eh/lib/Target/X86/X86AsmPrinter.cpp llvm/branches/non-call-eh/lib/Target/X86/X86AsmPrinter.h llvm/branches/non-call-eh/lib/Target/X86/X86CallingConv.td llvm/branches/non-call-eh/lib/Target/X86/X86CodeEmitter.cpp llvm/branches/non-call-eh/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/branches/non-call-eh/lib/Target/X86/X86ISelLowering.cpp llvm/branches/non-call-eh/lib/Target/X86/X86ISelLowering.h llvm/branches/non-call-eh/lib/Target/X86/X86Instr64bit.td llvm/branches/non-call-eh/lib/Target/X86/X86InstrBuilder.h llvm/branches/non-call-eh/lib/Target/X86/X86InstrInfo.cpp llvm/branches/non-call-eh/lib/Target/X86/X86InstrInfo.h llvm/branches/non-call-eh/lib/Target/X86/X86InstrInfo.td llvm/branches/non-call-eh/lib/Target/X86/X86InstrMMX.td llvm/branches/non-call-eh/lib/Target/X86/X86InstrSSE.td llvm/branches/non-call-eh/lib/Target/X86/X86IntelAsmPrinter.cpp llvm/branches/non-call-eh/lib/Target/X86/X86IntelAsmPrinter.h llvm/branches/non-call-eh/lib/Target/X86/X86JITInfo.cpp llvm/branches/non-call-eh/lib/Target/X86/X86MachineFunctionInfo.h llvm/branches/non-call-eh/lib/Target/X86/X86RegisterInfo.cpp llvm/branches/non-call-eh/lib/Target/X86/X86RegisterInfo.h llvm/branches/non-call-eh/lib/Target/X86/X86RegisterInfo.td llvm/branches/non-call-eh/lib/Target/X86/X86Subtarget.cpp llvm/branches/non-call-eh/lib/Target/X86/X86Subtarget.h llvm/branches/non-call-eh/lib/Target/X86/X86TargetAsmInfo.cpp llvm/branches/non-call-eh/lib/Target/X86/X86TargetMachine.cpp llvm/branches/non-call-eh/lib/Target/X86/X86TargetMachine.h llvm/branches/non-call-eh/lib/Transforms/Hello/Hello.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/ArgumentPromotion.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/ConstantMerge.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/DeadArgumentElimination.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/DeadTypeElimination.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/ExtractGV.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/GlobalDCE.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/GlobalOpt.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/IPConstantPropagation.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/IndMemRemoval.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/InlineSimple.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/Inliner.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/Internalize.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/LoopExtractor.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/LowerSetJmp.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/PruneEH.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/RaiseAllocations.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/StripDeadPrototypes.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/StripSymbols.cpp llvm/branches/non-call-eh/lib/Transforms/IPO/StructRetPromotion.cpp llvm/branches/non-call-eh/lib/Transforms/Instrumentation/BlockProfiling.cpp llvm/branches/non-call-eh/lib/Transforms/Instrumentation/EdgeProfiling.cpp llvm/branches/non-call-eh/lib/Transforms/Instrumentation/ProfilingUtils.cpp llvm/branches/non-call-eh/lib/Transforms/Instrumentation/RSProfiling.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/ADCE.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/BasicBlockPlacement.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/CodeGenPrepare.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/CondPropagate.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/ConstantProp.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/DCE.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/DeadStoreElimination.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/GCSE.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/GVN.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/GVNPRE.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/IndVarSimplify.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/InstructionCombining.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/JumpThreading.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/LICM.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/LoopIndexSplit.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/LoopRotation.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/LoopStrengthReduce.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/LoopUnroll.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/LoopUnswitch.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/MemCpyOptimizer.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/PredicateSimplifier.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/Reassociate.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/Reg2Mem.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/SCCP.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/ScalarReplAggregates.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/TailDuplication.cpp llvm/branches/non-call-eh/lib/Transforms/Scalar/TailRecursionElimination.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/BasicBlockUtils.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/BasicInliner.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/BreakCriticalEdges.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/CloneFunction.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/CloneLoop.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/CloneModule.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/CloneTrace.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/CodeExtractor.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/DemoteRegToStack.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/InlineCost.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/InlineFunction.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/LCSSA.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/Local.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/LoopSimplify.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/LowerAllocations.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/LowerInvoke.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/LowerSwitch.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/Mem2Reg.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/SimplifyCFG.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp llvm/branches/non-call-eh/lib/Transforms/Utils/ValueMapper.cpp llvm/branches/non-call-eh/lib/VMCore/AsmWriter.cpp llvm/branches/non-call-eh/lib/VMCore/AutoUpgrade.cpp llvm/branches/non-call-eh/lib/VMCore/BasicBlock.cpp llvm/branches/non-call-eh/lib/VMCore/ConstantFold.cpp llvm/branches/non-call-eh/lib/VMCore/ConstantFold.h llvm/branches/non-call-eh/lib/VMCore/Constants.cpp llvm/branches/non-call-eh/lib/VMCore/Core.cpp llvm/branches/non-call-eh/lib/VMCore/Dominators.cpp llvm/branches/non-call-eh/lib/VMCore/Function.cpp llvm/branches/non-call-eh/lib/VMCore/Globals.cpp llvm/branches/non-call-eh/lib/VMCore/InlineAsm.cpp llvm/branches/non-call-eh/lib/VMCore/Instruction.cpp llvm/branches/non-call-eh/lib/VMCore/Instructions.cpp llvm/branches/non-call-eh/lib/VMCore/IntrinsicInst.cpp llvm/branches/non-call-eh/lib/VMCore/Mangler.cpp llvm/branches/non-call-eh/lib/VMCore/Module.cpp llvm/branches/non-call-eh/lib/VMCore/Pass.cpp llvm/branches/non-call-eh/lib/VMCore/PassManager.cpp llvm/branches/non-call-eh/lib/VMCore/Type.cpp llvm/branches/non-call-eh/lib/VMCore/TypeSymbolTable.cpp llvm/branches/non-call-eh/lib/VMCore/Value.cpp llvm/branches/non-call-eh/lib/VMCore/ValueSymbolTable.cpp llvm/branches/non-call-eh/lib/VMCore/ValueTypes.cpp llvm/branches/non-call-eh/lib/VMCore/Verifier.cpp llvm/branches/non-call-eh/projects/Makefile llvm/branches/non-call-eh/test/Analysis/Andersens/basictest.ll llvm/branches/non-call-eh/test/Analysis/Andersens/dg.exp llvm/branches/non-call-eh/test/Analysis/Andersens/external.ll llvm/branches/non-call-eh/test/Analysis/Andersens/modreftest.ll llvm/branches/non-call-eh/test/Analysis/Andersens/modreftest2.ll llvm/branches/non-call-eh/test/Analysis/BasicAA/2003-03-04-GEPCrash.ll llvm/branches/non-call-eh/test/Analysis/BasicAA/2003-04-25-GEPCrash.ll llvm/branches/non-call-eh/test/Analysis/BasicAA/2003-06-01-AliasCrash.ll llvm/branches/non-call-eh/test/Analysis/BasicAA/2003-07-03-BasicAACrash.ll llvm/branches/non-call-eh/test/Analysis/BasicAA/dg.exp llvm/branches/non-call-eh/test/Analysis/BasicAA/licmtest.ll llvm/branches/non-call-eh/test/Analysis/Dominators/dg.exp llvm/branches/non-call-eh/test/Analysis/GlobalsModRef/dg.exp llvm/branches/non-call-eh/test/Analysis/LoadVN/dg.exp llvm/branches/non-call-eh/test/Analysis/LoopInfo/dg.exp llvm/branches/non-call-eh/test/Analysis/ScalarEvolution/smax.ll llvm/branches/non-call-eh/test/Archive/dg.exp llvm/branches/non-call-eh/test/Archive/toc_MacOSX.ll (props changed) llvm/branches/non-call-eh/test/Assembler/2002-01-24-BadSymbolTableAssert.ll llvm/branches/non-call-eh/test/Assembler/2002-01-24-ValueRefineAbsType.ll llvm/branches/non-call-eh/test/Assembler/2002-02-19-TypeParsing.ll llvm/branches/non-call-eh/test/Assembler/2002-03-08-NameCollision.ll llvm/branches/non-call-eh/test/Assembler/2002-03-08-NameCollision2.ll llvm/branches/non-call-eh/test/Assembler/2002-04-04-PureVirtMethCall.ll llvm/branches/non-call-eh/test/Assembler/2002-04-04-PureVirtMethCall2.ll llvm/branches/non-call-eh/test/Assembler/2002-04-05-TypeParsing.ll llvm/branches/non-call-eh/test/Assembler/2002-05-02-InvalidForwardRef.ll llvm/branches/non-call-eh/test/Assembler/2002-07-08-HugePerformanceProblem.ll llvm/branches/non-call-eh/test/Assembler/2002-07-25-ParserAssertionFailure.ll llvm/branches/non-call-eh/test/Assembler/2002-08-15-CastAmbiguity.ll llvm/branches/non-call-eh/test/Assembler/2002-08-15-ConstantExprProblem.ll llvm/branches/non-call-eh/test/Assembler/2002-08-15-UnresolvedGlobalReference.ll llvm/branches/non-call-eh/test/Assembler/2002-08-22-DominanceProblem.ll llvm/branches/non-call-eh/test/Assembler/2002-10-08-LargeArrayPerformance.ll llvm/branches/non-call-eh/test/Assembler/2002-10-15-NameClash.ll llvm/branches/non-call-eh/test/Assembler/2002-12-15-GlobalResolve.ll llvm/branches/non-call-eh/test/Assembler/2003-01-30-UnsignedString.ll llvm/branches/non-call-eh/test/Assembler/2003-04-25-UnresolvedGlobalReference.ll llvm/branches/non-call-eh/test/Assembler/2003-05-15-AssemblerProblem.ll llvm/branches/non-call-eh/test/Assembler/2003-05-15-SwitchBug.ll llvm/branches/non-call-eh/test/Assembler/2003-05-21-ConstantShiftExpr.ll llvm/branches/non-call-eh/test/Assembler/2003-05-21-EmptyStructTest.ll llvm/branches/non-call-eh/test/Assembler/2003-06-30-RecursiveTypeProblem.ll llvm/branches/non-call-eh/test/Assembler/2003-10-04-NotMergingGlobalConstants.ll llvm/branches/non-call-eh/test/Assembler/2003-11-11-ImplicitRename.ll llvm/branches/non-call-eh/test/Assembler/2003-12-30-TypeMapInvalidMemory.ll llvm/branches/non-call-eh/test/Assembler/2004-02-27-SelfUseAssertError.ll llvm/branches/non-call-eh/test/Assembler/2004-04-04-GetElementPtrIndexTypes.ll llvm/branches/non-call-eh/test/Assembler/2004-09-29-VerifierIsReallySlow.ll llvm/branches/non-call-eh/test/Assembler/2004-10-22-BCWriterUndefBug.ll llvm/branches/non-call-eh/test/Assembler/2004-11-28-InvalidTypeCrash.ll llvm/branches/non-call-eh/test/Assembler/2005-01-31-CallingAggregateFunction.ll llvm/branches/non-call-eh/test/Assembler/2007-01-02-Undefined-Arg-Type.ll llvm/branches/non-call-eh/test/Assembler/2007-01-05-Cmp-ConstExpr.ll llvm/branches/non-call-eh/test/Assembler/2007-01-16-CrashOnBadCast.ll llvm/branches/non-call-eh/test/Assembler/2007-01-16-CrashOnBadCast2.ll llvm/branches/non-call-eh/test/Assembler/2007-04-15-BadIntrinsic.ll llvm/branches/non-call-eh/test/Assembler/2007-11-26-AttributeOverload.ll llvm/branches/non-call-eh/test/Assembler/AutoUpgradeIntrinsics.ll llvm/branches/non-call-eh/test/Assembler/dg.exp llvm/branches/non-call-eh/test/Assembler/select.ll llvm/branches/non-call-eh/test/Bindings/Ocaml/ocaml.exp llvm/branches/non-call-eh/test/Bindings/Ocaml/vmcore.ml llvm/branches/non-call-eh/test/Bitcode/dg.exp llvm/branches/non-call-eh/test/Bitcode/memcpy.ll llvm/branches/non-call-eh/test/BugPoint/crash-narrowfunctiontest.ll llvm/branches/non-call-eh/test/BugPoint/misopt-basictest.ll llvm/branches/non-call-eh/test/BugPoint/remove_arguments_test.ll llvm/branches/non-call-eh/test/CodeGen/ARM/dg.exp llvm/branches/non-call-eh/test/CodeGen/Alpha/ctlz.ll llvm/branches/non-call-eh/test/CodeGen/Alpha/ctpop.ll llvm/branches/non-call-eh/test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll llvm/branches/non-call-eh/test/CodeGen/CBackend/2007-01-15-NamedArrayType.ll llvm/branches/non-call-eh/test/CodeGen/CBackend/dg.exp llvm/branches/non-call-eh/test/CodeGen/CellSPU/and_ops.ll llvm/branches/non-call-eh/test/CodeGen/CellSPU/dg.exp llvm/branches/non-call-eh/test/CodeGen/CellSPU/immed64.ll llvm/branches/non-call-eh/test/CodeGen/Generic/2002-04-14-UnexpectedUnsignedType.ll llvm/branches/non-call-eh/test/CodeGen/Generic/GC/badreadproto.ll llvm/branches/non-call-eh/test/CodeGen/Generic/GC/badrootproto.ll llvm/branches/non-call-eh/test/CodeGen/Generic/GC/badwriteproto.ll llvm/branches/non-call-eh/test/CodeGen/Generic/GC/dg.exp llvm/branches/non-call-eh/test/CodeGen/Generic/GC/outside.ll llvm/branches/non-call-eh/test/CodeGen/Generic/dg.exp llvm/branches/non-call-eh/test/CodeGen/Generic/spillccr.ll llvm/branches/non-call-eh/test/CodeGen/Generic/switch-lower-feature.ll llvm/branches/non-call-eh/test/CodeGen/IA64/dg.exp llvm/branches/non-call-eh/test/CodeGen/PowerPC/2007-04-24-InlineAsm-I-Modifier.ll llvm/branches/non-call-eh/test/CodeGen/PowerPC/atomic-1.ll llvm/branches/non-call-eh/test/CodeGen/PowerPC/atomic-2.ll llvm/branches/non-call-eh/test/CodeGen/PowerPC/dg.exp llvm/branches/non-call-eh/test/CodeGen/SPARC/dg.exp llvm/branches/non-call-eh/test/CodeGen/X86/2006-04-27-ISelFoldingBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2006-05-11-InstrSched.ll llvm/branches/non-call-eh/test/CodeGen/X86/2006-05-17-VectorArg.ll llvm/branches/non-call-eh/test/CodeGen/X86/2006-07-31-SingleRegClass.ll llvm/branches/non-call-eh/test/CodeGen/X86/2006-11-17-IllegalMove.ll llvm/branches/non-call-eh/test/CodeGen/X86/2006-11-28-Memcpy.ll llvm/branches/non-call-eh/test/CodeGen/X86/2007-01-13-StackPtrIndex.ll llvm/branches/non-call-eh/test/CodeGen/X86/2007-06-28-X86-64-isel.ll llvm/branches/non-call-eh/test/CodeGen/X86/2007-06-29-DAGCombinerBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2007-06-29-VecFPConstantCSEBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2007-07-03-GR64ToVR64.ll llvm/branches/non-call-eh/test/CodeGen/X86/2007-10-04-AvoidEFLAGSCopy.ll llvm/branches/non-call-eh/test/CodeGen/X86/2007-11-14-Coalescer-Bug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2007-11-30-LoadFolding-Bug.ll llvm/branches/non-call-eh/test/CodeGen/X86/2008-02-18-TailMergingBug.ll llvm/branches/non-call-eh/test/CodeGen/X86/aligned-comm.ll llvm/branches/non-call-eh/test/CodeGen/X86/dagcombine-cse.ll llvm/branches/non-call-eh/test/CodeGen/X86/dg.exp llvm/branches/non-call-eh/test/CodeGen/X86/dollar-name.ll llvm/branches/non-call-eh/test/CodeGen/X86/extractelement-from-arg.ll llvm/branches/non-call-eh/test/CodeGen/X86/loop-strength-reduce2.ll llvm/branches/non-call-eh/test/CodeGen/X86/mingw-alloca.ll llvm/branches/non-call-eh/test/CodeGen/X86/mmx-insert-element.ll llvm/branches/non-call-eh/test/CodeGen/X86/mmx-shift.ll llvm/branches/non-call-eh/test/CodeGen/X86/nancvt.ll llvm/branches/non-call-eh/test/CodeGen/X86/packed_struct.ll llvm/branches/non-call-eh/test/CodeGen/X86/prefetch.ll llvm/branches/non-call-eh/test/CodeGen/X86/scalar_sse_minmax.ll llvm/branches/non-call-eh/test/CodeGen/X86/split-select.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-0.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-1.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-10.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-11.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-12.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-2.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-3.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-4.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-5.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-6.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-7.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-8.ll llvm/branches/non-call-eh/test/CodeGen/X86/sse-align-9.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_add.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_align.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_clear.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_ctbits.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_extract-sse4.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_fneg.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_insert-2.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_insert-3.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_logical.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_return.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-2.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-4.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-5.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-6.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-7.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-9.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-A.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set-B.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_set.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_shuffle-11.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_shuffle-12.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_shuffle-13.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_shuffle-16.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_shuffle-2.ll llvm/branches/non-call-eh/test/CodeGen/X86/vec_ss_load_fold.ll llvm/branches/non-call-eh/test/CodeGen/X86/xor_not.ll llvm/branches/non-call-eh/test/DebugInfo/dg.exp llvm/branches/non-call-eh/test/ExecutionEngine/2002-12-16-ArgTest.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-01-04-ArgumentBug.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-01-04-LoopTest.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-01-04-PhiTest.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-01-09-SARTest.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-01-10-FUCOM.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-01-15-AlignmentTest.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-05-11-PHIRegAllocBug.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-06-04-bzip2-bug.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-06-05-PHIBug.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-08-15-AllocaAssertion.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-08-21-EnvironmentTest.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-08-23-RegisterAllocatePhysReg.ll llvm/branches/non-call-eh/test/ExecutionEngine/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.ll llvm/branches/non-call-eh/test/ExecutionEngine/2004-12-04-LazyCompileFuncs.ll llvm/branches/non-call-eh/test/ExecutionEngine/2007-12-10-APIntLoadStore.ll llvm/branches/non-call-eh/test/ExecutionEngine/2007-12-14-BigEndian.ll llvm/branches/non-call-eh/test/ExecutionEngine/2007-12-14-LittleEndian.ll llvm/branches/non-call-eh/test/ExecutionEngine/dg.exp llvm/branches/non-call-eh/test/ExecutionEngine/hello.ll llvm/branches/non-call-eh/test/ExecutionEngine/hello2.ll llvm/branches/non-call-eh/test/ExecutionEngine/simplesttest.ll llvm/branches/non-call-eh/test/ExecutionEngine/simpletest.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-branch.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-call.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-cast.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-constantexpr.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-fp.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-loadstore.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-logical.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-loop.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-malloc.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-phi.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-ret.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-setcond-fp.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-setcond-int.ll llvm/branches/non-call-eh/test/ExecutionEngine/test-shift.ll llvm/branches/non-call-eh/test/Feature/dg.exp llvm/branches/non-call-eh/test/Feature/globalredefinition3.ll llvm/branches/non-call-eh/test/Feature/llvm2cpp.exp llvm/branches/non-call-eh/test/Feature/llvm2cpp.ll llvm/branches/non-call-eh/test/Feature/packed_struct.ll llvm/branches/non-call-eh/test/FrontendObjC/2007-10-03-MetadataPointers.mm llvm/branches/non-call-eh/test/Integer/dg.exp llvm/branches/non-call-eh/test/Integer/packed_struct_bt.ll llvm/branches/non-call-eh/test/Linker/2003-01-30-LinkerRename.ll llvm/branches/non-call-eh/test/Linker/2003-04-21-Linkage.ll llvm/branches/non-call-eh/test/Linker/2003-04-23-LinkOnceLost.ll llvm/branches/non-call-eh/test/Linker/2003-04-26-NullPtrLinkProblem.ll llvm/branches/non-call-eh/test/Linker/2003-05-31-LinkerRename.ll llvm/branches/non-call-eh/test/Linker/2003-10-21-ConflictingTypesTolerance.ll llvm/branches/non-call-eh/test/Linker/2004-05-07-TypeResolution1.ll llvm/branches/non-call-eh/test/Linker/2004-12-03-DisagreeingType.ll llvm/branches/non-call-eh/test/Linker/2006-01-19-ConstantPacked.ll llvm/branches/non-call-eh/test/Linker/dg.exp llvm/branches/non-call-eh/test/Linker/link-archive.ll llvm/branches/non-call-eh/test/Linker/redefinition.ll llvm/branches/non-call-eh/test/Makefile llvm/branches/non-call-eh/test/Other/2007-06-05-PassID.ll llvm/branches/non-call-eh/test/Other/2007-06-16-Funcname.ll llvm/branches/non-call-eh/test/Other/dg.exp llvm/branches/non-call-eh/test/Other/invalid-commandline-option.ll llvm/branches/non-call-eh/test/Scripts/count llvm/branches/non-call-eh/test/TableGen/BitsInitOverflow.td llvm/branches/non-call-eh/test/TableGen/UnterminatedComment.td llvm/branches/non-call-eh/test/Transforms/ADCE/dg.exp llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/aggregate-promote.ll llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/control-flow.ll llvm/branches/non-call-eh/test/Transforms/ArgumentPromotion/dg.exp llvm/branches/non-call-eh/test/Transforms/BlockPlacement/basictest.ll llvm/branches/non-call-eh/test/Transforms/BlockPlacement/dg.exp llvm/branches/non-call-eh/test/Transforms/CodeExtractor/dg.exp llvm/branches/non-call-eh/test/Transforms/ConstProp/dg.exp llvm/branches/non-call-eh/test/Transforms/ConstantMerge/dg.exp llvm/branches/non-call-eh/test/Transforms/DeadArgElim/2007-12-20-ParamAttrs.ll llvm/branches/non-call-eh/test/Transforms/DeadArgElim/deadretval2.ll llvm/branches/non-call-eh/test/Transforms/DeadArgElim/dg.exp llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/2004-11-28-LiveStoreDeleted.ll llvm/branches/non-call-eh/test/Transforms/DeadStoreElimination/dg.exp llvm/branches/non-call-eh/test/Transforms/GCSE/dg.exp llvm/branches/non-call-eh/test/Transforms/GVN/dg.exp llvm/branches/non-call-eh/test/Transforms/GVNPRE/dg.exp llvm/branches/non-call-eh/test/Transforms/GlobalDCE/dg.exp llvm/branches/non-call-eh/test/Transforms/GlobalOpt/dg.exp llvm/branches/non-call-eh/test/Transforms/IPConstantProp/dg.exp llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-constant.ll llvm/branches/non-call-eh/test/Transforms/IPConstantProp/return-constants.ll llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2003-12-21-IndVarSize.ll llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/2004-04-05-InvokeCastCrash.ll llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/dg.exp llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/exit_value_tests.ll llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/loop_evaluate_1.ll llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/loop_evaluate_2.ll llvm/branches/non-call-eh/test/Transforms/IndVarsSimplify/tripcount_compute.ll llvm/branches/non-call-eh/test/Transforms/Inline/2007-12-19-InlineNoUnwind.ll llvm/branches/non-call-eh/test/Transforms/Inline/basictest.ll llvm/branches/non-call-eh/test/Transforms/Inline/dg.exp llvm/branches/non-call-eh/test/Transforms/Inline/inline_dce.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2003-11-13-ConstExprCastCall.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2004-09-20-BadLoadCombine2.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2004-11-27-SetCCForCastLargerAndConstant.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2006-10-19-SignedToUnsignedCastAndConst-2.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-01-06-BitCastAttributes.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/2008-01-21-MismatchedCastAndCompare.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/add2.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/apint-call-cast-target.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/bittest.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/bswap-fold.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/call.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/dg.exp llvm/branches/non-call-eh/test/Transforms/InstCombine/div.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/memmove.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/not.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/setcc-cast-cast.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/sub.ll llvm/branches/non-call-eh/test/Transforms/InstCombine/zext-fold.ll llvm/branches/non-call-eh/test/Transforms/LCSSA/dg.exp llvm/branches/non-call-eh/test/Transforms/LICM/2003-02-27-PreheaderProblem.ll llvm/branches/non-call-eh/test/Transforms/LICM/dg.exp llvm/branches/non-call-eh/test/Transforms/LoopIndexSplit/dg.exp llvm/branches/non-call-eh/test/Transforms/LoopRotate/dg.exp llvm/branches/non-call-eh/test/Transforms/LoopSimplify/dg.exp llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dg.exp llvm/branches/non-call-eh/test/Transforms/LoopStrengthReduce/dont-hoist-simple-loop-constants.ll llvm/branches/non-call-eh/test/Transforms/LoopUnroll/dg.exp llvm/branches/non-call-eh/test/Transforms/LoopUnswitch/dg.exp llvm/branches/non-call-eh/test/Transforms/LowerInvoke/dg.exp llvm/branches/non-call-eh/test/Transforms/LowerSetJmp/dg.exp llvm/branches/non-call-eh/test/Transforms/LowerSwitch/dg.exp llvm/branches/non-call-eh/test/Transforms/Mem2Reg/dg.exp llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/dg.exp llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/form-memset.ll llvm/branches/non-call-eh/test/Transforms/MemCpyOpt/form-memset2.ll llvm/branches/non-call-eh/test/Transforms/PredicateSimplifier/dg.exp llvm/branches/non-call-eh/test/Transforms/PruneEH/dg.exp llvm/branches/non-call-eh/test/Transforms/RaiseAllocations/dg.exp llvm/branches/non-call-eh/test/Transforms/Reassociate/dg.exp llvm/branches/non-call-eh/test/Transforms/Reassociate/mulfactor2.ll llvm/branches/non-call-eh/test/Transforms/SCCP/2008-03-10-sret.ll llvm/branches/non-call-eh/test/Transforms/SCCP/calltest.ll llvm/branches/non-call-eh/test/Transforms/SCCP/dg.exp llvm/branches/non-call-eh/test/Transforms/SRETPromotion/dg.exp llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2003-09-12-IncorrectPromote.ll llvm/branches/non-call-eh/test/Transforms/ScalarRepl/2003-10-29-ArrayProblem.ll llvm/branches/non-call-eh/test/Transforms/ScalarRepl/dg.exp llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2003-08-17-BranchFold.ll llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/2003-08-17-BranchFoldOrdering.ll llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/branch-fold-test.ll llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/branch-phi-thread.ll llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/dg.exp llvm/branches/non-call-eh/test/Transforms/SimplifyCFG/switch_thread.ll llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/FFS.ll llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/MemCpy.ll llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/StrChr.ll llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/dg.exp llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/floor.ll llvm/branches/non-call-eh/test/Transforms/SimplifyLibCalls/memcmp.ll llvm/branches/non-call-eh/test/Transforms/StripSymbols/dg.exp llvm/branches/non-call-eh/test/Transforms/TailCallElim/dg.exp llvm/branches/non-call-eh/test/Transforms/TailDup/MergeTest.ll llvm/branches/non-call-eh/test/Transforms/TailDup/dg.exp llvm/branches/non-call-eh/test/Verifier/2004-05-21-SwitchConstantMismatch.ll llvm/branches/non-call-eh/test/Verifier/2006-07-11-StoreStruct.ll llvm/branches/non-call-eh/test/Verifier/2007-12-21-InvokeParamAttrs.ll llvm/branches/non-call-eh/test/Verifier/2008-01-11-VarargAttrs.ll llvm/branches/non-call-eh/test/Verifier/byval-1.ll llvm/branches/non-call-eh/test/Verifier/byval-2.ll llvm/branches/non-call-eh/test/Verifier/byval-4.ll llvm/branches/non-call-eh/test/Verifier/dg.exp llvm/branches/non-call-eh/test/Verifier/gcread-ptrptr.ll llvm/branches/non-call-eh/test/Verifier/gcroot-alloca.ll llvm/branches/non-call-eh/test/Verifier/gcroot-meta.ll llvm/branches/non-call-eh/test/Verifier/gcroot-ptrptr.ll llvm/branches/non-call-eh/test/Verifier/gcwrite-ptrptr.ll llvm/branches/non-call-eh/test/Verifier/invoke-2.ll llvm/branches/non-call-eh/test/lib/llvm.exp llvm/branches/non-call-eh/test/lib/llvm2cpp.exp llvm/branches/non-call-eh/tools/Makefile llvm/branches/non-call-eh/tools/bugpoint/CrashDebugger.cpp llvm/branches/non-call-eh/tools/bugpoint/ExecutionDriver.cpp llvm/branches/non-call-eh/tools/bugpoint/ExtractFunction.cpp llvm/branches/non-call-eh/tools/bugpoint/Miscompilation.cpp llvm/branches/non-call-eh/tools/bugpoint/OptimizerDriver.cpp llvm/branches/non-call-eh/tools/bugpoint/ToolRunner.cpp llvm/branches/non-call-eh/tools/bugpoint/ToolRunner.h llvm/branches/non-call-eh/tools/llc/llc.cpp llvm/branches/non-call-eh/tools/lli/lli.cpp llvm/branches/non-call-eh/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp llvm/branches/non-call-eh/tools/llvm-ld/Optimize.cpp llvm/branches/non-call-eh/tools/llvm-ld/llvm-ld.cpp llvm/branches/non-call-eh/tools/llvm-link/llvm-link.cpp llvm/branches/non-call-eh/tools/llvm-nm/llvm-nm.cpp llvm/branches/non-call-eh/tools/llvm-stub/llvm-stub.c llvm/branches/non-call-eh/tools/llvmc2/ (props changed) llvm/branches/non-call-eh/tools/llvmc2/Common.td llvm/branches/non-call-eh/tools/llvmc2/Makefile llvm/branches/non-call-eh/tools/llvmc2/Tools.td llvm/branches/non-call-eh/tools/llvmc2/doc/LLVMC-Enhancements.rst llvm/branches/non-call-eh/tools/opt/GraphPrinters.cpp llvm/branches/non-call-eh/tools/opt/opt.cpp llvm/branches/non-call-eh/utils/GenLibDeps.pl llvm/branches/non-call-eh/utils/NewNightlyTest.pl llvm/branches/non-call-eh/utils/TableGen/AsmWriterEmitter.cpp llvm/branches/non-call-eh/utils/TableGen/CallingConvEmitter.cpp llvm/branches/non-call-eh/utils/TableGen/CodeEmitterGen.cpp llvm/branches/non-call-eh/utils/TableGen/CodeGenDAGPatterns.cpp llvm/branches/non-call-eh/utils/TableGen/CodeGenDAGPatterns.h llvm/branches/non-call-eh/utils/TableGen/CodeGenInstruction.cpp llvm/branches/non-call-eh/utils/TableGen/CodeGenInstruction.h llvm/branches/non-call-eh/utils/TableGen/CodeGenIntrinsics.h llvm/branches/non-call-eh/utils/TableGen/CodeGenRegisters.h llvm/branches/non-call-eh/utils/TableGen/CodeGenTarget.cpp llvm/branches/non-call-eh/utils/TableGen/CodeGenTarget.h llvm/branches/non-call-eh/utils/TableGen/DAGISelEmitter.cpp llvm/branches/non-call-eh/utils/TableGen/DAGISelEmitter.h llvm/branches/non-call-eh/utils/TableGen/InstrInfoEmitter.cpp llvm/branches/non-call-eh/utils/TableGen/IntrinsicEmitter.cpp llvm/branches/non-call-eh/utils/TableGen/Record.cpp llvm/branches/non-call-eh/utils/TableGen/RegisterInfoEmitter.cpp llvm/branches/non-call-eh/utils/TableGen/TableGen.cpp llvm/branches/non-call-eh/utils/buildit/build_llvm llvm/branches/non-call-eh/utils/vim/tablegen.vim llvm/branches/non-call-eh/win32/Analysis/Analysis.vcproj llvm/branches/non-call-eh/win32/Archive/Archive.vcproj llvm/branches/non-call-eh/win32/AsmParser/AsmParser.vcproj llvm/branches/non-call-eh/win32/Bitcode/Bitcode.vcproj llvm/branches/non-call-eh/win32/CBackend/CBackend.vcproj llvm/branches/non-call-eh/win32/CodeGen/CodeGen.vcproj llvm/branches/non-call-eh/win32/Configure/Configure.vcproj llvm/branches/non-call-eh/win32/ExecutionEngine/ExecutionEngine.vcproj llvm/branches/non-call-eh/win32/Fibonacci/Fibonacci.vcproj llvm/branches/non-call-eh/win32/Linker/Linker.vcproj llvm/branches/non-call-eh/win32/Support/Support.vcproj llvm/branches/non-call-eh/win32/System/System.vcproj llvm/branches/non-call-eh/win32/TableGen/TableGen.vcproj llvm/branches/non-call-eh/win32/Target/Target.vcproj llvm/branches/non-call-eh/win32/Transforms/Transforms.vcproj llvm/branches/non-call-eh/win32/VMCore/VMCore.vcproj llvm/branches/non-call-eh/win32/bugpoint/bugpoint.vcproj llvm/branches/non-call-eh/win32/clang.sln llvm/branches/non-call-eh/win32/dobison.cmd llvm/branches/non-call-eh/win32/llc/llc.vcproj llvm/branches/non-call-eh/win32/lli/lli.vcproj llvm/branches/non-call-eh/win32/llvm-ar/llvm-ar.vcproj llvm/branches/non-call-eh/win32/llvm-as/llvm-as.vcproj llvm/branches/non-call-eh/win32/llvm-bcanalyzer/llvm-bcanalyzer.vcproj llvm/branches/non-call-eh/win32/llvm-dis/llvm-dis.vcproj llvm/branches/non-call-eh/win32/llvm-ld/llvm-ld.vcproj llvm/branches/non-call-eh/win32/llvm-link/llvm-link.vcproj llvm/branches/non-call-eh/win32/llvm-nm/llvm-nm.vcproj llvm/branches/non-call-eh/win32/llvm-prof/llvm-prof.vcproj llvm/branches/non-call-eh/win32/llvm-ranlib/llvm-ranlib.vcproj llvm/branches/non-call-eh/win32/opt/opt.vcproj llvm/branches/non-call-eh/win32/x86/x86.vcproj Modified: llvm/branches/non-call-eh/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/CREDITS.TXT?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/CREDITS.TXT (original) +++ llvm/branches/non-call-eh/CREDITS.TXT Sun Jul 6 15:45:41 2008 @@ -110,6 +110,10 @@ D: Miscellaneous bug fixes D: Register allocation refactoring +N: Gabor Greif +E: ggreif at gmail.com +D: Improvements for space efficiency + N: Gordon Henriksen E: gordonhenriksen at mac.com D: Pluggable GC support Modified: llvm/branches/non-call-eh/LICENSE.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/LICENSE.TXT?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/LICENSE.TXT (original) +++ llvm/branches/non-call-eh/LICENSE.TXT Sun Jul 6 15:45:41 2008 @@ -62,7 +62,6 @@ Program Directory ------- --------- System Library llvm/lib/System -Compiler Driver llvm/tools/llvmc Autoconf llvm/autoconf llvm/projects/ModuleMaker/autoconf llvm/projects/sample/autoconf Modified: llvm/branches/non-call-eh/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/Makefile?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/Makefile (original) +++ llvm/branches/non-call-eh/Makefile Sun Jul 6 15:45:41 2008 @@ -77,9 +77,9 @@ dist-hook:: $(Echo) Eliminating files constructed by configure $(Verb) $(RM) -f \ - $(TopDistDir)/include/llvm/ADT/hash_map \ - $(TopDistDir)/include/llvm/ADT/hash_set \ - $(TopDistDir)/include/llvm/ADT/iterator \ + $(TopDistDir)/include/llvm/ADT/hash_map.h \ + $(TopDistDir)/include/llvm/ADT/hash_set.h \ + $(TopDistDir)/include/llvm/ADT/iterator.h \ $(TopDistDir)/include/llvm/Config/config.h \ $(TopDistDir)/include/llvm/Support/DataTypes.h \ $(TopDistDir)/include/llvm/Support/ThreadSupport.h @@ -95,9 +95,9 @@ FilesToConfig := \ include/llvm/Config/config.h \ include/llvm/Support/DataTypes.h \ - include/llvm/ADT/hash_map \ - include/llvm/ADT/hash_set \ - include/llvm/ADT/iterator + include/llvm/ADT/hash_map.h \ + include/llvm/ADT/hash_set.h \ + include/llvm/ADT/iterator.h FilesToConfigPATH := $(addprefix $(LLVM_OBJ_ROOT)/,$(FilesToConfig)) all-local:: $(FilesToConfigPATH) Modified: llvm/branches/non-call-eh/Makefile.rules URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/Makefile.rules?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/Makefile.rules (original) +++ llvm/branches/non-call-eh/Makefile.rules Sun Jul 6 15:45:41 2008 @@ -226,7 +226,7 @@ # Darwin requires -fstrict-aliasing to be explicitly enabled. ifeq ($(OS),Darwin) - EXTRA_OPTIONS += -fstrict-aliasing + EXTRA_OPTIONS += -fstrict-aliasing -Wstrict-aliasing endif CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) @@ -451,6 +451,10 @@ DISABLE_AUTO_DEPENDENCIES=1 endif +ifeq ($(OS),SunOS) +CPP.BaseFlags += -include llvm/System/Solaris.h +endif + LD.Flags += -L$(LibDir) -L$(LLVMLibDir) CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS # All -I flags should go here, so that they don't confuse llvm-config. @@ -1738,10 +1742,17 @@ endif check-line-length: - @egrep -n '.{81}' $(Sources) + @echo searching for overlength lines in files: $(Sources) + @echo + @echo + @egrep -n '.{81}' $(Sources) /dev/null check-for-tabs: - @egrep -n ' ' $(Sources) + @echo searching for tabs in files: $(Sources) + @echo + @echo + @egrep -n ' ' $(Sources) /dev/null + check-footprint: @ls -l $(LibDir) | awk '\ BEGIN { sum = 0; } \ Modified: llvm/branches/non-call-eh/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/autoconf/configure.ac?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/autoconf/configure.ac (original) +++ llvm/branches/non-call-eh/autoconf/configure.ac Sun Jul 6 15:45:41 2008 @@ -31,7 +31,7 @@ dnl===-----------------------------------------------------------------------=== dnl Initialize autoconf and define the package name, version number and dnl email address for reporting bugs. -AC_INIT([[llvm]],[[2.3svn]],[llvmbugs at cs.uiuc.edu]) +AC_INIT([[llvm]],[[2.4svn]],[llvmbugs at cs.uiuc.edu]) dnl Provide a copyright substitution and ensure the copyright notice is included dnl in the output of --version option of the generated configure script. @@ -70,7 +70,10 @@ sample) AC_CONFIG_SUBDIRS([projects/sample]) ;; privbracket) AC_CONFIG_SUBDIRS([projects/privbracket]) ;; llvm-stacker) AC_CONFIG_SUBDIRS([projects/llvm-stacker]) ;; + # llvm-test is the old name of the test-suite, kept here for backwards + # compatibility llvm-test) AC_CONFIG_SUBDIRS([projects/llvm-test]) ;; + test-suite) AC_CONFIG_SUBDIRS([projects/test-suite]) ;; llvm-reopt) AC_CONFIG_SUBDIRS([projects/llvm-reopt]);; llvm-gcc) AC_CONFIG_SUBDIRS([projects/llvm-gcc]) ;; llvm-java) AC_CONFIG_SUBDIRS([projects/llvm-java]) ;; @@ -137,6 +140,11 @@ llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_os_type="NetBSD" llvm_cv_platform_type="Unix" ;; + *-*-dragonfly*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="DragonFly" + llvm_cv_platform_type="Unix" ;; *-*-hpux*) llvm_cv_link_all_option="-Wl,--whole-archive" llvm_cv_no_link_all_option="-Wl,--no-whole-archive" @@ -216,6 +224,7 @@ ia64-*) llvm_cv_target_arch="IA64" ;; arm-*) llvm_cv_target_arch="ARM" ;; mips-*) llvm_cv_target_arch="Mips" ;; + pic16-*) llvm_cv_target_arch="PIC16" ;; *) llvm_cv_target_arch="Unknown" ;; esac]) @@ -314,6 +323,7 @@ IA64) AC_SUBST(TARGET_HAS_JIT,0) ;; ARM) AC_SUBST(TARGET_HAS_JIT,0) ;; Mips) AC_SUBST(TARGET_HAS_JIT,0) ;; + PIC16) AC_SUBST(TARGET_HAS_JIT,0) ;; *) AC_SUBST(TARGET_HAS_JIT,0) ;; esac fi @@ -363,7 +373,7 @@ [Build specific host targets: all,host-only,{target-name} (default=all)]),, enableval=all) case "$enableval" in - all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU CBackend MSIL" ;; + all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU PIC16 CBackend MSIL CppBackend" ;; host-only) case "$llvm_cv_target_arch" in x86) TARGETS_TO_BUILD="X86" ;; @@ -375,6 +385,7 @@ ARM) TARGETS_TO_BUILD="ARM" ;; Mips) TARGETS_TO_BUILD="Mips" ;; CellSPU|SPU) TARGETS_TO_BUILD="CellSPU" ;; + PIC16) TARGETS_TO_BUILD="PIC16" ;; *) AC_MSG_ERROR([Can not set target to build]) ;; esac ;; @@ -389,8 +400,10 @@ arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;; + pic16) TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;; cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;; msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;; + cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;; *) AC_MSG_ERROR([Unrecognized target $a_target]) ;; esac done @@ -976,9 +989,9 @@ dnl files can be updated automatically when their *.in sources change. AC_CONFIG_HEADERS([include/llvm/Config/config.h]) AC_CONFIG_HEADERS([include/llvm/Support/DataTypes.h]) -AC_CONFIG_HEADERS([include/llvm/ADT/hash_map]) -AC_CONFIG_HEADERS([include/llvm/ADT/hash_set]) -AC_CONFIG_HEADERS([include/llvm/ADT/iterator]) +AC_CONFIG_HEADERS([include/llvm/ADT/hash_map.h]) +AC_CONFIG_HEADERS([include/llvm/ADT/hash_set.h]) +AC_CONFIG_HEADERS([include/llvm/ADT/iterator.h]) dnl Configure the makefile's configuration data AC_CONFIG_FILES([Makefile.config]) Modified: llvm/branches/non-call-eh/bindings/ocaml/llvm/llvm_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/bindings/ocaml/llvm/llvm_ocaml.c?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/bindings/ocaml/llvm/llvm_ocaml.c (original) +++ llvm/branches/non-call-eh/bindings/ocaml/llvm/llvm_ocaml.c Sun Jul 6 15:45:41 2008 @@ -329,7 +329,7 @@ } CAMLprim value llvm_refine_type(LLVMTypeRef AbstractTy, LLVMTypeRef ConcreteTy){ - LLVMRefineAbstractType(AbstractTy, ConcreteTy); + LLVMRefineType(AbstractTy, ConcreteTy); return Val_unit; } Modified: llvm/branches/non-call-eh/configure URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/configure?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/configure (original) +++ llvm/branches/non-call-eh/configure Sun Jul 6 15:45:41 2008 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.60 for llvm 2.3svn. +# Generated by GNU Autoconf 2.60 for llvm 2.4svn. # # Report bugs to . # @@ -715,8 +715,8 @@ # Identity of this package. PACKAGE_NAME='llvm' PACKAGE_TARNAME='-llvm-' -PACKAGE_VERSION='2.3svn' -PACKAGE_STRING='llvm 2.3svn' +PACKAGE_VERSION='2.4svn' +PACKAGE_STRING='llvm 2.4svn' PACKAGE_BUGREPORT='llvmbugs at cs.uiuc.edu' ac_unique_file="lib/VMCore/Module.cpp" @@ -951,6 +951,7 @@ projects/privbracket projects/llvm-stacker projects/llvm-test +projects/test-suite projects/llvm-reopt projects/llvm-gcc projects/llvm-java @@ -1459,7 +1460,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures llvm 2.3svn to adapt to many kinds of systems. +\`configure' configures llvm 2.4svn to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1525,7 +1526,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of llvm 2.3svn:";; + short | recursive ) echo "Configuration of llvm 2.4svn:";; esac cat <<\_ACEOF @@ -1660,7 +1661,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -llvm configure 2.3svn +llvm configure 2.4svn generated by GNU Autoconf 2.60 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1676,7 +1677,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by llvm $as_me 2.3svn, which was +It was created by llvm $as_me 2.4svn, which was generated by GNU Autoconf 2.60. Invocation command line was $ $0 $@ @@ -2089,8 +2090,12 @@ ;; llvm-stacker) subdirs="$subdirs projects/llvm-stacker" ;; + # llvm-test is the old name of the test-suite, kept here for backwards + # compatibility llvm-test) subdirs="$subdirs projects/llvm-test" ;; + test-suite) subdirs="$subdirs projects/test-suite" + ;; llvm-reopt) subdirs="$subdirs projects/llvm-reopt" ;; llvm-gcc) subdirs="$subdirs projects/llvm-gcc" @@ -2282,6 +2287,11 @@ llvm_cv_no_link_all_option="-Wl,--no-whole-archive" llvm_cv_os_type="NetBSD" llvm_cv_platform_type="Unix" ;; + *-*-dragonfly*) + llvm_cv_link_all_option="-Wl,--whole-archive" + llvm_cv_no_link_all_option="-Wl,--no-whole-archive" + llvm_cv_os_type="DragonFly" + llvm_cv_platform_type="Unix" ;; *-*-hpux*) llvm_cv_link_all_option="-Wl,--whole-archive" llvm_cv_no_link_all_option="-Wl,--no-whole-archive" @@ -2375,6 +2385,7 @@ ia64-*) llvm_cv_target_arch="IA64" ;; arm-*) llvm_cv_target_arch="ARM" ;; mips-*) llvm_cv_target_arch="Mips" ;; + pic16-*) llvm_cv_target_arch="PIC16" ;; *) llvm_cv_target_arch="Unknown" ;; esac fi @@ -4662,6 +4673,8 @@ ;; Mips) TARGET_HAS_JIT=0 ;; + PIC16) TARGET_HAS_JIT=0 + ;; *) TARGET_HAS_JIT=0 ;; esac @@ -4743,7 +4756,7 @@ fi case "$enableval" in - all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU CBackend MSIL" ;; + all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU PIC16 CBackend MSIL CppBackend" ;; host-only) case "$llvm_cv_target_arch" in x86) TARGETS_TO_BUILD="X86" ;; @@ -4755,6 +4768,7 @@ ARM) TARGETS_TO_BUILD="ARM" ;; Mips) TARGETS_TO_BUILD="Mips" ;; CellSPU|SPU) TARGETS_TO_BUILD="CellSPU" ;; + PIC16) TARGETS_TO_BUILD="PIC16" ;; *) { { echo "$as_me:$LINENO: error: Can not set target to build" >&5 echo "$as_me: error: Can not set target to build" >&2;} { (exit 1); exit 1; }; } ;; @@ -4771,8 +4785,10 @@ arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;; + pic16) TARGETS_TO_BUILD="PIC16 $TARGETS_TO_BUILD" ;; cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;; msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;; + cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;; *) { { echo "$as_me:$LINENO: error: Unrecognized target $a_target" >&5 echo "$as_me: error: Unrecognized target $a_target" >&2;} { (exit 1); exit 1; }; } ;; @@ -10630,7 +10646,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 12793 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -14492,11 +14508,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:14495: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14511: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14499: \$? = $ac_status" >&5 + echo "$as_me:14515: \$? = $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. @@ -14760,11 +14776,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:14763: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14779: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:14767: \$? = $ac_status" >&5 + echo "$as_me:14783: \$? = $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. @@ -14864,11 +14880,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:14867: $lt_compile\"" >&5) + (eval echo "\"\$as_me:14883: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:14871: \$? = $ac_status" >&5 + echo "$as_me:14887: \$? = $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 @@ -17316,7 +17332,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:19803: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:19791: \$? = $ac_status" >&5 + echo "$as_me:19807: \$? = $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. @@ -19888,11 +19904,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:19891: $lt_compile\"" >&5) + (eval echo "\"\$as_me:19907: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:19895: \$? = $ac_status" >&5 + echo "$as_me:19911: \$? = $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 @@ -21458,11 +21474,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:21461: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21477: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:21465: \$? = $ac_status" >&5 + echo "$as_me:21481: \$? = $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. @@ -21562,11 +21578,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:21565: $lt_compile\"" >&5) + (eval echo "\"\$as_me:21581: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:21569: \$? = $ac_status" >&5 + echo "$as_me:21585: \$? = $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 @@ -23797,11 +23813,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:23800: $lt_compile\"" >&5) + (eval echo "\"\$as_me:23816: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:23804: \$? = $ac_status" >&5 + echo "$as_me:23820: \$? = $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. @@ -24065,11 +24081,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:24068: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24084: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:24072: \$? = $ac_status" >&5 + echo "$as_me:24088: \$? = $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. @@ -24169,11 +24185,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:24172: $lt_compile\"" >&5) + (eval echo "\"\$as_me:24188: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:24176: \$? = $ac_status" >&5 + echo "$as_me:24192: \$? = $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 @@ -34255,11 +34271,11 @@ ac_config_headers="$ac_config_headers include/llvm/Support/DataTypes.h" -ac_config_headers="$ac_config_headers include/llvm/ADT/hash_map" +ac_config_headers="$ac_config_headers include/llvm/ADT/hash_map.h" -ac_config_headers="$ac_config_headers include/llvm/ADT/hash_set" +ac_config_headers="$ac_config_headers include/llvm/ADT/hash_set.h" -ac_config_headers="$ac_config_headers include/llvm/ADT/iterator" +ac_config_headers="$ac_config_headers include/llvm/ADT/iterator.h" ac_config_files="$ac_config_files Makefile.config" @@ -34710,7 +34726,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by llvm $as_me 2.3svn, which was +This file was extended by llvm $as_me 2.4svn, which was generated by GNU Autoconf 2.60. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -34763,7 +34779,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -llvm config.status 2.3svn +llvm config.status 2.4svn configured by $0, generated by GNU Autoconf 2.60, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" @@ -34878,9 +34894,9 @@ case $ac_config_target in "include/llvm/Config/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Config/config.h" ;; "include/llvm/Support/DataTypes.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/Support/DataTypes.h" ;; - "include/llvm/ADT/hash_map") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_map" ;; - "include/llvm/ADT/hash_set") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_set" ;; - "include/llvm/ADT/iterator") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/iterator" ;; + "include/llvm/ADT/hash_map.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_map.h" ;; + "include/llvm/ADT/hash_set.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/hash_set.h" ;; + "include/llvm/ADT/iterator.h") CONFIG_HEADERS="$CONFIG_HEADERS include/llvm/ADT/iterator.h" ;; "Makefile.config") CONFIG_FILES="$CONFIG_FILES Makefile.config" ;; "llvm.spec") CONFIG_FILES="$CONFIG_FILES llvm.spec" ;; "docs/doxygen.cfg") CONFIG_FILES="$CONFIG_FILES docs/doxygen.cfg" ;; Modified: llvm/branches/non-call-eh/docs/CodeGenerator.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/CodeGenerator.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/CodeGenerator.html (original) +++ llvm/branches/non-call-eh/docs/CodeGenerator.html Sun Jul 6 15:45:41 2008 @@ -84,6 +84,7 @@
  • Target-specific Implementation Notes
      +
    • Tail call optimization
    • The X86 backend
    • The PowerPC backend
        @@ -620,9 +621,9 @@
        -int %test(int %X, int %Y) {
        -  %Z = div int %X, %Y
        -  ret int %Z
        +define i32 @test(i32 %X, i32 %Y) {
        +  %Z = udiv i32 %X, %Y
        +  ret i32 %Z
         }
         
        @@ -789,7 +790,8 @@ edges are represented by instances of the SDOperand class, which is a <SDNode, unsigned> pair, indicating the node and result value being used, respectively. Each value produced by an SDNode has -an associated MVT::ValueType indicating what type the value is.

        +an associated MVT (Machine Value Type) indicating what the type of the +value is.

        SelectionDAGs contain two different kinds of values: those that represent data flow and those that represent control flow dependencies. Data values are @@ -1466,12 +1468,12 @@

         %a = MOVE %b
        -%a = ADD %a %b
        +%a = ADD %a %c
         

        Notice that, internally, the second instruction is represented as -ADD %a[def/use] %b. I.e., the register operand %a is +ADD %a[def/use] %c. I.e., the register operand %a is both used and defined by the instruction.

        @@ -1620,7 +1622,51 @@ + + + +
        +

        Tail call optimization, callee reusing the stack of the caller, is currently supported on x86/x86-64 and PowerPC. It is performed if: +

          +
        • Caller and callee have the calling convention fastcc.
        • +
        • The call is a tail call - in tail position (ret immediately follows call and ret uses value of call or is void).
        • +
        • Option -tailcallopt is enabled.
        • +
        • Platform specific constraints are met.
        • +
        +

        +

        x86/x86-64 constraints: +

          +
        • No variable argument lists are used.
        • +
        • On x86-64 when generating GOT/PIC code only module-local calls (visibility = hidden or protected) are supported.
        • +
        +

        +

        PowerPC constraints: +

          +
        • No variable argument lists are used.
        • +
        • No byval parameters are used.
        • +
        • On ppc32/64 GOT/PIC only module-local calls (visibility = hidden or protected) are supported.
        • +
        +

        +

        Example:

        +

        Call as llc -tailcallopt test.ll. +

        +
        +declare fastcc i32 @tailcallee(i32 inreg %a1, i32 inreg %a2, i32 %a3, i32 %a4)
        +
        +define fastcc i32 @tailcaller(i32 %in1, i32 %in2) {
        +  %l1 = add i32 %in1, %in2
        +  %tmp = tail call fastcc i32 @tailcallee(i32 %in1 inreg, i32 %in2 inreg, i32 %in1, i32 %l1)
        +  ret i32 %tmp
        +}
        +
        +

        +

        Implications of -tailcallopt:

        +

        To support tail call optimization in situations where the callee has more arguments than the caller a 'callee pops arguments' convention is used. This currently causes each fastcc call that is not tail call optimized (because one or more of above constraints are not met) to be followed by a readjustment of the stack. So performance might be worse in such cases.

        +

        On x86 and x86-64 one register is reserved for indirect tail calls (e.g via a function pointer). So there is one less register for integer argument passing. For x86 this means 2 registers (if inreg parameter attribute is used) and for x86-64 this means 5 register are used.

        +
        The X86 backend Modified: llvm/branches/non-call-eh/docs/CodingStandards.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/CodingStandards.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/CodingStandards.html (original) +++ llvm/branches/non-call-eh/docs/CodingStandards.html Sun Jul 6 15:45:41 2008 @@ -623,6 +623,29 @@

        You get the idea...

        +

        Please be aware when adding assert statements that not all compilers are aware of +the semantics of the assert. In some places, asserts are used to indicate a piece of +code that should not be reached. These are typically of the form:

        + +
        +
        +assert(0 && "Some helpful error message");
        +
        +
        + +

        When used in a function that returns a value, they should be followed with a return +statement and a comment indicating that this line is never reached. This will prevent +a compiler which is unable to deduce that the assert statement never returns from +generating a warning.

        + +
        +
        +assert(0 && "Some helpful error message");
        +// Not reached
        +return 0;
        +
        +
        +
        Modified: llvm/branches/non-call-eh/docs/CommandGuide/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/CommandGuide/Makefile?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/CommandGuide/Makefile (original) +++ llvm/branches/non-call-eh/docs/CommandGuide/Makefile Sun Jul 6 15:45:41 2008 @@ -23,6 +23,12 @@ clean: rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS) + +# To create other directories, as needed, and timestamp their creation +%/.dir: + -mkdir $* > /dev/null + date > $@ + else # Otherwise, if not in BUILD_FOR_WEBSITE mode, use the project info. Modified: llvm/branches/non-call-eh/docs/CommandGuide/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/CommandGuide/index.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/CommandGuide/index.html (original) +++ llvm/branches/non-call-eh/docs/CommandGuide/index.html Sun Jul 6 15:45:41 2008 @@ -63,17 +63,12 @@
      • llvm-prof - format raw `llvmprof.out' data into a human-readable report
      • -
      • llvmc - - generic and configurable compiler driver
      • -
      • llvm-ld - general purpose linker with loadable runtime optimization support
      • llvm-config - print out LLVM compilation options, libraries, etc. as configured.
      • -
      • llvm2cpp - convert LLVM assembly - into the corresponding LLVM C++ API calls to produce it
      Modified: llvm/branches/non-call-eh/docs/CommandGuide/llvm-ld.pod URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/CommandGuide/llvm-ld.pod?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/CommandGuide/llvm-ld.pod (original) +++ llvm/branches/non-call-eh/docs/CommandGuide/llvm-ld.pod Sun Jul 6 15:45:41 2008 @@ -159,34 +159,6 @@ =over -=item B<-O0> - -An alias for the -O1 option. - -=item B<-O1> - -Optimize for linking speed, not execution speed. The optimizer will attempt to -reduce the size of the linked program to reduce I/O but will not otherwise -perform any link-time optimizations. - -=item B<-O2> - -Perform only the minimal or required set of scalar optimizations. - -=item B<-03> - -An alias for the -O2 option. - -=item B<-04> - -Perform the standard link time inter-procedural optimizations. This will -attempt to optimize the program taking the entire program into consideration. - -=item B<-O5> - -Perform aggressive link time optimizations. This is the same as -O4 but works -more aggressively to optimize the program. - =item B<-disable-inlining> Do not run the inlining pass. Functions will not be inlined into other Removed: llvm/branches/non-call-eh/docs/CommandGuide/llvm2cpp.pod URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/CommandGuide/llvm2cpp.pod?rev=53162&view=auto ============================================================================== --- llvm/branches/non-call-eh/docs/CommandGuide/llvm2cpp.pod (original) +++ llvm/branches/non-call-eh/docs/CommandGuide/llvm2cpp.pod (removed) @@ -1,217 +0,0 @@ -=pod - -=head1 NAME - -llvm2xpp - LLVM bitcode to LLVM C++ IR translator - -=head1 SYNOPSIS - -B [I] [I] - -=head1 DESCRIPTION - -B translates from LLVM bitcode (.bc files) to a -corresponding C++ source file that will make calls against the LLVM C++ API to -build the same module as the input. By default, the C++ output is a complete -program that builds the module, verifies it and then emits the module as -LLVM assembly. This technique assists with testing because the input to -B and the output of the generated C++ program should be identical. - -If F is omitted or is C<->, then B reads its input from -standard input. - -If an output file is not specified with the B<-o> option, then -B sends its output to a file or standard output by following -these rules: - -=over - -=item * - -If the input is standard input, then the output is standard output. - -=item * - -If the input is a file that ends with C<.bc>, then the output file is of -the same name, except that the suffix is changed to C<.cpp>. - -=item * - -If the input is a file that does not end with the C<.bc> suffix, then the -output file has the same name as the input file, except that the C<.cpp> -suffix is appended. - -=back - -=head1 OPTIONS - -=over - -=item B<-f> - -Force overwrite. Normally, B will refuse to overwrite an -output file that already exists. With this option, B -will overwrite the output file and replace it with new C++ source code. - -=item B<--help> - -Print a summary of command line options. - -=item B<-f> - -Normally, B will not overwrite an existing output file. With this -option, that default behavior is changed and the program will overwrite existing -output files. - -=item B<-o> F - -Specify the output file name. If F is C<->, then B -sends its output to standard output. - -=item B<-funcname> F - -Specify the name of the function to be generated. The generated code contains a -single function that produces the input module. By default its name is -I. The B<-funcname> option overrides this default and allows -you to control the name of the generated function. This is handy in conjunction -with the B<-fragment> option when you only want B to generate a -single function that produces the module. With both options, such generated code -could be I<#included> into another program. - -=item B<-for> - -Specify the name of the thing for which C++ code should be generated. By default -the entire input module is re-generated. However, use of the various B<-gen-*> -options can restrict what is produced. This option indicates what that -restriction is. - -=item B<-gen-program> - -Specify that the output should be a complete program. Such program will recreate -B's input as an LLVM module, verify that module, and then write out -the module in LLVM assembly format. This is useful for doing identity tests -where the output of the generated program is identical to the input to -B. The LLVM DejaGnu test suite can make use of this fact. This is the -default form of generated output. - -If the B<-for> option is given with this option, it specifies the module -identifier to use for the module created. - -=item B<-gen-module> - -Specify that the output should be a function that regenerates the module. It is -assumed that this output will be #included into another program that has already -arranged for the correct header files to be #included. The function generated -takes no arguments and returns a I. - -If the B<-for> option is given with this option, it specifies the module -identifier to use in creating the module returned by the generated function. - -=item B<-gen-contents> - -Specify that the output should be a function that adds the contents of the input -module to another module. It is assumed that the output will be #included into -another program that has already arranged for the correct header files to be -#included. The function generated takes a single argument of type I and -returns that argument. Note that Module level attributes such as endianess, -pointer size, target triple and inline asm are not passed on from the input -module to the destination module. Only the sub-elements of the module (types, -constants, functions, global variables) will be added to the input module. - -If the B<-for> option is given with this option, it specifies the module -identifier to set in the input module by the generated function. - -=item B<-gen-function> - -Specify that the output should be a function that produces the definitions -necessary for a specific function to be added to a module. It is assumed that -the output will be #included into another program that has already arranged -for the correct header files to be #included. The function generated takes a -single argument of type I and returns the I that it added to -the module. Note that only those things (types, constants, etc.) directly -needed in the definition of the function will be placed in the generated -function. - -The B<-for> option must be given with this option or an error will be produced. -The value of the option must be the name of a function in the input module for -which code should be generated. If the named function does not exist an error -will be produced. - -=item B<-gen-inline> - -This option is very analagous to B<-gen-function> except that the generated -function will not re-produce the target function's definition. Instead, the body -of the target function is inserted into some other function passed as an -argument to the generated function. Similarly any arguments to the function must -be passed to the generated function. The result of the generated function is the -first basic block of the target function. - -The B<-for> option works the same way as it does for B<-gen-function>. - -=item B<-gen-variable> - -Specify that the output should be a function that produces the definitions -necessary for a specific global variable to be added to a module. It is assumed -that the output will be #included into another program that has already arranged -for the correct header files to be #included. The function generated takes a -single argument of type I and returns the I that it -added to the module. Note that only those things (types, constants, etc.) -directly needed in the definition of the global variable will be placed in the -generated function. - -The B<-for> option must be given with this option or an error will be produced. -THe value of the option must be the name of a global variable in the input -module for which code should be generated. If the named global variable does not -exist an error will be produced. - -=item B<-gen-type> - -Specify that the output should be a function that produces the definitions -necessary for specific type to be added to a module. It is assumed that the -otuput will be #included into another program that has already arranged for the -correct header files to be #included. The function generated take a single -argument of type I and returns the I that it added to the -module. Note that the generated function will only add the necessary type -definitions to (possibly recursively) define the requested type. - -The B<-for> option must be given with this option or an error will be produced. -The value of the option must be the name of a global type in the input module -for which code should be generated. If the named type does not exist an error -will be produced. - -=item B<-stats> - -Show pass statistics (not interesting in this program). - -=item B<-time-passes> - -Show pass timing statistics (not interesting in this program). - -=item B<-version> - -Show the version number of this program. - -=back - - -=head1 EXIT STATUS - -If B succeeds, it will exit with 0. Otherwise, if an error -occurs, it will exit with a non-zero value. - -=head1 SEE ALSO - -L L - -=head1 NOTES - -This tool may be removed from a future version of LLVM. Instead, its -functionality may be incorporated into the llc tool. It would then act similarly -to other targets except its output would be C++ source that could be compiled to -construct the input program. - -=head1 AUTHORS - -Written by Reid Spencer (L). - -=cut Removed: llvm/branches/non-call-eh/docs/CommandGuide/llvmc.pod URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/CommandGuide/llvmc.pod?rev=53162&view=auto ============================================================================== --- llvm/branches/non-call-eh/docs/CommandGuide/llvmc.pod (original) +++ llvm/branches/non-call-eh/docs/CommandGuide/llvmc.pod (removed) @@ -1,431 +0,0 @@ -=pod - -=head1 NAME - -llvmc - The LLVM Compiler Driver (experimental) - -=head1 SYNOPSIS - -B [I] [I...] - -=head1 DESCRIPTION - -B is a configurable driver for invoking other LLVM (and non-LLVM) tools -in order to compile, optimize and link software for multiple languages. For -those familiar with FSF's B tool, it is very similar. Please note that -B is considered an experimental tool. B has the following goals: - -=over - -=item * provide a single point of access to the LLVM tool set, - -=item * hide the complexities of the LLVM tools through a single interface, - -=item * make integration of existing non-LLVM tools simple, - -=item * extend the capabilities of minimal front ends, and - -=item * make the interface for compiling consistent for all languages. - -=back - -The tool itself does nothing with a user's program. It merely invokes other -tools to get the compilation tasks done. - -The options supported by B generalize the compilation process and -provide a consistent and simple interface for multiple programming languages. -This makes it easier for developers to get their software compiled with LLVM. -Without B, developers would need to understand how to invoke the -front-end compiler, optimizer, assembler, and linker in order to compile their -programs. B's sole mission is to trivialize that process. - -=head2 Basic Operation - -B always takes the following basic actions: - -=over - -=item * Command line options and filenames are collected. - -The command line options provide the marching orders to B on what actions -it should perform. This is the I the user is making of B and it -is interpreted first. - -=item * Configuration files are read. - -Based on the options and the suffixes of the filenames presented, a set of -configuration files are read to configure the actions B will take. -Configuration files are provided by either LLVM or the front end compiler tools -that B invokes. Users generally don't need to be concerned with the -contents of the configuration files. - -=item * Determine actions to take. - -The tool chain needed to complete the task is determined. This is the primary -work of B. It breaks the request specified by the command line options -into a set of basic actions to be done: - -=over - -=item * Pre-processing: gathering/filtering compiler input (optional). - -=item * Translation: source language to bitcode conversion. - -=item * Assembly: bitcode to native code conversion. - -=item * Optimization: conversion of bitcode to something that runs faster. - -=item * Linking: combining multiple bitcode files to produce executable program. - -=back - -=item * Execute actions. - -The actions determined previously are executed sequentially and then -B terminates. - -=back - -=head1 OPTIONS - -=head2 Control Options - -Control options tell B what to do at a high level. The -following control options are defined: - -=over - -=item B<-c> or B<--compile> - -This option specifies that the linking phase is not to be run. All -previous phases, if applicable will run. This is generally how a given -bitcode file is compiled and optimized for a source language module. - -=item B<-k> or B<--link> or default - -This option (or the lack of any control option) specifies that all stages -of compilation, optimization, and linking should be attempted. Source files -specified on the command line will be compiled and linked with objects and -libraries also specified. - -=item B<-S> - -This option specifies that compilation should end in the creation of -an LLVM assembly file that can be later converted to an LLVM object -file. - -=item B<-E> - -This option specifies that no compilation or linking should be -performed. Only pre-processing, if applicable to the language being -compiled, is performed. For languages that support it, this will -result in the output containing the raw input to the compiler. - -=back - -=head2 Optimization Options - -Optimization with B is based on goals and specified with -the following -O options. The specific details of which -optimizations run is controlled by the configuration files because -each source language will have different needs. - -=over - -=item B<-O1> or B<-O0> (default, fast compilation) - -Only those optimizations that will hasten the compilation (mostly by reducing -the output) are applied. In general these are extremely fast and simple -optimizations that reduce emitted code size. The goal here is not to make the -resulting program fast but to make the compilation fast. If not specified, -this is the default level of optimization. - -=item B<-O2> (basic optimization) - -This level of optimization specifies a balance between generating good code -that will execute reasonably quickly and not spending too much time optimizing -the code to get there. For example, this level of optimization may include -things like global common sub-expression elimination, aggressive dead code -elimination, and scalar replication. - -=item B<-O3> (aggressive optimization) - -This level of optimization aggressively optimizes each set of files compiled -together. However, no link-time inter-procedural optimization is performed. -This level implies all the optimizations of the B<-O1> and B<-O2> optimization -levels, and should also provide loop optimizations and compile time -inter-procedural optimizations. Essentially, this level tries to do as much -as it can with the input it is given but doesn't do any link time IPO. - -=item B<-O4> (link time optimization) - -In addition to the previous three levels of optimization, this level of -optimization aggressively optimizes each program at link time. It employs -basic analysis and basic link-time inter-procedural optimizations, -considering the program as a whole. - -=item B<-O5> (aggressive link time optimization) - -This is the same as B<-O4> except it employs aggressive analyses and -aggressive inter-procedural optimization. - -=item B<-O6> (profile guided optimization: not implemented) - -This is the same as B<-O5> except that it employs profile-guided -re-optimization of the program after it has executed. Note that this implies -a single level of re-optimization based on run time profile analysis. Once -the re-optimization has completed, the profiling instrumentation is -removed and final optimizations are employed. - -=item B<-O7> (lifelong optimization: not implemented) - -This is the same as B<-O5> and similar to B<-O6> except that re-optimization -is performed through the life of the program. That is, each run will update -the profile by which future re-optimizations are directed. - -=back - -=head2 Input Options - -=over - -=item B<-l> I - -This option instructs B to locate a library named I and search -it for unresolved symbols when linking the program. - -=item B<-L> F - -This option instructs B to add F to the list of places in which -the linker will - -=item B<-x> I - -This option instructs B to regard the following input files as -containing programs in the language I. Normally, input file languages -are identified by their suffix but this option will override that default -behavior. The B<-x> option stays in effect until the end of the options or -a new B<-x> option is encountered. - -=back - -=head2 Output Options - -=over - -=item B<-m>I - -This option selects the back end code generator to use. The I portion -of the option names the back end to use. - -=item B<--native> - -Normally, B produces bitcode files at most stages of compilation. -With this option, B will arrange for native object files to be -generated with the B<-c> option, native assembly files to be generated -with the B<-S> option, and native executables to be generated with the -B<--link> option. In the case of the B<-E> option, the output will not -differ as there is no I version of pre-processed output. - -=item B<-o> F - -Specify the output file name. The contents of the file depend on other -options. - -=back - -=head2 Information Options - -=over - -=item B<-n> or B<--no-op> - -This option tells B to do everything but actually execute the -resulting tools. In combination with the B<-v> option, this causes B -to merely print out what it would have done. - -=item B<-v> or B<--verbose> - -This option will cause B to print out (on standard output) each of the -actions it takes to accomplish the objective. The output will immediately -precede the invocation of other tools. - -=item B<--stats> - -Print all statistics gathered during the compilation to the standard error. -Note that this option is merely passed through to the sub-tools to do with -as they please. - -=item B<--time-passes> - -Record the amount of time needed for each optimization pass and print it -to standard error. Like B<--stats> this option is just passed through to -the sub-tools to do with as they please. - -=item B<--time-programs> - -Record the amount of time each program (compilation tool) takes and print -it to the standard error. - -=back - -=head2 Language Specific Options - -=over - -=item B<-T,pre>=I - -Pass an arbitrary option to the pre-processor. - -=item B<-T,opt>=I - -Pass an arbitrary option to the optimizer. - -=item B<-T,lnk>=I - -Pass an arbitrary option to the linker. - -=item B<-T,asm>=I - -Pass an arbitrary option to the code generator. - -=back - -=head2 C/C++ Specific Options - -=over - -=item B<-I>F - -This option is just passed through to a C or C++ front end compiler to tell it -where include files can be found. - -=item B<-D>F - -This option is just passed through to a C or C++ front end compiler to tell it -to define a symbol. - -=back - -=head2 Miscellaneous Options - -=over - -=item B<--help> - -Print a summary of command line options. - -=item B<--version> - -This option will cause B to print out its version number and terminate. - -=back - -=head2 Advanced Options - -You better know what you're doing if you use these options. Improper use -of these options can produce drastically wrong results. - -=over - -=item B<--config-dir> F - -This option tells B to read configuration data from the I -named F. Data from such directories will be read in the order -specified on the command line after all other standard configuration files have -been read. This allows users or groups of users to conveniently create -their own configuration directories in addition to the standard ones to which -they may not have write access. - -=back - - -=head2 Unimplemented Options - -The options below are not currently implemented in B but will be -eventually. They are documented here as "future design". - -=over - -=item B<--show-config> I<[suffixes...]> - -When this option is given, the only action taken by B is to show its -final configuration state in the form of a configuration file. No compilation -tasks will be conducted when this option is given; processing will stop once -the configuration has been printed. The optional (comma separated) list of -suffixes controls what is printed. Without any suffixes, the configuration -for all languages is printed. With suffixes, only the languages pertaining -to those file suffixes will be printed. The configuration information is -printed after all command line options and configuration files have been -read and processed. This allows the user to verify that the correct -configuration data has been read by B. - -=item B<--config> :I
      :I=I - -This option instructs B to accept I as the value for configuration -item I in the section named I
      . This is a quick way to override -a configuration item on the command line without resorting to changing the -configuration files. - -=item B<--config-only-from> F - -This option tells B to skip the normal processing of configuration -files and only configure from the contents of the F directory. Multiple -B<--config-only-from> options may be given in which case the directories are -read in the order given on the command line. - -=item B<--emit-raw-code> - -No optimization is done whatsoever. The compilers invoked by B with -this option given will be instructed to produce raw, unoptimized code. This -option is useful only to front end language developers and therefore does not -participate in the list of B<-O> options. This is distinctly different from -the B<-O0> option (a synonym for B<-O1>) because those optimizations will -reduce code size to make compilation faster. With B<--emit-raw-code>, only -the full raw code produced by the compiler will be generated. - -=back - - -=head1 EXIT STATUS - -If B succeeds, it will exit with 0. Otherwise, if an error -occurs, it will exit with a non-zero value and no compilation actions -will be taken. If one of the compilation tools returns a non-zero -status, pending actions will be discarded and B will return the -same result code as the failing compilation tool. - -=head1 DEFICIENCIES - -B is considered an experimental LLVM tool because it has these -deficiencies: - -=over - -=item Insufficient support for native linking - -Because B doesn't handle native linking, neither can B - -=item Poor configuration support - -The support for configuring new languages, etc. is weak. There are many -command line configurations that cannot be achieved with the current -support. Furthermore the grammar is cumbersome for configuration files. -Please see L for further details. - -=item Does not handle target specific configurations - -This is one of the major deficiencies, also addressed in -L - -=back - -=head1 SEE ALSO - -L, L, L, L - -=head1 AUTHORS - -Maintained by the LLVM Team (L). - -=cut Modified: llvm/branches/non-call-eh/docs/CommandGuide/llvmgcc.pod URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/CommandGuide/llvmgcc.pod?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/CommandGuide/llvmgcc.pod (original) +++ llvm/branches/non-call-eh/docs/CommandGuide/llvmgcc.pod Sun Jul 6 15:45:41 2008 @@ -15,12 +15,14 @@ bitcode or LLVM assembly language, depending upon the options. By default, B compiles to native objects just like GCC does. If the -B<-emit-llvm> option is given then it will generate LLVM bitcode files instead. -If B<-S> (assembly) is also given, then it will generate LLVM assembly. +B<-emit-llvm> and B<-c> options are given then it will generate LLVM bitcode files +instead. If B<-emit-llvm> and B<-S> are given, then it will generate LLVM +assembly. Being derived from the GNU Compiler Collection, B has many of gcc's features and accepts most of gcc's options. It handles a -number of gcc's extensions to the C programming language. +number of gcc's extensions to the C programming language. See the gcc +documentation for details. =head1 OPTIONS @@ -30,18 +32,6 @@ Print a summary of command line options. -=item B<-S> - -Do not generate an LLVM bitcode file. Rather, compile the source -file into an LLVM assembly language file. - -=item B<-c> - -Do not generate a linked executable. Rather, compile the source -file into an LLVM bitcode file. This bitcode file can then be -linked with other bitcode files later on to generate a full LLVM -executable. - =item B<-o> I Specify the output file to be I. @@ -63,8 +53,9 @@ =item B<-emit-llvm> -Make the output be LLVM bitcode (or assembly) instead of native object (or -assembly). +Make the output be LLVM bitcode (with B<-c>) or assembly (with B<-s>) instead +of native object (or assembly). If B<-emit-llvm> is given without either B<-c> +or B<-S> it has no effect. =back Modified: llvm/branches/non-call-eh/docs/CommandLine.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/CommandLine.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/CommandLine.html (original) +++ llvm/branches/non-call-eh/docs/CommandLine.html Sun Jul 6 15:45:41 2008 @@ -52,6 +52,7 @@ specified
    • Controlling other formatting options
    • Miscellaneous option modifiers
    • +
    • Response files
  • Top-Level Classes and Functions @@ -1442,6 +1443,29 @@ + + + +
    + +

    Some systems, such as certain variants of Microsoft Windows and +some older Unices have a relatively low limit on command-line +length. It is therefore customary to use the so-called 'response +files' to circumvent this restriction. These files are mentioned on +the command-line (using the "@file") syntax. The program reads these +files and inserts the contents into argv, thereby working around the +command-line length limits. Response files are enabled by an optional +fourth argument to +cl::ParseEnvironmentOptions +and +cl::ParseCommandLineOptions. +

    + +
    + +
    Top-Level Classes and Functions @@ -1475,7 +1499,8 @@

    The cl::ParseCommandLineOptions function requires two parameters (argc and argv), but may also take an optional third parameter which holds additional extra text to emit when the ---help option is invoked.

    +--help option is invoked, and a fourth boolean parameter that enables +response files.

    @@ -1497,11 +1522,13 @@ href="#cl::ParseCommandLineOptions">cl::ParseCommandLineOptions does.

    -

    It takes three parameters: the name of the program (since argv may +

    It takes four parameters: the name of the program (since argv may not be available, it can't just look in argv[0]), the name of the -environment variable to examine, and the optional +environment variable to examine, the optional additional extra text to emit when the ---help option is invoked.

    +--help option is invoked, and the boolean +switch that controls whether reponse files +should be read.

    cl::ParseEnvironmentOptions will break the environment variable's value up into words and then process them using Modified: llvm/branches/non-call-eh/docs/CompilerDriver.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/CompilerDriver.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/CompilerDriver.html (original) +++ llvm/branches/non-call-eh/docs/CompilerDriver.html Sun Jul 6 15:45:41 2008 @@ -1,823 +1,420 @@ - - + + + - - The LLVM Compiler Driver (llvmc) - - - + + +Customizing LLVMC: Reference Manual + -

    The LLVM Compiler Driver (llvmc)
    -

    NOTE: This document is a work in progress!

    -
      -
    1. Abstract
    2. -
    3. Introduction -
        -
      1. Purpose
      2. -
      3. Operation
      4. -
      5. Phases
      6. -
      7. Actions
      8. -
      -
    4. -
    5. Configuration -
        -
      1. Overview
      2. -
      3. Configuration Files
      4. -
      5. Syntax
      6. -
      7. Substitutions
      8. -
      9. Sample Config File
      10. -
      -
    6. Glossary -
    -
    -

    Written by Reid Spencer -

    -
    - - - - -
    -

    This document describes the requirements, design, and configuration of the - LLVM compiler driver, llvmc. The compiler driver knows about LLVM's - tool set and can be configured to know about a variety of compilers for - source languages. It uses this knowledge to execute the tools necessary - to accomplish general compilation, optimization, and linking tasks. The main - purpose of llvmc is to provide a simple and consistent interface to - all compilation tasks. This reduces the burden on the end user who can just - learn to use llvmc instead of the entire LLVM tool set and all the - source language compilers compatible with LLVM.

    -
    - - - -
    -

    The llvmc tool is a configurable compiler - driver. As such, it isn't a compiler, optimizer, - or a linker itself but it drives (invokes) other software that perform those - tasks. If you are familiar with the GNU Compiler Collection's gcc - tool, llvmc is very similar.

    -

    The following introductory sections will help you understand why this tool - is necessary and what it does.

    -
    - - - -
    -

    llvmc was invented to make compilation of user programs with - LLVM-based tools easier. To accomplish this, llvmc strives to:

    -
      -
    • Be the single point of access to most of the LLVM tool set.
    • -
    • Hide the complexities of the LLVM tools through a single interface.
    • -
    • Provide a consistent interface for compiling all languages.
    • -
    -

    Additionally, llvmc makes it easier to write a compiler for use - with LLVM, because it:

    -
      -
    • Makes integration of existing non-LLVM tools simple.
    • -
    • Extends the capabilities of minimal compiler tools by optimizing their - output.
    • -
    • Reduces the number of interfaces a compiler writer must know about - before a working compiler can be completed (essentially only the VMCore - interfaces need to be understood).
    • -
    • Supports source language translator invocation via both dynamically - loadable shared objects and invocation of an executable.
    • -
    -
    - - - -
    -

    At a high level, llvmc operation is very simple. The basic action - taken by llvmc is to simply invoke some tool or set of tools to fill - the user's request for compilation. Every execution of llvmctakes the - following sequence of steps:

    -
    -
    Collect Command Line Options
    -
    The command line options provide the marching orders to llvmc - on what actions it should perform. This is the request the user is making - of llvmc and it is interpreted first. See the llvmc - manual page for details on the - options.
    -
    Read Configuration Files
    -
    Based on the options and the suffixes of the filenames presented, a set - of configuration files are read to configure the actions llvmc will - take. Configuration files are provided by either LLVM or the - compiler tools that llvmc invokes. These files determine what - actions llvmc will take in response to the user's request. See - the section on configuration for more details. -
    -
    Determine Phases To Execute
    -
    Based on the command line options and configuration files, - llvmc determines the compilation phases that - must be executed by the user's request. This is the primary work of - llvmc.
    -
    Determine Actions To Execute
    -
    Each phase to be executed can result in the - invocation of one or more actions. An action is - either a whole program or a function in a dynamically linked shared library. - In this step, llvmc determines the sequence of actions that must be - executed. Actions will always be executed in a deterministic order.
    -
    Execute Actions
    -
    The actions necessary to support the user's - original request are executed sequentially and deterministically. All - actions result in either the invocation of a whole program to perform the - action or the loading of a dynamically linkable shared library and invocation - of a standard interface function within that library.
    -
    Termination
    -
    If any action fails (returns a non-zero result code), llvmc - also fails and returns the result code from the failing action. If - everything succeeds, llvmc will return a zero result code.
    -
    -

    llvmc's operation must be simple, regular and predictable. - Developers need to be able to rely on it to take a consistent approach to - compilation. For example, the invocation:

    - - llvmc -O2 x.c y.c z.c -o xyz -

    must produce exactly the same results as:

    -
    
    -    llvmc -O2 x.c -o x.o
    -    llvmc -O2 y.c -o y.o
    -    llvmc -O2 z.c -o z.o
    -    llvmc -O2 x.o y.o z.o -o xyz
    -

    To accomplish this, llvmc uses a very simple goal oriented - procedure to do its work. The overall goal is to produce a functioning - executable. To accomplish this, llvmc always attempts to execute a - series of compilation phases in the same sequence. - However, the user's options to llvmc can cause the sequence of phases - to start in the middle or finish early.

    -
    - - -
    Phases
    -
    -

    llvmc breaks every compilation task into the following five - distinct phases:

    -
    Preprocessing
    Not all languages support preprocessing; - but for those that do, this phase can be invoked. This phase is for - languages that provide combining, filtering, or otherwise altering with the - source language input before the translator parses it. Although C and C++ - are the most common users of this phase, other languages may provide their - own preprocessor (whether its the C pre-processor or not).
    -
    -
    Translation
    The translation phase converts the source - language input into something that LLVM can interpret and use for - downstream phases. The translation is essentially from "non-LLVM form" to - "LLVM form".
    -
    -
    Optimization
    Once an LLVM Module has been obtained from - the translation phase, the program enters the optimization phase. This phase - attempts to optimize all of the input provided on the command line according - to the options provided.
    -
    -
    Linking
    The inputs are combined to form a complete - program.
    -
    -

    The following table shows the inputs, outputs, and command line options - applicable to each phase.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PhaseInputsOutputsOptions
    Preprocessing
    • Source Language File
    • Source Language File
    -
    -E
    -
    Stops the compilation after preprocessing
    -
    Translation
      -
    • Source Language File
    • -
      -
    • LLVM Assembly
    • -
    • LLVM Bitcode
    • -
    • LLVM C++ IR
    • -
    -
    -c
    -
    Stops the compilation after translation so that optimization and - linking are not done.
    -
    -S
    -
    Stops the compilation before object code is written so that only - assembly code remains.
    -
    Optimization
      -
    • LLVM Assembly
    • -
    • LLVM Bitcode
    • -
      -
    • LLVM Bitcode
    • -
    -
    -Ox -
    This group of options controls the amount of optimization - performed.
    -
    Linking
      -
    • LLVM Bitcode
    • -
    • Native Object Code
    • -
    • LLVM Library
    • -
    • Native Library
    • -
      -
    • LLVM Bitcode Executable
    • -
    • Native Executable
    • -
    -
    -L
    Specifies a path for library search.
    -
    -l
    Specifies a library to link in.
    -
    -
    - - -
    Actions
    -
    -

    An action, with regard to llvmc is a basic operation that it takes - in order to fulfill the user's request. Each phase of compilation will invoke - zero or more actions in order to accomplish that phase.

    -

    Actions come in two forms:

    -
      -
    • Invokable Executables
    • -
    • Functions in a shared library
    • -
    -
    - - - - -
    -

    This section of the document describes the configuration files used by - llvmc. Configuration information is relatively static for a - given release of LLVM and a compiler tool. However, the details may - change from release to release of either. Users are encouraged to simply use - the various options of the llvmc command and ignore the configuration - of the tool. These configuration files are for compiler writers and LLVM - developers. Those wishing to simply use llvmc don't need to understand - this section but it may be instructive on how the tool works.

    -
    - - -
    Overview
    -
    -

    llvmc is highly configurable both on the command line and in -configuration files. The options it understands are generic, consistent and -simple by design. Furthermore, the llvmc options apply to the -compilation of any LLVM enabled programming language. To be enabled as a -supported source language compiler, a compiler writer must provide a -configuration file that tells llvmc how to invoke the compiler -and what its capabilities are. The purpose of the configuration files then -is to allow compiler writers to specify to llvmc how the compiler -should be invoked. Users may but are not advised to alter the compiler's -llvmc configuration.

    - -

    Because llvmc just invokes other programs, it must deal with the -available command line options for those programs regardless of whether they -were written for LLVM or not. Furthermore, not all compiler tools will -have the same capabilities. Some compiler tools will simply generate LLVM assembly -code, others will be able to generate fully optimized bitcode. In general, -llvmc doesn't make any assumptions about the capabilities or command -line options of a sub-tool. It simply uses the details found in the -configuration files and leaves it to the compiler writer to specify the -configuration correctly.

    - -

    This approach means that new compiler tools can be up and working very -quickly. As a first cut, a tool can simply compile its source to raw -(unoptimized) bitcode or LLVM assembly and llvmc can be configured -to pick up the slack (translate LLVM assembly to bitcode, optimize the -bitcode, generate native assembly, link, etc.). In fact, the compiler tools -need not use any LLVM libraries, and it could be written in any language -(instead of C++). The configuration data will allow the full range of -optimization, assembly, and linking capabilities that LLVM provides to be added -to these kinds of tools. Enabling the rapid development of front-ends is one -of the primary goals of llvmc.

    - -

    As a compiler tool matures, it may utilize the LLVM libraries and tools -to more efficiently produce optimized bitcode directly in a single compilation -and optimization program. In these cases, multiple tools would not be needed -and the configuration data for the compiler would change.

    - -

    Configuring llvmc to the needs and capabilities of a source language -compiler is relatively straight-forward. A compiler writer must provide a -definition of what to do for each of the five compilation phases for each of -the optimization levels. The specification consists simply of prototypical -command lines into which llvmc can substitute command line -arguments and file names. Note that any given phase can be completely blank if -the source language's compiler combines multiple phases into a single program. -For example, quite often pre-processing, translation, and optimization are -combined into a single program. The specification for such a compiler would have -blank entries for pre-processing and translation but a full command line for -optimization.

    -
    - - - - -
    -

    Each configuration file provides the details for a single source language - that is to be compiled. This configuration information tells llvmc - how to invoke the language's pre-processor, translator, optimizer, assembler - and linker. Note that a given source language needn't provide all these tools - as many of them exist in llvm currently.

    -
    - - - -
    -

    llvmc always looks for files of a specific name. It uses the - first file with the name its looking for by searching directories in the - following order:
    -

      -
    1. Any directory specified by the -config-dir option will be - checked first.
    2. -
    3. If the environment variable LLVM_CONFIG_DIR is set, and it contains - the name of a valid directory, that directory will be searched next.
    4. -
    5. If the user's home directory (typically /home/user contains - a sub-directory named .llvm and that directory contains a - sub-directory named etc then that directory will be tried - next.
    6. -
    7. If the LLVM installation directory (typically /usr/local/llvm - contains a sub-directory named etc then that directory will be - tried last.
    8. -
    9. A standard "system" directory will be searched next. This is typically - /etc/llvm on UNIX™ and C:\WINNT on Microsoft - Windows™.
    10. -
    11. If the configuration file sought still can't be found, llvmc - will print an error message and exit.
    12. -
    -

    The first file found in this search will be used. Other files with the - same name will be ignored even if they exist in one of the subsequent search - locations.

    -
    - - -
    -

    In the directories searched, each configuration file is given a specific - name to foster faster lookup (so llvmc doesn't have to do directory searches). - The name of a given language specific configuration file is simply the same - as the suffix used to identify files containing source in that language. - For example, a configuration file for C++ source might be named - cpp, C, or cxx. For languages that support multiple - file suffixes, multiple (probably identical) files (or symbolic links) will - need to be provided.

    -
    - - -
    -

    Which configuration files are read depends on the command line options and - the suffixes of the file names provided on llvmc's command line. Note - that the -x LANGUAGE option alters the language that llvmc - uses for the subsequent files on the command line. Only the configuration - files actually needed to complete llvmc's task are read. Other - language specific files will be ignored.

    -
    - - -
    Syntax
    -
    -

    The syntax of the configuration files is very simple and somewhat - compatible with Java's property files. Here are the syntax rules:

    -
      -
    • The file encoding is ASCII.
    • -
    • The file is line oriented. There should be one configuration definition - per line. Lines are terminated by the newline (0x0A) and/or carriage return - characters (0x0D)
    • -
    • A backslash (\) before a newline causes the newline to be - ignored. This is useful for line continuation of long definitions. A - backslash anywhere else is recognized as a backslash.
    • -
    • A configuration item consists of a name, an = and a value.
    • -
    • A name consists of a sequence of identifiers separated by period.
    • -
    • An identifier consists of specific keywords made up of only lower case - and upper case letters (e.g. lang.name).
    • -
    • Values come in four flavors: booleans, integers, commands and - strings.
    • -
    • Valid "false" boolean values are false False FALSE no No NO - off Off and OFF.
    • -
    • Valid "true" boolean values are true True TRUE yes Yes YES - on On and ON.
    • -
    • Integers are simply sequences of digits.
    • -
    • Commands start with a program name and are followed by a sequence of - words that are passed to that program as command line arguments. Program - arguments that begin and end with the % sign will have their value - substituted. Program names beginning with / are considered to be - absolute. Otherwise the PATH will be applied to find the program to - execute.
    • -
    • Strings are composed of multiple sequences of characters from the - character class [-A-Za-z0-9_:%+/\\|,] separated by white - space.
    • -
    • White space on a line is folded. Multiple blanks or tabs will be - reduced to a single blank.
    • -
    • White space before the configuration item's name is ignored.
    • -
    • White space on either side of the = is ignored.
    • -
    • White space in a string value is used to separate the individual - components of the string value but otherwise ignored.
    • -
    • Comments are introduced by the # character. Everything after a - # and before the end of line is ignored.
    • -
    -
    - - - -
    -

    The table below provides definitions of the allowed configuration items - that may appear in a configuration file. Every item has a default value and - does not need to appear in the configuration file. Missing items will have the - default value. Each identifier may appear as all lower case, first letter - capitalized or all upper case.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameValue TypeDescriptionDefault

    LLVMC ITEMS

    versionstringProvides the version string for the contents of this - configuration file. What is accepted as a legal configuration file - will change over time and this item tells llvmc which version - should be expected.b

    LANG ITEMS

    lang.namestringProvides the common name for a language definition. - For example "C++", "Pascal", "FORTRAN", etc.blank
    lang.opt1stringSpecifies the parameters to give the optimizer when - -O1 is specified on the llvmc command line.-simplifycfg -instcombine -mem2reg
    lang.opt2stringSpecifies the parameters to give the optimizer when - -O2 is specified on the llvmc command line.TBD
    lang.opt3stringSpecifies the parameters to give the optimizer when - -O3 is specified on the llvmc command line.TBD
    lang.opt4stringSpecifies the parameters to give the optimizer when - -O4 is specified on the llvmc command line.TBD
    lang.opt5stringSpecifies the parameters to give the optimizer when - -O5 is specified on the llvmc command line.TBD

    PREPROCESSOR ITEMS

    preprocessor.commandcommandThis provides the command prototype that will be used - to run the preprocessor. This is generally only used with the - -E option.<blank>
    preprocessor.requiredbooleanThis item specifies whether the pre-processing phase - is required by the language. If the value is true, then the - preprocessor.command value must not be blank. With this option, - llvmc will always run the preprocessor as it assumes that the - translation and optimization phases don't know how to pre-process their - input.false

    TRANSLATOR ITEMS

    translator.commandcommandThis provides the command prototype that will be used - to run the translator. Valid substitutions are %in% for the - input file and %out% for the output file.<blank>
    translator.outputbitcode or assemblyThis item specifies the kind of output the language's - translator generates.bitcode
    translator.preprocessesbooleanIndicates that the translator also preprocesses. If - this is true, then llvmc will skip the pre-processing phase - whenever the final phase is not pre-processing.false

    OPTIMIZER ITEMS

    optimizer.commandcommandThis provides the command prototype that will be used - to run the optimizer. Valid substitutions are %in% for the - input file and %out% for the output file.<blank>
    optimizer.outputbitcode or assemblyThis item specifies the kind of output the language's - optimizer generates. Valid values are "assembly" and "bitcode"bitcode
    optimizer.preprocessesbooleanIndicates that the optimizer also preprocesses. If - this is true, then llvmc will skip the pre-processing phase - whenever the final phase is optimization or later.false
    optimizer.translatesbooleanIndicates that the optimizer also translates. If - this is true, then llvmc will skip the translation phase - whenever the final phase is optimization or later.false

    ASSEMBLER ITEMS

    assembler.commandcommandThis provides the command prototype that will be used - to run the assembler. Valid substitutions are %in% for the - input file and %out% for the output file.<blank>
    -
    - - - -
    -

    On any configuration item that ends in command, you must - specify substitution tokens. Substitution tokens begin and end with a percent - sign (%) and are replaced by the corresponding text. Any substitution - token may be given on any command line but some are more useful than - others. In particular each command should have both an %in% - and an %out% substitution. The table below provides definitions of - each of the allowed substitution tokens.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Substitution TokenReplacement Description
    %args%Replaced with all the tool-specific arguments given - to llvmc via the -T set of options. This just allows - you to place these arguments in the correct place on the command line. - If the %args% option does not appear on your command line, - then you are explicitly disallowing the -T option for your - tool. -
    %force%Replaced with the -f option if it was - specified on the llvmc command line. This is intended to tell - the compiler tool to force the overwrite of output files. -
    %in%Replaced with the full path of the input file. You - needn't worry about the cascading of file names. llvmc will - create temporary files and ensure that the output of one phase is the - input to the next phase.
    %opt%Replaced with the optimization options for the - tool. If the tool understands the -O options then that will - be passed. Otherwise, the lang.optN series of configuration - items will specify which arguments are to be given.
    %out%Replaced with the full path of the output file. - Note that this is not necessarily the output file specified with the - -o option on llvmc's command line. It might be a - temporary file that will be passed to a subsequent phase's input. -
    %stats%If your command accepts the -stats option, - use this substitution token. If the user requested -stats - from the llvmc command line then this token will be replaced - with -stats, otherwise it will be ignored. -
    %target%Replaced with the name of the target "machine" for - which code should be generated. The value used here is taken from the - llvmc option -march. -
    %time%If your command accepts the -time-passes - option, use this substitution token. If the user requested - -time-passes from the llvmc command line then this - token will be replaced with -time-passes, otherwise it will - be ignored. -
    -
    - - - -
    -

    Since an example is always instructive, here's how the Stacker language - configuration file looks.

    -
    
    -# Stacker Configuration File For llvmc
    -
    -##########################################################
    -# Language definitions
    -##########################################################
    -  lang.name=Stacker 
    -  lang.opt1=-simplifycfg -instcombine -mem2reg
    -  lang.opt2=-simplifycfg -instcombine -mem2reg -load-vn \
    -    -gcse -dse -scalarrepl -sccp 
    -  lang.opt3=-simplifycfg -instcombine -mem2reg -load-vn \
    -    -gcse -dse -scalarrepl -sccp -branch-combine -adce \
    -    -globaldce -inline -licm 
    -  lang.opt4=-simplifycfg -instcombine -mem2reg -load-vn \
    -    -gcse -dse -scalarrepl -sccp -ipconstprop \
    -    -branch-combine -adce -globaldce -inline -licm 
    -  lang.opt5=-simplifycfg -instcombine -mem2reg --load-vn \
    -    -gcse -dse scalarrepl -sccp -ipconstprop \
    -    -branch-combine -adce -globaldce -inline -licm \
    -    -block-placement
    -
    -##########################################################
    -# Pre-processor definitions
    -##########################################################
    -
    -  # Stacker doesn't have a preprocessor but the following
    -  # allows the -E option to be supported
    -  preprocessor.command=cp %in% %out%
    -  preprocessor.required=false
    -
    -##########################################################
    -# Translator definitions
    -##########################################################
    -
    -  # To compile stacker source, we just run the stacker
    -  # compiler with a default stack size of 2048 entries.
    -  translator.command=stkrc -s 2048 %in% -o %out% %time% \
    -    %stats% %force% %args%
    -
    -  # stkrc doesn't preprocess but we set this to true so
    -  # that we don't run the cp command by default.
    -  translator.preprocesses=true
    -
    -  # The translator is required to run.
    -  translator.required=true
    -
    -  # stkrc doesn't handle the -On options
    -  translator.output=bitcode
    -
    -##########################################################
    -# Optimizer definitions
    -##########################################################
    -  
    -  # For optimization, we use the LLVM "opt" program
    -  optimizer.command=opt %in% -o %out% %opt% %time% %stats% \
    -    %force% %args%
    -
    -  optimizer.required = true
    -
    -  # opt doesn't translate
    -  optimizer.translates = no
    -
    -  # opt doesn't preprocess
    -  optimizer.preprocesses=no
    -
    -  # opt produces bitcode
    -  optimizer.output = bc
    -
    -##########################################################
    -# Assembler definitions
    -##########################################################
    -  assembler.command=llc %in% -o %out% %target% %time% %stats%
    -
    -
    - - - - -
    -

    This document uses precise terms in reference to the various artifacts and - concepts related to compilation. The terms used throughout this document are - defined below.

    -
    -
    assembly
    -
    A compilation phase in which LLVM bitcode or - LLVM assembly code is assembled to a native code format (either target - specific aseembly language or the platform's native object file format). -
    - -
    compiler
    -
    Refers to any program that can be invoked by llvmc to accomplish - the work of one or more compilation phases.
    - -
    driver
    -
    Refers to llvmc itself.
    - -
    linking
    -
    A compilation phase in which LLVM bitcode files - and (optionally) native system libraries are combined to form a complete - executable program.
    - -
    optimization
    -
    A compilation phase in which LLVM bitcode is - optimized.
    - -
    phase
    -
    Refers to any one of the five compilation phases that that - llvmc supports. The five phases are: - preprocessing, - translation, - optimization, - assembly, - linking.
    - -
    source language
    -
    Any common programming language (e.g. C, C++, Java, Stacker, ML, - FORTRAN). These languages are distinguished from any of the lower level - languages (such as LLVM or native assembly), by the fact that a - translation phase - is required before LLVM can be applied.
    +
    -
    tool
    -
    Refers to any program in the LLVM tool set.
    +
    Customizing LLVMC: Reference Manual
    -
    translation
    -
    A compilation phase in which - source language code is translated into - either LLVM assembly language or LLVM bitcode.
    -
    -
    - -
    -
    Valid CSS!Valid HTML 4.01!Reid Spencer
    -The LLVM Compiler Infrastructure
    -Last modified: $Date$ +
    +

    Note: This document is a work-in-progress. Additions and clarifications + are welcome.

    +
    + +

    LLVMC is a generic compiler driver, designed to be customizable and +extensible. It plays the same role for LLVM as the gcc program +does for GCC - LLVMC's job is essentially to transform a set of input +files into a set of targets depending on configuration rules and user +options. What makes LLVMC different is that these transformation rules +are completely customizable - in fact, LLVMC knows nothing about the +specifics of transformation (even the command-line options are mostly +not hard-coded) and regards the transformation structure as an +abstract graph. This makes it possible to adapt LLVMC for other +purposes - for example, as a build tool for game resources.

    +

    Because LLVMC employs TableGen [1] as its configuration language, you +need to be familiar with it to customize LLVMC.

    + + +
    Written by Mikhail Glushenkov
    + +
    + +

    LLVMC tries hard to be as compatible with gcc as possible, +although there are some small differences. Most of the time, however, +you shouldn't be able to notice them:

    +
    +$ # This works as expected:
    +$ llvmc2 -O3 -Wall hello.cpp
    +$ ./a.out
    +hello
    +
    +

    One nice feature of LLVMC is that one doesn't have to distinguish +between different compilers for different languages (think g++ and +gcc) - the right toolchain is chosen automatically based on input +language names (which are, in turn, determined from file +extensions). If you want to force files ending with ".c" to compile as +C++, use the -x option, just like you would do it with gcc:

    +
    +$ llvmc2 -x c hello.cpp
    +$ # hello.cpp is really a C file
    +$ ./a.out
    +hello
    +
    +

    On the other hand, when using LLVMC as a linker to combine several C++ +object files you should provide the --linker option since it's +impossible for LLVMC to choose the right linker in that case:

    +
    +$ llvmc2 -c hello.cpp
    +$ llvmc2 hello.o
    +[A lot of link-time errors skipped]
    +$ llvmc2 --linker=c++ hello.o
    +$ ./a.out
    +hello
    +
    +
    +
    + +

    LLVMC has some built-in options that can't be overridden in the +configuration files:

    +
      +
    • -o FILE - Output file name.
    • +
    • -x LANGUAGE - Specify the language of the following input files +until the next -x option.
    • +
    • -v - Enable verbose mode, i.e. print out all executed commands.
    • +
    • --view-graph - Show a graphical representation of the compilation +graph. Requires that you have dot and gv commands +installed. Hidden option, useful for debugging.
    • +
    • --write-graph - Write a compilation-graph.dot file in the +current directory with the compilation graph description in the +Graphviz format. Hidden option, useful for debugging.
    • +
    • --save-temps - Write temporary files to the current directory +and do not delete them on exit. Hidden option, useful for debugging.
    • +
    • --help, --help-hidden, --version - These options have +their standard meaning.
    • +
    +
    +
    + +

    At the time of writing LLVMC does not support on-the-fly reloading of +configuration, so to customize LLVMC you'll have to recompile the +source code (which lives under $LLVM_DIR/tools/llvmc2). The +default configuration files are Common.td (contains common +definitions, don't forget to include it in your configuration +files), Tools.td (tool descriptions) and Graph.td (compilation +graph definition).

    +

    To compile LLVMC with your own configuration file (say,``MyGraph.td``), +run make like this:

    +
    +$ cd $LLVM_DIR/tools/llvmc2
    +$ make GRAPH=MyGraph.td TOOLNAME=my_llvmc
    +
    +

    This will build an executable named my_llvmc. There are also +several sample configuration files in the llvmc2/examples +subdirectory that should help to get you started.

    +

    Internally, LLVMC stores information about possible source +transformations in form of a graph. Nodes in this graph represent +tools, and edges between two nodes represent a transformation path. A +special "root" node is used to mark entry points for the +transformations. LLVMC also assigns a weight to each edge (more on +this later) to choose between several alternative edges.

    +

    The definition of the compilation graph (see file Graph.td) is +just a list of edges:

    +
    +def CompilationGraph : CompilationGraph<[
    +    Edge<root, llvm_gcc_c>,
    +    Edge<root, llvm_gcc_assembler>,
    +    ...
    +
    +    Edge<llvm_gcc_c, llc>,
    +    Edge<llvm_gcc_cpp, llc>,
    +    ...
    +
    +    OptionalEdge<llvm_gcc_c, opt, [(switch_on "opt")]>,
    +    OptionalEdge<llvm_gcc_cpp, opt, [(switch_on "opt")]>,
    +    ...
    +
    +    OptionalEdge<llvm_gcc_assembler, llvm_gcc_cpp_linker,
    +        (case (input_languages_contain "c++"), (inc_weight),
    +              (or (parameter_equals "linker", "g++"),
    +                  (parameter_equals "linker", "c++")), (inc_weight))>,
    +    ...
    +
    +    ]>;
    +
    +

    As you can see, the edges can be either default or optional, where +optional edges are differentiated by sporting a case expression +used to calculate the edge's weight.

    +

    The default edges are assigned a weight of 1, and optional edges get a +weight of 0 + 2*N where N is the number of tests that evaluated to +true in the case expression. It is also possible to provide an +integer parameter to inc_weight and dec_weight - in this case, +the weight is increased (or decreased) by the provided value instead +of the default 2.

    +

    When passing an input file through the graph, LLVMC picks the edge +with the maximum weight. To avoid ambiguity, there should be only one +default edge between two nodes (with the exception of the root node, +which gets a special treatment - there you are allowed to specify one +default edge per language).

    +

    To get a visual representation of the compilation graph (useful for +debugging), run llvmc2 --view-graph. You will need dot and +gsview installed for this to work properly.

    +
    +
    + +

    As was said earlier, nodes in the compilation graph represent tools, +which are described separately. A tool definition looks like this +(taken from the Tools.td file):

    +
    +def llvm_gcc_cpp : Tool<[
    +    (in_language "c++"),
    +    (out_language "llvm-assembler"),
    +    (output_suffix "bc"),
    +    (cmd_line "llvm-g++ -c $INFILE -o $OUTFILE -emit-llvm"),
    +    (sink)
    +    ]>;
    +
    +

    This defines a new tool called llvm_gcc_cpp, which is an alias for +llvm-g++. As you can see, a tool definition is just a list of +properties; most of them should be self-explanatory. The sink +property means that this tool should be passed all command-line +options that lack explicit descriptions.

    +

    The complete list of the currently implemented tool properties follows:

    +
      +
    • Possible tool properties:
        +
      • in_language - input language name.
      • +
      • out_language - output language name.
      • +
      • output_suffix - output file suffix.
      • +
      • cmd_line - the actual command used to run the tool. You can +use $INFILE and $OUTFILE variables, output redirection +with >, hook invocations ($CALL), environment variables +(via $ENV) and the case construct (more on this below).
      • +
      • join - this tool is a "join node" in the graph, i.e. it gets a +list of input files and joins them together. Used for linkers.
      • +
      • sink - all command-line options that are not handled by other +tools are passed to this tool.
      • +
      +
    • +
    +

    The next tool definition is slightly more complex:

    +
    +def llvm_gcc_linker : Tool<[
    +    (in_language "object-code"),
    +    (out_language "executable"),
    +    (output_suffix "out"),
    +    (cmd_line "llvm-gcc $INFILE -o $OUTFILE"),
    +    (join),
    +    (prefix_list_option "L", (forward),
    +                        (help "add a directory to link path")),
    +    (prefix_list_option "l", (forward),
    +                        (help "search a library when linking")),
    +    (prefix_list_option "Wl", (unpack_values),
    +                        (help "pass options to linker"))
    +    ]>;
    +
    +

    This tool has a "join" property, which means that it behaves like a +linker. This tool also defines several command-line options: -l, +-L and -Wl which have their usual meaning. An option has two +attributes: a name and a (possibly empty) list of properties. All +currently implemented option types and properties are described below:

    +
      +
    • Possible option types:

      +
      +
        +
      • switch_option - a simple boolean switch, for example -time.
      • +
      • parameter_option - option that takes an argument, for example +-std=c99;
      • +
      • parameter_list_option - same as the above, but more than one +occurence of the option is allowed.
      • +
      • prefix_option - same as the parameter_option, but the option name +and parameter value are not separated.
      • +
      • prefix_list_option - same as the above, but more than one +occurence of the option is allowed; example: -lm -lpthread.
      • +
      • alias_option - a special option type for creating +aliases. Unlike other option types, aliases are not allowed to +have any properties besides the aliased option name. Usage +example: (alias_option "preprocess", "E")
      • +
      +
      +
    • +
    • Possible option properties:

      +
      +
        +
      • append_cmd - append a string to the tool invocation command.
      • +
      • forward - forward this option unchanged.
      • +
      • output_suffix - modify the output suffix of this +tool. Example : (switch "E", (output_suffix "i").
      • +
      • stop_compilation - stop compilation after this phase.
      • +
      • unpack_values - used for for splitting and forwarding +comma-separated lists of options, e.g. -Wa,-foo=bar,-baz is +converted to -foo=bar -baz and appended to the tool invocation +command.
      • +
      • help - help string associated with this option. Used for +--help output.
      • +
      • required - this option is obligatory.
      • +
      +
      +
    • +
    +
    +
    + +

    It can be handy to have all information about options gathered in a +single place to provide an overview. This can be achieved by using a +so-called OptionList:

    +
    +def Options : OptionList<[
    +(switch_option "E", (help "Help string")),
    +(alias_option "quiet", "q")
    +...
    +]>;
    +
    +

    OptionList is also a good place to specify option aliases.

    +

    Tool-specific option properties like append_cmd have (obviously) +no meaning in the context of OptionList, so the only properties +allowed there are help and required.

    +

    Option lists are used at the file scope. See file +examples/Clang.td for an example of OptionList usage.

    +
    +
    + +

    Normally, LLVMC executes programs from the system PATH. Sometimes, +this is not sufficient: for example, we may want to specify tool names +in the configuration file. This can be achieved via the mechanism of +hooks - to compile LLVMC with your hooks, just drop a .cpp file into +tools/llvmc2 directory. Hooks should live in the hooks +namespace and have the signature std::string hooks::MyHookName +(void). They can be used from the cmd_line tool property:

    +
    +(cmd_line "$CALL(MyHook)/path/to/file -o $CALL(AnotherHook)")
    +
    +

    It is also possible to use environment variables in the same manner:

    +
    +(cmd_line "$ENV(VAR1)/path/to/file -o $ENV(VAR2)")
    +
    +

    To change the command line string based on user-provided options use +the case expression (documented below):

    +
    +(cmd_line
    +  (case
    +    (switch_on "E"),
    +       "llvm-g++ -E -x c $INFILE -o $OUTFILE",
    +    (default),
    +       "llvm-g++ -c -x c $INFILE -o $OUTFILE -emit-llvm"))
    +
    +
    +
    + +

    The 'case' construct can be used to calculate weights of the optional +edges and to choose between several alternative command line strings +in the cmd_line tool property. It is designed after the +similarly-named construct in functional languages and takes the form +(case (test_1), statement_1, (test_2), statement_2, ... (test_N), +statement_N). The statements are evaluated only if the corresponding +tests evaluate to true.

    +

    Examples:

    +
    +// Increases edge weight by 5 if "-A" is provided on the
    +// command-line, and by 5 more if "-B" is also provided.
    +(case
    +    (switch_on "A"), (inc_weight 5),
    +    (switch_on "B"), (inc_weight 5))
    +
    +// Evaluates to "cmdline1" if option "-A" is provided on the
    +// command line, otherwise to "cmdline2"
    +(case
    +    (switch_on "A"), "cmdline1",
    +    (switch_on "B"), "cmdline2",
    +    (default), "cmdline3")
    +
    +

    Note the slight difference in 'case' expression handling in contexts +of edge weights and command line specification - in the second example +the value of the "B" switch is never checked when switch "A" is +enabled, and the whole expression always evaluates to "cmdline1" in +that case.

    +

    Case expressions can also be nested, i.e. the following is legal:

    +
    +(case (switch_on "E"), (case (switch_on "o"), ..., (default), ...)
    +      (default), ...)
    +
    +

    You should, however, try to avoid doing that because it hurts +readability. It is usually better to split tool descriptions and/or +use TableGen inheritance instead.

    +
      +
    • Possible tests are:
        +
      • switch_on - Returns true if a given command-line option is +provided by the user. Example: (switch_on "opt"). Note that +you have to define all possible command-line options separately in +the tool descriptions. See the next doc_text for the discussion of +different kinds of command-line options.
      • +
      • parameter_equals - Returns true if a command-line parameter equals +a given value. Example: (parameter_equals "W", "all").
      • +
      • element_in_list - Returns true if a command-line parameter list +includes a given value. Example: (parameter_in_list "l", "pthread").
      • +
      • input_languages_contain - Returns true if a given language +belongs to the current input language set. Example: +`(input_languages_contain "c++").
      • +
      • in_language - Evaluates to true if the language of the input +file equals to the argument. Valid only when using case +expression in a cmd_line tool property. Example: +`(in_language "c++").
      • +
      • not_empty - Returns true if a given option (which should be +either a parameter or a parameter list) is set by the +user. Example: `(not_empty "o").
      • +
      • default - Always evaluates to true. Should always be the last +test in the case expression.
      • +
      • and - A standard logical combinator that returns true iff all +of its arguments return true. Used like this: (and (test1), +(test2), ... (testN)). Nesting of and and or is allowed, +but not encouraged.
      • +
      • or - Another logical combinator that returns true only if any +one of its arguments returns true. Example: (or (test1), +(test2), ... (testN)).
      • +
      +
    • +
    +
    +
    + +

    One last thing that you will need to modify when adding support for a +new language to LLVMC is the language map, which defines mappings from +file extensions to language names. It is used to choose the proper +toolchain(s) for a given input file set. Language map definition is +located in the file Tools.td and looks like this:

    +
    +def LanguageMap : LanguageMap<
    +    [LangToSuffixes<"c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]>,
    +     LangToSuffixes<"c", ["c"]>,
    +     ...
    +    ]>;
    +
    +
    + + +
    +
    + Valid CSS! + Valid XHTML 1.0! + The LLVM Compiler Infrastructure
    + Last modified: $Date$
    - Modified: llvm/branches/non-call-eh/docs/DeveloperPolicy.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/DeveloperPolicy.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/DeveloperPolicy.html (original) +++ llvm/branches/non-call-eh/docs/DeveloperPolicy.html Sun Jul 6 15:45:41 2008 @@ -116,6 +116,15 @@ attachment to the message, not embedded into the text of the message. This ensures that your mailer will not mangle the patch when it sends it (e.g. by making whitespace changes or by wrapping lines).

    + +

    For Thunderbird users: Before submitting a patch, please open + Preferences → Advanced → General → Config Editor, + find the key mail.content_disposition_type, and set its value to + 1. Without this setting, Thunderbird sends your attachment using + Content-Disposition: inline rather than Content-Disposition: + attachment. Apple Mail gamely displays such a file inline, making it + difficult to work with for reviewers using that program.

    +

    @@ -458,7 +467,7 @@

    Although UIUC may eventually reassign the copyright of the software to another - entity (e.g. a dedicated non-profit "LLVM Organization", or something) + entity (e.g. a dedicated non-profit "LLVM Organization") the intent for the project is to always have a single entity hold the copyrights to LLVM at any given time.

    @@ -467,6 +476,7 @@ reduces the managerial burden for any kind of administrative or technical decisions about LLVM. The goal of the LLVM project is to always keep the code open and licensed under a very liberal license.

    + @@ -480,7 +490,8 @@
    • You can freely distribute LLVM.
    • You must retain the copyright notice if you redistribute LLVM.
    • -
    • Binaries derived from LLVM must reproduce the copyright notice.
    • +
    • Binaries derived from LLVM must reproduce the copyright notice (e.g. + in an included readme file).
    • You can't use our names to promote your LLVM derived products.
    • There's no warranty on LLVM at all.
    @@ -520,9 +531,11 @@ arbitrary purposes (including commercial use).

    When contributing code, we expect contributors to notify us of any potential - for patent-related trouble with their changes. If you own the rights to a + for patent-related trouble with their changes. If you or your employer + own the rights to a patent and would like to contribute code to LLVM that relies on it, we - require that you sign an agreement that allows any other user of LLVM to + require that + the copyright owner sign an agreement that allows any other user of LLVM to freely use your patent. Please contact the oversight group for more details.

    @@ -537,6 +550,11 @@ the entire software base can be managed by a single copyright holder. This implies that any contributions can be licensed under the license that the project uses.

    + +

    When contributing code, you also affirm that you are legally entitled to + grant this copyright, personally or on behalf of your employer. If the code + belongs to some other entity, please raise this issue with the oversight + group before the code is committed.

    Modified: llvm/branches/non-call-eh/docs/GCCFEBuildInstrs.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/GCCFEBuildInstrs.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/GCCFEBuildInstrs.html (original) +++ llvm/branches/non-call-eh/docs/GCCFEBuildInstrs.html Sun Jul 6 15:45:41 2008 @@ -29,31 +29,22 @@
    -

    This section describes how to acquire and build llvm-gcc 4.0 and 4.2, which are -based on the GCC 4.0.1/4.2.1 front-ends respectively. Both front-ends support C, -C++, Objective-C and Objective-C++. The 4.2 front-end also supports Ada and -Fortran to some extent. Note that the instructions for building these front-ends -are completely different (and much easier!) than those for building llvm-gcc3 in -the past.

    +

    This section describes how to acquire and build llvm-gcc 4.2, which is based +on the GCC 4.2.1 front-end. Supported languages are Ada, C, C++, Fortran, +Objective-C and Objective-C++. Note that the instructions for building these +front-ends are completely different (and much easier!) than those for building +llvm-gcc3 in the past.

      -
    1. Retrieve the appropriate llvm-gcc4.x-y.z.source.tar.gz archive from the +

    2. Retrieve the appropriate llvm-gcc-4.2-x.y.source.tar.gz archive from the llvm web site.

      It is also possible to download the sources of the llvm-gcc front end - from a read-only mirror using subversion. To check out the 4.0 code + from a read-only mirror using subversion. To check out the 4.2 code for first time use:

      -svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.0/trunk dst-directory
      -
      -
      - -

      To check out the 4.2 code use:

      - -
      -
       svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk dst-directory
       
      @@ -93,19 +84,17 @@
    3. The build requires having a compiler that supports Ada, C and C++. The Ada front-end is written in Ada so an Ada compiler is needed to build it. Compilers known to work with the - LLVM 2.2 release + LLVM 2.3 release are gcc-4.2 and the - 2005 GNAT GPL Edition. - LLVM from subversion - also works with the - 2006 and 2007 GNAT GPL Editions. + 2005, 2006 and 2007 versions of the + GNAT GPL Edition. The LLVM parts of llvm-gcc are written in C++ so a C++ compiler is needed to build them. The rest of gcc is written in C. Some linux distributions provide a version of gcc that supports all three languages (the Ada part often comes as an add-on package to the rest of gcc). Otherwise it is possible to combine two versions of gcc, one that supports Ada and C (such as the - 2005 GNAT GPL Edition) + 2007 GNAT GPL Edition) and another which supports C++, see below.

    4. Because the Ada front-end is experimental, it is wise to build the compiler with checking enabled. This causes it to run much slower, but @@ -121,9 +110,9 @@ and unpack it:

      -
      wget http://llvm.org/releases/2.2/llvm-2.2.tar.gz
      -tar xzf llvm-2.2.tar.gz
      -mv llvm-2.2 llvm
      +
      wget http://llvm.org/releases/2.3/llvm-2.3.tar.gz
      +tar xzf llvm-2.3.tar.gz
      +mv llvm-2.3 llvm

      or check out the @@ -139,9 +128,9 @@ and unpack it:

      -
      wget http://llvm.org/releases/2.2/llvm-gcc4.2-2.2.source.tar.gz
      -tar xzf llvm-gcc4.2-2.2.source.tar.gz
      -mv llvm-gcc4.2-2.2.source llvm-gcc-4.2
      +
      wget http://llvm.org/releases/2.3/llvm-gcc-4.2-2.3.source.tar.gz
      +tar xzf llvm-gcc-4.2-2.3.source.tar.gz
      +mv llvm-gcc4.2-2.3.source llvm-gcc-4.2

      or check out the @@ -186,7 +175,7 @@

    5. Install LLVM (optional):

      -
      make install
      +
      make ENABLE_OPTIMIZED=0 install
    6. @@ -203,12 +192,12 @@
    7. Configure llvm-gcc (here it is configured to install into /usr/local). The --enable-checking flag turns on sanity checks inside the compiler. - If you omit it then LLVM must be built with make ENABLE_OPTIMIZED=1. + If you omit it then LLVM should be built with make ENABLE_OPTIMIZED=1. Additional languages can be appended to the --enable-languages switch, for example --enable-languages=ada,c,c++.

      -
      ../llvm-gcc-4.2/configure --prefix=/usr/local --enable-languages=ada,c --enable-checking --enable-llvm=$PWD/../llvm-objects --disable-shared --disable-bootstrap --disable-multilib
      +
      ../llvm-gcc-4.2/configure --prefix=/usr/local --enable-languages=ada,c --enable-checking --enable-llvm=$PWD/../llvm-objects --disable-bootstrap --disable-multilib

      If you have a multi-compiler setup, then you can configure like this:

      @@ -217,7 +206,7 @@
       export CC=PATH_TO_C_AND_ADA_COMPILER
       export CXX=PATH_TO_C++_COMPILER
      -../llvm-gcc-4.2/configure --prefix=/usr/local --enable-languages=ada,c --enable-checking --enable-llvm=$PWD/../llvm-objects --disable-shared --disable-bootstrap --disable-multilib
      +../llvm-gcc-4.2/configure --prefix=/usr/local --enable-languages=ada,c --enable-checking --enable-llvm=$PWD/../llvm-objects --disable-bootstrap --disable-multilib
  • Modified: llvm/branches/non-call-eh/docs/GarbageCollection.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/GarbageCollection.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/GarbageCollection.html (original) +++ llvm/branches/non-call-eh/docs/GarbageCollection.html Sun Jul 6 15:45:41 2008 @@ -151,7 +151,7 @@

    LLVM's intermediate representation provides garbage -collection intrinsics which offer support for a broad class of +collection intrinsics that offer support for a broad class of collector models. For instance, the intrinsics permit:

      @@ -280,8 +280,8 @@
      -

      The SemiSpace runtime implements with the suggested -runtime interface and is compatible the ShadowStack backend.

      +

      The SemiSpace runtime implements the suggested +runtime interface and is compatible with the ShadowStack backend.

      SemiSpace is a very simple copying collector. When it starts up, it allocates two blocks of memory for the heap. It uses a simple bump-pointer @@ -321,7 +321,7 @@

      @@ -351,12 +351,12 @@

      The gc function attribute is used to specify the desired collector -algorithm to the compiler. It is equivalent to specify the collector name +algorithm to the compiler. It is equivalent to specifying the collector name programmatically using the setCollector method of Function.

      Specifying the collector on a per-function basis allows LLVM to link together -programs which use different garbage collection algorithms.

      +programs that use different garbage collection algorithms.

      @@ -366,13 +366,13 @@
      - void %llvm.gcroot(i8** %ptrloc, i8* %metadata) + void @llvm.gcroot(i8** %ptrloc, i8* %metadata)

      The llvm.gcroot intrinsic is used to inform LLVM of a pointer -variable on the stack. The first argument must be an alloca instruction +variable on the stack. The first argument must be a value referring to an alloca instruction or a bitcast of an alloca. The second contains a pointer to metadata that should be associated with the pointer, and must be a constant or global value address. If your target collector uses tags, use a null pointer for @@ -399,7 +399,7 @@ ;; Tell LLVM that the stack space is a stack root. ;; Java has type-tags on objects, so we pass null as metadata. %tmp = bitcast %Object** %X to i8** - call void %llvm.gcroot(%i8** %X, i8* null) + call void @llvm.gcroot(i8** %X, i8* null) ... ;; "CodeBlock" is the block corresponding to the start @@ -439,16 +439,16 @@ for completeness. In this snippet, %object is the object pointer, and %derived is the derived pointer:

      -
          ;; An array type.
      +
      +    ;; An array type.
           %class.Array = type { %class.Object, i32, [0 x %class.Object*] }
      -...
      +    ...
       
           ;; Load the object pointer from a gcroot.
           %object = load %class.Array** %object_addr
       
           ;; Compute the derived pointer.
      -    %derived = getelementptr %obj, i32 0, i32 2, i32 %n
      + %derived = getelementptr %object, i32 0, i32 2, i32 %n
      @@ -594,7 +594,7 @@ generator that iterates through all of the GC roots on the stack, calling the specified function pointer with each record. For each GC root, the address of the pointer and the meta-data (from the llvm.gcroot intrinsic) are provided. +href="#gcroot">llvm.gcroot intrinsic) are provided.

    @@ -1329,7 +1329,7 @@ llvm_gc_collect functions. To do this, it will probably have to trace through the roots from the stack and understand the GC descriptors -for heap objects. Luckily, there are some example +for heap objects. Luckily, there are some example implementations available.

    @@ -1366,7 +1366,7 @@

    The LLVM garbage collectors are capable of supporting all of these styles of language, including ones that mix various implementations. To do this, it allows the source-language to associate meta-data with the stack roots, and the heap tracing routines can propagate the +href="#gcroot">stack roots, and the heap tracing routines can propagate the information. In addition, LLVM allows the front-end to extract GC information in any form from a specific object pointer (this supports situations #1 and #3).

    Modified: llvm/branches/non-call-eh/docs/GettingStarted.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/GettingStarted.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/GettingStarted.html (original) +++ llvm/branches/non-call-eh/docs/GettingStarted.html Sun Jul 6 15:45:41 2008 @@ -716,6 +716,7 @@ subdirectories of the 'tags' directory:

      +
    • Release 2.3: RELEASE_23
    • Release 2.2: RELEASE_22
    • Release 2.1: RELEASE_21
    • Release 2.0: RELEASE_20
    • Modified: llvm/branches/non-call-eh/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/LangRef.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/LangRef.html (original) +++ llvm/branches/non-call-eh/docs/LangRef.html Sun Jul 6 15:45:41 2008 @@ -111,6 +111,12 @@
    • 'shufflevector' Instruction
    • +
    • Aggregate Operations +
        +
      1. 'extractvalue' Instruction
      2. +
      3. 'insertvalue' Instruction
      4. +
      +
    • Memory Access and Addressing Operations
      1. 'malloc' Instruction
      2. @@ -140,6 +146,8 @@
        1. 'icmp' Instruction
        2. 'fcmp' Instruction
        3. +
        4. 'vicmp' Instruction
        5. +
        6. 'vfcmp' Instruction
        7. 'phi' Instruction
        8. 'select' Instruction
        9. 'call' Instruction
        10. @@ -208,9 +216,18 @@
        11. Atomic intrinsics
          1. llvm.memory_barrier
          2. -
          3. llvm.atomic.lcs
          4. -
          5. llvm.atomic.las
          6. +
          7. llvm.atomic.cmp.swap
          8. llvm.atomic.swap
          9. +
          10. llvm.atomic.load.add
          11. +
          12. llvm.atomic.load.sub
          13. +
          14. llvm.atomic.load.and
          15. +
          16. llvm.atomic.load.nand
          17. +
          18. llvm.atomic.load.or
          19. +
          20. llvm.atomic.load.xor
          21. +
          22. llvm.atomic.load.max
          23. +
          24. llvm.atomic.load.min
          25. +
          26. llvm.atomic.load.umax
          27. +
          28. llvm.atomic.load.umin
        12. General intrinsics @@ -458,7 +475,7 @@
          -
          internal
          +
          internal:
          Global values with internal linkage are only directly accessible by objects in the current module. In particular, linking code into a module with @@ -477,14 +494,22 @@ allowed to be discarded.
          +
          common:
          + +
          "common" linkage is exactly the same as linkonce + linkage, except that unreferenced common globals may not be + discarded. This is used for globals that may be emitted in multiple + translation units, but that are not guaranteed to be emitted into every + translation unit that uses them. One example of this is tentative + definitions in C, such as "int X;" at global scope. +
          +
          weak:
          -
          "weak" linkage is exactly the same as linkonce linkage, - except that unreferenced weak globals may not be discarded. This is - used for globals that may be emitted in multiple translation units, but that - are not guaranteed to be emitted into every translation unit that uses them. - One example of this are common globals in C, such as "int X;" at - global scope. +
          "weak" linkage is the same as common linkage, except + that some targets may choose to emit different assembly sequences for them + for target-dependent reasons. This is used for globals that are declared + "weak" in C source code.
          appending:
          @@ -578,9 +603,11 @@ (e.g. by passing things in registers). This calling convention allows the target to use whatever tricks it wants to produce fast code for the target, without having to conform to an externally specified ABI. Implementations of - this convention should allow arbitrary tail call optimization to be supported. - This calling convention does not support varargs and requires the prototype of - all callees to exactly match the prototype of the function definition. + this convention should allow arbitrary + tail call optimization to be + supported. This calling convention does not support varargs and requires the + prototype of all callees to exactly match the prototype of the function + definition.
          "coldcc" - The cold calling convention:
          @@ -1027,14 +1054,16 @@ integer, floating point, pointer, - vector + vector, + structure, + array, + label. primitive label, void, - integer, floating point. @@ -1054,8 +1083,7 @@

          The first class types are perhaps the most important. Values of these types are the only ones which can be produced by instructions, passed as arguments, or used as operands to -instructions. This means that all structures and arrays must be -manipulated either by pointer or by component.

          +instructions.

          @@ -1223,17 +1251,21 @@
          +
          Overview:
          +

          The function type can be thought of as a function signature. It consists of a return type and a list of formal parameter types. The -return type of a function type is a scalar type or a void type or a struct type. +return type of a function type is a scalar type, a void type, or a struct type. If the return type is a struct type then all struct elements must be of first -class types. Function types are usually used to build virtual function tables -(which are structures of pointers to functions), for indirect function -calls, and when defining a function.

          +class types, and the struct must have at least one element.

          Syntax:
          -
            <returntype list> (<parameter list>)
          + +
          +  <returntype list> (<parameter list>)
          +
          +

          ...where '<parameter list>' is a comma-separated list of type specifiers. Optionally, the parameter list may include a type ..., which indicates that the function takes a variable number of arguments. @@ -1241,6 +1273,7 @@ href="#int_varargs">variable argument handling intrinsic functions. '<returntype list>' is a comma-separated list of first class type specifiers.

          +
          Examples:
          @@ -1675,6 +1708,12 @@
          fcmp COND ( VAL1, VAL2 )
          Performs the fcmp operation on constants.
          +
          vicmp COND ( VAL1, VAL2 )
          +
          Performs the vicmp operation on constants.
          + +
          vfcmp COND ( VAL1, VAL2 )
          +
          Performs the vfcmp operation on constants.
          +
          extractelement ( VAL, IDX )
          Perform the extractelement @@ -1802,19 +1841,26 @@ ret void ; Return from void function ret <type> <value>, <type> <value> ; Return two values from a non-void function +
          Overview:
          +

          The 'ret' instruction is used to return control flow (and a value) from a function back to the caller.

          There are two forms of the 'ret' instruction: one that -returns a value and then causes control flow, and one that just causes +returns value(s) and then causes control flow, and one that just causes control flow to occur.

          +
          Arguments:
          -

          The 'ret' instruction may return one or multiple values. The -type of each return value must be a 'first class' - type. Note that a function is not well formed -if there exists a 'ret' instruction inside of the function that -returns values that do not match the return type of the function.

          + +

          The 'ret' instruction may return zero, one or multiple values. +The type of each return value must be a 'first +class' type. Note that a function is not well +formed if there exists a 'ret' instruction inside of the +function that returns values that do not match the return type of the +function.

          +
          Semantics:
          +

          When the 'ret' instruction is executed, control flow returns back to the calling function's context. If the caller is a "call" instruction, execution continues at @@ -1825,8 +1871,11 @@ return value. If the instruction returns multiple values then these values can only be accessed through a 'getresult ' instruction.

          +
          Example:
          -
            ret i32 5                       ; Return an integer value of 5
          +
          +
          +  ret i32 5                       ; Return an integer value of 5
             ret void                        ; Return from a void function
             ret i32 4, i8 2                 ; Return two values 4 and 2  
           
          @@ -2062,82 +2111,121 @@

          There are several different binary operators:

          - + +
          +
          Syntax:
          -
            <result> = add <ty> <var1>, <var2>   ; yields {ty}:result
          +
          +
          +  <result> = add <ty> <var1>, <var2>   ; yields {ty}:result
           
          +
          Overview:
          +

          The 'add' instruction returns the sum of its two operands.

          +
          Arguments:
          -

          The two arguments to the 'add' instruction must be either integer or floating point values. - This instruction can also take vector versions of the values. -Both arguments must have identical types.

          + +

          The two arguments to the 'add' instruction must be integer, floating point, or + vector values. Both arguments must have identical + types.

          +
          Semantics:
          +

          The value produced is the integer or floating point sum of the two operands.

          +

          If an integer sum has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.

          +

          Because LLVM integers use a two's complement representation, this instruction is appropriate for both signed and unsigned integers.

          +
          Example:
          -
            <result> = add i32 4, %var          ; yields {i32}:result = 4 + %var
          +
          +
          +  <result> = add i32 4, %var          ; yields {i32}:result = 4 + %var
           
          - + +
          +
          Syntax:
          -
            <result> = sub <ty> <var1>, <var2>   ; yields {ty}:result
          +
          +
          +  <result> = sub <ty> <var1>, <var2>   ; yields {ty}:result
           
          +
          Overview:
          +

          The 'sub' instruction returns the difference of its two operands.

          -

          Note that the 'sub' instruction is used to represent the 'neg' -instruction present in most other intermediate representations.

          + +

          Note that the 'sub' instruction is used to represent the +'neg' instruction present in most other intermediate +representations.

          +
          Arguments:
          -

          The two arguments to the 'sub' instruction must be either integer or floating point -values. -This instruction can also take vector versions of the values. -Both arguments must have identical types.

          + +

          The two arguments to the 'sub' instruction must be integer, floating point, + or vector values. Both arguments must have identical + types.

          +
          Semantics:
          +

          The value produced is the integer or floating point difference of the two operands.

          +

          If an integer difference has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.

          +

          Because LLVM integers use a two's complement representation, this instruction is appropriate for both signed and unsigned integers.

          +
          Example:
             <result> = sub i32 4, %var          ; yields {i32}:result = 4 - %var
             <result> = sub i32 0, %val          ; yields {i32}:result = -%var
           
          + - + +
          +
          Syntax:
            <result> = mul <ty> <var1>, <var2>   ; yields {ty}:result
           
          Overview:

          The 'mul' instruction returns the product of its two operands.

          +
          Arguments:
          -

          The two arguments to the 'mul' instruction must be either integer or floating point -values. -This instruction can also take vector versions of the values. -Both arguments must have identical types.

          + +

          The two arguments to the 'mul' instruction must be integer, floating point, +or vector values. Both arguments must have identical +types.

          +
          Semantics:
          +

          The value produced is the integer or floating point product of the two operands.

          +

          If the result of an integer multiplication has unsigned overflow, the result returned is the mathematical result modulo 2n, where n is the bit width of the result.

          @@ -2151,6 +2239,7 @@
            <result> = mul i32 4, %var          ; yields {i32}:result = 4 * %var
           
          + @@ -2161,12 +2250,15 @@
          Overview:

          The 'udiv' instruction returns the quotient of its two operands.

          +
          Arguments:
          +

          The two arguments to the 'udiv' instruction must be -integer values. Both arguments must have identical -types. This instruction can also take vector versions -of the values in which case the elements must be integers.

          +integer or vector of integer +values. Both arguments must have identical types.

          +
          Semantics:
          +

          The value produced is the unsigned integer quotient of the two operands.

          Note that unsigned integer division and signed integer division are distinct operations; for signed integer division, use 'sdiv'.

          @@ -2180,16 +2272,21 @@
          Syntax:
          -
            <result> = sdiv <ty> <var1>, <var2>   ; yields {ty}:result
          +
          +  <result> = sdiv <ty> <var1>, <var2>   ; yields {ty}:result
           
          +
          Overview:
          +

          The 'sdiv' instruction returns the quotient of its two operands.

          +
          Arguments:
          -

          The two arguments to the 'sdiv' instruction must be -integer values. Both arguments must have identical -types. This instruction can also take vector versions -of the values in which case the elements must be integers.

          + +

          The two arguments to the 'sdiv' instruction must be +integer or vector of integer +values. Both arguments must have identical types.

          +
          Semantics:

          The value produced is the signed integer quotient of the two operands rounded towards zero.

          Note that signed integer division and unsigned integer division are distinct @@ -2206,22 +2303,31 @@ Instruction

          Syntax:
          -
            <result> = fdiv <ty> <var1>, <var2>   ; yields {ty}:result
          +
          +  <result> = fdiv <ty> <var1>, <var2>   ; yields {ty}:result
           
          Overview:
          +

          The 'fdiv' instruction returns the quotient of its two operands.

          +
          Arguments:
          +

          The two arguments to the 'fdiv' instruction must be -floating point values. Both arguments must have -identical types. This instruction can also take vector -versions of floating point values.

          +floating point or vector +of floating point values. Both arguments must have identical types.

          +
          Semantics:
          +

          The value produced is the floating point quotient of the two operands.

          +
          Example:
          -
            <result> = fdiv float 4.0, %var          ; yields {float}:result = 4.0 / %var
          +
          +
          +  <result> = fdiv float 4.0, %var          ; yields {float}:result = 4.0 / %var
           
          + @@ -2233,10 +2339,9 @@

          The 'urem' instruction returns the remainder from the unsigned division of its two arguments.

          Arguments:
          -

          The two arguments to the 'urem' instruction must be -integer values. Both arguments must have identical -types. This instruction can also take vector versions -of the values in which case the elements must be integers.

          +

          The two arguments to the 'urem' instruction must be +integer or vector of integer +values. Both arguments must have identical types.

          Semantics:

          This instruction returns the unsigned integer remainder of a division. This instruction always performs an unsigned division to get the remainder.

          @@ -2249,23 +2354,33 @@ - + +
          +
          Syntax:
          -
            <result> = srem <ty> <var1>, <var2>   ; yields {ty}:result
          +
          +
          +  <result> = srem <ty> <var1>, <var2>   ; yields {ty}:result
           
          +
          Overview:
          +

          The 'srem' instruction returns the remainder from the signed division of its two operands. This instruction can also take vector versions of the values in which case the elements must be integers.

          Arguments:
          +

          The two arguments to the 'srem' instruction must be -integer values. Both arguments must have identical -types.

          +integer or vector of integer +values. Both arguments must have identical types.

          +
          Semantics:
          +

          This instruction returns the remainder of a division (where the result has the same sign as the dividend, var1), not the modulo operator (where the result has the same sign as the divisor, var2) of @@ -2288,9 +2403,11 @@

          - + +
          +
          Syntax:
            <result> = frem <ty> <var1>, <var2>   ; yields {ty}:result
           
          @@ -2299,14 +2416,18 @@ division of its two operands.

          Arguments:

          The two arguments to the 'frem' instruction must be -floating point values. Both arguments must have -identical types. This instruction can also take vector -versions of floating point values.

          +floating point or vector +of floating point values. Both arguments must have identical types.

          +
          Semantics:
          +

          This instruction returns the remainder of a division. The remainder has the same sign as the dividend.

          +
          Example:
          -
            <result> = frem float 4.0, %var          ; yields {float}:result = 4.0 % %var
          +
          +
          +  <result> = frem float 4.0, %var          ; yields {float}:result = 4.0 % %var
           
          @@ -2338,7 +2459,8 @@

          Both arguments to the 'shl' instruction must be the same integer type. 'var2' is treated as an -unsigned value.

          +unsigned value. This instruction does not support +vector operands.

          Semantics:
          @@ -2368,7 +2490,8 @@
          Arguments:

          Both arguments to the 'lshr' instruction must be the same integer type. 'var2' is treated as an -unsigned value.

          +unsigned value. This instruction does not support +vector operands.

          Semantics:
          @@ -2403,7 +2526,8 @@
          Arguments:

          Both arguments to the 'ashr' instruction must be the same integer type. 'var2' is treated as an -unsigned value.

          +unsigned value. This instruction does not support +vector operands.

          Semantics:

          This instruction always performs an arithmetic shift right operation, @@ -2425,17 +2549,26 @@

          +
          +
          Syntax:
          -
            <result> = and <ty> <var1>, <var2>   ; yields {ty}:result
          +
          +
          +  <result> = and <ty> <var1>, <var2>   ; yields {ty}:result
           
          +
          Overview:
          +

          The 'and' instruction returns the bitwise logical and of its two operands.

          +
          Arguments:
          -

          The two arguments to the 'and' instruction must be integer values. Both arguments must have -identical types.

          + +

          The two arguments to the 'and' instruction must be +integer or vector of integer +values. Both arguments must have identical types.

          +
          Semantics:

          The truth table used for the 'and' instruction is:

          @@ -2471,7 +2604,8 @@
          Example:
          -
            <result> = and i32 4, %var         ; yields {i32}:result = 4 & %var
          +
          +  <result> = and i32 4, %var         ; yields {i32}:result = 4 & %var
             <result> = and i32 15, 40          ; yields {i32}:result = 8
             <result> = and i32 4, 8            ; yields {i32}:result = 0
           
          @@ -2486,9 +2620,10 @@

          The 'or' instruction returns the bitwise logical inclusive or of its two operands.

          Arguments:
          -

          The two arguments to the 'or' instruction must be integer values. Both arguments must have -identical types.

          + +

          The two arguments to the 'or' instruction must be +integer or vector of integer +values. Both arguments must have identical types.

          Semantics:

          The truth table used for the 'or' instruction is:

          @@ -2541,10 +2676,12 @@ or of its two operands. The xor is used to implement the "one's complement" operation, which is the "~" operator in C.

          Arguments:
          -

          The two arguments to the 'xor' instruction must be integer values. Both arguments must have -identical types.

          +

          The two arguments to the 'xor' instruction must be +integer or vector of integer +values. Both arguments must have identical types.

          +
          Semantics:
          +

          The truth table used for the 'xor' instruction is:

          @@ -2659,7 +2796,7 @@
          Syntax:
          -  <result> = insertelement <n x <ty>> <val>, <ty> <elt>, i32 <idx>    ; yields <n x <ty>>
          +  <result> = insertelement <n x <ty>> <val>, <ty> <elt>, i32 <idx>    ; yields <n x <ty>>
           
          Overview:
          @@ -2752,6 +2889,114 @@ + +
          + +

          LLVM supports several instructions for working with aggregate values. +

          + +
          + + + + +
          + +
          Syntax:
          + +
          +  <result> = extractvalue <aggregate type> <val>, <idx>{, <idx>}*
          +
          + +
          Overview:
          + +

          +The 'extractvalue' instruction extracts the value of a struct field +or array element from an aggregate value. +

          + + +
          Arguments:
          + +

          +The first operand of an 'extractvalue' instruction is a +value of struct or array +type. The operands are constant indices to specify which value to extract +in a similar manner as indices in a +'getelementptr' instruction. +

          + +
          Semantics:
          + +

          +The result is the value at the position in the aggregate specified by +the index operands. +

          + +
          Example:
          + +
          +  %result = extractvalue {i32, float} %agg, 0    ; yields i32
          +
          +
          + + + + + +
          + +
          Syntax:
          + +
          +  <result> = insertvalue <aggregate type> <val>, <ty> <val>, <idx>    ; yields <n x <ty>>
          +
          + +
          Overview:
          + +

          +The 'insertvalue' instruction inserts a value +into a struct field or array element in an aggregate. +

          + + +
          Arguments:
          + +

          +The first operand of an 'insertvalue' instruction is a +value of struct or array type. +The second operand is a first-class value to insert. +The following operands are constant indices +indicating the position at which to insert the value in a similar manner as +indices in a +'getelementptr' instruction. +The value to insert must have the same type as the value identified +by the indices. + +

          Semantics:
          + +

          +The result is an aggregate of the same type as val. Its +value is that of val except that the value at the position +specified by the indices is that of elt. +

          + +
          Example:
          + +
          +  %result = insertvalue {i32, float} %agg, i32 1, 0    ; yields {i32, float}
          +
          +
          + + + + @@ -3005,8 +3250,8 @@ 'getelementptr' instruction is used to index down through the type levels of a structure or to a specific index in an array. When indexing into a structure, only i32 integer constants are allowed. When indexing -into an array or pointer, only integers of 32 or 64 bits are allowed, and will -be sign extended to 64-bit values.

          +into an array or pointer, only integers of 32 or 64 bits are allowed; 32-bit +values will be sign extended to 64-bits if required.

          For example, let's consider a C code fragment and how it gets compiled to LLVM:

          @@ -3081,7 +3326,7 @@

          Note that it is undefined to access an array out of bounds: array and pointer indexes must always be within the defined bounds of the array type. -The one exception for this rules is zero length arrays. These arrays are +The one exception for this rule is zero length arrays. These arrays are defined to be accessible as variable length arrays, which requires access beyond the zero'th element.

          @@ -3517,15 +3762,19 @@
          Overview:
          +

          The 'bitcast' instruction converts value to type ty2 without changing any bits.

          Arguments:
          +

          The 'bitcast' instruction takes a value to cast, which must be a first class value, and a type to cast it to, which must also be a first class type. The bit sizes of value and the destination type, ty2, must be identical. If the source -type is a pointer, the destination type must also be a pointer.

          +type is a pointer, the destination type must also be a pointer. This +instruction supports bitwise conversion of vectors to integers and to vectors +of other types (as long as they have the same size).

          Semantics:

          The 'bitcast' instruction converts value to type @@ -3657,9 +3906,9 @@ floating point typed. They must have identical types.

          Semantics:
          -

          The 'fcmp' compares var1 and var2 according to -the condition code given as cond. The comparison performed always -yields a i1 result, as follows: +

          The 'fcmp' instruction compares var1 and var2 +according to the condition code given as cond. The comparison performed +always yields a i1 result, as follows:

          1. false: always yields false, regardless of operands.
          2. oeq: yields true if both operands are not a QNAN and @@ -3700,30 +3949,144 @@ - + +
            +
            Syntax:
            +
              <result> = vicmp <cond> <ty> <var1>, <var2>   ; yields {ty}:result
            +
            +
            Overview:
            +

            The 'vicmp' instruction returns an integer vector value based on +element-wise comparison of its two integer vector operands.

            +
            Arguments:
            +

            The 'vicmp' instruction takes three operands. The first operand is +the condition code indicating the kind of comparison to perform. It is not +a value, just a keyword. The possible condition code are: +

              +
            1. eq: equal
            2. +
            3. ne: not equal
            4. +
            5. ugt: unsigned greater than
            6. +
            7. uge: unsigned greater or equal
            8. +
            9. ult: unsigned less than
            10. +
            11. ule: unsigned less or equal
            12. +
            13. sgt: signed greater than
            14. +
            15. sge: signed greater or equal
            16. +
            17. slt: signed less than
            18. +
            19. sle: signed less or equal
            20. +
            +

            The remaining two arguments must be vector of +integer typed. They must also be identical types.

            +
            Semantics:
            +

            The 'vicmp' instruction compares var1 and var2 +according to the condition code given as cond. The comparison yields a +vector of integer result, of +identical type as the values being compared. The most significant bit in each +element is 1 if the element-wise comparison evaluates to true, and is 0 +otherwise. All other bits of the result are undefined. The condition codes +are evaluated identically to the 'icmp' +instruction. + +

            Example:
            +
            +  <result> = vicmp eq <2 x i32> < i32 4, i32 0>, < i32 5, i32 0>   ; yields: result=<2 x i32> < i32 0, i32 -1 >
            +  <result> = vicmp ult <2 x i8 > < i8 1, i8 2>, < i8 2, i8 2 >        ; yields: result=<2 x i8> < i8 -1, i8 0 >
            +
            +
            + + + +
            +
            Syntax:
            +
              <result> = vfcmp <cond> <ty> <var1>, <var2>
            +
            Overview:
            +

            The 'vfcmp' instruction returns an integer vector value based on +element-wise comparison of its two floating point vector operands. The output +elements have the same width as the input elements.

            +
            Arguments:
            +

            The 'vfcmp' instruction takes three operands. The first operand is +the condition code indicating the kind of comparison to perform. It is not +a value, just a keyword. The possible condition code are: +

              +
            1. false: no comparison, always returns false
            2. +
            3. oeq: ordered and equal
            4. +
            5. ogt: ordered and greater than
            6. +
            7. oge: ordered and greater than or equal
            8. +
            9. olt: ordered and less than
            10. +
            11. ole: ordered and less than or equal
            12. +
            13. one: ordered and not equal
            14. +
            15. ord: ordered (no nans)
            16. +
            17. ueq: unordered or equal
            18. +
            19. ugt: unordered or greater than
            20. +
            21. uge: unordered or greater than or equal
            22. +
            23. ult: unordered or less than
            24. +
            25. ule: unordered or less than or equal
            26. +
            27. une: unordered or not equal
            28. +
            29. uno: unordered (either nans)
            30. +
            31. true: no comparison, always returns true
            32. +
            +

            The remaining two arguments must be vector of +floating point typed. They must also be identical +types.

            +
            Semantics:
            +

            The 'vfcmp' instruction compares var1 and var2 +according to the condition code given as cond. The comparison yields a +vector of integer result, with +an identical number of elements as the values being compared, and each element +having identical with to the width of the floating point elements. The most +significant bit in each element is 1 if the element-wise comparison evaluates to +true, and is 0 otherwise. All other bits of the result are undefined. The +condition codes are evaluated identically to the +'fcmp' instruction. + +

            Example:
            +
            +  <result> = vfcmp oeq <2 x float> < float 4, float 0 >, < float 5, float 0 >       ; yields: result=<2 x i32> < i32 0, i32 -1 >
            +  <result> = vfcmp ult <2 x double> < double 1, double 2 >, < double 2, double 2>   ; yields: result=<2 x i64> < i64 -1, i64 0 >
            +
            +
            + + + +
            +
            Syntax:
            +
              <result> = phi <ty> [ <val0>, <label0>], ...
            Overview:

            The 'phi' instruction is used to implement the φ node in the SSA graph representing the function.

            Arguments:
            +

            The type of the incoming values is specified with the first type field. After this, the 'phi' instruction takes a list of pairs as arguments, with one pair for each predecessor basic block of the current block. Only values of first class type may be used as the value arguments to the PHI node. Only labels may be used as the label arguments.

            +

            There must be no non-phi instructions between the start of a basic block and the PHI instructions: i.e. PHI instructions must be first in a basic block.

            +
            Semantics:
            +

            At runtime, the 'phi' instruction logically takes on the value specified by the pair corresponding to the predecessor basic block that executed just prior to the current block.

            +
            Example:
            -
            Loop:       ; Infinite loop that counts from 0 on up...
            %indvar = phi i32 [ 0, %LoopHeader ], [ %nextindvar, %Loop ]
            %nextindvar = add i32 %indvar, 1
            br label %Loop
            +
            +Loop:       ; Infinite loop that counts from 0 on up...
            +  %indvar = phi i32 [ 0, %LoopHeader ], [ %nextindvar, %Loop ]
            +  %nextindvar = add i32 %indvar, 1
            +  br label %Loop
            +
            @@ -3750,13 +4113,16 @@
            Arguments:

            -The 'select' instruction requires a boolean value indicating the condition, and two values of the same first class type. +The 'select' instruction requires an 'i1' value indicating the +condition, and two values of the same first class +type. If the val1/val2 are vectors, the entire vectors are selected, not +individual elements.

            Semantics:

            -If the boolean condition evaluates to true, the instruction returns the first +If the i1 condition evaluates is 1, the instruction returns the first value argument; otherwise, it returns the second value argument.

            @@ -3925,9 +4291,10 @@
            Arguments:

            The 'getresult' instruction takes a call or invoke value as its -first argument. The value must have structure type. -The second argument is a constant unsigned index value which must be in range for -the number of values returned by the call.

            +first argument, or an undef value. The value must have structure type. The second argument is a constant +unsigned index value which must be in range for the number of values returned +by the call.

            Semantics:
            @@ -4191,7 +4558,7 @@
            Semantics:
            -

            At runtime, a call to this intrinsics stores a null pointer into the "ptrloc" +

            At runtime, a call to this intrinsic stores a null pointer into the "ptrloc" location. At compile-time, the code generator generates information to allow the runtime to find the pointer at GC safe points. The 'llvm.gcroot' intrinsic may only be used in a function which specifies a GC @@ -5419,19 +5786,19 @@

            Syntax:

            - This is an overloaded intrinsic. You can use llvm.atomic.lcs on any + This is an overloaded intrinsic. You can use llvm.atomic.cmp.swap on any integer bit width. Not all targets support all bit widths however.

            -declare i8 @llvm.atomic.lcs.i8( i8* <ptr>, i8 <cmp>, i8 <val> )
            -declare i16 @llvm.atomic.lcs.i16( i16* <ptr>, i16 <cmp>, i16 <val> )
            -declare i32 @llvm.atomic.lcs.i32( i32* <ptr>, i32 <cmp>, i32 <val> )
            -declare i64 @llvm.atomic.lcs.i64( i64* <ptr>, i64 <cmp>, i64 <val> )
            +declare i8 @llvm.atomic.cmp.swap.i8( i8* <ptr>, i8 <cmp>, i8 <val> )
            +declare i16 @llvm.atomic.cmp.swap.i16( i16* <ptr>, i16 <cmp>, i16 <val> )
            +declare i32 @llvm.atomic.cmp.swap.i32( i32* <ptr>, i32 <cmp>, i32 <val> )
            +declare i64 @llvm.atomic.cmp.swap.i64( i64* <ptr>, i64 <cmp>, i64 <val> )
             
             
            Overview:
            @@ -5441,7 +5808,7 @@

            Arguments:

            - The llvm.atomic.lcs intrinsic takes three arguments. The result as + The llvm.atomic.cmp.swap intrinsic takes three arguments. The result as well as both cmp and val must be integer values with the same bit width. The ptr argument must be a pointer to a value of this integer type. While any bit width integer may be used, targets may only @@ -5463,13 +5830,13 @@ store i32 4, %ptr %val1 = add i32 4, 4 -%result1 = call i32 @llvm.atomic.lcs.i32( i32* %ptr, i32 4, %val1 ) +%result1 = call i32 @llvm.atomic.cmp.swap.i32( i32* %ptr, i32 4, %val1 ) ; yields {i32}:result1 = 4 %stored1 = icmp eq i32 %result1, 4 ; yields {i1}:stored1 = true %memval1 = load i32* %ptr ; yields {i32}:memval1 = 8 %val2 = add i32 1, 1 -%result2 = call i32 @llvm.atomic.lcs.i32( i32* %ptr, i32 5, %val2 ) +%result2 = call i32 @llvm.atomic.cmp.swap.i32( i32* %ptr, i32 5, %val2 ) ; yields {i32}:result2 = 8 %stored2 = icmp eq i32 %result2, 5 ; yields {i1}:stored2 = false @@ -5503,7 +5870,7 @@

            Arguments:

            - The llvm.atomic.ls intrinsic takes two arguments. Both the + The llvm.atomic.swap intrinsic takes two arguments. Both the val argument and the result must be integers of the same bit width. The first argument, ptr, must be a pointer to a value of this integer type. The targets may only lower integer representations they @@ -5538,19 +5905,19 @@

            Syntax:

            - This is an overloaded intrinsic. You can use llvm.atomic.las on any + This is an overloaded intrinsic. You can use llvm.atomic.load.add on any integer bit width. Not all targets support all bit widths however.

            -declare i8 @llvm.atomic.las.i8.( i8* <ptr>, i8 <delta> )
            -declare i16 @llvm.atomic.las.i16.( i16* <ptr>, i16 <delta> )
            -declare i32 @llvm.atomic.las.i32.( i32* <ptr>, i32 <delta> )
            -declare i64 @llvm.atomic.las.i64.( i64* <ptr>, i64 <delta> )
            +declare i8 @llvm.atomic.load.add.i8.( i8* <ptr>, i8 <delta> )
            +declare i16 @llvm.atomic.load.add.i16.( i16* <ptr>, i16 <delta> )
            +declare i32 @llvm.atomic.load.add.i32.( i32* <ptr>, i32 <delta> )
            +declare i64 @llvm.atomic.load.add.i64.( i64* <ptr>, i64 <delta> )
             
             
            Overview:
            @@ -5577,17 +5944,236 @@
             %ptr      = malloc i32
                     store i32 4, %ptr
            -%result1  = call i32 @llvm.atomic.las.i32( i32* %ptr, i32 4 )
            +%result1  = call i32 @llvm.atomic.load.add.i32( i32* %ptr, i32 4 )
                                             ; yields {i32}:result1 = 4
            -%result2  = call i32 @llvm.atomic.las.i32( i32* %ptr, i32 2 )
            +%result2  = call i32 @llvm.atomic.load.add.i32( i32* %ptr, i32 2 )
                                             ; yields {i32}:result2 = 8
            -%result3  = call i32 @llvm.atomic.las.i32( i32* %ptr, i32 5 )
            +%result3  = call i32 @llvm.atomic.load.add.i32( i32* %ptr, i32 5 )
                                             ; yields {i32}:result3 = 10
            -%memval   = load i32* %ptr      ; yields {i32}:memval1 = 15
            +%memval1  = load i32* %ptr      ; yields {i32}:memval1 = 15
            +
            +
            + + + +
            +
            Syntax:
            +

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

            +
            +declare i8 @llvm.atomic.load.sub.i8.( i8* <ptr>, i8 <delta> )
            +declare i16 @llvm.atomic.load.sub.i16.( i16* <ptr>, i16 <delta> )
            +declare i32 @llvm.atomic.load.sub.i32.( i32* <ptr>, i32 <delta> )
            +declare i64 @llvm.atomic.load.sub.i64.( i64* <ptr>, i64 <delta> )
            +
            +
            +
            Overview:
            +

            + This intrinsic subtracts delta to the value stored in memory at + ptr. It yields the original value at ptr. +

            +
            Arguments:
            +

            + + The intrinsic takes two arguments, the first a pointer to an integer value + and the second an integer value. The result is also an integer value. These + integer types can have any bit width, but they must all have the same bit + width. The targets may only lower integer representations they support. +

            +
            Semantics:
            +

            + This intrinsic does a series of operations atomically. It first loads the + value stored at ptr. It then subtracts delta, stores the + result to ptr. It yields the original value stored at ptr. +

            + +
            Examples:
            +
            +%ptr      = malloc i32
            +        store i32 8, %ptr
            +%result1  = call i32 @llvm.atomic.load.sub.i32( i32* %ptr, i32 4 )
            +                                ; yields {i32}:result1 = 8
            +%result2  = call i32 @llvm.atomic.load.sub.i32( i32* %ptr, i32 2 )
            +                                ; yields {i32}:result2 = 4
            +%result3  = call i32 @llvm.atomic.load.sub.i32( i32* %ptr, i32 5 )
            +                                ; yields {i32}:result3 = 2
            +%memval1  = load i32* %ptr      ; yields {i32}:memval1 = -3
            +
            +
            + + + +
            +
            Syntax:
            +

            + These are overloaded intrinsics. You can use llvm.atomic.load_and, + llvm.atomic.load_nand, llvm.atomic.load_or, and + llvm.atomic.load_xor on any integer bit width. Not all targets + support all bit widths however.

            +
            +declare i8 @llvm.atomic.load.and.i8.( i8* <ptr>, i8 <delta> )
            +declare i16 @llvm.atomic.load.and.i16.( i16* <ptr>, i16 <delta> )
            +declare i32 @llvm.atomic.load.and.i32.( i32* <ptr>, i32 <delta> )
            +declare i64 @llvm.atomic.load.and.i64.( i64* <ptr>, i64 <delta> )
            +
            +
            + +
            +declare i8 @llvm.atomic.load.or.i8.( i8* <ptr>, i8 <delta> )
            +declare i16 @llvm.atomic.load.or.i16.( i16* <ptr>, i16 <delta> )
            +declare i32 @llvm.atomic.load.or.i32.( i32* <ptr>, i32 <delta> )
            +declare i64 @llvm.atomic.load.or.i64.( i64* <ptr>, i64 <delta> )
            +
            +
            + +
            +declare i8 @llvm.atomic.load.nand.i8.( i8* <ptr>, i8 <delta> )
            +declare i16 @llvm.atomic.load.nand.i16.( i16* <ptr>, i16 <delta> )
            +declare i32 @llvm.atomic.load.nand.i32.( i32* <ptr>, i32 <delta> )
            +declare i64 @llvm.atomic.load.nand.i64.( i64* <ptr>, i64 <delta> )
            +
            +
            + +
            +declare i8 @llvm.atomic.load.xor.i8.( i8* <ptr>, i8 <delta> )
            +declare i16 @llvm.atomic.load.xor.i16.( i16* <ptr>, i16 <delta> )
            +declare i32 @llvm.atomic.load.xor.i32.( i32* <ptr>, i32 <delta> )
            +declare i64 @llvm.atomic.load.xor.i64.( i64* <ptr>, i64 <delta> )
            +
            +
            +
            Overview:
            +

            + These intrinsics bitwise the operation (and, nand, or, xor) delta to + the value stored in memory at ptr. It yields the original value + at ptr. +

            +
            Arguments:
            +

            + + These intrinsics take two arguments, the first a pointer to an integer value + and the second an integer value. The result is also an integer value. These + integer types can have any bit width, but they must all have the same bit + width. The targets may only lower integer representations they support. +

            +
            Semantics:
            +

            + These intrinsics does a series of operations atomically. They first load the + value stored at ptr. They then do the bitwise operation + delta, store the result to ptr. They yield the original + value stored at ptr. +

            + +
            Examples:
            +
            +%ptr      = malloc i32
            +        store i32 0x0F0F, %ptr
            +%result0  = call i32 @llvm.atomic.load.nand.i32( i32* %ptr, i32 0xFF )
            +                                ; yields {i32}:result0 = 0x0F0F
            +%result1  = call i32 @llvm.atomic.load.and.i32( i32* %ptr, i32 0xFF )
            +                                ; yields {i32}:result1 = 0xFFFFFFF0
            +%result2  = call i32 @llvm.atomic.load.or.i32( i32* %ptr, i32 0F )
            +                                ; yields {i32}:result2 = 0xF0
            +%result3  = call i32 @llvm.atomic.load.xor.i32( i32* %ptr, i32 0F )
            +                                ; yields {i32}:result3 = FF
            +%memval1  = load i32* %ptr      ; yields {i32}:memval1 = F0
             
            + + +
            +
            Syntax:
            +

            + These are overloaded intrinsics. You can use llvm.atomic.load_max, + llvm.atomic.load_min, llvm.atomic.load_umax, and + llvm.atomic.load_umin on any integer bit width. Not all targets + support all bit widths however.

            +
            +declare i8 @llvm.atomic.load.max.i8.( i8* <ptr>, i8 <delta> )
            +declare i16 @llvm.atomic.load.max.i16.( i16* <ptr>, i16 <delta> )
            +declare i32 @llvm.atomic.load.max.i32.( i32* <ptr>, i32 <delta> )
            +declare i64 @llvm.atomic.load.max.i64.( i64* <ptr>, i64 <delta> )
            +
            +
            + +
            +declare i8 @llvm.atomic.load.min.i8.( i8* <ptr>, i8 <delta> )
            +declare i16 @llvm.atomic.load.min.i16.( i16* <ptr>, i16 <delta> )
            +declare i32 @llvm.atomic.load.min.i32.( i32* <ptr>, i32 <delta> )
            +declare i64 @llvm.atomic.load.min.i64.( i64* <ptr>, i64 <delta> )
            +
            +
            + +
            +declare i8 @llvm.atomic.load.umax.i8.( i8* <ptr>, i8 <delta> )
            +declare i16 @llvm.atomic.load.umax.i16.( i16* <ptr>, i16 <delta> )
            +declare i32 @llvm.atomic.load.umax.i32.( i32* <ptr>, i32 <delta> )
            +declare i64 @llvm.atomic.load.umax.i64.( i64* <ptr>, i64 <delta> )
            +
            +
            + +
            +declare i8 @llvm.atomic.load.umin.i8.( i8* <ptr>, i8 <delta> )
            +declare i16 @llvm.atomic.load.umin.i16.( i16* <ptr>, i16 <delta> )
            +declare i32 @llvm.atomic.load.umin.i32.( i32* <ptr>, i32 <delta> )
            +declare i64 @llvm.atomic.load.umin.i64.( i64* <ptr>, i64 <delta> )
            +
            +
            +
            Overview:
            +

            + These intrinsics takes the signed or unsigned minimum or maximum of + delta and the value stored in memory at ptr. It yields the + original value at ptr. +

            +
            Arguments:
            +

            + + These intrinsics take two arguments, the first a pointer to an integer value + and the second an integer value. The result is also an integer value. These + integer types can have any bit width, but they must all have the same bit + width. The targets may only lower integer representations they support. +

            +
            Semantics:
            +

            + These intrinsics does a series of operations atomically. They first load the + value stored at ptr. They then do the signed or unsigned min or max + delta and the value, store the result to ptr. They yield + the original value stored at ptr. +

            + +
            Examples:
            +
            +%ptr      = malloc i32
            +        store i32 7, %ptr
            +%result0  = call i32 @llvm.atomic.load.min.i32( i32* %ptr, i32 -2 )
            +                                ; yields {i32}:result0 = 7
            +%result1  = call i32 @llvm.atomic.load.max.i32( i32* %ptr, i32 8 )
            +                                ; yields {i32}:result1 = -2
            +%result2  = call i32 @llvm.atomic.load.umin.i32( i32* %ptr, i32 10 )
            +                                ; yields {i32}:result2 = 8
            +%result3  = call i32 @llvm.atomic.load.umax.i32( i32* %ptr, i32 30 )
            +                                ; yields {i32}:result3 = 8
            +%memval1  = load i32* %ptr      ; yields {i32}:memval1 = 30
            +
            +
            +
            General Intrinsics Modified: llvm/branches/non-call-eh/docs/Passes.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/Passes.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/Passes.html (original) +++ llvm/branches/non-call-eh/docs/Passes.html Sun Jul 6 15:45:41 2008 @@ -116,7 +116,7 @@ -argpromotionPromote 'by reference' arguments to scalars -block-placementProfile Guided Basic Block Placement -break-crit-edgesBreak critical edges in CFG --ceeCorrelated Expression Elimination +-codegenpreparePrepare a function for code generation -condpropConditional Propagation -constmergeMerge Duplicate Global Constants -constpropSimple constant propagation @@ -142,8 +142,10 @@ -internalizeInternalize Global Symbols -ipconstpropInterprocedural constant propagation -ipsccpInterprocedural Sparse Conditional Constant Propagation +-jump-threadingThread control through conditional blocks -lcssaLoop-Closed SSA Form Pass -licmLoop Invariant Code Motion +-loop-deletionDead Loop Deletion Pass -loop-extractExtract loops into new functions -loop-extract-singleExtract at most one loop into a new function -loop-index-splitIndex Split Loops @@ -152,14 +154,12 @@ -loop-unrollUnroll loops -loop-unswitchUnswitch loops -loopsimplifyCanonicalize natural loops --lower-packedlowers packed operations to operations on smaller packed datatypes -lowerallocsLower allocations from instructions to calls --lowergcLower GC intrinsics, for GCless code generators -lowerinvokeLower invoke and unwind, for unwindless code generators --lowerselectLower select instructions to branches -lowersetjmpLower Set Jump -lowerswitchLower SwitchInst's to branches -mem2regPromote Memory to Register +-memcpyoptOptimize use of memcpy and friends -mergereturnUnify function exit nodes -predsimplifyPredicate Simplifier -prune-ehRemove unused exception handling info @@ -171,6 +171,8 @@ -simplify-libcallsSimplify well-known library calls -simplifycfgSimplify the CFG -stripStrip all symbols from a module +-strip-dead-prototypesRemove unused function declarations +-sretpromotionPromote sret arguments -tailcallelimTail Call Elimination -tailduplicateTail Duplication @@ -296,7 +298,7 @@

            @@ -305,6 +307,12 @@ lexically identical expressions. This does not require any ahead of time analysis, so it is a very fast default implementation.

            +

            + The ValueNumbering analysis passes are mostly deprecated. They are only used + by the Global Common Subexpression Elimination pass, which + is deprecated by the Global Value Numbering pass (which + does its value numbering on its own). +

            @@ -739,27 +747,12 @@
            -

            Correlated Expression Elimination propagates information from conditional - branches to blocks dominated by destinations of the branch. It propagates - information from the condition check itself into the body of the branch, - allowing transformations like these for example:

            - -
            -if (i == 7)
            -  ... 4*i;  // constant propagation
            -
            -M = i+1; N = j+1;
            -if (i == j)
            -  X = M-N;  // = M-M == 0;
            -
            - -

            This is called Correlated Expression Elimination because we eliminate or - simplify expressions that are correlated with the direction of a branch. In - this way we use static information to give us some information about the - dynamic value of a variable.

            + This pass munges the code in the input function to better prepare it for + SelectionDAG-based code generation. This works around limitations in it's + basic-block-at-a-time approach. It should eventually be removed.
            @@ -872,9 +865,13 @@

            This pass is designed to be a very quick global transformation that eliminates global common subexpressions from a function. It does this by - using an existing value numbering implementation to identify the common + using an existing value numbering analysis pass to identify the common subexpressions, eliminating them when possible.

            +

            + This pass is deprecated by the Global Value Numbering pass + (which does a better job with its own value numbering). +

            @@ -912,6 +909,10 @@ This pass performs global value numbering to eliminate fully redundant instructions. It also performs simple dead load elimination.

            +

            + Note that this pass does the value numbering itself, it does not use the + ValueNumbering analysis passes. +

            @@ -929,6 +930,10 @@ live ranges, and should be used with caution on platforms that are very sensitive to register pressure.

            +

            + Note that this pass does the value numbering itself, it does not use the + ValueNumbering analysis passes. +

            @@ -1183,6 +1188,35 @@ +
            +

            + Jump threading tries to find distinct threads of control flow running through + a basic block. This pass looks at blocks that have multiple predecessors and + multiple successors. If one or more of the predecessors of the block can be + proven to always cause a jump to one of the successors, we forward the edge + from the predecessor to the successor by duplicating the contents of this + block. +

            +

            + An example of when this can occur is code like this: +

            + +
            if () { ...
            +  X = 4;
            +}
            +if (X < 3) {
            + +

            + In this case, the unconditional branch at the end of the first if can be + revectored to the false side of the second if. +

            +
            + + +
            @@ -1246,6 +1280,18 @@ variable.
    + + +
    +

    + This file implements the Dead Loop Deletion Pass. This pass is responsible + for eliminating loops with non-infinite computable trip counts that have no + side effects or volatile instructions, and do not contribute to the + computation of the function's return value. +

    +
    @@ -1390,17 +1436,6 @@ -
    -

    - Lowers operations on vector datatypes into operations on more primitive vector - datatypes, and finally to scalar operations. -

    -
    - - -
    @@ -1417,29 +1452,6 @@ -
    -

    - This file implements lowering for the llvm.gc* intrinsics for targets - that do not natively support them (which includes the C backend). Note that - the code generated is not as efficient as it would be for targets that - natively support the GC intrinsics, but it is useful for getting new targets - up-and-running quickly. -

    - -

    - This pass implements the code transformation described in this paper: -

    - -

    - "Accurate Garbage Collection in an Uncooperative Environment" - Fergus Henderson, ISMM, 2002 -

    -
    - - -
    @@ -1481,25 +1493,6 @@ -
    -

    - Lowers select instructions into conditional branches for targets that do not - have conditional moves or that have not implemented the select instruction - yet. -

    - -

    - Note that this pass could be improved. In particular it turns every select - instruction into a new conditional branch, even though some common cases have - select instructions on the same predicate next to each other. It would be - better to use the same branch for the whole group of selects. -

    -
    - - -
    @@ -1557,6 +1550,17 @@ +
    +

    + This pass performs various transformations related to eliminating memcpy + calls, or transforming sets of stores into memset's. +

    +
    + + +
    @@ -1753,6 +1757,42 @@ +
    +

    + This pass loops over all of the functions in the input module, looking for + dead declarations and removes them. Dead declarations are declarations of + functions for which no implementation is available (i.e., declarations for + unused library functions). +

    +
    + + + +
    +

    + This pass finds functions that return a struct (using a pointer to the struct + as the first argument of the function, marked with the 'sret' attribute) and + replaces them with a new function that simply returns each of the elements of + that struct (using multiple return values). +

    + +

    + This pass works under a number of conditions: +

    + +
      +
    • The returned struct must not contain other structs
    • +
    • The returned struct must only be used to load values from
    • +
    • The placeholder struct passed in is the result of an alloca
    • +
    +
    + + +
    Modified: llvm/branches/non-call-eh/docs/ProgrammersManual.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/ProgrammersManual.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/ProgrammersManual.html (original) +++ llvm/branches/non-call-eh/docs/ProgrammersManual.html Sun Jul 6 15:45:41 2008 @@ -138,7 +138,8 @@
  • The AbstractTypeUser Class
  • -
  • The ValueSymbolTable and TypeSymbolTable classes
  • +
  • The ValueSymbolTable and TypeSymbolTable classes
  • +
  • The User and owned Use classes' memory layout
  • The Core LLVM Class Hierarchy Reference @@ -173,7 +174,8 @@ @@ -331,7 +333,7 @@
    cast<>:

    The cast<> operator is a "checked cast" operation. It - converts a pointer or reference from a base class to a derived cast, causing + converts a pointer or reference from a base class to a derived class, causing an assertion failure if it is not really an instance of the right type. This should be used in cases where you have some information that makes you believe that something is of the right type. An example of the isa<> @@ -1484,8 +1486,8 @@ #include "llvm/Support/InstIterator.h" // F is a pointer to a Function instance -for (inst_iterator i = inst_begin(F), e = inst_end(F); i != e; ++i) - llvm::cerr << *i << "\n"; +for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) + llvm::cerr << *I << "\n";

  • @@ -1497,7 +1499,10 @@
     std::set<Instruction*> worklist;
    -worklist.insert(inst_begin(F), inst_end(F));
    +// or better yet, SmallPtrSet<Instruction*, 64> worklist;
    +
    +for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I)
    +   worklist.insert(&*I);
     
    @@ -2204,7 +2209,7 @@ by most clients. It should only be used when iteration over the symbol table names themselves are required, which is very special purpose. Note that not all LLVM -Values have names, and those without names (i.e. they have +Values have names, and those without names (i.e. they have an empty name) do not exist in the symbol table.

    @@ -2220,7 +2225,230 @@ - + + + +
    +

    The +User class provides a base for expressing the ownership of User +towards other +Values. The +Use helper class is employed to do the bookkeeping and to facilitate O(1) +addition and removal.

    + + + + +
    +

    +A subclass of User can choose between incorporating its Use objects +or refer to them out-of-line by means of a pointer. A mixed variant +(some Uses inline others hung off) is impractical and breaks the invariant +that the Use objects belonging to the same User form a contiguous array. +

    +
    + +

    +We have 2 different layouts in the User (sub)classes: +

      +
    • Layout a) +The Use object(s) are inside (resp. at fixed offset) of the User +object and there are a fixed number of them.

      + +
    • Layout b) +The Use object(s) are referenced by a pointer to an +array from the User object and there may be a variable +number of them.

      +
    +

    +As of v2.4 each layout still possesses a direct pointer to the +start of the array of Uses. Though not mandatory for layout a), +we stick to this redundancy for the sake of simplicity. +The User object also stores the number of Use objects it +has. (Theoretically this information can also be calculated +given the scheme presented below.)

    +

    +Special forms of allocation operators (operator new) +enforce the following memory layouts:

    + +
      +
    • Layout a) is modelled by prepending the User object by the Use[] array.

      + +
      +...---.---.---.---.-------...
      +  | P | P | P | P | User
      +'''---'---'---'---'-------'''
      +
      + +
    • Layout b) is modelled by pointing at the Use[] array.

      +
      +.-------...
      +| User
      +'-------'''
      +    |
      +    v
      +    .---.---.---.---...
      +    | P | P | P | P |
      +    '---'---'---'---'''
      +
      +
    +(In the above figures 'P' stands for the Use** that + is stored in each Use object in the member Use::Prev) + + + + +
    +

    +Since the Use objects are deprived of the direct (back)pointer to +their User objects, there must be a fast and exact method to +recover it. This is accomplished by the following scheme:

    +
    + +A bit-encoding in the 2 LSBits (least significant bits) of the Use::Prev allows to find the +start of the User object: +
      +
    • 00 —> binary digit 0
    • +
    • 01 —> binary digit 1
    • +
    • 10 —> stop and calculate (s)
    • +
    • 11 —> full stop (S)
    • +
    +

    +Given a Use*, all we have to do is to walk till we get +a stop and we either have a User immediately behind or +we have to walk to the next stop picking up digits +and calculating the offset:

    +
    +.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.---.----------------
    +| 1 | s | 1 | 0 | 1 | 0 | s | 1 | 1 | 0 | s | 1 | 1 | s | 1 | S | User (or User*)
    +'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'---'----------------
    +    |+15                |+10            |+6         |+3     |+1
    +    |                   |               |           |       |__>
    +    |                   |               |           |__________>
    +    |                   |               |______________________>
    +    |                   |______________________________________>
    +    |__________________________________________________________>
    +
    +

    +Only the significant number of bits need to be stored between the +stops, so that the worst case is 20 memory accesses when there are +1000 Use objects associated with a User.

    + + + + +
    +

    +The following literate Haskell fragment demonstrates the concept:

    +
    + +
    +
    +> import Test.QuickCheck
    +> 
    +> digits :: Int -> [Char] -> [Char]
    +> digits 0 acc = '0' : acc
    +> digits 1 acc = '1' : acc
    +> digits n acc = digits (n `div` 2) $ digits (n `mod` 2) acc
    +> 
    +> dist :: Int -> [Char] -> [Char]
    +> dist 0 [] = ['S']
    +> dist 0 acc = acc
    +> dist 1 acc = let r = dist 0 acc in 's' : digits (length r) r
    +> dist n acc = dist (n - 1) $ dist 1 acc
    +> 
    +> takeLast n ss = reverse $ take n $ reverse ss
    +> 
    +> test = takeLast 40 $ dist 20 []
    +> 
    +
    +
    +

    +Printing <test> gives: "1s100000s11010s10100s1111s1010s110s11s1S"

    +

    +The reverse algorithm computes the length of the string just by examining +a certain prefix:

    + +
    +
    +> pref :: [Char] -> Int
    +> pref "S" = 1
    +> pref ('s':'1':rest) = decode 2 1 rest
    +> pref (_:rest) = 1 + pref rest
    +> 
    +> decode walk acc ('0':rest) = decode (walk + 1) (acc * 2) rest
    +> decode walk acc ('1':rest) = decode (walk + 1) (acc * 2 + 1) rest
    +> decode walk acc _ = walk + acc
    +> 
    +
    +
    +

    +Now, as expected, printing <pref test> gives 40.

    +

    +We can quickCheck this with following property:

    + +
    +
    +> testcase = dist 2000 []
    +> testcaseLength = length testcase
    +> 
    +> identityProp n = n > 0 && n <= testcaseLength ==> length arr == pref arr
    +>     where arr = takeLast n testcase
    +> 
    +
    +
    +

    +As expected <quickCheck identityProp> gives:

    + +
    +*Main> quickCheck identityProp
    +OK, passed 100 tests.
    +
    +

    +Let's be a bit more exhaustive:

    + +
    +
    +> 
    +> deepCheck p = check (defaultConfig { configMaxTest = 500 }) p
    +> 
    +
    +
    +

    +And here is the result of <deepCheck identityProp>:

    + +
    +*Main> deepCheck identityProp
    +OK, passed 500 tests.
    +
    + + + + +

    +To maintain the invariant that the 2 LSBits of each Use** in Use +never change after being set up, setters of Use::Prev must re-tag the +new Use** on every modification. Accordingly getters must strip the +tag bits.

    +

    +For layout b) instead of the User we find a pointer (User* with LSBit set). +Following this pointer brings us to the User. A portable trick ensures +that the first bytes of User (if interpreted as a pointer) never has +the LSBit set.

    + +
    + + @@ -3183,7 +3411,7 @@ Valid CSS! Valid HTML 4.01! + src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01 Strict"> Dinakar Dhurjati and Chris Lattner
    Modified: llvm/branches/non-call-eh/docs/ReleaseNotes.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/ReleaseNotes.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/ReleaseNotes.html (original) +++ llvm/branches/non-call-eh/docs/ReleaseNotes.html Sun Jul 6 15:45:41 2008 @@ -1,3 +1,4 @@ + @@ -12,6 +13,7 @@
    1. Introduction
    2. +
    3. Major Changes and Sub-project Status
    4. What's New?
    5. Installation Instructions
    6. Portability and Supported Platforms
    7. @@ -23,8 +25,7 @@

      Written by the LLVM Team

    -

    THIS IS A WORK IN PROGRESS FOR LLVM 2.3 (currently in -progress on SVN HEAD)

    +
    @@ -55,19 +56,18 @@

    This is the fourteenth public release of the LLVM Compiler Infrastructure. -It includes many features and refinements from LLVM 2.2.

    +It includes a large number of features and refinements from LLVM 2.2.

    -

    LLVM 2.2 was the last LLVM release to support llvm-gcc 4.0 and llvm-upgrade. -llvm-gcc 4.0 has been replaced with llvm-gcc 4.2. llvm-upgrade was useful for -upgrading llvm 1.9 files to llvm 2.x syntax, but you can always use a previous -llvm release to do this.

    +

    LLVM 2.3 no longer supports llvm-gcc 4.0, it has been replaced with + llvm-gcc 4.2.

    +

    LLVM 2.3 no longer includes the llvm-upgrade tool. It was useful + for upgrading LLVM 1.9 files to LLVM 2.x syntax, but you can always use a + previous LLVM release to do this. One nice impact of this is that the LLVM + regression test suite no longer depends on llvm-upgrade, which makes it run + faster.

    + +

    The llvm2cpp tool has been folded into llc, use + llc -march=cpp instead of llvm2cpp.

    + +

    LLVM API Changes:

    + +
      +
    • Several core LLVM IR classes have migrated to use the + 'FOOCLASS::Create(...)' pattern instead of 'new + FOOCLASS(...)' (e.g. where FOOCLASS=BasicBlock). We hope to + standardize on FOOCLASS::Create for all IR classes in the future, + but not all of them have been moved over yet.
    • +
    • LLVM 2.3 renames the LLVMBuilder and LLVMFoldingBuilder classes to + IRBuilder. +
    • +
    • MRegisterInfo was renamed to + + TargetRegisterInfo.
    • +
    • The MappedFile class is gone, please use + + MemoryBuffer instead.
    • +
    • The '-enable-eh' flag to llc has been removed. Now code should + encode whether it is safe to omit unwind information for a function by + tagging the Function object with the 'nounwind' attribute.
    • +
    • The ConstantFP::get method that uses APFloat now takes one argument + instead of two. The type argument has been removed, and the type is + now inferred from the size of the given APFloat value.
    • + +
    +

    +The core LLVM 2.3 distribution currently consists of code from the core LLVM +repository (which roughly contains the LLVM optimizer, code generators and +supporting tools) and the llvm-gcc repository. In addition to this code, the +LLVM Project includes other sub-projects that are in development. The two which +are the most actively developed are the new vmkit Project +and the Clang Project. +

    +
    + + +
    +vmkit +
    -

    LLVM 2.3 fully supports llvm-gcc 4.2 front-end.

    +
    +

    +The "vmkit" project is a new addition to the LLVM family. It is an +implementation of a JVM and a CLI Virtual Machines (Microsoft .NET is an +implementation of the CLI) using the Just-In-Time compiler of LLVM.

    + +

    The JVM, called JnJVM, executes real-world applications such as Apache +projects (e.g. Felix and Tomcat) and the SpecJVM98 benchmark. It uses the GNU +Classpath project for the base classes. The CLI implementation, called N3, is +its in early stages but can execute simple applications and the "pnetmark" +benchmark. It uses the pnetlib project as its core library.

    + +

    The 'vmkit' VMs compare in performance with industrial and top open-source +VMs on scientific applications. Besides the JIT, the VMs use many features of +the LLVM framework, including the standard set of optimizations, atomic +operations, custom function provider and memory manager for JITed methods, and +specific virtual machine optimizations. vmkit is not an official part of LLVM +2.3 release. It is publicly available under the LLVM license and can be +downloaded from: +

    -

    The clang project is an effort to build -a set of new 'llvm native' front-end technologies for the LLVM optimizer -and code generator. Currently, its C and Objective-C support is maturing -nicely, and it has advanced source-to-source analysis and transformation -capabilities. If you are interested in building source-level tools for C and -Objective-C (and eventually C++), you should take a look. However, note that -clang is not an official part of the LLVM 2.3 release. If you are interested in -this project, please see its web site.

    +
    +
    svn co http://llvm.org/svn/llvm-project/vmkit/trunk vmkit
    +
    +
    +Clang +
    + +
    + +

    The Clang project is an effort to build +a set of new 'LLVM native' front-end technologies for the LLVM optimizer +and code generator. Clang is continuing to make major strides forward in all +areas. Its C and Objective-C parsing support is very solid, and the code +generation support is far enough along to build many C applications. While not +yet production quality, it is progressing very nicely. In addition, C++ +front-end work has started to make significant progress.

    + +

    At this point, Clang is most useful if you are interested in source-to-source +transformations (such as refactoring) and other source-level tools for C and +Objective-C. Clang now also includes tools for turning C code into pretty HTML, +and includes a new static +analysis tool in development. This tool focuses on automatically finding +bugs in C and Objective-C code.

    + +
    + + + + + + +
    + +

    LLVM 2.3 includes a huge number of bug fixes, performance tweaks and minor +improvements. Some of the major improvements and new features are listed in +this section. +

    +
    + + @@ -117,10 +216,81 @@

    LLVM 2.3 includes several major new capabilities:

      +
    • The biggest change in LLVM 2.3 is Multiple Return Value (MRV) support. + MRVs allow LLVM IR to directly represent functions that return multiple + values without having to pass them "by reference" in the LLVM IR. This + allows a front-end to generate more efficient code, as MRVs are generally + returned in registers if a target supports them. See the LLVM IR Reference for more details.

      + +

      MRVs are fully supported in the LLVM IR, but are not yet fully supported in + on all targets. However, it is generally safe to return up to 2 values from + a function: most targets should be able to handle at least that. MRV + support is a critical requirement for X86-64 ABI support, as X86-64 requires + the ability to return multiple registers from functions, and we use MRVs to + accomplish this in a direct way.

    • + +
    • LLVM 2.3 includes a complete reimplementation of the "llvmc" + tool. It is designed to overcome several problems with the original + llvmc and to provide a superset of the features of the + 'gcc' driver.

      + +

      The main features of llvmc2 are: +

        +
      • Extended handling of command line options and smart rules for + dispatching them to different tools.
      • +
      • Flexible (and extensible) rules for defining different tools.
      • +
      • The different intermediate steps performed by tools are represented + as edges in the abstract graph.
      • +
      • The 'language' for driver behavior definition is tablegen and thus + it's relatively easy to add new features.
      • +
      • The definition of driver is transformed into set of C++ classes, thus + no runtime interpretation is needed.
      • +
      +
    • + +
    • LLVM 2.3 includes a completely rewritten interface for Link Time Optimization. This interface + is written in C, which allows for easier integration with C code bases, and + incorporates improvements we learned about from the first incarnation of the + interface.

    • + +
    • The Kaleidoscope tutorial now + includes a "port" of the tutorial that uses the Ocaml bindings to implement + the Kaleidoscope language.

    • + +
    + +
    + + + + + +
    + +

    LLVM 2.3 fully supports the llvm-gcc 4.2 front-end, and includes support +for the C, C++, Objective-C, Ada, and Fortran front-ends.

    + +

    +

      +
    • llvm-gcc 4.2 includes numerous fixes to better support the Objective-C +front-end. Objective-C now works very well on Mac OS/X.
    • + +
    • Fortran EQUIVALENCEs are now supported by the gfortran +front-end.
    • + +
    • llvm-gcc 4.2 includes many other fixes which improve conformance with the +relevant parts of the GCC testsuite.
    • +
    +
    LLVM Core Improvements @@ -131,13 +301,94 @@

      +
    • LLVM IR now directly represents "common" linkage, instead of representing it +as a form of weak linkage.
    • +
    • LLVM IR now has support for atomic operations, and this functionality can be +accessed through the llvm-gcc "__sync_synchronize", +"__sync_val_compare_and_swap", and related builtins. Support for +atomics are available in the Alpha, X86, X86-64, and PowerPC backends.
    • + +
    • The C and Ocaml bindings have extended to cover pass managers, several +transformation passes, iteration over the LLVM IR, target data, and parameter +attribute lists.
    + +
    + +

    In addition to a huge array of bug fixes and minor performance tweaks, the +LLVM 2.3 optimizers support a few major enhancements:

    + +
      + +
    • Loop index set splitting on by default. +This transformation hoists conditions from loop bodies and reduces a loop's +iteration space to improve performance. For example,

      + +
      +
      +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
      +
      +
      +

      +
    • + +
    • LLVM now includes a new memcpy optimization pass which removes +dead memcpy calls, unneeded copies of aggregates, and performs +return slot optimization. The LLVM optimizer now notices long sequences of +consecutive stores and merges them into memcpy's where profitable.
    • + +
    • Alignment detection for vector memory references and for memcpy and +memset is now more aggressive.
    • + +
    • The Aggressive Dead Code Elimination (ADCE) optimization has been rewritten +to make it both faster and safer in the presence of code containing infinite +loops. Some of its prior functionality has been factored out into the loop +deletion pass, which is safe for infinite loops. The new ADCE pass is +no longer based on control dependence, making it run faster.
    • + +
    • The 'SimplifyLibCalls' pass, which optimizes calls to libc and libm + functions for C-based languages, has been rewritten to be a FunctionPass + instead a ModulePass. This allows it to be run more often and to be + included at -O1 in llvm-gcc. It was also extended to include more + optimizations and several corner case bugs were fixed.
    • + +
    • LLVM now includes a simple 'Jump Threading' pass, which attempts to simplify + conditional branches using information about predecessor blocks, simplifying + the control flow graph. This pass is pretty basic at this point, but + catches some important cases and provides a foundation to build on.
    • + +
    • Several corner case bugs which could lead to deleting volatile memory + accesses have been fixed.
    • + +
    • Several optimizations have been sped up, leading to faster code generation + with the same code quality.
    • + +
    + +
    + + + @@ -148,33 +399,110 @@ faster:

      -
    • MemOperand in the code generator.
    • +
    • The code generator now has support for carrying information about memory + references throughout the entire code generation process, via the + + MachineMemOperand class. In the future this will be used to improve + both pre-pass and post-pass scheduling, and to improve compiler-debugging + output.
    • + +
    • The target-independent code generator infrastructure now uses LLVM's + APInt + class to handle integer values, which allows it to support integer types + larger than 64 bits (for example i128). Note that support for such types is + also dependent on target-specific support. Use of APInt is also a step + toward support for non-power-of-2 integer sizes.
    • + +
    • LLVM 2.3 includes several compile time speedups for code with large basic + blocks, particularly in the instruction selection phase, register + allocation, scheduling, and tail merging/jump threading.
    • + +
    • LLVM 2.3 includes several improvements which make llc's + --view-sunit-dags visualization of scheduling dependency graphs + easier to understand.
    • + +
    • The code generator allows targets to write patterns that generate subreg + references directly in .td files now.
    • + +
    • memcpy lowering in the backend is more aggressive, particularly for + memcpy calls introduced by the code generator when handling + pass-by-value structure argument copies.
    • + +
    • Inline assembly with multiple register results now returns those results + directly in the appropriate registers, rather than going through memory. + Inline assembly that uses constraints like "ir" with immediates now use the + 'i' form when possible instead of always loading the value in a register. + This saves an instruction and reduces register use.
    • + +
    • Added support for PIC/GOT style tail calls on X86/32 and initial + support for tail calls on PowerPC 32 (it may also work on PowerPC 64 but is + not thoroughly tested).
    +
    - -

    In addition to a huge array of bug fixes and minor performance tweaks, the -LLVM 2.3 optimizers support a few major enhancements:

    +

    New target-specific features include: +

      +
    • llvm-gcc's X86-64 ABI conformance is far improved, particularly in the + area of passing and returning structures by value. llvm-gcc compiled code + now interoperates very well on X86-64 systems with other compilers.
    • + +
    • Support for Win64 was added. This includes code generation itself, JIT + support, and necessary changes to llvm-gcc.
    • + +
    • The LLVM X86 backend now supports the support SSE 4.1 instruction set, and + the llvm-gcc 4.2 front-end supports the SSE 4.1 compiler builtins. Various + generic vector operations (insert/extract/shuffle) are much more efficient + when SSE 4.1 is enabled. The JIT automatically takes advantage of these + instructions, but llvm-gcc must be explicitly told to use them, e.g. with + -march=penryn.
    • + +
    • The X86 backend now does a number of optimizations that aim to avoid + converting numbers back and forth from SSE registers to the X87 floating + point stack. This is important because most X86 ABIs require return values + to be on the X87 Floating Point stack, but most CPUs prefer computation in + the SSE units.
    • + +
    • The X86 backend supports stack realignment, which is particularly useful for + vector code on OS's without 16-byte aligned stacks, such as Linux and + Windows.
    • + +
    • The X86 backend now supports the "sseregparm" options in GCC, which allow + functions to be tagged as passing floating point values in SSE + registers.
    • + +
    • Trampolines (taking the address of a nested function) now work on + Linux/X86-64.
    • + +
    • __builtin_prefetch is now compiled into the appropriate prefetch + instructions instead of being ignored.
    • -
    • Index set splitting on by default.
    • +
    • 128-bit integers are now supported on X86-64 targets. This can be used + through __attribute__((TImode)) in llvm-gcc.
    • -
    +
  • The register allocator can now rematerialize PIC-base computations, which is + an important optimization for register use.
  • -
    +
  • The "t" and "f" inline assembly constraints for the X87 floating point stack + now work. However, the "u" constraint is still not fully supported.
  • + + +
    @@ -182,10 +510,15 @@

      +
    • The LLVM C backend now supports vector code.
    • +
    • The Cell SPU backend includes a number of improvements. It generates better + code and its stability/completeness is improving.
    + +
    Other Improvements @@ -196,6 +529,10 @@

      +
    • LLVM now builds with GCC 4.3.
    • +
    • Bugpoint now supports running custom scripts (with the -run-custom + option) to determine how to execute the command and whether it is making + forward process.
    @@ -211,20 +548,19 @@

    LLVM is known to work on the following platforms:

      -
    • Intel and AMD machines running Red Hat Linux, Fedora Core and FreeBSD +
    • Intel and AMD machines (IA32) running Red Hat Linux, Fedora Core and FreeBSD (and probably other unix-like systems).
    • PowerPC and X86-based Mac OS X systems, running 10.3 and above in 32-bit and 64-bit modes.
    • Intel and AMD machines running on Win32 using MinGW libraries (native).
    • Intel and AMD machines running on Win32 with the Cygwin libraries (limited support is available for native builds with Visual C++).
    • -
    • Sun UltraSPARC workstations running Solaris 8.
    • +
    • Sun UltraSPARC workstations running Solaris 10.
    • Alpha-based machines running Debian GNU/Linux.
    • -
    • Itanium-based machines running Linux and HP-UX.
    • +
    • Itanium-based (IA64) machines running Linux and HP-UX.
    -

    The core LLVM infrastructure uses -GNU autoconf to adapt itself +

    The core LLVM infrastructure uses GNU autoconf to adapt itself to the machine and operating system on which it is built. However, minor porting may be required to get LLVM to work on new platforms. We welcome your portability patches and reports of successful builds or error messages.

    @@ -263,9 +599,8 @@
    • The MSIL, IA64, Alpha, SPU, and MIPS backends are experimental.
    • -
    • The LLC "-filetype=asm" (the default) is the only supported +
    • The llc "-filetype=asm" (the default) is the only supported value for this option.
    • -
    • The llvmc tool is not supported.
    @@ -278,13 +613,23 @@
      -
    • The X86 backend does not yet support inline - assembly that uses the X86 floating point stack.
    • -
    • The X86 backend occasionally has alignment - problems on operating systems that don't require 16-byte stack alignment - (including most non-darwin OS's like linux).
    • -
    • The X86 backend generates inefficient floating point code when configured to - generate code for systems that don't have SSE2.
    • +
    • The X86 backend does not yet support + all inline assembly that uses the X86 + floating point stack. It supports the 'f' and 't' constraints, but not + 'u'.
    • +
    • The X86 backend generates inefficient floating point code when configured + to generate code for systems that don't have SSE2.
    • +
    • Win64 code generation wasn't widely tested. Everything should work, but we + expect small issues to happen. Also, llvm-gcc cannot build mingw64 runtime + currently due + to several + bugs due to lack of support for the + 'u' inline assembly constraint and X87 floating point inline assembly.
    • +
    • The X86-64 backend does not yet support position-independent code (PIC) + generation on Linux targets.
    • +
    • The X86-64 backend does not yet support the LLVM IR instruction + va_arg. Currently, the llvm-gcc front-end supports variadic + argument constructs on X86-64 by lowering them manually.
    @@ -316,7 +661,8 @@ results (PR1388).
  • Compilation for ARM Linux OABI (old ABI) is supported, but not fully tested.
  • -
  • There is a bug in QEMU-ARM (<= 0.9.0) which causes it to incorrectly execute +
  • There is a bug in QEMU-ARM (<= 0.9.0) which causes it to incorrectly + execute programs compiled with LLVM. Please use more recent versions of QEMU.
  • @@ -359,25 +705,9 @@
      - -
    • C++ programs are likely to fail on IA64, as calls to setjmp are -made where the argument is not 16-byte aligned, as required on IA64. (Strictly -speaking this is not a bug in the IA64 back-end; it will also be encountered -when building C++ programs using the C back-end.)
    • - -
    • The C++ front-end does not use IA64 -ABI compliant layout of v-tables. In particular, it just stores function -pointers instead of function descriptors in the vtable. This bug prevents -mixing C++ code compiled with LLVM with C++ objects compiled by other C++ -compilers.
    • - -
    • There are a few ABI violations which will lead to problems when mixing LLVM -output with code built with other compilers, particularly for floating-point -programs.
    • - -
    • Defining vararg functions is not supported (but calling them is ok).
    • - -
    • The Itanium backend has bitrotted somewhat.
    • +
    • The Itanium backend is highly experimental, and has a number of known + issues. We are looking for a maintainer for the Itanium backend. If you + are interested, please contact the llvmdev mailing list.
    @@ -390,13 +720,11 @@
    @@ -405,69 +733,29 @@ - -
    Bugs
    -

    llvm-gcc does not currently support Link-Time Optimization on most platforms "out-of-the-box". Please inquire on the llvmdev mailing list if you are interested.

    -
    - - -
    - Notes -
    - -
    -
      - -
    • llvm-gcc does not support __builtin_apply yet. - See Constructing Calls: Dispatching a call to another function.

      -
    • - -
    • llvm-gcc partially supports these GCC extensions:

      -
        -
      1. Nested Functions: - - As in Algol and Pascal, lexical scoping of functions. - Nested functions are supported, but llvm-gcc does not support - taking the address of a nested function (except on X86 targets) - or non-local gotos.
      2. - -
      3. Function Attributes: - - Declaring that functions have no side effects or that they can never - return.
        - - Supported: alias, always_inline, cdecl, - const, constructor, destructor, - deprecated, fastcall, format, - format_arg, non_null, noinline, - noreturn, nothrow, pure, regparm - section, stdcall, unused, used, - visibility, warn_unused_result, weak
        - - Ignored: malloc, - no_instrument_function
      4. -
      -
    • - -
    +

    The only major language feature of GCC not supported by llvm-gcc is + the __builtin_apply family of builtins. However, some extensions + are only supported on some targets. For example, trampolines are only + supported on some targets (these are used when you take the address of a + nested function).

    -

    If you run into GCC extensions which have not been included in any of these -lists, please let us know (also including whether or not they work).

    +

    If you run into GCC extensions which are not supported, please let us know. +

    @@ -477,8 +765,9 @@ itself, Qt, Mozilla, etc.

      -
    • Exception handling only works well on the X86 and PowerPC targets. -It works well for x86-64 darwin but not x86-64 linux.
    • +
    • Exception handling works well on the X86 and PowerPC targets, including +X86-64 darwin. This works when linking to a libstdc++ compiled by GCC. It is +supported on X86-64 linux, but that is disabled by default in this release.
    @@ -486,22 +775,24 @@
    The llvm-gcc 4.2 Ada compiler works fairly well, however this is not a mature technology and problems should be expected.
      -
    • The Ada front-end currently only builds on x86-32. This is mainly due +
    • The Ada front-end currently only builds on X86-32. This is mainly due to lack of trampoline support (pointers to nested functions) on other platforms, -however it also fails to build on x86-64 +however it also fails to build on X86-64 which does support trampolines.
    • The Ada front-end fails to bootstrap. Workaround: configure with --disable-bootstrap.
    • The c380004 and c393010 ACATS tests -fail (c380004 also fails with gcc-4.2 mainline).
    • -
    • Many gcc specific Ada tests continue to crash the compiler.
    • +fail (c380004 also fails with gcc-4.2 mainline). When built at -O3, the +cxg2021 ACATS test also fails. +
    • Some gcc specific Ada tests continue to crash the compiler. The testsuite +reports most tests as having failed even though they pass.
    • The -E binder option (exception backtraces) does not work and will result in programs crashing if an exception is raised. Workaround: do not use -E.
    • @@ -509,29 +800,15 @@ or finish at a non-byte offset in a record. Workaround: do not pack records or use representation clauses that result in a field of a non-discrete type starting or finishing in the middle of a byte. -
    • The lli interpreter considers 'main' -as generated by the Ada binder to be invalid. -Workaround: hand edit the file to use pointers for argv and envp rather than -integers.
    • -
    • The -fstack-check option is ignored.
    • +
    • The lli interpreter considers +'main' as generated by the Ada binder to be invalid. +Workaround: hand edit the file to use pointers for argv and +envp rather than integers.
    • +
    • The -fstack-check option is +ignored.
    - - - -
    - - -
    - - -
    Additional Information Modified: llvm/branches/non-call-eh/docs/SourceLevelDebugging.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/SourceLevelDebugging.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/SourceLevelDebugging.html (original) +++ llvm/branches/non-call-eh/docs/SourceLevelDebugging.html Sun Jul 6 15:45:41 2008 @@ -130,7 +130,7 @@

    When a program is being debugged, a debugger interacts with the user and turns the stored debug information into source-language specific information. As such, a debugger must be aware of the source-language, and is thus tied to -a specific language of family of languages.

    +a specific language or family of languages.

    @@ -142,7 +142,7 @@

    The role of debug information is to provide meta information normally stripped away during the compilation process. This meta information provides an -llvm user a relationship between generated code and the original program source +LLVM user a relationship between generated code and the original program source code.

    Currently, debug information is consumed by the DwarfWriter to produce dwarf @@ -175,12 +175,12 @@ have been run, and without any modification to the optimizations themselves. However, some optimizations may impact the ability to modify the current state of the program with a debugger, such as setting program variables, or calling -function that have been deleted. +functions that have been deleted.

  • LLVM optimizations gracefully interact with debugging information. If they are not aware of debug information, they are automatically disabled as necessary in the cases that would invalidate the debug info. This retains the LLVM -features making it easy to write new transformations.
  • +features, making it easy to write new transformations.
  • As desired, LLVM optimizations can be upgraded to be aware of the LLVM debugging information, allowing them to update the debugging information as they Modified: llvm/branches/non-call-eh/docs/TestingGuide.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/TestingGuide.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/TestingGuide.html (original) +++ llvm/branches/non-call-eh/docs/TestingGuide.html Sun Jul 6 15:45:41 2008 @@ -2,32 +2,45 @@ "http://www.w3.org/TR/html4/strict.dtd"> - LLVM Test Suite Guide + LLVM Testing Infrastructure Guide
    - LLVM Test Suite Guide + LLVM Testing Infrastructure Guide
    1. Overview
    2. -
    3. Requirements
    4. -
    5. Quick Start
    6. -
    7. LLVM Test Suite Organization +
    8. Requirements
    9. +
    10. LLVM testing infrastructure organization
    11. -
    12. LLVM Test Suite Tree
    13. -
    14. DejaGNU Structure
    15. -
    16. llvm-test Structure
    17. -
    18. Running the LLVM Tests +
    19. Quick start +
    20. DejaGNU tests
    21. +
    22. Test suite
    23. + + +
    24. DejaGNU structure + +
    25. +
    26. Test suite structure
    27. +
    28. Running the test suite +
    29. Running the nightly tester
    @@ -43,19 +56,19 @@
    -

    This document is the reference manual for the LLVM test suite. It documents -the structure of the LLVM test suite, the tools needed to use it, and how to add -and run tests.

    +

    This document is the reference manual for the LLVM testing infrastructure. It documents +the structure of the LLVM testing infrastructure, the tools needed to use it, +and how to add and run tests.

    - +
    -

    In order to use the LLVM test suite, you will need all of the software +

    In order to use the LLVM testing infrastructure, you will need all of the software required to build LLVM, plus the following:

    @@ -101,19 +114,92 @@
    - + + + +
    + +

    The LLVM testing infrastructure contains two major categories of tests: code +fragments and whole programs. Code fragments are referred to as the "DejaGNU +tests" and are in the llvm module in subversion under the +llvm/test directory. The whole programs tests are referred to as the +"Test suite" and are in the test-suite module in subversion. +

    + +
    + + + + + +
    + +

    Code fragments are small pieces of code that test a specific feature of LLVM +or trigger a specific bug in LLVM. They are usually written in LLVM assembly +language, but can be written in other languages if the test targets a particular +language front end. These tests are driven by the DejaGNU testing framework, +which is hidden behind a few simple makefiles.

    + +

    These code fragments are not complete programs. The code generated from them is +never executed to determine correct behavior.

    + +

    These code fragment tests are located in the llvm/test +directory.

    + +

    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 +piece of LLVM assembly language code, often distilled from an actual +application or benchmark.

    + +
    + + + + + +
    + +

    The test suite contains whole programs, which are pieces of +code which can be compiled and linked into a stand-alone program that can be +executed. These programs are generally written in high level languages such as +C or C++, but sometimes they are written straight in LLVM assembly.

    + +

    These programs are compiled and then executed using several different +methods (native compiler, LLVM C backend, LLVM JIT, LLVM native code generation, +etc). The output of these programs is compared to ensure that LLVM is compiling +the program correctly.

    + +

    In addition to compiling and executing programs, whole program tests serve as +a way of benchmarking LLVM performance, both in terms of the efficiency of the +programs generated as well as the speed with which LLVM compiles, optimizes, and +generates code.

    + +

    The test-suite is located in the test-suite Subversion module.

    + +
    + + +
    -

    The tests are located in two separate Subversion modules. The basic feature - and regression tests are in the main "llvm" module under the directory - llvm/test. A more comprehensive test suite that includes whole -programs in C and C++ is in the test-suite module. This module should -be checked out to the llvm/projects directory as llvm-test (for -historical purpose). When you configure the llvm module, -the llvm-test directory will be automatically configured. +

    The tests are located in two separate Subversion modules. The + DejaGNU tests are in the main "llvm" module under the directory + llvm/test (so you get these tests for free with the main llvm tree). + The more comprehensive test suite that includes whole +programs in C and C++ is in the test-suite module. This module should +be checked out to the llvm/projects directory (don't use another name +then the default "test-suite", for then the test suite will be run every time +you run make in the main llvm directory). +When you configure the llvm module, +the test-suite directory will be automatically configured. 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:

    @@ -131,13 +217,13 @@
    -

    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 +

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

    -% gmake -C llvm/test TESTSUITE=Regression/Transforms
    +% gmake TESTSUITE=Transforms check
     
    @@ -145,95 +231,71 @@ must have run the complete testsuite before you can specify a subdirectory.

    -

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

    +

    To run only a single test, set TESTONE to its path (relative to +llvm/test) and make the check-one target:

    -% cd llvm/projects
    -% svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
    -% cd ..
    -% ./configure --with-llvmgccdir=$LLVM_GCC_DIR
    -% cd projects/llvm-test
    -% gmake
    +% gmake TESTONE=Feature/basictest.ll check-one
     
    -
  • - - - - - -
    - -

    The LLVM test suite contains two major categories of tests: code -fragments and whole programs. Code fragments are in the llvm module -under the llvm/test directory. The whole programs -test suite is in the llvm-test module under the main directory.

    - -
    - - + -
    - -

    Code fragments are small pieces of code that test a specific feature of LLVM -or trigger a specific bug in LLVM. They are usually written in LLVM assembly -language, but can be written in other languages if the test targets a particular -language front end.

    - -

    Code fragments are not complete programs, and they are never executed to -determine correct behavior.

    - -

    These code fragment tests are located in the llvm/test/Features and -llvm/test/Regression directories.

    +

    To run the comprehensive test suite (tests that compile and execute whole +programs), first checkout and setup the test-suite module:

    +
    +
    +% cd llvm/projects
    +% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
    +% cd ..
    +% ./configure --with-llvmgccdir=$LLVM_GCC_DIR
    +
    +

    where $LLVM_GCC_DIR is the directory where you installed +llvm-gcc, not it's src or obj dir.

    - - - +

    Then, run the entire test suite by running make in the test-suite +directory:

    -
    +
    +
    +% cd projects/test-suite
    +% gmake
    +
    +
    -

    Whole Programs are pieces of code which can be compiled and linked into a -stand-alone program that can be executed. These programs are generally written -in high level languages such as C or C++, but sometimes they are written -straight in LLVM assembly.

    +

    Usually, running the "nightly" set of tests is a good idea, and you can also +let it generate a report by running:

    -

    These programs are compiled and then executed using several different -methods (native compiler, LLVM C backend, LLVM JIT, LLVM native code generation, -etc). The output of these programs is compared to ensure that LLVM is compiling -the program correctly.

    - -

    In addition to compiling and executing programs, whole program tests serve as -a way of benchmarking LLVM performance, both in terms of the efficiency of the -programs generated as well as the speed with which LLVM compiles, optimizes, and -generates code.

    +
    +
    +% cd projects/test-suite
    +% gmake TEST=nightly report report.html
    +
    +
    -

    All "whole program" tests are located in the test-suite Subversion -module.

    +

    Any of the above commands can also be run in a subdirectory of +projects/test-suite to run the specified test only on the programs in +that subdirectory.

    - + -
    +

    The LLVM DejaGNU tests are driven by DejaGNU together with GNU Make and are + located in the llvm/test directory. -

    Each type of test in the LLVM test suite has its own directory. The major -subtrees of the test suite directory tree are as follows:

    - -
      -
    • llvm/test

      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:

      +
      • Analysis: checks Analysis passes.
      • Archive: checks the Archive library.
      • @@ -246,55 +308,13 @@ 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 - piece of LLVM assembly language code, often distilled from an actual - application or benchmark.

    • - -
    • test-suite -

      The test-suite module contains programs that can be compiled -with LLVM and executed. These programs are compiled using the native compiler -and various LLVM backends. The output from the program compiled with the -native compiler is assumed correct; the results from the other programs are -compared to the native program output and pass if they match.

      - -

      In addition for testing correctness, the llvm-test directory also -performs timing tests of various LLVM optimizations. It also records -compilation times for the compilers and the JIT. This information can be -used to compare the effectiveness of LLVM's optimizations and code -generation.

    • - -
    • llvm-test/SingleSource -

      The SingleSource directory contains test programs that are only a single -source file in size. These are usually small benchmark programs or small -programs that calculate a particular value. Several such programs are grouped -together in each directory.

    • - -
    • llvm-test/MultiSource -

      The MultiSource directory contains subdirectories which contain entire -programs with multiple source files. Large benchmarks and whole applications -go here.

    • - -
    • llvm-test/External -

      The External directory contains Makefiles for building code that is external -to (i.e., not distributed with) LLVM. The most prominent members of this -directory are the SPEC 95 and SPEC 2000 benchmark suites. The presence and -location of these external programs is configured by the llvm-test -configure script.

    • - -
    - - - -
    -

    The LLVM test suite is partially driven by DejaGNU and partially driven by - GNU Make. Specifically, the Features and Regression tests are all driven by - DejaGNU. The llvm-test module is currently driven by a set of - Makefiles.

    + + + +

    The DejaGNU structure is very simple, but does require some information to be set. This information is gathered via configure and is written to a file, site.exp in llvm/test. The llvm/test @@ -303,7 +323,9 @@

    In order for DejaGNU to work, each directory of tests must have a dg.exp file. DejaGNU looks for this file to determine how to run the tests. This file is just a Tcl script and it can do anything you want, but - we've standardized it for the LLVM regression tests. It simply loads a Tcl + we've standardized it for the LLVM regression tests. If you're adding a + directory of tests, just copy dg.exp from another directory to get + running. The standard dg.exp simply loads a Tcl library (test/lib/llvm.exp) and calls the llvm_runtests function defined in that library with a list of file names to run. The names are obtained by using Tcl's glob command. Any directory that contains only @@ -332,7 +354,7 @@ line to be concatenated with the next one. In this way you can build up long pipelines of commands without making huge line lengths. The lines ending in \ are concatenated until a RUN line that doesn't end in \ is - found. This concatenated set or RUN lines then constitutes one execution. + found. This concatenated set of RUN lines then constitutes one execution. Tcl will substitute variables and arrange for the pipeline to be executed. If any process in the pipeline fails, the entire line (and test case) fails too.

    @@ -432,7 +454,8 @@
    - + +

    With a RUN line there are a number of substitutions that are permitted. In general, any Tcl variable that is available in the substitute @@ -541,9 +564,12 @@

    +

    To make RUN line writing easier, there are several shell scripts located - in the llvm/test/Scripts directory. For example:

    + in the llvm/test/Scripts directory. This directory is in the PATH + when running tests, so you can just call these scripts using their name. For + example:

    ignore
    This script runs its arguments and then always returns 0. This is useful @@ -583,7 +609,7 @@

    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 PR[0-9]+. This is the syntax for specifying a PR (Problem Report) number that - is related to the test case. The numer after "PR" specifies the LLVM bugzilla + is related to the test case. The number after "PR" specifies the LLVM bugzilla number. When a PR number is specified, it will be used in the pass/fail reporting. This is useful to quickly get some context when a test fails.

    @@ -597,66 +623,75 @@
    -
    llvm-test +
    -

    As mentioned previously, the llvm-test module provides three types -of tests: MultiSource, SingleSource, and External. Each tree is then subdivided -into several categories, including applications, benchmarks, regression tests, -code that is strange grammatically, etc. These organizations should be -relatively self explanatory.

    +

    The test-suite module contains a number of programs that can be compiled +with LLVM and executed. These programs are compiled using the native compiler +and various LLVM backends. The output from the program compiled with the +native compiler is assumed correct; the results from the other programs are +compared to the native program output and pass if they match.

    -

    In addition to the regular "whole program" tests, the llvm-test -module also provides a mechanism for compiling the programs in different ways. -If the variable TEST is defined on the gmake command line, the test system will -include a Makefile named TEST.<value of TEST variable>.Makefile. -This Makefile can modify build rules to yield different results.

    +

    When executing tests, it is usually a good idea to start out with a subset of +the available tests or programs. This makes test run times smaller at first and +later on this is useful to investigate individual test failures. To run some +test only on a subset of programs, simply change directory to the programs you +want tested and run gmake there. Alternatively, you can run a different +test using the TEST variable to change what tests or run on the +selected programs (see below for more info).

    -

    For example, the LLVM nightly tester uses TEST.nightly.Makefile to -create the nightly test reports. To run the nightly tests, run gmake -TEST=nightly.

    +

    In addition for testing correctness, the llvm-test directory also +performs timing tests of various LLVM optimizations. It also records +compilation times for the compilers and the JIT. This information can be +used to compare the effectiveness of LLVM's optimizations and code +generation.

    -

    There are several TEST Makefiles available in the tree. Some of them are -designed for internal LLVM research and will not work outside of the LLVM -research group. They may still be valuable, however, as a guide to writing your -own TEST Makefile for any optimization or analysis passes that you develop with -LLVM.

    +

    llvm-test tests are divided into three types of tests: MultiSource, +SingleSource, and External.

    -

    Note, when configuring the llvm-test module, you might want to -specify the following configuration options:

    -
    -
    --enable-spec2000 -
    --enable-spec2000=<directory> -
    - Enable the use of SPEC2000 when testing LLVM. This is disabled by default - (unless configure finds SPEC2000 installed). By specifying - directory, you can tell configure where to find the SPEC2000 - benchmarks. If directory is left unspecified, configure - uses the default value - /home/vadve/shared/benchmarks/speccpu2000/benchspec. -

    +

      +
    • llvm-test/SingleSource +

      The SingleSource directory contains test programs that are only a single +source file in size. These are usually small benchmark programs or small +programs that calculate a particular value. Several such programs are grouped +together in each directory.

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

      +

    • llvm-test/MultiSource +

      The MultiSource directory contains subdirectories which contain entire +programs with multiple source files. Large benchmarks and whole applications +go here.

    • + +
    • llvm-test/External +

      The External directory contains Makefiles for building code that is external +to (i.e., not distributed with) LLVM. The most prominent members of this +directory are the SPEC 95 and SPEC 2000 benchmark suites. The External +directory does not contain these actual tests,but only the Makefiles that know +how to properly compile these programs from somewhere else. The presence and +location of these external programs is configured by the llvm-test +configure script.

    • +
    + +

    Each tree is then subdivided into several categories, including applications, +benchmarks, regression tests, code that is strange grammatically, etc. These +organizations should be relatively self explanatory.

    + +

    Some tests are known to fail. Some are bugs that we have not fixed yet; +others are features that we haven't added yet (or may never add). In DejaGNU, +the result for such tests will be XFAIL (eXpected FAILure). In this way, you +can tell the difference between an expected and unexpected failure.

    + +

    The tests in the test suite have no such feature at this time. If the +test passes, only warnings and other miscellaneous output will be generated. If +a test fails, a large <program> FAILED message will be displayed. This +will help you separate benign warnings from actual test failures.

    -
    --enable-povray -
    --enable-povray=<directory> -
    - Enable the use of Povray as an external test. Versions of Povray written - in C should work. This option is similar to the --enable-spec2000 - option. -
    - +
    @@ -665,22 +700,7 @@ 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.

    - -

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

    - -

    For example, to run the Regression tests, type -gmake TESTSUITE=Regression in llvm/tests.

    - -

    Note that there are no Makefiles in llvm/test/Features and -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 test suite, you need to use the following steps:

    1. cd into the llvm/projects directory
    2. @@ -689,70 +709,130 @@
      -% svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
      +% svn co http://llvm.org/svn/llvm-project/test-suite/trunk test-suite
       

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

      -
    3. Configure the test suite using llvm configure. This will automatically configure llvm-test. - You must do it from the top level otherwise llvm-gcc will not be set which is required to - run llvm-test:

      +
    4. Configure the test suite using llvm configure. This will automatically + configure test-suite. You must do it from the top level otherwise llvm-gcc + will not be set which is required to run llvm-test:

       % cd $LLVM_OBJ_ROOT ; $LLVM_SRC_ROOT/configure --with-llvmgccdir=$LLVM_GCC_DIR
       
      -
    5. gmake
    6. +

      Note that that $LLVM_GCC_DIR is the directory where you + installed llvm-gcc, not its src or obj directory.

      + + +
    7. Change back to the llvm/projects/test-suite directory you created before + and run gmake (or just "make" on systems where GNU make is + the default, such as linux.

    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). $LLVM_GCC_DIR is the path to the LLVM -C/C++ FrontEnd

    +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
    -
    -
    +
    +

    Note, when configuring the test-suite module, you might want to +specify the following configuration options:

    +
    +
    --enable-spec2000 +
    --enable-spec2000=<directory> +
    + Enable the use of SPEC2000 when testing LLVM. This is disabled by default + (unless configure finds SPEC2000 installed). By specifying + directory, you can tell configure where to find the SPEC2000 + benchmarks. If directory is left unspecified, configure + uses the default value + /home/vadve/shared/benchmarks/speccpu2000/benchspec. +

    -

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

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

    -

    -
    -% cd llvm/projects/llvm-test
    -% gmake TEST=nightly test
    -
    +
    --enable-povray +
    --enable-povray=<directory> +
    + Enable the use of Povray as an external test. Versions of Povray written + in C should work. This option is similar to the --enable-spec2000 + option. +
    -

    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 -choose.

    + + + +
    +

    In addition to the regular "whole program" tests, the test-suite +module also provides a mechanism for compiling the programs in different ways. +If the variable TEST is defined on the gmake command line, the test system will +include a Makefile named TEST.<value of TEST variable>.Makefile. +This Makefile can modify build rules to yield different results.

    -

    Some tests are known to fail. Some are bugs that we have not fixed yet; -others are features that we haven't added yet (or may never add). In DejaGNU, -the result for such tests will be XFAIL (eXpected FAILure). In this way, you -can tell the difference between an expected and unexpected failure.

    +

    For example, the LLVM nightly tester uses TEST.nightly.Makefile to +create the nightly test reports. To run the nightly tests, run gmake +TEST=nightly.

    -

    The tests in llvm-test have no such feature at this time. If the -test passes, only warnings and other miscellaneous output will be generated. If -a test fails, a large <program> FAILED message will be displayed. This -will help you separate benign warnings from actual test failures.

    +

    There are several TEST Makefiles available in the tree. Some of them are +designed for internal LLVM research and will not work outside of the LLVM +research group. They may still be valuable, however, as a guide to writing your +own TEST Makefile for any optimization or analysis passes that you develop with +LLVM.

    + +
    + + + +
    +

    There are a number of ways to run the tests and generate output. The most + simple one is simply running gmake with no arguments. This will + compile and run all programs in the tree using a number of different methods + and compare results. Any failures are reported in the output, but are likely + drowned in the other output. Passes are not reported explicitely.

    + +

    Somewhat better is running gmake TEST=sometest test, which runs + the specified test and usually adds per-program summaries to the output + (depending on which sometest you use). For example, the nightly test + explicitely outputs TEST-PASS or TEST-FAIL for every test after each program. + Though these lines are still drowned in the output, it's easy to grep the + output logs in the Output directories.

    + +

    Even better are the report and report.format targets + (where format is one of html, csv, text or + graphs). The exact contents of the report are dependent on which + TEST you are running, but the text results are always shown at the + end of the run and the results are always stored in the + report.<type>.format file (when running with + TEST=<type>). + + The report also generate a file called + report.<type>.raw.out containing the output of the entire test + run.

    +Writing custom tests for the test suite
    -

    Assuming you can run llvm-test, (e.g. "gmake TEST=nightly report" +

    Assuming you can run the test suite, (e.g. "gmake TEST=nightly report" should work), it is really easy to run optimizations or code generator components against every program in the tree, collecting statistics or running custom checks for correctness. At base, this is how the nightly tester works, @@ -765,10 +845,10 @@

    Following this, you can set up a test and a report that collects these and formats them for easy viewing. This consists of two files, an -"llvm-test/TEST.XXX.Makefile" fragment (where XXX is the name of your +"test-suite/TEST.XXX.Makefile" fragment (where XXX is the name of your test) and an "llvm-test/TEST.XXX.report" file that indicates how to format the output into a table. There are many example reports of various -levels of sophistication included with llvm-test, and the framework is very +levels of sophistication included with the test suite, and the framework is very general.

    If you are interested in testing an optimization pass, check out the @@ -776,7 +856,7 @@

    -% cd llvm/projects/llvm-test/MultiSource/Benchmarks  # or some other level
    +% cd llvm/projects/test-suite/MultiSource/Benchmarks  # or some other level
     % make TEST=libcalls report
     
    @@ -807,7 +887,7 @@ You can also use the "TEST=libcalls report.html" target to get the table in HTML form, similarly for report.csv and report.tex.

    -

    The source for this is in llvm-test/TEST.libcalls.*. The format is pretty +

    The source for this is in test-suite/TEST.libcalls.*. The format is pretty simple: the Makefile indicates how to run the test (in this case, "opt -simplify-libcalls -stats"), and the report contains one line for each column of the output. The first value is the header for the column and the @@ -826,7 +906,7 @@

    The LLVM Nightly Testers automatically check out an LLVM tree, build it, run the "nightly" -program test (described above), run all of the feature and regression tests, +program test (described above), run all of the DejaGNU tests, delete the checked out tree, and then submit the results to http://llvm.org/nightlytest/. After test results are submitted to @@ -884,10 +964,10 @@ Valid CSS! Valid HTML 4.01! + src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"> John T. Criswell, Reid Spencer, and Tanya Lattner
    - The LLVM Compiler Infrastructure
    + The LLVM Compiler Infrastructure
    Last modified: $Date$ Modified: llvm/branches/non-call-eh/docs/index.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/index.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/index.html (original) +++ llvm/branches/non-call-eh/docs/index.html Sun Jul 6 15:45:41 2008 @@ -105,8 +105,8 @@ Instructions for properly submitting information about any bugs you run into in the LLVM system. -

  • LLVM Test Suite Guide - A reference -manual for using the LLVM test suite.
  • +
  • LLVM Testing Infrastructure Guide - A reference +manual for using the LLVM testing infrastructure.
  • How to build the C/C++ front-end - Instructions for building the front-end from source.
  • Modified: llvm/branches/non-call-eh/docs/tutorial/JITTutorial1.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/tutorial/JITTutorial1.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/tutorial/JITTutorial1.html (original) +++ llvm/branches/non-call-eh/docs/tutorial/JITTutorial1.html Sun Jul 6 15:45:41 2008 @@ -48,7 +48,7 @@
    -

    If you're unsure what the above code says, skim through the LLVM Language Reference Manual and convince yourself that the above LLVM IR is actually equivalent to the original function. Once you???re satisfied with that, let???s move on to actually generating it programmatically!

    +

    If you're unsure what the above code says, skim through the LLVM Language Reference Manual and convince yourself that the above LLVM IR is actually equivalent to the original function. Once you???re satisfied with that, let's move on to actually generating it programmatically!

    Of course, before we can start, we need to #include the appropriate LLVM header files:

    @@ -64,7 +64,7 @@
    -

    Now, let???s get started on our real program. Here???s what our basic main() will look like:

    +

    Now, let's get started on our real program. Here's what our basic main() will look like:

    @@ -81,6 +81,7 @@
       PM.add(new PrintModulePass(&llvm::cout));
       PM.run(*Mod);
     
    +  delete Mod;
       return 0;
     }
     
    @@ -88,11 +89,18 @@

    The first segment is pretty simple: it creates an LLVM ???module.??? In LLVM, a module represents a single unit of code that is to be processed together. A module contains things like global variables, function declarations, and implementations. Here we???ve declared a makeLLVMModule() function to do the real work of creating the module. Don???t worry, we???ll be looking at that one next!

    -

    The second segment runs the LLVM module verifier on our newly created module. While this probably isn???t really necessary for a simple module like this one, it???s always a good idea, especially if you???re generating LLVM IR based on some input. The verifier will print an error message if your LLVM module is malformed in any way.

    +

    The second segment runs the LLVM module verifier on our newly created module. While this probably isn???t really necessary for a simple module like this one, it's always a good idea, especially if you???re generating LLVM IR based on some input. The verifier will print an error message if your LLVM module is malformed in any way.

    -

    Finally, we instantiate an LLVM PassManager and run the PrintModulePass on our module. LLVM uses an explicit pass infrastructure to manage optimizations and various other things. A PassManager, as should be obvious from its name, manages passes: it is responsible for scheduling them, invoking them, and insuring the proper disposal after we???re done with them. For this example, we???re just using a trivial pass that prints out our module in textual form.

    +

    Finally, we instantiate an LLVM PassManager and run +the PrintModulePass on our module. LLVM uses an explicit pass +infrastructure to manage optimizations and various other things. +A PassManager, as should be obvious from its name, manages passes: +it is responsible for scheduling them, invoking them, and ensuring the proper +disposal after we???re done with them. For this example, we???re just using a +trivial pass that prints out our module in textual form.

    -

    Now onto the interesting part: creating and populating a module. Here???s the first chunk of our makeLLVMModule():

    +

    Now onto the interesting part: creating and populating a module. Here's the +first chunk of our makeLLVMModule():

    @@ -122,7 +130,9 @@
     
     

    You'll notice that getOrInsertFunction() doesn't actually return a Function*. This is because getOrInsertFunction() will return a cast of the existing function if the function already existed with a different prototype. Since we know that there's not already a mul_add function, we can safely just cast c to a Function*. -

    In addition, we set the calling convention for our new function to be the C calling convention. This isn???t strictly necessary, but it insures that our new function will interoperate properly with C code, which is a good thing.

    +

    In addition, we set the calling convention for our new function to be the C +calling convention. This isn???t strictly necessary, but it ensures that our new +function will interoperate properly with C code, which is a good thing.

    @@ -136,7 +146,7 @@
     
    -

    While we???re setting up our function, let???s also give names to the parameters. This also isn???t strictly necessary (LLVM will generate names for them if you don???t specify them), but it???ll make looking at our output somewhat more pleasant. To name the parameters, we iterate over the arguments of our function and call setName() on them. We???ll also keep the pointer to x, y, and z around, since we???ll need them when we get around to creating instructions.

    +

    While we???re setting up our function, let's also give names to the parameters. This also isn???t strictly necessary (LLVM will generate names for them if you don???t specify them), but it???ll make looking at our output somewhat more pleasant. To name the parameters, we iterate over the arguments of our function and call setName() on them. We???ll also keep the pointer to x, y, and z around, since we???ll need them when we get around to creating instructions.

    Great! We have a function now. But what good is a function if it has no body? Before we start working on a body for our new function, we need to recall some details of the LLVM IR. The IR, being an abstract assembly language, represents control flow using jumps (we call them branches), both conditional and unconditional. The straight-line sequences of code between branches are called basic blocks, or just blocks. To create a body for our function, we fill it with blocks:

    @@ -152,7 +162,7 @@
       Value* tmp = builder.CreateBinOp(Instruction::Mul,
    -                                    x, y, "tmp");
    +                                   x, y, "tmp");
       Value* tmp2 = builder.CreateBinOp(Instruction::Add,
                                         tmp, z, "tmp2");
     
    @@ -163,9 +173,9 @@
     
    -

    The final step in creating our function is to create the instructions that make it up. Our mul_add function is composed of just three instructions: a multiply, an add, and a return. IRBuilder gives us a simple interface for constructing these instructions and appending them to the ???entry??? block. Each of the calls to IRBuilder returns a Value* that represents the value yielded by the instruction. You???ll also notice that, above, x, y, and z are also Value*???s, so it???s clear that instructions operate on Value*???s.

    +

    The final step in creating our function is to create the instructions that make it up. Our mul_add function is composed of just three instructions: a multiply, an add, and a return. IRBuilder gives us a simple interface for constructing these instructions and appending them to the ???entry??? block. Each of the calls to IRBuilder returns a Value* that represents the value yielded by the instruction. You???ll also notice that, above, x, y, and z are also Value*'s, so it's clear that instructions operate on Value*'s.

    -

    And that???s it! Now you can compile and run your code, and get a wonderful textual print out of the LLVM IR we saw at the beginning. To compile, use the following command line as a guide:

    +

    And that's it! Now you can compile and run your code, and get a wonderful textual print out of the LLVM IR we saw at the beginning. To compile, use the following command line as a guide:

    
    Modified: llvm/branches/non-call-eh/docs/tutorial/JITTutorial2.html
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/tutorial/JITTutorial2.html?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/docs/tutorial/JITTutorial2.html (original)
    +++ llvm/branches/non-call-eh/docs/tutorial/JITTutorial2.html Sun Jul  6 15:45:41 2008
    @@ -70,7 +70,8 @@
       PassManager PM;
       PM.add(new PrintModulePass(&llvm::cout));
       PM.run(*Mod);
    -  
    +
    +  delete Mod;  
       return 0;
     }
     
    @@ -125,7 +126,15 @@
     
    -

    cond_false is a more interesting block: we now know that x != y, so we must branch again to determine which of x and y is larger. This is achieved using the ICmpULT instruction, which stands for integer comparison for unsigned less-than. In LLVM, integer types do not carry sign; a 32-bit integer pseudo-register can interpreted as signed or unsigned without casting. Whether a signed or unsigned interpretation is desired is specified in the instruction. This is why several instructions in the LLVM IR, such as integer less-than, include a specifier for signed or unsigned.

    +

    cond_false is a more interesting block: we now know that x +!= y, so we must branch again to determine which of x +and y is larger. This is achieved using the ICmpULT +instruction, which stands for integer comparison for unsigned +less-than. In LLVM, integer types do not carry sign; a 32-bit integer +pseudo-register can be interpreted as signed or unsigned without casting. +Whether a signed or unsigned interpretation is desired is specified in the +instruction. This is why several instructions in the LLVM IR, such as integer +less-than, include a specifier for signed or unsigned.

    Also note that we're again making use of LLVM's automatic name uniquing, this time at a register level. We've deliberately chosen to name every instruction "tmp" to illustrate that LLVM will give them all unique names without getting confused.

    Modified: llvm/branches/non-call-eh/docs/tutorial/LangImpl3.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/tutorial/LangImpl3.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/tutorial/LangImpl3.html (original) +++ llvm/branches/non-call-eh/docs/tutorial/LangImpl3.html Sun Jul 6 15:45:41 2008 @@ -48,7 +48,11 @@

    Please note: the code in this chapter and later require LLVM 2.2 or -LLVM SVN to work. LLVM 2.1 and before will not work with it.

    +later. LLVM 2.1 and before will not work with it. Also note that you need +to use a version of this tutorial that matches your LLVM release: If you are +using an official LLVM release, use the version of the documentation included +with your release or on the llvm.org +releases page.

    @@ -155,7 +159,7 @@
     Value *NumberExprAST::Codegen() {
    -  return ConstantFP::get(Type::DoubleTy, APFloat(Val));
    +  return ConstantFP::get(APFloat(Val));
     }
     
    @@ -166,7 +170,7 @@ constants of Arbitrary Precision). This code basically just creates and returns a ConstantFP. Note that in the LLVM IR that constants are all uniqued together and shared. For this reason, the API -uses "the foo::get(..)" idiom instead of "new foo(..)" or "foo::create(..)".

    +uses "the foo::get(..)" idiom instead of "new foo(..)" or "foo::Create(..)".

    @@ -1029,7 +1033,7 @@
     Value *ErrorV(const char *Str) { Error(Str); return 0; }
     
     Value *NumberExprAST::Codegen() {
    -  return ConstantFP::get(Type::DoubleTy, APFloat(Val));
    +  return ConstantFP::get(APFloat(Val));
     }
     
     Value *VariableExprAST::Codegen() {
    
    Modified: llvm/branches/non-call-eh/docs/tutorial/LangImpl4.html
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/tutorial/LangImpl4.html?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/docs/tutorial/LangImpl4.html (original)
    +++ llvm/branches/non-call-eh/docs/tutorial/LangImpl4.html Sun Jul  6 15:45:41 2008
    @@ -863,7 +863,7 @@
     Value *ErrorV(const char *Str) { Error(Str); return 0; }
     
     Value *NumberExprAST::Codegen() {
    -  return ConstantFP::get(Type::DoubleTy, APFloat(Val));
    +  return ConstantFP::get(APFloat(Val));
     }
     
     Value *VariableExprAST::Codegen() {
    
    Modified: llvm/branches/non-call-eh/docs/tutorial/LangImpl5.html
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/tutorial/LangImpl5.html?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/docs/tutorial/LangImpl5.html (original)
    +++ llvm/branches/non-call-eh/docs/tutorial/LangImpl5.html Sun Jul  6 15:45:41 2008
    @@ -364,7 +364,7 @@
       
       // Convert condition to a bool by comparing equal to 0.0.
       CondV = Builder.CreateFCmpONE(CondV, 
    -                                ConstantFP::get(Type::DoubleTy, APFloat(0.0)),
    +                                ConstantFP::get(APFloat(0.0)),
                                     "ifcond");
     
    @@ -796,7 +796,7 @@ if (StepVal == 0) return 0; } else { // If not specified, use 1.0. - StepVal = ConstantFP::get(Type::DoubleTy, APFloat(1.0)); + StepVal = ConstantFP::get(APFloat(1.0)); } Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar"); @@ -815,7 +815,7 @@ // Convert condition to a bool by comparing equal to 0.0. EndCond = Builder.CreateFCmpONE(EndCond, - ConstantFP::get(Type::DoubleTy, APFloat(0.0)), + ConstantFP::get(APFloat(0.0)), "loopcond");
    @@ -1359,7 +1359,7 @@ Value *ErrorV(const char *Str) { Error(Str); return 0; } Value *NumberExprAST::Codegen() { - return ConstantFP::get(Type::DoubleTy, APFloat(Val)); + return ConstantFP::get(APFloat(Val)); } Value *VariableExprAST::Codegen() { @@ -1410,7 +1410,7 @@ // Convert condition to a bool by comparing equal to 0.0. CondV = Builder.CreateFCmpONE(CondV, - ConstantFP::get(Type::DoubleTy, APFloat(0.0)), + ConstantFP::get(APFloat(0.0)), "ifcond"); Function *TheFunction = Builder.GetInsertBlock()->getParent(); @@ -1509,7 +1509,7 @@ if (StepVal == 0) return 0; } else { // If not specified, use 1.0. - StepVal = ConstantFP::get(Type::DoubleTy, APFloat(1.0)); + StepVal = ConstantFP::get(APFloat(1.0)); } Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar"); @@ -1520,7 +1520,7 @@ // Convert condition to a bool by comparing equal to 0.0. EndCond = Builder.CreateFCmpONE(EndCond, - ConstantFP::get(Type::DoubleTy, APFloat(0.0)), + ConstantFP::get(APFloat(0.0)), "loopcond"); // Create the "after loop" block and insert it. Modified: llvm/branches/non-call-eh/docs/tutorial/LangImpl6.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/tutorial/LangImpl6.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/tutorial/LangImpl6.html (original) +++ llvm/branches/non-call-eh/docs/tutorial/LangImpl6.html Sun Jul 6 15:45:41 2008 @@ -1364,7 +1364,7 @@ Value *ErrorV(const char *Str) { Error(Str); return 0; } Value *NumberExprAST::Codegen() { - return ConstantFP::get(Type::DoubleTy, APFloat(Val)); + return ConstantFP::get(APFloat(Val)); } Value *VariableExprAST::Codegen() { @@ -1435,7 +1435,7 @@ // Convert condition to a bool by comparing equal to 0.0. CondV = Builder.CreateFCmpONE(CondV, - ConstantFP::get(Type::DoubleTy, APFloat(0.0)), + ConstantFP::get(APFloat(0.0)), "ifcond"); Function *TheFunction = Builder.GetInsertBlock()->getParent(); @@ -1534,7 +1534,7 @@ if (StepVal == 0) return 0; } else { // If not specified, use 1.0. - StepVal = ConstantFP::get(Type::DoubleTy, APFloat(1.0)); + StepVal = ConstantFP::get(APFloat(1.0)); } Value *NextVar = Builder.CreateAdd(Variable, StepVal, "nextvar"); @@ -1545,7 +1545,7 @@ // Convert condition to a bool by comparing equal to 0.0. EndCond = Builder.CreateFCmpONE(EndCond, - ConstantFP::get(Type::DoubleTy, APFloat(0.0)), + ConstantFP::get(APFloat(0.0)), "loopcond"); // Create the "after loop" block and insert it. Modified: llvm/branches/non-call-eh/docs/tutorial/LangImpl7.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/tutorial/LangImpl7.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/tutorial/LangImpl7.html (original) +++ llvm/branches/non-call-eh/docs/tutorial/LangImpl7.html Sun Jul 6 15:45:41 2008 @@ -923,7 +923,7 @@ InitVal = Init->Codegen(); if (InitVal == 0) return 0; } else { // If not specified, use 0.0. - InitVal = ConstantFP::get(Type::DoubleTy, APFloat(0.0)); + InitVal = ConstantFP::get(APFloat(0.0)); } AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName); @@ -1622,7 +1622,7 @@ Value *NumberExprAST::Codegen() { - return ConstantFP::get(Type::DoubleTy, APFloat(Val)); + return ConstantFP::get(APFloat(Val)); } Value *VariableExprAST::Codegen() { @@ -1715,7 +1715,7 @@ // Convert condition to a bool by comparing equal to 0.0. CondV = Builder.CreateFCmpONE(CondV, - ConstantFP::get(Type::DoubleTy, APFloat(0.0)), + ConstantFP::get(APFloat(0.0)), "ifcond"); Function *TheFunction = Builder.GetInsertBlock()->getParent(); @@ -1821,7 +1821,7 @@ if (StepVal == 0) return 0; } else { // If not specified, use 1.0. - StepVal = ConstantFP::get(Type::DoubleTy, APFloat(1.0)); + StepVal = ConstantFP::get(APFloat(1.0)); } // Compute the end condition. @@ -1836,7 +1836,7 @@ // Convert condition to a bool by comparing equal to 0.0. EndCond = Builder.CreateFCmpONE(EndCond, - ConstantFP::get(Type::DoubleTy, APFloat(0.0)), + ConstantFP::get(APFloat(0.0)), "loopcond"); // Create the "after loop" block and insert it. @@ -1880,7 +1880,7 @@ InitVal = Init->Codegen(); if (InitVal == 0) return 0; } else { // If not specified, use 0.0. - InitVal = ConstantFP::get(Type::DoubleTy, APFloat(0.0)); + InitVal = ConstantFP::get(APFloat(0.0)); } AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName); Modified: llvm/branches/non-call-eh/docs/tutorial/OCamlLangImpl3.html URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/docs/tutorial/OCamlLangImpl3.html?rev=53163&r1=53162&r2=53163&view=diff ============================================================================== --- llvm/branches/non-call-eh/docs/tutorial/OCamlLangImpl3.html (original) +++ llvm/branches/non-call-eh/docs/tutorial/OCamlLangImpl3.html Sun Jul 6 15:45:41 2008 @@ -148,7 +148,7 @@ constants of Arbitrary Precision). This code basically just creates and returns a ConstantFP. Note that in the LLVM IR that constants are all uniqued together and shared. For this reason, the API -uses "the foo::get(..)" idiom instead of "new foo(..)" or "foo::create(..)".

    +uses "the foo::get(..)" idiom instead of "new foo(..)" or "foo::Create(..)".

    
    Modified: llvm/branches/non-call-eh/examples/BrainF/BrainF.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/examples/BrainF/BrainF.cpp?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/examples/BrainF/BrainF.cpp (original)
    +++ llvm/branches/non-call-eh/examples/BrainF/BrainF.cpp Sun Jul  6 15:45:41 2008
    @@ -278,9 +278,10 @@
               BasicBlock *bb_1 = BasicBlock::Create(label, brainf_func);
               builder->SetInsertPoint(bb_1);
     
    -          //Make part of PHI instruction now, wait until end of loop to finish
    -          PHINode *phi_0 = PHINode::Create(PointerType::getUnqual(IntegerType::Int8Ty),
    -                                       headreg, testbb);
    +          // Make part of PHI instruction now, wait until end of loop to finish
    +          PHINode *phi_0 =
    +            PHINode::Create(PointerType::getUnqual(IntegerType::Int8Ty),
    +                            headreg, testbb);
               phi_0->reserveOperandSpace(2);
               phi_0->addIncoming(curhead, bb_0);
               curhead = phi_0;
    
    Modified: llvm/branches/non-call-eh/examples/Fibonacci/fibonacci.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/examples/Fibonacci/fibonacci.cpp?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/examples/Fibonacci/fibonacci.cpp (original)
    +++ llvm/branches/non-call-eh/examples/Fibonacci/fibonacci.cpp Sun Jul  6 15:45:41 2008
    @@ -66,18 +66,18 @@
       ReturnInst::Create(One, RetBB);
     
       // create fib(x-1)
    -  Value *Sub = BinaryOperator::createSub(ArgX, One, "arg", RecurseBB);
    +  Value *Sub = BinaryOperator::CreateSub(ArgX, One, "arg", RecurseBB);
       CallInst *CallFibX1 = CallInst::Create(FibF, Sub, "fibx1", RecurseBB);
       CallFibX1->setTailCall();
     
       // create fib(x-2)
    -  Sub = BinaryOperator::createSub(ArgX, Two, "arg", RecurseBB);
    +  Sub = BinaryOperator::CreateSub(ArgX, Two, "arg", RecurseBB);
       CallInst *CallFibX2 = CallInst::Create(FibF, Sub, "fibx2", RecurseBB);
       CallFibX2->setTailCall();
     
     
       // fib(x-1)+fib(x-2)
    -  Value *Sum = BinaryOperator::createAdd(CallFibX1, CallFibX2,
    +  Value *Sum = BinaryOperator::CreateAdd(CallFibX1, CallFibX2,
                                              "addresult", RecurseBB);
     
       // Create the return instruction and add it to the basic block
    
    Modified: llvm/branches/non-call-eh/examples/HowToUseJIT/HowToUseJIT.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/examples/HowToUseJIT/HowToUseJIT.cpp?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/examples/HowToUseJIT/HowToUseJIT.cpp (original)
    +++ llvm/branches/non-call-eh/examples/HowToUseJIT/HowToUseJIT.cpp Sun Jul  6 15:45:41 2008
    @@ -69,7 +69,7 @@
       ArgX->setName("AnArg");            // Give it a nice symbolic name for fun.
     
       // Create the add instruction, inserting it into the end of BB.
    -  Instruction *Add = BinaryOperator::createAdd(One, ArgX, "addresult", BB);
    +  Instruction *Add = BinaryOperator::CreateAdd(One, ArgX, "addresult", BB);
     
       // Create the return instruction and add it to the basic block
       ReturnInst::Create(Add, BB);
    
    Modified: llvm/branches/non-call-eh/examples/ModuleMaker/ModuleMaker.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/examples/ModuleMaker/ModuleMaker.cpp?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/examples/ModuleMaker/ModuleMaker.cpp (original)
    +++ llvm/branches/non-call-eh/examples/ModuleMaker/ModuleMaker.cpp Sun Jul  6 15:45:41 2008
    @@ -43,7 +43,7 @@
       Value *Three = ConstantInt::get(Type::Int32Ty, 3);
     
       // Create the add instruction... does not insert...
    -  Instruction *Add = BinaryOperator::create(Instruction::Add, Two, Three,
    +  Instruction *Add = BinaryOperator::Create(Instruction::Add, Two, Three,
                                                 "addresult");
     
       // explicitly insert it into the basic block...
    
    Modified: llvm/branches/non-call-eh/examples/ParallelJIT/ParallelJIT.cpp
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/examples/ParallelJIT/ParallelJIT.cpp?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/examples/ParallelJIT/ParallelJIT.cpp (original)
    +++ llvm/branches/non-call-eh/examples/ParallelJIT/ParallelJIT.cpp Sun Jul  6 15:45:41 2008
    @@ -50,7 +50,7 @@
       ArgX->setName("AnArg");            // Give it a nice symbolic name for fun.
     
       // Create the add instruction, inserting it into the end of BB.
    -  Instruction *Add = BinaryOperator::createAdd(One, ArgX, "addresult", BB);
    +  Instruction *Add = BinaryOperator::CreateAdd(One, ArgX, "addresult", BB);
     
       // Create the return instruction and add it to the basic block
       ReturnInst::Create(Add, BB);
    @@ -90,16 +90,16 @@
       ReturnInst::Create(One, RetBB);
     
       // create fib(x-1)
    -  Value *Sub = BinaryOperator::createSub(ArgX, One, "arg", RecurseBB);
    +  Value *Sub = BinaryOperator::CreateSub(ArgX, One, "arg", RecurseBB);
       Value *CallFibX1 = CallInst::Create(FibF, Sub, "fibx1", RecurseBB);
     
       // create fib(x-2)
    -  Sub = BinaryOperator::createSub(ArgX, Two, "arg", RecurseBB);
    +  Sub = BinaryOperator::CreateSub(ArgX, Two, "arg", RecurseBB);
       Value *CallFibX2 = CallInst::Create(FibF, Sub, "fibx2", RecurseBB);
     
       // fib(x-1)+fib(x-2)
       Value *Sum =
    -    BinaryOperator::createAdd(CallFibX1, CallFibX2, "addresult", RecurseBB);
    +    BinaryOperator::CreateAdd(CallFibX1, CallFibX2, "addresult", RecurseBB);
     
       // Create the return instruction and add it to the basic block
       ReturnInst::Create(Sum, RecurseBB);
    
    Modified: llvm/branches/non-call-eh/include/llvm-c/BitWriter.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm-c/BitWriter.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm-c/BitWriter.h (original)
    +++ llvm/branches/non-call-eh/include/llvm-c/BitWriter.h Sun Jul  6 15:45:41 2008
    @@ -28,7 +28,8 @@
     
     /*===-- Operations on modules ---------------------------------------------===*/
     
    -/* Writes a module to an open file descriptor. Returns 0 on success. */ 
    +/* Writes a module to an open file descriptor. Returns 0 on success.
    +   Closes the Handle. Use dup first if this is not what you want. */ 
     int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);
     
     /* Writes a module to the specified path. Returns 0 on success. */ 
    
    Modified: llvm/branches/non-call-eh/include/llvm-c/Core.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm-c/Core.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm-c/Core.h (original)
    +++ llvm/branches/non-call-eh/include/llvm-c/Core.h Sun Jul  6 15:45:41 2008
    @@ -83,6 +83,20 @@
     typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
     
     typedef enum {
    +    LLVMZExtParamAttr       = 1<<0,
    +    LLVMSExtParamAttr       = 1<<1,
    +    LLVMNoReturnParamAttr   = 1<<2,
    +    LLVMInRegParamAttr      = 1<<3,
    +    LLVMStructRetParamAttr  = 1<<4,
    +    LLVMNoUnwindParamAttr   = 1<<5,
    +    LLVMNoAliasParamAttr    = 1<<6,
    +    LLVMByValParamAttr      = 1<<7,
    +    LLVMNestParamAttr       = 1<<8,
    +    LLVMReadNoneParamAttr   = 1<<9,
    +    LLVMReadOnlyParamAttr   = 1<<10
    +} LLVMParamAttr;
    +
    +typedef enum {
       LLVMVoidTypeKind,        /**< type with no size */
       LLVMFloatTypeKind,       /**< 32 bit floating point type */
       LLVMDoubleTypeKind,      /**< 64 bit floating point type */
    @@ -210,24 +224,21 @@
     /** See llvm::LLVMTypeKind::getTypeID. */
     LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty);
     
    -/** See llvm::DerivedType::refineAbstractTypeTo. */
    -void LLVMRefineAbstractType(LLVMTypeRef AbstractType, LLVMTypeRef ConcreteType);
    -
     /* Operations on integer types */
    -LLVMTypeRef LLVMInt1Type();
    -LLVMTypeRef LLVMInt8Type();
    -LLVMTypeRef LLVMInt16Type();
    -LLVMTypeRef LLVMInt32Type();
    -LLVMTypeRef LLVMInt64Type();
    +LLVMTypeRef LLVMInt1Type(void);
    +LLVMTypeRef LLVMInt8Type(void);
    +LLVMTypeRef LLVMInt16Type(void);
    +LLVMTypeRef LLVMInt32Type(void);
    +LLVMTypeRef LLVMInt64Type(void);
     LLVMTypeRef LLVMIntType(unsigned NumBits);
     unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy);
     
     /* Operations on real types */
    -LLVMTypeRef LLVMFloatType();
    -LLVMTypeRef LLVMDoubleType();
    -LLVMTypeRef LLVMX86FP80Type();
    -LLVMTypeRef LLVMFP128Type();
    -LLVMTypeRef LLVMPPCFP128Type();
    +LLVMTypeRef LLVMFloatType(void);
    +LLVMTypeRef LLVMDoubleType(void);
    +LLVMTypeRef LLVMX86FP80Type(void);
    +LLVMTypeRef LLVMFP128Type(void);
    +LLVMTypeRef LLVMPPCFP128Type(void);
     
     /* Operations on function types */
     LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
    @@ -256,9 +267,9 @@
     unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy);
     
     /* Operations on other types */
    -LLVMTypeRef LLVMVoidType();
    -LLVMTypeRef LLVMLabelType();
    -LLVMTypeRef LLVMOpaqueType();
    +LLVMTypeRef LLVMVoidType(void);
    +LLVMTypeRef LLVMLabelType(void);
    +LLVMTypeRef LLVMOpaqueType(void);
     
     /* Operations on type handles */
     LLVMTypeHandleRef LLVMCreateTypeHandle(LLVMTypeRef PotentiallyAbstractTy);
    @@ -306,7 +317,7 @@
     /* Operations on composite constants */
     LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
                                  int DontNullTerminate);
    -LLVMValueRef LLVMConstArray(LLVMTypeRef ArrayTy,
    +LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
                                 LLVMValueRef *ConstantVals, unsigned Length);
     LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
                                  int packed);
    @@ -413,6 +424,9 @@
     LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn);
     LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg);
     LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg);
    +void LLVMAddParamAttr(LLVMValueRef Arg, LLVMParamAttr PA);
    +void LLVMRemoveParamAttr(LLVMValueRef Arg, LLVMParamAttr PA);
    +void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align);
     
     /* Operations on basic blocks */
     LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB);
    @@ -441,6 +455,11 @@
     /* Operations on call sites */
     void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
     unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr);
    +void LLVMAddInstrParamAttr(LLVMValueRef Instr, unsigned index, LLVMParamAttr);
    +void LLVMRemoveInstrParamAttr(LLVMValueRef Instr, unsigned index, 
    +                              LLVMParamAttr);
    +void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index, 
    +                                unsigned align);
     
     /* Operations on phi nodes */
     void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
    @@ -455,7 +474,7 @@
      * exclusive means of building instructions using the C interface.
      */
     
    -LLVMBuilderRef LLVMCreateBuilder();
    +LLVMBuilderRef LLVMCreateBuilder(void);
     void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block,
                              LLVMValueRef Instr);
     void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr);
    @@ -615,7 +634,7 @@
     /** Constructs a new whole-module pass pipeline. This type of pipeline is
         suitable for link-time optimization and whole-module transformations.
         See llvm::PassManager::PassManager. */
    -LLVMPassManagerRef LLVMCreatePassManager();
    +LLVMPassManagerRef LLVMCreatePassManager(void);
     
     /** Constructs a new function-by-function pass pipeline over the module
         provider. It does not take ownership of the module provider. This type of
    
    Modified: llvm/branches/non-call-eh/include/llvm-c/ExecutionEngine.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm-c/ExecutionEngine.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm-c/ExecutionEngine.h (original)
    +++ llvm/branches/non-call-eh/include/llvm-c/ExecutionEngine.h Sun Jul  6 15:45:41 2008
    @@ -91,6 +91,9 @@
     
     LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE);
     
    +void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global,
    +                          void* Addr);
    +
     #ifdef __cplusplus
     }
     
    
    Modified: llvm/branches/non-call-eh/include/llvm-c/lto.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm-c/lto.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm-c/lto.h (original)
    +++ llvm/branches/non-call-eh/include/llvm-c/lto.h Sun Jul  6 15:45:41 2008
    @@ -63,14 +63,14 @@
      * Returns a printable string.
      */
     extern const char*
    -lto_get_version();
    +lto_get_version(void);
     
     
     /**
      * Returns the last error string or NULL if last operation was sucessful.
      */
     extern const char*
    -lto_get_error_message();
    +lto_get_error_message(void);
     
     
     /**
    @@ -160,7 +160,7 @@
      * Returns NULL on error (check lto_get_error_message() for details).
      */
     extern lto_code_gen_t
    -lto_codegen_create();
    +lto_codegen_create(void);
     
     
     /**
    @@ -227,6 +227,11 @@
     lto_codegen_compile(lto_code_gen_t cg, size_t* length);
     
     
    +/**
    + * Sets options to help debug codegen bugs.
    + */
    +extern void
    +lto_codegen_debug_options(lto_code_gen_t cg, const char *);
     #ifdef __cplusplus
     }
     #endif
    
    Propchange: llvm/branches/non-call-eh/include/llvm/ADT/
    
    ------------------------------------------------------------------------------
    --- svn:ignore (original)
    +++ svn:ignore Sun Jul  6 15:45:41 2008
    @@ -1,4 +1,3 @@
    -.cvsignore
    -hash_map
    -hash_set
    -iterator
    +hash_map.h
    +hash_set.h
    +iterator.h
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/APFloat.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/APFloat.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/APFloat.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/APFloat.h Sun Jul  6 15:45:41 2008
    @@ -152,8 +152,8 @@
           rmNearestTiesToAway
         };
     
    -    /* Operation status.  opUnderflow or opOverflow are always returned
    -       or-ed with opInexact.  */
    +    // Operation status.  opUnderflow or opOverflow are always returned
    +    // or-ed with opInexact.
         enum opStatus {
           opOK          = 0x00,
           opInvalidOp   = 0x01,
    @@ -163,7 +163,7 @@
           opInexact     = 0x10
         };
     
    -    /* Category of internally-represented number.  */
    +    // Category of internally-represented number.
         enum fltCategory {
           fcInfinity,
           fcNaN,
    @@ -171,7 +171,7 @@
           fcZero
         };
     
    -    /* Constructors.  */
    +    // Constructors.
         APFloat(const fltSemantics &, const char *);
         APFloat(const fltSemantics &, integerPart);
         APFloat(const fltSemantics &, fltCategory, bool negative);
    @@ -180,6 +180,17 @@
         explicit APFloat(const APInt &, bool isIEEE = false);
         APFloat(const APFloat &);
         ~APFloat();
    +
    +    // Convenience "constructors"
    +    static APFloat getZero(const fltSemantics &Sem, bool Negative = false) {
    +      return APFloat(Sem, fcZero, Negative);
    +    }
    +    static APFloat getInf(const fltSemantics &Sem, bool Negative = false) {
    +      return APFloat(Sem, fcInfinity, Negative);
    +    }
    +    static APFloat getNaN(const fltSemantics &Sem, bool Negative = false) {
    +      return APFloat(Sem, fcNaN, Negative);
    +    }
         
         /// Profile - Used to insert APFloat objects, or objects that contain
         ///  APFloat objects, into FoldingSets.
    @@ -244,6 +255,7 @@
         bool isZero() const { return category == fcZero; }
         bool isNonZero() const { return category != fcZero; }
         bool isNaN() const { return category == fcNaN; }
    +    bool isInfinity() const { return category == fcInfinity; }
         bool isNegative() const { return sign; }
         bool isPosZero() const { return isZero() && !isNegative(); }
         bool isNegZero() const { return isZero() && isNegative(); }
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/APInt.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/APInt.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/APInt.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/APInt.h Sun Jul  6 15:45:41 2008
    @@ -31,7 +31,8 @@
       typedef uint64_t integerPart;
     
       const unsigned int host_char_bit = 8;
    -  const unsigned int integerPartWidth = host_char_bit * sizeof(integerPart);
    +  const unsigned int integerPartWidth = host_char_bit *
    +    static_cast(sizeof(integerPart));
     
     //===----------------------------------------------------------------------===//
     //                              APInt Class
    @@ -76,8 +77,10 @@
     
       /// This enum is used to hold the constants we needed for APInt.
       enum {
    -    APINT_BITS_PER_WORD = sizeof(uint64_t) * 8, ///< Bits in a word
    -    APINT_WORD_SIZE = sizeof(uint64_t)          ///< Byte size of a word
    +    /// Bits in a word
    +    APINT_BITS_PER_WORD = static_cast(sizeof(uint64_t)) * 8,
    +    /// Byte size of a word
    +    APINT_WORD_SIZE = static_cast(sizeof(uint64_t))
       };
     
       /// This constructor is used only internally for speed of construction of
    @@ -127,7 +130,7 @@
           // the word size (64).
           return *this;
     
    -    // Mask out the hight bits.
    +    // Mask out the high bits.
         uint64_t mask = ~uint64_t(0ULL) >> (APINT_BITS_PER_WORD - wordBits);
         if (isSingleWord())
           VAL &= mask;
    @@ -665,9 +668,11 @@
         return this->urem(RHS);
       }
     
    -  /// Sometimes it is convenient to divide two APInt values and obtain both
    -  /// the quotient and remainder. This function does both operations in the
    -  /// same computation making it a little more efficient.
    +  /// Sometimes it is convenient to divide two APInt values and obtain both the
    +  /// quotient and remainder. This function does both operations in the same
    +  /// computation making it a little more efficient. The pair of input arguments
    +  /// may overlap with the pair of output arguments. It is safe to call
    +  /// udivrem(X, Y, X, Y), for example.
       /// @brief Dual division/remainder interface.
       static void udivrem(const APInt &LHS, const APInt &RHS, 
                           APInt &Quotient, APInt &Remainder);
    @@ -895,7 +900,7 @@
     
       /// Computes the minimum bit width for this APInt while considering it to be
       /// a signed (and probably negative) value. If the value is not negative, 
    -  /// this function returns the same value as getActiveBits(). Otherwise, it
    +  /// this function returns the same value as getActiveBits()+1. Otherwise, it
       /// returns the smallest bit width that will retain the negative value. For
       /// example, -1 can be written as 0b1 or 0xFFFFFFFFFF. 0b1 is shorter and so
       /// for -1, this function will always return 1.
    @@ -1104,7 +1109,8 @@
         return *this;
       }
     
    -  /// @}
    +  /// @returns the multiplicative inverse for a given modulo.
    +  APInt multiplicativeInverse(const APInt& modulo) const;
     
       /// @}
       /// @name Building-block Operations for APInt and APFloat
    @@ -1279,7 +1285,8 @@
     /// @returns true if the argument APInt value is a sequence of ones
     /// starting at the least significant bit with the remainder zero.
     inline bool isMask(uint32_t numBits, const APInt& APIVal) {
    -  return APIVal.getBoolValue() && ((APIVal + APInt(numBits,1)) & APIVal) == 0;
    +  return numBits <= APIVal.getBitWidth() &&
    +    APIVal == APInt::getLowBitsSet(APIVal.getBitWidth(), numBits);
     }
     
     /// @returns true if the argument APInt value contains a sequence of ones
    @@ -1299,7 +1306,7 @@
     }
     
     /// GreatestCommonDivisor - This function returns the greatest common
    -/// divisor of the two APInt values using Enclid's algorithm.
    +/// divisor of the two APInt values using Euclid's algorithm.
     /// @returns the greatest common divisor of Val1 and Val2
     /// @brief Compute GCD of two APInt values.
     APInt GreatestCommonDivisor(const APInt& Val1, const APInt& Val2);
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/BitVector.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/BitVector.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/BitVector.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/BitVector.h Sun Jul  6 15:45:41 2008
    @@ -17,7 +17,6 @@
     #include "llvm/Support/MathExtras.h"
     #include 
     #include 
    -#include 
     #include 
     
     namespace llvm {
    @@ -25,7 +24,7 @@
     class BitVector {
       typedef unsigned long BitWord;
     
    -  enum { BITWORD_SIZE = sizeof(BitWord) * 8 };
    +  enum { BITWORD_SIZE = (unsigned)sizeof(BitWord) * 8 };
     
       BitWord  *Bits;        // Actual bits. 
       unsigned Size;         // Size of bitvector in bits.
    @@ -65,7 +64,7 @@
     
       /// BitVector default ctor - Creates an empty bitvector.
       BitVector() : Size(0), Capacity(0) {
    -    Bits = NULL;
    +    Bits = 0;
       }
     
       /// BitVector ctor - Creates a bitvector of specified number of bits. All
    @@ -81,7 +80,7 @@
       /// BitVector copy ctor.
       BitVector(const BitVector &RHS) : Size(RHS.size()) {
         if (Size == 0) {
    -      Bits = NULL;
    +      Bits = 0;
           Capacity = 0;
           return;
         }
    @@ -103,7 +102,7 @@
         unsigned NumBits = 0;
         for (unsigned i = 0; i < NumBitWords(size()); ++i)
           if (sizeof(BitWord) == 4)
    -        NumBits += CountPopulation_32(Bits[i]);
    +        NumBits += CountPopulation_32((uint32_t)Bits[i]);
           else if (sizeof(BitWord) == 8)
             NumBits += CountPopulation_64(Bits[i]);
           else
    @@ -130,7 +129,7 @@
         for (unsigned i = 0; i < NumBitWords(size()); ++i)
           if (Bits[i] != 0) {
             if (sizeof(BitWord) == 4)
    -          return i * BITWORD_SIZE + CountTrailingZeros_32(Bits[i]);
    +          return i * BITWORD_SIZE + CountTrailingZeros_32((uint32_t)Bits[i]);
             else if (sizeof(BitWord) == 8)
               return i * BITWORD_SIZE + CountTrailingZeros_64(Bits[i]);
             else
    @@ -154,7 +153,7 @@
     
         if (Copy != 0) {
           if (sizeof(BitWord) == 4)
    -        return WordPos * BITWORD_SIZE + CountTrailingZeros_32(Copy);
    +        return WordPos * BITWORD_SIZE + CountTrailingZeros_32((uint32_t)Copy);
           else if (sizeof(BitWord) == 8)
             return WordPos * BITWORD_SIZE + CountTrailingZeros_64(Copy);
           else
    @@ -165,7 +164,7 @@
         for (unsigned i = WordPos+1; i < NumBitWords(size()); ++i)
           if (Bits[i] != 0) {
             if (sizeof(BitWord) == 4)
    -          return i * BITWORD_SIZE + CountTrailingZeros_32(Bits[i]);
    +          return i * BITWORD_SIZE + CountTrailingZeros_32((uint32_t)Bits[i]);
             else if (sizeof(BitWord) == 8)
               return i * BITWORD_SIZE + CountTrailingZeros_64(Bits[i]);
             else
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/DenseMap.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/DenseMap.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/DenseMap.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/DenseMap.h Sun Jul  6 15:45:41 2008
    @@ -82,7 +82,7 @@
             P->second.~ValueT();
           P->first.~KeyT();
         }
    -    delete[] reinterpret_cast(Buckets);
    +    operator delete(Buckets);
       }
       
       typedef DenseMapIterator iterator;
    @@ -210,15 +210,15 @@
         NumTombstones = other.NumTombstones;
         
         if (NumBuckets)
    -      delete[] reinterpret_cast(Buckets);
    -    Buckets = reinterpret_cast(new char[sizeof(BucketT) *
    -                                                  other.NumBuckets]);
    +      operator delete(Buckets);
    +    Buckets = static_cast(operator new(sizeof(BucketT) *
    +                                                 other.NumBuckets));
         
         if (KeyInfoT::isPod() && ValueInfoT::isPod())
           memcpy(Buckets, other.Buckets, other.NumBuckets * sizeof(BucketT));
         else
           for (size_t i = 0; i < other.NumBuckets; ++i) {
    -        new (Buckets[i].first) KeyT(other.Buckets[i].first);
    +        new (&Buckets[i].first) KeyT(other.Buckets[i].first);
             if (!KeyInfoT::isEqual(Buckets[i].first, getEmptyKey()) &&
                 !KeyInfoT::isEqual(Buckets[i].first, getTombstoneKey()))
               new (&Buckets[i].second) ValueT(other.Buckets[i].second);
    @@ -315,7 +315,7 @@
         NumBuckets = InitBuckets;
         assert(InitBuckets && (InitBuckets & (InitBuckets-1)) == 0 &&
                "# initial buckets must be a power of two!");
    -    Buckets = reinterpret_cast(new char[sizeof(BucketT)*InitBuckets]);
    +    Buckets = static_cast(operator new(sizeof(BucketT)*InitBuckets));
         // Initialize all the keys to EmptyKey.
         const KeyT EmptyKey = getEmptyKey();
         for (unsigned i = 0; i != InitBuckets; ++i)
    @@ -330,7 +330,7 @@
         while (NumBuckets <= AtLeast)
           NumBuckets <<= 1;
         NumTombstones = 0;
    -    Buckets = reinterpret_cast(new char[sizeof(BucketT)*NumBuckets]);
    +    Buckets = static_cast(operator new(sizeof(BucketT)*NumBuckets));
     
         // Initialize all the keys to EmptyKey.
         const KeyT EmptyKey = getEmptyKey();
    @@ -357,7 +357,7 @@
         }
         
         // Free the old table.
    -    delete[] reinterpret_cast(OldBuckets);
    +    operator delete(OldBuckets);
       }
       
       void shrink_and_clear() {
    @@ -368,7 +368,7 @@
         NumBuckets = NumEntries > 32 ? 1 << (Log2_32_Ceil(NumEntries) + 1)
                                      : 64;
         NumTombstones = 0;
    -    Buckets = reinterpret_cast(new char[sizeof(BucketT)*NumBuckets]);
    +    Buckets = static_cast(operator new(sizeof(BucketT)*NumBuckets));
     
         // Initialize all the keys to EmptyKey.
         const KeyT EmptyKey = getEmptyKey();
    @@ -387,7 +387,7 @@
         }
         
         // Free the old table.
    -    delete[] reinterpret_cast(OldBuckets);
    +    operator delete(OldBuckets);
         
         NumEntries = 0;
       }
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/DenseSet.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/DenseSet.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/DenseSet.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/DenseSet.h Sun Jul  6 15:45:41 2008
    @@ -24,15 +24,14 @@
     /// should be optimized later if there is a need.
     template >
     class DenseSet {
    -  DenseMap TheMap;
    +  typedef DenseMap MapTy;
    +  MapTy TheMap;
     public:
       DenseSet(const DenseSet &Other) : TheMap(Other.TheMap) {}
       explicit DenseSet(unsigned NumInitBuckets = 64) : TheMap(NumInitBuckets) {}
       
       bool empty() const { return TheMap.empty(); }
    -  unsigned size() const { return TheMap.size(); }
    -  
    -  // TODO add iterators.
    +  unsigned size() const { return TheMap.size(); }  
       
       void clear() {
         TheMap.clear();
    @@ -42,8 +41,8 @@
         return TheMap.count(V);
       }
       
    -  void insert(const ValueT &V) {
    -    TheMap[V] = 0;
    +  bool insert(const ValueT &V) {
    +    return TheMap.insert(std::make_pair(V, 0));
       }
       
       void erase(const ValueT &V) {
    @@ -54,6 +53,43 @@
         TheMap = RHS.TheMap;
         return *this;
       }
    +  
    +  // Iterators.
    +  
    +  class Iterator {
    +    typename MapTy::iterator I;
    +  public:
    +    Iterator(const typename MapTy::iterator &i) : I(i) {}
    +    
    +    ValueT& operator*() { return I->first; }
    +    ValueT* operator->() { return &I->first; }
    +    
    +    Iterator& operator++() { ++I; return *this; };
    +    bool operator==(const Iterator& X) const { return I == X.I; }
    +    bool operator!=(const Iterator& X) const { return I != X.I; }
    +  };
    +  
    +  class ConstIterator {
    +    typename MapTy::const_iterator I;
    +  public:
    +    ConstIterator(const typename MapTy::const_iterator &i) : I(i) {}
    +    
    +    const ValueT& operator*() { return I->first; }
    +    const ValueT* operator->() { return &I->first; }
    +    
    +    ConstIterator& operator++() { ++I; return *this; };
    +    bool operator==(const ConstIterator& X) const { return I == X.I; }
    +    bool operator!=(const ConstIterator& X) const { return I != X.I; }
    +  };
    +  
    +  typedef Iterator      iterator;
    +  typedef ConstIterator const_iterator;
    +  
    +  iterator begin() { return Iterator(TheMap.begin()); }
    +  iterator end() { return Iterator(TheMap.end()); }
    +  
    +  const_iterator begin() const { return ConstIterator(TheMap.begin()); }
    +  const_iterator end() const { return ConstIterator(TheMap.end()); }
     };
     
     } // end namespace llvm
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/DepthFirstIterator.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/DepthFirstIterator.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/DepthFirstIterator.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/DepthFirstIterator.h Sun Jul  6 15:45:41 2008
    @@ -34,7 +34,7 @@
     #define LLVM_ADT_DEPTHFIRSTITERATOR_H
     
     #include "llvm/ADT/GraphTraits.h"
    -#include "llvm/ADT/iterator"
    +#include "llvm/ADT/iterator.h"
     #include "llvm/ADT/SmallPtrSet.h"
     #include 
     #include 
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/EquivalenceClasses.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/EquivalenceClasses.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/EquivalenceClasses.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/EquivalenceClasses.h Sun Jul  6 15:45:41 2008
    @@ -15,7 +15,7 @@
     #ifndef LLVM_ADT_EQUIVALENCECLASSES_H
     #define LLVM_ADT_EQUIVALENCECLASSES_H
     
    -#include "llvm/ADT/iterator"
    +#include "llvm/ADT/iterator.h"
     #include "llvm/Support/DataTypes.h"
     #include 
     
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/FoldingSet.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/FoldingSet.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/FoldingSet.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/FoldingSet.h Sun Jul  6 15:45:41 2008
    @@ -220,6 +220,7 @@
       void AddFloat(float F);
       void AddDouble(double D);
       void AddString(const std::string &String);
    +  void AddString(const char* String);
       
       template 
       inline void Add(const T& x) { FoldingSetTrait::Profile(x, *this); }
    @@ -426,6 +427,18 @@
     
       operator T&() { return data; }
       operator const T&() const { return data; }
    +};  
    +  
    +//===----------------------------------------------------------------------===//
    +// Partial specializations of FoldingSetTrait.
    +
    +template struct FoldingSetTrait {
    +  static inline void Profile(const T* X, FoldingSetNodeID& ID) {
    +    ID.AddPointer(X);
    +  }
    +  static inline void Profile(T* X, FoldingSetNodeID& ID) {
    +    ID.AddPointer(X);
    +  }
     };
     
     } // End of namespace llvm.
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/HashExtras.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/HashExtras.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/HashExtras.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/HashExtras.h Sun Jul  6 15:45:41 2008
    @@ -17,7 +17,7 @@
     #ifndef LLVM_ADT_HASHEXTRAS_H
     #define LLVM_ADT_HASHEXTRAS_H
     
    -#include "llvm/ADT/hash_map"
    +#include "llvm/ADT/hash_map.h"
     #include 
     
     // Cannot specialize hash template from outside of the std namespace.
    
    Added: llvm/branches/non-call-eh/include/llvm/ADT/ImmutableList.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/ImmutableList.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/ImmutableList.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/ImmutableList.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,191 @@
    +//==--- ImmutableList.h - Immutable (functional) list interface --*- C++ -*-==//
    +//
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +//
    +//===----------------------------------------------------------------------===//
    +//
    +// This file defines the ImmutableList class.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ADT_IMLIST_H
    +#define LLVM_ADT_IMLIST_H
    +
    +#include "llvm/Support/Allocator.h"
    +#include "llvm/ADT/FoldingSet.h"
    +#include "llvm/Support/DataTypes.h"
    +#include 
    +
    +namespace llvm {
    +
    +template  class ImmutableListFactory;
    +  
    +template 
    +class ImmutableListImpl : public FoldingSetNode {
    +  T Head;
    +  ImmutableListImpl* Tail;
    +
    +  ImmutableListImpl(const T& head, ImmutableListImpl* tail = 0)
    +    : Head(head), Tail(tail) {}
    +  
    +  friend class ImmutableListFactory;
    +  
    +  // Do not implement.
    +  void operator=(const ImmutableListImpl&);
    +  ImmutableListImpl(const ImmutableListImpl&);
    +  
    +public:
    +  const T& getHead() const { return Head; }
    +  ImmutableListImpl* getTail() const { return Tail; }
    +  
    +  static inline void Profile(FoldingSetNodeID& ID, const T& H,
    +                             ImmutableListImpl* L){
    +    ID.AddPointer(L);
    +    ID.Add(H);
    +  }
    +  
    +  void Profile(FoldingSetNodeID& ID) {
    +    Profile(ID, Head, Tail);
    +  }
    +};
    +  
    +/// ImmutableList - This class represents an immutable (functional) list.
    +///  It is implemented as a smart pointer (wraps ImmutableListImpl), so it
    +///  it is intended to always be copied by value as if it were a pointer.
    +///  This interface matches ImmutableSet and ImmutableMap.  ImmutableList
    +///  objects should almost never be created directly, and instead should
    +///  be created by ImmutableListFactory objects that manage the lifetime
    +///  of a group of lists.  When the factory object is reclaimed, all lists
    +///  created by that factory are released as well.
    +template 
    +class ImmutableList {
    +public:
    +  typedef T value_type;
    +  typedef ImmutableListFactory Factory;
    +
    +private:
    +  ImmutableListImpl* X;
    +
    +public:
    +  // This constructor should normally only be called by ImmutableListFactory.
    +  // There may be cases, however, when one needs to extract the internal pointer
    +  // and reconstruct a list object from that pointer.
    +  ImmutableList(ImmutableListImpl* x) : X(x) {}
    +
    +  ImmutableListImpl* getInternalPointer() const {
    +    return X;
    +  }
    +  
    +  class iterator {
    +    ImmutableListImpl* L;
    +  public:
    +    iterator() : L(0) {}
    +    iterator(ImmutableList l) : L(l.getInternalPointer()) {}
    +    
    +    iterator& operator++() { L = L->getTail(); return *this; }
    +    bool operator==(const iterator& I) const { return L == I.L; }
    +    bool operator!=(const iterator& I) const { return L != I.L; }
    +    ImmutableList operator*() const { return L; }
    +  };
    +
    +  /// begin - Returns an iterator referring to the head of the list, or
    +  ///  an iterator denoting the end of the list if the list is empty.
    +  iterator begin() const { return iterator(X); }
    +    
    +  /// end - Returns an iterator denoting the end of the list.  This iterator
    +  ///  does not refer to a valid list element.
    +  iterator end() const { return iterator(); }
    +
    +  /// isEmpty - Returns true if the list is empty.
    +  bool isEmpty() const { return !X; }
    +  
    +  /// isEqual - Returns true if two lists are equal.  Because all lists created
    +  ///  from the same ImmutableListFactory are uniqued, this has O(1) complexity
    +  ///  because it the contents of the list do not need to be compared.  Note
    +  ///  that you should only compare two lists created from the same
    +  ///  ImmutableListFactory.
    +  bool isEqual(const ImmutableList& L) const { return X == L.X; }  
    +
    +  bool operator==(const ImmutableList& L) const { return isEqual(L); }
    +
    +  /// getHead - Returns the head of the list.
    +  const T& getHead() {
    +    assert (!isEmpty() && "Cannot get the head of an empty list.");
    +    return X->getHead();
    +  }
    +  
    +  /// getTail - Returns the tail of the list, which is another (possibly empty)
    +  ///  ImmutableList.
    +  ImmutableList getTail() {
    +    return X ? X->getTail() : 0;
    +  }  
    +};
    +  
    +template 
    +class ImmutableListFactory {
    +  typedef ImmutableListImpl ListTy;  
    +  typedef FoldingSet   CacheTy;
    +  
    +  CacheTy Cache;
    +  uintptr_t Allocator;
    +  
    +  bool ownsAllocator() const {
    +    return Allocator & 0x1 ? false : true;
    +  }
    +  
    +  BumpPtrAllocator& getAllocator() const { 
    +    return *reinterpret_cast(Allocator & ~0x1);
    +  }  
    +
    +public:
    +  ImmutableListFactory()
    +    : Allocator(reinterpret_cast(new BumpPtrAllocator())) {}
    +  
    +  ImmutableListFactory(BumpPtrAllocator& Alloc)
    +  : Allocator(reinterpret_cast(&Alloc) | 0x1) {}
    +  
    +  ~ImmutableListFactory() {
    +    if (ownsAllocator()) delete &getAllocator();
    +  }
    +  
    +  ImmutableList Concat(const T& Head, ImmutableList Tail) {
    +    // Profile the new list to see if it already exists in our cache.
    +    FoldingSetNodeID ID;
    +    void* InsertPos;
    +    
    +    ListTy* TailImpl = Tail.getInternalPointer();
    +    ListTy::Profile(ID, Head, TailImpl);
    +    ListTy* L = Cache.FindNodeOrInsertPos(ID, InsertPos);
    +    
    +    if (!L) {
    +      // The list does not exist in our cache.  Create it.
    +      BumpPtrAllocator& A = getAllocator();
    +      L = (ListTy*) A.Allocate();
    +      new (L) ListTy(Head, TailImpl);
    +    
    +      // Insert the new list into the cache.
    +      Cache.InsertNode(L, InsertPos);
    +    }
    +    
    +    return L;
    +  }
    +  
    +  ImmutableList Add(const T& D, ImmutableList L) {
    +    return Concat(D, L);
    +  }
    +  
    +  ImmutableList GetEmptyList() const {
    +    return ImmutableList(0);
    +  }
    +  
    +  ImmutableList Create(const T& X) {
    +    return Concat(X, GetEmptyList());
    +  }
    +};
    +  
    +} // end llvm namespace
    +
    +#endif
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/ImmutableMap.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/ImmutableMap.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/ImmutableMap.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/ImmutableMap.h Sun Jul  6 15:45:41 2008
    @@ -176,16 +176,19 @@
         friend class ImmutableMap;
     
       public:
    -    inline value_type_ref operator*() const { return itr->getValue(); }
    -    inline key_type_ref getKey() const { return itr->getValue().first; }
    -    inline data_type_ref getData() const { return itr->getValue().second; }
    +    value_type_ref operator*() const { return itr->getValue(); }
    +    value_type*    operator->() const { return &itr->getValue(); }
         
    -    inline iterator& operator++() { ++itr; return *this; }
    -    inline iterator  operator++(int) { iterator tmp(*this); ++itr; return tmp; }
    -    inline iterator& operator--() { --itr; return *this; }
    -    inline iterator  operator--(int) { iterator tmp(*this); --itr; return tmp; }
    -    inline bool operator==(const iterator& RHS) const { return RHS.itr == itr; }
    -    inline bool operator!=(const iterator& RHS) const { return RHS.itr != itr; }        
    +    key_type_ref getKey() const { return itr->getValue().first; }
    +    data_type_ref getData() const { return itr->getValue().second; }
    +    
    +    
    +    iterator& operator++() { ++itr; return *this; }
    +    iterator  operator++(int) { iterator tmp(*this); ++itr; return tmp; }
    +    iterator& operator--() { --itr; return *this; }
    +    iterator  operator--(int) { iterator tmp(*this); --itr; return tmp; }
    +    bool operator==(const iterator& RHS) const { return RHS.itr == itr; }
    +    bool operator!=(const iterator& RHS) const { return RHS.itr != itr; }        
       };
       
       iterator begin() const { return iterator(Root); }
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/PostOrderIterator.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/PostOrderIterator.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/PostOrderIterator.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/PostOrderIterator.h Sun Jul  6 15:45:41 2008
    @@ -17,7 +17,7 @@
     #define LLVM_ADT_POSTORDERITERATOR_H
     
     #include "llvm/ADT/GraphTraits.h"
    -#include "llvm/ADT/iterator"
    +#include "llvm/ADT/iterator.h"
     #include 
     #include 
     #include 
    
    Added: llvm/branches/non-call-eh/include/llvm/ADT/PriorityQueue.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/PriorityQueue.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/PriorityQueue.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/PriorityQueue.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,83 @@
    +//===- llvm/ADT/PriorityQueue.h - Priority queues ---------------*- C++ -*-===//
    +//
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +//
    +//===----------------------------------------------------------------------===//
    +//
    +// This file defines the PriorityQueue class.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ADT_PRIORITY_QUEUE_H
    +#define LLVM_ADT_PRIORITY_QUEUE_H
    +
    +#include 
    +
    +namespace llvm {
    +
    +/// PriorityQueue - This class behaves like std::priority_queue and
    +/// provides a few additional convenience functions.
    +/// 
    +template,
    +         class Compare = std::less >
    +class PriorityQueue : public std::priority_queue {
    +public:
    +  explicit PriorityQueue(const Compare &compare = Compare(),
    +                         const Sequence &sequence = Sequence())
    +    : std::priority_queue(compare, sequence)
    +  {}
    +
    +  template
    +  PriorityQueue(Iterator begin, Iterator end,
    +                const Compare &compare = Compare(),
    +                const Sequence &sequence = Sequence())
    +    : std::priority_queue(begin, end, compare, sequence)
    +  {}
    +
    +  /// erase_one - Erase one element from the queue, regardless of its
    +  /// position. This operation performs a linear search to find an element
    +  /// equal to t, but then uses all logarithmic-time algorithms to do
    +  /// the erase operation.
    +  ///
    +  void erase_one(const T &t) {
    +    // Linear-search to find the element.
    +    typename Sequence::size_type i =
    +      std::find(this->c.begin(), this->c.end(), t) - this->c.begin();
    +
    +    // Logarithmic-time heap bubble-up.
    +    while (i != 0) {
    +      typename Sequence::size_type parent = (i - 1) / 2;
    +      this->c[i] = this->c[parent];
    +      i = parent;
    +    }
    +
    +    // The element we want to remove is now at the root, so we can use
    +    // priority_queue's plain pop to remove it.
    +    this->pop();
    +  }
    +
    +  /// reheapify - If an element in the queue has changed in a way that
    +  /// affects its standing in the comparison function, the queue's
    +  /// internal state becomes invalid. Calling reheapify() resets the
    +  /// queue's state, making it valid again. This operation has time
    +  /// complexity proportional to the number of elements in the queue,
    +  /// so don't plan to use it a lot.
    +  ///
    +  void reheapify() {
    +    std::make_heap(this->c.begin(), this->c.end(), this->comp);
    +  }
    +
    +  /// clear - Erase all elements from the queue.
    +  ///
    +  void clear() {
    +    this->c.clear();
    +  }
    +};
    +
    +} // End llvm namespace
    +
    +#endif
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/SCCIterator.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/SCCIterator.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/SCCIterator.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/SCCIterator.h Sun Jul  6 15:45:41 2008
    @@ -22,7 +22,7 @@
     #define LLVM_ADT_SCCITERATOR_H
     
     #include "llvm/ADT/GraphTraits.h"
    -#include "llvm/ADT/iterator"
    +#include "llvm/ADT/iterator.h"
     #include 
     #include 
     
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/STLExtras.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/STLExtras.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/STLExtras.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/STLExtras.h Sun Jul  6 15:45:41 2008
    @@ -20,7 +20,7 @@
     #include 
     #include  // for std::pair
     #include  // for std::size_t
    -#include "llvm/ADT/iterator"
    +#include "llvm/ADT/iterator.h"
     
     namespace llvm {
     
    
    Added: llvm/branches/non-call-eh/include/llvm/ADT/ScopedHashTable.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/ScopedHashTable.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/ScopedHashTable.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/ScopedHashTable.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,193 @@
    +//===- ScopedHashTable.h - A simple scoped hash table ---------------------===//
    +//
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +//
    +//===----------------------------------------------------------------------===//
    +//
    +// This file implements an efficient scoped hash table, which is useful for
    +// things like dominator-based optimizations.  This allows clients to do things
    +// like this:
    +//
    +//  ScopedHashTable HT;
    +//  {
    +//    ScopedHashTableScope Scope1(HT);
    +//    HT.insert(0, 0);
    +//    HT.insert(1, 1);
    +//    {
    +//      ScopedHashTableScope Scope2(HT);
    +//      HT.insert(0, 42);
    +//    }
    +//  }
    +//
    +// Looking up the value for "0" in the Scope2 block will return 42.  Looking
    +// up the value for 0 before 42 is inserted or after Scope2 is popped will
    +// return 0.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ADT_SCOPEDHASHTABLE_H
    +#define LLVM_ADT_SCOPEDHASHTABLE_H
    +
    +#include 
    +#include "llvm/ADT/DenseMap.h"
    +
    +namespace llvm {
    +
    +template 
    +class ScopedHashTable;
    +
    +template 
    +class ScopedHashTableVal {
    +  ScopedHashTableVal *NextInScope;
    +  ScopedHashTableVal *NextForKey;
    +  K Key;
    +  V Val;
    +public:
    +  ScopedHashTableVal(ScopedHashTableVal *nextInScope, 
    +                     ScopedHashTableVal *nextForKey, const K &key, const V &val)
    +    : NextInScope(nextInScope), NextForKey(nextForKey), Key(key), Val(val) {
    +  }
    +  
    +  const K &getKey() const { return Key; }
    +  const V &getValue() const { return Val; }
    +  V &getValue() { return Val; }
    +  
    +  ScopedHashTableVal *getNextForKey() { return NextForKey; }
    +  const ScopedHashTableVal *getNextForKey() const { return NextForKey; }
    +public:
    +  ScopedHashTableVal *getNextInScope() { return NextInScope; }
    +};
    +
    +template 
    +class ScopedHashTableScope {
    +  /// HT - The hashtable that we are active for.
    +  ScopedHashTable &HT;
    +  
    +  /// PrevScope - This is the scope that we are shadowing in HT.
    +  ScopedHashTableScope *PrevScope;
    +
    +  /// LastValInScope - This is the last value that was inserted for this scope
    +  /// or null if none have been inserted yet.
    +  ScopedHashTableVal *LastValInScope;
    +  void operator=(ScopedHashTableScope&);       // DO NOT IMPLEMENT
    +  ScopedHashTableScope(ScopedHashTableScope&); // DO NOT IMPLEMENT
    +public:
    +  ScopedHashTableScope(ScopedHashTable &HT);
    +  ~ScopedHashTableScope();
    +  
    +private:
    +  friend class ScopedHashTable;
    +  ScopedHashTableVal *getLastValInScope() { return LastValInScope; }
    +  void setLastValInScope(ScopedHashTableVal *Val) { LastValInScope = Val; }
    +};
    +
    +
    +template 
    +class ScopedHashTableIterator {
    +  ScopedHashTableVal *Node;
    +public:
    +  ScopedHashTableIterator(ScopedHashTableVal *node) : Node(node){}
    +  
    +  V &operator*() const {
    +    assert(Node && "Dereference end()");
    +    return Node->getValue();
    +  }
    +  V *operator->() const {
    +    return &Node->getValue();
    +  }
    +  
    +  bool operator==(const ScopedHashTableIterator &RHS) const {
    +    return Node == RHS.Node;
    +  }
    +  bool operator!=(const ScopedHashTableIterator &RHS) const {
    +    return Node != RHS.Node;
    +  }
    +  
    +  inline ScopedHashTableIterator& operator++() {          // Preincrement
    +    assert(Node && "incrementing past end()");
    +    Node = Node->getNextForKey();
    +    return *this;
    +  }
    +  ScopedHashTableIterator operator++(int) {        // Postincrement
    +    ScopedHashTableIterator tmp = *this; ++*this; return tmp;
    +  }
    +};
    +
    +
    +template 
    +class ScopedHashTable {
    +  DenseMap*> TopLevelMap;
    +  ScopedHashTableScope *CurScope;
    +  ScopedHashTable(const ScopedHashTable&); // NOT YET IMPLEMENTED
    +  void operator=(const ScopedHashTable&);  // NOT YET IMPLEMENTED
    +  friend class ScopedHashTableScope;
    +public:
    +  ScopedHashTable() : CurScope(0) {}
    +  ~ScopedHashTable() {
    +    assert(CurScope == 0 && TopLevelMap.empty() && "Scope imbalance!");
    +  }
    +  
    +  void insert(const K &Key, const V &Val) {
    +    assert(CurScope && "No scope active!");
    +    
    +    ScopedHashTableVal *&KeyEntry = TopLevelMap[Key];
    +    
    +    KeyEntry = new ScopedHashTableVal(CurScope->getLastValInScope(),
    +                                           KeyEntry, Key, Val);
    +    CurScope->setLastValInScope(KeyEntry);
    +  }
    +  
    +  typedef ScopedHashTableIterator iterator;
    +
    +  iterator end() { return iterator(0); }
    +
    +  iterator begin(const K &Key) {
    +    typename DenseMap*>::iterator I = 
    +      TopLevelMap.find(Key);
    +    if (I == TopLevelMap.end()) return end();
    +    return iterator(I->second);
    +  }
    +};
    +
    +/// ScopedHashTableScope ctor - Install this as the current scope for the hash
    +/// table.
    +template 
    +ScopedHashTableScope::ScopedHashTableScope(ScopedHashTable &ht)
    +  : HT(ht) {
    +  PrevScope = HT.CurScope;
    +  HT.CurScope = this;
    +  LastValInScope = 0;
    +}
    +
    +template 
    +ScopedHashTableScope::~ScopedHashTableScope() {
    +  assert(HT.CurScope == this && "Scope imbalance!");
    +  HT.CurScope = PrevScope;
    +  
    +  // Pop and delete all values corresponding to this scope.
    +  while (ScopedHashTableVal *ThisEntry = LastValInScope) {
    +    // Pop this value out of the TopLevelMap.
    +    if (ThisEntry->getNextForKey() == 0) {
    +      assert(HT.TopLevelMap[ThisEntry->getKey()] == ThisEntry &&
    +             "Scope imbalance!");
    +      HT.TopLevelMap.erase(ThisEntry->getKey());
    +    } else {      
    +      ScopedHashTableVal *&KeyEntry = HT.TopLevelMap[ThisEntry->getKey()];
    +      assert(KeyEntry == ThisEntry && "Scope imbalance!");
    +      KeyEntry = ThisEntry->getNextForKey();
    +    }
    +    
    +    // Pop this value out of the scope.
    +    LastValInScope = ThisEntry->getNextInScope();
    +    
    +    // Delete this entry.
    +    delete ThisEntry;
    +  }
    +}
    +
    +} // end namespace llvm
    +
    +#endif
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/SmallPtrSet.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/SmallPtrSet.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/SmallPtrSet.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/SmallPtrSet.h Sun Jul  6 15:45:41 2008
    @@ -121,7 +121,7 @@
       bool isSmall() const { return CurArray == &SmallArray[0]; }
     
       unsigned Hash(const void *Ptr) const {
    -    return ((uintptr_t)Ptr >> 4) & (CurArraySize-1);
    +    return static_cast(((uintptr_t)Ptr >> 4) & (CurArraySize-1));
       }
       const void * const *FindBucketFor(const void *Ptr) const;
       void shrink_and_clear();
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/SmallVector.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/SmallVector.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/SmallVector.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/SmallVector.h Sun Jul  6 15:45:41 2008
    @@ -14,8 +14,10 @@
     #ifndef LLVM_ADT_SMALLVECTOR_H
     #define LLVM_ADT_SMALLVECTOR_H
     
    -#include "llvm/ADT/iterator"
    +#include "llvm/ADT/iterator.h"
    +#include "llvm/Support/type_traits.h"
     #include 
    +#include 
     #include 
     
     #ifdef _MSC_VER
    @@ -84,7 +86,7 @@
     
         // If this wasn't grown from the inline copy, deallocate the old space.
         if (!isSmall())
    -      delete[] reinterpret_cast(Begin);
    +      operator delete(static_cast(Begin));
       }
       
       typedef size_t size_type;
    @@ -190,7 +192,7 @@
       ///
       template
       void append(in_iter in_start, in_iter in_end) {
    -    unsigned NumInputs = std::distance(in_start, in_end);
    +    size_type NumInputs = std::distance(in_start, in_end);
         // Grow allocated space if needed.
         if (End+NumInputs > Capacity)
           grow(size()+NumInputs);
    @@ -242,7 +244,7 @@
           *I = Elt;
           return I;
         }
    -    unsigned EltNo = I-Begin;
    +    size_t EltNo = I-Begin;
         grow();
         I = Begin+EltNo;
         goto Retry;
    @@ -255,12 +257,12 @@
           return end()-1;
         }
         
    -    unsigned NumToInsert = std::distance(From, To);
    +    size_t NumToInsert = std::distance(From, To);
         // Convert iterator to elt# to avoid invalidating iterator when we reserve()
    -    unsigned InsertElt = I-begin();
    +    size_t InsertElt = I-begin();
         
         // Ensure there is enough space.
    -    reserve(size() + NumToInsert);
    +    reserve(static_cast(size() + NumToInsert));
         
         // Uninvalidate the iterator.
         I = begin()+InsertElt;
    @@ -285,7 +287,7 @@
         // Copy over the elements that we're about to overwrite.
         T *OldEnd = End;
         End += NumToInsert;
    -    unsigned NumOverwritten = OldEnd-I;
    +    size_t NumOverwritten = OldEnd-I;
         std::uninitialized_copy(I, OldEnd, End-NumOverwritten);
         
         // Replace the overwritten part.
    @@ -300,25 +302,30 @@
       
       bool operator==(const SmallVectorImpl &RHS) const {
         if (size() != RHS.size()) return false;
    -    for (T *This = Begin, *That = RHS.Begin, *End = Begin+size(); 
    -         This != End; ++This, ++That)
    +    for (T *This = Begin, *That = RHS.Begin, *E = Begin+size(); 
    +         This != E; ++This, ++That)
           if (*This != *That)
             return false;
         return true;
       }
       bool operator!=(const SmallVectorImpl &RHS) const { return !(*this == RHS); }
    +
    +  bool operator<(const SmallVectorImpl &RHS) const {
    +    return std::lexicographical_compare(begin(), end(),
    +                                        RHS.begin(), RHS.end());
    +  }
       
     private:
       /// isSmall - Return true if this is a smallvector which has not had dynamic
       /// memory allocated for it.
       bool isSmall() const {
    -    return reinterpret_cast(Begin) == 
    -           reinterpret_cast(&FirstEl);
    +    return static_cast(Begin) == 
    +           static_cast(&FirstEl);
       }
     
       /// grow - double the size of the allocated memory, guaranteeing space for at
       /// least one more element or MinSize if specified.
    -  void grow(unsigned MinSize = 0);
    +  void grow(size_type MinSize = 0);
     
       void construct_range(T *S, T *E, const T &Elt) {
         for (; S != E; ++S)
    @@ -335,23 +342,27 @@
     
     // Define this out-of-line to dissuade the C++ compiler from inlining it.
     template 
    -void SmallVectorImpl::grow(unsigned MinSize) {
    -  unsigned CurCapacity = unsigned(Capacity-Begin);
    -  unsigned CurSize = unsigned(size());
    -  unsigned NewCapacity = 2*CurCapacity;
    +void SmallVectorImpl::grow(size_t MinSize) {
    +  size_t CurCapacity = Capacity-Begin;
    +  size_t CurSize = size();
    +  size_t NewCapacity = 2*CurCapacity;
       if (NewCapacity < MinSize)
         NewCapacity = MinSize;
    -  T *NewElts = reinterpret_cast(new char[NewCapacity*sizeof(T)]);
    +  T *NewElts = static_cast(operator new(NewCapacity*sizeof(T)));
       
       // Copy the elements over.
    -  std::uninitialized_copy(Begin, End, NewElts);
    +  if (is_class::value)
    +    std::uninitialized_copy(Begin, End, NewElts);
    +  else
    +    // Use memcpy for PODs (std::uninitialized_copy optimizes to memmove).
    +    memcpy(NewElts, Begin, CurSize * sizeof(T));
       
       // Destroy the original elements.
       destroy_range(Begin, End);
       
       // If this wasn't grown from the inline copy, deallocate the old space.
       if (!isSmall())
    -    delete[] reinterpret_cast(Begin);
    +    operator delete(static_cast(Begin));
       
       Begin = NewElts;
       End = NewElts+CurSize;
    @@ -375,20 +386,20 @@
         RHS.grow(size());
       
       // Swap the shared elements.
    -  unsigned NumShared = size();
    +  size_t NumShared = size();
       if (NumShared > RHS.size()) NumShared = RHS.size();
    -  for (unsigned i = 0; i != NumShared; ++i)
    +  for (unsigned i = 0; i != static_cast(NumShared); ++i)
         std::swap(Begin[i], RHS[i]);
       
       // Copy over the extra elts.
       if (size() > RHS.size()) {
    -    unsigned EltDiff = size() - RHS.size();
    +    size_t EltDiff = size() - RHS.size();
         std::uninitialized_copy(Begin+NumShared, End, RHS.End);
         RHS.End += EltDiff;
         destroy_range(Begin+NumShared, End);
         End = Begin+NumShared;
       } else if (RHS.size() > size()) {
    -    unsigned EltDiff = RHS.size() - size();
    +    size_t EltDiff = RHS.size() - size();
         std::uninitialized_copy(RHS.Begin+NumShared, RHS.End, End);
         End += EltDiff;
         destroy_range(RHS.Begin+NumShared, RHS.End);
    @@ -458,7 +469,9 @@
       typedef typename SmallVectorImpl::U U;
       enum {
         // MinUs - The number of U's require to cover N T's.
    -    MinUs = (sizeof(T)*N+sizeof(U)-1)/sizeof(U),
    +    MinUs = (static_cast(sizeof(T))*N +
    +             static_cast(sizeof(U)) - 1) / 
    +            static_cast(sizeof(U)),
         
         // NumInlineEltsElts - The number of elements actually in this array.  There
         // is already one in the parent class, and we have to round up to avoid
    @@ -467,7 +480,8 @@
         
         // NumTsAvailable - The number of T's we actually have space for, which may
         // be more than N due to rounding.
    -    NumTsAvailable = (NumInlineEltsElts+1)*sizeof(U) / sizeof(T)
    +    NumTsAvailable = (NumInlineEltsElts+1)*static_cast(sizeof(U))/
    +                     static_cast(sizeof(T))
       };
       U InlineElts[NumInlineEltsElts];
     public:  
    @@ -490,11 +504,12 @@
         if (!RHS.empty())
           operator=(RHS);
       }
    -  
    +
       const SmallVector &operator=(const SmallVector &RHS) {
         SmallVectorImpl::operator=(RHS);
         return *this;
       }
    +  
     };
     
     } // End llvm namespace
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/SparseBitVector.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/SparseBitVector.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/SparseBitVector.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/SparseBitVector.h Sun Jul  6 15:45:41 2008
    @@ -21,7 +21,7 @@
     #include "llvm/Support/DataTypes.h"
     #include "llvm/ADT/STLExtras.h"
     #include "llvm/Support/MathExtras.h"
    -#include "llvm/ADT/ilist"
    +#include "llvm/ADT/ilist.h"
     namespace llvm {
     
     /// SparseBitVector is an implementation of a bitvector that is sparse by only
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/Statistic.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/Statistic.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/Statistic.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/Statistic.h Sun Jul  6 15:45:41 2008
    @@ -68,7 +68,7 @@
     // STATISTIC - A macro to make definition of statistics really simple.  This
     // automatically passes the DEBUG_TYPE of the file into the statistic.
     #define STATISTIC(VARNAME, DESC) \
    -  static Statistic VARNAME = { DEBUG_TYPE, DESC, 0, 0 }
    +  static llvm::Statistic VARNAME = { DEBUG_TYPE, DESC, 0, 0 }
     
     } // End llvm namespace
     
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/StringExtras.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/StringExtras.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/StringExtras.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/StringExtras.h Sun Jul  6 15:45:41 2008
    @@ -126,7 +126,7 @@
     static inline bool StringsEqualNoCase(const std::string &LHS, 
                                           const std::string &RHS) {
       if (LHS.size() != RHS.size()) return false;
    -  for (unsigned i = 0, e = LHS.size(); i != e; ++i)
    +  for (unsigned i = 0, e = static_cast(LHS.size()); i != e; ++i)
         if (tolower(LHS[i]) != tolower(RHS[i])) return false;
       return true;
     }
    @@ -135,12 +135,38 @@
     /// case.
     static inline bool StringsEqualNoCase(const std::string &LHS, 
                                           const char *RHS) {
    -  for (unsigned i = 0, e = LHS.size(); i != e; ++i) {
    +  for (unsigned i = 0, e = static_cast(LHS.size()); i != e; ++i) {
         if (RHS[i] == 0) return false;  // RHS too short.
         if (tolower(LHS[i]) != tolower(RHS[i])) return false;
       }
       return RHS[LHS.size()] == 0;  // Not too long?
     }
    +  
    +/// CStrInCStrNoCase - Portable version of strcasestr.  Locates the first
    +///  occurance of c-string 's2' in string 's1', ignoring case.  Returns
    +///  NULL if 's2' cannot be found.
    +static inline const char* CStrInCStrNoCase(const char *s1, const char *s2) {
    +
    +  // Are either strings NULL or empty?
    +  if (!s1 || !s2 || s1[0] == '\0' || s2[0] == '\0')
    +    return 0;
    +  
    +  if (s1 == s2)
    +    return s1;
    +  
    +  const char *I1=s1, *I2=s2;
    +  
    +  while (*I1 != '\0' || *I2 != '\0' )
    +    if (tolower(*I1) != tolower(*I2)) { // No match.  Start over.
    +      ++s1; I1 = s1; I2 = s2;
    +    }
    +    else { // Character match.  Advance to the next character.
    +      ++I1; ++I2;
    +    }
    +
    +  // If we exhausted all of the characters in 's2', then 's2' appears in 's1'.
    +  return *I2 == '\0' ? s1 : 0;
    +}
     
     /// getToken - This function extracts one token from source, ignoring any
     /// leading characters that appear in the Delimiters string, and ending the
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/StringMap.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/StringMap.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/StringMap.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/StringMap.h Sun Jul  6 15:45:41 2008
    @@ -130,10 +130,10 @@
     public:
       ValueTy second;
     
    -  explicit StringMapEntry(unsigned StrLen)
    -    : StringMapEntryBase(StrLen), second() {}
    -  StringMapEntry(unsigned StrLen, const ValueTy &V)
    -    : StringMapEntryBase(StrLen), second(V) {}
    +  explicit StringMapEntry(unsigned strLen)
    +    : StringMapEntryBase(strLen), second() {}
    +  StringMapEntry(unsigned strLen, const ValueTy &V)
    +    : StringMapEntryBase(strLen), second(V) {}
     
       const ValueTy &getValue() const { return second; }
       ValueTy &getValue() { return second; }
    @@ -153,13 +153,14 @@
       static StringMapEntry *Create(const char *KeyStart, const char *KeyEnd,
                                     AllocatorTy &Allocator,
                                     InitType InitVal) {
    -    unsigned KeyLength = KeyEnd-KeyStart;
    +    unsigned KeyLength = static_cast(KeyEnd-KeyStart);
     
         // Okay, the item doesn't already exist, and 'Bucket' is the bucket to fill
         // in.  Allocate a new item with space for the string at the end and a null
         // terminator.
     
    -    unsigned AllocSize = sizeof(StringMapEntry)+KeyLength+1;
    +    unsigned AllocSize = static_cast(sizeof(StringMapEntry))+
    +      KeyLength+1;
         unsigned Alignment = alignof();
     
         StringMapEntry *NewItem =
    @@ -236,9 +237,9 @@
       AllocatorTy Allocator;
       typedef StringMapEntry MapEntryTy;
     public:
    -  StringMap() : StringMapImpl(sizeof(MapEntryTy)) {}
    +  StringMap() : StringMapImpl(static_cast(sizeof(MapEntryTy))) {}
       explicit StringMap(unsigned InitialSize)
    -    : StringMapImpl(InitialSize, sizeof(MapEntryTy)) {}
    +    : StringMapImpl(InitialSize, static_cast(sizeof(MapEntryTy))) {}
     
       AllocatorTy &getAllocator() { return Allocator; }
       const AllocatorTy &getAllocator() const { return Allocator; }
    @@ -332,6 +333,20 @@
         return true;
       }
     
    +  // clear - Empties out the StringMap
    +  void clear() {
    +    if (empty()) return;
    +    
    +    // Zap all values, resetting the keys back to non-present (not tombstone),
    +    // which is safe because we're removing all elements.
    +    for (ItemBucket *I = TheTable, *E = TheTable+NumBuckets; I != E; ++I) {
    +      if (I->Item && I->Item != getTombstoneVal()) {
    +        static_cast(I->Item)->Destroy(Allocator);
    +        I->Item = 0;
    +      }
    +    }
    +  }
    +
       /// GetOrCreateValue - Look up the specified key in the table.  If a value
       /// exists, return it.  Otherwise, default construct a value, insert it, and
       /// return.
    @@ -376,11 +391,22 @@
         V.Destroy(Allocator);
       }
     
    +  bool erase(const char *Key) {
    +    iterator I = find(Key);
    +    if (I == end()) return false;
    +    erase(I);
    +    return true;
    +  }
    +
    +  bool erase(const std::string &Key) {
    +    iterator I = find(Key);
    +    if (I == end()) return false;
    +    erase(I);
    +    return true;
    +  }
    +
       ~StringMap() {
    -    for (ItemBucket *I = TheTable, *E = TheTable+NumBuckets; I != E; ++I) {
    -      if (I->Item && I->Item != getTombstoneVal())
    -        static_cast(I->Item)->Destroy(Allocator);
    -    }
    +    clear();
         free(TheTable);
       }
     private:
    
    Added: llvm/branches/non-call-eh/include/llvm/ADT/StringSet.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/StringSet.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/StringSet.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/StringSet.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,40 @@
    +//===--- StringSet.h - The LLVM Compiler Driver -----------------*- C++ -*-===//
    +//
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open
    +// Source License. See LICENSE.TXT for details.
    +//
    +//===----------------------------------------------------------------------===//
    +//
    +//  StringSet - A set-like wrapper for the StringMap.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ADT_STRINGSET_H
    +#define LLVM_ADT_STRINGSET_H
    +
    +#include "llvm/ADT/StringMap.h"
    +
    +#include 
    +
    +namespace llvm {
    +
    +  /// StringSet - A wrapper for StringMap that provides set-like
    +  /// functionality.  Only insert() and count() methods are used by my
    +  /// code.
    +  template 
    +  class StringSet : public llvm::StringMap {
    +    typedef llvm::StringMap base;
    +  public:
    +    void insert (const std::string& InLang) {
    +      assert(!InLang.empty());
    +      const char* KeyStart = &InLang[0];
    +      const char* KeyEnd = KeyStart + InLang.size();
    +      base::insert(llvm::StringMapEntry::
    +                   Create(KeyStart, KeyEnd, base::getAllocator(), '+'));
    +    }
    +  };
    +}
    +
    +#endif // LLVM_ADT_STRINGSET_H
    
    Modified: llvm/branches/non-call-eh/include/llvm/ADT/UniqueVector.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/UniqueVector.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/UniqueVector.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/UniqueVector.h Sun Jul  6 15:45:41 2008
    @@ -41,7 +41,7 @@
         if (Val) return Val;
     
         // Compute ID for entry.
    -    Val = Vector.size() + 1;
    +    Val = static_cast(Vector.size()) + 1;
         
         // Insert in vector.
         Vector.push_back(Entry);
    
    Added: llvm/branches/non-call-eh/include/llvm/ADT/hash_map.h.in
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/hash_map.h.in?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/hash_map.h.in (added)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/hash_map.h.in Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,150 @@
    +//==-- llvm/ADT/hash_map.h - "Portable" wrapper around hash_map --*- C++ -*-==//
    +// 
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +// 
    +//===----------------------------------------------------------------------===//
    +// 
    +// This file provides a wrapper around the mysterious  header file
    +// that seems to move around between GCC releases into and out of namespaces at
    +// will.  #including this header will cause hash_map to be available in the
    +// global namespace.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ADT_HASH_MAP_H
    +#define LLVM_ADT_HASH_MAP_H
    +
    +// Compiler Support Matrix
    +//
    +// Version   Namespace   Header File
    +//  2.95.x       ::        hash_map
    +//  3.0.4       std      ext/hash_map
    +//  3.1      __gnu_cxx   ext/hash_map
    +//  HP aCC6     std      stdex/rw/hashm*ap.h
    +//  MS VC++    stdext      hash_map
    +
    +#undef HAVE_GNU_EXT_HASH_MAP
    +#undef HAVE_STD_EXT_HASH_MAP
    +#undef HAVE_GLOBAL_HASH_MAP
    +#undef HAVE_RW_STDEX_HASH_MAP_H
    +
    +#if HAVE_GNU_EXT_HASH_MAP
    +// This is for GCC-3.1+ which puts hash in ext/hash_map
    +# include 
    +# ifndef HASH_NAMESPACE
    +#  define HASH_NAMESPACE __gnu_cxx
    +# endif
    +
    +// GCC 3.0.x puts hash_map in  and in the std namespace.
    +#elif HAVE_STD_EXT_HASH_MAP
    +# include 
    +# ifndef HASH_NAMESPACE
    +#  define HASH_NAMESPACE std
    +# endif
    +
    +// Older compilers such as GCC before version 3.0 do not keep
    +// extensions in the `ext' directory, and ignore the `std' namespace.
    +#elif HAVE_GLOBAL_HASH_MAP
    +# include 
    +# ifndef HASH_NAMESPACE
    +#  define HASH_NAMESPACE std
    +# endif
    +
    +// HP aCC doesn't include an SGI-like hash_map. For this platform (or
    +// any others using Rogue Wave Software's Tools.h++ library), we wrap
    +// around them in std::
    +#elif HAVE_RW_STDEX_HASH_MAP_H
    +# include 
    +# include 
    +# ifndef HASH_NAMESPACE
    +#  define HASH_NAMESPACE std
    +# endif
    +
    +// Support Microsoft VC++.
    +#elif defined(_MSC_VER)
    +# include 
    +# ifndef HASH_NAMESPACE
    +#  define HASH_NAMESPACE stdext
    +   using std::_Distance;
    +# endif
    +
    +// Give a warning if we couldn't find it, instead of (or in addition to)
    +// randomly doing something dumb.
    +#else
    +# warning "Autoconfiguration failed to find the hash_map header file."
    +#endif
    +
    +// we wrap Rogue Wave Tools.h++ rw_hashmap into something SGI-looking, here:
    +#ifdef HAVE_RW_STDEX_HASH_MAP_H
    +namespace HASH_NAMESPACE {
    +
    +template  struct hash {
    +  unsigned int operator()(const unsigned int& x) const {
    +      return x;
    +  }
    +};
    +
    +template ,
    +          class _EqualKey = equal_to,
    +          class _A = allocator  >
    +class hash_map : public rw_hashmap {
    +};
    +
    +template ,
    +          class _EqualKey = equal_to,
    +          class _A = allocator  >
    +class hash_multimap : public rw_hashmultimap {
    +};
    +
    +} // end HASH_NAMESPACE;
    +#endif
    +
    +// Include vector because ext/hash_map includes stl_vector.h and leaves
    +// out specializations like stl_bvector.h, causing link conflicts.
    +#include 
    +
    +#ifdef _MSC_VER
    +
    +// GCC and VC++ have differing ways of implementing hash_maps.  As it's not
    +// standardized, that's to be expected.  This adapter class allows VC++
    +// hash_map to use GCC's hash classes.
    +namespace stdext {
    +  template struct hash;
    +  
    +  // Provide a hash function for unsigned ints...
    +  template<> struct hash {
    +    inline size_t operator()(unsigned int Val) const {
    +      return Val;
    +    }
    +  };
    +
    +  template class hash_compare > {
    +    std::less comp;
    +  public:
    +    enum { bucket_size = 4 };
    +    enum { min_buckets = 8 };
    +    hash_compare() {}
    +    hash_compare(std::less pred) : comp(pred) {}
    +    size_t operator()(const Key& key) const { return hash()(key); }
    +    bool operator()(const Key& k1, const Key& k2) const { return comp(k1, k2); }
    +  };
    +}
    +
    +#endif
    +
    +using HASH_NAMESPACE::hash_map;
    +using HASH_NAMESPACE::hash_multimap;
    +using HASH_NAMESPACE::hash;
    +
    +#include "llvm/ADT/HashExtras.h"
    +
    +#endif // LLVM_ADT_HASH_MAP_H
    
    Removed: llvm/branches/non-call-eh/include/llvm/ADT/hash_map.in
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/hash_map.in?rev=53162&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/hash_map.in (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/hash_map.in (removed)
    @@ -1,150 +0,0 @@
    -//===-- llvm/ADT/hash_map - "Portable" wrapper around hash_map --*- C++ -*-===//
    -// 
    -//                     The LLVM Compiler Infrastructure
    -//
    -// This file is distributed under the University of Illinois Open Source
    -// License. See LICENSE.TXT for details.
    -// 
    -//===----------------------------------------------------------------------===//
    -// 
    -// This file provides a wrapper around the mysterious  header file
    -// that seems to move around between GCC releases into and out of namespaces at
    -// will.  #including this header will cause hash_map to be available in the
    -// global namespace.
    -//
    -//===----------------------------------------------------------------------===//
    -
    -#ifndef LLVM_ADT_HASH_MAP
    -#define LLVM_ADT_HASH_MAP
    -
    -// Compiler Support Matrix
    -//
    -// Version   Namespace   Header File
    -//  2.95.x       ::        hash_map
    -//  3.0.4       std      ext/hash_map
    -//  3.1      __gnu_cxx   ext/hash_map
    -//  HP aCC6     std      stdex/rw/hashm*ap.h
    -//  MS VC++    stdext      hash_map
    -
    -#undef HAVE_GNU_EXT_HASH_MAP
    -#undef HAVE_STD_EXT_HASH_MAP
    -#undef HAVE_GLOBAL_HASH_MAP
    -#undef HAVE_RW_STDEX_HASH_MAP_H
    -
    -#if HAVE_GNU_EXT_HASH_MAP
    -// This is for GCC-3.1+ which puts hash in ext/hash_map
    -# include 
    -# ifndef HASH_NAMESPACE
    -#  define HASH_NAMESPACE __gnu_cxx
    -# endif
    -
    -// GCC 3.0.x puts hash_map in  and in the std namespace.
    -#elif HAVE_STD_EXT_HASH_MAP
    -# include 
    -# ifndef HASH_NAMESPACE
    -#  define HASH_NAMESPACE std
    -# endif
    -
    -// Older compilers such as GCC before version 3.0 do not keep
    -// extensions in the `ext' directory, and ignore the `std' namespace.
    -#elif HAVE_GLOBAL_HASH_MAP
    -# include 
    -# ifndef HASH_NAMESPACE
    -#  define HASH_NAMESPACE std
    -# endif
    -
    -// HP aCC doesn't include an SGI-like hash_map. For this platform (or
    -// any others using Rogue Wave Software's Tools.h++ library), we wrap
    -// around them in std::
    -#elif HAVE_RW_STDEX_HASH_MAP_H
    -# include 
    -# include 
    -# ifndef HASH_NAMESPACE
    -#  define HASH_NAMESPACE std
    -# endif
    -
    -// Support Microsoft VC++.
    -#elif defined(_MSC_VER)
    -# include 
    -# ifndef HASH_NAMESPACE
    -#  define HASH_NAMESPACE stdext
    -   using std::_Distance;
    -# endif
    -
    -// Give a warning if we couldn't find it, instead of (or in addition to)
    -// randomly doing something dumb.
    -#else
    -# warning "Autoconfiguration failed to find the hash_map header file."
    -#endif
    -
    -// we wrap Rogue Wave Tools.h++ rw_hashmap into something SGI-looking, here:
    -#ifdef HAVE_RW_STDEX_HASH_MAP_H
    -namespace HASH_NAMESPACE {
    -
    -template  struct hash {
    -  unsigned int operator()(const unsigned int& x) const {
    -      return x;
    -  }
    -};
    -
    -template ,
    -          class _EqualKey = equal_to,
    -          class _A = allocator  >
    -class hash_map : public rw_hashmap {
    -};
    -
    -template ,
    -          class _EqualKey = equal_to,
    -          class _A = allocator  >
    -class hash_multimap : public rw_hashmultimap {
    -};
    -
    -} // end HASH_NAMESPACE;
    -#endif
    -
    -// Include vector because ext/hash_map includes stl_vector.h and leaves
    -// out specializations like stl_bvector.h, causing link conflicts.
    -#include 
    -
    -#ifdef _MSC_VER
    -
    -// GCC and VC++ have differing ways of implementing hash_maps.  As it's not
    -// standardized, that's to be expected.  This adapter class allows VC++
    -// hash_map to use GCC's hash classes.
    -namespace stdext {
    -  template struct hash;
    -  
    -  // Provide a hash function for unsigned ints...
    -  template<> struct hash {
    -    inline size_t operator()(unsigned int Val) const {
    -      return Val;
    -    }
    -  };
    -
    -  template class hash_compare > {
    -    std::less comp;
    -  public:
    -    enum { bucket_size = 4 };
    -    enum { min_buckets = 8 };
    -    hash_compare() {}
    -    hash_compare(std::less pred) : comp(pred) {}
    -    size_t operator()(const Key& key) const { return hash()(key); }
    -    bool operator()(const Key& k1, const Key& k2) const { return comp(k1, k2); }
    -  };
    -}
    -
    -#endif
    -
    -using HASH_NAMESPACE::hash_map;
    -using HASH_NAMESPACE::hash_multimap;
    -using HASH_NAMESPACE::hash;
    -
    -#include "llvm/ADT/HashExtras.h"
    -
    -#endif
    
    Added: llvm/branches/non-call-eh/include/llvm/ADT/hash_set.h.in
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/hash_set.h.in?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/hash_set.h.in (added)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/hash_set.h.in Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,111 @@
    +//==-- llvm/ADT/hash_set.h - "Portable" wrapper around hash_set --*- C++ -*-==//
    +// 
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +// 
    +//===----------------------------------------------------------------------===//
    +// vim:ft=cpp
    +//
    +// This file provides a wrapper around the mysterious  header file
    +// that seems to move around between GCC releases into and out of namespaces at
    +// will.  #including this header will cause hash_set to be available in the
    +// global namespace.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ADT_HASH_SET_H
    +#define LLVM_ADT_HASH_SET_H
    +
    +// Compiler Support Matrix
    +//
    +// Version   Namespace   Header File
    +//  2.95.x       ::        hash_set
    +//  3.0.4       std      ext/hash_set
    +//  3.1      __gnu_cxx   ext/hash_set
    +//  HP aCC6     std      stdex/rw/hashset.h
    +//  MS VC++    stdext      hash_set
    +
    +#undef HAVE_GNU_EXT_HASH_SET
    +#undef HAVE_STD_EXT_HASH_SET
    +#undef HAVE_GLOBAL_HASH_SET
    +#undef HAVE_RW_STDEX_HASH_SET_H
    +
    +// GCC versions 3.1 and later put hash_set in  and in
    +// the __gnu_cxx namespace.
    +#if HAVE_GNU_EXT_HASH_SET
    +# include 
    +# ifndef HASH_NAMESPACE
    +#  define HASH_NAMESPACE __gnu_cxx
    +# endif
    +
    +// GCC 3.0.x puts hash_set in  and in the std namespace.
    +#elif HAVE_STD_EXT_HASH_SET
    +# include 
    +# ifndef HASH_NAMESPACE
    +#  define HASH_NAMESPACE std
    +# endif
    +
    +// Older compilers such as GCC before version 3.0 do not keep
    +// extensions in the `ext' directory, and ignore the `std' namespace.
    +#elif HAVE_GLOBAL_HASH_SET
    +# include 
    +# ifndef HASH_NAMESPACE
    +#  define HASH_NAMESPACE std
    +# endif
    +
    +// HP aCC doesn't include an SGI-like hash_set. For this platform (or
    +// any others using Rogue Wave Software's Tools.h++ library), we wrap
    +// around them in std::
    +#elif HAVE_RW_STDEX_HASH_SET_H
    +# include 
    +# ifndef HASH_NAMESPACE
    +#  define HASH_NAMESPACE std
    +# endif
    +
    +// Support Microsoft VC++.
    +#elif defined(_MSC_VER)
    +# include 
    +# ifndef HASH_NAMESPACE
    +#  define HASH_NAMESPACE stdext
    +# endif
    +
    +// Give a warning if we couldn't find it, instead of (or in addition to)
    +// randomly doing something dumb.
    +#else
    +# warning "Autoconfiguration failed to find the hash_set header file."
    +#endif
    +
    +// we wrap Rogue Wave Tools.h++ rw_hashset into something SGI-looking, here:
    +#ifdef HAVE_RW_STDEX_HASH_SET_H
    +namespace HASH_NAMESPACE {
    +
    +/*
    +template  struct hash {
    +    unsigned int operator()(const unsigned int& x) const {
    +      return x;
    +    }
    +};
    +*/
    +
    +template ,
    +  class _EqualKey = equal_to,
    +  class _A = allocator  >
    +class hash_set : 
    +  public rw_hashset {
    +};
    +
    +} // end HASH_NAMESPACE;
    +#endif
    +
    +using HASH_NAMESPACE::hash_set;
    +
    +// Include vector because ext/hash_set includes stl_vector.h and leaves
    +// out specializations like stl_bvector.h, causing link conflicts.
    +#include 
    +
    +#include "llvm/ADT/HashExtras.h"
    +
    +#endif // LLVM_ADT_HASH_SET_H
    
    Removed: llvm/branches/non-call-eh/include/llvm/ADT/hash_set.in
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/hash_set.in?rev=53162&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/hash_set.in (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/hash_set.in (removed)
    @@ -1,111 +0,0 @@
    -//===-- llvm/ADT/hash_set - "Portable" wrapper around hash_set --*- C++ -*-===//
    -// 
    -//                     The LLVM Compiler Infrastructure
    -//
    -// This file is distributed under the University of Illinois Open Source
    -// License. See LICENSE.TXT for details.
    -// 
    -//===----------------------------------------------------------------------===//
    -// vim:ft=cpp
    -//
    -// This file provides a wrapper around the mysterious  header file
    -// that seems to move around between GCC releases into and out of namespaces at
    -// will.  #including this header will cause hash_set to be available in the
    -// global namespace.
    -//
    -//===----------------------------------------------------------------------===//
    -
    -#ifndef LLVM_ADT_HASH_SET
    -#define LLVM_ADT_HASH_SET
    -
    -// Compiler Support Matrix
    -//
    -// Version   Namespace   Header File
    -//  2.95.x       ::        hash_set
    -//  3.0.4       std      ext/hash_set
    -//  3.1      __gnu_cxx   ext/hash_set
    -//  HP aCC6     std      stdex/rw/hashset.h
    -//  MS VC++    stdext      hash_set
    -
    -#undef HAVE_GNU_EXT_HASH_SET
    -#undef HAVE_STD_EXT_HASH_SET
    -#undef HAVE_GLOBAL_HASH_SET
    -#undef HAVE_RW_STDEX_HASH_SET_H
    -
    -// GCC versions 3.1 and later put hash_set in  and in
    -// the __gnu_cxx namespace.
    -#if HAVE_GNU_EXT_HASH_SET
    -# include 
    -# ifndef HASH_NAMESPACE
    -#  define HASH_NAMESPACE __gnu_cxx
    -# endif
    -
    -// GCC 3.0.x puts hash_set in  and in the std namespace.
    -#elif HAVE_STD_EXT_HASH_SET
    -# include 
    -# ifndef HASH_NAMESPACE
    -#  define HASH_NAMESPACE std
    -# endif
    -
    -// Older compilers such as GCC before version 3.0 do not keep
    -// extensions in the `ext' directory, and ignore the `std' namespace.
    -#elif HAVE_GLOBAL_HASH_SET
    -# include 
    -# ifndef HASH_NAMESPACE
    -#  define HASH_NAMESPACE std
    -# endif
    -
    -// HP aCC doesn't include an SGI-like hash_set. For this platform (or
    -// any others using Rogue Wave Software's Tools.h++ library), we wrap
    -// around them in std::
    -#elif HAVE_RW_STDEX_HASH_SET_H
    -# include 
    -# ifndef HASH_NAMESPACE
    -#  define HASH_NAMESPACE std
    -# endif
    -
    -// Support Microsoft VC++.
    -#elif defined(_MSC_VER)
    -# include 
    -# ifndef HASH_NAMESPACE
    -#  define HASH_NAMESPACE stdext
    -# endif
    -
    -// Give a warning if we couldn't find it, instead of (or in addition to)
    -// randomly doing something dumb.
    -#else
    -# warning "Autoconfiguration failed to find the hash_set header file."
    -#endif
    -
    -// we wrap Rogue Wave Tools.h++ rw_hashset into something SGI-looking, here:
    -#ifdef HAVE_RW_STDEX_HASH_SET_H
    -namespace HASH_NAMESPACE {
    -
    -/*
    -template  struct hash {
    -    unsigned int operator()(const unsigned int& x) const {
    -      return x;
    -    }
    -};
    -*/
    -
    -template ,
    -  class _EqualKey = equal_to,
    -  class _A = allocator  >
    -class hash_set : 
    -  public rw_hashset {
    -};
    -
    -} // end HASH_NAMESPACE;
    -#endif
    -
    -using HASH_NAMESPACE::hash_set;
    -
    -// Include vector because ext/hash_set includes stl_vector.h and leaves
    -// out specializations like stl_bvector.h, causing link conflicts.
    -#include 
    -
    -#include "llvm/ADT/HashExtras.h"
    -
    -#endif
    
    Removed: llvm/branches/non-call-eh/include/llvm/ADT/ilist
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/ilist?rev=53162&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/ilist (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/ilist (removed)
    @@ -1,634 +0,0 @@
    -//===-- llvm/ADT/ilist - Intrusive Linked List Template ---------*- C++ -*-===//
    -// 
    -//                     The LLVM Compiler Infrastructure
    -//
    -// This file is distributed under the University of Illinois Open Source
    -// License. See LICENSE.TXT for details.
    -// 
    -//===----------------------------------------------------------------------===//
    -//
    -// This file defines classes to implement an intrusive doubly linked list class
    -// (i.e. each node of the list must contain a next and previous field for the
    -// list.
    -//
    -// The ilist_traits trait class is used to gain access to the next and previous
    -// fields of the node type that the list is instantiated with.  If it is not
    -// specialized, the list defaults to using the getPrev(), getNext() method calls
    -// to get the next and previous pointers.
    -//
    -// The ilist class itself, should be a plug in replacement for list, assuming
    -// that the nodes contain next/prev pointers.  This list replacement does not
    -// provides a constant time size() method, so be careful to use empty() when you
    -// really want to know if it's empty.
    -//
    -// The ilist class is implemented by allocating a 'tail' node when the list is
    -// created (using ilist_traits<>::createSentinel()).  This tail node is
    -// absolutely required because the user must be able to compute end()-1. Because
    -// of this, users of the direct next/prev links will see an extra link on the
    -// end of the list, which should be ignored.
    -//
    -// Requirements for a user of this list:
    -//
    -//   1. The user must provide {g|s}et{Next|Prev} methods, or specialize
    -//      ilist_traits to provide an alternate way of getting and setting next and
    -//      prev links.
    -//
    -//===----------------------------------------------------------------------===//
    -
    -#ifndef LLVM_ADT_ILIST
    -#define LLVM_ADT_ILIST
    -
    -#include "llvm/ADT/iterator"
    -#include 
    -#include 
    -
    -namespace llvm {
    -
    -template class iplist;
    -template class ilist_iterator;
    -
    -// Template traits for intrusive list.  By specializing this template class, you
    -// can change what next/prev fields are used to store the links...
    -template
    -struct ilist_traits {
    -  static NodeTy *getPrev(NodeTy *N) { return N->getPrev(); }
    -  static NodeTy *getNext(NodeTy *N) { return N->getNext(); }
    -  static const NodeTy *getPrev(const NodeTy *N) { return N->getPrev(); }
    -  static const NodeTy *getNext(const NodeTy *N) { return N->getNext(); }
    -
    -  static void setPrev(NodeTy *N, NodeTy *Prev) { N->setPrev(Prev); }
    -  static void setNext(NodeTy *N, NodeTy *Next) { N->setNext(Next); }
    -
    -  static NodeTy *createNode(const NodeTy &V) { return new NodeTy(V); }
    -
    -  static NodeTy *createSentinel() { return new NodeTy(); }
    -  static void destroySentinel(NodeTy *N) { delete N; }
    -
    -  void addNodeToList(NodeTy *NTy) {}
    -  void removeNodeFromList(NodeTy *NTy) {}
    -  void transferNodesFromList(iplist &L2,
    -                             ilist_iterator first,
    -                             ilist_iterator last) {}
    -};
    -
    -// Const traits are the same as nonconst traits...
    -template
    -struct ilist_traits : public ilist_traits {};
    -
    -
    -//===----------------------------------------------------------------------===//
    -// ilist_iterator - Iterator for intrusive list.
    -//
    -template
    -class ilist_iterator
    -  : public bidirectional_iterator {
    -  typedef ilist_traits Traits;
    -  typedef bidirectional_iterator super;
    -
    -public:
    -  typedef size_t size_type;
    -  typedef typename super::pointer pointer;
    -  typedef typename super::reference reference;
    -private:
    -  pointer NodePtr;
    -public:
    -
    -  ilist_iterator(pointer NP) : NodePtr(NP) {}
    -  ilist_iterator(reference NR) : NodePtr(&NR) {}
    -  ilist_iterator() : NodePtr(0) {}
    -
    -  // This is templated so that we can allow constructing a const iterator from
    -  // a nonconst iterator...
    -  template
    -  ilist_iterator(const ilist_iterator &RHS)
    -    : NodePtr(RHS.getNodePtrUnchecked()) {}
    -
    -  // This is templated so that we can allow assigning to a const iterator from
    -  // a nonconst iterator...
    -  template
    -  const ilist_iterator &operator=(const ilist_iterator &RHS) {
    -    NodePtr = RHS.getNodePtrUnchecked();
    -    return *this;
    -  }
    -
    -  // Accessors...
    -  operator pointer() const {
    -    assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!");
    -    return NodePtr;
    -  }
    -
    -  reference operator*() const {
    -    assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!");
    -    return *NodePtr;
    -  }
    -  pointer operator->() { return &operator*(); }
    -  const pointer operator->() const { return &operator*(); }
    -
    -  // Comparison operators
    -  bool operator==(const ilist_iterator &RHS) const {
    -    return NodePtr == RHS.NodePtr;
    -  }
    -  bool operator!=(const ilist_iterator &RHS) const {
    -    return NodePtr != RHS.NodePtr;
    -  }
    -
    -  // Increment and decrement operators...
    -  ilist_iterator &operator--() {      // predecrement - Back up
    -    NodePtr = Traits::getPrev(NodePtr);
    -    assert(Traits::getNext(NodePtr) && "--'d off the beginning of an ilist!");
    -    return *this;
    -  }
    -  ilist_iterator &operator++() {      // preincrement - Advance
    -    NodePtr = Traits::getNext(NodePtr);
    -    assert(NodePtr && "++'d off the end of an ilist!");
    -    return *this;
    -  }
    -  ilist_iterator operator--(int) {    // postdecrement operators...
    -    ilist_iterator tmp = *this;
    -    --*this;
    -    return tmp;
    -  }
    -  ilist_iterator operator++(int) {    // postincrement operators...
    -    ilist_iterator tmp = *this;
    -    ++*this;
    -    return tmp;
    -  }
    -
    -  // Internal interface, do not use...
    -  pointer getNodePtrUnchecked() const { return NodePtr; }
    -};
    -
    -// do not implement. this is to catch errors when people try to use
    -// them as random access iterators
    -template
    -void operator-(int, ilist_iterator);
    -template
    -void operator-(ilist_iterator,int);
    -
    -template
    -void operator+(int, ilist_iterator);
    -template
    -void operator+(ilist_iterator,int);
    -
    -// operator!=/operator== - Allow mixed comparisons without dereferencing
    -// the iterator, which could very likely be pointing to end().
    -template
    -bool operator!=(const T* LHS, const ilist_iterator &RHS) {
    -  return LHS != RHS.getNodePtrUnchecked();
    -}
    -template
    -bool operator==(const T* LHS, const ilist_iterator &RHS) {
    -  return LHS == RHS.getNodePtrUnchecked();
    -}
    -template
    -bool operator!=(T* LHS, const ilist_iterator &RHS) {
    -  return LHS != RHS.getNodePtrUnchecked();
    -}
    -template
    -bool operator==(T* LHS, const ilist_iterator &RHS) {
    -  return LHS == RHS.getNodePtrUnchecked();
    -}
    -
    -
    -// Allow ilist_iterators to convert into pointers to a node automatically when
    -// used by the dyn_cast, cast, isa mechanisms...
    -
    -template struct simplify_type;
    -
    -template struct simplify_type > {
    -  typedef NodeTy* SimpleType;
    -  
    -  static SimpleType getSimplifiedValue(const ilist_iterator &Node) {
    -    return &*Node;
    -  }
    -};
    -template struct simplify_type > {
    -  typedef NodeTy* SimpleType;
    -  
    -  static SimpleType getSimplifiedValue(const ilist_iterator &Node) {
    -    return &*Node;
    -  }
    -};
    -
    -
    -//===----------------------------------------------------------------------===//
    -//
    -/// iplist - The subset of list functionality that can safely be used on nodes
    -/// of polymorphic types, i.e. a heterogenous list with a common base class that
    -/// holds the next/prev pointers.  The only state of the list itself is a single
    -/// pointer to the head of the list.
    -///
    -/// This list can be in one of three interesting states:
    -/// 1. The list may be completely unconstructed.  In this case, the head
    -///    pointer is null.  When in this form, any query for an iterator (e.g.
    -///    begin() or end()) causes the list to transparently change to state #2.
    -/// 2. The list may be empty, but contain a sentinal for the end iterator. This
    -///    sentinal is created by the Traits::createSentinel method and is a link
    -///    in the list.  When the list is empty, the pointer in the iplist points
    -///    to the sentinal.  Once the sentinal is constructed, it
    -///    is not destroyed until the list is.
    -/// 3. The list may contain actual objects in it, which are stored as a doubly
    -///    linked list of nodes.  One invariant of the list is that the predecessor
    -///    of the first node in the list always points to the last node in the list,
    -///    and the successor pointer for the sentinal (which always stays at the
    -///    end of the list) is always null.  
    -///
    -template >
    -class iplist : public Traits {
    -  mutable NodeTy *Head;
    -
    -  // Use the prev node pointer of 'head' as the tail pointer.  This is really a
    -  // circularly linked list where we snip the 'next' link from the sentinel node
    -  // back to the first node in the list (to preserve assertions about going off
    -  // the end of the list).
    -  NodeTy *getTail() { return getPrev(Head); }
    -  const NodeTy *getTail() const { return getPrev(Head); }
    -  void setTail(NodeTy *N) const { setPrev(Head, N); }
    -  
    -  /// CreateLazySentinal - This method verifies whether the sentinal for the
    -  /// list has been created and lazily makes it if not.
    -  void CreateLazySentinal() const {
    -    if (Head != 0) return;
    -    Head = Traits::createSentinel();
    -    setNext(Head, 0);
    -    setTail(Head);
    -  }
    -
    -  static bool op_less(NodeTy &L, NodeTy &R) { return L < R; }
    -  static bool op_equal(NodeTy &L, NodeTy &R) { return L == R; }
    -public:
    -  typedef NodeTy *pointer;
    -  typedef const NodeTy *const_pointer;
    -  typedef NodeTy &reference;
    -  typedef const NodeTy &const_reference;
    -  typedef NodeTy value_type;
    -  typedef ilist_iterator iterator;
    -  typedef ilist_iterator const_iterator;
    -  typedef size_t size_type;
    -  typedef ptrdiff_t difference_type;
    -  typedef std::reverse_iterator  const_reverse_iterator;
    -  typedef std::reverse_iterator  reverse_iterator;
    -
    -  iplist() : Head(0) {}
    -  ~iplist() {
    -    if (!Head) return;
    -    clear();
    -    Traits::destroySentinel(getTail());
    -  }
    -
    -  // Iterator creation methods.
    -  iterator begin() {
    -    CreateLazySentinal(); 
    -    return iterator(Head); 
    -  }
    -  const_iterator begin() const {
    -    CreateLazySentinal();
    -    return const_iterator(Head);
    -  }
    -  iterator end() {
    -    CreateLazySentinal();
    -    return iterator(getTail());
    -  }
    -  const_iterator end() const {
    -    CreateLazySentinal();
    -    return const_iterator(getTail());
    -  }
    -
    -  // reverse iterator creation methods.
    -  reverse_iterator rbegin()            { return reverse_iterator(end()); }
    -  const_reverse_iterator rbegin() const{ return const_reverse_iterator(end()); }
    -  reverse_iterator rend()              { return reverse_iterator(begin()); }
    -  const_reverse_iterator rend() const { return const_reverse_iterator(begin());}
    -
    -
    -  // Miscellaneous inspection routines.
    -  size_type max_size() const { return size_type(-1); }
    -  bool empty() const { return Head == 0 || Head == getTail(); }
    -
    -  // Front and back accessor functions...
    -  reference front() {
    -    assert(!empty() && "Called front() on empty list!");
    -    return *Head;
    -  }
    -  const_reference front() const {
    -    assert(!empty() && "Called front() on empty list!");
    -    return *Head;
    -  }
    -  reference back() {
    -    assert(!empty() && "Called back() on empty list!");
    -    return *getPrev(getTail());
    -  }
    -  const_reference back() const {
    -    assert(!empty() && "Called back() on empty list!");
    -    return *getPrev(getTail());
    -  }
    -
    -  void swap(iplist &RHS) {
    -    abort();     // Swap does not use list traits callback correctly yet!
    -    std::swap(Head, RHS.Head);
    -  }
    -
    -  iterator insert(iterator where, NodeTy *New) {
    -    NodeTy *CurNode = where.getNodePtrUnchecked(), *PrevNode = getPrev(CurNode);
    -    setNext(New, CurNode);
    -    setPrev(New, PrevNode);
    -
    -    if (CurNode != Head)  // Is PrevNode off the beginning of the list?
    -      setNext(PrevNode, New);
    -    else
    -      Head = New;
    -    setPrev(CurNode, New);
    -
    -    addNodeToList(New);  // Notify traits that we added a node...
    -    return New;
    -  }
    -
    -  NodeTy *remove(iterator &IT) {
    -    assert(IT != end() && "Cannot remove end of list!");
    -    NodeTy *Node = &*IT;
    -    NodeTy *NextNode = getNext(Node);
    -    NodeTy *PrevNode = getPrev(Node);
    -
    -    if (Node != Head)  // Is PrevNode off the beginning of the list?
    -      setNext(PrevNode, NextNode);
    -    else
    -      Head = NextNode;
    -    setPrev(NextNode, PrevNode);
    -    IT = NextNode;
    -    removeNodeFromList(Node);  // Notify traits that we removed a node...
    -    
    -    // Set the next/prev pointers of the current node to null.  This isn't
    -    // strictly required, but this catches errors where a node is removed from
    -    // an ilist (and potentially deleted) with iterators still pointing at it.
    -    // When those iterators are incremented or decremented, they will assert on
    -    // the null next/prev pointer instead of "usually working".
    -    setNext(Node, 0);
    -    setPrev(Node, 0);
    -    return Node;
    -  }
    -
    -  NodeTy *remove(const iterator &IT) {
    -    iterator MutIt = IT;
    -    return remove(MutIt);
    -  }
    -
    -  // erase - remove a node from the controlled sequence... and delete it.
    -  iterator erase(iterator where) {
    -    delete remove(where);
    -    return where;
    -  }
    -
    -
    -private:
    -  // transfer - The heart of the splice function.  Move linked list nodes from
    -  // [first, last) into position.
    -  //
    -  void transfer(iterator position, iplist &L2, iterator first, iterator last) {
    -    assert(first != last && "Should be checked by callers");
    -
    -    if (position != last) {
    -      // Note: we have to be careful about the case when we move the first node
    -      // in the list.  This node is the list sentinel node and we can't move it.
    -      NodeTy *ThisSentinel = getTail();
    -      setTail(0);
    -      NodeTy *L2Sentinel = L2.getTail();
    -      L2.setTail(0);
    -
    -      // Remove [first, last) from its old position.
    -      NodeTy *First = &*first, *Prev = getPrev(First);
    -      NodeTy *Next = last.getNodePtrUnchecked(), *Last = getPrev(Next);
    -      if (Prev)
    -        setNext(Prev, Next);
    -      else
    -        L2.Head = Next;
    -      setPrev(Next, Prev);
    -
    -      // Splice [first, last) into its new position.
    -      NodeTy *PosNext = position.getNodePtrUnchecked();
    -      NodeTy *PosPrev = getPrev(PosNext);
    -
    -      // Fix head of list...
    -      if (PosPrev)
    -        setNext(PosPrev, First);
    -      else
    -        Head = First;
    -      setPrev(First, PosPrev);
    -
    -      // Fix end of list...
    -      setNext(Last, PosNext);
    -      setPrev(PosNext, Last);
    -
    -      transferNodesFromList(L2, First, PosNext);
    -
    -      // Now that everything is set, restore the pointers to the list sentinals.
    -      L2.setTail(L2Sentinel);
    -      setTail(ThisSentinel);
    -    }
    -  }
    -
    -public:
    -
    -  //===----------------------------------------------------------------------===
    -  // Functionality derived from other functions defined above...
    -  //
    -
    -  size_type size() const {
    -    if (Head == 0) return 0; // Don't require construction of sentinal if empty.
    -#if __GNUC__ == 2
    -    // GCC 2.95 has a broken std::distance
    -    size_type Result = 0;
    -    std::distance(begin(), end(), Result);
    -    return Result;
    -#else
    -    return std::distance(begin(), end());
    -#endif
    -  }
    -
    -  iterator erase(iterator first, iterator last) {
    -    while (first != last)
    -      first = erase(first);
    -    return last;
    -  }
    -
    -  void clear() { if (Head) erase(begin(), end()); }
    -
    -  // Front and back inserters...
    -  void push_front(NodeTy *val) { insert(begin(), val); }
    -  void push_back(NodeTy *val) { insert(end(), val); }
    -  void pop_front() {
    -    assert(!empty() && "pop_front() on empty list!");
    -    erase(begin());
    -  }
    -  void pop_back() {
    -    assert(!empty() && "pop_back() on empty list!");
    -    iterator t = end(); erase(--t);
    -  }
    -
    -  // Special forms of insert...
    -  template void insert(iterator where, InIt first, InIt last) {
    -    for (; first != last; ++first) insert(where, *first);
    -  }
    -
    -  // Splice members - defined in terms of transfer...
    -  void splice(iterator where, iplist &L2) {
    -    if (!L2.empty())
    -      transfer(where, L2, L2.begin(), L2.end());
    -  }
    -  void splice(iterator where, iplist &L2, iterator first) {
    -    iterator last = first; ++last;
    -    if (where == first || where == last) return; // No change
    -    transfer(where, L2, first, last);
    -  }
    -  void splice(iterator where, iplist &L2, iterator first, iterator last) {
    -    if (first != last) transfer(where, L2, first, last);
    -  }
    -
    -
    -
    -  //===----------------------------------------------------------------------===
    -  // High-Level Functionality that shouldn't really be here, but is part of list
    -  //
    -
    -  // These two functions are actually called remove/remove_if in list<>, but
    -  // they actually do the job of erase, rename them accordingly.
    -  //
    -  void erase(const NodeTy &val) {
    -    for (iterator I = begin(), E = end(); I != E; ) {
    -      iterator next = I; ++next;
    -      if (*I == val) erase(I);
    -      I = next;
    -    }
    -  }
    -  template void erase_if(Pr1 pred) {
    -    for (iterator I = begin(), E = end(); I != E; ) {
    -      iterator next = I; ++next;
    -      if (pred(*I)) erase(I);
    -      I = next;
    -    }
    -  }
    -
    -  template void unique(Pr2 pred) {
    -    if (empty()) return;
    -    for (iterator I = begin(), E = end(), Next = begin(); ++Next != E;) {
    -      if (pred(*I))
    -        erase(Next);
    -      else
    -        I = Next;
    -      Next = I;
    -    }
    -  }
    -  void unique() { unique(op_equal); }
    -
    -  template void merge(iplist &right, Pr3 pred) {
    -    iterator first1 = begin(), last1 = end();
    -    iterator first2 = right.begin(), last2 = right.end();
    -    while (first1 != last1 && first2 != last2)
    -      if (pred(*first2, *first1)) {
    -        iterator next = first2;
    -        transfer(first1, right, first2, ++next);
    -        first2 = next;
    -      } else {
    -        ++first1;
    -      }
    -    if (first2 != last2) transfer(last1, right, first2, last2);
    -  }
    -  void merge(iplist &right) { return merge(right, op_less); }
    -
    -  template void sort(Pr3 pred);
    -  void sort() { sort(op_less); }
    -  void reverse();
    -};
    -
    -
    -template
    -struct ilist : public iplist {
    -  typedef typename iplist::size_type size_type;
    -  typedef typename iplist::iterator iterator;
    -
    -  ilist() {}
    -  ilist(const ilist &right) {
    -    insert(this->begin(), right.begin(), right.end());
    -  }
    -  explicit ilist(size_type count) {
    -    insert(this->begin(), count, NodeTy());
    -  } 
    -  ilist(size_type count, const NodeTy &val) {
    -    insert(this->begin(), count, val);
    -  }
    -  template ilist(InIt first, InIt last) {
    -    insert(this->begin(), first, last);
    -  }
    -
    -
    -  // Forwarding functions: A workaround for GCC 2.95 which does not correctly
    -  // support 'using' declarations to bring a hidden member into scope.
    -  //
    -  iterator insert(iterator a, NodeTy *b){ return iplist::insert(a, b); }
    -  void push_front(NodeTy *a) { iplist::push_front(a); }
    -  void push_back(NodeTy *a)  { iplist::push_back(a); }
    -  
    -
    -  // Main implementation here - Insert for a node passed by value...
    -  iterator insert(iterator where, const NodeTy &val) {
    -    return insert(where, createNode(val));
    -  }
    -
    -
    -  // Front and back inserters...
    -  void push_front(const NodeTy &val) { insert(this->begin(), val); }
    -  void push_back(const NodeTy &val) { insert(this->end(), val); }
    -
    -  // Special forms of insert...
    -  template void insert(iterator where, InIt first, InIt last) {
    -    for (; first != last; ++first) insert(where, *first);
    -  }
    -  void insert(iterator where, size_type count, const NodeTy &val) {
    -    for (; count != 0; --count) insert(where, val);
    -  }
    -
    -  // Assign special forms...
    -  void assign(size_type count, const NodeTy &val) {
    -    iterator I = this->begin();
    -    for (; I != this->end() && count != 0; ++I, --count)
    -      *I = val;
    -    if (count != 0)
    -      insert(this->end(), val, val);
    -    else
    -      erase(I, this->end());
    -  }
    -  template void assign(InIt first1, InIt last1) {
    -    iterator first2 = this->begin(), last2 = this->end();
    -    for ( ; first1 != last1 && first2 != last2; ++first1, ++first2)
    -      *first1 = *first2;
    -    if (first2 == last2)
    -      erase(first1, last1);
    -    else
    -      insert(last1, first2, last2);
    -  }
    -
    -
    -  // Resize members...
    -  void resize(size_type newsize, NodeTy val) {
    -    iterator i = this->begin();
    -    size_type len = 0;
    -    for ( ; i != this->end() && len < newsize; ++i, ++len) /* empty*/ ;
    -
    -    if (len == newsize)
    -      erase(i, this->end());
    -    else                                          // i == end()
    -      insert(this->end(), newsize - len, val);
    -  }
    -  void resize(size_type newsize) { resize(newsize, NodeTy()); }
    -};
    -
    -} // End llvm namespace
    -
    -namespace std {
    -  // Ensure that swap uses the fast list swap...
    -  template
    -  void swap(llvm::iplist &Left, llvm::iplist &Right) {
    -    Left.swap(Right);
    -  }
    -}  // End 'std' extensions...
    -
    -#endif
    
    Added: llvm/branches/non-call-eh/include/llvm/ADT/ilist.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/ilist.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/ilist.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/ilist.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,634 @@
    +//==-- llvm/ADT/ilist.h - Intrusive Linked List Template ---------*- C++ -*-==//
    +// 
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +// 
    +//===----------------------------------------------------------------------===//
    +//
    +// This file defines classes to implement an intrusive doubly linked list class
    +// (i.e. each node of the list must contain a next and previous field for the
    +// list.
    +//
    +// The ilist_traits trait class is used to gain access to the next and previous
    +// fields of the node type that the list is instantiated with.  If it is not
    +// specialized, the list defaults to using the getPrev(), getNext() method calls
    +// to get the next and previous pointers.
    +//
    +// The ilist class itself, should be a plug in replacement for list, assuming
    +// that the nodes contain next/prev pointers.  This list replacement does not
    +// provide a constant time size() method, so be careful to use empty() when you
    +// really want to know if it's empty.
    +//
    +// The ilist class is implemented by allocating a 'tail' node when the list is
    +// created (using ilist_traits<>::createSentinel()).  This tail node is
    +// absolutely required because the user must be able to compute end()-1. Because
    +// of this, users of the direct next/prev links will see an extra link on the
    +// end of the list, which should be ignored.
    +//
    +// Requirements for a user of this list:
    +//
    +//   1. The user must provide {g|s}et{Next|Prev} methods, or specialize
    +//      ilist_traits to provide an alternate way of getting and setting next and
    +//      prev links.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ADT_ILIST_H
    +#define LLVM_ADT_ILIST_H
    +
    +#include "llvm/ADT/iterator.h"
    +#include 
    +#include 
    +
    +namespace llvm {
    +
    +template class iplist;
    +template class ilist_iterator;
    +
    +// Template traits for intrusive list.  By specializing this template class, you
    +// can change what next/prev fields are used to store the links...
    +template
    +struct ilist_traits {
    +  static NodeTy *getPrev(NodeTy *N) { return N->getPrev(); }
    +  static NodeTy *getNext(NodeTy *N) { return N->getNext(); }
    +  static const NodeTy *getPrev(const NodeTy *N) { return N->getPrev(); }
    +  static const NodeTy *getNext(const NodeTy *N) { return N->getNext(); }
    +
    +  static void setPrev(NodeTy *N, NodeTy *Prev) { N->setPrev(Prev); }
    +  static void setNext(NodeTy *N, NodeTy *Next) { N->setNext(Next); }
    +
    +  static NodeTy *createNode(const NodeTy &V) { return new NodeTy(V); }
    +
    +  static NodeTy *createSentinel() { return new NodeTy(); }
    +  static void destroySentinel(NodeTy *N) { delete N; }
    +
    +  void addNodeToList(NodeTy *NTy) {}
    +  void removeNodeFromList(NodeTy *NTy) {}
    +  void transferNodesFromList(iplist &L2,
    +                             ilist_iterator first,
    +                             ilist_iterator last) {}
    +};
    +
    +// Const traits are the same as nonconst traits...
    +template
    +struct ilist_traits : public ilist_traits {};
    +
    +
    +//===----------------------------------------------------------------------===//
    +// ilist_iterator - Iterator for intrusive list.
    +//
    +template
    +class ilist_iterator
    +  : public bidirectional_iterator {
    +  typedef ilist_traits Traits;
    +  typedef bidirectional_iterator super;
    +
    +public:
    +  typedef size_t size_type;
    +  typedef typename super::pointer pointer;
    +  typedef typename super::reference reference;
    +private:
    +  pointer NodePtr;
    +public:
    +
    +  ilist_iterator(pointer NP) : NodePtr(NP) {}
    +  ilist_iterator(reference NR) : NodePtr(&NR) {}
    +  ilist_iterator() : NodePtr(0) {}
    +
    +  // This is templated so that we can allow constructing a const iterator from
    +  // a nonconst iterator...
    +  template
    +  ilist_iterator(const ilist_iterator &RHS)
    +    : NodePtr(RHS.getNodePtrUnchecked()) {}
    +
    +  // This is templated so that we can allow assigning to a const iterator from
    +  // a nonconst iterator...
    +  template
    +  const ilist_iterator &operator=(const ilist_iterator &RHS) {
    +    NodePtr = RHS.getNodePtrUnchecked();
    +    return *this;
    +  }
    +
    +  // Accessors...
    +  operator pointer() const {
    +    assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!");
    +    return NodePtr;
    +  }
    +
    +  reference operator*() const {
    +    assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!");
    +    return *NodePtr;
    +  }
    +  pointer operator->() { return &operator*(); }
    +  const pointer operator->() const { return &operator*(); }
    +
    +  // Comparison operators
    +  bool operator==(const ilist_iterator &RHS) const {
    +    return NodePtr == RHS.NodePtr;
    +  }
    +  bool operator!=(const ilist_iterator &RHS) const {
    +    return NodePtr != RHS.NodePtr;
    +  }
    +
    +  // Increment and decrement operators...
    +  ilist_iterator &operator--() {      // predecrement - Back up
    +    NodePtr = Traits::getPrev(NodePtr);
    +    assert(Traits::getNext(NodePtr) && "--'d off the beginning of an ilist!");
    +    return *this;
    +  }
    +  ilist_iterator &operator++() {      // preincrement - Advance
    +    NodePtr = Traits::getNext(NodePtr);
    +    assert(NodePtr && "++'d off the end of an ilist!");
    +    return *this;
    +  }
    +  ilist_iterator operator--(int) {    // postdecrement operators...
    +    ilist_iterator tmp = *this;
    +    --*this;
    +    return tmp;
    +  }
    +  ilist_iterator operator++(int) {    // postincrement operators...
    +    ilist_iterator tmp = *this;
    +    ++*this;
    +    return tmp;
    +  }
    +
    +  // Internal interface, do not use...
    +  pointer getNodePtrUnchecked() const { return NodePtr; }
    +};
    +
    +// do not implement. this is to catch errors when people try to use
    +// them as random access iterators
    +template
    +void operator-(int, ilist_iterator);
    +template
    +void operator-(ilist_iterator,int);
    +
    +template
    +void operator+(int, ilist_iterator);
    +template
    +void operator+(ilist_iterator,int);
    +
    +// operator!=/operator== - Allow mixed comparisons without dereferencing
    +// the iterator, which could very likely be pointing to end().
    +template
    +bool operator!=(const T* LHS, const ilist_iterator &RHS) {
    +  return LHS != RHS.getNodePtrUnchecked();
    +}
    +template
    +bool operator==(const T* LHS, const ilist_iterator &RHS) {
    +  return LHS == RHS.getNodePtrUnchecked();
    +}
    +template
    +bool operator!=(T* LHS, const ilist_iterator &RHS) {
    +  return LHS != RHS.getNodePtrUnchecked();
    +}
    +template
    +bool operator==(T* LHS, const ilist_iterator &RHS) {
    +  return LHS == RHS.getNodePtrUnchecked();
    +}
    +
    +
    +// Allow ilist_iterators to convert into pointers to a node automatically when
    +// used by the dyn_cast, cast, isa mechanisms...
    +
    +template struct simplify_type;
    +
    +template struct simplify_type > {
    +  typedef NodeTy* SimpleType;
    +  
    +  static SimpleType getSimplifiedValue(const ilist_iterator &Node) {
    +    return &*Node;
    +  }
    +};
    +template struct simplify_type > {
    +  typedef NodeTy* SimpleType;
    +  
    +  static SimpleType getSimplifiedValue(const ilist_iterator &Node) {
    +    return &*Node;
    +  }
    +};
    +
    +
    +//===----------------------------------------------------------------------===//
    +//
    +/// iplist - The subset of list functionality that can safely be used on nodes
    +/// of polymorphic types, i.e. a heterogenous list with a common base class that
    +/// holds the next/prev pointers.  The only state of the list itself is a single
    +/// pointer to the head of the list.
    +///
    +/// This list can be in one of three interesting states:
    +/// 1. The list may be completely unconstructed.  In this case, the head
    +///    pointer is null.  When in this form, any query for an iterator (e.g.
    +///    begin() or end()) causes the list to transparently change to state #2.
    +/// 2. The list may be empty, but contain a sentinal for the end iterator. This
    +///    sentinal is created by the Traits::createSentinel method and is a link
    +///    in the list.  When the list is empty, the pointer in the iplist points
    +///    to the sentinal.  Once the sentinal is constructed, it
    +///    is not destroyed until the list is.
    +/// 3. The list may contain actual objects in it, which are stored as a doubly
    +///    linked list of nodes.  One invariant of the list is that the predecessor
    +///    of the first node in the list always points to the last node in the list,
    +///    and the successor pointer for the sentinal (which always stays at the
    +///    end of the list) is always null.  
    +///
    +template >
    +class iplist : public Traits {
    +  mutable NodeTy *Head;
    +
    +  // Use the prev node pointer of 'head' as the tail pointer.  This is really a
    +  // circularly linked list where we snip the 'next' link from the sentinel node
    +  // back to the first node in the list (to preserve assertions about going off
    +  // the end of the list).
    +  NodeTy *getTail() { return getPrev(Head); }
    +  const NodeTy *getTail() const { return getPrev(Head); }
    +  void setTail(NodeTy *N) const { setPrev(Head, N); }
    +  
    +  /// CreateLazySentinal - This method verifies whether the sentinal for the
    +  /// list has been created and lazily makes it if not.
    +  void CreateLazySentinal() const {
    +    if (Head != 0) return;
    +    Head = Traits::createSentinel();
    +    setNext(Head, 0);
    +    setTail(Head);
    +  }
    +
    +  static bool op_less(NodeTy &L, NodeTy &R) { return L < R; }
    +  static bool op_equal(NodeTy &L, NodeTy &R) { return L == R; }
    +public:
    +  typedef NodeTy *pointer;
    +  typedef const NodeTy *const_pointer;
    +  typedef NodeTy &reference;
    +  typedef const NodeTy &const_reference;
    +  typedef NodeTy value_type;
    +  typedef ilist_iterator iterator;
    +  typedef ilist_iterator const_iterator;
    +  typedef size_t size_type;
    +  typedef ptrdiff_t difference_type;
    +  typedef std::reverse_iterator  const_reverse_iterator;
    +  typedef std::reverse_iterator  reverse_iterator;
    +
    +  iplist() : Head(0) {}
    +  ~iplist() {
    +    if (!Head) return;
    +    clear();
    +    Traits::destroySentinel(getTail());
    +  }
    +
    +  // Iterator creation methods.
    +  iterator begin() {
    +    CreateLazySentinal(); 
    +    return iterator(Head); 
    +  }
    +  const_iterator begin() const {
    +    CreateLazySentinal();
    +    return const_iterator(Head);
    +  }
    +  iterator end() {
    +    CreateLazySentinal();
    +    return iterator(getTail());
    +  }
    +  const_iterator end() const {
    +    CreateLazySentinal();
    +    return const_iterator(getTail());
    +  }
    +
    +  // reverse iterator creation methods.
    +  reverse_iterator rbegin()            { return reverse_iterator(end()); }
    +  const_reverse_iterator rbegin() const{ return const_reverse_iterator(end()); }
    +  reverse_iterator rend()              { return reverse_iterator(begin()); }
    +  const_reverse_iterator rend() const { return const_reverse_iterator(begin());}
    +
    +
    +  // Miscellaneous inspection routines.
    +  size_type max_size() const { return size_type(-1); }
    +  bool empty() const { return Head == 0 || Head == getTail(); }
    +
    +  // Front and back accessor functions...
    +  reference front() {
    +    assert(!empty() && "Called front() on empty list!");
    +    return *Head;
    +  }
    +  const_reference front() const {
    +    assert(!empty() && "Called front() on empty list!");
    +    return *Head;
    +  }
    +  reference back() {
    +    assert(!empty() && "Called back() on empty list!");
    +    return *getPrev(getTail());
    +  }
    +  const_reference back() const {
    +    assert(!empty() && "Called back() on empty list!");
    +    return *getPrev(getTail());
    +  }
    +
    +  void swap(iplist &RHS) {
    +    abort();     // Swap does not use list traits callback correctly yet!
    +    std::swap(Head, RHS.Head);
    +  }
    +
    +  iterator insert(iterator where, NodeTy *New) {
    +    NodeTy *CurNode = where.getNodePtrUnchecked(), *PrevNode = getPrev(CurNode);
    +    setNext(New, CurNode);
    +    setPrev(New, PrevNode);
    +
    +    if (CurNode != Head)  // Is PrevNode off the beginning of the list?
    +      setNext(PrevNode, New);
    +    else
    +      Head = New;
    +    setPrev(CurNode, New);
    +
    +    addNodeToList(New);  // Notify traits that we added a node...
    +    return New;
    +  }
    +
    +  NodeTy *remove(iterator &IT) {
    +    assert(IT != end() && "Cannot remove end of list!");
    +    NodeTy *Node = &*IT;
    +    NodeTy *NextNode = getNext(Node);
    +    NodeTy *PrevNode = getPrev(Node);
    +
    +    if (Node != Head)  // Is PrevNode off the beginning of the list?
    +      setNext(PrevNode, NextNode);
    +    else
    +      Head = NextNode;
    +    setPrev(NextNode, PrevNode);
    +    IT = NextNode;
    +    removeNodeFromList(Node);  // Notify traits that we removed a node...
    +    
    +    // Set the next/prev pointers of the current node to null.  This isn't
    +    // strictly required, but this catches errors where a node is removed from
    +    // an ilist (and potentially deleted) with iterators still pointing at it.
    +    // When those iterators are incremented or decremented, they will assert on
    +    // the null next/prev pointer instead of "usually working".
    +    setNext(Node, 0);
    +    setPrev(Node, 0);
    +    return Node;
    +  }
    +
    +  NodeTy *remove(const iterator &IT) {
    +    iterator MutIt = IT;
    +    return remove(MutIt);
    +  }
    +
    +  // erase - remove a node from the controlled sequence... and delete it.
    +  iterator erase(iterator where) {
    +    delete remove(where);
    +    return where;
    +  }
    +
    +
    +private:
    +  // transfer - The heart of the splice function.  Move linked list nodes from
    +  // [first, last) into position.
    +  //
    +  void transfer(iterator position, iplist &L2, iterator first, iterator last) {
    +    assert(first != last && "Should be checked by callers");
    +
    +    if (position != last) {
    +      // Note: we have to be careful about the case when we move the first node
    +      // in the list.  This node is the list sentinel node and we can't move it.
    +      NodeTy *ThisSentinel = getTail();
    +      setTail(0);
    +      NodeTy *L2Sentinel = L2.getTail();
    +      L2.setTail(0);
    +
    +      // Remove [first, last) from its old position.
    +      NodeTy *First = &*first, *Prev = getPrev(First);
    +      NodeTy *Next = last.getNodePtrUnchecked(), *Last = getPrev(Next);
    +      if (Prev)
    +        setNext(Prev, Next);
    +      else
    +        L2.Head = Next;
    +      setPrev(Next, Prev);
    +
    +      // Splice [first, last) into its new position.
    +      NodeTy *PosNext = position.getNodePtrUnchecked();
    +      NodeTy *PosPrev = getPrev(PosNext);
    +
    +      // Fix head of list...
    +      if (PosPrev)
    +        setNext(PosPrev, First);
    +      else
    +        Head = First;
    +      setPrev(First, PosPrev);
    +
    +      // Fix end of list...
    +      setNext(Last, PosNext);
    +      setPrev(PosNext, Last);
    +
    +      transferNodesFromList(L2, First, PosNext);
    +
    +      // Now that everything is set, restore the pointers to the list sentinals.
    +      L2.setTail(L2Sentinel);
    +      setTail(ThisSentinel);
    +    }
    +  }
    +
    +public:
    +
    +  //===----------------------------------------------------------------------===
    +  // Functionality derived from other functions defined above...
    +  //
    +
    +  size_type size() const {
    +    if (Head == 0) return 0; // Don't require construction of sentinal if empty.
    +#if __GNUC__ == 2
    +    // GCC 2.95 has a broken std::distance
    +    size_type Result = 0;
    +    std::distance(begin(), end(), Result);
    +    return Result;
    +#else
    +    return std::distance(begin(), end());
    +#endif
    +  }
    +
    +  iterator erase(iterator first, iterator last) {
    +    while (first != last)
    +      first = erase(first);
    +    return last;
    +  }
    +
    +  void clear() { if (Head) erase(begin(), end()); }
    +
    +  // Front and back inserters...
    +  void push_front(NodeTy *val) { insert(begin(), val); }
    +  void push_back(NodeTy *val) { insert(end(), val); }
    +  void pop_front() {
    +    assert(!empty() && "pop_front() on empty list!");
    +    erase(begin());
    +  }
    +  void pop_back() {
    +    assert(!empty() && "pop_back() on empty list!");
    +    iterator t = end(); erase(--t);
    +  }
    +
    +  // Special forms of insert...
    +  template void insert(iterator where, InIt first, InIt last) {
    +    for (; first != last; ++first) insert(where, *first);
    +  }
    +
    +  // Splice members - defined in terms of transfer...
    +  void splice(iterator where, iplist &L2) {
    +    if (!L2.empty())
    +      transfer(where, L2, L2.begin(), L2.end());
    +  }
    +  void splice(iterator where, iplist &L2, iterator first) {
    +    iterator last = first; ++last;
    +    if (where == first || where == last) return; // No change
    +    transfer(where, L2, first, last);
    +  }
    +  void splice(iterator where, iplist &L2, iterator first, iterator last) {
    +    if (first != last) transfer(where, L2, first, last);
    +  }
    +
    +
    +
    +  //===----------------------------------------------------------------------===
    +  // High-Level Functionality that shouldn't really be here, but is part of list
    +  //
    +
    +  // These two functions are actually called remove/remove_if in list<>, but
    +  // they actually do the job of erase, rename them accordingly.
    +  //
    +  void erase(const NodeTy &val) {
    +    for (iterator I = begin(), E = end(); I != E; ) {
    +      iterator next = I; ++next;
    +      if (*I == val) erase(I);
    +      I = next;
    +    }
    +  }
    +  template void erase_if(Pr1 pred) {
    +    for (iterator I = begin(), E = end(); I != E; ) {
    +      iterator next = I; ++next;
    +      if (pred(*I)) erase(I);
    +      I = next;
    +    }
    +  }
    +
    +  template void unique(Pr2 pred) {
    +    if (empty()) return;
    +    for (iterator I = begin(), E = end(), Next = begin(); ++Next != E;) {
    +      if (pred(*I))
    +        erase(Next);
    +      else
    +        I = Next;
    +      Next = I;
    +    }
    +  }
    +  void unique() { unique(op_equal); }
    +
    +  template void merge(iplist &right, Pr3 pred) {
    +    iterator first1 = begin(), last1 = end();
    +    iterator first2 = right.begin(), last2 = right.end();
    +    while (first1 != last1 && first2 != last2)
    +      if (pred(*first2, *first1)) {
    +        iterator next = first2;
    +        transfer(first1, right, first2, ++next);
    +        first2 = next;
    +      } else {
    +        ++first1;
    +      }
    +    if (first2 != last2) transfer(last1, right, first2, last2);
    +  }
    +  void merge(iplist &right) { return merge(right, op_less); }
    +
    +  template void sort(Pr3 pred);
    +  void sort() { sort(op_less); }
    +  void reverse();
    +};
    +
    +
    +template
    +struct ilist : public iplist {
    +  typedef typename iplist::size_type size_type;
    +  typedef typename iplist::iterator iterator;
    +
    +  ilist() {}
    +  ilist(const ilist &right) {
    +    insert(this->begin(), right.begin(), right.end());
    +  }
    +  explicit ilist(size_type count) {
    +    insert(this->begin(), count, NodeTy());
    +  } 
    +  ilist(size_type count, const NodeTy &val) {
    +    insert(this->begin(), count, val);
    +  }
    +  template ilist(InIt first, InIt last) {
    +    insert(this->begin(), first, last);
    +  }
    +
    +
    +  // Forwarding functions: A workaround for GCC 2.95 which does not correctly
    +  // support 'using' declarations to bring a hidden member into scope.
    +  //
    +  iterator insert(iterator a, NodeTy *b){ return iplist::insert(a, b); }
    +  void push_front(NodeTy *a) { iplist::push_front(a); }
    +  void push_back(NodeTy *a)  { iplist::push_back(a); }
    +  
    +
    +  // Main implementation here - Insert for a node passed by value...
    +  iterator insert(iterator where, const NodeTy &val) {
    +    return insert(where, createNode(val));
    +  }
    +
    +
    +  // Front and back inserters...
    +  void push_front(const NodeTy &val) { insert(this->begin(), val); }
    +  void push_back(const NodeTy &val) { insert(this->end(), val); }
    +
    +  // Special forms of insert...
    +  template void insert(iterator where, InIt first, InIt last) {
    +    for (; first != last; ++first) insert(where, *first);
    +  }
    +  void insert(iterator where, size_type count, const NodeTy &val) {
    +    for (; count != 0; --count) insert(where, val);
    +  }
    +
    +  // Assign special forms...
    +  void assign(size_type count, const NodeTy &val) {
    +    iterator I = this->begin();
    +    for (; I != this->end() && count != 0; ++I, --count)
    +      *I = val;
    +    if (count != 0)
    +      insert(this->end(), val, val);
    +    else
    +      erase(I, this->end());
    +  }
    +  template void assign(InIt first1, InIt last1) {
    +    iterator first2 = this->begin(), last2 = this->end();
    +    for ( ; first1 != last1 && first2 != last2; ++first1, ++first2)
    +      *first1 = *first2;
    +    if (first2 == last2)
    +      erase(first1, last1);
    +    else
    +      insert(last1, first2, last2);
    +  }
    +
    +
    +  // Resize members...
    +  void resize(size_type newsize, NodeTy val) {
    +    iterator i = this->begin();
    +    size_type len = 0;
    +    for ( ; i != this->end() && len < newsize; ++i, ++len) /* empty*/ ;
    +
    +    if (len == newsize)
    +      erase(i, this->end());
    +    else                                          // i == end()
    +      insert(this->end(), newsize - len, val);
    +  }
    +  void resize(size_type newsize) { resize(newsize, NodeTy()); }
    +};
    +
    +} // End llvm namespace
    +
    +namespace std {
    +  // Ensure that swap uses the fast list swap...
    +  template
    +  void swap(llvm::iplist &Left, llvm::iplist &Right) {
    +    Left.swap(Right);
    +  }
    +}  // End 'std' extensions...
    +
    +#endif // LLVM_ADT_ILIST_H
    
    Added: llvm/branches/non-call-eh/include/llvm/ADT/iterator
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/iterator?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/iterator (added)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/iterator Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,32 @@
    +//===-- llvm/ADT/iterator - Portable wrapper around  --*- C++ -*-===//
    +// 
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +// 
    +//===----------------------------------------------------------------------===//
    +//
    +// This file provides a wrapper around the mysterious  header file.
    +// In GCC 2.95.3, the file defines a bidirectional_iterator class (and other
    +// friends), instead of the standard iterator class.  In GCC 3.1, the
    +// bidirectional_iterator class got moved out and the new, standards compliant,
    +// iterator<> class was added.  Because there is nothing that we can do to get
    +// correct behavior on both compilers, we have this header with #ifdef's.  Gross
    +// huh?
    +//
    +// By #includ'ing this file, you get the contents of  plus the
    +// following classes in the global namespace:
    +//
    +//   1. bidirectional_iterator
    +//   2. forward_iterator
    +//
    +// The #if directives' expressions are filled in by Autoconf.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#warning This files includes old 'llvm/ADT/iterator' file, which was replaced  \
    +by 'llvm/ADT/iterator.h'. Please consider upgrading the source.
    +
    +#include "llvm/ADT/iterator.h"
    +
    
    Added: llvm/branches/non-call-eh/include/llvm/ADT/iterator.h.in
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/iterator.h.in?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/iterator.h.in (added)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/iterator.h.in Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,76 @@
    +//==-- llvm/ADT/iterator.h - Portable wrapper around  --*- C++ -*-==//
    +// 
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +// 
    +//===----------------------------------------------------------------------===//
    +//
    +// This file provides a wrapper around the mysterious  header file.
    +// In GCC 2.95.3, the file defines a bidirectional_iterator class (and other
    +// friends), instead of the standard iterator class.  In GCC 3.1, the
    +// bidirectional_iterator class got moved out and the new, standards compliant,
    +// iterator<> class was added.  Because there is nothing that we can do to get
    +// correct behavior on both compilers, we have this header with #ifdef's.  Gross
    +// huh?
    +//
    +// By #includ'ing this file, you get the contents of  plus the
    +// following classes in the global namespace:
    +//
    +//   1. bidirectional_iterator
    +//   2. forward_iterator
    +//
    +// The #if directives' expressions are filled in by Autoconf.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ADT_ITERATOR_H
    +#define LLVM_ADT_ITERATOR_H
    +
    +#include 
    +
    +#undef HAVE_BI_ITERATOR
    +#undef HAVE_STD_ITERATOR
    +#undef HAVE_FWD_ITERATOR
    +
    +#ifdef _MSC_VER
    +#  define HAVE_BI_ITERATOR 0
    +#  define HAVE_STD_ITERATOR 1
    +#  define HAVE_FWD_ITERATOR 0
    +#endif
    +
    +#if !HAVE_BI_ITERATOR
    +# if HAVE_STD_ITERATOR
    +/// If the bidirectional iterator is not defined, we attempt to define it in
    +/// terms of the C++ standard iterator. Otherwise, we import it with a "using"
    +/// statement.
    +///
    +template
    +struct bidirectional_iterator
    +  : public std::iterator {
    +};
    +# else
    +#  error "Need to have standard iterator to define bidirectional iterator!"
    +# endif
    +#else
    +using std::bidirectional_iterator;
    +#endif
    +
    +#if !HAVE_FWD_ITERATOR
    +# if HAVE_STD_ITERATOR
    +/// If the forward iterator is not defined, attempt to define it in terms of
    +/// the C++ standard iterator. Otherwise, we import it with a "using" statement.
    +///
    +template
    +struct forward_iterator
    +  : public std::iterator {
    +};
    +# else
    +#  error "Need to have standard iterator to define forward iterator!"
    +# endif
    +#else
    +using std::forward_iterator;
    +#endif
    +
    +#endif // LLVM_ADT_ITERATOR_H
    
    Removed: llvm/branches/non-call-eh/include/llvm/ADT/iterator.in
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/ADT/iterator.in?rev=53162&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/ADT/iterator.in (original)
    +++ llvm/branches/non-call-eh/include/llvm/ADT/iterator.in (removed)
    @@ -1,76 +0,0 @@
    -//===-- llvm/ADT/iterator - Portable wrapper around  --*- C++ -*-===//
    -// 
    -//                     The LLVM Compiler Infrastructure
    -//
    -// This file is distributed under the University of Illinois Open Source
    -// License. See LICENSE.TXT for details.
    -// 
    -//===----------------------------------------------------------------------===//
    -//
    -// This file provides a wrapper around the mysterious  header file.
    -// In GCC 2.95.3, the file defines a bidirectional_iterator class (and other
    -// friends), instead of the standard iterator class.  In GCC 3.1, the
    -// bidirectional_iterator class got moved out and the new, standards compliant,
    -// iterator<> class was added.  Because there is nothing that we can do to get
    -// correct behavior on both compilers, we have this header with #ifdef's.  Gross
    -// huh?
    -//
    -// By #includ'ing this file, you get the contents of  plus the
    -// following classes in the global namespace:
    -//
    -//   1. bidirectional_iterator
    -//   2. forward_iterator
    -//
    -// The #if directives' expressions are filled in by Autoconf.
    -//
    -//===----------------------------------------------------------------------===//
    -
    -#ifndef LLVM_ADT_ITERATOR
    -#define LLVM_ADT_ITERATOR
    -
    -#include 
    -
    -#undef HAVE_BI_ITERATOR
    -#undef HAVE_STD_ITERATOR
    -#undef HAVE_FWD_ITERATOR
    -
    -#ifdef _MSC_VER
    -#  define HAVE_BI_ITERATOR 0
    -#  define HAVE_STD_ITERATOR 1
    -#  define HAVE_FWD_ITERATOR 0
    -#endif
    -
    -#if !HAVE_BI_ITERATOR
    -# if HAVE_STD_ITERATOR
    -/// If the bidirectional iterator is not defined, we attempt to define it in
    -/// terms of the C++ standard iterator. Otherwise, we import it with a "using"
    -/// statement.
    -///
    -template
    -struct bidirectional_iterator
    -  : public std::iterator {
    -};
    -# else
    -#  error "Need to have standard iterator to define bidirectional iterator!"
    -# endif
    -#else
    -using std::bidirectional_iterator;
    -#endif
    -
    -#if !HAVE_FWD_ITERATOR
    -# if HAVE_STD_ITERATOR
    -/// If the forward iterator is not defined, attempt to define it in terms of
    -/// the C++ standard iterator. Otherwise, we import it with a "using" statement.
    -///
    -template
    -struct forward_iterator
    -  : public std::iterator {
    -};
    -# else
    -#  error "Need to have standard iterator to define forward iterator!"
    -# endif
    -#else
    -using std::forward_iterator;
    -#endif
    -
    -#endif
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/AliasAnalysis.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/AliasAnalysis.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/AliasAnalysis.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/AliasAnalysis.h Sun Jul  6 15:45:41 2008
    @@ -55,9 +55,9 @@
       ///
       void InitializeAliasAnalysis(Pass *P);
     
    -  // getAnalysisUsage - All alias analysis implementations should invoke this
    -  // directly (using AliasAnalysis::getAnalysisUsage(AU)) to make sure that
    -  // TargetData is required by the pass.
    +  /// getAnalysisUsage - All alias analysis implementations should invoke this
    +  /// directly (using AliasAnalysis::getAnalysisUsage(AU)) to make sure that
    +  /// TargetData is required by the pass.
       virtual void getAnalysisUsage(AnalysisUsage &AU) const;
     
     public:
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/AliasSetTracker.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/AliasSetTracker.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/AliasSetTracker.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/AliasSetTracker.h Sun Jul  6 15:45:41 2008
    @@ -19,9 +19,9 @@
     
     #include "llvm/Support/CallSite.h"
     #include "llvm/Support/Streams.h"
    -#include "llvm/ADT/iterator"
    -#include "llvm/ADT/hash_map"
    -#include "llvm/ADT/ilist"
    +#include "llvm/ADT/iterator.h"
    +#include "llvm/ADT/hash_map.h"
    +#include "llvm/ADT/ilist.h"
     
     namespace llvm {
     
    @@ -232,7 +232,7 @@
                       bool KnownMustAlias = false);
       void addCallSite(CallSite CS, AliasAnalysis &AA);
       void removeCallSite(CallSite CS) {
    -    for (unsigned i = 0, e = CallSites.size(); i != e; ++i)
    +    for (size_t i = 0, e = CallSites.size(); i != e; ++i)
           if (CallSites[i].getInstruction() == CS.getInstruction()) {
             CallSites[i] = CallSites.back();
             CallSites.pop_back();
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/CallGraph.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/CallGraph.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/CallGraph.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/CallGraph.h Sun Jul  6 15:45:41 2008
    @@ -55,6 +55,7 @@
     #include "llvm/ADT/STLExtras.h"
     #include "llvm/Pass.h"
     #include "llvm/Support/CallSite.h"
    +#include "llvm/System/IncludeFile.h"
     #include 
     
     namespace llvm {
    @@ -158,10 +159,7 @@
       void print(std::ostream *o, const Module *M) const { if (o) print(*o, M); }
       void dump() const;
       
    -  // stub - dummy function, just ignore it
    -  static int stub;
     protected:
    -
       // destroy - Release memory for the call graph
       virtual void destroy();
     };
    @@ -191,7 +189,7 @@
       inline const_iterator begin() const { return CalledFunctions.begin(); }
       inline const_iterator end()   const { return CalledFunctions.end();   }
       inline bool empty() const { return CalledFunctions.empty(); }
    -  inline unsigned size() const { return CalledFunctions.size(); }
    +  inline unsigned size() const { return (unsigned)CalledFunctions.size(); }
     
       // Subscripting operator - Return the i'th called function...
       //
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/ConstantFolding.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/ConstantFolding.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/ConstantFolding.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/ConstantFolding.h Sun Jul  6 15:45:41 2008
    @@ -30,6 +30,12 @@
     ///
     Constant *ConstantFoldInstruction(Instruction *I, const TargetData *TD = 0);
     
    +/// ConstantFoldConstantExpression - Attempt to fold the constant expression
    +/// using the specified TargetData.  If successful, the constant result is
    +/// result is returned, if not, null is returned.
    +Constant *ConstantFoldConstantExpression(ConstantExpr *CE,
    +                                         const TargetData *TD);
    +
     /// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
     /// specified operands.  If successful, the constant result is returned, if not,
     /// null is returned.  Note that this function can fail when attempting to 
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/ConstantsScanner.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/ConstantsScanner.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/ConstantsScanner.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/ConstantsScanner.h Sun Jul  6 15:45:41 2008
    @@ -18,7 +18,7 @@
     
     #include "llvm/Support/InstIterator.h"
     #include "llvm/Instruction.h"
    -#include "llvm/ADT/iterator"
    +#include "llvm/ADT/iterator.h"
     
     namespace llvm {
     
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/DominatorInternals.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/DominatorInternals.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/DominatorInternals.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/DominatorInternals.h Sun Jul  6 15:45:41 2008
    @@ -233,14 +233,7 @@
       typedef GraphTraits GraphT;
     
       unsigned N = 0;
    -
    -  // 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.
    -  typename GraphT::NodeType* Root = DT.Roots.size() == 1 ? DT.Roots[0]
    -                   : 0;
       bool MultipleRoots = (DT.Roots.size() > 1);
    -
       if (MultipleRoots) {
         typename DominatorTreeBase::InfoRec &BBInfo =
             DT.Info[NULL];
    @@ -255,9 +248,14 @@
     
       // Step #1: Number blocks in depth-first order and initialize variables used
       // in later stages of the algorithm.
    -  for (unsigned i = 0, e = DT.Roots.size(); i != e; ++i)
    +  for (unsigned i = 0, e = static_cast(DT.Roots.size());
    +       i != e; ++i)
         N = DFSPass(DT, DT.Roots[i], N);
     
    +  // it might be that some blocks did not get a DFS number (e.g., blocks of 
    +  // infinite loops). In these cases an artificial exit node is required.
    +  MultipleRoots |= (DT.isPostDominator() && N != F.size());
    +
       for (unsigned i = N; i >= 2; --i) {
         typename GraphT::NodeType* W = DT.Vertex[i];
         typename DominatorTreeBase::InfoRec &WInfo =
    @@ -311,15 +309,18 @@
         if (WIDom != DT.Vertex[DT.Info[W].Semi])
           WIDom = DT.IDoms[WIDom];
       }
    -  
    +
       if (DT.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.
    +  // which postdominates all real exits if there are multiple exit blocks, or
    +  // an infinite loop.
    +  typename GraphT::NodeType* Root = !MultipleRoots ? DT.Roots[0] : 0;
    +
       DT.DomTreeNodes[Root] = DT.RootNode =
                             new DomTreeNodeBase(Root, 0);
    -  
    +
       // Loop over all of the reachable blocks in the function...
       for (unsigned i = 2; i <= N; ++i) {
         typename GraphT::NodeType* W = DT.Vertex[i];
    @@ -329,20 +330,12 @@
     
         typename GraphT::NodeType* ImmDom = DT.getIDom(W);
     
    -    // skip all non root nodes that have no dominator - this occures with 
    -    // infinite loops.
    -    if (!ImmDom && std::count(DT.Roots.begin(), DT.Roots.end(), W) == 0)
    -      continue;
    +    assert(ImmDom || DT.DomTreeNodes[NULL]);
     
         // Get or calculate the node for the immediate dominator
         DomTreeNodeBase *IDomNode =
                                                          DT.getNodeForBlock(ImmDom);
     
    -    // skip all children that are dominated by a non root node that, by itself,
    -    // has no dominator.
    -    if (!IDomNode)
    -      continue;
    -
         // Add a new tree node for this BasicBlock, and link it as a child of
         // IDomNode
         DomTreeNodeBase *C =
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/Dominators.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/Dominators.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/Dominators.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/Dominators.h Sun Jul  6 15:45:41 2008
    @@ -94,7 +94,7 @@
       const std::vector*> &getChildren() const {
         return Children;
       }
    -  
    +
       DomTreeNodeBase(NodeT *BB, DomTreeNodeBase *iDom)
         : TheBB(BB), IDom(iDom), DFSNumIn(-1), DFSNumOut(-1) { }
       
    @@ -102,11 +102,33 @@
         Children.push_back(C);
         return C;
       }
    -  
    +
       size_t getNumChildren() const {
         return Children.size();
       }
    +
    +  void clearAllChildren() {
    +    Children.clear();
    +  }
       
    +  bool compare(DomTreeNodeBase *Other) {
    +    if (getNumChildren() != Other->getNumChildren())
    +      return true;
    +
    +    SmallPtrSet OtherChildren;
    +    for(iterator I = Other->begin(), E = Other->end(); I != E; ++I) {
    +      NodeT *Nd = (*I)->getBlock();
    +      OtherChildren.insert(Nd);
    +    }
    +
    +    for(iterator I = begin(), E = end(); I != E; ++I) {
    +      NodeT *N = (*I)->getBlock();
    +      if (OtherChildren.count(N) == 0)
    +        return true;
    +    }
    +    return false;
    +  }
    +
       void setIDom(DomTreeNodeBase *NewIDom) {
         assert(IDom && "No immediate dominator?");
         if (IDom != NewIDom) {
    @@ -237,7 +259,7 @@
           bool NewBBDominatesNewBBSucc = true;
           {
             typename GraphT::NodeType* OnePred = PredBlocks[0];
    -        unsigned i = 1, e = PredBlocks.size();
    +        size_t i = 1, e = PredBlocks.size();
             for (i = 1; !DT.isReachableFromEntry(OnePred); ++i) {
               assert(i != e && "Didn't find reachable pred?");
               OnePred = PredBlocks[i];
    @@ -308,6 +330,33 @@
       // FIXME: Should remove this
       virtual bool runOnFunction(Function &F) { return false; }
     
    +  /// compare - Return false if the other dominator tree base matches this
    +  /// dominator tree base. Otherwise return true.
    +  bool compare(DominatorTreeBase &Other) const {
    +
    +    const DomTreeNodeMapType &OtherDomTreeNodes = Other.DomTreeNodes;
    +    if (DomTreeNodes.size() != OtherDomTreeNodes.size())
    +      return true;
    +
    +    SmallPtrSet MyBBs;
    +    for (typename DomTreeNodeMapType::const_iterator 
    +           I = this->DomTreeNodes.begin(),
    +           E = this->DomTreeNodes.end(); I != E; ++I) {
    +      NodeT *BB = I->first;
    +      typename DomTreeNodeMapType::const_iterator OI = OtherDomTreeNodes.find(BB);
    +      if (OI == OtherDomTreeNodes.end())
    +        return true;
    +
    +      DomTreeNodeBase* MyNd = I->second;
    +      DomTreeNodeBase* OtherNd = OI->second;
    +      
    +      if (MyNd->compare(OtherNd))
    +        return true;
    +    }
    +
    +    return false;
    +  }
    +
       virtual void releaseMemory() { reset(); }
     
       /// getNode - return the (Post)DominatorTree node for the specified basic
    @@ -567,7 +616,7 @@
         SmallVector*,
                     typename DomTreeNodeBase::iterator>, 32> WorkStack;
     
    -    for (unsigned i = 0, e = this->Roots.size(); i != e; ++i) {
    +    for (unsigned i = 0, e = (unsigned)this->Roots.size(); i != e; ++i) {
           DomTreeNodeBase *ThisRoot = getNode(this->Roots[i]);
           WorkStack.push_back(std::make_pair(ThisRoot, ThisRoot->begin()));
           ThisRoot->DFSNumIn = DFSNum++;
    @@ -605,17 +654,9 @@
         // immediate dominator.
         NodeT *IDom = getIDom(BB);
     
    -    // skip all non root nodes that have no dominator
    -    if (!IDom && std::count(this->Roots.begin(), this->Roots.end(), BB) == 0)
    -      return NULL;
    -
    +    assert(IDom || this->DomTreeNodes[NULL]);
         DomTreeNodeBase *IDomNode = getNodeForBlock(IDom);
     
    -    // skip all nodes that are dominated by a non root node that, by itself,
    -    // has no dominator.
    -    if (!IDomNode)
    -      return NULL;
    -
         // Add a new tree node for this BasicBlock, and link it as a child of
         // IDomNode
         DomTreeNodeBase *C = new DomTreeNodeBase(BB, IDomNode);
    @@ -705,7 +746,22 @@
       inline DomTreeNode *getRootNode() const {
         return DT->getRootNode();
       }
    -  
    +
    +  /// compare - Return false if the other dominator tree matches this
    +  /// dominator tree. Otherwise return true.
    +  inline bool compare(DominatorTree &Other) const {
    +    DomTreeNode *R = getRootNode();
    +    DomTreeNode *OtherR = Other.getRootNode();
    +    
    +    if (!R || !OtherR || R->getBlock() != OtherR->getBlock())
    +      return true;
    +    
    +    if (DT->compare(Other.getBase()))
    +      return true;
    +
    +    return false;
    +  }
    +
       virtual bool runOnFunction(Function &F);
       
       virtual void getAnalysisUsage(AnalysisUsage &AU) const {
    @@ -800,6 +856,10 @@
         DT->splitBlock(NewBB);
       }
       
    +  bool isReachableFromEntry(BasicBlock* A) {
    +    return DT->isReachableFromEntry(A);
    +  }
    +  
       
       virtual void releaseMemory() { 
         DT->releaseMemory();
    @@ -847,8 +907,8 @@
       typedef std::map DomSetMapType; // Dom set map
     protected:
       DomSetMapType Frontiers;
    -    std::vector Roots;
    -    const bool IsPostDominators;
    +  std::vector Roots;
    +  const bool IsPostDominators;
       
     public:
       DominanceFrontierBase(intptr_t ID, bool isPostDom) 
    @@ -900,6 +960,58 @@
         I->second.erase(Node);
       }
     
    +  /// compareDomSet - Return false if two domsets match. Otherwise
    +  /// return true;
    +  bool compareDomSet(DomSetType &DS1, const DomSetType &DS2) const {
    +    std::set tmpSet;
    +    for (DomSetType::const_iterator I = DS2.begin(),
    +           E = DS2.end(); I != E; ++I) 
    +      tmpSet.insert(*I);
    +
    +    for (DomSetType::const_iterator I = DS1.begin(),
    +           E = DS1.end(); I != E; ++I) {
    +      BasicBlock *Node = *I;
    +
    +      if (tmpSet.erase(Node) == 0)
    +        // Node is in DS1 but not in DS2.
    +        return true;
    +    }
    +
    +    if(!tmpSet.empty())
    +      // There are nodes that are in DS2 but not in DS1.
    +      return true;
    +
    +    // DS1 and DS2 matches.
    +    return false;
    +  }
    +
    +  /// compare - Return true if the other dominance frontier base matches
    +  /// this dominance frontier base. Otherwise return false.
    +  bool compare(DominanceFrontierBase &Other) const {
    +    DomSetMapType tmpFrontiers;
    +    for (DomSetMapType::const_iterator I = Other.begin(),
    +           E = Other.end(); I != E; ++I) 
    +      tmpFrontiers.insert(std::make_pair(I->first, I->second));
    +
    +    for (DomSetMapType::iterator I = tmpFrontiers.begin(),
    +           E = tmpFrontiers.end(); I != E; ++I) {
    +      BasicBlock *Node = I->first;
    +      const_iterator DFI = find(Node);
    +      if (DFI == end()) 
    +        return true;
    +
    +      if (compareDomSet(I->second, DFI->second))
    +        return true;
    +
    +      tmpFrontiers.erase(Node);
    +    }
    +
    +    if (!tmpFrontiers.empty())
    +      return true;
    +
    +    return false;
    +  }
    +
       /// print - Convert to human readable form
       ///
       virtual void print(std::ostream &OS, const Module* = 0) const;
    @@ -952,6 +1064,9 @@
         // itself is not member of NewBB's dominance frontier.
         DominanceFrontier::iterator NewDFI = find(NewBB);
         DominanceFrontier::iterator DFI = find(BB);
    +    // If BB was an entry block then its frontier is empty.
    +    if (DFI == end())
    +      return;
         DominanceFrontier::DomSetType BBSet = DFI->second;
         for (DominanceFrontier::DomSetType::iterator BBSetI = BBSet.begin(),
                BBSetE = BBSet.end(); BBSetI != BBSetE; ++BBSetI) {
    @@ -963,7 +1078,6 @@
         NewDFI->second.erase(BB);
       }
     
    -private:
       const DomSetType &calculate(const DominatorTree &DT,
                                   const DomTreeNode *Node);
     };
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/FindUsedTypes.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/FindUsedTypes.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/FindUsedTypes.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/FindUsedTypes.h Sun Jul  6 15:45:41 2008
    @@ -61,7 +61,4 @@
     
     } // End llvm namespace
     
    -// Make sure that any clients of this file link in PostDominators.cpp
    -FORCE_DEFINING_FILE_TO_BE_LINKED(FindUsedTypes)
    -
     #endif
    
    Added: llvm/branches/non-call-eh/include/llvm/Analysis/LibCallAliasAnalysis.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/LibCallAliasAnalysis.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/LibCallAliasAnalysis.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/LibCallAliasAnalysis.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,61 @@
    +//===- LibCallAliasAnalysis.h - Implement AliasAnalysis for libcalls ------===//
    +//
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +//
    +//===----------------------------------------------------------------------===//
    +//
    +// This file defines the LibCallAliasAnalysis class.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ANALYSIS_LIBCALL_AA_H
    +#define LLVM_ANALYSIS_LIBCALL_AA_H
    +
    +#include "llvm/Analysis/AliasAnalysis.h"
    +#include "llvm/Pass.h"
    +
    +namespace llvm {
    +  class LibCallInfo;
    +  class LibCallFunctionInfo;
    +  
    +  /// LibCallAliasAnalysis - Alias analysis driven from LibCallInfo.
    +  struct LibCallAliasAnalysis : public FunctionPass, AliasAnalysis {
    +    static char ID; // Class identification
    +    
    +    LibCallInfo *LCI;
    +    
    +    explicit LibCallAliasAnalysis(LibCallInfo *LC = 0)
    +      : FunctionPass(&ID), LCI(LC) {
    +    }
    +    explicit LibCallAliasAnalysis(const void *ID, LibCallInfo *LC)
    +      : FunctionPass(ID), LCI(LC) {
    +    }
    +    ~LibCallAliasAnalysis();
    +    
    +    ModRefResult getModRefInfo(CallSite CS, Value *P, unsigned Size);
    +    
    +    ModRefResult getModRefInfo(CallSite CS1, CallSite CS2) {
    +      // TODO: Could compare two direct calls against each other if we cared to.
    +      return AliasAnalysis::getModRefInfo(CS1,CS2);
    +    }
    +    
    +    virtual void getAnalysisUsage(AnalysisUsage &AU) const;
    +    
    +    virtual bool runOnFunction(Function &F) {
    +      InitializeAliasAnalysis(this);                 // set up super class
    +      return false;
    +    }
    +    
    +    /// hasNoModRefInfoForCalls - We can provide mod/ref information against
    +    /// non-escaping allocations.
    +    virtual bool hasNoModRefInfoForCalls() const { return false; }
    +  private:
    +    ModRefResult AnalyzeLibCallDetails(const LibCallFunctionInfo *FI,
    +                                       CallSite CS, Value *P, unsigned Size);
    +  };
    +}  // End of llvm namespace
    +
    +#endif
    
    Added: llvm/branches/non-call-eh/include/llvm/Analysis/LibCallSemantics.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/LibCallSemantics.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/LibCallSemantics.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/LibCallSemantics.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,166 @@
    +//===- LibCallSemantics.h - Describe library semantics --------------------===//
    +//
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +//
    +//===----------------------------------------------------------------------===//
    +//
    +// This file defines interfaces that can be used to describe language specific
    +// runtime library interfaces (e.g. libc, libm, etc) to LLVM optimizers.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ANALYSIS_LIBCALLSEMANTICS_H
    +#define LLVM_ANALYSIS_LIBCALLSEMANTICS_H
    +
    +#include "llvm/Analysis/AliasAnalysis.h"
    +
    +namespace llvm {
    +
    +  /// LibCallLocationInfo - This struct describes a set of memory locations that
    +  /// are accessed by libcalls.  Identification of a location is doing with a
    +  /// simple callback function.
    +  ///
    +  /// For example, the LibCallInfo may be set up to model the behavior of
    +  /// standard libm functions.  The location that they may be interested in is
    +  /// an abstract location that represents errno for the current target.  In
    +  /// this case, a location for errno is anything such that the predicate
    +  /// returns true.  On Mac OS/X, this predicate would return true if the
    +  /// pointer is the result of a call to "__error()".
    +  ///
    +  /// Locations can also be defined in a constant-sensitive way.  For example,
    +  /// it is possible to define a location that returns true iff it is passed
    +  /// into the call as a specific argument.  This is useful for modeling things
    +  /// like "printf", which can store to memory, but only through pointers passed
    +  /// with a '%n' constraint.
    +  ///
    +  struct LibCallLocationInfo {
    +    // TODO: Flags: isContextSensitive etc.
    +    
    +    /// isLocation - Return a LocResult if the specified pointer refers to this
    +    /// location for the specified call site.  This returns "Yes" if we can tell
    +    /// that the pointer *does definitely* refer to the location, "No" if we can
    +    /// tell that the location *definitely does not* refer to the location, and
    +    /// returns "Unknown" if we cannot tell for certain.
    +    enum LocResult {
    +      Yes, No, Unknown
    +    };
    +    LocResult (*isLocation)(CallSite CS, const Value *Ptr, unsigned Size);
    +  };
    +  
    +  /// LibCallFunctionInfo - Each record in the array of FunctionInfo structs
    +  /// records the behavior of one libcall that is known by the optimizer.  This
    +  /// captures things like the side effects of the call.  Side effects are
    +  /// modeled both universally (in the readnone/readonly) sense, but also
    +  /// potentially against a set of abstract locations defined by the optimizer.
    +  /// This allows an optimizer to define that some libcall (e.g. sqrt) is
    +  /// side-effect free except that it might modify errno (thus, the call is
    +  /// *not* universally readonly).  Or it might say that the side effects
    +  /// are unknown other than to say that errno is not modified.
    +  ///
    +  struct LibCallFunctionInfo {
    +    /// Name - This is the name of the libcall this describes.
    +    const char *Name;
    +    
    +    /// TODO: Constant folding function: Constant* vector -> Constant*.
    +    
    +    /// UniversalBehavior - This captures the absolute mod/ref behavior without
    +    /// any specific context knowledge.  For example, if the function is known
    +    /// to be readonly, this would be set to 'ref'.  If known to be readnone,
    +    /// this is set to NoModRef.
    +    AliasAnalysis::ModRefResult UniversalBehavior;
    +    
    +    /// LocationMRInfo - This pair captures info about whether a specific
    +    /// location is modified or referenced by a libcall.
    +    struct LocationMRInfo {
    +      /// LocationID - ID # of the accessed location or ~0U for array end.
    +      unsigned LocationID;
    +      /// MRInfo - Mod/Ref info for this location.
    +      AliasAnalysis::ModRefResult MRInfo;
    +    };
    +    
    +    /// DetailsType - Indicate the sense of the LocationDetails array.  This
    +    /// controls how the LocationDetails array is interpreted.
    +    enum {
    +      /// DoesOnly - If DetailsType is set to DoesOnly, then we know that the
    +      /// *only* mod/ref behavior of this function is captured by the
    +      /// LocationDetails array.  If we are trying to say that 'sqrt' can only
    +      /// modify errno, we'd have the {errnoloc,mod} in the LocationDetails
    +      /// array and have DetailsType set to DoesOnly.
    +      DoesOnly,
    +      
    +      /// DoesNot - If DetailsType is set to DoesNot, then the sense of the
    +      /// LocationDetails array is completely inverted.  This means that we *do
    +      /// not* know everything about the side effects of this libcall, but we do
    +      /// know things that the libcall cannot do.  This is useful for complex
    +      /// functions like 'ctime' which have crazy mod/ref behavior, but are
    +      /// known to never read or write errno.  In this case, we'd have
    +      /// {errnoloc,modref} in the LocationDetails array and DetailsType would
    +      /// be set to DoesNot, indicating that ctime does not read or write the
    +      /// errno location.
    +      DoesNot
    +    } DetailsType;
    +    
    +    /// LocationDetails - This is a pointer to an array of LocationMRInfo
    +    /// structs which indicates the behavior of the libcall w.r.t. specific
    +    /// locations.  For example, if this libcall is known to only modify
    +    /// 'errno', it would have a LocationDetails array with the errno ID and
    +    /// 'mod' in it.  See the DetailsType field for how this is interpreted.
    +    ///
    +    /// In the "DoesOnly" case, this information is 'may' information for: there
    +    /// is no guarantee that the specified side effect actually does happen,
    +    /// just that it could.  In the "DoesNot" case, this is 'must not' info.
    +    ///
    +    /// If this pointer is null, no details are known.
    +    ///
    +    const LocationMRInfo *LocationDetails;
    +  };
    +  
    +  
    +  /// LibCallInfo - Abstract interface to query about library call information.
    +  /// Instances of this class return known information about some set of
    +  /// libcalls.
    +  /// 
    +  class LibCallInfo {
    +    // Implementation details of this object, private.
    +    mutable void *Impl;
    +    mutable const LibCallLocationInfo *Locations;
    +    mutable unsigned NumLocations;
    +  public:
    +    LibCallInfo() : Impl(0), Locations(0), NumLocations(0) {}
    +    virtual ~LibCallInfo();
    +    
    +    //===------------------------------------------------------------------===//
    +    //  Accessor Methods: Efficient access to contained data.
    +    //===------------------------------------------------------------------===//
    +    
    +    /// getLocationInfo - Return information about the specified LocationID.
    +    const LibCallLocationInfo &getLocationInfo(unsigned LocID) const;
    +    
    +    
    +    /// getFunctionInfo - Return the LibCallFunctionInfo object corresponding to
    +    /// the specified function if we have it.  If not, return null.
    +    const LibCallFunctionInfo *getFunctionInfo(Function *F) const;
    +    
    +    
    +    //===------------------------------------------------------------------===//
    +    //  Implementation Methods: Subclasses should implement these.
    +    //===------------------------------------------------------------------===//
    +    
    +    /// getLocationInfo - Return descriptors for the locations referenced by
    +    /// this set of libcalls.
    +    virtual unsigned getLocationInfo(const LibCallLocationInfo *&Array) const {
    +      return 0;
    +    }
    +    
    +    /// getFunctionInfoArray - Return an array of descriptors that describe the
    +    /// set of libcalls represented by this LibCallInfo object.  This array is
    +    /// terminated by an entry with a NULL name.
    +    virtual const LibCallFunctionInfo *getFunctionInfoArray() const = 0;
    +  };
    +
    +} // end namespace llvm
    +
    +#endif
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/LoopInfo.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/LoopInfo.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/LoopInfo.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/LoopInfo.h Sun Jul  6 15:45:41 2008
    @@ -43,6 +43,8 @@
     #include 
     #include 
     
    +namespace llvm {
    +
     template
     static void RemoveFromVector(std::vector &V, T *N) {
       typename std::vector::iterator I = std::find(V.begin(), V.end(), N);
    @@ -50,8 +52,6 @@
       V.erase(I);
     }
     
    -namespace llvm {
    -
     class DominatorTree;
     class LoopInfo;
     class PHINode;
    @@ -80,7 +80,7 @@
       /// Loop ctor - This creates an empty loop.
       LoopBase() : ParentLoop(0) {}
       ~LoopBase() {
    -    for (unsigned i = 0, e = SubLoops.size(); i != e; ++i)
    +    for (size_t i = 0, e = SubLoops.size(); i != e; ++i)
           delete SubLoops[i];
       }
     
    @@ -118,8 +118,8 @@
       block_iterator block_begin() const { return Blocks.begin(); }
       block_iterator block_end() const { return Blocks.end(); }
     
    -  /// isLoopExit - True if this block can branch to another block that is
    -  /// outside of the current loop.
    +  /// isLoopExit - True if terminator in the block can branch to another block
    +  /// that is outside of the current loop.
       ///
       bool isLoopExit(const BlockT *BB) const {
         typedef GraphTraits BlockTraits;
    @@ -418,6 +418,59 @@
         return 0;
       }
       
    +  /// getSmallConstantTripCount - Returns the trip count of this loop as a
    +  /// normal unsigned value, if possible. Returns 0 if the trip count is unknown
    +  /// of not constant. Will also return 0 if the trip count is very large 
    +  /// (>= 2^32)
    +  inline unsigned getSmallConstantTripCount() const {
    +    Value* TripCount = this->getTripCount();
    +    if (TripCount) {
    +      if (ConstantInt *TripCountC = dyn_cast(TripCount)) {
    +        // Guard against huge trip counts.
    +        if (TripCountC->getValue().getActiveBits() <= 32) {
    +          return (unsigned)TripCountC->getZExtValue();
    +        }
    +      }
    +    }
    +    return 0;
    +  }
    +
    +  /// getSmallConstantTripMultiple - Returns the largest constant divisor of the
    +  /// trip count of this loop as a normal unsigned value, if possible. This
    +  /// means that the actual trip count is always a multiple of the returned
    +  /// value (don't forget the trip count could very well be zero as well!).
    +  ///
    +  /// Returns 1 if the trip count is unknown or not guaranteed to be the
    +  /// multiple of a constant (which is also the case if the trip count is simply
    +  /// constant, use getSmallConstantTripCount for that case), Will also return 1
    +  /// if the trip count is very large (>= 2^32).
    +  inline unsigned getSmallConstantTripMultiple() const {
    +    Value* TripCount = this->getTripCount();
    +    // This will hold the ConstantInt result, if any
    +    ConstantInt *Result = NULL;
    +    if (TripCount) {
    +      // See if the trip count is constant itself
    +      Result = dyn_cast(TripCount);
    +      // if not, see if it is a multiplication
    +      if (!Result)
    +        if (BinaryOperator *BO = dyn_cast(TripCount)) {
    +          switch (BO->getOpcode()) {
    +          case BinaryOperator::Mul:
    +            Result = dyn_cast(BO->getOperand(1));
    +            break;
    +          default: 
    +            break;
    +          }
    +        }
    +    }
    +    // Guard against huge trip counts.
    +    if (Result && Result->getValue().getActiveBits() <= 32) {
    +      return (unsigned)Result->getZExtValue();
    +    } else {
    +      return 1;
    +    }
    +  }
    +  
       /// isLCSSAForm - Return true if the Loop is in LCSSA form
       inline bool isLCSSAForm() const {
         // Sort the blocks vector so that we can use binary search to do quick
    @@ -847,7 +900,8 @@
                "This loop should not be inserted here!");
     
         // Check to see if it belongs in a child loop...
    -    for (unsigned i = 0, e = Parent->SubLoops.size(); i != e; ++i)
    +    for (unsigned i = 0, e = static_cast(Parent->SubLoops.size());
    +         i != e; ++i)
           if (Parent->SubLoops[i]->contains(LHeader)) {
             InsertLoopInto(L, Parent->SubLoops[i]);
             return;
    @@ -919,9 +973,6 @@
         return LI->isLoopHeader(BB);
       }
     
    -  /// isAnalysis - Return true if this pass is  implementing an analysis pass.
    -  bool isAnalysis() const { return true; }
    -
       /// runOnFunction - Calculate the natural loop information.
       ///
       virtual bool runOnFunction(Function &F);
    @@ -1015,7 +1066,4 @@
     
     } // End llvm namespace
     
    -// Make sure that any clients of this file link in LoopInfo.cpp
    -FORCE_DEFINING_FILE_TO_BE_LINKED(LoopInfo)
    -
     #endif
    
    Added: llvm/branches/non-call-eh/include/llvm/Analysis/LoopVR.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/LoopVR.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/LoopVR.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/LoopVR.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,90 @@
    +//===- LoopVR.cpp - Value Range analysis driven by loop information -------===//
    +//
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +//
    +//===----------------------------------------------------------------------===//
    +//
    +// This file defines the interface for the loop-driven value range pass.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ANALYSIS_LOOPVR_H
    +#define LLVM_ANALYSIS_LOOPVR_H
    +
    +#include "llvm/Pass.h"
    +#include "llvm/Analysis/ScalarEvolution.h"
    +#include "llvm/Support/ConstantRange.h"
    +#include 
    +#include 
    +
    +namespace llvm {
    +
    +/// LoopVR - This class maintains a mapping of Values to ConstantRanges.
    +/// There are interfaces to look up and update ranges by value, and for
    +/// accessing all values with range information.
    +///
    +class LoopVR : public FunctionPass {
    +public:
    +  static char ID; // Class identification, replacement for typeinfo
    +
    +  LoopVR() : FunctionPass(intptr_t(&ID)) {}
    +
    +  bool runOnFunction(Function &F);
    +  virtual void print(std::ostream &os, const Module *) const;
    +  void releaseMemory();
    +
    +  void getAnalysisUsage(AnalysisUsage &AU) const {
    +    AU.addRequiredTransitive();
    +    AU.addRequiredTransitive();
    +    AU.setPreservesAll();
    +  }
    +
    +  //===---------------------------------------------------------------------
    +  // Methods that are used to look up and update particular values.
    +
    +  /// get - return the ConstantRange for a given Value of IntegerType.
    +  ConstantRange get(Value *V);
    +
    +  /// remove - remove a value from this analysis.
    +  void remove(Value *V);
    +
    +  /// narrow - improve our unterstanding of a Value by pointing out that it
    +  /// must fall within ConstantRange. To replace a range, remove it first.
    +  void narrow(Value *V, const ConstantRange &CR);
    +
    +  //===---------------------------------------------------------------------
    +  // Methods that are used to iterate across all values with information.
    +
    +  /// size - returns the number of Values with information
    +  unsigned size() const { return Map.size(); }
    +
    +  typedef std::map::iterator iterator;
    +
    +  /// begin - return an iterator to the first Value, ConstantRange pair
    +  iterator begin() { return Map.begin(); }
    +
    +  /// end - return an iterator one past the last Value, ConstantRange pair
    +  iterator end() { return Map.end(); }
    +
    +  /// getValue - return the Value referenced by an iterator
    +  Value *getValue(iterator I) { return I->first; }
    +
    +  /// getConstantRange - return the ConstantRange referenced by an iterator
    +  ConstantRange getConstantRange(iterator I) { return *I->second; }
    +
    +private:
    +  ConstantRange compute(Value *V);
    +
    +  ConstantRange getRange(SCEVHandle S, Loop *L, ScalarEvolution &SE);
    +
    +  ConstantRange getRange(SCEVHandle S, SCEVHandle T, ScalarEvolution &SE);
    +
    +  std::map Map;
    +};
    +
    +} // end llvm namespace
    +
    +#endif
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/Passes.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/Passes.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/Passes.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/Passes.h Sun Jul  6 15:45:41 2008
    @@ -20,6 +20,7 @@
       class ImmutablePass;
       class ModulePass;
       class Pass;
    +  class LibCallInfo;
     
       //===--------------------------------------------------------------------===//
       //
    @@ -63,6 +64,14 @@
     
       //===--------------------------------------------------------------------===//
       //
    +  /// createLibCallAliasAnalysisPass - Create an alias analysis pass that knows
    +  /// about the semantics of a set of libcalls specified by LCI.  The newly
    +  /// constructed pass takes ownership of the pointer that is provided.
    +  ///
    +  FunctionPass *createLibCallAliasAnalysisPass(LibCallInfo *LCI);
    +
    +  //===--------------------------------------------------------------------===//
    +  //
       // createAndersensPass - This pass implements Andersen's interprocedural alias
       // analysis.
       //
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/PostDominators.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/PostDominators.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/PostDominators.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/PostDominators.h Sun Jul  6 15:45:41 2008
    @@ -29,6 +29,8 @@
         DT = new DominatorTreeBase(true);
       }
     
    +  ~PostDominatorTree();
    +
       virtual bool runOnFunction(Function &F);
     
       virtual void getAnalysisUsage(AnalysisUsage &AU) const {
    @@ -60,6 +62,7 @@
       }
     };
     
    +FunctionPass* createPostDomTree();
     
     /// PostDominanceFrontier Class - Concrete subclass of DominanceFrontier that is
     /// used to compute the a post-dominance frontier.
    @@ -88,9 +91,8 @@
                                   const DomTreeNode *Node);
     };
     
    -} // End llvm namespace
    +FunctionPass* createPostDomFrontier();
     
    -// Make sure that any clients of this file link in PostDominators.cpp
    -FORCE_DEFINING_FILE_TO_BE_LINKED(PostDominanceFrontier)
    +} // End llvm namespace
     
     #endif
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolution.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolution.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolution.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolution.h Sun Jul  6 15:45:41 2008
    @@ -24,8 +24,7 @@
     #include "llvm/Pass.h"
     #include "llvm/Analysis/LoopInfo.h"
     #include "llvm/Support/DataTypes.h"
    -#include "llvm/Support/Streams.h"
    -#include 
    +#include 
     
     namespace llvm {
       class APInt;
    @@ -82,6 +81,10 @@
         /// 
         uint32_t getBitWidth() const;
     
    +    /// isZero - Return true if the expression is a constant zero.
    +    ///
    +    bool isZero() const;
    +
         /// replaceSymbolicValuesWithConcrete - If this SCEV internally references
         /// the symbolic value "Sym", construct and return a new SCEV that produces
         /// the same value, but which uses the concrete value Conc instead of the
    @@ -254,6 +257,11 @@
         SCEVHandle getMinusSCEV(const SCEVHandle &LHS,
                                 const SCEVHandle &RHS);
     
    +    /// getTruncateOrZeroExtend - Return a SCEV corresponding to a conversion
    +    /// of the input value to the specified type.  If the type must be
    +    /// extended, it is zero extended.
    +    SCEVHandle getTruncateOrZeroExtend(const SCEVHandle &V, const Type *Ty);
    +
         /// getIntegerSCEV - Given an integer or FP type, create a constant for the
         /// specified signed integer value and return a SCEV for the constant.
         SCEVHandle getIntegerSCEV(int Val, const Type *Ty);
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolutionExpander.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolutionExpander.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolutionExpander.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolutionExpander.h Sun Jul  6 15:45:41 2008
    @@ -14,13 +14,10 @@
     #ifndef LLVM_ANALYSIS_SCALAREVOLUTION_EXPANDER_H
     #define LLVM_ANALYSIS_SCALAREVOLUTION_EXPANDER_H
     
    -#include "llvm/BasicBlock.h"
    -#include "llvm/Constants.h"
     #include "llvm/Instructions.h"
     #include "llvm/Type.h"
     #include "llvm/Analysis/ScalarEvolution.h"
     #include "llvm/Analysis/ScalarEvolutionExpressions.h"
    -#include "llvm/Support/CFG.h"
     
     namespace llvm {
       /// SCEVExpander - This class uses information about analyze scalars to
    @@ -78,11 +75,7 @@
         /// expandCodeFor - Insert code to directly compute the specified SCEV
         /// expression into the program.  The inserted code is inserted into the
         /// specified block.
    -    Value *expandCodeFor(SCEVHandle SH, Instruction *IP) {
    -      // Expand the code for this SCEV.
    -      this->InsertPt = IP;
    -      return expand(SH);
    -    }
    +    Value *expandCodeFor(SCEVHandle SH, Instruction *IP);
     
         /// InsertCastOfTo - Insert a cast of V to the specified type, doing what
         /// we can to share the casts.
    @@ -91,7 +84,7 @@
         /// InsertBinop - Insert the specified binary operator, doing a small amount
         /// of work to avoid inserting an obviously redundant operation.
         static Value *InsertBinop(Instruction::BinaryOps Opcode, Value *LHS,
    -                              Value *RHS, Instruction *&InsertPt);
    +                              Value *RHS, Instruction *InsertPt);
       protected:
         Value *expand(SCEV *S);
         
    @@ -99,30 +92,13 @@
           return S->getValue();
         }
     
    -    Value *visitTruncateExpr(SCEVTruncateExpr *S) {
    -      Value *V = expand(S->getOperand());
    -      return CastInst::createTruncOrBitCast(V, S->getType(), "tmp.", InsertPt);
    -    }
    -
    -    Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S) {
    -      Value *V = expand(S->getOperand());
    -      return CastInst::createZExtOrBitCast(V, S->getType(), "tmp.", InsertPt);
    -    }
    +    Value *visitTruncateExpr(SCEVTruncateExpr *S);
     
    -    Value *visitSignExtendExpr(SCEVSignExtendExpr *S) {
    -      Value *V = expand(S->getOperand());
    -      return CastInst::createSExtOrBitCast(V, S->getType(), "tmp.", InsertPt);
    -    }
    +    Value *visitZeroExtendExpr(SCEVZeroExtendExpr *S);
     
    -    Value *visitAddExpr(SCEVAddExpr *S) {
    -      Value *V = expand(S->getOperand(S->getNumOperands()-1));
    +    Value *visitSignExtendExpr(SCEVSignExtendExpr *S);
     
    -      // Emit a bunch of add instructions
    -      for (int i = S->getNumOperands()-2; i >= 0; --i)
    -        V = InsertBinop(Instruction::Add, V, expand(S->getOperand(i)),
    -                        InsertPt);
    -      return V;
    -    }
    +    Value *visitAddExpr(SCEVAddExpr *S);
     
         Value *visitMulExpr(SCEVMulExpr *S);
     
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolutionExpressions.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolutionExpressions.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolutionExpressions.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/ScalarEvolutionExpressions.h Sun Jul  6 15:45:41 2008
    @@ -229,7 +229,7 @@
         ~SCEVCommutativeExpr();
     
       public:
    -    unsigned getNumOperands() const { return Operands.size(); }
    +    unsigned getNumOperands() const { return (unsigned)Operands.size(); }
         const SCEVHandle &getOperand(unsigned i) const {
           assert(i < Operands.size() && "Operand index out of range!");
           return Operands[i];
    @@ -387,7 +387,7 @@
     
         SCEVAddRecExpr(const std::vector &ops, const Loop *l)
           : SCEV(scAddRecExpr), Operands(ops), L(l) {
    -      for (unsigned i = 0, e = Operands.size(); i != e; ++i)
    +      for (size_t i = 0, e = Operands.size(); i != e; ++i)
             assert(Operands[i]->isLoopInvariant(l) &&
                    "Operands of AddRec must be loop-invariant!");
         }
    @@ -397,7 +397,7 @@
         op_iterator op_begin() const { return Operands.begin(); }
         op_iterator op_end() const { return Operands.end(); }
     
    -    unsigned getNumOperands() const { return Operands.size(); }
    +    unsigned getNumOperands() const { return (unsigned)Operands.size(); }
         const SCEVHandle &getOperand(unsigned i) const { return Operands[i]; }
         const SCEVHandle &getStart() const { return Operands[0]; }
         const Loop *getLoop() const { return L; }
    @@ -407,7 +407,7 @@
         /// indicating how much this expression steps by.  If this is a polynomial
         /// of degree N, it returns a chrec of degree N-1.
         SCEVHandle getStepRecurrence(ScalarEvolution &SE) const {
    -      if (getNumOperands() == 2) return getOperand(1);
    +      if (isAffine()) return getOperand(1);
           return SE.getAddRecExpr(std::vector(op_begin()+1,op_end()),
                                   getLoop());
         }
    
    Added: llvm/branches/non-call-eh/include/llvm/Analysis/SparsePropagation.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/SparsePropagation.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/SparsePropagation.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/SparsePropagation.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,184 @@
    +//===- SparsePropagation.h - Sparse Conditional Property Propagation ------===//
    +//
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +//
    +//===----------------------------------------------------------------------===//
    +//
    +// This file implements an abstract sparse conditional propagation algorithm,
    +// modeled after SCCP, but with a customizable lattice function.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ANALYSIS_SPARSE_PROPAGATION_H
    +#define LLVM_ANALYSIS_SPARSE_PROPAGATION_H
    +
    +#include "llvm/ADT/DenseMap.h"
    +#include "llvm/ADT/SmallPtrSet.h"
    +#include "llvm/ADT/SmallVector.h"
    +#include 
    +#include 
    +
    +namespace llvm {
    +  class Value;
    +  class Constant;
    +  class Instruction;
    +  class PHINode;
    +  class TerminatorInst;
    +  class BasicBlock;
    +  class Function;
    +  class SparseSolver;
    +  
    +/// AbstractLatticeFunction - This class is implemented by the dataflow instance
    +/// to specify what the lattice values are and how they handle merges etc.
    +/// This gives the client the power to compute lattice values from instructions,
    +/// constants, etc.  The requirement is that lattice values must all fit into
    +/// a void*.  If a void* is not sufficient, the implementation should use this
    +/// pointer to be a pointer into a uniquing set or something.
    +///
    +class AbstractLatticeFunction {
    +public:
    +  typedef void *LatticeVal;
    +private:
    +  LatticeVal UndefVal, OverdefinedVal, UntrackedVal;
    +public:
    +  AbstractLatticeFunction(LatticeVal undefVal, LatticeVal overdefinedVal,
    +                          LatticeVal untrackedVal) {
    +    UndefVal = undefVal;
    +    OverdefinedVal = overdefinedVal;
    +    UntrackedVal = untrackedVal;
    +  }
    +  virtual ~AbstractLatticeFunction();
    +  
    +  LatticeVal getUndefVal()       const { return UndefVal; }
    +  LatticeVal getOverdefinedVal() const { return OverdefinedVal; }
    +  LatticeVal getUntrackedVal()   const { return UntrackedVal; }
    +  
    +  /// IsUntrackedValue - If the specified Value is something that is obviously
    +  /// uninteresting to the analysis (and would always return UntrackedVal),
    +  /// this function can return true to avoid pointless work.
    +  virtual bool IsUntrackedValue(Value *V) {
    +    return false;
    +  }
    +  
    +  /// ComputeConstant - Given a constant value, compute and return a lattice
    +  /// value corresponding to the specified constant.
    +  virtual LatticeVal ComputeConstant(Constant *C) {
    +    return getOverdefinedVal(); // always safe
    +  }
    +  
    +  /// GetConstant - If the specified lattice value is representable as an LLVM
    +  /// constant value, return it.  Otherwise return null.  The returned value
    +  /// must be in the same LLVM type as Val.
    +  virtual Constant *GetConstant(LatticeVal LV, Value *Val, SparseSolver &SS) {
    +    return 0;
    +  }
    +  
    +  /// MergeValues - Compute and return the merge of the two specified lattice
    +  /// values.  Merging should only move one direction down the lattice to
    +  /// guarantee convergence (toward overdefined).
    +  virtual LatticeVal MergeValues(LatticeVal X, LatticeVal Y) {
    +    return getOverdefinedVal(); // always safe, never useful.
    +  }
    +  
    +  /// ComputeInstructionState - Given an instruction and a vector of its operand
    +  /// values, compute the result value of the instruction.
    +  virtual LatticeVal ComputeInstructionState(Instruction &I, SparseSolver &SS) {
    +    return getOverdefinedVal(); // always safe, never useful.
    +  }
    +  
    +  /// PrintValue - Render the specified lattice value to the specified stream.
    +  virtual void PrintValue(LatticeVal V, std::ostream &OS);
    +};
    +
    +  
    +/// SparseSolver - This class is a general purpose solver for Sparse Conditional
    +/// Propagation with a programmable lattice function.
    +///
    +class SparseSolver {
    +  typedef AbstractLatticeFunction::LatticeVal LatticeVal;
    +  
    +  /// LatticeFunc - This is the object that knows the lattice and how to do
    +  /// compute transfer functions.
    +  AbstractLatticeFunction *LatticeFunc;
    +  
    +  DenseMap ValueState;  // The state each value is in.
    +  SmallPtrSet BBExecutable;   // The bbs that are executable.
    +  
    +  std::vector InstWorkList;   // Worklist of insts to process.
    +  
    +  std::vector BBWorkList;  // The BasicBlock work list
    +  
    +  /// KnownFeasibleEdges - Entries in this set are edges which have already had
    +  /// PHI nodes retriggered.
    +  typedef std::pair Edge;
    +  std::set KnownFeasibleEdges;
    +  
    +  SparseSolver(const SparseSolver&);    // DO NOT IMPLEMENT
    +  void operator=(const SparseSolver&);  // DO NOT IMPLEMENT
    +public:
    +  explicit SparseSolver(AbstractLatticeFunction *Lattice)
    +    : LatticeFunc(Lattice) {}
    +  ~SparseSolver() {
    +    delete LatticeFunc;
    +  }
    +  
    +  /// Solve - Solve for constants and executable blocks.
    +  ///
    +  void Solve(Function &F);
    +  
    +  void Print(Function &F, std::ostream &OS);
    +
    +  /// getLatticeState - Return the LatticeVal object that corresponds to the
    +  /// value.  If an value is not in the map, it is returned as untracked,
    +  /// unlike the getOrInitValueState method.
    +  LatticeVal getLatticeState(Value *V) const {
    +    DenseMap::iterator I = ValueState.find(V);
    +    return I != ValueState.end() ? I->second : LatticeFunc->getUntrackedVal();
    +  }
    +  
    +  /// getOrInitValueState - Return the LatticeVal object that corresponds to the
    +  /// value, initializing the value's state if it hasn't been entered into the
    +  /// map yet.   This function is necessary because not all values should start
    +  /// out in the underdefined state... Arguments should be overdefined, and
    +  /// constants should be marked as constants.
    +  ///
    +  LatticeVal getOrInitValueState(Value *V);
    +  
    +  /// isEdgeFeasible - Return true if the control flow edge from the 'From'
    +  /// basic block to the 'To' basic block is currently feasible.  If
    +  /// AggressiveUndef is true, then this treats values with unknown lattice
    +  /// values as undefined.  This is generally only useful when solving the
    +  /// lattice, not when querying it.
    +  bool isEdgeFeasible(BasicBlock *From, BasicBlock *To,
    +                      bool AggressiveUndef = false);
    +  
    +private:
    +  /// UpdateState - When the state for some instruction is potentially updated,
    +  /// this function notices and adds I to the worklist if needed.
    +  void UpdateState(Instruction &Inst, LatticeVal V);
    +  
    +  /// MarkBlockExecutable - This method can be used by clients to mark all of
    +  /// the blocks that are known to be intrinsically live in the processed unit.
    +  void MarkBlockExecutable(BasicBlock *BB);
    +  
    +  /// markEdgeExecutable - Mark a basic block as executable, adding it to the BB
    +  /// work list if it is not already executable.
    +  void markEdgeExecutable(BasicBlock *Source, BasicBlock *Dest);
    +  
    +  /// getFeasibleSuccessors - Return a vector of booleans to indicate which
    +  /// successors are reachable from a given terminator instruction.
    +  void getFeasibleSuccessors(TerminatorInst &TI, SmallVectorImpl &Succs,
    +                             bool AggressiveUndef);
    +  
    +  void visitInst(Instruction &I);
    +  void visitPHINode(PHINode &I);
    +  void visitTerminatorInst(TerminatorInst &TI);
    +
    +};
    +
    +} // end namespace llvm
    +
    +#endif // LLVM_ANALYSIS_SPARSE_PROPAGATION_H
    
    Modified: llvm/branches/non-call-eh/include/llvm/Analysis/ValueNumbering.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/ValueNumbering.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/ValueNumbering.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/ValueNumbering.h Sun Jul  6 15:45:41 2008
    @@ -22,6 +22,7 @@
     
     #include 
     #include "llvm/Pass.h"
    +#include "llvm/System/IncludeFile.h"
     
     namespace llvm {
     
    
    Added: llvm/branches/non-call-eh/include/llvm/Analysis/ValueTracking.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Analysis/ValueTracking.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Analysis/ValueTracking.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/Analysis/ValueTracking.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,87 @@
    +//===- llvm/Analysis/ValueTracking.h - Walk computations --------*- C++ -*-===//
    +//
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +//
    +//===----------------------------------------------------------------------===//
    +//
    +// This file contains routines that help analyze properties that chains of
    +// computations have.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_ANALYSIS_VALUETRACKING_H
    +#define LLVM_ANALYSIS_VALUETRACKING_H
    +
    +#include 
    +#include 
    +
    +namespace llvm {
    +  class Value;
    +  class Instruction;
    +  class APInt;
    +  class TargetData;
    +  
    +  /// ComputeMaskedBits - Determine which of the bits specified in Mask are
    +  /// known to be either zero or one and return them in the KnownZero/KnownOne
    +  /// bit sets.  This code only analyzes bits in Mask, in order to short-circuit
    +  /// processing.
    +  void ComputeMaskedBits(Value *V, const APInt &Mask, APInt &KnownZero,
    +                         APInt &KnownOne, TargetData *TD = 0,
    +                         unsigned Depth = 0);
    +  
    +  /// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero.  We use
    +  /// this predicate to simplify operations downstream.  Mask is known to be
    +  /// zero for bits that V cannot have.
    +  bool MaskedValueIsZero(Value *V, const APInt &Mask, 
    +                         TargetData *TD = 0, unsigned Depth = 0);
    +
    +  
    +  /// ComputeNumSignBits - Return the number of times the sign bit of the
    +  /// register is replicated into the other bits.  We know that at least 1 bit
    +  /// is always equal to the sign bit (itself), but other cases can give us
    +  /// information.  For example, immediately after an "ashr X, 2", we know that
    +  /// the top 3 bits are all equal to each other, so we return 3.
    +  ///
    +  /// 'Op' must have a scalar integer type.
    +  ///
    +  unsigned ComputeNumSignBits(Value *Op, TargetData *TD = 0,
    +                              unsigned Depth = 0);
    +
    +  /// CannotBeNegativeZero - Return true if we can prove that the specified FP 
    +  /// value is never equal to -0.0.
    +  ///
    +  bool CannotBeNegativeZero(const Value *V, unsigned Depth = 0);
    +
    +  /// FindScalarValue - Given an aggregrate and an sequence of indices, see if
    +  /// the scalar value indexed is already around as a register, for example if
    +  /// it were inserted directly into the aggregrate.
    +  ///
    +  /// If InsertBefore is not null, this function will duplicate (modified)
    +  /// insertvalues when a part of a nested struct is extracted.
    +  Value *FindInsertedValue(Value *V,
    +                         const unsigned *idx_begin,
    +                         const unsigned *idx_end,
    +                         Instruction *InsertBefore = 0);
    +
    +  /// This is a convenience wrapper for finding values indexed by a single index
    +  /// only.
    +  inline Value *FindInsertedValue(Value *V, const unsigned Idx,
    +                                 Instruction *InsertBefore = 0) {
    +    const unsigned Idxs[1] = { Idx };
    +    return FindInsertedValue(V, &Idxs[0], &Idxs[1], InsertBefore);
    +  }
    +  
    +  /// GetConstantStringInfo - This function computes the length of a
    +  /// null-terminated C string pointed to by V.  If successful, it returns true
    +  /// and returns the string in Str.  If unsuccessful, it returns false.  If
    +  /// StopAtNul is set to true (the default), the returned string is truncated
    +  /// by a nul character in the global.  If StopAtNul is false, the nul
    +  /// character is included in the result string.
    +  bool GetConstantStringInfo(Value *V, std::string &Str, uint64_t Offset = 0,
    +                             bool StopAtNul = true);
    +} // end namespace llvm
    +
    +#endif
    
    Modified: llvm/branches/non-call-eh/include/llvm/Argument.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Argument.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Argument.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Argument.h Sun Jul  6 15:45:41 2008
    @@ -15,6 +15,7 @@
     #define LLVM_ARGUMENT_H
     
     #include "llvm/Value.h"
    +#include "llvm/ParameterAttributes.h"
     
     namespace llvm {
     
    @@ -60,7 +61,13 @@
       /// hasSRetAttr - Return true if this argument has the sret attribute on it in
       /// its containing function.
       bool hasStructRetAttr() const;
    +
    +  /// addAttr - Add a ParamAttr to an argument
    +  void addAttr(ParameterAttributes);
       
    +  /// removeAttr - Remove a ParamAttr from an argument
    +  void removeAttr(ParameterAttributes);
    +
       virtual void print(std::ostream &OS) const;
       void print(std::ostream *OS) const {
         if (OS) print(*OS);
    
    Modified: llvm/branches/non-call-eh/include/llvm/AutoUpgrade.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/AutoUpgrade.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/AutoUpgrade.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/AutoUpgrade.h Sun Jul  6 15:45:41 2008
    @@ -35,6 +35,12 @@
       /// so that it can update all calls to the old function.
       void UpgradeCallsToIntrinsic(Function* F);
     
    +  /// This is an auto-upgrade hook for mutiple-value return statements.
    +  /// This function auto-upgrades all such return statements in the given
    +  /// function to use aggregate return values built with insertvalue
    +  /// instructions.
    +  void UpgradeMultipleReturnValues(Function *F);
    +
     } // End llvm namespace
     
     #endif
    
    Modified: llvm/branches/non-call-eh/include/llvm/BasicBlock.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/BasicBlock.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/BasicBlock.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/BasicBlock.h Sun Jul  6 15:45:41 2008
    @@ -7,16 +7,17 @@
     //
     //===----------------------------------------------------------------------===//
     //
    -//
     // This file contains the declaration of the BasicBlock class.
    +//
     //===----------------------------------------------------------------------===//
     
     #ifndef LLVM_BASICBLOCK_H
     #define LLVM_BASICBLOCK_H
     
     #include "llvm/Instruction.h"
    +#include "llvm/OperandTraits.h"
     #include "llvm/SymbolTableListTraits.h"
    -#include "llvm/ADT/ilist"
    +#include "llvm/ADT/ilist.h"
     #include "llvm/Support/DataTypes.h"
     
     namespace llvm {
    @@ -56,7 +57,6 @@
       InstListType InstList;
       BasicBlock *Prev, *Next; // Next and Prev links for our intrusive linked list
       Function *Parent;
    -  Use unwindDest;
     
       void setParent(Function *parent);
       void setNext(BasicBlock *N) { Next = N; }
    @@ -71,7 +71,7 @@
       /// InsertBefore is null), or before the specified basic block.
       ///
       explicit BasicBlock(const std::string &Name = "", Function *Parent = 0,
    -                      BasicBlock *InsertBefore = 0, BasicBlock *UnwindDest = 0);
    +                      BasicBlock *InsertBefore = 0);
     public:
       /// Instruction iterators...
       typedef InstListType::iterator                              iterator;
    @@ -79,11 +79,14 @@
     
       // allocate space for exactly zero operands
       static BasicBlock *Create(const std::string &Name = "", Function *Parent = 0,
    -                            BasicBlock *InsertBefore = 0, BasicBlock *UnwindDest = 0) {
    -    return new(!!UnwindDest) BasicBlock(Name, Parent, InsertBefore, UnwindDest);
    +                            BasicBlock *InsertBefore = 0) {
    +    return new(1) BasicBlock(Name, Parent, InsertBefore);
       }
       ~BasicBlock();
     
    +  /// Provide fast operand accessors
    +  DECLARE_TRANSPARENT_OPERAND_ACCESSORS(BasicBlock);
    +
       /// getUnwindDest - Returns the BasicBlock that flow will enter if an unwind
       /// instruction occurs in this block. May be null, in which case unwinding
       /// exits the function.
    @@ -111,6 +114,11 @@
       const Function *getParent() const { return Parent; }
             Function *getParent()       { return Parent; }
     
    +  /// use_back - Specialize the methods defined in Value, as we know that an
    +  /// BasicBlock can only be used by Instructions (specifically PHI and terms).
    +  Instruction       *use_back()       { return cast(*use_begin());}
    +  const Instruction *use_back() const { return cast(*use_begin());}
    +  
       /// getTerminator() - If this is a well formed basic block, then this returns
       /// a pointer to the terminator instruction.  If it is not, then you get a
       /// null pointer back.
    @@ -124,6 +132,9 @@
       /// the first instruction, which might be PHI.
       /// Returns 0 is there's no non-PHI instruction.
       Instruction* getFirstNonPHI();
    +  const Instruction* getFirstNonPHI() const {
    +    return const_cast(this)->getFirstNonPHI();
    +  }
       
       /// removeFromParent - This method unlinks 'this' from the containing
       /// function, but does not delete it.
    @@ -198,14 +209,7 @@
       /// update the PHI nodes that reside in the block.  Note that this should be
       /// called while the predecessor still refers to this block.
       ///
    -  /// DontDeleteUselessPHIs will keep PHIs that have one value or the same 
    -  /// value for all entries.
    -  ///
    -  /// OnlyDeleteOne will only remove one entry from a PHI, in case there were
    -  /// duplicate entries for the Pred.
    -  ///
    -  void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs = false,
    -                         bool OnlyDeleteOne = false);
    +  void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs = false);
     
       /// splitBasicBlock - This splits a basic block into two at the specified
       /// instruction.  Note that all instructions BEFORE the specified iterator
    @@ -241,6 +245,12 @@
       return BasicBlock::getInstListOffset();
     }
     
    +template <>
    +struct OperandTraits : OptionalOperandTraits<> {
    +};
    +
    +DEFINE_TRANSPARENT_CASTED_OPERAND_ACCESSORS(BasicBlock, BasicBlock)
    +
     } // End llvm namespace
     
     #endif
    
    Modified: llvm/branches/non-call-eh/include/llvm/Bitcode/Archive.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Bitcode/Archive.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Bitcode/Archive.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Bitcode/Archive.h Sun Jul  6 15:45:41 2008
    @@ -17,7 +17,7 @@
     #ifndef LLVM_BITCODE_ARCHIVE_H
     #define LLVM_BITCODE_ARCHIVE_H
     
    -#include "llvm/ADT/ilist"
    +#include "llvm/ADT/ilist.h"
     #include "llvm/System/Path.h"
     #include 
     #include 
    @@ -254,7 +254,7 @@
         inline reverse_iterator       rend  ()       { return members.rend();   }
         inline const_reverse_iterator rend  () const { return members.rend();   }
     
    -    inline unsigned               size()   const { return members.size();   }
    +    inline size_t                 size()   const { return members.size();   }
         inline bool                   empty()  const { return members.empty();  }
         inline const ArchiveMember&   front()  const { return members.front();  }
         inline       ArchiveMember&   front()        { return members.front();  }
    
    Modified: llvm/branches/non-call-eh/include/llvm/Bitcode/BitCodes.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Bitcode/BitCodes.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Bitcode/BitCodes.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Bitcode/BitCodes.h Sun Jul  6 15:45:41 2008
    @@ -165,7 +165,9 @@
       void addRef() { ++RefCount; }
       void dropRef() { if (--RefCount == 0) delete this; }
     
    -  unsigned getNumOperandInfos() const { return OperandList.size(); }
    +  unsigned getNumOperandInfos() const {
    +    return static_cast(OperandList.size());
    +  }
       const BitCodeAbbrevOp &getOperandInfo(unsigned N) const {
         return OperandList[N];
       }
    
    Modified: llvm/branches/non-call-eh/include/llvm/Bitcode/BitstreamReader.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Bitcode/BitstreamReader.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Bitcode/BitstreamReader.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Bitcode/BitstreamReader.h Sun Jul  6 15:45:41 2008
    @@ -85,12 +85,15 @@
       ~BitstreamReader() {
         // Abbrevs could still exist if the stream was broken.  If so, don't leak
         // them.
    -    for (unsigned i = 0, e = CurAbbrevs.size(); i != e; ++i)
    +    for (unsigned i = 0, e = static_cast(CurAbbrevs.size());
    +         i != e; ++i)
           CurAbbrevs[i]->dropRef();
     
    -    for (unsigned S = 0, e = BlockScope.size(); S != e; ++S) {
    +    for (unsigned S = 0, e = static_cast(BlockScope.size());
    +         S != e; ++S) {
           std::vector &Abbrevs = BlockScope[S].PrevAbbrevs;
    -      for (unsigned i = 0, e = Abbrevs.size(); i != e; ++i)
    +      for (unsigned i = 0, e = static_cast(Abbrevs.size());
    +           i != e; ++i)
             Abbrevs[i]->dropRef();
         }
         
    @@ -98,7 +101,8 @@
         while (!BlockInfoRecords.empty()) {
           BlockInfo &Info = BlockInfoRecords.back();
           // Free blockinfo abbrev info.
    -      for (unsigned i = 0, e = Info.Abbrevs.size(); i != e; ++i)
    +      for (unsigned i = 0, e = static_cast(Info.Abbrevs.size());
    +           i != e; ++i)
             Info.Abbrevs[i]->dropRef();
           BlockInfoRecords.pop_back();
         }
    @@ -127,7 +131,7 @@
         // Skip over any bits that are already consumed.
         if (WordBitNo) {
           NextChar -= 4;
    -      Read(WordBitNo);
    +      Read(static_cast(WordBitNo));
         }
       }
       
    @@ -237,7 +241,8 @@
         if (!BlockInfoRecords.empty() && BlockInfoRecords.back().BlockID == BlockID)
           return &BlockInfoRecords.back();
         
    -    for (unsigned i = 0, e = BlockInfoRecords.size(); i != e; ++i)
    +    for (unsigned i = 0, e = static_cast(BlockInfoRecords.size());
    +         i != e; ++i)
           if (BlockInfoRecords[i].BlockID == BlockID)
             return &BlockInfoRecords[i];
         return 0;
    @@ -282,7 +287,8 @@
         
         // Add the abbrevs specific to this block to the CurAbbrevs list.
         if (BlockInfo *Info = getBlockInfo(BlockID)) {
    -      for (unsigned i = 0, e = Info->Abbrevs.size(); i != e; ++i) {
    +      for (unsigned i = 0, e = static_cast(Info->Abbrevs.size());
    +           i != e; ++i) {
             CurAbbrevs.push_back(Info->Abbrevs[i]);
             CurAbbrevs.back()->addRef();
           }
    @@ -317,7 +323,8 @@
         CurCodeSize = BlockScope.back().PrevCodeSize;
         
         // Delete abbrevs from popped scope.
    -    for (unsigned i = 0, e = CurAbbrevs.size(); i != e; ++i)
    +    for (unsigned i = 0, e = static_cast(CurAbbrevs.size());
    +         i != e; ++i)
           CurAbbrevs[i]->dropRef();
         
         BlockScope.back().PrevAbbrevs.swap(CurAbbrevs);
    
    Modified: llvm/branches/non-call-eh/include/llvm/Bitcode/BitstreamWriter.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Bitcode/BitstreamWriter.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Bitcode/BitstreamWriter.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Bitcode/BitstreamWriter.h Sun Jul  6 15:45:41 2008
    @@ -70,7 +70,8 @@
         while (!BlockInfoRecords.empty()) {
           BlockInfo &Info = BlockInfoRecords.back();
           // Free blockinfo abbrev info.
    -      for (unsigned i = 0, e = Info.Abbrevs.size(); i != e; ++i)
    +      for (unsigned i = 0, e = static_cast(Info.Abbrevs.size());
    +           i != e; ++i)
             Info.Abbrevs[i]->dropRef();
           BlockInfoRecords.pop_back();
         }
    @@ -167,7 +168,8 @@
         if (!BlockInfoRecords.empty() && BlockInfoRecords.back().BlockID == BlockID)
           return &BlockInfoRecords.back();
         
    -    for (unsigned i = 0, e = BlockInfoRecords.size(); i != e; ++i)
    +    for (unsigned i = 0, e = static_cast(BlockInfoRecords.size());
    +         i != e; ++i)
           if (BlockInfoRecords[i].BlockID == BlockID)
             return &BlockInfoRecords[i];
         return 0;
    @@ -181,7 +183,7 @@
         EmitVBR(CodeLen, bitc::CodeLenWidth);
         FlushToWord();
         
    -    unsigned BlockSizeWordLoc = Out.size();
    +    unsigned BlockSizeWordLoc = static_cast(Out.size());
         unsigned OldCodeSize = CurCodeSize;
         
         // Emit a placeholder, which will be replaced when the block is popped.
    @@ -197,7 +199,8 @@
         // If there is a blockinfo for this BlockID, add all the predefined abbrevs
         // to the abbrev list.
         if (BlockInfo *Info = getBlockInfo(BlockID)) {
    -      for (unsigned i = 0, e = Info->Abbrevs.size(); i != e; ++i) {
    +      for (unsigned i = 0, e = static_cast(Info->Abbrevs.size());
    +           i != e; ++i) {
             CurAbbrevs.push_back(Info->Abbrevs[i]);
             Info->Abbrevs[i]->addRef();
           }
    @@ -208,7 +211,8 @@
         assert(!BlockScope.empty() && "Block scope imbalance!");
         
         // Delete all abbrevs.
    -    for (unsigned i = 0, e = CurAbbrevs.size(); i != e; ++i)
    +    for (unsigned i = 0, e = static_cast(CurAbbrevs.size());
    +         i != e; ++i)
           CurAbbrevs[i]->dropRef();
         
         const Block &B = BlockScope.back();
    @@ -219,7 +223,7 @@
         FlushToWord();
     
         // Compute the size of the block, in words, not counting the size field.
    -    unsigned SizeInWords = Out.size()/4-B.StartSizeWord - 1;
    +    unsigned SizeInWords= static_cast(Out.size())/4-B.StartSizeWord-1;
         unsigned ByteNo = B.StartSizeWord*4;
         
         // Update the block size field in the header of this sub-block.
    @@ -283,7 +287,8 @@
           Vals.insert(Vals.begin(), Code);
           
           unsigned RecordIdx = 0;
    -      for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) {
    +      for (unsigned i = 0, e = static_cast(Abbv->getNumOperandInfos());
    +           i != e; ++i) {
             const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
             if (Op.isLiteral() || Op.getEncoding() != BitCodeAbbrevOp::Array) {
               assert(RecordIdx < Vals.size() && "Invalid abbrev/record");
    @@ -295,7 +300,7 @@
               const BitCodeAbbrevOp &EltEnc = Abbv->getOperandInfo(++i);
               
               // Emit a vbr6 to indicate the number of elements present.
    -          EmitVBR(Vals.size()-RecordIdx, 6);
    +          EmitVBR(static_cast(Vals.size()-RecordIdx), 6);
               
               // Emit each field.
               for (; RecordIdx != Vals.size(); ++RecordIdx)
    @@ -308,8 +313,8 @@
           // form.
           EmitCode(bitc::UNABBREV_RECORD);
           EmitVBR(Code, 6);
    -      EmitVBR(Vals.size(), 6);
    -      for (unsigned i = 0, e = Vals.size(); i != e; ++i)
    +      EmitVBR(static_cast(Vals.size()), 6);
    +      for (unsigned i = 0, e = static_cast(Vals.size()); i != e; ++i)
             EmitVBR64(Vals[i], 6);
         }
       }
    @@ -323,7 +328,8 @@
       void EncodeAbbrev(BitCodeAbbrev *Abbv) {
         EmitCode(bitc::DEFINE_ABBREV);
         EmitVBR(Abbv->getNumOperandInfos(), 5);
    -    for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) {
    +    for (unsigned i = 0, e = static_cast(Abbv->getNumOperandInfos());
    +         i != e; ++i) {
           const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
           Emit(Op.isLiteral(), 1);
           if (Op.isLiteral()) {
    @@ -343,7 +349,8 @@
         // Emit the abbreviation as a record.
         EncodeAbbrev(Abbv);
         CurAbbrevs.push_back(Abbv);
    -    return CurAbbrevs.size()-1+bitc::FIRST_APPLICATION_ABBREV;
    +    return static_cast(CurAbbrevs.size())-1 +
    +      bitc::FIRST_APPLICATION_ABBREV;
       }
       
       //===--------------------------------------------------------------------===//
    
    Modified: llvm/branches/non-call-eh/include/llvm/Bitcode/Deserialize.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Bitcode/Deserialize.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Bitcode/Deserialize.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Bitcode/Deserialize.h Sun Jul  6 15:45:41 2008
    @@ -436,7 +436,7 @@
       }
       
       template 
    -  T* ReadPtr() { T* x; ReadPtr(x,false); return x; }
    +  T* ReadPtr() { T* x = 0; ReadPtr(x,false); return x; }
     
       void ReadUIntPtr(uintptr_t& PtrRef, const SerializedPtrID& PtrID, 
                        bool AllowBackpatch = true);
    
    Modified: llvm/branches/non-call-eh/include/llvm/Bitcode/LLVMBitCodes.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/Bitcode/LLVMBitCodes.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/Bitcode/LLVMBitCodes.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/Bitcode/LLVMBitCodes.h Sun Jul  6 15:45:41 2008
    @@ -125,7 +125,9 @@
         CST_CODE_CE_INSERTELT  = 15,  // CE_INSERTELT:  [opval, opval, opval]
         CST_CODE_CE_SHUFFLEVEC = 16,  // CE_SHUFFLEVEC: [opval, opval, opval]
         CST_CODE_CE_CMP        = 17,  // CE_CMP:        [opty, opval, opval, pred]
    -    CST_CODE_INLINEASM     = 18   // INLINEASM:     [sideeffect,asmstr,conststr]
    +    CST_CODE_INLINEASM     = 18,  // INLINEASM:     [sideeffect,asmstr,conststr]
    +    CST_CODE_CE_EXTRACTVAL = 19,  // CE_EXTRACTVAL: [n x operands]
    +    CST_CODE_CE_INSERTVAL  = 20   // CE_INSERTVAL:  [n x operands]
       };
       
       /// CastOpcodes - These are values used in the bitcode files to encode which
    @@ -203,9 +205,11 @@
         // spaces) is retained.
         FUNC_CODE_INST_STORE2      = 24, // STORE:      [ptrty,ptr,val, align, vol]
         FUNC_CODE_INST_GETRESULT   = 25, // GETRESULT:  [ty, opval, n]
    +    FUNC_CODE_INST_EXTRACTVAL  = 26, // EXTRACTVAL: [n x operands]
    +    FUNC_CODE_INST_INSERTVAL   = 27, // INSERTVAL:  [n x operands]
     
    -    FUNC_CODE_INST_BB_UNWINDDEST = 26, // BB_UNWINDDEST: [bb#]
    -    FUNC_CODE_INST_BB_NOUNWIND = 27  // BB_NOUNWIND
    +    FUNC_CODE_INST_BB_UNWINDDEST = 28, // BB_UNWINDDEST: [bb#]
    +    FUNC_CODE_INST_BB_NOUNWIND = 29  // BB_NOUNWIND
       };
     } // End bitc namespace
     } // End llvm namespace
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/AsmPrinter.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/AsmPrinter.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/AsmPrinter.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/AsmPrinter.h Sun Jul  6 15:45:41 2008
    @@ -236,6 +236,7 @@
         /// then it will be printed first.  Comments should not contain '\n'.
         void EOL() const;
         void EOL(const std::string &Comment) const;
    +    void EOL(const char* Comment) const;
         
         /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an
         /// unsigned leb128 value.
    @@ -314,8 +315,7 @@
         void EmitConstantValueOnly(const Constant *CV);
     
         /// EmitGlobalConstant - Print a general LLVM constant to the .s file.
    -    /// If Packed is false, pad to the ABI size.
    -    void EmitGlobalConstant(const Constant* CV, bool Packed = false);
    +    void EmitGlobalConstant(const Constant* CV);
     
         virtual void EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV);
         
    @@ -348,6 +348,11 @@
         /// specified type.
         void printDataDirective(const Type *type);
     
    +    /// printSuffixedName - This prints a name with preceding 
    +    /// getPrivateGlobalPrefix and the specified suffix, handling quoted names
    +    /// correctly.
    +    void printSuffixedName(std::string &Name, const char* Suffix);
    +
       private:
         void EmitLLVMUsedList(Constant *List);
         void EmitXXStructorList(Constant *List);
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/CallingConvLower.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/CallingConvLower.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/CallingConvLower.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/CallingConvLower.h Sun Jul  6 15:45:41 2008
    @@ -49,14 +49,14 @@
       LocInfo HTP : 7;
       
       /// ValVT - The type of the value being assigned.
    -  MVT::ValueType ValVT;
    +  MVT ValVT;
     
       /// LocVT - The type of the location being assigned to.
    -  MVT::ValueType LocVT;
    +  MVT LocVT;
     public:
         
    -  static CCValAssign getReg(unsigned ValNo, MVT::ValueType ValVT,
    -                            unsigned RegNo, MVT::ValueType LocVT,
    +  static CCValAssign getReg(unsigned ValNo, MVT ValVT,
    +                            unsigned RegNo, MVT LocVT,
                                 LocInfo HTP) {
         CCValAssign Ret;
         Ret.ValNo = ValNo;
    @@ -67,8 +67,8 @@
         Ret.LocVT = LocVT;
         return Ret;
       }
    -  static CCValAssign getMem(unsigned ValNo, MVT::ValueType ValVT,
    -                            unsigned Offset, MVT::ValueType LocVT,
    +  static CCValAssign getMem(unsigned ValNo, MVT ValVT,
    +                            unsigned Offset, MVT LocVT,
                                 LocInfo HTP) {
         CCValAssign Ret;
         Ret.ValNo = ValNo;
    @@ -81,14 +81,14 @@
       }
       
       unsigned getValNo() const { return ValNo; }
    -  MVT::ValueType getValVT() const { return ValVT; }
    +  MVT getValVT() const { return ValVT; }
     
       bool isRegLoc() const { return !isMem; }
       bool isMemLoc() const { return isMem; }
       
       unsigned getLocReg() const { assert(isRegLoc()); return Loc; }
       unsigned getLocMemOffset() const { assert(isMemLoc()); return Loc; }
    -  MVT::ValueType getLocVT() const { return LocVT; }
    +  MVT getLocVT() const { return LocVT; }
       
       LocInfo getLocInfo() const { return HTP; }
     };
    @@ -96,8 +96,8 @@
     
     /// CCAssignFn - This function assigns a location for Val, updating State to
     /// reflect the change.
    -typedef bool CCAssignFn(unsigned ValNo, MVT::ValueType ValVT,
    -                        MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,
    +typedef bool CCAssignFn(unsigned ValNo, MVT ValVT,
    +                        MVT LocVT, CCValAssign::LocInfo LocInfo,
                             ISD::ArgFlagsTy ArgFlags, CCState &State);
     
       
    @@ -217,8 +217,8 @@
       // HandleByVal - Allocate a stack slot large enough to pass an argument by
       // value. The size and alignment information of the argument is encoded in its
       // parameter attribute.
    -  void HandleByVal(unsigned ValNo, MVT::ValueType ValVT,
    -                   MVT::ValueType LocVT, CCValAssign::LocInfo LocInfo,
    +  void HandleByVal(unsigned ValNo, MVT ValVT,
    +                   MVT LocVT, CCValAssign::LocInfo LocInfo,
                        int MinSize, int MinAlign, ISD::ArgFlagsTy ArgFlags);
     
     private:
    
    Added: llvm/branches/non-call-eh/include/llvm/CodeGen/DAGISelHeader.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/DAGISelHeader.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/DAGISelHeader.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/DAGISelHeader.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,192 @@
    +//==-llvm/CodeGen/DAGISelHeader.h - Common DAG ISel definitions  -*- C++ -*-==//
    +//
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +//
    +//===----------------------------------------------------------------------===//
    +//
    +// This file provides definitions of the common, target-independent methods and 
    +// data, which is used by SelectionDAG-based instruction selectors.
    +//
    +// *** NOTE: This file is #included into the middle of the target
    +// *** instruction selector class.  These functions are really methods.
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_CODEGEN_DAGISEL_HEADER_H
    +#define LLVM_CODEGEN_DAGISEL_HEADER_H
    +
    +/// ISelQueue - Instruction selector priority queue sorted 
    +/// in the order of increasing NodeId() values.
    +std::vector ISelQueue;
    +
    +/// Keep track of nodes which have already been added to queue.
    +unsigned char *ISelQueued;
    +
    +/// Keep track of nodes which have already been selected.
    +unsigned char *ISelSelected;
    +
    +/// IsChainCompatible - Returns true if Chain is Op or Chain does
    +/// not reach Op.
    +static bool IsChainCompatible(SDNode *Chain, SDNode *Op) {
    +  if (Chain->getOpcode() == ISD::EntryToken)
    +    return true;
    +  else if (Chain->getOpcode() == ISD::TokenFactor)
    +    return false;
    +  else if (Chain->getNumOperands() > 0) {
    +    SDOperand C0 = Chain->getOperand(0);
    +    if (C0.getValueType() == MVT::Other)
    +      return C0.Val != Op && IsChainCompatible(C0.Val, Op);
    +  }
    +  return true;
    +}
    +
    +/// isel_sort - Sorting functions for the selection queue in the
    +/// increasing NodeId order.
    +struct isel_sort : public std::binary_function {
    +  bool operator()(const SDNode* left, const SDNode* right) const {
    +    return (left->getNodeId() > right->getNodeId());
    +  }
    +};
    +
    +/// setQueued - marks the node with a given NodeId() as element of the 
    +/// instruction selection queue.
    +inline void setQueued(int Id) {
    +  ISelQueued[Id / 8] |= 1 << (Id % 8);
    +}
    +
    +/// isSelected - checks if the node with a given NodeId() is
    +/// in the instruction selection queue already.
    +inline bool isQueued(int Id) {
    +  return ISelQueued[Id / 8] & (1 << (Id % 8));
    +}
    +
    +/// setSelected - marks the node with a given NodeId() as selected.
    +inline void setSelected(int Id) {
    +  ISelSelected[Id / 8] |= 1 << (Id % 8);
    +}
    +
    +/// isSelected - checks if the node with a given NodeId() is
    +/// selected already.
    +inline bool isSelected(int Id) {
    +  return ISelSelected[Id / 8] & (1 << (Id % 8));
    +}
    +
    +/// AddToISelQueue - adds a node to the instruction 
    +/// selection queue.
    +void AddToISelQueue(SDOperand N) DISABLE_INLINE {
    +  int Id = N.Val->getNodeId();
    +  if (Id != -1 && !isQueued(Id)) {
    +    ISelQueue.push_back(N.Val);
    +    std::push_heap(ISelQueue.begin(), ISelQueue.end(), isel_sort());
    +    setQueued(Id);
    +  }
    +}
    +
    +/// ISelQueueUpdater - helper class to handle updates of the 
    +/// instruciton selection queue.
    +class VISIBILITY_HIDDEN ISelQueueUpdater :
    +  public SelectionDAG::DAGUpdateListener {
    +    std::vector &ISelQueue;
    +    bool HadDelete; // Indicate if any deletions were done.
    +  public:
    +    explicit ISelQueueUpdater(std::vector &isq)
    +      : ISelQueue(isq), HadDelete(false) {}
    +    
    +    bool hadDelete() const { return HadDelete; }
    +
    +    /// NodeDeleted - remove node from the selection queue.
    +    virtual void NodeDeleted(SDNode *N, SDNode *E) {
    +      ISelQueue.erase(std::remove(ISelQueue.begin(), ISelQueue.end(), N),
    +                      ISelQueue.end());
    +      HadDelete = true;
    +    }
    +
    +    /// NodeUpdated - Ignore updates for now.
    +    virtual void NodeUpdated(SDNode *N) {}
    +  };
    +
    +/// UpdateQueue - update the instruction selction queue to maintain 
    +/// the increasing NodeId() ordering property.
    +inline void UpdateQueue(const ISelQueueUpdater &ISQU) {
    +  if (ISQU.hadDelete())
    +    std::make_heap(ISelQueue.begin(), ISelQueue.end(),isel_sort());
    +}
    +
    +
    +/// ReplaceUses - replace all uses of the old node F with the use
    +/// of the new node T.
    +void ReplaceUses(SDOperand F, SDOperand T) DISABLE_INLINE {
    +  ISelQueueUpdater ISQU(ISelQueue);
    +  CurDAG->ReplaceAllUsesOfValueWith(F, T, &ISQU);
    +  setSelected(F.Val->getNodeId());
    +  UpdateQueue(ISQU);
    +}
    +
    +/// ReplaceUses - replace all uses of the old node F with the use
    +/// of the new node T.
    +void ReplaceUses(SDNode *F, SDNode *T) DISABLE_INLINE {
    +  unsigned FNumVals = F->getNumValues();
    +  unsigned TNumVals = T->getNumValues();
    +  ISelQueueUpdater ISQU(ISelQueue);
    +  if (FNumVals != TNumVals) {
    +    for (unsigned i = 0, e = std::min(FNumVals, TNumVals); i < e; ++i)
    +     CurDAG->ReplaceAllUsesOfValueWith(SDOperand(F, i), SDOperand(T, i), &ISQU);
    +  } else {
    +    CurDAG->ReplaceAllUsesWith(F, T, &ISQU);
    +  }
    +  setSelected(F->getNodeId());
    +  UpdateQueue(ISQU);
    +}
    +
    +/// SelectRoot - Top level entry to DAG instruction selector.
    +/// Selects instructions starting at the root of the current DAG.
    +SDOperand SelectRoot(SDOperand Root) {
    +  SelectRootInit();
    +  unsigned NumBytes = (DAGSize + 7) / 8;
    +  ISelQueued   = new unsigned char[NumBytes];
    +  ISelSelected = new unsigned char[NumBytes];
    +  memset(ISelQueued,   0, NumBytes);
    +  memset(ISelSelected, 0, NumBytes);
    +
    +  // Create a dummy node (which is not added to allnodes), that adds
    +  // a reference to the root node, preventing it from being deleted,
    +  // and tracking any changes of the root.
    +  HandleSDNode Dummy(CurDAG->getRoot());
    +  ISelQueue.push_back(CurDAG->getRoot().Val);
    +
    +  // Select pending nodes from the instruction selection queue
    +  // until no more nodes are left for selection.
    +  while (!ISelQueue.empty()) {
    +    SDNode *Node = ISelQueue.front();
    +    std::pop_heap(ISelQueue.begin(), ISelQueue.end(), isel_sort());
    +    ISelQueue.pop_back();
    +    // Skip already selected nodes.
    +    if (isSelected(Node->getNodeId()))
    +      continue;
    +    SDNode *ResNode = Select(SDOperand(Node, 0));
    +    // If node should not be replaced, 
    +    // continue with the next one.
    +    if (ResNode == Node)
    +      continue;
    +    // Replace node.
    +    if (ResNode)
    +      ReplaceUses(Node, ResNode);
    +    // If after the replacement this node is not used any more,
    +    // remove this dead node.
    +    if (Node->use_empty()) { // Don't delete EntryToken, etc.
    +          ISelQueueUpdater ISQU(ISelQueue);
    +          CurDAG->RemoveDeadNode(Node, &ISQU);
    +          UpdateQueue(ISQU);
    +    }
    +  }
    +
    +  delete[] ISelQueued;
    +  ISelQueued = NULL;
    +  delete[] ISelSelected;
    +  ISelSelected = NULL;
    +  return Dummy.getValue();
    +}
    +
    +#endif /* LLVM_CODEGEN_DAGISEL_HEADER_H */
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/LinkAllCodegenComponents.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/LinkAllCodegenComponents.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/LinkAllCodegenComponents.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/LinkAllCodegenComponents.h Sun Jul  6 15:45:41 2008
    @@ -39,10 +39,10 @@
           (void) llvm::createOcamlCollector();
           (void) llvm::createShadowStackCollector();
           
    -      (void) llvm::createBURRListDAGScheduler(NULL, NULL, NULL);
    -      (void) llvm::createTDRRListDAGScheduler(NULL, NULL, NULL);
    -      (void) llvm::createTDListDAGScheduler(NULL, NULL, NULL);
    -      (void) llvm::createDefaultScheduler(NULL, NULL, NULL);
    +      (void) llvm::createBURRListDAGScheduler(NULL, NULL, NULL, false);
    +      (void) llvm::createTDRRListDAGScheduler(NULL, NULL, NULL, false);
    +      (void) llvm::createTDListDAGScheduler(NULL, NULL, NULL, false);
    +      (void) llvm::createDefaultScheduler(NULL, NULL, NULL, false);
     
         }
       } ForceCodegenLinking; // Force link by creating a global definition.
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/LiveInterval.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/LiveInterval.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/LiveInterval.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/LiveInterval.h Sun Jul  6 15:45:41 2008
    @@ -23,9 +23,7 @@
     
     #include "llvm/ADT/SmallVector.h"
     #include "llvm/Support/Allocator.h"
    -#include "llvm/Support/Streams.h"
     #include 
    -#include 
     #include 
     
     namespace llvm {
    @@ -37,6 +35,7 @@
       /// merge point), it contains ~0u,x. If the value number is not in use, it
       /// contains ~1u,x to indicate that the value # is not used. 
       ///   def   - Instruction # of the definition.
    +  ///         - or reg # of the definition if it's a stack slot liveinterval.
       ///   copy  - Copy iff val# is defined by a copy; zero otherwise.
       ///   hasPHIKill - One or more of the kills are PHI nodes.
       ///   kills - Instruction # of the kills.
    @@ -102,15 +101,18 @@
         typedef SmallVector Ranges;
         typedef SmallVector VNInfoList;
     
    -    unsigned reg;        // the register of this interval
    +    unsigned reg;        // the register or stack slot of this interval
    +                         // if the top bits is set, it represents a stack slot.
         unsigned preference; // preferred register to allocate for this interval
         float weight;        // weight of this interval
         Ranges ranges;       // the ranges in which this register is live
         VNInfoList valnos;   // value#'s
     
       public:
    -    LiveInterval(unsigned Reg, float Weight)
    +    LiveInterval(unsigned Reg, float Weight, bool IsSS = false)
           : reg(Reg), preference(0), weight(Weight) {
    +      if (IsSS)
    +        reg = reg | (1U << (sizeof(unsigned)*8-1));
         }
     
         typedef Ranges::iterator iterator;
    @@ -141,9 +143,22 @@
           return I;
         }
     
    +    /// isStackSlot - Return true if this is a stack slot interval.
    +    ///
    +    bool isStackSlot() const {
    +      return reg & (1U << (sizeof(unsigned)*8-1));
    +    }
    +
    +    /// getStackSlotIndex - Return stack slot index if this is a stack slot
    +    /// interval.
    +    int getStackSlotIndex() const {
    +      assert(isStackSlot() && "Interval is not a stack slot interval!");
    +      return reg & ~(1U << (sizeof(unsigned)*8-1));
    +    }
    +
         bool containsOneValue() const { return valnos.size() == 1; }
     
    -    unsigned getNumValNums() const { return valnos.size(); }
    +    unsigned getNumValNums() const { return (unsigned)valnos.size(); }
         
         /// getValNumInfo - Returns pointer to the specified val#.
         ///
    @@ -168,14 +183,15 @@
         VNInfo *getNextValue(unsigned MIIdx, MachineInstr *CopyMI,
                              BumpPtrAllocator &VNInfoAllocator) {
     #ifdef __GNUC__
    -      unsigned Alignment = __alignof__(VNInfo);
    +      unsigned Alignment = (unsigned)__alignof__(VNInfo);
     #else
           // FIXME: ugly.
           unsigned Alignment = 8;
     #endif
    -      VNInfo *VNI= static_cast(VNInfoAllocator.Allocate(sizeof(VNInfo),
    -                                                                 Alignment));
    -      new (VNI) VNInfo(valnos.size(), MIIdx, CopyMI);
    +      VNInfo *VNI =
    +        static_cast(VNInfoAllocator.Allocate((unsigned)sizeof(VNInfo),
    +                                                      Alignment));
    +      new (VNI) VNInfo((unsigned)valnos.size(), MIIdx, CopyMI);
           valnos.push_back(VNI);
           return VNI;
         }
    @@ -196,7 +212,8 @@
         /// addKills - Add a number of kills into the VNInfo kill vector. If this
         /// interval is live at a kill point, then the kill is not added.
         void addKills(VNInfo *VNI, const SmallVector &kills) {
    -      for (unsigned i = 0, e = kills.size(); i != e; ++i) {
    +      for (unsigned i = 0, e = static_cast(kills.size());
    +           i != e; ++i) {
             unsigned KillIdx = kills[i];
             if (!liveBeforeAndAt(KillIdx)) {
               SmallVector::iterator
    @@ -313,6 +330,11 @@
         /// FindLiveRangeContaining - Return an iterator to the live range that
         /// contains the specified index, or end() if there is none.
         iterator FindLiveRangeContaining(unsigned Idx);
    +
    +    /// findDefinedVNInfo - Find the VNInfo that's defined at the specified
    +    /// index (register interval) or defined by the specified register (stack
    +    /// inteval).
    +    VNInfo *findDefinedVNInfo(unsigned DefIdxOrReg) const;
         
         /// overlaps - Return true if the intersection of the two live intervals is
         /// not empty.
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/LiveIntervalAnalysis.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/LiveIntervalAnalysis.h Sun Jul  6 15:45:41 2008
    @@ -131,7 +131,7 @@
         const_iterator end() const { return r2iMap_.end(); }
         iterator begin() { return r2iMap_.begin(); }
         iterator end() { return r2iMap_.end(); }
    -    unsigned getNumIntervals() const { return r2iMap_.size(); }
    +    unsigned getNumIntervals() const { return (unsigned)r2iMap_.size(); }
     
         LiveInterval &getInterval(unsigned reg) {
           Reg2IntervalMap::iterator I = r2iMap_.find(reg);
    @@ -169,6 +169,13 @@
           return MBB2IdxMap[MBBNo].second;
         }
     
    +    /// getIntervalSize - get the size of an interval in "units,"
    +    /// where every function is composed of one thousand units.  This
    +    /// measure scales properly with empty index slots in the function.
    +    unsigned getScaledIntervalSize(LiveInterval& I) const {
    +      return (1000 / InstrSlots::NUM * I.getSize()) / i2miMap_.size();
    +    }
    +
         /// getMBBFromIndex - given an index in any instruction of an
         /// MBB return a pointer the MBB
         MachineBasicBlock* getMBBFromIndex(unsigned index) const {
    @@ -220,6 +227,11 @@
             I = r2iMap_.insert(I, std::make_pair(reg, createInterval(reg)));
           return I->second;
         }
    +    
    +    /// addLiveRangeToEndOfBlock - Given a register and an instruction,
    +    /// adds a live range from that instruction to the end of its MBB.
    +    LiveRange addLiveRangeToEndOfBlock(unsigned reg,
    +                                        MachineInstr* startInst);
     
         // Interval removal
     
    @@ -278,10 +290,12 @@
         }
     
         /// addIntervalsForSpills - Create new intervals for spilled defs / uses of
    -    /// the given interval.
    +    /// the given interval. FIXME: It also returns the weight of the spill slot
    +    /// (if any is created) by reference. This is temporary.
         std::vector
         addIntervalsForSpills(const LiveInterval& i,
    -                          const MachineLoopInfo *loopInfo, VirtRegMap& vrm);
    +                          const MachineLoopInfo *loopInfo, VirtRegMap& vrm,
    +                          float &SSWeight);
     
         /// spillPhysRegAroundRegDefsUses - Spill the specified physical register
         /// around all defs and uses of the specified interval.
    @@ -302,6 +316,9 @@
         unsigned getNumConflictsWithPhysReg(const LiveInterval &li,
                                             unsigned PhysReg) const;
     
    +    /// computeNumbering - Compute the index numbering.
    +    void computeNumbering();
    +
       private:      
         /// computeIntervals - Compute live intervals.
         void computeIntervals();
    @@ -311,20 +328,20 @@
         /// handleVirtualRegisterDef)
         void handleRegisterDef(MachineBasicBlock *MBB,
                                MachineBasicBlock::iterator MI, unsigned MIIdx,
    -                           unsigned reg);
    +                           MachineOperand& MO);
     
         /// handleVirtualRegisterDef - update intervals for a virtual
         /// register def
         void handleVirtualRegisterDef(MachineBasicBlock *MBB,
                                       MachineBasicBlock::iterator MI,
    -                                  unsigned MIIdx,
    +                                  unsigned MIIdx, MachineOperand& MO,
                                       LiveInterval& interval);
     
         /// handlePhysicalRegisterDef - update intervals for a physical register
         /// def.
         void handlePhysicalRegisterDef(MachineBasicBlock* mbb,
                                        MachineBasicBlock::iterator mi,
    -                                   unsigned MIIdx,
    +                                   unsigned MIIdx, MachineOperand& MO,
                                        LiveInterval &interval,
                                        MachineInstr *CopyMI);
     
    @@ -416,7 +433,7 @@
             SmallVector &ReMatIds, const MachineLoopInfo *loopInfo,
             unsigned &NewVReg, unsigned ImpUse, bool &HasDef, bool &HasUse,
             std::map &MBBVRegsMap,
    -        std::vector &NewLIs);
    +        std::vector &NewLIs, float &SSWeight);
         void rewriteInstructionsForSpills(const LiveInterval &li, bool TrySplit,
             LiveInterval::Ranges::const_iterator &I,
             MachineInstr *OrigDefMI, MachineInstr *DefMI, unsigned Slot, int LdSlot,
    @@ -428,7 +445,7 @@
             BitVector &RestoreMBBs,
             std::map > &RestoreIdxes,
             std::map &MBBVRegsMap,
    -        std::vector &NewLIs);
    +        std::vector &NewLIs, float &SSWeight);
     
         static LiveInterval createInterval(unsigned Reg);
     
    
    Added: llvm/branches/non-call-eh/include/llvm/CodeGen/LiveStackAnalysis.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/LiveStackAnalysis.h?rev=53163&view=auto
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/LiveStackAnalysis.h (added)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/LiveStackAnalysis.h Sun Jul  6 15:45:41 2008
    @@ -0,0 +1,71 @@
    +//===-- LiveStackAnalysis.h - Live Stack Slot Analysis ----------*- C++ -*-===//
    +//
    +//                     The LLVM Compiler Infrastructure
    +//
    +// This file is distributed under the University of Illinois Open Source
    +// License. See LICENSE.TXT for details.
    +//
    +//===----------------------------------------------------------------------===//
    +//
    +// This file implements the live stack slot analysis pass. It is analogous to
    +// live interval analysis except it's analyzing liveness of stack slots rather
    +// than registers.
    +//
    +//===----------------------------------------------------------------------===//
    +
    +#ifndef LLVM_CODEGEN_LIVESTACK_ANALYSIS_H
    +#define LLVM_CODEGEN_LIVESTACK_ANALYSIS_H
    +
    +#include "llvm/CodeGen/MachineFunctionPass.h"
    +#include "llvm/CodeGen/LiveInterval.h"
    +#include "llvm/Support/Allocator.h"
    +#include 
    +
    +namespace llvm {
    +
    +  class LiveStacks : public MachineFunctionPass {
    +    /// Special pool allocator for VNInfo's (LiveInterval val#).
    +    ///
    +    BumpPtrAllocator VNInfoAllocator;
    +
    +    /// s2iMap - Stack slot indices to live interval mapping.
    +    ///
    +    typedef std::map SS2IntervalMap;
    +    SS2IntervalMap s2iMap;
    +
    +  public:
    +    static char ID; // Pass identification, replacement for typeid
    +    LiveStacks() : MachineFunctionPass((intptr_t)&ID) {}
    +
    +    typedef SS2IntervalMap::iterator iterator;
    +    typedef SS2IntervalMap::const_iterator const_iterator;
    +    const_iterator begin() const { return s2iMap.begin(); }
    +    const_iterator end() const { return s2iMap.end(); }
    +    iterator begin() { return s2iMap.begin(); }
    +    iterator end() { return s2iMap.end(); }
    +    unsigned getNumIntervals() const { return (unsigned)s2iMap.size(); }
    +
    +    LiveInterval &getOrCreateInterval(int Slot) {
    +      SS2IntervalMap::iterator I = s2iMap.find(Slot);
    +      if (I == s2iMap.end())
    +        I = s2iMap.insert(I,std::make_pair(Slot,LiveInterval(Slot,0.0F,true)));
    +      return I->second;
    +    }
    +
    +    BumpPtrAllocator& getVNInfoAllocator() { return VNInfoAllocator; }
    +
    +    virtual void getAnalysisUsage(AnalysisUsage &AU) const;
    +    virtual void releaseMemory();
    +
    +    /// runOnMachineFunction - pass entry point
    +    virtual bool runOnMachineFunction(MachineFunction&);
    +
    +    /// print - Implement the dump method.
    +    virtual void print(std::ostream &O, const Module* = 0) const;
    +    void print(std::ostream *O, const Module* M = 0) const {
    +      if (O) print(*O, M);
    +    }
    +  };
    +}
    +
    +#endif /* LLVM_CODEGEN_LIVESTACK_ANALYSIS_H */
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/LiveVariables.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/LiveVariables.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/LiveVariables.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/LiveVariables.h Sun Jul  6 15:45:41 2008
    @@ -52,8 +52,7 @@
       /// non-phi instructions that are the last users of the value.
       ///
       /// In the common case where a value is defined and killed in the same block,
    -  /// DefInst is the defining inst, there is one killing instruction, and 
    -  /// AliveBlocks is empty.
    +  /// There is one killing instruction, and  AliveBlocks is empty.
       ///
       /// Otherwise, the value is live out of the block.  If the value is live
       /// across any blocks, these blocks are listed in AliveBlocks.  Blocks where
    @@ -68,16 +67,11 @@
       /// but does include the predecessor block in the AliveBlocks set (unless that
       /// block also defines the value).  This leads to the (perfectly sensical)
       /// situation where a value is defined in a block, and the last use is a phi
    -  /// node in the successor.  In this case, DefInst will be the defining
    -  /// instruction, AliveBlocks is empty (the value is not live across any 
    -  /// blocks) and Kills is empty (phi nodes are not included).  This is sensical
    -  /// because the value must be live to the end of the block, but is not live in
    -  /// any successor blocks.
    +  /// node in the successor.  In this case, AliveBlocks is empty (the value is
    +  /// not live across any  blocks) and Kills is empty (phi nodes are not
    +  /// included). This is sensical because the value must be live to the end of
    +  /// the block, but is not live in any successor blocks.
       struct VarInfo {
    -    /// DefInst - The machine instruction that defines this register.
    -    ///
    -    MachineInstr *DefInst;
    -
         /// AliveBlocks - Set of blocks of which this value is alive completely
         /// through.  This is a bit set which uses the basic block number as an
         /// index.
    @@ -97,7 +91,7 @@
         ///
         std::vector Kills;
     
    -    VarInfo() : DefInst(0), NumUses(0) {}
    +    VarInfo() : NumUses(0) {}
     
         /// removeKill - Delete a kill corresponding to the specified
         /// machine instruction. Returns true if there was a kill
    @@ -183,11 +177,10 @@
       //===--------------------------------------------------------------------===//
       //  API to update live variable information
     
    -  /// instructionChanged - When the address of an instruction changes, this
    -  /// method should be called so that live variables can update its internal
    -  /// data structures.  This removes the records for OldMI, transfering them to
    -  /// the records for NewMI.
    -  void instructionChanged(MachineInstr *OldMI, MachineInstr *NewMI);
    +  /// replaceKillInstruction - Update register kill info by replacing a kill
    +  /// instruction with a new one.
    +  void replaceKillInstruction(unsigned Reg, MachineInstr *OldMI,
    +                              MachineInstr *NewMI);
     
       /// addVirtualRegisterKilled - Add information about the fact that the
       /// specified register is killed after being used by the specified
    @@ -199,13 +192,11 @@
           getVarInfo(IncomingReg).Kills.push_back(MI); 
       }
     
    -  /// removeVirtualRegisterKilled - Remove the specified virtual
    +  /// removeVirtualRegisterKilled - Remove the specified kill of the virtual
       /// register from the live variable information. Returns true if the
       /// variable was marked as killed by the specified instruction,
       /// false otherwise.
    -  bool removeVirtualRegisterKilled(unsigned reg,
    -                                   MachineBasicBlock *MBB,
    -                                   MachineInstr *MI) {
    +  bool removeVirtualRegisterKilled(unsigned reg, MachineInstr *MI) {
         if (!getVarInfo(reg).removeKill(MI))
           return false;
     
    @@ -233,16 +224,14 @@
       void addVirtualRegisterDead(unsigned IncomingReg, MachineInstr *MI,
                                   bool AddIfNotFound = false) {
         if (MI->addRegisterDead(IncomingReg, TRI, AddIfNotFound))
    -        getVarInfo(IncomingReg).Kills.push_back(MI);
    +      getVarInfo(IncomingReg).Kills.push_back(MI);
       }
     
    -  /// removeVirtualRegisterDead - Remove the specified virtual
    +  /// removeVirtualRegisterDead - Remove the specified kill of the virtual
       /// register from the live variable information. Returns true if the
       /// variable was marked dead at the specified instruction, false
       /// otherwise.
    -  bool removeVirtualRegisterDead(unsigned reg,
    -                                 MachineBasicBlock *MBB,
    -                                 MachineInstr *MI) {
    +  bool removeVirtualRegisterDead(unsigned reg, MachineInstr *MI) {
         if (!getVarInfo(reg).removeKill(MI))
           return false;
     
    @@ -259,10 +248,6 @@
         return true;
       }
     
    -  /// removeVirtualRegistersDead - Remove all of the dead registers for the
    -  /// specified instruction from the live variable information.
    -  void removeVirtualRegistersDead(MachineInstr *MI);
    -  
       virtual void getAnalysisUsage(AnalysisUsage &AU) const {
         AU.setPreservesAll();
       }
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/MachineBasicBlock.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/MachineBasicBlock.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/MachineBasicBlock.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/MachineBasicBlock.h Sun Jul  6 15:45:41 2008
    @@ -16,7 +16,7 @@
     
     #include "llvm/CodeGen/MachineInstr.h"
     #include "llvm/ADT/GraphTraits.h"
    -#include "llvm/ADT/ilist"
    +#include "llvm/ADT/ilist.h"
     #include "llvm/Support/Streams.h"
     
     namespace llvm {
    @@ -108,7 +108,7 @@
       typedef std::reverse_iterator const_reverse_iterator;
       typedef std::reverse_iterator             reverse_iterator;
     
    -  unsigned size() const { return Insts.size(); }
    +  unsigned size() const { return (unsigned)Insts.size(); }
       bool empty() const { return Insts.empty(); }
     
       MachineInstr& front() { return Insts.front(); }
    @@ -149,7 +149,9 @@
                                               { return Predecessors.rend();  }
       const_pred_reverse_iterator  pred_rend()   const
                                               { return Predecessors.rend();  }
    -  unsigned             pred_size()  const { return Predecessors.size();  }
    +  unsigned             pred_size()  const {
    +    return (unsigned)Predecessors.size();
    +  }
       bool                 pred_empty() const { return Predecessors.empty(); }
       succ_iterator        succ_begin()       { return Successors.begin();   }
       const_succ_iterator  succ_begin() const { return Successors.begin();   }
    @@ -163,7 +165,9 @@
                                               { return Successors.rend();    }
       const_succ_reverse_iterator  succ_rend()   const
                                               { return Successors.rend();    }
    -  unsigned             succ_size()  const { return Successors.size();    }
    +  unsigned             succ_size()  const {
    +    return (unsigned)Successors.size();
    +  }
       bool                 succ_empty() const { return Successors.empty();   }
     
       // LiveIn management methods.
    @@ -176,6 +180,10 @@
       ///
       void removeLiveIn(unsigned Reg);
     
    +  /// isLiveIn - Return true if the specified register is in the live in set.
    +  ///
    +  bool isLiveIn(unsigned Reg) const;
    +
       // Iteration support for live in sets.  These sets are kept in sorted
       // order by their register number.
       typedef std::vector::iterator       livein_iterator;
    @@ -228,6 +236,11 @@
       ///
       succ_iterator removeSuccessor(succ_iterator I);
       
    +  /// transferSuccessors - Transfers all the successors from MBB to this
    +  /// machine basic block (i.e., copies all the successors fromMBB and
    +  /// remove all the successors fromBB).
    +  void transferSuccessors(MachineBasicBlock *fromMBB);
    +  
       /// isSuccessor - Return true if the specified MBB is a successor of this
       /// block.
       bool isSuccessor(MachineBasicBlock *MBB) const;
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/MachineCodeEmitter.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/MachineCodeEmitter.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/MachineCodeEmitter.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/MachineCodeEmitter.h Sun Jul  6 15:45:41 2008
    @@ -18,7 +18,6 @@
     #define LLVM_CODEGEN_MACHINECODEEMITTER_H
     
     #include "llvm/Support/DataTypes.h"
    -#include 
     
     namespace llvm {
     
    @@ -168,7 +167,8 @@
       /// emitString - This callback is invoked when a String needs to be
       /// written to the output stream.
       void emitString(const std::string &String) {
    -    for (unsigned i = 0, N = String.size(); i < N; ++i) {
    +    for (unsigned i = 0, N = static_cast(String.size());
    +         i < N; ++i) {
           unsigned char C = String[i];
           emitByte(C);
         }
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/MachineFrameInfo.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/MachineFrameInfo.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/MachineFrameInfo.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/MachineFrameInfo.h Sun Jul  6 15:45:41 2008
    @@ -193,7 +193,14 @@
     
       /// getObjectIndexEnd - Return one past the maximum frame object index...
       ///
    -  int getObjectIndexEnd() const { return Objects.size()-NumFixedObjects; }
    +  int getObjectIndexEnd() const { return (int)Objects.size()-NumFixedObjects; }
    +
    +  /// getNumFixedObjects() - Return the number of fixed objects.
    +  unsigned getNumFixedObjects() const { return NumFixedObjects; }
    +
    +  /// getNumObjects() - Return the number of objects.
    +  ///
    +  unsigned getNumObjects() const { return Objects.size(); }
     
       /// getObjectSize - Return the size of the specified object
       ///
    @@ -203,6 +210,13 @@
         return Objects[ObjectIdx+NumFixedObjects].Size;
       }
     
    +  // setObjectSize - Change the size of the specified stack object...
    +  void setObjectSize(int ObjectIdx, int64_t Size) {
    +    assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    +           "Invalid Object Idx!");
    +    Objects[ObjectIdx+NumFixedObjects].Size = Size;
    +  }
    +
       /// getObjectAlignment - Return the alignment of the specified stack object...
       unsigned getObjectAlignment(int ObjectIdx) const {
         assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    @@ -210,6 +224,13 @@
         return Objects[ObjectIdx+NumFixedObjects].Alignment;
       }
     
    +  /// setObjectAlignment - Change the alignment of the specified stack object...
    +  void setObjectAlignment(int ObjectIdx, unsigned Align) {
    +    assert(unsigned(ObjectIdx+NumFixedObjects) < Objects.size() &&
    +           "Invalid Object Idx!");
    +    Objects[ObjectIdx+NumFixedObjects].Alignment = Align;
    +  }
    +
       /// getObjectOffset - Return the assigned stack offset of the specified object
       /// from the incoming stack pointer.
       ///
    @@ -311,18 +332,14 @@
       int CreateStackObject(uint64_t Size, unsigned Alignment) {
         assert(Size != 0 && "Cannot allocate zero size stack objects!");
         Objects.push_back(StackObject(Size, Alignment, -1));
    -    return Objects.size()-NumFixedObjects-1;
    +    return (int)Objects.size()-NumFixedObjects-1;
       }
     
       /// RemoveStackObject - Remove or mark dead a statically sized stack object.
       ///
       void RemoveStackObject(int ObjectIdx) {
    -    if (ObjectIdx == (int)(Objects.size()-NumFixedObjects-1))
    -      // Last object, simply pop it off the list.
    -      Objects.pop_back();
    -    else
    -      // Mark it dead.
    -      Objects[ObjectIdx+NumFixedObjects].Size = ~0ULL;
    +    // Mark it dead.
    +    Objects[ObjectIdx+NumFixedObjects].Size = ~0ULL;
       }
     
       /// CreateVariableSizedObject - Notify the MachineFrameInfo object that a
    @@ -333,7 +350,7 @@
       int CreateVariableSizedObject() {
         HasVarSizedObjects = true;
         Objects.push_back(StackObject(0, 1, -1));
    -    return Objects.size()-NumFixedObjects-1;
    +    return (int)Objects.size()-NumFixedObjects-1;
       }
       
       /// getCalleeSavedInfo - Returns a reference to call saved info vector for the
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/MachineFunction.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/MachineFunction.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/MachineFunction.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/MachineFunction.h Sun Jul  6 15:45:41 2008
    @@ -32,7 +32,7 @@
     
     // ilist_traits
     template <>
    -struct ilist_traits {
    +class ilist_traits {
       // this is only set by the MachineFunction owning the ilist
       friend class MachineFunction;
       MachineFunction* Parent;
    @@ -165,7 +165,7 @@
     
       /// getNumBlockIDs - Return the number of MBB ID's allocated.
       ///
    -  unsigned getNumBlockIDs() const { return MBBNumbering.size(); }
    +  unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); }
       
       /// RenumberBlocks - This discards all of the MachineBasicBlock numbers and
       /// recomputes them.  This guarantees that the MBB numbers are sequential,
    @@ -238,7 +238,7 @@
       reverse_iterator        rend  ()       { return BasicBlocks.rend();   }
       const_reverse_iterator  rend  () const { return BasicBlocks.rend();   }
     
    -  unsigned                  size() const { return BasicBlocks.size(); }
    +  unsigned                  size() const { return (unsigned)BasicBlocks.size();}
       bool                     empty() const { return BasicBlocks.empty(); }
       const MachineBasicBlock &front() const { return BasicBlocks.front(); }
             MachineBasicBlock &front()       { return BasicBlocks.front(); }
    @@ -254,7 +254,7 @@
       ///
       unsigned addToMBBNumbering(MachineBasicBlock *MBB) {
         MBBNumbering.push_back(MBB);
    -    return MBBNumbering.size()-1;
    +    return (unsigned)MBBNumbering.size()-1;
       }
     
       /// removeFromMBBNumbering - Remove the specific machine basic block from our
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/MachineInstr.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/MachineInstr.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/MachineInstr.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/MachineInstr.h Sun Jul  6 15:45:41 2008
    @@ -18,6 +18,7 @@
     
     #include "llvm/CodeGen/MachineOperand.h"
     #include "llvm/CodeGen/MachineMemOperand.h"
    +#include 
     
     namespace llvm {
     
    @@ -82,7 +83,7 @@
     
       /// Access to explicit operands of the instruction.
       ///
    -  unsigned getNumOperands() const { return Operands.size(); }
    +  unsigned getNumOperands() const { return (unsigned)Operands.size(); }
     
       const MachineOperand& getOperand(unsigned i) const {
         assert(i < getNumOperands() && "getOperand() out of range!");
    @@ -98,7 +99,7 @@
       unsigned getNumExplicitOperands() const;
       
       /// Access to memory operands of the instruction
    -  unsigned getNumMemOperands() const { return MemOperands.size(); }
    +  unsigned getNumMemOperands() const { return (unsigned)MemOperands.size(); }
     
       const MachineMemOperand& getMemOperand(unsigned i) const {
         assert(i < getNumMemOperands() && "getMemOperand() out of range!");
    @@ -135,6 +136,10 @@
         delete removeFromParent();
       }
     
    +  /// isLabel - Returns true if the MachineInstr represents a label.
    +  ///
    +  bool isLabel() const;
    +
       /// isDebugLabel - Returns true if the MachineInstr represents a debug label.
       ///
       bool isDebugLabel() const;
    @@ -184,10 +189,9 @@
       }
       
       /// findRegisterDefOperandIdx() - Returns the operand index that is a def of
    -  /// the specific register or -1 if it is not found. It further tightening
    -  /// the search criteria to a def that is dead the register if isDead is true.
    -  /// If TargetRegisterInfo is passed, then it also checks if there is a def of
    -  /// a super-register.
    +  /// the specified register or -1 if it is not found. If isDead is true, defs
    +  /// that are not dead are skipped. If TargetRegisterInfo is non-null, then it
    +  /// also checks if there is a def of a super-register.
       int findRegisterDefOperandIdx(unsigned Reg, bool isDead = false,
                                     const TargetRegisterInfo *TRI = NULL) const;
     
    @@ -230,13 +234,9 @@
       bool addRegisterDead(unsigned IncomingReg, const TargetRegisterInfo *RegInfo,
                            bool AddIfNotFound = false);
     
    -  /// copyKillDeadInfo - Copies killed/dead information from one instr to another
    -  void copyKillDeadInfo(MachineInstr *OldMI,
    -                        const TargetRegisterInfo *RegInfo);
    -
    -  /// isSafeToMove - Return true if it is safe to this instruction. If SawStore
    -  /// true, it means there is a store (or call) between the instruction the
    -  /// localtion and its intended destination.
    +  /// isSafeToMove - Return true if it is safe to move this instruction. If
    +  /// SawStore is set to true, it means that there is a store (or call) between
    +  /// the instruction's location and its intended destination.
       bool isSafeToMove(const TargetInstrInfo *TII, bool &SawStore);
     
       //
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/MachineJumpTableInfo.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/MachineJumpTableInfo.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/MachineJumpTableInfo.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/MachineJumpTableInfo.h Sun Jul  6 15:45:41 2008
    @@ -70,9 +70,9 @@
       bool ReplaceMBBInJumpTables(MachineBasicBlock *Old, MachineBasicBlock *New) {
         assert(Old != New && "Not making a change?");
         bool MadeChange = false;
    -    for (unsigned i = 0, e = JumpTables.size(); i != e; ++i) {
    +    for (size_t i = 0, e = JumpTables.size(); i != e; ++i) {
           MachineJumpTableEntry &JTE = JumpTables[i];
    -      for (unsigned j = 0, e = JTE.MBBs.size(); j != e; ++j)
    +      for (size_t j = 0, e = JTE.MBBs.size(); j != e; ++j)
             if (JTE.MBBs[j] == Old) {
               JTE.MBBs[j] = New;
               MadeChange = true;
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/MachineLoopInfo.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/MachineLoopInfo.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/MachineLoopInfo.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/MachineLoopInfo.h Sun Jul  6 15:45:41 2008
    @@ -187,7 +187,4 @@
     
     } // End llvm namespace
     
    -// Make sure that any clients of this file link in LoopInfo.cpp
    -FORCE_DEFINING_FILE_TO_BE_LINKED(MachineLoopInfo)
    -
     #endif
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/MachineModuleInfo.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/MachineModuleInfo.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/MachineModuleInfo.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/MachineModuleInfo.h Sun Jul  6 15:45:41 2008
    @@ -34,6 +34,7 @@
     #include "llvm/Support/Dwarf.h"
     #include "llvm/Support/DataTypes.h"
     #include "llvm/ADT/SmallVector.h"
    +#include "llvm/ADT/DenseMap.h"
     #include "llvm/ADT/UniqueVector.h"
     #include "llvm/ADT/SmallPtrSet.h"
     #include "llvm/GlobalValue.h"
    @@ -748,14 +749,9 @@
     /// DIDeserializer - This class is responsible for casting GlobalVariables
     /// into DebugInfoDesc objects.
     class DIDeserializer {
    -private:
    -  std::map GlobalDescs;
    -                                        // Previously defined gloabls.
    -  
    +  // Previously defined gloabls.
    +  std::map GlobalDescs;
     public:
    -  DIDeserializer() {}
    -  ~DIDeserializer() {}
    -  
       const std::map &getGlobalDescs() const {
         return GlobalDescs;
       }
    @@ -770,27 +766,23 @@
     /// DISerializer - This class is responsible for casting DebugInfoDesc objects
     /// into GlobalVariables.
     class DISerializer {
    -private:
       Module *M;                            // Definition space module.
       PointerType *StrPtrTy;                // A "i8*" type.  Created lazily.
       PointerType *EmptyStructPtrTy;        // A "{ }*" type.  Created lazily.
    +
    +  // Types per Tag. Created lazily.
       std::map TagTypes;
    -                                        // Types per Tag.  Created lazily.
    -  std::map DescGlobals;
    -                                        // Previously defined descriptors.
    -  std::map StringCache;
    -                                        // Previously defined strings.
    -                                          
    +
    +  // Previously defined descriptors.
    +  DenseMap DescGlobals;
    +
    +  // Previously defined strings.
    +  DenseMap StringCache;
     public:
       DISerializer()
    -  : M(NULL)
    -  , StrPtrTy(NULL)
    -  , EmptyStructPtrTy(NULL)
    -  , TagTypes()
    -  , DescGlobals()
    -  , StringCache()
    +    : M(NULL), StrPtrTy(NULL), EmptyStructPtrTy(NULL), TagTypes(),
    +      DescGlobals(), StringCache()
       {}
    -  ~DISerializer() {}
       
       // Accessors
       Module *getModule()        const { return M; };
    @@ -824,21 +816,17 @@
     /// DIVerifier - This class is responsible for verifying the given network of
     /// GlobalVariables are valid as DebugInfoDesc objects.
     class DIVerifier {
    -private:
       enum {
         Unknown = 0,
         Invalid,
         Valid
       };
    -  std::map Validity;// Tracks prior results.
    -  std::map Counts;  // Count of fields per Tag type.
    -  
    +  DenseMap Validity; // Tracks prior results.
    +  std::map Counts; // Count of fields per Tag type.
     public:
       DIVerifier()
    -  : Validity()
    -  , Counts()
    +    : Validity(), Counts()
       {}
    -  ~DIVerifier() {}
       
       /// Verify - Return true if the GlobalVariable appears to be a valid
       /// serialization of a DebugInfoDesc.
    @@ -854,12 +842,10 @@
     /// SourceLineInfo - This class is used to record source line correspondence.
     ///
     class SourceLineInfo {
    -private:
       unsigned Line;                        // Source line number.
       unsigned Column;                      // Source column.
       unsigned SourceID;                    // Source ID number.
       unsigned LabelID;                     // Label in code ID number.
    -
     public:
       SourceLineInfo(unsigned L, unsigned C, unsigned S, unsigned I)
       : Line(L), Column(C), SourceID(S), LabelID(I) {}
    @@ -875,10 +861,8 @@
     /// SourceFileInfo - This class is used to track source information.
     ///
     class SourceFileInfo {
    -private:
       unsigned DirectoryID;                 // Directory ID number.
       std::string Name;                     // File name (not including directory.)
    -  
     public:
       SourceFileInfo(unsigned D, const std::string &N) : DirectoryID(D), Name(N) {}
                 
    @@ -1100,7 +1084,7 @@
       /// NextLabelID - Return the next unique label id.
       ///
       unsigned NextLabelID() {
    -    unsigned ID = LabelIDList.size() + 1;
    +    unsigned ID = (unsigned)LabelIDList.size() + 1;
         LabelIDList.push_back(ID);
         return ID;
       }
    @@ -1168,16 +1152,17 @@
       
       /// getGlobalVariablesUsing - Return all of the GlobalVariables that use the
       /// named GlobalVariable.
    -  std::vector
    -  getGlobalVariablesUsing(Module &M, const std::string &RootName);
    +  void getGlobalVariablesUsing(Module &M, const std::string &RootName,
    +                               std::vector &Result);
     
       /// getAnchoredDescriptors - Return a vector of anchored debug descriptors.
       ///
    -  template std::vector getAnchoredDescriptors(Module &M) {
    +  template 
    +  void getAnchoredDescriptors(Module &M, std::vector &AnchoredDescs) {
         T Desc;
    -    std::vector Globals =
    -                             getGlobalVariablesUsing(M, Desc.getAnchorString());
    -    std::vector AnchoredDescs;
    +    std::vector Globals;
    +    getGlobalVariablesUsing(M, Desc.getAnchorString(), Globals);
    +
         for (unsigned i = 0, N = Globals.size(); i < N; ++i) {
           GlobalVariable *GV = Globals[i];
     
    @@ -1187,8 +1172,6 @@
             AnchoredDescs.push_back(cast(DR.Deserialize(GV)));
           }
         }
    -
    -    return AnchoredDescs;
       }
       
       /// RecordRegionStart - Indicate the start of a region.
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/MachineOperand.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/MachineOperand.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/MachineOperand.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/MachineOperand.h Sun Jul  6 15:45:41 2008
    @@ -15,7 +15,6 @@
     #define LLVM_CODEGEN_MACHINEOPERAND_H
     
     #include "llvm/Support/DataTypes.h"
    -#include 
     #include 
     #include 
     
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/MachineRegisterInfo.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/MachineRegisterInfo.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/MachineRegisterInfo.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/MachineRegisterInfo.h Sun Jul  6 15:45:41 2008
    @@ -16,7 +16,7 @@
     
     #include "llvm/Target/TargetRegisterInfo.h"
     #include "llvm/ADT/BitVector.h"
    -#include "llvm/ADT/iterator"
    +#include "llvm/ADT/iterator.h"
     #include 
     
     namespace llvm {
    @@ -90,6 +90,10 @@
       }
       static use_iterator use_end() { return use_iterator(0); }
       
    +  /// use_empty - Return true if there are no instructions using the specified
    +  /// register.
    +  bool use_empty(unsigned RegNo) const { return use_begin(RegNo) == use_end(); }
    +
       
       /// replaceRegWith - Replace all instances of FromReg with ToReg in the
       /// machine function.  This is like llvm-level X->replaceAllUsesWith(Y),
    @@ -131,6 +135,13 @@
         assert(Reg < VRegInfo.size() && "Invalid vreg!");
         return VRegInfo[Reg].first;
       }
    +
    +  /// setRegClass - Set the register class of the specified virtual register.
    +  void setRegClass(unsigned Reg, const TargetRegisterClass *RC) {
    +    Reg -= TargetRegisterInfo::FirstVirtualRegister;
    +    assert(Reg < VRegInfo.size() && "Invalid vreg!");
    +    VRegInfo[Reg].first = RC;
    +  }
       
       /// createVirtualRegister - Create and return a new virtual register in the
       /// function with the specified register class.
    @@ -152,7 +163,7 @@
       /// getLastVirtReg - Return the highest currently assigned virtual register.
       ///
       unsigned getLastVirtReg() const {
    -    return VRegInfo.size()+TargetRegisterInfo::FirstVirtualRegister-1;
    +    return (unsigned)VRegInfo.size()+TargetRegisterInfo::FirstVirtualRegister-1;
       }
       
       
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/Passes.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/Passes.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/Passes.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/Passes.h Sun Jul  6 15:45:41 2008
    @@ -40,18 +40,18 @@
     
       /// MachineLoopInfo pass - This pass is a loop analysis pass.
       /// 
    -  extern const PassInfo *MachineLoopInfoID;
    +  extern const PassInfo *const MachineLoopInfoID;
     
       /// MachineDominators pass - This pass is a machine dominators analysis pass.
       /// 
    -  extern const PassInfo *MachineDominatorsID;
    +  extern const PassInfo *const MachineDominatorsID;
     
       /// PHIElimination pass - This pass eliminates machine instruction PHI nodes
       /// by inserting copy instructions.  This destroys SSA information, but is the
       /// desired input for some register allocators.  This pass is "required" by
       /// these register allocator like this: AU.addRequiredID(PHIEliminationID);
       ///
    -  extern const PassInfo *PHIEliminationID;
    +  extern const PassInfo *const PHIEliminationID;
       
       /// StrongPHIElimination pass - This pass eliminates machine instruction PHI
       /// nodes by inserting copy instructions.  This destroys SSA information, but
    @@ -59,17 +59,17 @@
       /// "required" by these register allocator like this:
       ///    AU.addRequiredID(PHIEliminationID);
       ///  This pass is still in development
    -  extern const PassInfo *StrongPHIEliminationID;
    +  extern const PassInfo *const StrongPHIEliminationID;
     
       /// SimpleRegisterCoalescing pass.  Aggressively coalesces every register
       /// copy it can.
       ///
    -  extern const PassInfo *SimpleRegisterCoalescingID;
    +  extern const PassInfo *const SimpleRegisterCoalescingID;
     
       /// TwoAddressInstruction pass - This pass reduces two-address instructions to
       /// use two operands. This destroys SSA information but it is desired by
       /// register allocators.
    -  extern const PassInfo *TwoAddressInstructionPassID;
    +  extern const PassInfo *const TwoAddressInstructionPassID;
     
       /// Creates a register allocator as the user specified on the command line.
       ///
    @@ -172,6 +172,9 @@
       /// createMachineSinkingPass - This pass performs sinking on machine
       /// instructions.
       FunctionPass *createMachineSinkingPass();
    +
    +  /// createStackSlotColoringPass - This pass performs stack slot coloring.
    +  FunctionPass *createStackSlotColoringPass();
       
     } // End llvm namespace
     
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/RuntimeLibcalls.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/RuntimeLibcalls.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/RuntimeLibcalls.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/RuntimeLibcalls.h Sun Jul  6 15:45:41 2008
    @@ -99,6 +99,7 @@
         FPTOSINT_F64_I128,
         FPTOSINT_F80_I64,
         FPTOSINT_F80_I128,
    +    FPTOSINT_PPCF128_I32,
         FPTOSINT_PPCF128_I64,
         FPTOSINT_PPCF128_I128,
         FPTOUINT_F32_I32,
    @@ -110,6 +111,7 @@
         FPTOUINT_F80_I32,
         FPTOUINT_F80_I64,
         FPTOUINT_F80_I128,
    +    FPTOUINT_PPCF128_I32,
         FPTOUINT_PPCF128_I64,
         FPTOUINT_PPCF128_I128,
         SINTTOFP_I32_F32,
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/SchedGraphCommon.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/SchedGraphCommon.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/SchedGraphCommon.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/SchedGraphCommon.h Sun Jul  6 15:45:41 2008
    @@ -16,7 +16,7 @@
     #define LLVM_CODEGEN_SCHEDGRAPHCOMMON_H
     
     #include "llvm/Value.h"
    -#include "llvm/ADT/iterator"
    +#include "llvm/ADT/iterator.h"
     #include "llvm/Support/Streams.h"
     #include 
     
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/ScheduleDAG.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/ScheduleDAG.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/ScheduleDAG.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/ScheduleDAG.h Sun Jul  6 15:45:41 2008
    @@ -17,7 +17,6 @@
     
     #include "llvm/CodeGen/MachineBasicBlock.h"
     #include "llvm/CodeGen/SelectionDAG.h"
    -#include "llvm/ADT/BitVector.h"
     #include "llvm/ADT/DenseMap.h"
     #include "llvm/ADT/GraphTraits.h"
     #include "llvm/ADT/SmallSet.h"
    @@ -59,26 +58,23 @@
         ///     other instruction is available, issue it first.
         ///  * NoopHazard: issuing this instruction would break the program.  If
         ///     some other instruction can be issued, do so, otherwise issue a noop.
    -    virtual HazardType getHazardType(SDNode *Node) {
    +    virtual HazardType getHazardType(SDNode *) {
           return NoHazard;
         }
         
         /// EmitInstruction - This callback is invoked when an instruction is
         /// emitted, to advance the hazard state.
    -    virtual void EmitInstruction(SDNode *Node) {
    -    }
    +    virtual void EmitInstruction(SDNode *) {}
         
         /// AdvanceCycle - This callback is invoked when no instructions can be
         /// issued on this cycle without a hazard.  This should increment the
         /// internal state of the hazard recognizer so that previously "Hazard"
         /// instructions will now not be hazards.
    -    virtual void AdvanceCycle() {
    -    }
    +    virtual void AdvanceCycle() {}
         
         /// EmitNoop - This callback is invoked when a noop was added to the
         /// instruction stream.
    -    virtual void EmitNoop() {
    -    }
    +    virtual void EmitNoop() {}
       };
     
       /// SDep - Scheduling dependency. It keeps track of dependent nodes,
    @@ -98,8 +94,8 @@
       struct SUnit {
         SDNode *Node;                       // Representative node.
         SmallVector FlaggedNodes;// All nodes flagged to Node.
    -    unsigned InstanceNo;                // Instance#. One SDNode can be multiple
    -                                        // SUnit due to cloning.
    +    SUnit *OrigNode;                    // If not this, the node from which
    +                                        // this node was cloned.
         
         // 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. 
    @@ -112,6 +108,7 @@
         typedef SmallVector::const_iterator const_succ_iterator;
         
         unsigned NodeNum;                   // Entry # of node in the node vector.
    +    unsigned NodeQueueId;               // Queue id of node.
         unsigned short Latency;             // Node latency.
         short NumPreds;                     // # of preds.
         short NumSuccs;                     // # of sucss.
    @@ -131,7 +128,7 @@
         const TargetRegisterClass *CopySrcRC;
         
         SUnit(SDNode *node, unsigned nodenum)
    -      : Node(node), InstanceNo(0), NodeNum(nodenum), Latency(0),
    +      : Node(node), OrigNode(0), NodeNum(nodenum), NodeQueueId(0), Latency(0),
             NumPreds(0), NumSuccs(0), NumPredsLeft(0), NumSuccsLeft(0),
             isTwoAddress(false), isCommutable(false), hasPhysRegDefs(false),
             isPending(false), isAvailable(false), isScheduled(false),
    @@ -142,7 +139,7 @@
         /// not already.  This returns true if this is a new pred.
         bool addPred(SUnit *N, bool isCtrl, bool isSpecial,
                      unsigned PhyReg = 0, int Cost = 1) {
    -      for (unsigned i = 0, e = Preds.size(); i != e; ++i)
    +      for (unsigned i = 0, e = (unsigned)Preds.size(); i != e; ++i)
             if (Preds[i].Dep == N &&
                 Preds[i].isCtrl == isCtrl && Preds[i].isSpecial == isSpecial)
               return false;
    @@ -188,14 +185,14 @@
         }
     
         bool isPred(SUnit *N) {
    -      for (unsigned i = 0, e = Preds.size(); i != e; ++i)
    +      for (unsigned i = 0, e = (unsigned)Preds.size(); i != e; ++i)
             if (Preds[i].Dep == N)
               return true;
           return false;
         }
         
         bool isSucc(SUnit *N) {
    -      for (unsigned i = 0, e = Succs.size(); i != e; ++i)
    +      for (unsigned i = 0, e = (unsigned)Succs.size(); i != e; ++i)
             if (Succs[i].Dep == N)
               return true;
           return false;
    @@ -217,8 +214,7 @@
       public:
         virtual ~SchedulingPriorityQueue() {}
       
    -    virtual void initNodes(DenseMap > &SUMap,
    -                           std::vector &SUnits) = 0;
    +    virtual void initNodes(std::vector &SUnits) = 0;
         virtual void addNode(const SUnit *SU) = 0;
         virtual void updateNode(const SUnit *SU) = 0;
         virtual void releaseState() = 0;
    @@ -233,11 +229,12 @@
         virtual void remove(SUnit *SU) = 0;
     
         /// ScheduledNode - As each node is scheduled, this method is invoked.  This
    -    /// allows the priority function to adjust the priority of node that have
    -    /// already been emitted.
    -    virtual void ScheduledNode(SUnit *Node) {}
    +    /// allows the priority function to adjust the priority of related
    +    /// unscheduled nodes, for example.
    +    ///
    +    virtual void ScheduledNode(SUnit *) {}
     
    -    virtual void UnscheduledNode(SUnit *Node) {}
    +    virtual void UnscheduledNode(SUnit *) {}
       };
     
       class ScheduleDAG {
    @@ -253,8 +250,6 @@
         MachineConstantPool *ConstPool;       // Target constant pool
         std::vector Sequence;         // The schedule. Null SUnit*'s
                                               // represent noop instructions.
    -    DenseMap > SUnitMap;
    -                                          // SDNode to SUnit mapping (n -> n).
         std::vector SUnits;            // The scheduling units.
         SmallSet CommuteSet;     // Nodes that should be commuted.
     
    @@ -292,7 +287,8 @@
         /// NewSUnit - Creates a new SUnit and return a ptr to it.
         ///
         SUnit *NewSUnit(SDNode *N) {
    -      SUnits.push_back(SUnit(N, SUnits.size()));
    +      SUnits.push_back(SUnit(N, (unsigned)SUnits.size()));
    +      SUnits.back().OrigNode = &SUnits.back();
           return &SUnits.back();
         }
     
    @@ -333,7 +329,7 @@
         /// VRBaseMap contains, for each already emitted node, the first virtual
         /// register number for the results of the node.
         ///
    -    void EmitNode(SDNode *Node, unsigned InstNo,
    +    void EmitNode(SDNode *Node, bool IsClone,
                       DenseMap &VRBaseMap);
         
         /// EmitNoop - Emit a noop instruction.
    @@ -344,9 +340,10 @@
     
         void dumpSchedule() const;
     
    -    /// Schedule - Order nodes according to selected style.
    +    /// Schedule - Order nodes according to selected style, filling
    +    /// in the Sequence member.
         ///
    -    virtual void Schedule() {}
    +    virtual void Schedule() = 0;
     
       private:
         /// EmitSubregNode - Generate machine code for subreg nodes.
    @@ -372,7 +369,7 @@
     
         /// EmitCopyFromReg - Generate machine code for an CopyFromReg node or an
         /// implicit physical register output.
    -    void EmitCopyFromReg(SDNode *Node, unsigned ResNo, unsigned InstNo,
    +    void EmitCopyFromReg(SDNode *Node, unsigned ResNo, bool IsClone,
                              unsigned SrcReg,
                              DenseMap &VRBaseMap);
         
    @@ -399,25 +396,29 @@
       /// reduction list scheduler.
       ScheduleDAG* createBURRListDAGScheduler(SelectionDAGISel *IS,
                                               SelectionDAG *DAG,
    -                                          MachineBasicBlock *BB);
    +                                          MachineBasicBlock *BB,
    +                                          bool Fast);
       
       /// createTDRRListDAGScheduler - This creates a top down register usage
       /// reduction list scheduler.
       ScheduleDAG* createTDRRListDAGScheduler(SelectionDAGISel *IS,
                                               SelectionDAG *DAG,
    -                                          MachineBasicBlock *BB);
    +                                          MachineBasicBlock *BB,
    +                                          bool Fast);
       
       /// createTDListDAGScheduler - This creates a top-down list scheduler with
       /// a hazard recognizer.
       ScheduleDAG* createTDListDAGScheduler(SelectionDAGISel *IS,
                                             SelectionDAG *DAG,
    -                                        MachineBasicBlock *BB);
    +                                        MachineBasicBlock *BB,
    +                                        bool Fast);
                                             
       /// createDefaultScheduler - This creates an instruction scheduler appropriate
       /// for the target.
       ScheduleDAG* createDefaultScheduler(SelectionDAGISel *IS,
                                           SelectionDAG *DAG,
    -                                      MachineBasicBlock *BB);
    +                                      MachineBasicBlock *BB,
    +                                      bool Fast);
     
       class SUnitIterator : public forward_iterator {
         SUnit *Node;
    @@ -451,7 +452,7 @@
     
         static SUnitIterator begin(SUnit *N) { return SUnitIterator(N, 0); }
         static SUnitIterator end  (SUnit *N) {
    -      return SUnitIterator(N, N->Preds.size());
    +      return SUnitIterator(N, (unsigned)N->Preds.size());
         }
     
         unsigned getOperand() const { return Operand; }
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/SchedulerRegistry.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/SchedulerRegistry.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/SchedulerRegistry.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/SchedulerRegistry.h Sun Jul  6 15:45:41 2008
    @@ -35,7 +35,7 @@
     public:
     
       typedef ScheduleDAG *(*FunctionPassCtor)(SelectionDAGISel*, SelectionDAG*,
    -                                           MachineBasicBlock*);
    +                                        MachineBasicBlock*, bool);
     
       static MachinePassRegistry Registry;
     
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAG.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAG.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAG.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAG.h Sun Jul  6 15:45:41 2008
    @@ -16,13 +16,13 @@
     #define LLVM_CODEGEN_SELECTIONDAG_H
     
     #include "llvm/ADT/FoldingSet.h"
    -#include "llvm/ADT/ilist"
    +#include "llvm/ADT/StringMap.h"
    +#include "llvm/ADT/ilist.h"
     #include "llvm/CodeGen/SelectionDAGNodes.h"
     
     #include 
     #include 
     #include 
    -#include 
     #include 
     
     namespace llvm {
    @@ -32,6 +32,7 @@
       class MachineModuleInfo;
       class MachineFunction;
       class MachineConstantPoolValue;
    +  class FunctionLoweringInfo;
     
     /// SelectionDAG class - This is used to represent a portion of an LLVM function
     /// in a low-level Data Dependence DAG representation suitable for instruction
    @@ -47,6 +48,7 @@
     class SelectionDAG {
       TargetLowering &TLI;
       MachineFunction &MF;
    +  FunctionLoweringInfo &FLI;
       MachineModuleInfo *MMI;
     
       /// Root - The root of the entire DAG.  EntryNode - The starting token.
    @@ -60,8 +62,9 @@
       FoldingSet CSEMap;
     
     public:
    -  SelectionDAG(TargetLowering &tli, MachineFunction &mf, MachineModuleInfo *mmi)
    -  : TLI(tli), MF(mf), MMI(mmi) {
    +  SelectionDAG(TargetLowering &tli, MachineFunction &mf, 
    +               FunctionLoweringInfo &fli, MachineModuleInfo *mmi)
    +  : TLI(tli), MF(mf), FLI(fli), MMI(mmi) {
         EntryNode = Root = getNode(ISD::EntryToken, MVT::Other);
       }
       ~SelectionDAG();
    @@ -69,6 +72,7 @@
       MachineFunction &getMachineFunction() const { return MF; }
       const TargetMachine &getTarget() const;
       TargetLowering &getTargetLoweringInfo() const { return TLI; }
    +  FunctionLoweringInfo &getFunctionLoweringInfo() const { return FLI; }
       MachineModuleInfo *getMachineModuleInfo() const { return MMI; }
     
       /// viewGraph - Pop up a GraphViz/gv window with the DAG rendered using 'dot'.
    @@ -101,6 +105,7 @@
       typedef ilist::iterator allnodes_iterator;
       allnodes_iterator allnodes_begin() { return AllNodes.begin(); }
       allnodes_iterator allnodes_end() { return AllNodes.end(); }
    +  ilist::size_type allnodes_size() const { return AllNodes.size(); }
       
       /// getRoot - Return the root tag of the SelectionDAG.
       ///
    @@ -145,83 +150,82 @@
     
       /// getVTList - Return an SDVTList that represents the list of values
       /// specified.
    -  SDVTList getVTList(MVT::ValueType VT);
    -  SDVTList getVTList(MVT::ValueType VT1, MVT::ValueType VT2);
    -  SDVTList getVTList(MVT::ValueType VT1, MVT::ValueType VT2,MVT::ValueType VT3);
    -  SDVTList getVTList(const MVT::ValueType *VTs, unsigned NumVTs);
    +  SDVTList getVTList(MVT VT);
    +  SDVTList getVTList(MVT VT1, MVT VT2);
    +  SDVTList getVTList(MVT VT1, MVT VT2, MVT VT3);
    +  SDVTList getVTList(const MVT *VTs, unsigned NumVTs);
       
       /// getNodeValueTypes - These are obsolete, use getVTList instead.
    -  const MVT::ValueType *getNodeValueTypes(MVT::ValueType VT) {
    +  const MVT *getNodeValueTypes(MVT VT) {
         return getVTList(VT).VTs;
       }
    -  const MVT::ValueType *getNodeValueTypes(MVT::ValueType VT1, 
    -                                          MVT::ValueType VT2) {
    +  const MVT *getNodeValueTypes(MVT VT1, MVT VT2) {
         return getVTList(VT1, VT2).VTs;
       }
    -  const MVT::ValueType *getNodeValueTypes(MVT::ValueType VT1,MVT::ValueType VT2,
    -                                          MVT::ValueType VT3) {
    +  const MVT *getNodeValueTypes(MVT VT1, MVT VT2, MVT VT3) {
         return getVTList(VT1, VT2, VT3).VTs;
       }
    -  const MVT::ValueType *getNodeValueTypes(std::vector &VTList) {
    -    return getVTList(&VTList[0], VTList.size()).VTs;
    +  const MVT *getNodeValueTypes(std::vector &vtList) {
    +    return getVTList(&vtList[0], (unsigned)vtList.size()).VTs;
       }
       
       
       //===--------------------------------------------------------------------===//
       // Node creation methods.
       //
    -  SDOperand getString(const std::string &Val);
    -  SDOperand getConstant(uint64_t Val, MVT::ValueType VT, bool isTarget = false);
    -  SDOperand getConstant(const APInt &Val, MVT::ValueType VT, bool isTarget = false);
    +  SDOperand getConstant(uint64_t Val, MVT VT, bool isTarget = false);
    +  SDOperand getConstant(const APInt &Val, MVT VT, bool isTarget = false);
       SDOperand getIntPtrConstant(uint64_t Val, bool isTarget = false);
    -  SDOperand getTargetConstant(uint64_t Val, MVT::ValueType VT) {
    +  SDOperand getTargetConstant(uint64_t Val, MVT VT) {
         return getConstant(Val, VT, true);
       }
    -  SDOperand getTargetConstant(const APInt &Val, MVT::ValueType VT) {
    +  SDOperand getTargetConstant(const APInt &Val, MVT VT) {
         return getConstant(Val, VT, true);
       }
    -  SDOperand getConstantFP(double Val, MVT::ValueType VT, bool isTarget = false);
    -  SDOperand getConstantFP(const APFloat& Val, MVT::ValueType VT, 
    -                          bool isTarget = false);
    -  SDOperand getTargetConstantFP(double Val, MVT::ValueType VT) {
    +  SDOperand getConstantFP(double Val, MVT VT, bool isTarget = false);
    +  SDOperand getConstantFP(const APFloat& Val, MVT VT, bool isTarget = false);
    +  SDOperand getTargetConstantFP(double Val, MVT VT) {
         return getConstantFP(Val, VT, true);
       }
    -  SDOperand getTargetConstantFP(const APFloat& Val, MVT::ValueType VT) {
    +  SDOperand getTargetConstantFP(const APFloat& Val, MVT VT) {
         return getConstantFP(Val, VT, true);
       }
    -  SDOperand getGlobalAddress(const GlobalValue *GV, MVT::ValueType VT,
    +  SDOperand getGlobalAddress(const GlobalValue *GV, MVT VT,
                                  int offset = 0, bool isTargetGA = false);
    -  SDOperand getTargetGlobalAddress(const GlobalValue *GV, MVT::ValueType VT,
    +  SDOperand getTargetGlobalAddress(const GlobalValue *GV, MVT VT,
                                        int offset = 0) {
         return getGlobalAddress(GV, VT, offset, true);
       }
    -  SDOperand getFrameIndex(int FI, MVT::ValueType VT, bool isTarget = false);
    -  SDOperand getTargetFrameIndex(int FI, MVT::ValueType VT) {
    +  SDOperand getFrameIndex(int FI, MVT VT, bool isTarget = false);
    +  SDOperand getTargetFrameIndex(int FI, MVT VT) {
         return getFrameIndex(FI, VT, true);
       }
    -  SDOperand getJumpTable(int JTI, MVT::ValueType VT, bool isTarget = false);
    -  SDOperand getTargetJumpTable(int JTI, MVT::ValueType VT) {
    +  SDOperand getJumpTable(int JTI, MVT VT, bool isTarget = false);
    +  SDOperand getTargetJumpTable(int JTI, MVT VT) {
         return getJumpTable(JTI, VT, true);
       }
    -  SDOperand getConstantPool(Constant *C, MVT::ValueType VT,
    +  SDOperand getConstantPool(Constant *C, MVT VT,
                                 unsigned Align = 0, int Offs = 0, bool isT=false);
    -  SDOperand getTargetConstantPool(Constant *C, MVT::ValueType VT,
    +  SDOperand getTargetConstantPool(Constant *C, MVT VT,
                                       unsigned Align = 0, int Offset = 0) {
         return getConstantPool(C, VT, Align, Offset, true);
       }
    -  SDOperand getConstantPool(MachineConstantPoolValue *C, MVT::ValueType VT,
    +  SDOperand getConstantPool(MachineConstantPoolValue *C, MVT VT,
                                 unsigned Align = 0, int Offs = 0, bool isT=false);
       SDOperand getTargetConstantPool(MachineConstantPoolValue *C,
    -                                  MVT::ValueType VT, unsigned Align = 0,
    +                                  MVT VT, unsigned Align = 0,
                                       int Offset = 0) {
         return getConstantPool(C, VT, Align, Offset, true);
       }
       SDOperand getBasicBlock(MachineBasicBlock *MBB);
    -  SDOperand getExternalSymbol(const char *Sym, MVT::ValueType VT);
    -  SDOperand getTargetExternalSymbol(const char *Sym, MVT::ValueType VT);
    +  SDOperand getExternalSymbol(const char *Sym, MVT VT);
    +  SDOperand getTargetExternalSymbol(const char *Sym, MVT VT);
       SDOperand getArgFlags(ISD::ArgFlagsTy Flags);
    -  SDOperand getValueType(MVT::ValueType);
    -  SDOperand getRegister(unsigned Reg, MVT::ValueType VT);
    +  SDOperand getValueType(MVT);
    +  SDOperand getRegister(unsigned Reg, MVT VT);
    +  SDOperand getDbgStopPoint(SDOperand Root, unsigned Line, unsigned Col,
    +                            const CompileUnitDesc *CU);
    +  SDOperand getLabel(unsigned Opcode, SDOperand Root, unsigned LabelID);
     
       SDOperand getCopyToReg(SDOperand Chain, unsigned Reg, SDOperand N) {
         return getNode(ISD::CopyToReg, MVT::Other, Chain,
    @@ -233,7 +237,7 @@
       // null) and that there should be a flag result.
       SDOperand getCopyToReg(SDOperand Chain, unsigned Reg, SDOperand N,
                              SDOperand Flag) {
    -    const MVT::ValueType *VTs = getNodeValueTypes(MVT::Other, MVT::Flag);
    +    const MVT *VTs = getNodeValueTypes(MVT::Other, MVT::Flag);
         SDOperand Ops[] = { Chain, getRegister(Reg, N.getValueType()), N, Flag };
         return getNode(ISD::CopyToReg, VTs, 2, Ops, Flag.Val ? 4 : 3);
       }
    @@ -241,13 +245,13 @@
       // Similar to last getCopyToReg() except parameter Reg is a SDOperand
       SDOperand getCopyToReg(SDOperand Chain, SDOperand Reg, SDOperand N,
                              SDOperand Flag) {
    -    const MVT::ValueType *VTs = getNodeValueTypes(MVT::Other, MVT::Flag);
    +    const MVT *VTs = getNodeValueTypes(MVT::Other, MVT::Flag);
         SDOperand Ops[] = { Chain, Reg, N, Flag };
         return getNode(ISD::CopyToReg, VTs, 2, Ops, Flag.Val ? 4 : 3);
       }
       
    -  SDOperand getCopyFromReg(SDOperand Chain, unsigned Reg, MVT::ValueType VT) {
    -    const MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other);
    +  SDOperand getCopyFromReg(SDOperand Chain, unsigned Reg, MVT VT) {
    +    const MVT *VTs = getNodeValueTypes(VT, MVT::Other);
         SDOperand Ops[] = { Chain, getRegister(Reg, VT) };
         return getNode(ISD::CopyFromReg, VTs, 2, Ops, 2);
       }
    @@ -255,9 +259,9 @@
       // This version of the getCopyFromReg method takes an extra operand, which
       // indicates that there is potentially an incoming flag value (if Flag is not
       // null) and that there should be a flag result.
    -  SDOperand getCopyFromReg(SDOperand Chain, unsigned Reg, MVT::ValueType VT,
    +  SDOperand getCopyFromReg(SDOperand Chain, unsigned Reg, MVT VT,
                                SDOperand Flag) {
    -    const MVT::ValueType *VTs = getNodeValueTypes(VT, MVT::Other, MVT::Flag);
    +    const MVT *VTs = getNodeValueTypes(VT, MVT::Other, MVT::Flag);
         SDOperand Ops[] = { Chain, getRegister(Reg, VT), Flag };
         return getNode(ISD::CopyFromReg, VTs, 3, Ops, Flag.Val ? 3 : 2);
       }
    @@ -266,12 +270,12 @@
     
       /// getZeroExtendInReg - Return the expression required to zero extend the Op
       /// value assuming it was the smaller SrcTy value.
    -  SDOperand getZeroExtendInReg(SDOperand Op, MVT::ValueType SrcTy);
    +  SDOperand getZeroExtendInReg(SDOperand Op, MVT SrcTy);
       
       /// getCALLSEQ_START - Return a new CALLSEQ_START node, which always must have
       /// a flag result (to ensure it's not CSE'd).
       SDOperand getCALLSEQ_START(SDOperand Chain, SDOperand Op) {
    -    const MVT::ValueType *VTs = getNodeValueTypes(MVT::Other, MVT::Flag);
    +    const MVT *VTs = getNodeValueTypes(MVT::Other, MVT::Flag);
         SDOperand Ops[] = { Chain,  Op };
         return getNode(ISD::CALLSEQ_START, VTs, 2, Ops, 2);
       }
    @@ -287,32 +291,29 @@
         Ops.push_back(Op2);
         Ops.push_back(InFlag);
         return getNode(ISD::CALLSEQ_END, NodeTys, &Ops[0],
    -                   Ops.size() - (InFlag.Val == 0 ? 1 : 0));
    +                   (unsigned)Ops.size() - (InFlag.Val == 0 ? 1 : 0));
       }
     
       /// getNode - Gets or creates the specified node.
       ///
    -  SDOperand getNode(unsigned Opcode, MVT::ValueType VT);
    -  SDOperand getNode(unsigned Opcode, MVT::ValueType VT, SDOperand N);
    -  SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
    -                    SDOperand N1, SDOperand N2);
    -  SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
    +  SDOperand getNode(unsigned Opcode, MVT VT);
    +  SDOperand getNode(unsigned Opcode, MVT VT, SDOperand N);
    +  SDOperand getNode(unsigned Opcode, MVT VT, SDOperand N1, SDOperand N2);
    +  SDOperand getNode(unsigned Opcode, MVT VT,
                         SDOperand N1, SDOperand N2, SDOperand N3);
    -  SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
    +  SDOperand getNode(unsigned Opcode, MVT VT,
                         SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4);
    -  SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
    +  SDOperand getNode(unsigned Opcode, MVT VT,
                         SDOperand N1, SDOperand N2, SDOperand N3, SDOperand N4,
                         SDOperand N5);
    -  SDOperand getNode(unsigned Opcode, MVT::ValueType VT,
    +  SDOperand getNode(unsigned Opcode, MVT VT, SDOperandPtr Ops, unsigned NumOps);
    +  SDOperand getNode(unsigned Opcode, std::vector &ResultTys,
                         SDOperandPtr Ops, unsigned NumOps);
    -  SDOperand getNode(unsigned Opcode, std::vector &ResultTys,
    -                    SDOperandPtr Ops, unsigned NumOps);
    -  SDOperand getNode(unsigned Opcode, const MVT::ValueType *VTs, unsigned NumVTs,
    +  SDOperand getNode(unsigned Opcode, const MVT *VTs, unsigned NumVTs,
                         SDOperandPtr Ops, unsigned NumOps);
       SDOperand getNode(unsigned Opcode, SDVTList VTs);
       SDOperand getNode(unsigned Opcode, SDVTList VTs, SDOperand N);
    -  SDOperand getNode(unsigned Opcode, SDVTList VTs,
    -                    SDOperand N1, SDOperand N2);
    +  SDOperand getNode(unsigned Opcode, SDVTList VTs, SDOperand N1, SDOperand N2);
       SDOperand getNode(unsigned Opcode, SDVTList VTs,
                         SDOperand N1, SDOperand N2, SDOperand N3);
       SDOperand getNode(unsigned Opcode, SDVTList VTs,
    @@ -326,26 +327,34 @@
       SDOperand getMemcpy(SDOperand Chain, SDOperand Dst, SDOperand Src,
                           SDOperand Size, unsigned Align,
                           bool AlwaysInline,
    -                      const Value *DstSV, uint64_t DstOff,
    -                      const Value *SrcSV, uint64_t SrcOff);
    +                      const Value *DstSV, uint64_t DstSVOff,
    +                      const Value *SrcSV, uint64_t SrcSVOff);
     
       SDOperand getMemmove(SDOperand Chain, SDOperand Dst, SDOperand Src,
    -                      SDOperand Size, unsigned Align,
    -                      const Value *DstSV, uint64_t DstOff,
    -                      const Value *SrcSV, uint64_t SrcOff);
    +                       SDOperand Size, unsigned Align,
    +                       const Value *DstSV, uint64_t DstOSVff,
    +                       const Value *SrcSV, uint64_t SrcSVOff);
     
       SDOperand getMemset(SDOperand Chain, SDOperand Dst, SDOperand Src,
                           SDOperand Size, unsigned Align,
    -                      const Value *DstSV, uint64_t DstOff);
    +                      const Value *DstSV, uint64_t DstSVOff);
     
       /// getSetCC - Helper function to make it easier to build SetCC's if you just
       /// have an ISD::CondCode instead of an SDOperand.
       ///
    -  SDOperand getSetCC(MVT::ValueType VT, SDOperand LHS, SDOperand RHS,
    +  SDOperand getSetCC(MVT VT, SDOperand LHS, SDOperand RHS,
                          ISD::CondCode Cond) {
         return getNode(ISD::SETCC, VT, LHS, RHS, getCondCode(Cond));
       }
     
    +  /// getVSetCC - Helper function to make it easier to build VSetCC's nodes
    +  /// if you just have an ISD::CondCode instead of an SDOperand.
    +  ///
    +  SDOperand getVSetCC(MVT VT, SDOperand LHS, SDOperand RHS,
    +                      ISD::CondCode Cond) {
    +    return getNode(ISD::VSETCC, VT, LHS, RHS, getCondCode(Cond));
    +  }
    +
       /// getSelectCC - Helper function to make it easier to build SelectCC's if you
       /// just have an ISD::CondCode instead of an SDOperand.
       ///
    @@ -357,35 +366,52 @@
       
       /// getVAArg - VAArg produces a result and token chain, and takes a pointer
       /// and a source value as input.
    -  SDOperand getVAArg(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr,
    +  SDOperand getVAArg(MVT VT, SDOperand Chain, SDOperand Ptr,
                          SDOperand SV);
     
       /// getAtomic - Gets a node for an atomic op, produces result and chain, takes
    -  // 3 operands
    +  /// 3 operands
       SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, 
    -                      SDOperand Cmp, SDOperand Swp, MVT::ValueType VT);
    +                      SDOperand Cmp, SDOperand Swp, const Value* PtrVal,
    +                      unsigned Alignment=0);
     
       /// getAtomic - Gets a node for an atomic op, produces result and chain, takes
    -  // 2 operands
    +  /// 2 operands
       SDOperand getAtomic(unsigned Opcode, SDOperand Chain, SDOperand Ptr, 
    -                      SDOperand Val, MVT::ValueType VT);
    +                      SDOperand Val, const Value* PtrVal,
    +                      unsigned Alignment = 0);
    +
    +  /// getMergeValues - Create a MERGE_VALUES node from the given operands.
    +  /// Allowed to return something different (and simpler) if Simplify is true.
    +  SDOperand getMergeValues(SDOperandPtr Ops, unsigned NumOps,
    +                           bool Simplify = true);
    +
    +  /// getMergeValues - Create a MERGE_VALUES node from the given types and ops.
    +  /// Allowed to return something different (and simpler) if Simplify is true.
    +  /// May be faster than the above version if VTs is known and NumOps is large.
    +  SDOperand getMergeValues(SDVTList VTs, SDOperandPtr Ops, unsigned NumOps,
    +                           bool Simplify = true) {
    +    if (Simplify && NumOps == 1)
    +      return Ops[0];
    +    return getNode(ISD::MERGE_VALUES, VTs, Ops, NumOps);
    +  }
     
       /// getLoad - Loads are not normal binary operators: their result type is not
       /// determined by their operands, and they produce a value AND a token chain.
       ///
    -  SDOperand getLoad(MVT::ValueType VT, SDOperand Chain, SDOperand Ptr,
    +  SDOperand getLoad(MVT VT, SDOperand Chain, SDOperand Ptr,
                         const Value *SV, int SVOffset, bool isVolatile=false,
                         unsigned Alignment=0);
    -  SDOperand getExtLoad(ISD::LoadExtType ExtType, MVT::ValueType VT,
    +  SDOperand getExtLoad(ISD::LoadExtType ExtType, MVT VT,
                            SDOperand Chain, SDOperand Ptr, const Value *SV,
    -                       int SVOffset, MVT::ValueType EVT, bool isVolatile=false,
    +                       int SVOffset, MVT EVT, bool isVolatile=false,
                            unsigned Alignment=0);
       SDOperand getIndexedLoad(SDOperand OrigLoad, SDOperand Base,
                                SDOperand Offset, ISD::MemIndexedMode AM);
       SDOperand getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType,
    -                    MVT::ValueType VT, SDOperand Chain,
    +                    MVT VT, SDOperand Chain,
                         SDOperand Ptr, SDOperand Offset,
    -                    const Value *SV, int SVOffset, MVT::ValueType EVT,
    +                    const Value *SV, int SVOffset, MVT EVT,
                         bool isVolatile=false, unsigned Alignment=0);
     
       /// getStore - Helper function to build ISD::STORE nodes.
    @@ -394,7 +420,7 @@
                          const Value *SV, int SVOffset, bool isVolatile=false,
                          unsigned Alignment=0);
       SDOperand getTruncStore(SDOperand Chain, SDOperand Val, SDOperand Ptr,
    -                          const Value *SV, int SVOffset, MVT::ValueType TVT,
    +                          const Value *SV, int SVOffset, MVT TVT,
                               bool isVolatile=false, unsigned Alignment=0);
       SDOperand getIndexedStore(SDOperand OrigStoe, SDOperand Base,
                                SDOperand Offset, ISD::MemIndexedMode AM);
    @@ -427,20 +453,27 @@
       /// operands.  Note that target opcodes are stored as
       /// ISD::BUILTIN_OP_END+TargetOpcode in the node opcode field.  The 0th value
       /// of the resultant node is returned.
    -  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT);
    -  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, 
    -                       SDOperand Op1);
    -  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, 
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT);
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT, SDOperand Op1);
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT,
                            SDOperand Op1, SDOperand Op2);
    -  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT, 
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT,
                            SDOperand Op1, SDOperand Op2, SDOperand Op3);
    -  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT,
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT,
    +                       SDOperandPtr Ops, unsigned NumOps);
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1, MVT VT2);
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1,
    +                       MVT VT2, SDOperandPtr Ops, unsigned NumOps);
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1,
    +                       MVT VT2, MVT VT3, SDOperandPtr Ops, unsigned NumOps);
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1,
    +                       MVT VT2, SDOperand Op1);
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1,
    +                       MVT VT2, SDOperand Op1, SDOperand Op2);
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT VT1,
    +                       MVT VT2, SDOperand Op1, SDOperand Op2, SDOperand Op3);
    +  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, SDVTList VTs,
                            SDOperandPtr Ops, unsigned NumOps);
    -  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1, 
    -                       MVT::ValueType VT2, SDOperand Op1, SDOperand Op2);
    -  SDNode *SelectNodeTo(SDNode *N, unsigned TargetOpc, MVT::ValueType VT1,
    -                       MVT::ValueType VT2, SDOperand Op1, SDOperand Op2,
    -                       SDOperand Op3);
     
     
       /// getTargetNode - These are used for target selectors to create a new node
    @@ -449,41 +482,30 @@
       /// Note that getTargetNode returns the resultant node.  If there is already a
       /// node of the specified opcode and operands, it returns that node instead of
       /// the current one.
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
    -                        SDOperand Op1);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
    -                        SDOperand Op1, SDOperand Op2);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT);
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT, SDOperand Op1);
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT, SDOperand Op1, SDOperand Op2);
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT,
                             SDOperand Op1, SDOperand Op2, SDOperand Op3);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT,
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT,
                             SDOperandPtr Ops, unsigned NumOps);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
    -                        MVT::ValueType VT2);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
    -                        MVT::ValueType VT2, SDOperand Op1);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
    -                        MVT::ValueType VT2, SDOperand Op1, SDOperand Op2);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
    -                        MVT::ValueType VT2, SDOperand Op1, SDOperand Op2,
    -                        SDOperand Op3);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, 
    -                        MVT::ValueType VT2,
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2);
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, SDOperand Op1);
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT1,
    +                        MVT VT2, SDOperand Op1, SDOperand Op2);
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT1,
    +                        MVT VT2, SDOperand Op1, SDOperand Op2, SDOperand Op3);
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2,
                             SDOperandPtr Ops, unsigned NumOps);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
    -                        MVT::ValueType VT2, MVT::ValueType VT3,
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3,
                             SDOperand Op1, SDOperand Op2);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1,
    -                        MVT::ValueType VT2, MVT::ValueType VT3,
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3,
                             SDOperand Op1, SDOperand Op2, SDOperand Op3);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, 
    -                        MVT::ValueType VT2, MVT::ValueType VT3,
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3,
                             SDOperandPtr Ops, unsigned NumOps);
    -  SDNode *getTargetNode(unsigned Opcode, MVT::ValueType VT1, 
    -                        MVT::ValueType VT2, MVT::ValueType VT3,
    -                        MVT::ValueType VT4,
    +  SDNode *getTargetNode(unsigned Opcode, MVT VT1, MVT VT2, MVT VT3, MVT VT4,
                             SDOperandPtr Ops, unsigned NumOps);
    -  SDNode *getTargetNode(unsigned Opcode, std::vector &ResultTys,
    +  SDNode *getTargetNode(unsigned Opcode, std::vector &ResultTys,
                             SDOperandPtr Ops, unsigned NumOps);
     
       /// getNodeIfExists - Get the specified node if it's already available, or
    @@ -497,7 +519,12 @@
       class DAGUpdateListener {
       public:
         virtual ~DAGUpdateListener();
    -    virtual void NodeDeleted(SDNode *N) = 0;
    +
    +    /// NodeDeleted - The node N that was deleted and, if E is not null, an
    +    /// equivalent node E that replaced it.
    +    virtual void NodeDeleted(SDNode *N, SDNode *E) = 0;
    +
    +    /// NodeUpdated - The node N that was updated.
         virtual void NodeUpdated(SDNode *N) = 0;
       };
       
    @@ -562,11 +589,12 @@
       void dump() const;
     
       /// CreateStackTemporary - Create a stack temporary, suitable for holding the
    -  /// specified value type.
    -  SDOperand CreateStackTemporary(MVT::ValueType VT);
    +  /// specified value type.  If minAlign is specified, the slot size will have
    +  /// at least that alignment.
    +  SDOperand CreateStackTemporary(MVT VT, unsigned minAlign = 1);
       
       /// FoldSetCC - Constant fold a setcc to true or false.
    -  SDOperand FoldSetCC(MVT::ValueType VT, SDOperand N1,
    +  SDOperand FoldSetCC(MVT VT, SDOperand N1,
                           SDOperand N2, ISD::CondCode Cond);
       
       /// SignBitIsZero - Return true if the sign bit of Op is known to be zero.  We
    @@ -599,6 +627,10 @@
       /// isVerifiedDebugInfoDesc - Returns true if the specified SDOperand has
       /// been verified as a debug information descriptor.
       bool isVerifiedDebugInfoDesc(SDOperand Op) const;
    +
    +  /// getShuffleScalarElt - Returns the scalar element that will make up the ith
    +  /// element of the result of the vector shuffle.
    +  SDOperand getShuffleScalarElt(const SDNode *N, unsigned Idx);
       
     private:
       void RemoveNodeFromCSEMaps(SDNode *N);
    @@ -612,16 +644,15 @@
       void DeleteNodeNotInCSEMaps(SDNode *N);
       
       // List of non-single value types.
    -  std::list > VTList;
    +  std::list > VTList;
       
       // Maps to auto-CSE operations.
       std::vector CondCodeNodes;
     
       std::vector ValueTypeNodes;
    -  std::map ExtendedValueTypeNodes;
    -  std::map ExternalSymbols;
    -  std::map TargetExternalSymbols;
    -  std::map StringNodes;
    +  std::map ExtendedValueTypeNodes;
    +  StringMap ExternalSymbols;
    +  StringMap TargetExternalSymbols;
     };
     
     template <> struct GraphTraits : public GraphTraits {
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAGISel.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAGISel.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAGISel.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAGISel.h Sun Jul  6 15:45:41 2008
    @@ -41,13 +41,13 @@
       SelectionDAG *CurDAG;
       MachineBasicBlock *BB;
       AliasAnalysis *AA;
    -  std::vector TopOrder;
    -  unsigned DAGSize;
       CollectorMetadata *GCI;
    +  bool FastISel;
    +  std::vector TopOrder;
       static char ID;
     
    -  explicit SelectionDAGISel(TargetLowering &tli) : 
    -    FunctionPass((intptr_t)&ID), TLI(tli), DAGSize(0), GCI(0) {}
    +  explicit SelectionDAGISel(TargetLowering &tli, bool fast = false) : 
    +    FunctionPass((intptr_t)&ID), TLI(tli), GCI(0), FastISel(fast), DAGSize(0) {}
       
       TargetLowering &getTargetLowering() { return TLI; }
     
    @@ -55,10 +55,12 @@
     
       virtual bool runOnFunction(Function &Fn);
     
    -  unsigned MakeReg(MVT::ValueType VT);
    +  unsigned MakeReg(MVT VT);
     
       virtual void EmitFunctionEntryCode(Function &Fn, MachineFunction &MF) {}
    -  virtual void InstructionSelectBasicBlock(SelectionDAG &SD) = 0;
    +  virtual void InstructionSelect(SelectionDAG &SD) = 0;
    +  virtual void InstructionSelectPostProcessing(SelectionDAG &DAG) {}
    +  
       virtual void SelectRootInit() {
         DAGSize = CurDAG->AssignTopologicalOrder(TopOrder);
       }
    @@ -158,11 +160,12 @@
         MachineBasicBlock *Default;
         BitTestInfo Cases;
       };
    -protected:
    -  /// Pick a safe ordering and emit instructions for each target node in the
    -  /// graph.
    -  void ScheduleAndEmitDAG(SelectionDAG &DAG);
       
    +protected:
    +  /// DAGSize - Size of DAG being instruction selected.
    +  ///
    +  unsigned DAGSize;
    +
       /// SelectInlineAsmMemoryOperands - Calls to this are automatically generated
       /// by tblgen.  Others should not call it.
       void SelectInlineAsmMemoryOperands(std::vector &Ops,
    @@ -183,6 +186,12 @@
                              FunctionLoweringInfo &FuncInfo);
       void CodeGenAndEmitDAG(SelectionDAG &DAG);
       void LowerArguments(BasicBlock *BB, SelectionDAGLowering &SDL);
    +  
    +  void ComputeLiveOutVRegInfo(SelectionDAG &DAG);
    +
    +  /// Pick a safe ordering and emit instructions for each target node in the
    +  /// graph.
    +  void ScheduleAndEmitDAG(SelectionDAG &DAG);
     
       /// SwitchCases - Vector of CaseBlock structures used to communicate
       /// SwitchInst code generation information.
    
    Modified: llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAGNodes.h
    URL: http://llvm.org/viewvc/llvm-project/llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAGNodes.h?rev=53163&r1=53162&r2=53163&view=diff
    
    ==============================================================================
    --- llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAGNodes.h (original)
    +++ llvm/branches/non-call-eh/include/llvm/CodeGen/SelectionDAGNodes.h Sun Jul  6 15:45:41 2008
    @@ -22,7 +22,7 @@
     #include "llvm/Value.h"
     #include "llvm/ADT/FoldingSet.h"
     #include "llvm/ADT/GraphTraits.h"
    -#include "llvm/ADT/iterator"
    +#include "llvm/ADT/iterator.h"
     #include "llvm/ADT/APFloat.h"
     #include "llvm/ADT/APInt.h"
     #include "llvm/CodeGen/ValueTypes.h"
    @@ -37,6 +37,7 @@
     class MachineBasicBlock;
     class MachineConstantPoolValue;
     class SDNode;
    +class CompileUnitDesc;
     template  struct DenseMapInfo;
     template  struct simplify_type;
     template  struct ilist_traits;
    @@ -48,7 +49,7 @@
     /// SelectionDAG::getVTList(...).
     ///
     struct SDVTList {
    -  const MVT::ValueType *VTs;
    +  const MVT *VTs;
       unsigned short NumVTs;
     };
     
    @@ -82,7 +83,7 @@
         AssertSext, AssertZext,
     
         // Various leaf nodes.
    -    STRING, BasicBlock, VALUETYPE, ARG_FLAGS, CONDCODE, Register,
    +    BasicBlock, VALUETYPE, ARG_FLAGS, CONDCODE, Register,
         Constant, ConstantFP,
         GlobalAddress, GlobalTLSAddress, FrameIndex,
         JumpTable, ConstantPool, ExternalSymbol,
    @@ -193,16 +194,16 @@
         CALL,
     
         // EXTRACT_ELEMENT - This is used to get the lower or upper (determined by
    -    // a Constant, which is required to be operand #1) half of the integer value
    -    // specified as operand #0.  This is only for use before legalization, for
    -    // values that will be broken into multiple registers.
    +    // a Constant, which is required to be operand #1) half of the integer or
    +    // float value specified as operand #0.  This is only for use before
    +    // legalization, for values that will be broken into multiple registers.
         EXTRACT_ELEMENT,
     
         // BUILD_PAIR - This is the opposite of EXTRACT_ELEMENT in some ways.  Given
         // two values of the same integer value type, this produces a value twice as
         // big.  Like EXTRACT_ELEMENT, this can only be used before legalization.
         BUILD_PAIR,
    -    
    +
         // MERGE_VALUES - This node takes multiple discrete operands and returns
         // them all as its individual results.  This nodes has exactly the same
         // number of inputs and outputs, and is only valid before legalization.
    @@ -332,6 +333,14 @@
         // (op #2) as a CondCodeSDNode.
         SETCC,
     
    +    // Vector SetCC operator - This evaluates to a vector of integer elements
    +    // with the high bit in each element set to true if the comparison is true
    +    // and false if the comparison is false.  All other bits in each element 
    +    // are undefined.  The operands to this are the left and right operands
    +    // to compare (ops #0, and #1) and the condition code to compare them with
    +    // (op #2) as a CondCodeSDNode.
    +    VSETCC,
    +
         // SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded
         // integer shift operations, just like ADD/SUB_PARTS.  The operation
         // ordering is:
    @@ -473,14 +482,11 @@
         //   Operand #last: Optional, an incoming flag.
         INLINEASM,
         
    -    // LABEL - Represents a label in mid basic block used to track
    -    // locations needed for debug and exception handling tables.  This node
    -    // returns a chain.
    -    //   Operand #0 : input chain.
    -    //   Operand #1 : module unique number use to identify the label.
    -    //   Operand #2 : 0 indicates a debug label (e.g. stoppoint), 1 indicates
    -    //                a EH label, 2 indicates unknown label type.
    -    LABEL,
    +    // DBG_LABEL, EH_LABEL - Represents a label in mid basic block used to track
    +    // locations needed for debug and exception handling tables.  These nodes
    +    // take a chain as input and return a chain.
    +    DBG_LABEL,
    +    EH_LABEL,
     
         // DECLARE - Represents a llvm.dbg.declare intrinsic. It's used to track
         // local variable declarations for debugging information. First operand is
    @@ -539,11 +545,11 @@
         // HANDLENODE node - Used as a handle for various purposes.
         HANDLENODE,
     
    -    // LOCATION - This node is used to represent a source location for debug
    -    // info.  It takes token chain as input, then a line number, then a column
    -    // number, then a filename, then a working dir.  It produces a token chain
    -    // as output.
    -    LOCATION,
    +    // DBG_STOPPOINT - This node is used to represent a source location for
    +    // debug info.  It takes token chain as input, and carries a line number,
    +    // column number, and a pointer to a CompileUnitDesc object identifying
    +    // the containing compilation unit.  It produces a token chain as output.
    +    DBG_STOPPOINT,
         
         // DEBUG_LOC - This node is used to represent source line information
         // embedded in the code.  It takes a token chain as input, then a line
    @@ -576,17 +582,17 @@
         // and produces an output chain.
         MEMBARRIER,
     
    -    // Val, OUTCHAIN = ATOMIC_LCS(INCHAIN, ptr, cmp, swap)
    +    // Val, OUTCHAIN = ATOMIC_CMP_SWAP(INCHAIN, ptr, cmp, swap)
         // this corresponds to the atomic.lcs intrinsic.
         // cmp is compared to *ptr, and if equal, swap is stored in *ptr.
         // the return is always the original value in *ptr
    -    ATOMIC_LCS,
    +    ATOMIC_CMP_SWAP,
     
    -    // Val, OUTCHAIN = ATOMIC_LAS(INCHAIN, ptr, amt)
    +    // Val, OUTCHAIN = ATOMIC_LOAD_ADD(INCHAIN, ptr, amt)
         // this corresponds to the atomic.las intrinsic.
         // *ptr + amt is stored to *ptr atom