void MIPrinter::print(const MCCFIInstruction &CFI, const TargetRegisterInfo *TRI) { switch (CFI.getOperation()) { case MCCFIInstruction::OpOffset: OS << ".cfi_offset "; if (CFI.getLabel()) OS << "<mcsymbol> "; 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()) OS << "<mcsymbol> "; OS << CFI.getOffset(); break; case MCCFIInstruction::OpDefCfa: OS << ".cfi_def_cfa "; if (CFI.getLabel()) OS << "<mcsymbol> "; printCFIRegister(CFI.getRegister(), OS, TRI); OS << ", " << CFI.getOffset(); break; default: // TODO: Print the other CFI Operations. OS << "<unserializable cfi operation>"; break; } }
static void printCFI(raw_ostream &OS, const MCCFIInstruction &CFI, const TargetRegisterInfo *TRI) { switch (CFI.getOperation()) { case MCCFIInstruction::OpSameValue: OS << "same_value "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); printCFIRegister(CFI.getRegister(), OS, TRI); break; case MCCFIInstruction::OpRememberState: OS << "remember_state "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); break; case MCCFIInstruction::OpRestoreState: OS << "restore_state "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); break; case MCCFIInstruction::OpOffset: OS << "offset "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); printCFIRegister(CFI.getRegister(), OS, TRI); OS << ", " << CFI.getOffset(); break; case MCCFIInstruction::OpDefCfaRegister: OS << "def_cfa_register "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); printCFIRegister(CFI.getRegister(), OS, TRI); break; case MCCFIInstruction::OpDefCfaOffset: OS << "def_cfa_offset "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); OS << CFI.getOffset(); break; case MCCFIInstruction::OpDefCfa: OS << "def_cfa "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); printCFIRegister(CFI.getRegister(), OS, TRI); OS << ", " << CFI.getOffset(); break; case MCCFIInstruction::OpRelOffset: OS << "rel_offset "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); printCFIRegister(CFI.getRegister(), OS, TRI); OS << ", " << CFI.getOffset(); break; case MCCFIInstruction::OpAdjustCfaOffset: OS << "adjust_cfa_offset "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); OS << CFI.getOffset(); break; case MCCFIInstruction::OpRestore: OS << "restore "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); printCFIRegister(CFI.getRegister(), OS, TRI); break; case MCCFIInstruction::OpEscape: { OS << "escape "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); if (!CFI.getValues().empty()) { size_t e = CFI.getValues().size() - 1; for (size_t i = 0; i < e; ++i) OS << format("0x%02x", uint8_t(CFI.getValues()[i])) << ", "; OS << format("0x%02x", uint8_t(CFI.getValues()[e])) << ", "; } break; } case MCCFIInstruction::OpUndefined: OS << "undefined "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); printCFIRegister(CFI.getRegister(), OS, TRI); break; case MCCFIInstruction::OpRegister: OS << "register "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); printCFIRegister(CFI.getRegister(), OS, TRI); OS << ", "; printCFIRegister(CFI.getRegister2(), OS, TRI); break; case MCCFIInstruction::OpWindowSave: OS << "window_save "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); break; case MCCFIInstruction::OpNegateRAState: OS << "negate_ra_sign_state "; if (MCSymbol *Label = CFI.getLabel()) MachineOperand::printSymbol(OS, *Label); break; default: // TODO: Print the other CFI Operations. OS << "<unserializable cfi directive>"; break; } }