llvm.org GIT mirror llvm / bea0f24
[MIR] Add support for debug metadata for fixed stack objects Debug var, expr and loc were only supported for non-fixed stack objects. This patch adds the following fields to the "fixedStack:" entries, and renames the ones from "stack:" to: * debug-info-variable * debug-info-expression * debug-info-location Differential Revision: https://reviews.llvm.org/D46032 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330859 91177308-0d34-0410-b5e6-96231b3b80d8 Francis Visoiu Mistrih 1 year, 9 months ago
43 changed file(s) with 288 addition(s) and 129 deletion(s). Raw diff Collapse all Expand all
257257 YamlIO.mapOptional("callee-saved-restored", Object.CalleeSavedRestored,
258258 true);
259259 YamlIO.mapOptional("local-offset", Object.LocalOffset, Optional());
260 YamlIO.mapOptional("di-variable", Object.DebugVar,
261 StringValue()); // Don't print it out when it's empty.
262 YamlIO.mapOptional("di-expression", Object.DebugExpr,
263 StringValue()); // Don't print it out when it's empty.
264 YamlIO.mapOptional("di-location", Object.DebugLoc,
260 YamlIO.mapOptional("debug-info-variable", Object.DebugVar,
261 StringValue()); // Don't print it out when it's empty.
262 YamlIO.mapOptional("debug-info-expression", Object.DebugExpr,
263 StringValue()); // Don't print it out when it's empty.
264 YamlIO.mapOptional("debug-info-location", Object.DebugLoc,
265265 StringValue()); // Don't print it out when it's empty.
266266 }
267267
282282 bool IsAliased = false;
283283 StringValue CalleeSavedRegister;
284284 bool CalleeSavedRestored = true;
285 StringValue DebugVar;
286 StringValue DebugExpr;
287 StringValue DebugLoc;
285288
286289 bool operator==(const FixedMachineStackObject &Other) const {
287290 return ID == Other.ID && Type == Other.Type && Offset == Other.Offset &&
289292 StackID == Other.StackID &&
290293 IsImmutable == Other.IsImmutable && IsAliased == Other.IsAliased &&
291294 CalleeSavedRegister == Other.CalleeSavedRegister &&
292 CalleeSavedRestored == Other.CalleeSavedRestored;
295 CalleeSavedRestored == Other.CalleeSavedRestored &&
296 DebugVar == Other.DebugVar && DebugExpr == Other.DebugExpr
297 && DebugLoc == Other.DebugLoc;
293298 }
294299 };
295300
320325 StringValue()); // Don't print it out when it's empty.
321326 YamlIO.mapOptional("callee-saved-restored", Object.CalleeSavedRestored,
322327 true);
328 YamlIO.mapOptional("debug-info-variable", Object.DebugVar,
329 StringValue()); // Don't print it out when it's empty.
330 YamlIO.mapOptional("debug-info-expression", Object.DebugExpr,
331 StringValue()); // Don't print it out when it's empty.
332 YamlIO.mapOptional("debug-info-location", Object.DebugLoc,
333 StringValue()); // Don't print it out when it's empty.
323334 }
324335
325336 static const bool flow = true;
348348 struct VariableDbgInfo {
349349 const DILocalVariable *Var;
350350 const DIExpression *Expr;
351 unsigned Slot;
351 // The Slot can be negative for fixed stack objects.
352 int Slot;
352353 const DILocation *Loc;
353354
354355 VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
355 unsigned Slot, const DILocation *Loc)
356 int Slot, const DILocation *Loc)
356357 : Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {}
357358 };
358359 using VariableDbgInfoMapTy = SmallVector;
859860
860861 /// Collect information used to emit debugging information of a variable.
861862 void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
862 unsigned Slot, const DILocation *Loc) {
863 int Slot, const DILocation *Loc) {
863864 VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc);
864865 }
865866
121121 const yaml::StringValue &RegisterSource,
122122 bool IsRestored, int FrameIdx);
123123
124 template
124125 bool parseStackObjectsDebugInfo(PerFunctionMIParsingState &PFS,
125 const yaml::MachineStackObject &Object,
126 const T &Object,
126127 int FrameIdx);
127128
128129 bool initializeConstantPool(PerFunctionMIParsingState &PFS,
615616 if (parseCalleeSavedRegister(PFS, CSIInfo, Object.CalleeSavedRegister,
616617 Object.CalleeSavedRestored, ObjectIdx))
617618 return true;
619 if (parseStackObjectsDebugInfo(PFS, Object, ObjectIdx))
620 return true;
618621 }
619622
620623 // Initialize the ordinary frame objects.
699702 return false;
700703 }
701704
705 template
702706 bool MIRParserImpl::parseStackObjectsDebugInfo(PerFunctionMIParsingState &PFS,
703 const yaml::MachineStackObject &Object, int FrameIdx) {
707 const T &Object, int FrameIdx) {
704708 // Debug information can only be attached to stack objects; Fixed stack
705709 // objects aren't supported.
706 assert(FrameIdx >= 0 && "Expected a stack object frame index");
707710 MDNode *Var = nullptr, *Expr = nullptr, *Loc = nullptr;
708711 if (parseMDNode(PFS, Var, Object.DebugVar) ||
709712 parseMDNode(PFS, Expr, Object.DebugExpr) ||
718721 typecheckMDNode(DIExpr, Expr, Object.DebugExpr, "DIExpression", *this) ||
719722 typecheckMDNode(DILoc, Loc, Object.DebugLoc, "DILocation", *this))
720723 return true;
721 PFS.MF.setVariableDbgInfo(DIVar, DIExpr, unsigned(FrameIdx), DILoc);
724 PFS.MF.setVariableDbgInfo(DIVar, DIExpr, FrameIdx, DILoc);
722725 return false;
723726 }
724727
255255 OS << printRegClassOrBank(Reg, RegInfo, TRI);
256256 }
257257
258 template
259 static void
260 printStackObjectDbgInfo(const MachineFunction::VariableDbgInfo &DebugVar,
261 T &Object, ModuleSlotTracker &MST) {
262 std::array Outputs{{&Object.DebugVar.Value,
263 &Object.DebugExpr.Value,
264 &Object.DebugLoc.Value}};
265 std::array Metas{{DebugVar.Var,
266 DebugVar.Expr,
267 DebugVar.Loc}};
268 for (unsigned i = 0; i < 3; ++i) {
269 raw_string_ostream StrOS(*Outputs[i]);
270 Metas[i]->printAsOperand(StrOS, MST);
271 }
272 }
258273
259274 void MIRPrinter::convert(yaml::MachineFunction &MF,
260275 const MachineRegisterInfo &RegInfo,
420435 assert(StackObjectInfo != StackObjectOperandMapping.end() &&
421436 "Invalid stack object index");
422437 const FrameIndexOperand &StackObject = StackObjectInfo->second;
423 assert(!StackObject.IsFixed && "Expected a non-fixed stack object");
424 auto &Object = YMF.StackObjects[StackObject.ID];
425 {
426 raw_string_ostream StrOS(Object.DebugVar.Value);
427 DebugVar.Var->printAsOperand(StrOS, MST);
428 }
429 {
430 raw_string_ostream StrOS(Object.DebugExpr.Value);
431 DebugVar.Expr->printAsOperand(StrOS, MST);
432 }
433 {
434 raw_string_ostream StrOS(Object.DebugLoc.Value);
435 DebugVar.Loc->printAsOperand(StrOS, MST);
438 if (StackObject.IsFixed) {
439 auto &Object = YMF.FixedStackObjects[StackObject.ID];
440 printStackObjectDbgInfo(DebugVar, Object, MST);
441 } else {
442 auto &Object = YMF.StackObjects[StackObject.ID];
443 printStackObjectDbgInfo(DebugVar, Object, MST);
436444 }
437445 }
438446 }
3232 ; CHECK: stack:
3333 ; CHECK-NEXT: - { id: 0, name: ptr1, type: default, offset: 0, size: 8, alignment: 8,
3434 ; CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
35 ; CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
35 ; CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
3636 ; CHECK-NEXT: - { id: 1, name: ptr2, type: default, offset: 0, size: 8, alignment: 1,
3737 ; CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
38 ; CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
38 ; CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
3939 ; CHECK-NEXT: - { id: 2, name: ptr3, type: default, offset: 0, size: 128, alignment: 8,
4040 ; CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
41 ; CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
41 ; CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
4242 ; CHECK-NEXT: - { id: 3, name: ptr4, type: default, offset: 0, size: 1, alignment: 8,
4343 ; CHECK: %{{[0-9]+}}:_(p0) = G_FRAME_INDEX %stack.0.ptr1
4444 ; CHECK: %{{[0-9]+}}:_(p0) = G_FRAME_INDEX %stack.1.ptr2
44 ; CHECK: stack:
55 ; CHECK: - { id: {{.*}}, name: in.addr, type: default, offset: 0, size: {{.*}}, alignment: {{.*}},
66 ; CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true,
7 ; CHECK-NEXT: di-variable: '!11', di-expression: '!DIExpression()',
7 ; CHECK-NEXT: debug-info-variable: '!11', debug-info-expression: '!DIExpression()',
88 ; CHECK: DBG_VALUE debug-use %0(s32), debug-use $noreg, !11, !DIExpression(), debug-location !12
99 define void @debug_declare(i32 %in) #0 !dbg !7 {
1010 entry:
2424 stack:
2525 - { id: 0, name: a.addr, type: default, offset: 0, size: 16, alignment: 16,
2626 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
27 di-variable: '', di-expression: '', di-location: '' }
27 debug-info-variable: '', debug-info-expression: '',
28 debug-info-location: '' }
2829 body: |
2930 bb.1.entry:
3031 liveins: $q0
2323 stack:
2424 - { id: 0, name: retval, type: default, offset: 0, size: 4, alignment: 4,
2525 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
26 di-variable: '', di-expression: '', di-location: '' }
26 debug-info-variable: '', debug-info-expression: '',
27 debug-info-location: '' }
2728 constants:
2829 body: |
2930 bb.1:
4545 stack:
4646 - { id : 0, size: 8, alignment: 4,
4747 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
48 local-offset: -4, di-variable: '', di-expression: '', di-location: '' }
48 local-offset: -4, debug-info-variable: '', debug-info-expression: '',
49 debug-info-location: '' }
4950
5051 body: |
5152 bb.0:
102102 isImmutable: false, isAliased: false, callee-saved-register: '' }
103103 stack:
104104 - { id: 0, name: scratch0, type: default, offset: 4, size: 32768, alignment: 4,
105 stack-id: 0, callee-saved-register: '', local-offset: 0, di-variable: '',
106 di-expression: '', di-location: '' }
105 stack-id: 0, callee-saved-register: '', local-offset: 0,
106 debug-info-variable: '', debug-info-expression: '',
107 debug-info-location: '' }
107108 - { id: 1, name: scratch1, type: default, offset: 32772, size: 32768,
108109 alignment: 4, stack-id: 0, callee-saved-register: '', local-offset: 32768,
109 di-variable: '', di-expression: '', di-location: '' }
110 debug-info-variable: '', debug-info-expression: '',
111 debug-info-location: '' }
110112 constants:
111113 body: |
112114 bb.0.entry:
100100 isImmutable: false, isAliased: false, callee-saved-register: '' }
101101 stack:
102102 - { id: 0, name: scratch0, type: default, offset: 4, size: 32768, alignment: 4,
103 stack-id: 0, callee-saved-register: '', local-offset: 0, di-variable: '',
104 di-expression: '', di-location: '' }
103 stack-id: 0, callee-saved-register: '', local-offset: 0,
104 debug-info-variable: '', debug-info-expression: '',
105 debug-info-location: '' }
105106 - { id: 1, name: scratch1, type: default, offset: 32772, size: 32768,
106107 alignment: 4, stack-id: 0, callee-saved-register: '', local-offset: 32768,
107 di-variable: '', di-expression: '', di-location: '' }
108 debug-info-variable: '', debug-info-expression: '',
109 debug-info-location: '' }
108110 constants:
109111 body: |
110112 bb.0.entry:
100100 isImmutable: false, isAliased: false, callee-saved-register: '' }
101101 stack:
102102 - { id: 0, name: scratch0, type: default, offset: 4, size: 32768, alignment: 4,
103 stack-id: 0, callee-saved-register: '', local-offset: 0, di-variable: '',
104 di-expression: '', di-location: '' }
103 stack-id: 0, callee-saved-register: '', local-offset: 0,
104 debug-info-variable: '', debug-info-expression: '',
105 debug-info-location: '' }
105106 - { id: 1, name: scratch1, type: default, offset: 32772, size: 32768,
106107 alignment: 4, stack-id: 0, callee-saved-register: '', local-offset: 32768,
107 di-variable: '', di-expression: '', di-location: '' }
108 debug-info-variable: '', debug-info-expression: '',
109 debug-info-location: '' }
108110 constants:
109111 body: |
110112 bb.0.entry:
187187 stack:
188188 - { id: 0, name: tmp5, type: default, offset: 0, size: 128, alignment: 16,
189189 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
190 local-offset: 0, di-variable: '', di-expression: '', di-location: '' }
190 local-offset: 0, debug-info-variable: '', debug-info-expression: '',
191 debug-info-location: '' }
191192 constants:
192193 body: |
193194 bb.0.bb:
178178 - { id: 2, class: vgpr_32 }
179179 stack:
180180 - { id: 0, name: "", type: default, offset: 0, size: 128, alignment: 8,
181 callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
182 di-location: '' }
181 callee-saved-register: '', local-offset: 0, debug-info-variable: '',
182 debug-info-expression: '', debug-info-location: '' }
183183 body: |
184184 bb.0:
185185
3434 stack:
3535 - { id: 0, name: '', type: spill-slot, offset: 0, size: 8, alignment: 4,
3636 stack-id: 1, callee-saved-register: '', callee-saved-restored: true,
37 di-variable: '', di-expression: '', di-location: '' }
37 debug-info-variable: '', debug-info-expression: '',
38 debug-info-location: '' }
3839 constants:
3940 body: |
4041 bb.0:
9798 stack:
9899 - { id: 0, name: '', type: spill-slot, offset: 0, size: 8, alignment: 4,
99100 stack-id: 1, callee-saved-register: '', callee-saved-restored: true,
100 di-variable: '', di-expression: '', di-location: '' }
101 debug-info-variable: '', debug-info-expression: '',
102 debug-info-location: '' }
101103 constants:
102104 body: |
103105 bb.0:
4343 - { id: 2, class: vgpr_32 }
4444 stack:
4545 - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
46 callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
47 di-location: '' }
46 callee-saved-register: '', local-offset: 0, debug-info-variable: '',
47 debug-info-expression: '', debug-info-location: '' }
4848 body: |
4949 bb.0:
5050 %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
6464 - { id: 2, class: vgpr_32 }
6565 stack:
6666 - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
67 callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
68 di-location: '' }
67 callee-saved-register: '', local-offset: 0, debug-info-variable: '',
68 debug-info-expression: '', debug-info-location: '' }
6969 body: |
7070 bb.0:
7171 %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
8686 - { id: 2, class: vgpr_32 }
8787 stack:
8888 - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
89 callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
90 di-location: '' }
89 callee-saved-register: '', local-offset: 0, debug-info-variable: '',
90 debug-info-expression: '', debug-info-location: '' }
9191 body: |
9292 bb.0:
9393 %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
108108 - { id: 2, class: vgpr_32 }
109109 stack:
110110 - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
111 callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
112 di-location: '' }
111 callee-saved-register: '', local-offset: 0, debug-info-variable: '',
112 debug-info-expression: '', debug-info-location: '' }
113113 body: |
114114 bb.0:
115115 %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
129129 - { id: 2, class: vgpr_32 }
130130 stack:
131131 - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
132 callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
133 di-location: '' }
132 callee-saved-register: '', local-offset: 0, debug-info-variable: '',
133 debug-info-expression: '', debug-info-location: '' }
134134 body: |
135135 bb.0:
136136 %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
150150 - { id: 2, class: vgpr_32 }
151151 stack:
152152 - { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
153 callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
154 di-location: '' }
153 callee-saved-register: '', local-offset: 0, debug-info-variable: '',
154 debug-info-expression: '', debug-info-location: '' }
155155 body: |
156156 bb.0:
157157 %0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
6666 stack:
6767 - { id: 0, name: res, type: default, offset: -2, size: 2, alignment: 2,
6868 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
69 local-offset: -2, di-variable: '', di-expression: '', di-location: '' }
69 local-offset: -2, debug-info-variable: '', debug-info-expression: '',
70 debug-info-location: '' }
7071 constants:
7172 - id: 0
7273 value: half 0xH706B
6767 stack:
6868 - { id: 0, name: res, type: default, offset: -2, size: 2, alignment: 2,
6969 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
70 local-offset: -2, di-variable: '', di-expression: '', di-location: '' }
70 local-offset: -2, debug-info-variable: '', debug-info-expression: '',
71 debug-info-location: '' }
7172 constants:
7273 - id: 0
7374 value: half 0xH706B
55 stack:
66 - { id: 0, type: default, offset: 0, size: 4, alignment: 4,
77 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
8 local-offset: -4, di-variable: '', di-expression: '', di-location: '' }
8 local-offset: -4, debug-info-variable: '', debug-info-expression: '',
9 debug-info-location: '' }
910 - { id: 1, type: default, offset: 0, size: 8, alignment: 8,
1011 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
11 local-offset: -16, di-variable: '', di-expression: '', di-location: '' }
12 local-offset: -16, debug-info-variable: '', debug-info-expression: '',
13 debug-info-location: '' }
1214 - { id: 2, type: default, offset: 0, size: 8, alignment: 8,
1315 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
14 local-offset: -24, di-variable: '', di-expression: '', di-location: '' }
16 local-offset: -24, debug-info-variable: '', debug-info-expression: '',
17 debug-info-location: '' }
1518 - { id: 3, type: default, offset: 0, size: 8, alignment: 8,
1619 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
17 local-offset: -32, di-variable: '', di-expression: '', di-location: '' }
20 local-offset: -32, debug-info-variable: '', debug-info-expression: '',
21 debug-info-location: '' }
1822 - { id: 4, type: default, offset: 0, size: 8, alignment: 8,
1923 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
20 local-offset: -40, di-variable: '', di-expression: '', di-location: '' }
24 local-offset: -40, debug-info-variable: '', debug-info-expression: '',
25 debug-info-location: '' }
2126 - { id: 5, type: default, offset: 0, size: 8, alignment: 8,
2227 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
23 local-offset: -48, di-variable: '', di-expression: '', di-location: '' }
28 local-offset: -48, debug-info-variable: '', debug-info-expression: '',
29 debug-info-location: '' }
2430 - { id: 6, type: default, offset: 0, size: 8, alignment: 8,
2531 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
26 local-offset: -56, di-variable: '', di-expression: '', di-location: '' }
32 local-offset: -56, debug-info-variable: '', debug-info-expression: '',
33 debug-info-location: '' }
2734 constants:
2835 body: |
2936 bb.0:
1010 stack:
1111 - { id: 0, type: default, offset: 0, size: 4, alignment: 4,
1212 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
13 local-offset: -4, di-variable: '', di-expression: '', di-location: '' }
13 local-offset: -4, debug-info-variable: '', debug-info-expression: '',
14 debug-info-location: '' }
1415 - { id: 1, type: default, offset: 0, size: 8, alignment: 8,
1516 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
16 local-offset: -16, di-variable: '', di-expression: '', di-location: '' }
17 local-offset: -16, debug-info-variable: '', debug-info-expression: '',
18 debug-info-location: '' }
1719 - { id: 2, type: default, offset: 0, size: 8, alignment: 8,
1820 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
19 local-offset: -24, di-variable: '', di-expression: '', di-location: '' }
21 local-offset: -24, debug-info-variable: '', debug-info-expression: '',
22 debug-info-location: '' }
2023 - { id: 3, type: default, offset: 0, size: 8, alignment: 8,
2124 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
22 local-offset: -32, di-variable: '', di-expression: '', di-location: '' }
25 local-offset: -32, debug-info-variable: '', debug-info-expression: '',
26 debug-info-location: '' }
2327 - { id: 4, type: default, offset: 0, size: 8, alignment: 8,
2428 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
25 local-offset: -40, di-variable: '', di-expression: '', di-location: '' }
29 local-offset: -40, debug-info-variable: '', debug-info-expression: '',
30 debug-info-location: '' }
2631 - { id: 5, type: default, offset: 0, size: 8, alignment: 8,
2732 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
28 local-offset: -48, di-variable: '', di-expression: '', di-location: '' }
33 local-offset: -48, debug-info-variable: '', debug-info-expression: '',
34 debug-info-location: '' }
2935 - { id: 6, type: default, offset: 0, size: 8, alignment: 8,
3036 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
31 local-offset: -56, di-variable: '', di-expression: '', di-location: '' }
37 local-offset: -56, debug-info-variable: '', debug-info-expression: '',
38 debug-info-location: '' }
3239 constants:
3340 body: |
3441 bb.0:
2626 # CHECK: stack:
2727 # CHECK: - { id: 0, name: local_var, type: default, offset: 0, size: 8, alignment: 8,
2828 # CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
29 # CHECK-NEXT: local-offset: -8, di-variable: '', di-expression: '', di-location: '' }
29 # CHECK-NEXT: local-offset: -8, debug-info-variable: '', debug-info-expression: '',
30 # CHECK-NEXT: debug-info-location: '' }
3031 stack:
3132 - { id: 0,name: local_var,offset: 0,size: 8,alignment: 8, local-offset: -8 }
3233 body: |
4949 adjustsStack: true
5050 hasCalls: true
5151 # CHECK: fixedStack:
52 # CHECK: callee-saved-register: '$rbx', callee-saved-restored: true }
52 # CHECK: callee-saved-register: '$rbx', callee-saved-restored: true
5353 fixedStack:
5454 - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$rbx' }
5555 # CHECK: stack:
1212 liveins:
1313 - { reg: '$edi' }
1414 stack:
15 # CHECK: [[@LINE+1]]:74: expected a metadata node
16 - { id: 0, name: xa, offset: -12, size: 4, alignment: 4, di-variable: '0' }
15 - { id: 0, name: xa, offset: -12, size: 4, alignment: 4,
16 # CHECK: [[@LINE+1]]:29: expected a metadata node
17 debug-info-variable: '0' }
1718 body: |
1819 bb.0.entry:
1920 liveins: $edi
0 # RUN: llc -mtriple=x86_64-apple-unknown -run-pass none %s -o /dev/null
1 # Check that we parse the 'debug-info-*' fields for `fixedStack:` entries.
2
3 --- |
4
5 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-apple-unknown"
7
8 declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
9
10 define hidden void @foo(i32* byval %dstRect) {
11 entry:
12 call void @llvm.dbg.declare(metadata i32* %dstRect, metadata !3, metadata !DIExpression()), !dbg !5
13 unreachable
14 }
15
16 attributes #0 = { nounwind readnone speculatable }
17
18 !llvm.dbg.cu = !{!0}
19 !llvm.module.flags = !{!2}
20
21 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
22 !1 = !DIFile(filename: "file.cpp", directory: "/dir")
23 !2 = !{i32 2, !"Debug Info Version", i32 3}
24 !3 = !DILocalVariable(name: "dstRect", scope: !4)
25 !4 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !0, file: !1, line: 42, unit: !0)
26 !5 = !DILocation(line: 42, column: 85, scope: !4)
27
28 ...
29 ---
30 name: foo
31 alignment: 4
32 tracksRegLiveness: true
33 frameInfo:
34 maxAlignment: 8
35 fixedStack:
36 - { id: 0, size: 4, alignment: 16, stack-id: 0, debug-info-variable: '!3', debug-info-expression: '!DIExpression()',
37 debug-info-location: '!5' }
38 body: |
39 bb.0.entry:
40
41 ...
3737 frameInfo:
3838 maxAlignment: 16
3939 stack:
40 # CHECK: [[@LINE+1]]:75: expected a reference to a 'DILocalVariable' metadata node
41 - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!8',
42 di-expression: '!7', di-location: '!8' }
40 - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16,
41 # CHECK: [[@LINE+1]]:28: expected a reference to a 'DILocalVariable' metadata node
42 debug-info-variable: '!8', debug-info-expression: '!7',
43 debug-info-location: '!8' }
4344 body: |
4445 bb.0.entry:
4546 successors: %bb.1.for.body
1919 maxAlignment: 4
2020 # CHECK: fixedStack:
2121 # CHECK-NEXT: - { id: 0, type: spill-slot, offset: 0, size: 4, alignment: 4, stack-id: 0,
22 # CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true }
22 # CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '',
23 # CHECK-NEXT: debug-info-expression: '', debug-info-location: '' }
2324 fixedStack:
2425 - { id: 0, type: spill-slot, offset: 0, size: 4, alignment: 4 }
2526 stack:
5151 # CHECK: stack:
5252 # CHECK: - { id: 0, name: y.i, type: default, offset: 0, size: 256, alignment: 16,
5353 # CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true,
54 # CHECK-NEXT: di-variable: '!4', di-expression: '!DIExpression()', di-location: '!10' }
54 # CHECK-NEXT: debug-info-variable: '!4', debug-info-expression: '!DIExpression()',
55 # CHECK-NEXT: debug-info-location: '!10' }
5556 stack:
56 - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4',
57 di-expression: '!DIExpression()', di-location: '!7' }
57 - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16,
58 debug-info-variable: '!4', debug-info-expression: '!DIExpression()',
59 debug-info-location: '!7' }
5860 body: |
5961 bb.0.entry:
6062 successors: %bb.1.for.body
2222 # CHECK: stack:
2323 # CHECK-NEXT: - { id: 0, name: b, type: default, offset: -12, size: 4, alignment: 4,
2424 # CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
25 # CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
25 # CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
2626 # CHECK-NEXT: - { id: 1, name: x, type: default, offset: -24, size: 8, alignment: 8,
2727 # CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
28 # CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
28 # CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
2929 # CHECK-NEXT: - { id: 2, name: '', type: spill-slot, offset: -32, size: 4, alignment: 4,
3030 # CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
31 # CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
31 # CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
3232 stack:
3333 - { id: 0, name: b, offset: -12, size: 4, alignment: 4 }
3434 - { id: 1, name: x, offset: -24, size: 8, alignment: 8 }
2525 # CHECK: stack:
2626 # CHECK-NEXT: - { id: 0, name: '', type: default, offset: -20, size: 4, alignment: 4,
2727 # CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
28 # CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
28 # CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
2929 # CHECK-NEXT: - { id: 1, name: '', type: default, offset: -32, size: 8, alignment: 8,
3030 # CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
31 # CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
31 # CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
3232 # CHECK-NEXT: - { id: 2, name: y, type: variable-sized, offset: -32, alignment: 1,
3333 stack:
3434 - { id: 0, offset: -20, size: 4, alignment: 4 }
162162 stack:
163163 - { id: 0, name: z.addr, type: default, offset: 0, size: 4, alignment: 4,
164164 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
165 di-variable: '', di-expression: '', di-location: '' }
165 debug-info-variable: '', debug-info-expression: '',
166 debug-info-location: '' }
166167 constants:
167168 body: |
168169 bb.0.entry:
4848 stack:
4949 - { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
5050 stack-id: 0, callee-saved-register: '$ra', callee-saved-restored: true,
51 di-variable: '', di-expression: '', di-location: '' }
51 debug-info-variable: '', debug-info-expression: '',
52 debug-info-location: '' }
5253 constants:
5354 body: |
5455 bb.0.entry:
101101 fixedStack:
102102 stack:
103103 - { id: 0, name: retval, type: default, offset: 0, size: 16, alignment: 16,
104 callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
104 callee-saved-register: '', debug-info-variable: '',
105 debug-info-expression: '', debug-info-location: '' }
105106 - { id: 1, name: a, type: default, offset: 0, size: 16, alignment: 16,
106 callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
107 callee-saved-register: '', debug-info-variable: '',
108 debug-info-expression: '', debug-info-location: '' }
107109 - { id: 2, name: b, type: default, offset: 0, size: 16, alignment: 16,
108 callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
110 callee-saved-register: '', debug-info-variable: '',
111 debug-info-expression: '', debug-info-location: '' }
109112 - { id: 3, name: a.addr, type: default, offset: 0, size: 16, alignment: 16,
110 callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
113 callee-saved-register: '', debug-info-variable: '',
114 debug-info-expression: '', debug-info-location: '' }
111115 - { id: 4, name: b.addr, type: default, offset: 0, size: 16, alignment: 16,
112 callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
116 callee-saved-register: '', debug-info-variable: '',
117 debug-info-expression: '', debug-info-location: '' }
113118 - { id: 5, name: c.addr, type: default, offset: 0, size: 4, alignment: 4,
114 callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
119 callee-saved-register: '', debug-info-variable: '',
120 debug-info-expression: '', debug-info-location: '' }
115121 - { id: 6, name: g, type: default, offset: 0, size: 8, alignment: 8,
116 callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
122 callee-saved-register: '', debug-info-variable: '',
123 debug-info-expression: '', debug-info-location: '' }
117124 - { id: 7, name: d, type: default, offset: 0, size: 8, alignment: 8,
118 callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
125 callee-saved-register: '', debug-info-variable: '',
126 debug-info-expression: '', debug-info-location: '' }
119127 - { id: 8, name: '', type: default, offset: 0, size: 6400,
120 alignment: 16, callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
128 alignment: 16, callee-saved-register: '', debug-info-variable: '',
129 debug-info-expression: '', debug-info-location: '' }
121130 constants:
122131 body: |
123132 bb.0.entry:
30743074 stack:
30753075 - { id: 0, name: '', type: default, offset: 0, size: 16, alignment: 16,
30763076 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
3077 local-offset: -16, di-variable: '', di-expression: '', di-location: '' }
3077 local-offset: -16, debug-info-variable: '', debug-info-expression: '',
3078 debug-info-location: '' }
30783079 - { id: 1, name: '', type: default, offset: 0, size: 4, alignment: 4,
30793080 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
3080 local-offset: -20, di-variable: '', di-expression: '', di-location: '' }
3081 local-offset: -20, debug-info-variable: '', debug-info-expression: '',
3082 debug-info-location: '' }
30813083 - { id: 2, name: '', type: default, offset: 0, size: 4, alignment: 4,
30823084 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
3083 local-offset: -24, di-variable: '', di-expression: '', di-location: '' }
3085 local-offset: -24, debug-info-variable: '', debug-info-expression: '',
3086 debug-info-location: '' }
30843087 - { id: 3, name: '', type: default, offset: 0, size: 4, alignment: 4,
30853088 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
3086 local-offset: -28, di-variable: '', di-expression: '', di-location: '' }
3089 local-offset: -28, debug-info-variable: '', debug-info-expression: '',
3090 debug-info-location: '' }
30873091 - { id: 4, name: '', type: default, offset: 0, size: 4, alignment: 4,
30883092 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
3089 local-offset: -32, di-variable: '', di-expression: '', di-location: '' }
3093 local-offset: -32, debug-info-variable: '', debug-info-expression: '',
3094 debug-info-location: '' }
30903095 constants:
30913096 body: |
30923097 bb.0.entry:
1818 stack:
1919 - { id: 0, name: ptr1, type: default, offset: 0, size: 4, alignment: 4,
2020 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
21 di-variable: '', di-expression: '', di-location: '' }
21 debug-info-variable: '', debug-info-expression: '',
22 debug-info-location: '' }
2223
2324 body: |
2425 bb.1 (%ir-block.0):
1818 stack:
1919 - { id: 0, name: ptr1, type: default, offset: 0, size: 4, alignment: 4,
2020 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
21 di-variable: '', di-expression: '', di-location: '' }
21 debug-info-variable: '', debug-info-expression: '',
22 debug-info-location: '' }
2223
2324 body: |
2425 bb.1 (%ir-block.0):
1818 stack:
1919 - { id: 0, name: ptr1, type: default, offset: 0, size: 4, alignment: 4,
2020 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
21 di-variable: '', di-expression: '', di-location: '' }
21 debug-info-variable: '', debug-info-expression: '',
22 debug-info-location: '' }
2223
2324 body: |
2425 bb.1 (%ir-block.0):
0 ; RUN: llc -mtriple=x86_64-apple-unknown -stop-before=expand-isel-pseudos %s -o - -simplify-mir | FileCheck %s
1 ; The byval argument of the function will be allocated a fixed stack slot. Test
2 ; that we serialize the fixed slot correctly.
3
4 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-apple-unknown"
6
7 declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
8
9 define hidden void @foo(i32* byval %dstRect) {
10 ; CHECK-LABEL: name: foo
11 entry:
12 call void @llvm.dbg.declare(metadata i32* %dstRect, metadata !3, metadata !DIExpression()), !dbg !5
13 ; CHECK: fixedStack:
14 ; CHECK: id: 0
15 ; CHECK: debug-info-variable: '!3'
16 ; CHECK: debug-info-expression: '!DIExpression()'
17 ; CHECK: debug-info-location: '!5'
18 unreachable
19 }
20
21 attributes #0 = { nounwind readnone speculatable }
22
23 !llvm.dbg.cu = !{!0}
24 !llvm.module.flags = !{!2}
25
26 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
27 !1 = !DIFile(filename: "file.cpp", directory: "/dir")
28 !2 = !{i32 2, !"Debug Info Version", i32 3}
29 !3 = !DILocalVariable(name: "dstRect", scope: !4)
30 !4 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !0, file: !1, line: 42, unit: !0)
31 !5 = !DILocation(line: 42, column: 85, scope: !4)
8888 stack:
8989 - { id: 0, name: p, type: default, offset: 0, size: 4, alignment: 4,
9090 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
91 di-variable: '', di-expression: '', di-location: '' }
91 debug-info-variable: '', debug-info-expression: '',
92 debug-info-location: '' }
9293 - { id: 1, name: q, type: default, offset: 0, size: 4, alignment: 4,
9394 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
94 di-variable: '', di-expression: '', di-location: '' }
95 debug-info-variable: '', debug-info-expression: '',
96 debug-info-location: '' }
9597 - { id: 2, name: s, type: default, offset: 0, size: 8, alignment: 8,
9698 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
97 di-variable: '', di-expression: '', di-location: '' }
99 debug-info-variable: '', debug-info-expression: '',
100 debug-info-location: '' }
98101 constants:
99102 body: |
100103 bb.0.entry:
4646 stack:
4747 - { id: 0, name: alpha, type: default, offset: 0, size: 1, alignment: 1,
4848 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
49 di-variable: '', di-expression: '', di-location: '' }
49 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
5050 - { id: 1, name: foxtrot, type: default, offset: 0, size: 16, alignment: 16,
5151 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
52 di-variable: '', di-expression: '', di-location: '' }
52 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
5353 - { id: 2, name: india, type: default, offset: 0, size: 16, alignment: 16,
5454 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
55 di-variable: '', di-expression: '', di-location: '' }
55 debug-info-variable: '', debug-info-expression: '',
56 debug-info-location: '' }
5657 constants:
5758 body: |
5859 bb.0.entry:
172172 fixedStack:
173173 stack:
174174 - { id: 0, name: bz, type: default, offset: -32, size: 16, alignment: 8,
175 callee-saved-register: '', local-offset: -16, di-variable: '', di-expression: '',
176 di-location: '' }
175 callee-saved-register: '', local-offset: -16, debug-info-variable: '',
176 debug-info-expression: '', debug-info-location: '' }
177177 - { id: 1, name: att, type: default, offset: -48, size: 16, alignment: 8,
178 callee-saved-register: '', local-offset: -32, di-variable: '', di-expression: '',
179 di-location: '' }
178 callee-saved-register: '', local-offset: -32, debug-info-variable: '',
179 debug-info-expression: '', debug-info-location: '' }
180180 - { id: 2, name: '', type: spill-slot, offset: -16, size: 8, alignment: 16,
181 callee-saved-register: '$lr', di-variable: '', di-expression: '',
182 di-location: '' }
181 callee-saved-register: '$lr', debug-info-variable: '',
182 debug-info-expression: '', debug-info-location: '' }
183183 constants:
184184 body: |
185185 bb.0.entry:
139139 stack:
140140 - { id: 0, name: condition, type: default, offset: -12, size: 4, alignment: 4,
141141 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
142 di-variable: '', di-expression: '', di-location: '' }
142 debug-info-variable: '', debug-info-expression: '',
143 debug-info-location: '' }
143144 - { id: 1, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
144145 stack-id: 0, callee-saved-register: '$ra', callee-saved-restored: true,
145 di-variable: '', di-expression: '', di-location: '' }
146 debug-info-variable: '', debug-info-expression: '',
147 debug-info-location: '' }
146148 - { id: 2, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4,
147149 stack-id: 0, callee-saved-register: '$s0', callee-saved-restored: true,
148 di-variable: '', di-expression: '', di-location: '' }
150 debug-info-variable: '', debug-info-expression: '',
151 debug-info-location: '' }
149152 constants:
150153 body: |
151154 bb.0.entry:
245245 stack:
246246 - { id: 0, name: '', type: spill-slot, offset: -64, size: 4, alignment: 4,
247247 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
248 di-variable: '', di-expression: '', di-location: '' }
248 debug-info-variable: '', debug-info-expression: '',
249 debug-info-location: '' }
249250 - { id: 1, name: '', type: spill-slot, offset: -60, size: 4, alignment: 4,
250251 stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
251 di-variable: '', di-expression: '', di-location: '' }
252 debug-info-variable: '', debug-info-expression: '',
253 debug-info-location: '' }
252254 constants:
253255 body: |
254256 bb.0.entry:
118118 fixedStack:
119119 stack:
120120 - { id: 0, name: x.addr, type: default, offset: 0, size: 4, alignment: 4,
121 stack-id: 0, callee-saved-register: '', di-variable: '', di-expression: '',
122 di-location: '' }
121 stack-id: 0, callee-saved-register: '', debug-info-variable: '',
122 debug-info-expression: '', debug-info-location: '' }
123123 constants:
124124 body: |
125125 bb.0.entry: