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 | ccfacfff9a707e283e208a3d5295557cc060ac36 (patch) | |
| tree | e711de52ac95930fe24aefb4fe27dee63aac9b2f | |
| parent | 832959536a6471eef3bee0bd4774b49ac76d46eb (diff) | |
| download | bcm5719-llvm-ccfacfff9a707e283e208a3d5295557cc060ac36.tar.gz bcm5719-llvm-ccfacfff9a707e283e208a3d5295557cc060ac36.zip  | |
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.
llvm-svn: 62888
| -rw-r--r-- | llvm/include/llvm/Analysis/DebugInfo.h | 6 | ||||
| -rw-r--r-- | llvm/include/llvm/Support/Dwarf.h | 6 | ||||
| -rw-r--r-- | llvm/lib/Analysis/DebugInfo.cpp | 8 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/Support/Dwarf.cpp | 2 | 
5 files changed, 23 insertions, 4 deletions
diff --git a/llvm/include/llvm/Analysis/DebugInfo.h b/llvm/include/llvm/Analysis/DebugInfo.h index 63206ea6fca..c80a11d3b32 100644 --- a/llvm/include/llvm/Analysis/DebugInfo.h +++ b/llvm/include/llvm/Analysis/DebugInfo.h @@ -109,6 +109,8 @@ namespace llvm {      std::string getFilename() const  { return getStringField(3); }      std::string getDirectory() const { return getStringField(4); }      std::string getProducer() const  { return getStringField(5); } +    bool isOptimized() const         { return getUnsignedField(6); } +    std::string getFlags() const     { return getStringField(7); }      /// Verify - Verify that a compile unit is well formed.      bool Verify() const; @@ -372,7 +374,9 @@ namespace llvm {      DICompileUnit CreateCompileUnit(unsigned LangID,                                      const std::string &Filename,                                      const std::string &Directory, -                                    const std::string &Producer); +                                    const std::string &Producer, +                                    bool isOptimized = false, +                                    const char *Flags = "");      /// CreateEnumerator - Create a single enumerator value.      DIEnumerator CreateEnumerator(const std::string &Name, uint64_t Val); diff --git a/llvm/include/llvm/Support/Dwarf.h b/llvm/include/llvm/Support/Dwarf.h index 23ab9bf29e5..c24274354cf 100644 --- a/llvm/include/llvm/Support/Dwarf.h +++ b/llvm/include/llvm/Support/Dwarf.h @@ -221,7 +221,11 @@ enum dwarf_constants {    DW_AT_GNU_vector = 0x2107,    DW_AT_lo_user = 0x2000,    DW_AT_hi_user = 0x3fff, -  + +  // Apple extensions. +  DW_AT_APPLE_optimized = 0x3fe1, +  DW_AT_APPLE_flags = 0x3fe2, +    // Attribute form encodings    DW_FORM_addr = 0x01,    DW_FORM_block2 = 0x03, diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp index 34ccd0a97cf..2f336572a1d 100644 --- a/llvm/lib/Analysis/DebugInfo.cpp +++ b/llvm/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/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp index 6bbb5bb9b76..4b19d06c924 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp +++ b/llvm/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/llvm/lib/Support/Dwarf.cpp b/llvm/lib/Support/Dwarf.cpp index b7cf3b977ab..10a2c3c64f8 100644 --- a/llvm/lib/Support/Dwarf.cpp +++ b/llvm/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 "";  | 

