- //===------------------------------------------------------------------===//
- // Core attributes used by the Dwarf writer.
- //
-
- //
- /// O - Stream to .s file.
- ///
- std::ostream &O;
-
- /// Asm - Target of Dwarf emission.
- ///
- AsmPrinter *Asm;
-
- /// DebugInfo - Collected debug information.
- ///
- MachineDebugInfo *DebugInfo;
-
- /// didInitial - Flag to indicate if initial emission has been done.
- ///
- bool didInitial;
-
- //===------------------------------------------------------------------===//
- // Attributes used to construct specific Dwarf sections.
- //
-
- /// CompileUnits - All the compile units involved in this build. The index
- /// of each entry in this vector corresponds to the sources in DebugInfo.
- std::vector<DIE *> CompileUnits;
-
- /// Abbreviations - A UniqueVector of TAG structure abbreviations.
- ///
- UniqueVector<DIEAbbrev> Abbreviations;
-
- /// GlobalTypes - A map of globally visible named types.
- ///
- std::map<std::string, DIE *> GlobalTypes;
-
- /// GlobalEntities - A map of globally visible named entities.
- ///
- std::map<std::string, DIE *> GlobalEntities;
-
- /// StringPool - A UniqueVector of strings used by indirect references.
- ///
- UniqueVector<std::string> StringPool;
-
- //===------------------------------------------------------------------===//
- // Properties to be set by the derived class ctor, used to configure the
- // Dwarf writer.
- //
-
- /// AddressSize - Size of addresses used in file.
- ///
- unsigned AddressSize;
-
- /// hasLEB128 - True if target asm supports leb128 directives.
- ///
- bool hasLEB128; /// Defaults to false.
-
- /// hasDotLoc - True if target asm supports .loc directives.
- ///
- bool hasDotLoc; /// Defaults to false.
-
- /// hasDotFile - True if target asm supports .file directives.
- ///
- bool hasDotFile; /// Defaults to false.
-
- /// needsSet - True if target asm can't compute addresses on data
- /// directives.
- bool needsSet; /// Defaults to false.
-
- /// DwarfAbbrevSection - Section directive for Dwarf abbrev.
- ///
- const char *DwarfAbbrevSection; /// Defaults to ".debug_abbrev".
-
- /// DwarfInfoSection - Section directive for Dwarf info.
- ///
- const char *DwarfInfoSection; /// Defaults to ".debug_info".
-
- /// DwarfLineSection - Section directive for Dwarf info.
- ///
- 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".
-
- /// DataSection - Section directive for standard data.
- ///
- const char *DataSection; /// Defaults to ".data".
-
- //===------------------------------------------------------------------===//
- // Emission and print routines
- //
-
-public:
- /// getAddressSize - Return the size of a target address in bytes.
- ///
- unsigned getAddressSize() const { return AddressSize; }
-
- /// PrintHex - Print a value as a hexidecimal value.
- ///
- void PrintHex(int Value) const;
-
- /// EOL - Print a newline character to asm stream. If a comment is present
- /// then it will be printed first. Comments should not contain '\n'.
- void EOL(const std::string &Comment) const;
-
- /// EmitULEB128Bytes - Emit an assembler byte data directive to compose an
- /// unsigned leb128 value.
- void EmitULEB128Bytes(unsigned Value) const;
-
- /// EmitSLEB128Bytes - print an assembler byte data directive to compose a
- /// signed leb128 value.
- void EmitSLEB128Bytes(int Value) const;
-
- /// PrintULEB128 - Print a series of hexidecimal values (separated by
- /// commas) representing an unsigned leb128 value.
- void PrintULEB128(unsigned Value) const;
-
- /// SizeULEB128 - Compute the number of bytes required for an unsigned
- /// leb128 value.
- static unsigned SizeULEB128(unsigned Value);
-
- /// PrintSLEB128 - Print a series of hexidecimal values (separated by
- /// commas) representing a signed leb128 value.
- void PrintSLEB128(int Value) const;
-
- /// SizeSLEB128 - Compute the number of bytes required for a signed leb128
- /// value.
- static unsigned SizeSLEB128(int Value);
-
- /// EmitInt8 - Emit a byte directive and value.
- ///
- void EmitInt8(int Value) const;
-
- /// EmitInt16 - Emit a short directive and value.
- ///
- void EmitInt16(int Value) const;
-
- /// EmitInt32 - Emit a long directive and value.
- ///
- void EmitInt32(int Value) const;
-
- /// EmitInt64 - Emit a long long directive and value.
- ///
- void EmitInt64(uint64_t Value) const;
-
- /// EmitString - Emit a string with quotes and a null terminator.
- /// Special characters are emitted properly. (Eg. '\t')
- void EmitString(const std::string &String) const;