void AArch64TargetWinCOFFStreamer::EmitARM64WinCFIEpilogEnd() { auto &S = getStreamer(); WinEH::FrameInfo *CurFrame = S.EnsureValidWinFrameInfo(SMLoc()); if (!CurFrame) return; InEpilogCFI = false; MCSymbol *Label = S.EmitCFILabel(); WinEH::Instruction Inst = WinEH::Instruction(Win64EH::UOP_End, Label, -1, 0); CurFrame->EpilogMap[CurrentEpilog].push_back(Inst); CurrentEpilog = nullptr; }
// The functions below handle opcodes that can end up in either a prolog or // an epilog, but not both. void AArch64TargetWinCOFFStreamer::EmitARM64WinCFIPrologEnd() { auto &S = getStreamer(); WinEH::FrameInfo *CurFrame = S.EnsureValidWinFrameInfo(SMLoc()); if (!CurFrame) return; MCSymbol *Label = S.EmitCFILabel(); CurFrame->PrologEnd = Label; WinEH::Instruction Inst = WinEH::Instruction(Win64EH::UOP_End, Label, -1, 0); auto it = CurFrame->Instructions.begin(); CurFrame->Instructions.insert(it, Inst); }
// Helper function to common out unwind code setup for those codes that can // belong to both prolog and epilog. // There are three types of Windows ARM64 SEH codes. They can // 1) take no operands: SEH_Nop, SEH_PrologEnd, SEH_EpilogStart, SEH_EpilogEnd // 2) take an offset: SEH_StackAlloc, SEH_SaveFPLR, SEH_SaveFPLR_X // 3) take a register and an offset/size: all others void AArch64TargetWinCOFFStreamer::EmitARM64WinUnwindCode(unsigned UnwindCode, int Reg, int Offset) { auto &S = getStreamer(); WinEH::FrameInfo *CurFrame = S.EnsureValidWinFrameInfo(SMLoc()); if (!CurFrame) return; MCSymbol *Label = S.EmitCFILabel(); auto Inst = WinEH::Instruction(UnwindCode, Label, Reg, Offset); if (InEpilogCFI) CurFrame->EpilogMap[CurrentEpilog].push_back(Inst); else CurFrame->Instructions.push_back(Inst); }
void AVRTargetStreamer::finish() { MCStreamer &OS = getStreamer(); MCContext &Context = OS.getContext(); MCSymbol *DoCopyData = Context.getOrCreateSymbol("__do_copy_data"); MCSymbol *DoClearBss = Context.getOrCreateSymbol("__do_clear_bss"); // FIXME: We can disable __do_copy_data if there are no static RAM variables. OS.emitRawComment(" Declaring this symbol tells the CRT that it should"); OS.emitRawComment("copy all variables from program memory to RAM on startup"); OS.EmitSymbolAttribute(DoCopyData, MCSA_Global); OS.emitRawComment(" Declaring this symbol tells the CRT that it should"); OS.emitRawComment("clear the zeroed data section on startup"); OS.EmitSymbolAttribute(DoClearBss, MCSA_Global); }