//------------------------------------------------------------------------ // Compiler::unwindSetFrameRegCFI: Record a cfi info for a frame register set. // // Arguments: // reg - The register being set as the frame register. // offset - The offset from the current stack pointer that the frame pointer will point at. // void Compiler::unwindSetFrameRegCFI(regNumber reg, unsigned offset) { #if defined(_TARGET_ARM_) assert(compGeneratingEpilog); #else assert(compGeneratingProlog); #endif FuncInfoDsc* func = funCurrentFunc(); unsigned int cbProlog = 0; if (compGeneratingProlog) { cbProlog = unwindGetCurrentOffset(func); noway_assert((BYTE)cbProlog == cbProlog); } createCfiCode(func, cbProlog, CFI_DEF_CFA_REGISTER, mapRegNumToDwarfReg(reg)); if (offset != 0) { // before: cfa = rsp + old_cfa_offset; // rbp = rsp + offset; // after: cfa should be based on rbp, but points to the old address: // rsp + old_cfa_offset == rbp + old_cfa_offset + adjust; // adjust = -offset; int adjust = -(int)offset; createCfiCode(func, cbProlog, CFI_ADJUST_CFA_OFFSET, DWARF_REG_ILLEGAL, adjust); } }
void Compiler::unwindPushPopCFI(regNumber reg) { #if defined(_TARGET_ARM_) assert(compGeneratingEpilog); #else assert(compGeneratingProlog); #endif FuncInfoDsc* func = funCurrentFunc(); unsigned int cbProlog = 0; if (compGeneratingProlog) { cbProlog = unwindGetCurrentOffset(func); noway_assert((BYTE)cbProlog == cbProlog); createCfiCode(func, cbProlog, CFI_ADJUST_CFA_OFFSET, DWARF_REG_ILLEGAL, REGSIZE_BYTES == 8 ? 8 : 4); } if ((RBM_CALLEE_SAVED & genRegMask(reg)) #if defined(UNIX_AMD64_ABI) #if ETW_EBP_FRAMED // In case of ETW_EBP_FRAMED defined the REG_FPBASE (RBP) // is excluded from the callee-save register list. // Make sure the register gets PUSH unwind info in this case, // since it is pushed as a frame register. || (reg == REG_FPBASE) #endif // ETW_EBP_FRAMED #endif ) { createCfiCode(func, cbProlog, CFI_REL_OFFSET, mapRegNumToDwarfReg(reg)); } }
void Compiler::unwindSetFrameRegCFI(regNumber reg, unsigned offset) { assert(compGeneratingProlog); FuncInfoDsc* func = funCurrentFunc(); unsigned int cbProlog = unwindGetCurrentOffset(func); noway_assert((BYTE)cbProlog == cbProlog); createCfiCode(func, cbProlog, CFI_DEF_CFA_REGISTER, mapRegNumToDwarfReg(reg)); if (offset != 0) { createCfiCode(func, cbProlog, CFI_ADJUST_CFA_OFFSET, DWARF_REG_ILLEGAL, offset); } }
void Compiler::unwindAllocStackCFI(unsigned size) { assert(compGeneratingProlog); FuncInfoDsc* func = funCurrentFunc(); unsigned int cbProlog = unwindGetCurrentOffset(func); noway_assert((BYTE)cbProlog == cbProlog); createCfiCode(func, cbProlog, CFI_ADJUST_CFA_OFFSET, DWARF_REG_ILLEGAL, size); }
void Compiler::unwindSaveRegCFI(regNumber reg, unsigned offset) { assert(compGeneratingProlog); if (RBM_CALLEE_SAVED & genRegMask(reg)) { FuncInfoDsc* func = funCurrentFunc(); unsigned int cbProlog = unwindGetCurrentOffset(func); noway_assert((BYTE)cbProlog == cbProlog); createCfiCode(func, cbProlog, CFI_REL_OFFSET, mapRegNumToDwarfReg(reg), offset); } }
void Compiler::unwindAllocStackCFI(unsigned size) { #if defined(_TARGET_ARM_) assert(compGeneratingEpilog); #else assert(compGeneratingProlog); #endif FuncInfoDsc* func = funCurrentFunc(); unsigned int cbProlog = 0; if (compGeneratingProlog) { cbProlog = unwindGetCurrentOffset(func); noway_assert((BYTE)cbProlog == cbProlog); } createCfiCode(func, cbProlog, CFI_ADJUST_CFA_OFFSET, DWARF_REG_ILLEGAL, size); }