diff options
author | Devang Patel <dpatel@apple.com> | 2009-01-23 22:33:47 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-01-23 22:33:47 +0000 |
commit | 3b64c6bc2916bc62a99ef8a2995a426d994e1a04 (patch) | |
tree | cc7d737ff28292510cd2195c01a8d164017363ae /lib | |
parent | 91387de8cece07e871e02148d62fd3f17d831cad (diff) | |
download | external_llvm-3b64c6bc2916bc62a99ef8a2995a426d994e1a04.zip external_llvm-3b64c6bc2916bc62a99ef8a2995a426d994e1a04.tar.gz external_llvm-3b64c6bc2916bc62a99ef8a2995a426d994e1a04.tar.bz2 |
Introduce two DWARF attribute extentions DW_AT_APPLE_optimized, DW_AT_APPLE_flags.
DW_AT_APPLE_optimized flag is set when a compile_unit is optimized. The debugger takes advantage of this information some way.
DW_AT_APPLE_flags encodes command line options when certain env. variable is set. This is used by build engineers to track various gcc command lines used by by a project, irrespective of whether the project used makefile, Xcode or something else.
llvm-gcc patch is next.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62888 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 8 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfWriter.cpp | 5 | ||||
-rw-r--r-- | lib/Support/Dwarf.cpp | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 34ccd0a..2f33657 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -440,14 +440,18 @@ DISubrange DIFactory::GetOrCreateSubrange(int64_t Lo, int64_t Hi) { DICompileUnit DIFactory::CreateCompileUnit(unsigned LangID, const std::string &Filename, const std::string &Directory, - const std::string &Producer) { + const std::string &Producer, + bool isOptimized, + const char *Flags) { Constant *Elts[] = { GetTagConstant(dwarf::DW_TAG_compile_unit), getCastToEmpty(GetOrCreateCompileUnitAnchor()), ConstantInt::get(Type::Int32Ty, LangID), GetStringConstant(Filename), GetStringConstant(Directory), - GetStringConstant(Producer) + GetStringConstant(Producer), + ConstantInt::get(Type::Int1Ty, isOptimized), + GetStringConstant(Flags) }; Constant *Init = ConstantStruct::get(Elts, sizeof(Elts)/sizeof(Elts[0])); diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp index 6bbb5bb..4b19d06 100644 --- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp @@ -2781,6 +2781,11 @@ private: AddString(Die, DW_AT_name, DW_FORM_string, DIUnit.getFilename()); if (!DIUnit.getDirectory().empty()) AddString(Die, DW_AT_comp_dir, DW_FORM_string, DIUnit.getDirectory()); + if (DIUnit.isOptimized()) + AddUInt(Die, DW_AT_APPLE_optimized, DW_FORM_flag, 1); + const std::string &Flags = DIUnit.getFlags(); + if (!Flags.empty()) + AddString(Die, DW_AT_APPLE_flags, DW_FORM_string, Flags); CompileUnit *Unit = new CompileUnit(ID, Die); DW_CUs[DIUnit.getGV()] = Unit; diff --git a/lib/Support/Dwarf.cpp b/lib/Support/Dwarf.cpp index b7cf3b9..10a2c3c 100644 --- a/lib/Support/Dwarf.cpp +++ b/lib/Support/Dwarf.cpp @@ -198,6 +198,8 @@ const char *AttributeString(unsigned Attribute) { case DW_AT_GNU_vector: return "DW_AT_GNU_vector"; case DW_AT_lo_user: return "DW_AT_lo_user"; case DW_AT_hi_user: return "DW_AT_hi_user"; + case DW_AT_APPLE_optimized: return "DW_AT_APPLE_optimized"; + case DW_AT_APPLE_flags: return "DW_AT_APPLE_flags"; } assert(0 && "Unknown Dwarf Attribute"); return ""; |