From 824598883513789516a919651f4b35e7a638ec5c Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 26 Aug 2009 05:01:18 +0000 Subject: Revert 79977. It causes llvm-gcc bootstrap failures on some platforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80073 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Analysis/DebugInfo.h | 111 ++++++++++++++++--------------- include/llvm/AutoUpgrade.h | 4 -- include/llvm/CodeGen/DwarfWriter.h | 8 +-- include/llvm/CodeGen/MachineFunction.h | 2 +- include/llvm/CodeGen/SelectionDAG.h | 2 +- include/llvm/CodeGen/SelectionDAGNodes.h | 6 +- include/llvm/IntrinsicInst.h | 13 ++-- include/llvm/Intrinsics.td | 11 ++- include/llvm/Metadata.h | 1 + include/llvm/Support/DebugLoc.h | 12 ++-- 10 files changed, 84 insertions(+), 86 deletions(-) (limited to 'include/llvm') diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h index 9f90f64..c0721d3 100644 --- a/include/llvm/Analysis/DebugInfo.h +++ b/include/llvm/Analysis/DebugInfo.h @@ -17,7 +17,6 @@ #ifndef LLVM_ANALYSIS_DEBUGINFO_H #define LLVM_ANALYSIS_DEBUGINFO_H -#include "llvm/Metadata.h" #include "llvm/Target/TargetMachine.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/DenseMap.h" @@ -45,12 +44,12 @@ namespace llvm { class DIDescriptor { protected: - MDNode *DbgNode; + GlobalVariable *DbgGV; - /// DIDescriptor constructor. If the specified node is non-null, check + /// DIDescriptor constructor. If the specified GV is non-null, this checks /// to make sure that the tag in the descriptor matches 'RequiredTag'. If /// not, the debug info is corrupt and we ignore it. - DIDescriptor(MDNode *N, unsigned RequiredTag); + DIDescriptor(GlobalVariable *GV, unsigned RequiredTag); const std::string &getStringField(unsigned Elt, std::string &Result) const; unsigned getUnsignedField(unsigned Elt) const { @@ -61,18 +60,18 @@ namespace llvm { template DescTy getFieldAs(unsigned Elt) const { - return DescTy(getDescriptorField(Elt).getNode()); + return DescTy(getDescriptorField(Elt).getGV()); } GlobalVariable *getGlobalVariableField(unsigned Elt) const; public: - explicit DIDescriptor() : DbgNode(0) {} - explicit DIDescriptor(MDNode *N) : DbgNode(N) {} + explicit DIDescriptor() : DbgGV(0) {} + explicit DIDescriptor(GlobalVariable *GV) : DbgGV(GV) {} - bool isNull() const { return DbgNode == 0; } + bool isNull() const { return DbgGV == 0; } - MDNode *getNode() const { return DbgNode; } + GlobalVariable *getGV() const { return DbgGV; } unsigned getVersion() const { return getUnsignedField(0) & LLVMDebugVersionMask; @@ -82,8 +81,8 @@ namespace llvm { return getUnsignedField(0) & ~LLVMDebugVersionMask; } - /// ValidDebugInfo - Return true if N represents valid debug info value. - static bool ValidDebugInfo(MDNode *N, CodeGenOpt::Level OptLevel); + /// ValidDebugInfo - Return true if V represents valid debug info value. + static bool ValidDebugInfo(Value *V, CodeGenOpt::Level OptLevel); /// dump - print descriptor. void dump() const; @@ -92,8 +91,8 @@ namespace llvm { /// DISubrange - This is used to represent ranges, for array bounds. class DISubrange : public DIDescriptor { public: - explicit DISubrange(MDNode *N = 0) - : DIDescriptor(N, dwarf::DW_TAG_subrange_type) {} + explicit DISubrange(GlobalVariable *GV = 0) + : DIDescriptor(GV, dwarf::DW_TAG_subrange_type) {} int64_t getLo() const { return (int64_t)getUInt64Field(1); } int64_t getHi() const { return (int64_t)getUInt64Field(2); } @@ -102,8 +101,7 @@ namespace llvm { /// DIArray - This descriptor holds an array of descriptors. class DIArray : public DIDescriptor { public: - explicit DIArray(MDNode *N = 0) - : DIDescriptor(N) {} + explicit DIArray(GlobalVariable *GV = 0) : DIDescriptor(GV) {} unsigned getNumElements() const; DIDescriptor getElement(unsigned Idx) const { @@ -114,8 +112,8 @@ namespace llvm { /// DICompileUnit - A wrapper for a compile unit. class DICompileUnit : public DIDescriptor { public: - explicit DICompileUnit(MDNode *N = 0) - : DIDescriptor(N, dwarf::DW_TAG_compile_unit) {} + explicit DICompileUnit(GlobalVariable *GV = 0) + : DIDescriptor(GV, dwarf::DW_TAG_compile_unit) {} unsigned getLanguage() const { return getUnsignedField(2); } const std::string &getFilename(std::string &F) const { @@ -156,8 +154,8 @@ namespace llvm { /// type/precision or a file/line pair for location info. class DIEnumerator : public DIDescriptor { public: - explicit DIEnumerator(MDNode *N = 0) - : DIDescriptor(N, dwarf::DW_TAG_enumerator) {} + explicit DIEnumerator(GlobalVariable *GV = 0) + : DIDescriptor(GV, dwarf::DW_TAG_enumerator) {} const std::string &getName(std::string &F) const { return getStringField(1, F); @@ -178,11 +176,10 @@ namespace llvm { }; protected: - DIType(MDNode *N, unsigned Tag) - : DIDescriptor(N, Tag) {} + DIType(GlobalVariable *GV, unsigned Tag) : DIDescriptor(GV, Tag) {} // This ctor is used when the Tag has already been validated by a derived // ctor. - DIType(MDNode *N, bool, bool) : DIDescriptor(N) {} + DIType(GlobalVariable *GV, bool, bool) : DIDescriptor(GV) {} public: /// isDerivedType - Return true if the specified tag is legal for @@ -202,7 +199,7 @@ namespace llvm { /// Verify - Verify that a type descriptor is well formed. bool Verify() const; public: - explicit DIType(MDNode *N); + explicit DIType(GlobalVariable *GV); explicit DIType() {} virtual ~DIType() {} @@ -238,8 +235,8 @@ namespace llvm { /// DIBasicType - A basic type, like 'int' or 'float'. class DIBasicType : public DIType { public: - explicit DIBasicType(MDNode *N = 0) - : DIType(N, dwarf::DW_TAG_base_type) {} + explicit DIBasicType(GlobalVariable *GV) + : DIType(GV, dwarf::DW_TAG_base_type) {} unsigned getEncoding() const { return getUnsignedField(9); } @@ -251,13 +248,13 @@ namespace llvm { /// a typedef, a pointer or reference, etc. class DIDerivedType : public DIType { protected: - explicit DIDerivedType(MDNode *N, bool, bool) - : DIType(N, true, true) {} + explicit DIDerivedType(GlobalVariable *GV, bool, bool) + : DIType(GV, true, true) {} public: - explicit DIDerivedType(MDNode *N = 0) - : DIType(N, true, true) { - if (DbgNode && !isDerivedType(getTag())) - DbgNode = 0; + explicit DIDerivedType(GlobalVariable *GV) + : DIType(GV, true, true) { + if (GV && !isDerivedType(getTag())) + DbgGV = 0; } DIType getTypeDerivedFrom() const { return getFieldAs(9); } @@ -279,10 +276,10 @@ namespace llvm { /// FIXME: Why is this a DIDerivedType?? class DICompositeType : public DIDerivedType { public: - explicit DICompositeType(MDNode *N = 0) - : DIDerivedType(N, true, true) { - if (N && !isCompositeType(getTag())) - DbgNode = 0; + explicit DICompositeType(GlobalVariable *GV) + : DIDerivedType(GV, true, true) { + if (GV && !isCompositeType(getTag())) + DbgGV = 0; } DIArray getTypeArray() const { return getFieldAs(10); } @@ -298,8 +295,8 @@ namespace llvm { /// DIGlobal - This is a common class for global variables and subprograms. class DIGlobal : public DIDescriptor { protected: - explicit DIGlobal(MDNode *N, unsigned RequiredTag) - : DIDescriptor(N, RequiredTag) {} + explicit DIGlobal(GlobalVariable *GV, unsigned RequiredTag) + : DIDescriptor(GV, RequiredTag) {} /// isSubprogram - Return true if the specified tag is legal for /// DISubprogram. @@ -342,8 +339,8 @@ namespace llvm { /// DISubprogram - This is a wrapper for a subprogram (e.g. a function). class DISubprogram : public DIGlobal { public: - explicit DISubprogram(MDNode *N = 0) - : DIGlobal(N, dwarf::DW_TAG_subprogram) {} + explicit DISubprogram(GlobalVariable *GV = 0) + : DIGlobal(GV, dwarf::DW_TAG_subprogram) {} DICompositeType getType() const { return getFieldAs(8); } @@ -353,7 +350,7 @@ namespace llvm { DICompositeType DCT(getFieldAs(8)); if (!DCT.isNull()) { DIArray A = DCT.getTypeArray(); - DIType T(A.getElement(0).getNode()); + DIType T(A.getElement(0).getGV()); return T.getName(F); } DIType T(getFieldAs(8)); @@ -374,8 +371,8 @@ namespace llvm { /// DIGlobalVariable - This is a wrapper for a global variable. class DIGlobalVariable : public DIGlobal { public: - explicit DIGlobalVariable(MDNode *N = 0) - : DIGlobal(N, dwarf::DW_TAG_variable) {} + explicit DIGlobalVariable(GlobalVariable *GV = 0) + : DIGlobal(GV, dwarf::DW_TAG_variable) {} GlobalVariable *getGlobal() const { return getGlobalVariableField(11); } @@ -390,10 +387,10 @@ namespace llvm { /// global etc). class DIVariable : public DIDescriptor { public: - explicit DIVariable(MDNode *N = 0) - : DIDescriptor(N) { - if (DbgNode && !isVariable(getTag())) - DbgNode = 0; + explicit DIVariable(GlobalVariable *GV = 0) + : DIDescriptor(GV) { + if (GV && !isVariable(getTag())) + DbgGV = 0; } DIDescriptor getContext() const { return getDescriptorField(1); } @@ -417,8 +414,8 @@ namespace llvm { /// DIBlock - This is a wrapper for a block (e.g. a function, scope, etc). class DIBlock : public DIDescriptor { public: - explicit DIBlock(MDNode *N = 0) - : DIDescriptor(N, dwarf::DW_TAG_lexical_block) {} + explicit DIBlock(GlobalVariable *GV = 0) + : DIDescriptor(GV, dwarf::DW_TAG_lexical_block) {} DIDescriptor getContext() const { return getDescriptorField(1); } }; @@ -545,6 +542,10 @@ namespace llvm { private: Constant *GetTagConstant(unsigned TAG); + Constant *GetStringConstant(const std::string &String); + + /// getCastToEmpty - Return the descriptor as a Constant* with type '{}*'. + Constant *getCastToEmpty(DIDescriptor D); }; /// Finds the stoppoint coressponding to this instruction, that is the @@ -606,6 +607,7 @@ namespace llvm { /// isInlinedFnEnd - Return true if REI is ending an inlined function. bool isInlinedFnEnd(DbgRegionEndInst &REI, const Function *CurrentFn); + /// DebugInfoFinder - This object collects DebugInfo from a module. class DebugInfoFinder { @@ -649,7 +651,7 @@ namespace llvm { bool addType(DIType DT); public: - typedef SmallVector::iterator iterator; + typedef SmallVector::iterator iterator; iterator compile_unit_begin() { return CUs.begin(); } iterator compile_unit_end() { return CUs.end(); } iterator subprogram_begin() { return SPs.begin(); } @@ -665,11 +667,12 @@ namespace llvm { unsigned type_count() { return TYs.size(); } private: - SmallVector CUs; // Compile Units - SmallVector SPs; // Subprograms - SmallVector GVs; // Global Variables; - SmallVector TYs; // Types - SmallPtrSet NodesSeen; + SmallVector CUs; // Compile Units + SmallVector SPs; // Subprograms + SmallVector GVs; // Global Variables + SmallVector TYs; // Types + SmallPtrSet NodesSeen; + }; } // end namespace llvm diff --git a/include/llvm/AutoUpgrade.h b/include/llvm/AutoUpgrade.h index 0a81c80..f61bd1a 100644 --- a/include/llvm/AutoUpgrade.h +++ b/include/llvm/AutoUpgrade.h @@ -15,7 +15,6 @@ #define LLVM_AUTOUPGRADE_H namespace llvm { - class Module; class Function; class CallInst; @@ -35,9 +34,6 @@ namespace llvm { /// so that it can update all calls to the old function. void UpgradeCallsToIntrinsic(Function* F); - /// This function checks debug info intrinsics. If an intrinsic is invalid - /// then this function simply removes the intrinsic. - void CheckDebugInfoIntrinsics(Module *M); } // End llvm namespace #endif diff --git a/include/llvm/CodeGen/DwarfWriter.h b/include/llvm/CodeGen/DwarfWriter.h index 3635c4d..9ae7668 100644 --- a/include/llvm/CodeGen/DwarfWriter.h +++ b/include/llvm/CodeGen/DwarfWriter.h @@ -33,7 +33,7 @@ class MachineFunction; class MachineInstr; class Value; class Module; -class MDNode; +class GlobalVariable; class MCAsmInfo; class raw_ostream; class Instruction; @@ -88,17 +88,17 @@ public: unsigned RecordSourceLine(unsigned Line, unsigned Col, DICompileUnit CU); /// RecordRegionStart - Indicate the start of a region. - unsigned RecordRegionStart(MDNode *N); + unsigned RecordRegionStart(GlobalVariable *V); /// RecordRegionEnd - Indicate the end of a region. - unsigned RecordRegionEnd(MDNode *N); + unsigned RecordRegionEnd(GlobalVariable *V); /// getRecordSourceLineCount - Count source lines. unsigned getRecordSourceLineCount(); /// RecordVariable - Indicate the declaration of a local variable. /// - void RecordVariable(MDNode *N, unsigned FrameIndex); + void RecordVariable(GlobalVariable *GV, unsigned FrameIndex); /// ShouldEmitDwarfDebug - Returns true if Dwarf debugging declarations should /// be emitted. diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h index 5fca29f..92f46b0 100644 --- a/include/llvm/CodeGen/MachineFunction.h +++ b/include/llvm/CodeGen/MachineFunction.h @@ -327,7 +327,7 @@ public: /// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given /// source file, line, and column. If none currently exists, create a new /// DebugLocTuple, and insert it into the DebugIdMap. - unsigned getOrCreateDebugLocID(MDNode *CompileUnit, + unsigned getOrCreateDebugLocID(GlobalVariable *CompileUnit, unsigned Line, unsigned Col); /// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object. diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index 1d3023b..b0fb5d8 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -322,7 +322,7 @@ public: SDValue getValueType(EVT); SDValue getRegister(unsigned Reg, EVT VT); SDValue getDbgStopPoint(DebugLoc DL, SDValue Root, - unsigned Line, unsigned Col, MDNode *CU); + unsigned Line, unsigned Col, Value *CU); SDValue getLabel(unsigned Opcode, DebugLoc dl, SDValue Root, unsigned LabelID); diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 0e656a2..a5fb08f 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -2015,10 +2015,10 @@ class DbgStopPointSDNode : public SDNode { SDUse Chain; unsigned Line; unsigned Column; - MDNode *CU; + Value *CU; friend class SelectionDAG; DbgStopPointSDNode(SDValue ch, unsigned l, unsigned c, - MDNode *cu) + Value *cu) : SDNode(ISD::DBG_STOPPOINT, DebugLoc::getUnknownLoc(), getSDVTList(MVT::Other)), Line(l), Column(c), CU(cu) { InitOperands(&Chain, ch); @@ -2026,7 +2026,7 @@ class DbgStopPointSDNode : public SDNode { public: unsigned getLine() const { return Line; } unsigned getColumn() const { return Column; } - MDNode *getCompileUnit() const { return CU; } + Value *getCompileUnit() const { return CU; } static bool classof(const DbgStopPointSDNode *) { return true; } static bool classof(const SDNode *N) { diff --git a/include/llvm/IntrinsicInst.h b/include/llvm/IntrinsicInst.h index a502cc2..b848055 100644 --- a/include/llvm/IntrinsicInst.h +++ b/include/llvm/IntrinsicInst.h @@ -25,7 +25,6 @@ #define LLVM_INTRINSICINST_H #include "llvm/Constants.h" -#include "llvm/Metadata.h" #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/Intrinsics.h" @@ -86,8 +85,8 @@ namespace llvm { struct DbgStopPointInst : public DbgInfoIntrinsic { Value *getLineValue() const { return const_cast(getOperand(1)); } Value *getColumnValue() const { return const_cast(getOperand(2)); } - MDNode *getContext() const { - return cast(getOperand(3)); + Value *getContext() const { + return StripCast(getOperand(3)); } unsigned getLine() const { @@ -113,7 +112,7 @@ namespace llvm { /// DbgFuncStartInst - This represents the llvm.dbg.func.start instruction. /// struct DbgFuncStartInst : public DbgInfoIntrinsic { - MDNode *getSubprogram() const { return cast(getOperand(1)); } + Value *getSubprogram() const { return StripCast(getOperand(1)); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const DbgFuncStartInst *) { return true; } @@ -128,7 +127,7 @@ namespace llvm { /// DbgRegionStartInst - This represents the llvm.dbg.region.start /// instruction. struct DbgRegionStartInst : public DbgInfoIntrinsic { - MDNode *getContext() const { return cast(getOperand(1)); } + Value *getContext() const { return StripCast(getOperand(1)); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const DbgRegionStartInst *) { return true; } @@ -143,7 +142,7 @@ namespace llvm { /// DbgRegionEndInst - This represents the llvm.dbg.region.end instruction. /// struct DbgRegionEndInst : public DbgInfoIntrinsic { - MDNode *getContext() const { return cast(getOperand(1)); } + Value *getContext() const { return StripCast(getOperand(1)); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const DbgRegionEndInst *) { return true; } @@ -159,7 +158,7 @@ namespace llvm { /// struct DbgDeclareInst : public DbgInfoIntrinsic { Value *getAddress() const { return getOperand(1); } - MDNode *getVariable() const { return cast(getOperand(2)); } + Value *getVariable() const { return StripCast(getOperand(2)); } // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const DbgDeclareInst *) { return true; } diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td index 9b0c876..552254f 100644 --- a/include/llvm/Intrinsics.td +++ b/include/llvm/Intrinsics.td @@ -110,7 +110,6 @@ def llvm_ptrptr_ty : LLVMPointerType; // i8** def llvm_anyptr_ty : LLVMAnyPointerType; // (space)i8* def llvm_empty_ty : LLVMType; // { } def llvm_descriptor_ty : LLVMPointerType; // { }* -def llvm_metadata_ty : LLVMType; // !{...} def llvm_v2i8_ty : LLVMType; // 2 x i8 def llvm_v4i8_ty : LLVMType; // 4 x i8 @@ -279,12 +278,12 @@ let Properties = [IntrNoMem] in { let Properties = [IntrNoMem] in { def int_dbg_stoppoint : Intrinsic<[llvm_void_ty], [llvm_i32_ty, llvm_i32_ty, - llvm_metadata_ty]>; - def int_dbg_region_start : Intrinsic<[llvm_void_ty], [llvm_metadata_ty]>; - def int_dbg_region_end : Intrinsic<[llvm_void_ty], [llvm_metadata_ty]>; - def int_dbg_func_start : Intrinsic<[llvm_void_ty], [llvm_metadata_ty]>; + llvm_descriptor_ty]>; + def int_dbg_region_start : Intrinsic<[llvm_void_ty], [llvm_descriptor_ty]>; + def int_dbg_region_end : Intrinsic<[llvm_void_ty], [llvm_descriptor_ty]>; + def int_dbg_func_start : Intrinsic<[llvm_void_ty], [llvm_descriptor_ty]>; def int_dbg_declare : Intrinsic<[llvm_void_ty], - [llvm_descriptor_ty, llvm_metadata_ty]>; + [llvm_descriptor_ty, llvm_descriptor_ty]>; } //===------------------ Exception Handling Intrinsics----------------------===// diff --git a/include/llvm/Metadata.h b/include/llvm/Metadata.h index b38336b..f36de68 100644 --- a/include/llvm/Metadata.h +++ b/include/llvm/Metadata.h @@ -110,6 +110,7 @@ class MDNode : public MetadataBase { unsigned getNumOperands() { return User::getNumOperands(); } SmallVector Node; + friend struct ConstantCreator >; protected: explicit MDNode(LLVMContext &C, Value*const* Vals, unsigned NumVals); diff --git a/include/llvm/Support/DebugLoc.h b/include/llvm/Support/DebugLoc.h index 0bfad7c..8ef7e4a 100644 --- a/include/llvm/Support/DebugLoc.h +++ b/include/llvm/Support/DebugLoc.h @@ -19,19 +19,19 @@ #include namespace llvm { - class MDNode; + class GlobalVariable; /// DebugLocTuple - Debug location tuple of filename id, line and column. /// struct DebugLocTuple { - MDNode *CompileUnit; + GlobalVariable *CompileUnit; unsigned Line, Col; DebugLocTuple() : CompileUnit(0), Line(~0U), Col(~0U) {}; - DebugLocTuple(MDNode *n, unsigned l, unsigned c) - : CompileUnit(n), Line(l), Col(c) {}; + DebugLocTuple(GlobalVariable *v, unsigned l, unsigned c) + : CompileUnit(v), Line(l), Col(c) {}; bool operator==(const DebugLocTuple &DLT) const { return CompileUnit == DLT.CompileUnit && @@ -69,10 +69,10 @@ namespace llvm { return DebugLocTuple(0, ~0U, ~0U); } static inline DebugLocTuple getTombstoneKey() { - return DebugLocTuple((MDNode*)~1U, ~1U, ~1U); + return DebugLocTuple((GlobalVariable*)~1U, ~1U, ~1U); } static unsigned getHashValue(const DebugLocTuple &Val) { - return DenseMapInfo::getHashValue(Val.CompileUnit) ^ + return DenseMapInfo::getHashValue(Val.CompileUnit) ^ DenseMapInfo::getHashValue(Val.Line) ^ DenseMapInfo::getHashValue(Val.Col); } -- cgit v1.1