@@ -58,18 +58,17 @@ class LVIRReader final : public LVReader {
58
58
// Whether to emit all linkage names, or just abstract subprograms.
59
59
bool UseAllLinkageNames = true ;
60
60
61
- // Dependencies on external options (llc, etc).
61
+ // Looking at IR generated with the '-gdwarf -gsplit-dwarf=split' the only
62
+ // difference is setting the 'DICompileUnit::splitDebugFilename' to the
63
+ // name of the split filename: "xxx.dwo".
62
64
bool includeMinimalInlineScopes () const ;
63
65
bool useAllLinkageNames () const { return UseAllLinkageNames; }
64
66
65
67
bool LanguageIsFortran = false ;
66
68
void mapFortranLanguage (unsigned DWLang);
67
69
bool moduleIsInFortran () const { return LanguageIsFortran; }
68
70
69
- // Generate logical debug line before prologue.
70
- bool GenerateLineBeforePrologue = true ;
71
-
72
- // We assume a constante increase between instructions.
71
+ // We assume a constant instruction-size increase between instructions.
73
72
const unsigned OffsetIncrease = 4 ;
74
73
void updateLineOffset () { CurrentOffset += OffsetIncrease; }
75
74
@@ -79,6 +78,7 @@ class LVIRReader final : public LVReader {
79
78
std::unique_ptr<DbgValueRangeTable> DbgValueRanges;
80
79
81
80
// Record the last assigned file index for each compile unit.
81
+ // This data structure is to aid mapping DIFiles onto a DWARF-like file table.
82
82
using LVIndexFiles = std::map<LVScopeCompileUnit *, size_t >;
83
83
LVIndexFiles IndexFiles;
84
84
@@ -99,13 +99,13 @@ class LVIRReader final : public LVReader {
99
99
return FileIndex;
100
100
}
101
101
102
- // Collect the compile unit metadata files .
102
+ // Store a FileID number for each DIFile seen .
103
103
using LVCompileUnitFiles = std::map<const DIFile *, size_t >;
104
104
LVCompileUnitFiles CompileUnitFiles;
105
105
106
106
size_t getOrCreateSourceID (const DIFile *File);
107
107
108
- // Associate the logical elements to metadata objects .
108
+ // Associate the metadata objects to logical elements .
109
109
using LVMDObjects = std::map<const MDNode *, LVElement *>;
110
110
LVMDObjects MDObjects;
111
111
@@ -130,18 +130,23 @@ class LVIRReader final : public LVReader {
130
130
return static_cast <LVType *>(getElementForSeenMD (MD));
131
131
}
132
132
133
- // Inlined concrete scopes with its associated inlined abstract scopes.
134
- // When creating abstract scopes, there is no direct information to find
133
+ // Abstract scopes mapped to the associated inlined scopes.
134
+ // When creating inlined scopes, there is no direct information to find
135
135
// the correct lexical scope.
136
- using LVInlinedScopes = std::map<LVScope *, LVScope *>;
136
+ using LVScopeEntry = std::pair<LVScope *, const DILocation *>;
137
+ using LVInlinedScopes = std::map<LVScopeEntry, LVScope *>;
137
138
LVInlinedScopes InlinedScopes;
138
139
139
- void addInlinedScope (LVScope *ConcreteScope, LVScope *AbstractScope) {
140
- if (InlinedScopes.find (ConcreteScope) == InlinedScopes.end ())
141
- InlinedScopes.emplace (ConcreteScope, AbstractScope);
140
+ void addInlinedScope (LVScope *AbstractScope, const DILocation *InlinedAt,
141
+ LVScope *InlinedScope) {
142
+ auto Entry = LVScopeEntry (AbstractScope, InlinedAt);
143
+ if (InlinedScopes.find (Entry) == InlinedScopes.end ())
144
+ InlinedScopes.emplace (Entry, InlinedScope);
142
145
}
143
- LVScope *getInlinedScope (LVScope *ConcreteScope) const {
144
- LVInlinedScopes::const_iterator Iter = InlinedScopes.find (ConcreteScope);
146
+ LVScope *getInlinedScope (LVScope *AbstractScope,
147
+ const DILocation *InlinedAt) const {
148
+ auto Entry = LVScopeEntry (AbstractScope, InlinedAt);
149
+ LVInlinedScopes::const_iterator Iter = InlinedScopes.find (Entry);
145
150
return Iter != InlinedScopes.end () ? Iter->second : nullptr ;
146
151
}
147
152
@@ -163,9 +168,6 @@ class LVIRReader final : public LVReader {
163
168
164
169
void processBasicBlocks (Function &F, const DISubprogram *SP);
165
170
166
- void addGlobalName (StringRef Name, LVElement *Element,
167
- const DIScope *Context);
168
-
169
171
void addAccess (LVElement *Element, DINode::DIFlags Flags);
170
172
171
173
void addConstantValue (LVElement *Element, const DIExpression *DIExpr);
@@ -175,7 +177,7 @@ class LVIRReader final : public LVReader {
175
177
const DIType *Ty);
176
178
void addConstantValue (LVElement *Element, const APInt &Value, bool Unsigned);
177
179
void addConstantValue (LVElement *Element, uint64_t Value, const DIType *Ty);
178
- void addConstantValue (LVElement *Element, bool Unsigned, uint64_t Value );
180
+ void addConstantValue (LVElement *Element, uint64_t Value, bool Unsigned );
179
181
180
182
void addString (LVElement *Element, StringRef Str);
181
183
@@ -197,8 +199,6 @@ class LVIRReader final : public LVReader {
197
199
bool applySubprogramDefinitionAttributes (LVScope *Function,
198
200
const DISubprogram *SP,
199
201
bool Minimal = false );
200
- void applySubprogramAttributesToDefinition (LVScope *Function,
201
- const DISubprogram *SP);
202
202
203
203
void constructAggregate (LVScopeAggregate *Aggregate,
204
204
const DICompositeType *CTy);
@@ -210,7 +210,8 @@ class LVIRReader final : public LVReader {
210
210
LVType *IndexType);
211
211
void constructImportedEntity (LVElement *Element, const DIImportedEntity *IE);
212
212
213
- void constructLine (LVScope *Scope, const DISubprogram *SP, Instruction &I);
213
+ void constructLine (LVScope *Scope, const DISubprogram *SP, Instruction &I,
214
+ bool &GenerateLineBeforePrologue);
214
215
215
216
LVSymbol *getOrCreateMember (LVScope *Aggregate, const DIDerivedType *DT);
216
217
LVSymbol *getOrCreateStaticMember (LVScope *Aggregate,
@@ -220,14 +221,15 @@ class LVIRReader final : public LVReader {
220
221
LVScope *getOrCreateScope (const DIScope *Context);
221
222
void constructScope (LVElement *Element, const DIScope *Context);
222
223
223
- LVScope *getOrCreateSubprogram (const DISubprogram *SP, bool Minimal = false );
224
+ LVScope *getOrCreateSubprogram (const DISubprogram *SP);
224
225
LVScope *getOrCreateSubprogram (LVScope *Function, const DISubprogram *SP,
225
226
bool Minimal = false );
226
227
void constructSubprogramArguments (LVScope *Function,
227
228
const DITypeRefArray Args);
228
229
229
- LVScope *getOrCreateInlinedScope (LVScope *Parent, const DILocation *DL);
230
- LVScope *getOrCreateAbstractScope (LVScope *OriginScope, const DILocation *DL);
230
+ LVScope *getOrCreateAbstractScope (LVScope *Parent, const DILocation *DL);
231
+ LVScope *getOrCreateInlinedScope (LVScope *AbstractScope,
232
+ const DILocation *DL);
231
233
232
234
void constructSubrange (LVScopeArray *Array, const DISubrange *GSR,
233
235
LVType *IndexType);
@@ -245,8 +247,8 @@ class LVIRReader final : public LVReader {
245
247
LVSymbol *getOrCreateVariable (const DIGlobalVariableExpression *GVE);
246
248
LVSymbol *getOrCreateVariable (const DIVariable *Var,
247
249
const DILocation *DL = nullptr );
248
- LVSymbol *getOrCreateAbstractVariable (LVSymbol *OriginSymbol,
249
- const DILocation *DL);
250
+ LVSymbol *getOrCreateInlinedVariable (LVSymbol *OriginSymbol,
251
+ const DILocation *DL);
250
252
251
253
LVElement *constructElement (const DINode *DN);
252
254
0 commit comments