[llvm-commits] CVS: llvm/Xcode/LLVM.xcodeproj/project.pbxproj
Changes in directory llvm/Xcode/LLVM.xcodeproj: project.pbxproj updated: 1.16 - 1.17 --- Log message: Adding UniqueVector. --- Diffs of the changes: (+2 -0) project.pbxproj |2 ++ 1 files changed, 2 insertions(+) Index: llvm/Xcode/LLVM.xcodeproj/project.pbxproj diff -u llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.16 llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.17 --- llvm/Xcode/LLVM.xcodeproj/project.pbxproj:1.16 Wed Jan 4 07:37:32 2006 +++ llvm/Xcode/LLVM.xcodeproj/project.pbxproj Tue Jan 17 11:29:20 2006 @@ -131,6 +131,7 @@ CFC244BF0959F2E3009F8C47 /* IA64ISelDAGToDAG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IA64ISelDAGToDAG.cpp; sourceTree = group; }; CFC244C00959F2E3009F8C47 /* IA64ISelLowering.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IA64ISelLowering.cpp; sourceTree = group; }; CFC244C10959F2E3009F8C47 /* IA64ISelLowering.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IA64ISelLowering.h; sourceTree = group; }; + CFF8B434097C605F0047F72A /* UniqueVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UniqueVector.h; sourceTree = group; }; DE4DA0390911476D0012D44B /* LoopSimplify.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = LoopSimplify.cpp; path = ../lib/Transforms/Utils/LoopSimplify.cpp; sourceTree = SOURCE_ROOT; }; DE4DA03C091147920012D44B /* LiveInterval.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = LiveInterval.h; path = ../include/llvm/CodeGen/LiveInterval.h; sourceTree = SOURCE_ROOT; }; DE4DA03D091147920012D44B /* LiveIntervalAnalysis.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = LiveIntervalAnalysis.h; path = ../include/llvm/CodeGen/LiveIntervalAnalysis.h; sourceTree = SOURCE_ROOT; }; @@ -1898,6 +1899,7 @@ DE66F1FF08ABF03100323D32 /* STLExtras.h */, DE66F20008ABF03100323D32 /* StringExtras.h */, DE66F20108ABF03100323D32 /* Tree.h */, + CFF8B434097C605F0047F72A /* UniqueVector.h */, DE66F20208ABF03100323D32 /* VectorExtras.h */, ); path = ADT; ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.267 - 1.268 --- Log message: Adding basic support for Dwarf line number debug information. I promise to keep future commits smaller. --- Diffs of the changes: (+1 -1) LegalizeDAG.cpp |2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.267 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.268 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.267 Mon Jan 16 01:59:13 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Jan 17 11:31:53 2006 @@ -627,7 +627,7 @@ castStringSDNode(Node-getOperand(3))-getValue(); const std::string DirName = castStringSDNode(Node-getOperand(4))-getValue(); -unsigned SrcFile = DebugInfo-getUniqueSourceID(FName, DirName); +unsigned SrcFile = DebugInfo-RecordSource(DirName, FName); std::vectorSDOperand Ops; Ops.push_back(Tmp1); // chain ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/DwarfWriter.h MachineDebugInfo.h
Changes in directory llvm/include/llvm/CodeGen: DwarfWriter.h updated: 1.6 - 1.7 MachineDebugInfo.h updated: 1.5 - 1.6 --- Log message: Adding basic support for Dwarf line number debug information. I promise to keep future commits smaller. --- Diffs of the changes: (+506 -84) DwarfWriter.h | 446 ++--- MachineDebugInfo.h | 144 + 2 files changed, 506 insertions(+), 84 deletions(-) Index: llvm/include/llvm/CodeGen/DwarfWriter.h diff -u llvm/include/llvm/CodeGen/DwarfWriter.h:1.6 llvm/include/llvm/CodeGen/DwarfWriter.h:1.7 --- llvm/include/llvm/CodeGen/DwarfWriter.h:1.6 Wed Jan 4 19:25:28 2006 +++ llvm/include/llvm/CodeGen/DwarfWriter.h Tue Jan 17 11:31:53 2006 @@ -7,14 +7,26 @@ // //===--===// // -// This file contains support for writing dwarf debug info into asm files. +// This file contains support for writing Dwarf debug info into asm files. For +// Details on the Dwarf 3 specfication see DWARF Debugging Information Format +// V.3 reference manual http://dwarf.freestandards.org , // +// The role of the Dwarf Writer class is to extract debug information from the +// MachineDebugInfo object, organize it in Dwarf form and then emit it into asm +// the current asm file using data and high level Dwarf directives. +// //===--===// #ifndef LLVM_CODEGEN_DWARFPRINTER_H #define LLVM_CODEGEN_DWARFPRINTER_H +#include llvm/ADT/UniqueVector.h + #include iosfwd +#include map +#include string +#include vector + namespace llvm { @@ -23,6 +35,8 @@ // reference manual http://dwarf.freestandards.org . // enum dwarf_constants { +DWARF_VERSION = 2, + // Tags DW_TAG_array_type = 0x01, DW_TAG_class_type = 0x02, @@ -425,23 +439,246 @@ DW_CFA_hi_user = 0x3f }; + //======// + // DWLabel - Labels are used to track locations in the assembler file. + // Labels appear in the form prefixdebug_TagNumber, where the tag is a + // category of label (Ex. location) and number is a value unique in that + // category. + struct DWLabel { +const char *Tag;// Label category tag. Should always be +// a staticly declared C string. +unsignedNumber; // Unique number + +DWLabel() : Tag(NULL), Number(0) {} +DWLabel(const char *T, unsigned N) : Tag(T), Number(N) {} + }; + + //======// + // DIEAbbrev - Dwarf abbreviation, describes the organization of a debug + // information object. + // + class DIEAbbrev { + private: +const unsigned char *Data; // Static array of bytes containing the +// image of the raw abbreviation data. + + public: + +DIEAbbrev(const unsigned char *D) +: Data(D) +{} + +/// operator== - Used by UniqueVector to locate entry. +/// +bool operator==(const DIEAbbrev DA) const { + return Data == DA.Data; +} + +/// operator - Used by UniqueVector to locate entry. +/// +bool operator(const DIEAbbrev DA) const { + return Data DA.Data; +} + +// Accessors +unsigned getTag() const { return Data[0]; } +unsigned getChildrenFlag()const { return Data[1]; } +unsigned getAttribute(unsigned i) const { return Data[2 + 2 * i + 0]; } +unsigned getForm(unsigned i) const { return Data[2 + 2 * i + 1]; } + }; + + //======// + // DIEValue - A debug information entry value. + // + class DwarfWriter; + class DIEValue { + public: +enum { + isInteger, + isString, + isLabel, + isDelta +}; + +unsigned Type; // Type of the value + +DIEValue(unsigned T) : Type(T) {} +virtual ~DIEValue() {} + +// Implement isa/cast/dyncast. +static bool classof(const DIEValue *) { return true; } + +/// EmitValue - Emit value via the Dwarf writer. +/// +virtual void EmitValue(const DwarfWriter DW, unsigned Form) const = 0; + +/// SizeOf - Return the size of a value in bytes. +/// +virtual unsigned SizeOf(const DwarfWriter DW, unsigned Form) const = 0; + }; + + //======// + // DWInteger - An integer value DIE. + // + class DIEInteger : public DIEValue { + private: +int Value; + + public: +DIEInteger(int V) : DIEValue(isInteger), Value(V) {} + +// Implement isa/cast/dyncast. +static bool classof(const DIEInteger *) { return true; } +static bool classof(const DIEValue *V) { return V-Type == isInteger; } + +
[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.136 - 1.137 --- Log message: Adding basic support for Dwarf line number debug information. I promise to keep future commits smaller. --- Diffs of the changes: (+8 -6) PPCAsmPrinter.cpp | 14 -- 1 files changed, 8 insertions(+), 6 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.136 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.137 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.136 Wed Jan 4 19:25:28 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Jan 17 11:31:53 2006 @@ -215,9 +215,11 @@ : DwarfWriter(o, ap) { needsSet = true; - DwarfAbbrevSection = .section __DWARFA,__debug_abbrev,regular,debug; - DwarfInfoSection = .section __DWARFA,__debug_info,regular,debug; - DwarfLineSection = .section __DWARFA,__debug_line,regular,debug; + DwarfAbbrevSection = .section __DWARF,__debug_abbrev,regular,debug; + DwarfInfoSection = .section __DWARF,__debug_info,regular,debug; + DwarfLineSection = .section __DWARF,__debug_line,regular,debug; + TextSection = .text; + DataSection = .data; } }; @@ -607,6 +609,9 @@ } } + // Emit initial debug information. + DW.EndModule(); + // Funny Darwin hack: This flag tells the linker that no global symbols // contain code that falls through to other global symbols (e.g. the obvious // implementation of multiple entry points). If this doesn't occur, the @@ -614,9 +619,6 @@ // code that does this, it is always safe to set. O \t.subsections_via_symbols\n; - // Emit initial debug information. - DW.EndModule(); - AsmPrinter::doFinalization(M); return false; // success } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm-test/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c
Changes in directory llvm-test/SingleSource/Regression/C: 2004-08-12-InlinerAndAllocas.c updated: 1.2 - 1.3 --- Log message: The old f-e doesn't insert the required llvm.stacksave/stackrestore intrinsics. --- Diffs of the changes: (+1 -0) 2004-08-12-InlinerAndAllocas.c |1 + 1 files changed, 1 insertion(+) Index: llvm-test/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c diff -u llvm-test/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c:1.2 llvm-test/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c:1.3 --- llvm-test/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c:1.2 Tue Mar 8 09:51:08 2005 +++ llvm-test/SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c Tue Jan 17 11:46:46 2006 @@ -1,5 +1,6 @@ // A compiler cannot inline Callee into main unless it is prepared to reclaim // the stack memory allocated in it. +// XFAIL: * #ifdef __FreeBSD__ #include stdlib.h ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
Changes in directory llvm/lib/Transforms/IPO: SimplifyLibCalls.cpp updated: 1.55 - 1.56 --- Log message: Clean up the FFS optimization code, and make it correctly create the appropriate unsigned llvm.cttz.* intrinsic, fixing the 2005-05-11-Popcount-ffs-fls regression last night. --- Diffs of the changes: (+43 -41) SimplifyLibCalls.cpp | 84 ++- 1 files changed, 43 insertions(+), 41 deletions(-) Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.55 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.56 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.55 Sat Oct 22 23:37:20 2005 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cppTue Jan 17 12:27:17 2006 @@ -1810,69 +1810,71 @@ /// optimization is to compute the result at compile time if the argument is /// a constant. /// @brief Simplify the ffs library function. -struct FFSOptimization : public LibCallOptimization -{ +struct FFSOptimization : public LibCallOptimization { protected: /// @brief Subclass Constructor FFSOptimization(const char* funcName, const char* description) -: LibCallOptimization(funcName, description) -{} +: LibCallOptimization(funcName, description) {} public: /// @brief Default Constructor FFSOptimization() : LibCallOptimization(ffs, Number of 'ffs' calls simplified) {} - /// @brief Make sure that the fputs function has the right prototype - virtual bool ValidateCalledFunction(const Function* f, SimplifyLibCalls SLC) - { + /// @brief Make sure that the ffs function has the right prototype + virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls SLC){ // Just make sure this has 2 arguments -return (f-arg_size() == 1 f-getReturnType() == Type::IntTy); +return F-arg_size() == 1 F-getReturnType() == Type::IntTy; } /// @brief Perform the ffs optimization. - virtual bool OptimizeCall(CallInst* ci, SimplifyLibCalls SLC) - { -if (ConstantInt* CI = dyn_castConstantInt(ci-getOperand(1))) -{ + virtual bool OptimizeCall(CallInst *TheCall, SimplifyLibCalls SLC) { +if (ConstantInt *CI = dyn_castConstantInt(TheCall-getOperand(1))) { // ffs(cnst) - bit# // ffsl(cnst) - bit# // ffsll(cnst) - bit# uint64_t val = CI-getRawValue(); int result = 0; - while (val != 0) { -result +=1; -if (val1) - break; -val = 1; + if (val) { +++result; +while ((val 1) == 0) { + ++result; + val = 1; +} } - ci-replaceAllUsesWith(ConstantSInt::get(Type::IntTy, result)); - ci-eraseFromParent(); + TheCall-replaceAllUsesWith(ConstantSInt::get(Type::IntTy, result)); + TheCall-eraseFromParent(); return true; } -// ffs(x) - ( x == 0 ? 0 : llvm.cttz(x)+1) -// ffsl(x) - ( x == 0 ? 0 : llvm.cttz(x)+1) -// ffsll(x) - ( x == 0 ? 0 : llvm.cttz(x)+1) -const Type* arg_type = ci-getOperand(1)-getType(); -std::vectorconst Type* args; -args.push_back(arg_type); -FunctionType* llvm_cttz_type = FunctionType::get(arg_type,args,false); -Function* F = - SLC.getModule()-getOrInsertFunction(llvm.cttz,llvm_cttz_type); -std::string inst_name(ci-getName()+.ffs); -Instruction* call = - new CallInst(F, ci-getOperand(1), inst_name, ci); -if (arg_type != Type::IntTy) - call = new CastInst(call, Type::IntTy, inst_name, ci); -BinaryOperator* add = BinaryOperator::createAdd(call, - ConstantSInt::get(Type::IntTy,1), inst_name, ci); -SetCondInst* eq = new SetCondInst(Instruction::SetEQ,ci-getOperand(1), - ConstantSInt::get(ci-getOperand(1)-getType(),0),inst_name,ci); -SelectInst* select = new SelectInst(eq,ConstantSInt::get(Type::IntTy,0),add, - inst_name,ci); -ci-replaceAllUsesWith(select); -ci-eraseFromParent(); +// ffs(x) - x == 0 ? 0 : llvm.cttz(x)+1 +// ffsl(x) - x == 0 ? 0 : llvm.cttz(x)+1 +// ffsll(x) - x == 0 ? 0 : llvm.cttz(x)+1 +const Type *ArgType = TheCall-getOperand(1)-getType(); +ArgType = ArgType-getUnsignedVersion(); +const char *CTTZName; +switch (ArgType-getTypeID()) { +default: assert(0 Unknown unsigned type!); +case Type::UByteTyID : CTTZName = llvm.cttz.i8 ; break; +case Type::UShortTyID: CTTZName = llvm.cttz.i16; break; +case Type::UIntTyID : CTTZName = llvm.cttz.i32; break; +case Type::ULongTyID : CTTZName = llvm.cttz.i64; break; +} + +Function *F = SLC.getModule()-getOrInsertFunction(CTTZName, ArgType, + ArgType, NULL); +Value *V = new CastInst(TheCall-getOperand(1), ArgType, tmp, TheCall); +Value *V2 = new CallInst(F, V, tmp, TheCall); +V2 = new CastInst(V2, Type::IntTy, tmp, TheCall); +V2 = BinaryOperator::createAdd(V2, ConstantSInt::get(Type::IntTy, 1), +
[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.268 - 1.269 --- Log message: Bug fix: missing LegalizeOp() on newly created nodes. --- Diffs of the changes: (+6 -1) LegalizeDAG.cpp |7 ++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.268 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.269 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.268 Tue Jan 17 11:31:53 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Jan 17 13:47:13 2006 @@ -1639,6 +1639,7 @@ // Perform the larger operation, then round down. Result = DAG.getNode(ISD::SELECT, NVT, Tmp1, Tmp2,Tmp3); Result = DAG.getNode(TruncOp, Node-getValueType(0), Result); + Result = LegalizeOp(Result); break; } } @@ -1838,6 +1839,7 @@ Result = DAG.getNode(ISD::SETCC, Node-getValueType(0), Tmp1, Tmp2, Node-getOperand(2)); + Result = LegalizeOp(Result); break; } case TargetLowering::Custom: { @@ -2246,6 +2248,7 @@ Tmp1 = DAG.getNode(ISD::BSWAP, NVT, Tmp1); Result = DAG.getNode(ISD::SRL, NVT, Tmp1, DAG.getConstant(DiffBits, TLI.getShiftAmountTy())); +Result = LegalizeOp(Result); break; } case TargetLowering::Custom: @@ -2316,6 +2319,7 @@ break; } } +Result = LegalizeOp(Result); break; } } @@ -2358,6 +2362,7 @@ getSizeInBits(OVT), NVT)); break; } + Result = LegalizeOp(Result); break; } case TargetLowering::Custom: @@ -2384,7 +2389,7 @@ DAG.getNode(ISD::SRL, VT, Tmp1, Tmp3), Tmp2)); } -Result = Tmp1; +Result = LegalizeOp(Tmp1); break; } case ISD::CTLZ: { ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp ConstantFolding.h Constants.cpp Instruction.cpp Instructions.cpp Verifier.cpp
Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.82 - 1.83 ConstantFolding.h updated: 1.46 - 1.47 Constants.cpp updated: 1.144 - 1.145 Instruction.cpp updated: 1.49 - 1.50 Instructions.cpp updated: 1.30 - 1.31 Verifier.cpp updated: 1.143 - 1.144 --- Log message: VMCore support for the insertelement operation. --- Diffs of the changes: (+147 -9) ConstantFolding.cpp | 57 ConstantFolding.h |3 ++ Constants.cpp | 49 +--- Instruction.cpp |1 Instructions.cpp| 25 -- Verifier.cpp| 21 +++ 6 files changed, 147 insertions(+), 9 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.82 llvm/lib/VMCore/ConstantFolding.cpp:1.83 --- llvm/lib/VMCore/ConstantFolding.cpp:1.82Tue Jan 10 14:03:46 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Tue Jan 17 14:07:22 2006 @@ -734,6 +734,63 @@ return 0; } +Constant *llvm::ConstantFoldInsertElementInstruction(const Constant *Val, + const Constant *Elt, + const Constant *Idx) { + const ConstantUInt *CIdx = dyn_castConstantUInt(Idx); + if (!CIdx) return 0; + unsigned idxVal = CIdx-getValue(); + if (const UndefValue *UVal = dyn_castUndefValue(Val)) { +// Insertion of scalar constant into packed undef +// Optimize away insertion of undef +if (isaUndefValue(Elt)) + return const_castConstant*(Val); +// Otherwise break the aggregate undef into multiple undefs and do +// the insertion +unsigned numOps = + castPackedType(Val-getType())-getNumElements(); +std::vectorConstant* Ops; +Ops.reserve(numOps); +for (unsigned i = 0; i numOps; ++i) { + const Constant *Op = +(i == idxVal) ? Elt : UndefValue::get(Elt-getType()); + Ops.push_back(const_castConstant*(Op)); +} +return ConstantPacked::get(Ops); + } + if (const ConstantAggregateZero *CVal = + dyn_castConstantAggregateZero(Val)) { +// Insertion of scalar constant into packed aggregate zero +// Optimize away insertion of zero +if (Elt-isNullValue()) + return const_castConstant*(Val); +// Otherwise break the aggregate zero into multiple zeros and do +// the insertion +unsigned numOps = + castPackedType(Val-getType())-getNumElements(); +std::vectorConstant* Ops; +Ops.reserve(numOps); +for (unsigned i = 0; i numOps; ++i) { + const Constant *Op = +(i == idxVal) ? Elt : Constant::getNullValue(Elt-getType()); + Ops.push_back(const_castConstant*(Op)); +} +return ConstantPacked::get(Ops); + } + if (const ConstantPacked *CVal = dyn_castConstantPacked(Val)) { +// Insertion of scalar constant into packed constant +std::vectorConstant* Ops; +Ops.reserve(CVal-getNumOperands()); +for (unsigned i = 0; i CVal-getNumOperands(); ++i) { + const Constant *Op = +(i == idxVal) ? Elt : castConstant(CVal-getOperand(i)); + Ops.push_back(const_castConstant*(Op)); +} +return ConstantPacked::get(Ops); + } + return 0; +} + /// isZeroSizedType - This type is zero sized if its an array or structure of /// zero sized types. The only leaf zero sized type is an empty structure. static bool isMaybeZeroSizedType(const Type *Ty) { Index: llvm/lib/VMCore/ConstantFolding.h diff -u llvm/lib/VMCore/ConstantFolding.h:1.46 llvm/lib/VMCore/ConstantFolding.h:1.47 --- llvm/lib/VMCore/ConstantFolding.h:1.46 Tue Jan 10 14:03:46 2006 +++ llvm/lib/VMCore/ConstantFolding.h Tue Jan 17 14:07:22 2006 @@ -33,6 +33,9 @@ const Constant *V2); Constant *ConstantFoldExtractElementInstruction(const Constant *Val, const Constant *Idx); + Constant *ConstantFoldInsertElementInstruction(const Constant *Val, + const Constant *Elt, + const Constant *Idx); Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1, const Constant *V2); Constant *ConstantFoldGetElementPtr(const Constant *C, Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.144 llvm/lib/VMCore/Constants.cpp:1.145 --- llvm/lib/VMCore/Constants.cpp:1.144 Tue Jan 10 14:03:46 2006 +++ llvm/lib/VMCore/Constants.cpp Tue Jan 17 14:07:22 2006 @@ -347,8 +347,9 @@ } }; -/// ExtractElementConstantExpr - This class is private to Constants.cpp, and is used -/// behind the scenes to implement extractelement constant exprs. +/// ExtractElementConstantExpr - This class is private to +/// Constants.cpp, and is used behind the scenes to implement +/// extractelement constant exprs. class
[llvm-commits] CVS: llvm/lib/Transforms/Scalar/LowerPacked.cpp SCCP.cpp
Changes in directory llvm/lib/Transforms/Scalar: LowerPacked.cpp updated: 1.7 - 1.8 SCCP.cpp updated: 1.126 - 1.127 --- Log message: Lowerpacked and SCCP support for the insertelement operation. --- Diffs of the changes: (+66 -8) LowerPacked.cpp | 53 + SCCP.cpp| 21 + 2 files changed, 66 insertions(+), 8 deletions(-) Index: llvm/lib/Transforms/Scalar/LowerPacked.cpp diff -u llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.7 llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.8 --- llvm/lib/Transforms/Scalar/LowerPacked.cpp:1.7 Tue Jan 10 13:05:05 2006 +++ llvm/lib/Transforms/Scalar/LowerPacked.cpp Tue Jan 17 14:06:55 2006 @@ -61,8 +61,12 @@ /// @brief Lowers packed extractelement instructions. /// @param EI the extractelement operator to convert - void visitExtractElementInst(ExtractElementInst EI); + void visitExtractElementInst(ExtractElementInst EE); + /// @brief Lowers packed insertelement instructions. + /// @param EI the insertelement operator to convert + void visitInsertElementInst(InsertElementInst IE); + /// This function asserts if the instruction is a PackedType but /// is handled by another function. /// @@ -345,22 +349,55 @@ if (ConstantUInt *C = dyn_castConstantUInt(op1)) { EI.replaceAllUsesWith(op0Vals[C-getValue()]); } else { -AllocaInst *alloca = new AllocaInst(PTy-getElementType(), - ConstantUInt::get(Type::UIntTy, PTy-getNumElements()), - EI.getName() + .alloca, (EI.getParent()-getParent()-getEntryBlock().front())); +AllocaInst *alloca = + new AllocaInst(PTy-getElementType(), + ConstantUInt::get(Type::UIntTy, PTy-getNumElements()), + EI.getName() + .alloca, +EI.getParent()-getParent()-getEntryBlock().begin()); for (unsigned i = 0; i PTy-getNumElements(); ++i) { - GetElementPtrInst *GEP = new GetElementPtrInst(alloca, ConstantUInt::get(Type::UIntTy, i), -store.ge, EI); + GetElementPtrInst *GEP = +new GetElementPtrInst(alloca, ConstantUInt::get(Type::UIntTy, i), + store.ge, EI); new StoreInst(op0Vals[i], GEP, EI); } -GetElementPtrInst *GEP = new GetElementPtrInst(alloca, op1, - EI.getName() + .ge, EI); +GetElementPtrInst *GEP = + new GetElementPtrInst(alloca, op1, EI.getName() + .ge, EI); LoadInst *load = new LoadInst(GEP, EI.getName() + .load, EI); EI.replaceAllUsesWith(load); } Changed = true; instrsToRemove.push_back(EI); +} + +void LowerPacked::visitInsertElementInst(InsertElementInst IE) +{ + std::vectorValue* Vals = getValues(IE.getOperand(0)); + Value *Elt = IE.getOperand(1); + Value *Idx = IE.getOperand(2); + std::vectorValue* result; + result.reserve(Vals.size()); + + if (ConstantUInt *C = dyn_castConstantUInt(Idx)) { +unsigned idxVal = C-getValue(); +for (unsigned i = 0; i != Vals.size(); ++i) { + result.push_back(i == idxVal ? Elt : Vals[i]); +} + } else { +for (unsigned i = 0; i != Vals.size(); ++i) { + SetCondInst *setcc = +new SetCondInst(Instruction::SetEQ, Idx, +ConstantUInt::get(Type::UIntTy, i), +setcc, IE); + SelectInst *select = +new SelectInst(setcc, Elt, Vals[i], select, IE); + result.push_back(select); +} + } + + setValues(IE, result); + Changed = true; + instrsToRemove.push_back(IE); } bool LowerPacked::runOnFunction(Function F) Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.126 llvm/lib/Transforms/Scalar/SCCP.cpp:1.127 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.126 Tue Jan 10 13:05:05 2006 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Tue Jan 17 14:06:55 2006 @@ -323,6 +323,7 @@ void visitBinaryOperator(Instruction I); void visitShiftInst(ShiftInst I) { visitBinaryOperator(I); } void visitExtractElementInst(ExtractElementInst I); + void visitInsertElementInst(InsertElementInst I); // Instructions that cannot be folded away... void visitStoreInst (Instruction I); @@ -738,6 +739,26 @@ else if(ValState.isConstant() IdxState.isConstant()) markConstant(I, ConstantExpr::getExtractElement(ValState.getConstant(), IdxState.getConstant())); +} + +void SCCPSolver::visitInsertElementInst(InsertElementInst I) { + LatticeVal ValState = getValueState(I.getOperand(0)); + LatticeVal EltState = getValueState(I.getOperand(1)); + LatticeVal IdxState = getValueState(I.getOperand(2)); + + if (ValState.isOverdefined() || EltState.isOverdefined() || + IdxState.isOverdefined()) +markOverdefined(I); + else if(ValState.isConstant()
[llvm-commits] CVS: llvm/lib/Transforms/Utils/Local.cpp
Changes in directory llvm/lib/Transforms/Utils: Local.cpp updated: 1.50 - 1.51 --- Log message: Constant folding support for the insertelement operation. --- Diffs of the changes: (+3 -0) Local.cpp |3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/Transforms/Utils/Local.cpp diff -u llvm/lib/Transforms/Utils/Local.cpp:1.50 llvm/lib/Transforms/Utils/Local.cpp:1.51 --- llvm/lib/Transforms/Utils/Local.cpp:1.50Mon Jan 16 15:12:35 2006 +++ llvm/lib/Transforms/Utils/Local.cpp Tue Jan 17 14:07:07 2006 @@ -104,6 +104,9 @@ return 0; case Instruction::ExtractElement: return ConstantExpr::getExtractElement(Op0, Op1); + case Instruction::InsertElement: +if (Constant *Op2 = dyn_castConstant(I-getOperand(2))) + return ConstantExpr::getInsertElement(Op0, Op1, Op2); case Instruction::GetElementPtr: std::vectorConstant* IdxList; IdxList.reserve(I-getNumOperands()-1); ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/DwarfWriter.h
Changes in directory llvm/include/llvm/CodeGen: DwarfWriter.h updated: 1.8 - 1.9 --- Log message: Add frame work for additional dwarf sections. Comments will improve as code is added. --- Diffs of the changes: (+64 -0) DwarfWriter.h | 64 ++ 1 files changed, 64 insertions(+) Index: llvm/include/llvm/CodeGen/DwarfWriter.h diff -u llvm/include/llvm/CodeGen/DwarfWriter.h:1.8 llvm/include/llvm/CodeGen/DwarfWriter.h:1.9 --- llvm/include/llvm/CodeGen/DwarfWriter.h:1.8 Tue Jan 17 13:12:24 2006 +++ llvm/include/llvm/CodeGen/DwarfWriter.h Tue Jan 17 14:41:40 2006 @@ -744,6 +744,38 @@ /// const char *DwarfLineSection; /// Defaults to .debug_line. +/// DwarfFrameSection - Section directive for Dwarf info. +/// +const char *DwarfFrameSection; /// Defaults to .debug_frame. + +/// DwarfPubNamesSection - Section directive for Dwarf info. +/// +const char *DwarfPubNamesSection; /// Defaults to .debug_pubnames. + +/// DwarfPubTypesSection - Section directive for Dwarf info. +/// +const char *DwarfPubTypesSection; /// Defaults to .debug_pubtypes. + +/// DwarfStrSection - Section directive for Dwarf info. +/// +const char *DwarfStrSection; /// Defaults to .debug_str. + +/// DwarfLocSection - Section directive for Dwarf info. +/// +const char *DwarfLocSection; /// Defaults to .debug_loc. + +/// DwarfARangesSection - Section directive for Dwarf info. +/// +const char *DwarfARangesSection; /// Defaults to .debug_aranges. + +/// DwarfRangesSection - Section directive for Dwarf info. +/// +const char *DwarfRangesSection; /// Defaults to .debug_ranges. + +/// DwarfMacInfoSection - Section directive for Dwarf info. +/// +const char *DwarfMacInfoSection; /// Defaults to .debug_macinfo. + /// TextSection - Section directive for standard text. /// const char *TextSection; /// Defaults to .text. @@ -877,6 +909,38 @@ /// void EmitDebugLines() const; +/// EmitDebugFrame - Emit info into a debug frame section. +/// +void DwarfWriter::EmitDebugFrame(); + +/// EmitDebugPubNames - Emit info into a debug pubnames section. +/// +void DwarfWriter::EmitDebugPubNames(); + +/// EmitDebugPubTypes - Emit info into a debug pubtypes section. +/// +void DwarfWriter::EmitDebugPubTypes(); + +/// EmitDebugStr - Emit info into a debug str section. +/// +void DwarfWriter::EmitDebugStr(); + +/// EmitDebugLoc - Emit info into a debug loc section. +/// +void DwarfWriter::EmitDebugLoc(); + +/// EmitDebugARanges - Emit info into a debug aranges section. +/// +void DwarfWriter::EmitDebugARanges(); + +/// EmitDebugRanges - Emit info into a debug ranges section. +/// +void DwarfWriter::EmitDebugRanges(); + +/// EmitDebugMacInfo - Emit info into a debug macinfo section. +/// +void DwarfWriter::EmitDebugMacInfo(); + /// ShouldEmitDwarf - Returns true if Dwarf declarations should be made. /// When called it also checks to see if debug info is newly available. if /// so the initial Dwarf headers are emitted. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp
Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.6 - 1.7 --- Log message: Add frame work for additional dwarf sections. Comments will improve as code is added. --- Diffs of the changes: (+72 -0) DwarfWriter.cpp | 72 1 files changed, 72 insertions(+) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.6 llvm/lib/CodeGen/DwarfWriter.cpp:1.7 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.6Tue Jan 17 11:31:53 2006 +++ llvm/lib/CodeGen/DwarfWriter.cppTue Jan 17 14:41:40 2006 @@ -1293,6 +1293,46 @@ EmitLabel(line_end, 0); } + +/// EmitDebugFrame - Emit visible names into a debug frame section. +/// +void DwarfWriter::EmitDebugFrame() { +} + +/// EmitDebugPubNames - Emit visible names into a debug pubnames section. +/// +void DwarfWriter::EmitDebugPubNames() { +} + +/// EmitDebugPubTypes - Emit visible names into a debug pubtypes section. +/// +void DwarfWriter::EmitDebugPubTypes() { +} + +/// EmitDebugStr - Emit visible names into a debug str section. +/// +void DwarfWriter::EmitDebugStr() { +} + +/// EmitDebugLoc - Emit visible names into a debug loc section. +/// +void DwarfWriter::EmitDebugLoc() { +} + +/// EmitDebugARanges - Emit visible names into a debug aranges section. +/// +void DwarfWriter::EmitDebugARanges() { +} + +/// EmitDebugRanges - Emit visible names into a debug ranges section. +/// +void DwarfWriter::EmitDebugRanges() { +} + +/// EmitDebugMacInfo - Emit visible names into a debug macinfo section. +/// +void DwarfWriter::EmitDebugMacInfo() { +} /// ShouldEmitDwarf - Determine if Dwarf declarations should be made. /// @@ -1329,6 +1369,14 @@ , DwarfAbbrevSection(.debug_abbrev) , DwarfInfoSection(.debug_info) , DwarfLineSection(.debug_line) + , DwarfFrameSection(.debug_frame) + , DwarfPubNamesSection(.debug_pubnames) + , DwarfPubTypesSection(.debug_pubtypes) + , DwarfStrSection(.debug_str) + , DwarfLocSection(.debug_loc) + , DwarfARangesSection(.debug_aranges) + , DwarfRangesSection(.debug_ranges) + , DwarfMacInfoSection(.debug_macinfo) , TextSection(.text) , DataSection(.data) {} @@ -1377,6 +1425,30 @@ // Emit source line correspondence into a debug line section. EmitDebugLines(); + + // Emit info into a debug frame section. + EmitDebugFrame(); + + // Emit info into a debug pubnames section. + EmitDebugPubNames(); + + // Emit info into a debug pubtypes section. + EmitDebugPubTypes(); + + // Emit info into a debug str section. + EmitDebugStr(); + + // Emit info into a debug loc section. + EmitDebugLoc(); + + // Emit info into a debug aranges section. + EmitDebugARanges(); + + // Emit info into a debug ranges section. + EmitDebugRanges(); + + // Emit info into a debug macinfo section. + EmitDebugMacInfo(); } /// BeginFunction - Emit pre-function debug information. ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/include/llvm/CodeGen/DwarfWriter.h
Changes in directory llvm/include/llvm/CodeGen: DwarfWriter.h updated: 1.9 - 1.10 --- Log message: Pastos. --- Diffs of the changes: (+9 -9) DwarfWriter.h | 18 +- 1 files changed, 9 insertions(+), 9 deletions(-) Index: llvm/include/llvm/CodeGen/DwarfWriter.h diff -u llvm/include/llvm/CodeGen/DwarfWriter.h:1.9 llvm/include/llvm/CodeGen/DwarfWriter.h:1.10 --- llvm/include/llvm/CodeGen/DwarfWriter.h:1.9 Tue Jan 17 14:41:40 2006 +++ llvm/include/llvm/CodeGen/DwarfWriter.h Tue Jan 17 15:39:39 2006 @@ -839,7 +839,7 @@ /// EmitString - Emit a string with quotes and a null terminator. /// Special characters are emitted properly. (Eg. '\t') -void DwarfWriter::EmitString(const std::string String) const; +void EmitString(const std::string String) const; /// PrintLabelName - Print label name in form used by Dwarf writer. /// @@ -911,35 +911,35 @@ /// EmitDebugFrame - Emit info into a debug frame section. /// -void DwarfWriter::EmitDebugFrame(); +void EmitDebugFrame(); /// EmitDebugPubNames - Emit info into a debug pubnames section. /// -void DwarfWriter::EmitDebugPubNames(); +void EmitDebugPubNames(); /// EmitDebugPubTypes - Emit info into a debug pubtypes section. /// -void DwarfWriter::EmitDebugPubTypes(); +void EmitDebugPubTypes(); /// EmitDebugStr - Emit info into a debug str section. /// -void DwarfWriter::EmitDebugStr(); +void EmitDebugStr(); /// EmitDebugLoc - Emit info into a debug loc section. /// -void DwarfWriter::EmitDebugLoc(); +void EmitDebugLoc(); /// EmitDebugARanges - Emit info into a debug aranges section. /// -void DwarfWriter::EmitDebugARanges(); +void EmitDebugARanges(); /// EmitDebugRanges - Emit info into a debug ranges section. /// -void DwarfWriter::EmitDebugRanges(); +void EmitDebugRanges(); /// EmitDebugMacInfo - Emit info into a debug macinfo section. /// -void DwarfWriter::EmitDebugMacInfo(); +void EmitDebugMacInfo(); /// ShouldEmitDwarf - Returns true if Dwarf declarations should be made. /// When called it also checks to see if debug info is newly available. if ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp
Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.46 - 1.47 --- Log message: Fix lowering of calls which return f32 values. --- Diffs of the changes: (+12 -0) X86ISelLowering.cpp | 12 1 files changed, 12 insertions(+) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.46 llvm/lib/Target/X86/X86ISelLowering.cpp:1.47 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.46Mon Jan 16 20:32:49 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue Jan 17 15:58:21 2006 @@ -548,6 +548,7 @@ Chain = Hi.getValue(1); break; } + case MVT::f32: case MVT::f64: { std::vectorMVT::ValueType Tys; Tys.push_back(MVT::f64); @@ -580,6 +581,11 @@ DAG.getSrcValue(NULL)); Chain = RetVal.getValue(1); } + +if (RetTyVT == MVT::f32 !X86ScalarSSE) + // FIXME: we would really like to remember that this FP_ROUND + // operation is okay to eliminate if we allow excess FP precision. + RetVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, RetVal); break; } } @@ -1068,6 +1074,7 @@ Chain = Hi.getValue(1); break; } + case MVT::f32: case MVT::f64: { std::vectorMVT::ValueType Tys; Tys.push_back(MVT::f64); @@ -1100,6 +1107,11 @@ DAG.getSrcValue(NULL)); Chain = RetVal.getValue(1); } + +if (RetTyVT == MVT::f32 !X86ScalarSSE) + // FIXME: we would really like to remember that this FP_ROUND + // operation is okay to eliminate if we allow excess FP precision. + RetVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, RetVal); break; } } ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
[llvm-commits] CVS: llvm/lib/Linker/Linker.cpp
Changes in directory llvm/lib/Linker: Linker.cpp updated: 1.9 - 1.10 --- Log message: Fixed style of curly brace. No functionality changes. --- Diffs of the changes: (+1 -2) Linker.cpp |3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Linker/Linker.cpp diff -u llvm/lib/Linker/Linker.cpp:1.9 llvm/lib/Linker/Linker.cpp:1.10 --- llvm/lib/Linker/Linker.cpp:1.9 Mon Jan 9 21:12:29 2006 +++ llvm/lib/Linker/Linker.cpp Tue Jan 17 16:01:57 2006 @@ -157,8 +157,7 @@ /// Path if no matching file can be found. /// sys::Path -Linker::FindLib(const std::string Filename) -{ +Linker::FindLib(const std::string Filename) { // Determine if the pathname can be found as it stands. sys::Path FilePath(Filename); if (FilePath.canRead() ___ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits