From 167e7afcd52bc1438d60320ec1d1bc53b8eae4a3 Mon Sep 17 00:00:00 2001 From: RamNalamothu Date: Mon, 14 Jun 2021 06:57:58 +0530 Subject: Implement DW_CFA_LLVM_* for Heterogeneous Debugging Add support in MC/MIR for writing/parsing, and DebugInfo. This is part of the Extensions for Heterogeneous Debugging defined at https://llvm.org/docs/AMDGPUDwarfExtensionsForHeterogeneousDebugging.html Specifically the CFI instructions implemented here are defined at https://llvm.org/docs/AMDGPUDwarfExtensionsForHeterogeneousDebugging.html#cfa-definition-instructions Reviewed By: clayborg Differential Revision: https://reviews.llvm.org/D76877 --- llvm/lib/MC/MCStreamer.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'llvm/lib/MC/MCStreamer.cpp') diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index 5d06240..2a1998f 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -444,7 +444,8 @@ void MCStreamer::emitCFIStartProc(bool IsSimple, SMLoc Loc) { if (MAI) { for (const MCCFIInstruction& Inst : MAI->getInitialFrameState()) { if (Inst.getOperation() == MCCFIInstruction::OpDefCfa || - Inst.getOperation() == MCCFIInstruction::OpDefCfaRegister) { + Inst.getOperation() == MCCFIInstruction::OpDefCfaRegister || + Inst.getOperation() == MCCFIInstruction::OpLLVMDefAspaceCfa) { Frame.CurrentCfaRegister = Inst.getRegister(); } } @@ -517,6 +518,18 @@ void MCStreamer::emitCFIDefCfaRegister(int64_t Register) { CurFrame->CurrentCfaRegister = static_cast(Register); } +void MCStreamer::emitCFILLVMDefAspaceCfa(int64_t Register, int64_t Offset, + int64_t AddressSpace) { + MCSymbol *Label = emitCFILabel(); + MCCFIInstruction Instruction = MCCFIInstruction::createLLVMDefAspaceCfa( + Label, Register, Offset, AddressSpace); + MCDwarfFrameInfo *CurFrame = getCurrentDwarfFrameInfo(); + if (!CurFrame) + return; + CurFrame->Instructions.push_back(Instruction); + CurFrame->CurrentCfaRegister = static_cast(Register); +} + void MCStreamer::emitCFIOffset(int64_t Register, int64_t Offset) { MCSymbol *Label = emitCFILabel(); MCCFIInstruction Instruction = -- cgit v1.1