.Case("frame-setup", MIToken::kw_frame_setup)
.Case("debug-location", MIToken::kw_debug_location)
.Case(".cfi_offset", MIToken::kw_cfi_offset)
+ .Case(".cfi_def_cfa_register", MIToken::kw_cfi_def_cfa_register)
.Case(".cfi_def_cfa_offset", MIToken::kw_cfi_def_cfa_offset)
.Default(MIToken::Identifier);
}
kw_frame_setup,
kw_debug_location,
kw_cfi_offset,
+ kw_cfi_def_cfa_register,
kw_cfi_def_cfa_offset,
// Identifier tokens
CFIIndex =
MMI.addFrameInst(MCCFIInstruction::createOffset(nullptr, Reg, Offset));
break;
+ case MIToken::kw_cfi_def_cfa_register:
+ if (parseCFIRegister(Reg))
+ return true;
+ CFIIndex =
+ MMI.addFrameInst(MCCFIInstruction::createDefCfaRegister(nullptr, Reg));
+ break;
case MIToken::kw_cfi_def_cfa_offset:
if (parseCFIOffset(Offset))
return true;
case MIToken::exclaim:
return parseMetadataOperand(Dest);
case MIToken::kw_cfi_offset:
+ case MIToken::kw_cfi_def_cfa_register:
case MIToken::kw_cfi_def_cfa_offset:
return parseCFIOperand(Dest);
case MIToken::Error:
printCFIRegister(CFI.getRegister(), OS, TRI);
OS << ", " << CFI.getOffset();
break;
+ case MCCFIInstruction::OpDefCfaRegister:
+ OS << ".cfi_def_cfa_register ";
+ if (CFI.getLabel())
+ OS << "<mcsymbol> ";
+ printCFIRegister(CFI.getRegister(), OS, TRI);
+ break;
case MCCFIInstruction::OpDefCfaOffset:
OS << ".cfi_def_cfa_offset ";
if (CFI.getLabel())
--- /dev/null
+# RUN: llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
+# This test ensures that the MIR parser parses the .cfi_def_cfa_register
+# operands correctly.
+
+--- |
+
+ define void @func() #0 {
+ entry:
+ unreachable
+ }
+
+ attributes #0 = { "no-frame-pointer-elim"="true" }
+
+...
+---
+name: func
+tracksRegLiveness: true
+frameInfo:
+ stackSize: 8
+fixedStack:
+ - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16 }
+body:
+ - id: 0
+ name: entry
+ liveins: [ '%rbp' ]
+ instructions:
+ - 'PUSH64r killed %rbp, implicit-def %rsp, implicit %rsp'
+ - 'CFI_INSTRUCTION .cfi_def_cfa_offset 16'
+ - 'CFI_INSTRUCTION .cfi_offset %rbp, -16'
+ - '%rbp = MOV64rr %rsp'
+ # CHECK: CFI_INSTRUCTION .cfi_def_cfa_register %rbp
+ - 'CFI_INSTRUCTION .cfi_def_cfa_register %rbp'
+...