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
llvm-svn: 330859
YamlIO.mapOptional("callee-saved-restored", Object.CalleeSavedRestored,
true);
YamlIO.mapOptional("local-offset", Object.LocalOffset, Optional<int64_t>());
- YamlIO.mapOptional("di-variable", Object.DebugVar,
+ YamlIO.mapOptional("debug-info-variable", Object.DebugVar,
StringValue()); // Don't print it out when it's empty.
- YamlIO.mapOptional("di-expression", Object.DebugExpr,
+ YamlIO.mapOptional("debug-info-expression", Object.DebugExpr,
StringValue()); // Don't print it out when it's empty.
- YamlIO.mapOptional("di-location", Object.DebugLoc,
+ YamlIO.mapOptional("debug-info-location", Object.DebugLoc,
StringValue()); // Don't print it out when it's empty.
}
bool IsAliased = false;
StringValue CalleeSavedRegister;
bool CalleeSavedRestored = true;
+ StringValue DebugVar;
+ StringValue DebugExpr;
+ StringValue DebugLoc;
bool operator==(const FixedMachineStackObject &Other) const {
return ID == Other.ID && Type == Other.Type && Offset == Other.Offset &&
StackID == Other.StackID &&
IsImmutable == Other.IsImmutable && IsAliased == Other.IsAliased &&
CalleeSavedRegister == Other.CalleeSavedRegister &&
- CalleeSavedRestored == Other.CalleeSavedRestored;
+ CalleeSavedRestored == Other.CalleeSavedRestored &&
+ DebugVar == Other.DebugVar && DebugExpr == Other.DebugExpr
+ && DebugLoc == Other.DebugLoc;
}
};
StringValue()); // Don't print it out when it's empty.
YamlIO.mapOptional("callee-saved-restored", Object.CalleeSavedRestored,
true);
+ YamlIO.mapOptional("debug-info-variable", Object.DebugVar,
+ StringValue()); // Don't print it out when it's empty.
+ YamlIO.mapOptional("debug-info-expression", Object.DebugExpr,
+ StringValue()); // Don't print it out when it's empty.
+ YamlIO.mapOptional("debug-info-location", Object.DebugLoc,
+ StringValue()); // Don't print it out when it's empty.
}
static const bool flow = true;
struct VariableDbgInfo {
const DILocalVariable *Var;
const DIExpression *Expr;
- unsigned Slot;
+ // The Slot can be negative for fixed stack objects.
+ int Slot;
const DILocation *Loc;
VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
- unsigned Slot, const DILocation *Loc)
+ int Slot, const DILocation *Loc)
: Var(Var), Expr(Expr), Slot(Slot), Loc(Loc) {}
};
using VariableDbgInfoMapTy = SmallVector<VariableDbgInfo, 4>;
/// Collect information used to emit debugging information of a variable.
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr,
- unsigned Slot, const DILocation *Loc) {
+ int Slot, const DILocation *Loc) {
VariableDbgInfos.emplace_back(Var, Expr, Slot, Loc);
}
const yaml::StringValue &RegisterSource,
bool IsRestored, int FrameIdx);
+ template <typename T>
bool parseStackObjectsDebugInfo(PerFunctionMIParsingState &PFS,
- const yaml::MachineStackObject &Object,
+ const T &Object,
int FrameIdx);
bool initializeConstantPool(PerFunctionMIParsingState &PFS,
if (parseCalleeSavedRegister(PFS, CSIInfo, Object.CalleeSavedRegister,
Object.CalleeSavedRestored, ObjectIdx))
return true;
+ if (parseStackObjectsDebugInfo(PFS, Object, ObjectIdx))
+ return true;
}
// Initialize the ordinary frame objects.
return false;
}
+template <typename T>
bool MIRParserImpl::parseStackObjectsDebugInfo(PerFunctionMIParsingState &PFS,
- const yaml::MachineStackObject &Object, int FrameIdx) {
+ const T &Object, int FrameIdx) {
// Debug information can only be attached to stack objects; Fixed stack
// objects aren't supported.
- assert(FrameIdx >= 0 && "Expected a stack object frame index");
MDNode *Var = nullptr, *Expr = nullptr, *Loc = nullptr;
if (parseMDNode(PFS, Var, Object.DebugVar) ||
parseMDNode(PFS, Expr, Object.DebugExpr) ||
typecheckMDNode(DIExpr, Expr, Object.DebugExpr, "DIExpression", *this) ||
typecheckMDNode(DILoc, Loc, Object.DebugLoc, "DILocation", *this))
return true;
- PFS.MF.setVariableDbgInfo(DIVar, DIExpr, unsigned(FrameIdx), DILoc);
+ PFS.MF.setVariableDbgInfo(DIVar, DIExpr, FrameIdx, DILoc);
return false;
}
OS << printRegClassOrBank(Reg, RegInfo, TRI);
}
+template <typename T>
+static void
+printStackObjectDbgInfo(const MachineFunction::VariableDbgInfo &DebugVar,
+ T &Object, ModuleSlotTracker &MST) {
+ std::array<std::string *, 3> Outputs{{&Object.DebugVar.Value,
+ &Object.DebugExpr.Value,
+ &Object.DebugLoc.Value}};
+ std::array<const Metadata *, 3> Metas{{DebugVar.Var,
+ DebugVar.Expr,
+ DebugVar.Loc}};
+ for (unsigned i = 0; i < 3; ++i) {
+ raw_string_ostream StrOS(*Outputs[i]);
+ Metas[i]->printAsOperand(StrOS, MST);
+ }
+}
void MIRPrinter::convert(yaml::MachineFunction &MF,
const MachineRegisterInfo &RegInfo,
assert(StackObjectInfo != StackObjectOperandMapping.end() &&
"Invalid stack object index");
const FrameIndexOperand &StackObject = StackObjectInfo->second;
- assert(!StackObject.IsFixed && "Expected a non-fixed stack object");
- auto &Object = YMF.StackObjects[StackObject.ID];
- {
- raw_string_ostream StrOS(Object.DebugVar.Value);
- DebugVar.Var->printAsOperand(StrOS, MST);
- }
- {
- raw_string_ostream StrOS(Object.DebugExpr.Value);
- DebugVar.Expr->printAsOperand(StrOS, MST);
- }
- {
- raw_string_ostream StrOS(Object.DebugLoc.Value);
- DebugVar.Loc->printAsOperand(StrOS, MST);
+ if (StackObject.IsFixed) {
+ auto &Object = YMF.FixedStackObjects[StackObject.ID];
+ printStackObjectDbgInfo(DebugVar, Object, MST);
+ } else {
+ auto &Object = YMF.StackObjects[StackObject.ID];
+ printStackObjectDbgInfo(DebugVar, Object, MST);
}
}
}
; CHECK: stack:
; CHECK-NEXT: - { id: 0, name: ptr1, type: default, offset: 0, size: 8, alignment: 8,
; CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
-; CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
+; CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
; CHECK-NEXT: - { id: 1, name: ptr2, type: default, offset: 0, size: 8, alignment: 1,
; CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
-; CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
+; CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
; CHECK-NEXT: - { id: 2, name: ptr3, type: default, offset: 0, size: 128, alignment: 8,
; CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
-; CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
+; CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
; CHECK-NEXT: - { id: 3, name: ptr4, type: default, offset: 0, size: 1, alignment: 8,
; CHECK: %{{[0-9]+}}:_(p0) = G_FRAME_INDEX %stack.0.ptr1
; CHECK: %{{[0-9]+}}:_(p0) = G_FRAME_INDEX %stack.1.ptr2
; CHECK: stack:
; CHECK: - { id: {{.*}}, name: in.addr, type: default, offset: 0, size: {{.*}}, alignment: {{.*}},
; CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true,
-; CHECK-NEXT: di-variable: '!11', di-expression: '!DIExpression()',
+; CHECK-NEXT: debug-info-variable: '!11', debug-info-expression: '!DIExpression()',
; CHECK: DBG_VALUE debug-use %0(s32), debug-use $noreg, !11, !DIExpression(), debug-location !12
define void @debug_declare(i32 %in) #0 !dbg !7 {
entry:
stack:
- { id: 0, name: a.addr, type: default, offset: 0, size: 16, alignment: 16,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
body: |
bb.1.entry:
liveins: $q0
stack:
- { id: 0, name: retval, type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.1:
stack:
- { id : 0, size: 8, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -4, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -4, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
body: |
bb.0:
isImmutable: false, isAliased: false, callee-saved-register: '' }
stack:
- { id: 0, name: scratch0, type: default, offset: 4, size: 32768, alignment: 4,
- stack-id: 0, callee-saved-register: '', local-offset: 0, di-variable: '',
- di-expression: '', di-location: '' }
+ stack-id: 0, callee-saved-register: '', local-offset: 0,
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 1, name: scratch1, type: default, offset: 32772, size: 32768,
alignment: 4, stack-id: 0, callee-saved-register: '', local-offset: 32768,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0.entry:
isImmutable: false, isAliased: false, callee-saved-register: '' }
stack:
- { id: 0, name: scratch0, type: default, offset: 4, size: 32768, alignment: 4,
- stack-id: 0, callee-saved-register: '', local-offset: 0, di-variable: '',
- di-expression: '', di-location: '' }
+ stack-id: 0, callee-saved-register: '', local-offset: 0,
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 1, name: scratch1, type: default, offset: 32772, size: 32768,
alignment: 4, stack-id: 0, callee-saved-register: '', local-offset: 32768,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0.entry:
isImmutable: false, isAliased: false, callee-saved-register: '' }
stack:
- { id: 0, name: scratch0, type: default, offset: 4, size: 32768, alignment: 4,
- stack-id: 0, callee-saved-register: '', local-offset: 0, di-variable: '',
- di-expression: '', di-location: '' }
+ stack-id: 0, callee-saved-register: '', local-offset: 0,
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 1, name: scratch1, type: default, offset: 32772, size: 32768,
alignment: 4, stack-id: 0, callee-saved-register: '', local-offset: 32768,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0.entry:
stack:
- { id: 0, name: tmp5, type: default, offset: 0, size: 128, alignment: 16,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: 0, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: 0, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0.bb:
- { id: 2, class: vgpr_32 }
stack:
- { id: 0, name: "", type: default, offset: 0, size: 128, alignment: 8,
- callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
- di-location: '' }
+ callee-saved-register: '', local-offset: 0, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
body: |
bb.0:
stack:
- { id: 0, name: '', type: spill-slot, offset: 0, size: 8, alignment: 4,
stack-id: 1, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0:
stack:
- { id: 0, name: '', type: spill-slot, offset: 0, size: 8, alignment: 4,
stack-id: 1, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0:
- { id: 2, class: vgpr_32 }
stack:
- { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
- callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
- di-location: '' }
+ callee-saved-register: '', local-offset: 0, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
body: |
bb.0:
%0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
- { id: 2, class: vgpr_32 }
stack:
- { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
- callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
- di-location: '' }
+ callee-saved-register: '', local-offset: 0, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
body: |
bb.0:
%0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
- { id: 2, class: vgpr_32 }
stack:
- { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
- callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
- di-location: '' }
+ callee-saved-register: '', local-offset: 0, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
body: |
bb.0:
%0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
- { id: 2, class: vgpr_32 }
stack:
- { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
- callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
- di-location: '' }
+ callee-saved-register: '', local-offset: 0, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
body: |
bb.0:
%0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
- { id: 2, class: vgpr_32 }
stack:
- { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
- callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
- di-location: '' }
+ callee-saved-register: '', local-offset: 0, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
body: |
bb.0:
%0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
- { id: 2, class: vgpr_32 }
stack:
- { id: 0, name: alloca, type: default, offset: 0, size: 128, alignment: 8,
- callee-saved-register: '', local-offset: 0, di-variable: '', di-expression: '',
- di-location: '' }
+ callee-saved-register: '', local-offset: 0, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
body: |
bb.0:
%0 = V_MOV_B32_e32 %stack.0.alloca, implicit $exec
stack:
- { id: 0, name: res, type: default, offset: -2, size: 2, alignment: 2,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -2, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -2, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
- id: 0
value: half 0xH706B
stack:
- { id: 0, name: res, type: default, offset: -2, size: 2, alignment: 2,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -2, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -2, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
- id: 0
value: half 0xH706B
stack:
- { id: 0, type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -4, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -4, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 1, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -16, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -16, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 2, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -24, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -24, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 3, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -32, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -32, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 4, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -40, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -40, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 5, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -48, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -48, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 6, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -56, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -56, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0:
stack:
- { id: 0, type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -4, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -4, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 1, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -16, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -16, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 2, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -24, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -24, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 3, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -32, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -32, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 4, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -40, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -40, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 5, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -48, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -48, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 6, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -56, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -56, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0:
# CHECK: stack:
# CHECK: - { id: 0, name: local_var, type: default, offset: 0, size: 8, alignment: 8,
# CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
-# CHECK-NEXT: local-offset: -8, di-variable: '', di-expression: '', di-location: '' }
+# CHECK-NEXT: local-offset: -8, debug-info-variable: '', debug-info-expression: '',
+# CHECK-NEXT: debug-info-location: '' }
stack:
- { id: 0,name: local_var,offset: 0,size: 8,alignment: 8, local-offset: -8 }
body: |
adjustsStack: true
hasCalls: true
# CHECK: fixedStack:
-# CHECK: callee-saved-register: '$rbx', callee-saved-restored: true }
+# CHECK: callee-saved-register: '$rbx', callee-saved-restored: true
fixedStack:
- { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$rbx' }
# CHECK: stack:
liveins:
- { reg: '$edi' }
stack:
-# CHECK: [[@LINE+1]]:74: expected a metadata node
- - { id: 0, name: xa, offset: -12, size: 4, alignment: 4, di-variable: '0' }
+ - { id: 0, name: xa, offset: -12, size: 4, alignment: 4,
+# CHECK: [[@LINE+1]]:29: expected a metadata node
+ debug-info-variable: '0' }
body: |
bb.0.entry:
liveins: $edi
--- /dev/null
+# RUN: llc -mtriple=x86_64-apple-unknown -run-pass none %s -o /dev/null
+# Check that we parse the 'debug-info-*' fields for `fixedStack:` entries.
+
+--- |
+
+ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+ target triple = "x86_64-apple-unknown"
+
+ declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
+
+ define hidden void @foo(i32* byval %dstRect) {
+ entry:
+ call void @llvm.dbg.declare(metadata i32* %dstRect, metadata !3, metadata !DIExpression()), !dbg !5
+ unreachable
+ }
+
+ attributes #0 = { nounwind readnone speculatable }
+
+ !llvm.dbg.cu = !{!0}
+ !llvm.module.flags = !{!2}
+
+ !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
+ !1 = !DIFile(filename: "file.cpp", directory: "/dir")
+ !2 = !{i32 2, !"Debug Info Version", i32 3}
+ !3 = !DILocalVariable(name: "dstRect", scope: !4)
+ !4 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !0, file: !1, line: 42, unit: !0)
+ !5 = !DILocation(line: 42, column: 85, scope: !4)
+
+...
+---
+name: foo
+alignment: 4
+tracksRegLiveness: true
+frameInfo:
+ maxAlignment: 8
+fixedStack:
+ - { id: 0, size: 4, alignment: 16, stack-id: 0, debug-info-variable: '!3', debug-info-expression: '!DIExpression()',
+ debug-info-location: '!5' }
+body: |
+ bb.0.entry:
+
+...
frameInfo:
maxAlignment: 16
stack:
-# CHECK: [[@LINE+1]]:75: expected a reference to a 'DILocalVariable' metadata node
- - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!8',
- di-expression: '!7', di-location: '!8' }
+ - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16,
+# CHECK: [[@LINE+1]]:28: expected a reference to a 'DILocalVariable' metadata node
+ debug-info-variable: '!8', debug-info-expression: '!7',
+ debug-info-location: '!8' }
body: |
bb.0.entry:
successors: %bb.1.for.body
maxAlignment: 4
# CHECK: fixedStack:
# CHECK-NEXT: - { id: 0, type: spill-slot, offset: 0, size: 4, alignment: 4, stack-id: 0,
-# CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true }
+# CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true, debug-info-variable: '',
+# CHECK-NEXT: debug-info-expression: '', debug-info-location: '' }
fixedStack:
- { id: 0, type: spill-slot, offset: 0, size: 4, alignment: 4 }
stack:
# CHECK: stack:
# CHECK: - { id: 0, name: y.i, type: default, offset: 0, size: 256, alignment: 16,
# CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true,
-# CHECK-NEXT: di-variable: '!4', di-expression: '!DIExpression()', di-location: '!10' }
+# CHECK-NEXT: debug-info-variable: '!4', debug-info-expression: '!DIExpression()',
+# CHECK-NEXT: debug-info-location: '!10' }
stack:
- - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4',
- di-expression: '!DIExpression()', di-location: '!7' }
+ - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16,
+ debug-info-variable: '!4', debug-info-expression: '!DIExpression()',
+ debug-info-location: '!7' }
body: |
bb.0.entry:
successors: %bb.1.for.body
# CHECK: stack:
# CHECK-NEXT: - { id: 0, name: b, type: default, offset: -12, size: 4, alignment: 4,
# CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
-# CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
+# CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
# CHECK-NEXT: - { id: 1, name: x, type: default, offset: -24, size: 8, alignment: 8,
# CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
-# CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
+# CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
# CHECK-NEXT: - { id: 2, name: '', type: spill-slot, offset: -32, size: 4, alignment: 4,
# CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
-# CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
+# CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
stack:
- { id: 0, name: b, offset: -12, size: 4, alignment: 4 }
- { id: 1, name: x, offset: -24, size: 8, alignment: 8 }
# CHECK: stack:
# CHECK-NEXT: - { id: 0, name: '', type: default, offset: -20, size: 4, alignment: 4,
# CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
-# CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
+# CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
# CHECK-NEXT: - { id: 1, name: '', type: default, offset: -32, size: 8, alignment: 8,
# CHECK-NEXT: stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
-# CHECK-NEXT: di-variable: '', di-expression: '', di-location: '' }
+# CHECK-NEXT: debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
# CHECK-NEXT: - { id: 2, name: y, type: variable-sized, offset: -32, alignment: 1,
stack:
- { id: 0, offset: -20, size: 4, alignment: 4 }
stack:
- { id: 0, name: z.addr, type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0.entry:
stack:
- { id: 0, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '$ra', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0.entry:
fixedStack:
stack:
- { id: 0, name: retval, type: default, offset: 0, size: 16, alignment: 16,
- callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
+ callee-saved-register: '', debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
- { id: 1, name: a, type: default, offset: 0, size: 16, alignment: 16,
- callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
+ callee-saved-register: '', debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
- { id: 2, name: b, type: default, offset: 0, size: 16, alignment: 16,
- callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
+ callee-saved-register: '', debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
- { id: 3, name: a.addr, type: default, offset: 0, size: 16, alignment: 16,
- callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
+ callee-saved-register: '', debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
- { id: 4, name: b.addr, type: default, offset: 0, size: 16, alignment: 16,
- callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
+ callee-saved-register: '', debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
- { id: 5, name: c.addr, type: default, offset: 0, size: 4, alignment: 4,
- callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
+ callee-saved-register: '', debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
- { id: 6, name: g, type: default, offset: 0, size: 8, alignment: 8,
- callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
+ callee-saved-register: '', debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
- { id: 7, name: d, type: default, offset: 0, size: 8, alignment: 8,
- callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
+ callee-saved-register: '', debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
- { id: 8, name: '', type: default, offset: 0, size: 6400,
- alignment: 16, callee-saved-register: '', di-variable: '', di-expression: '', di-location: '' }
+ alignment: 16, callee-saved-register: '', debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
constants:
body: |
bb.0.entry:
stack:
- { id: 0, name: '', type: default, offset: 0, size: 16, alignment: 16,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -16, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -16, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 1, name: '', type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -20, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -20, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 2, name: '', type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -24, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -24, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 3, name: '', type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -28, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -28, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 4, name: '', type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- local-offset: -32, di-variable: '', di-expression: '', di-location: '' }
+ local-offset: -32, debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0.entry:
stack:
- { id: 0, name: ptr1, type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
body: |
bb.1 (%ir-block.0):
stack:
- { id: 0, name: ptr1, type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
body: |
bb.1 (%ir-block.0):
stack:
- { id: 0, name: ptr1, type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
body: |
bb.1 (%ir-block.0):
--- /dev/null
+; RUN: llc -mtriple=x86_64-apple-unknown -stop-before=expand-isel-pseudos %s -o - -simplify-mir | FileCheck %s
+; The byval argument of the function will be allocated a fixed stack slot. Test
+; that we serialize the fixed slot correctly.
+
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-unknown"
+
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
+
+define hidden void @foo(i32* byval %dstRect) {
+; CHECK-LABEL: name: foo
+entry:
+ call void @llvm.dbg.declare(metadata i32* %dstRect, metadata !3, metadata !DIExpression()), !dbg !5
+; CHECK: fixedStack:
+; CHECK: id: 0
+; CHECK: debug-info-variable: '!3'
+; CHECK: debug-info-expression: '!DIExpression()'
+; CHECK: debug-info-location: '!5'
+ unreachable
+}
+
+attributes #0 = { nounwind readnone speculatable }
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!2}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1)
+!1 = !DIFile(filename: "file.cpp", directory: "/dir")
+!2 = !{i32 2, !"Debug Info Version", i32 3}
+!3 = !DILocalVariable(name: "dstRect", scope: !4)
+!4 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !0, file: !1, line: 42, unit: !0)
+!5 = !DILocation(line: 42, column: 85, scope: !4)
stack:
- { id: 0, name: p, type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 1, name: q, type: default, offset: 0, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 2, name: s, type: default, offset: 0, size: 8, alignment: 8,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0.entry:
stack:
- { id: 0, name: alpha, type: default, offset: 0, size: 1, alignment: 1,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
- { id: 1, name: foxtrot, type: default, offset: 0, size: 16, alignment: 16,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
- { id: 2, name: india, type: default, offset: 0, size: 16, alignment: 16,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0.entry:
fixedStack:
stack:
- { id: 0, name: bz, type: default, offset: -32, size: 16, alignment: 8,
- callee-saved-register: '', local-offset: -16, di-variable: '', di-expression: '',
- di-location: '' }
+ callee-saved-register: '', local-offset: -16, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
- { id: 1, name: att, type: default, offset: -48, size: 16, alignment: 8,
- callee-saved-register: '', local-offset: -32, di-variable: '', di-expression: '',
- di-location: '' }
+ callee-saved-register: '', local-offset: -32, debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
- { id: 2, name: '', type: spill-slot, offset: -16, size: 8, alignment: 16,
- callee-saved-register: '$lr', di-variable: '', di-expression: '',
- di-location: '' }
+ callee-saved-register: '$lr', debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
constants:
body: |
bb.0.entry:
stack:
- { id: 0, name: condition, type: default, offset: -12, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 1, name: '', type: spill-slot, offset: -4, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '$ra', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 2, name: '', type: spill-slot, offset: -8, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '$s0', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0.entry:
stack:
- { id: 0, name: '', type: spill-slot, offset: -64, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
- { id: 1, name: '', type: spill-slot, offset: -60, size: 4, alignment: 4,
stack-id: 0, callee-saved-register: '', callee-saved-restored: true,
- di-variable: '', di-expression: '', di-location: '' }
+ debug-info-variable: '', debug-info-expression: '',
+ debug-info-location: '' }
constants:
body: |
bb.0.entry:
fixedStack:
stack:
- { id: 0, name: x.addr, type: default, offset: 0, size: 4, alignment: 4,
- stack-id: 0, callee-saved-register: '', di-variable: '', di-expression: '',
- di-location: '' }
+ stack-id: 0, callee-saved-register: '', debug-info-variable: '',
+ debug-info-expression: '', debug-info-location: '' }
constants:
body: |
bb.0.entry: