mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-23 14:25:07 +00:00
Each input file is encoded as a separate compile unit in LLVM debugging
information output. However, many target specific tool chains prefer to encode only one compile unit in an object file. In this situation, the LLVM code generator will include debugging information entities in the compile unit that is marked as main compile unit. The code generator accepts maximum one main compile unit per module. If a module does not contain any main compile unit then the code generator will emit multiple compile units in the output object file. [Part 1] Update DebugInfo APIs to accept optional boolean value while creating DICompileUnit to mark the unit as "main" unit. By defaults all units are considered non-main. Update SourceLevelDebugging.html to document "main" compile unit. Update DebugInfo APIs to not accept and encode separate source file/directory entries while creating various llvm.dbg.* entities. There was a recent, yet to be documented, change to include this additional information so no documentation changes are required here. Update DwarfDebug to handle "main" compile unit. If "main" compile unit is seen then all DIEs are inserted into "main" compile unit. All other compile units are used to find source location for llvm.dbg.* values. If there is not any "main" compile unit then create unique compile unit DIEs for each llvm.dbg.compile_unit. [Part 2] Create separate llvm.dbg.compile_unit for each input file. Mark compile unit create for main_input_filename as "main" compile unit. Use appropriate compile unit, based on source location information collected from the tree node, while creating llvm.dbg.* values using DebugInfo APIs. --- This is Part 1. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63400 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -109,8 +109,18 @@ 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); }
|
||||
|
||||
/// isMain - Each input file is encoded as a separate compile unit in LLVM
|
||||
/// debugging information output. However, many target specific tool chains
|
||||
/// prefer to encode only one compile unit in an object file. In this
|
||||
/// situation, the LLVM code generator will include debugging information
|
||||
/// entities in the compile unit that is marked as main compile unit. The
|
||||
/// code generator accepts maximum one main compile unit per module. If a
|
||||
/// module does not contain any main compile unit then the code generator
|
||||
/// will emit multiple compile units in the output object file.
|
||||
bool isMain() const { return getUnsignedField(6); }
|
||||
bool isOptimized() const { return getUnsignedField(7); }
|
||||
std::string getFlags() const { return getStringField(8); }
|
||||
|
||||
/// Verify - Verify that a compile unit is well formed.
|
||||
bool Verify() const;
|
||||
@@ -183,16 +193,6 @@ namespace llvm {
|
||||
bool isProtected() const { return (getFlags() & FlagProtected) != 0; }
|
||||
bool isForwardDecl() const { return (getFlags() & FlagFwdDecl) != 0; }
|
||||
|
||||
virtual std::string getFilename() const {
|
||||
assert (0 && "Invalid DIDescriptor");
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string getDirectory() const {
|
||||
assert (0 && "Invalid DIDescriptor");
|
||||
return "";
|
||||
}
|
||||
|
||||
/// dump - print type.
|
||||
void dump() const;
|
||||
};
|
||||
@@ -201,10 +201,7 @@ namespace llvm {
|
||||
class DIBasicType : public DIType {
|
||||
public:
|
||||
explicit DIBasicType(GlobalVariable *GV);
|
||||
|
||||
unsigned getEncoding() const { return getUnsignedField(9); }
|
||||
std::string getFilename() const { return getStringField(10); }
|
||||
std::string getDirectory() const { return getStringField(11); }
|
||||
|
||||
/// dump - print basic type.
|
||||
void dump() const;
|
||||
@@ -218,10 +215,7 @@ namespace llvm {
|
||||
: DIType(GV, true, true) {}
|
||||
public:
|
||||
explicit DIDerivedType(GlobalVariable *GV);
|
||||
|
||||
DIType getTypeDerivedFrom() const { return getFieldAs<DIType>(9); }
|
||||
std::string getFilename() const { return getStringField(10); }
|
||||
std::string getDirectory() const { return getStringField(11); }
|
||||
|
||||
/// dump - print derived type.
|
||||
void dump() const;
|
||||
@@ -233,10 +227,7 @@ namespace llvm {
|
||||
class DICompositeType : public DIDerivedType {
|
||||
public:
|
||||
explicit DICompositeType(GlobalVariable *GV);
|
||||
|
||||
DIArray getTypeArray() const { return getFieldAs<DIArray>(10); }
|
||||
std::string getFilename() const { return getStringField(11); }
|
||||
std::string getDirectory() const { return getStringField(12); }
|
||||
|
||||
/// Verify - Verify that a composite type descriptor is well formed.
|
||||
bool Verify() const;
|
||||
@@ -279,16 +270,6 @@ namespace llvm {
|
||||
unsigned isLocalToUnit() const { return getUnsignedField(9); }
|
||||
unsigned isDefinition() const { return getUnsignedField(10); }
|
||||
|
||||
virtual std::string getFilename() const {
|
||||
assert (0 && "Invalid DIDescriptor");
|
||||
return "";
|
||||
}
|
||||
|
||||
virtual std::string getDirectory() const {
|
||||
assert (0 && "Invalid DIDescriptor");
|
||||
return "";
|
||||
}
|
||||
|
||||
/// dump - print global.
|
||||
void dump() const;
|
||||
};
|
||||
@@ -297,8 +278,6 @@ namespace llvm {
|
||||
class DISubprogram : public DIGlobal {
|
||||
public:
|
||||
explicit DISubprogram(GlobalVariable *GV = 0);
|
||||
std::string getFilename() const { return getStringField(11); }
|
||||
std::string getDirectory() const { return getStringField(12); }
|
||||
DICompositeType getType() const { return getFieldAs<DICompositeType>(8); }
|
||||
|
||||
/// Verify - Verify that a subprogram descriptor is well formed.
|
||||
@@ -312,10 +291,7 @@ namespace llvm {
|
||||
class DIGlobalVariable : public DIGlobal {
|
||||
public:
|
||||
explicit DIGlobalVariable(GlobalVariable *GV = 0);
|
||||
|
||||
GlobalVariable *getGlobal() const { return getGlobalVariableField(11); }
|
||||
std::string getFilename() const { return getStringField(12); }
|
||||
std::string getDirectory() const { return getStringField(13); }
|
||||
|
||||
/// Verify - Verify that a global variable descriptor is well formed.
|
||||
bool Verify() const;
|
||||
@@ -335,8 +311,6 @@ namespace llvm {
|
||||
DICompileUnit getCompileUnit() const{ return getFieldAs<DICompileUnit>(3); }
|
||||
unsigned getLineNumber() const { return getUnsignedField(4); }
|
||||
DIType getType() const { return getFieldAs<DIType>(5); }
|
||||
std::string getFilename() const { return getStringField(6); }
|
||||
std::string getDirectory() const { return getStringField(7); }
|
||||
|
||||
/// isVariable - Return true if the specified tag is legal for DIVariable.
|
||||
static bool isVariable(unsigned Tag);
|
||||
@@ -402,6 +376,7 @@ namespace llvm {
|
||||
const std::string &Filename,
|
||||
const std::string &Directory,
|
||||
const std::string &Producer,
|
||||
bool isMain = false,
|
||||
bool isOptimized = false,
|
||||
const char *Flags = "");
|
||||
|
||||
@@ -413,9 +388,7 @@ namespace llvm {
|
||||
DICompileUnit CompileUnit, unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
unsigned Encoding,
|
||||
const std::string *FileName = 0,
|
||||
const std::string *Directory = 0);
|
||||
unsigned Encoding);
|
||||
|
||||
/// CreateDerivedType - Create a derived type like const qualified type,
|
||||
/// pointer, typedef, etc.
|
||||
@@ -425,9 +398,7 @@ namespace llvm {
|
||||
unsigned LineNumber,
|
||||
uint64_t SizeInBits, uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
DIType DerivedFrom,
|
||||
const std::string *FileName = 0,
|
||||
const std::string *Directory = 0);
|
||||
DIType DerivedFrom);
|
||||
|
||||
/// CreateCompositeType - Create a composite type like array, struct, etc.
|
||||
DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
|
||||
@@ -438,9 +409,7 @@ namespace llvm {
|
||||
uint64_t AlignInBits,
|
||||
uint64_t OffsetInBits, unsigned Flags,
|
||||
DIType DerivedFrom,
|
||||
DIArray Elements,
|
||||
const std::string *FileName = 0,
|
||||
const std::string *Directory = 0);
|
||||
DIArray Elements);
|
||||
|
||||
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
|
||||
/// See comments in DISubprogram for descriptions of these fields.
|
||||
@@ -449,9 +418,7 @@ namespace llvm {
|
||||
const std::string &LinkageName,
|
||||
DICompileUnit CompileUnit, unsigned LineNo,
|
||||
DIType Type, bool isLocalToUnit,
|
||||
bool isDefinition,
|
||||
const std::string *FileName = 0,
|
||||
const std::string *Directory = 0);
|
||||
bool isDefinition);
|
||||
|
||||
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
||||
DIGlobalVariable
|
||||
@@ -460,17 +427,13 @@ namespace llvm {
|
||||
const std::string &LinkageName,
|
||||
DICompileUnit CompileUnit,
|
||||
unsigned LineNo, DIType Type, bool isLocalToUnit,
|
||||
bool isDefinition, llvm::GlobalVariable *GV,
|
||||
const std::string *FileName = 0,
|
||||
const std::string *Directory = 0);
|
||||
bool isDefinition, llvm::GlobalVariable *GV);
|
||||
|
||||
/// CreateVariable - Create a new descriptor for the specified variable.
|
||||
DIVariable CreateVariable(unsigned Tag, DIDescriptor Context,
|
||||
const std::string &Name,
|
||||
DICompileUnit CompileUnit, unsigned LineNo,
|
||||
DIType Type,
|
||||
const std::string *FileName = 0,
|
||||
const std::string *Directory = 0);
|
||||
DIType Type);
|
||||
|
||||
/// CreateBlock - This creates a descriptor for a lexical block with the
|
||||
/// specified parent context.
|
||||
|
Reference in New Issue
Block a user