1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Revert "Remove DIBuilder cache of variable TheCU and change the few"

This reverts commit r186599 as I didn't want to commit this yet.

llvm-svn: 186601
This commit is contained in:
Eric Christopher 2013-07-18 19:13:06 +00:00
parent 7365a26bba
commit 1a3914a23a
3 changed files with 23 additions and 27 deletions

View File

@ -29,7 +29,6 @@ namespace llvm {
class MDNode; class MDNode;
class StringRef; class StringRef;
class DIBasicType; class DIBasicType;
class DICompileUnit;
class DICompositeType; class DICompositeType;
class DIDerivedType; class DIDerivedType;
class DIDescriptor; class DIDescriptor;
@ -54,6 +53,7 @@ namespace llvm {
private: private:
Module &M; Module &M;
LLVMContext & VMContext; LLVMContext & VMContext;
MDNode *TheCU;
MDNode *TempEnumTypes; MDNode *TempEnumTypes;
MDNode *TempRetainTypes; MDNode *TempRetainTypes;
@ -81,6 +81,7 @@ namespace llvm {
public: public:
explicit DIBuilder(Module &M); explicit DIBuilder(Module &M);
const MDNode *getCU() { return TheCU; }
enum ComplexAddrKind { OpPlus=1, OpDeref }; enum ComplexAddrKind { OpPlus=1, OpDeref };
/// finalize - Construct any deferred debug info descriptors. /// finalize - Construct any deferred debug info descriptors.
@ -102,11 +103,10 @@ namespace llvm {
/// Objective-C. /// Objective-C.
/// @param SplitName The name of the file that we'll split debug info out /// @param SplitName The name of the file that we'll split debug info out
/// into. /// into.
DICompileUnit createCompileUnit(unsigned Lang, StringRef File, void createCompileUnit(unsigned Lang, StringRef File, StringRef Dir,
StringRef Dir, StringRef Producer, StringRef Producer, bool isOptimized,
bool isOptimized, StringRef Flags, StringRef Flags, unsigned RV,
unsigned RV, StringRef SplitName = StringRef());
StringRef SplitName = StringRef());
/// createFile - Create a file descriptor to hold debugging information /// createFile - Create a file descriptor to hold debugging information
/// for a file. /// for a file.

View File

@ -30,7 +30,7 @@ static Constant *GetTagConstant(LLVMContext &VMContext, unsigned Tag) {
} }
DIBuilder::DIBuilder(Module &m) DIBuilder::DIBuilder(Module &m)
: M(m), VMContext(M.getContext()), TempEnumTypes(0), : M(m), VMContext(M.getContext()), TheCU(0), TempEnumTypes(0),
TempRetainTypes(0), TempSubprograms(0), TempGVs(0), DeclareFn(0), TempRetainTypes(0), TempSubprograms(0), TempGVs(0), DeclareFn(0),
ValueFn(0) ValueFn(0)
{} {}
@ -86,11 +86,10 @@ static MDNode *createFilePathPair(LLVMContext &VMContext, StringRef Filename,
/// createCompileUnit - A CompileUnit provides an anchor for all debugging /// createCompileUnit - A CompileUnit provides an anchor for all debugging
/// information generated during this instance of compilation. /// information generated during this instance of compilation.
DICompileUnit DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename, void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
StringRef Directory, StringRef Directory, StringRef Producer,
StringRef Producer, bool isOptimized, bool isOptimized, StringRef Flags,
StringRef Flags, unsigned RunTimeVer, unsigned RunTimeVer, StringRef SplitName) {
StringRef SplitName) {
assert(((Lang <= dwarf::DW_LANG_Python && Lang >= dwarf::DW_LANG_C89) || assert(((Lang <= dwarf::DW_LANG_Python && Lang >= dwarf::DW_LANG_C89) ||
(Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) && (Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
"Invalid Language tag"); "Invalid Language tag");
@ -122,14 +121,11 @@ DICompileUnit DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
TempImportedModules, TempImportedModules,
MDString::get(VMContext, SplitName) MDString::get(VMContext, SplitName)
}; };
TheCU = DICompileUnit(MDNode::get(VMContext, Elts));
MDNode *CUNode = MDNode::get(VMContext, Elts);
// Create a named metadata so that it is easier to find cu in a module. // Create a named metadata so that it is easier to find cu in a module.
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu"); NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
NMD->addOperand(CUNode); NMD->addOperand(TheCU);
return DICompileUnit(CUNode);
} }
static DIImportedEntity static DIImportedEntity
@ -220,7 +216,7 @@ DIBasicType DIBuilder::createUnspecifiedType(StringRef Name) {
Value *Elts[] = { Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_unspecified_type), GetTagConstant(VMContext, dwarf::DW_TAG_unspecified_type),
NULL, // Filename NULL, // Filename
NULL, // Unused NULL, //TheCU,
MDString::get(VMContext, Name), MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
@ -248,7 +244,7 @@ DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
Value *Elts[] = { Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_base_type), GetTagConstant(VMContext, dwarf::DW_TAG_base_type),
NULL, // File/directory name NULL, // File/directory name
NULL, // Unused NULL, //TheCU,
MDString::get(VMContext, Name), MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits), ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
@ -267,7 +263,7 @@ DIDerivedType DIBuilder::createQualifiedType(unsigned Tag, DIType FromTy) {
Value *Elts[] = { Value *Elts[] = {
GetTagConstant(VMContext, Tag), GetTagConstant(VMContext, Tag),
NULL, // Filename NULL, // Filename
NULL, // Unused NULL, //TheCU,
MDString::get(VMContext, StringRef()), // Empty name. MDString::get(VMContext, StringRef()), // Empty name.
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
@ -287,7 +283,7 @@ DIBuilder::createPointerType(DIType PointeeTy, uint64_t SizeInBits,
Value *Elts[] = { Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_pointer_type), GetTagConstant(VMContext, dwarf::DW_TAG_pointer_type),
NULL, // Filename NULL, // Filename
NULL, // Unused NULL, //TheCU,
MDString::get(VMContext, Name), MDString::get(VMContext, Name),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits), ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
@ -305,7 +301,7 @@ DIDerivedType DIBuilder::createMemberPointerType(DIType PointeeTy,
Value *Elts[] = { Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_ptr_to_member_type), GetTagConstant(VMContext, dwarf::DW_TAG_ptr_to_member_type),
NULL, // Filename NULL, // Filename
NULL, // Unused NULL, //TheCU,
NULL, NULL,
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
ConstantInt::get(Type::getInt64Ty(VMContext), 0), ConstantInt::get(Type::getInt64Ty(VMContext), 0),
@ -741,7 +737,7 @@ DICompositeType DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
Value *Elts[] = { Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_array_type), GetTagConstant(VMContext, dwarf::DW_TAG_array_type),
NULL, // Filename/Directory, NULL, // Filename/Directory,
NULL, // Unused NULL, //TheCU,
MDString::get(VMContext, ""), MDString::get(VMContext, ""),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), ConstantInt::get(Type::getInt32Ty(VMContext), 0),
ConstantInt::get(Type::getInt64Ty(VMContext), Size), ConstantInt::get(Type::getInt64Ty(VMContext), Size),
@ -764,7 +760,7 @@ DICompositeType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits,
Value *Elts[] = { Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_array_type), GetTagConstant(VMContext, dwarf::DW_TAG_array_type),
NULL, // Filename/Directory, NULL, // Filename/Directory,
NULL, // Unused NULL, //TheCU,
MDString::get(VMContext, ""), MDString::get(VMContext, ""),
ConstantInt::get(Type::getInt32Ty(VMContext), 0), ConstantInt::get(Type::getInt32Ty(VMContext), 0),
ConstantInt::get(Type::getInt64Ty(VMContext), Size), ConstantInt::get(Type::getInt64Ty(VMContext), Size),

View File

@ -289,9 +289,9 @@ private:
"LLVM Version " STR(LLVM_VERSION_MAJOR) "." STR(LLVM_VERSION_MINOR); "LLVM Version " STR(LLVM_VERSION_MAJOR) "." STR(LLVM_VERSION_MINOR);
} }
CUNode = Builder.createCompileUnit(dwarf::DW_LANG_C99, Filename, Directory, Producer,
Builder.createCompileUnit(dwarf::DW_LANG_C99, Filename, Directory, IsOptimized, Flags, RuntimeVersion);
Producer, IsOptimized, Flags, RuntimeVersion); CUNode = Builder.getCU();
if (CUToReplace) if (CUToReplace)
CUToReplace->replaceAllUsesWith(const_cast<MDNode *>(CUNode)); CUToReplace->replaceAllUsesWith(const_cast<MDNode *>(CUNode));