From 4a1a2f77907c5fa6b13ca2b49aa499a7db0a9839 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Sat, 12 Jul 2014 20:49:09 +0000 Subject: [PATCH] MC: rename MCW64UnwindInfo to MCWinFrameInfo This structure contains information related to the call frame used to generate unwinding information. Rename this to reflect the future use to represent the shared state between various architectures for WinCFI information. llvm-svn: 212881 --- llvm/include/llvm/MC/MCStreamer.h | 12 ++++++------ llvm/include/llvm/MC/MCWin64EH.h | 8 ++++---- llvm/lib/MC/MCAsmStreamer.cpp | 2 +- llvm/lib/MC/MCStreamer.cpp | 34 +++++++++++++++++----------------- llvm/lib/MC/MCWin64EH.cpp | 6 +++--- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h index 216de75..c224c57 100644 --- a/llvm/include/llvm/MC/MCStreamer.h +++ b/llvm/include/llvm/MC/MCStreamer.h @@ -180,9 +180,9 @@ class MCStreamer { MCSymbol *EmitCFICommon(); void EnsureValidFrame(); - std::vector W64UnwindInfos; - MCWin64EHUnwindInfo *CurrentW64UnwindInfo; - void setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame); + std::vector W64UnwindInfos; + MCWinFrameInfo *CurrentW64UnwindInfo; + void setCurrentW64UnwindInfo(MCWinFrameInfo *Frame); void EnsureValidW64UnwindInfo(); // SymbolOrdering - Tracks an index to represent the order @@ -204,7 +204,7 @@ protected: virtual void EmitCFIStartProcImpl(MCDwarfFrameInfo &Frame); virtual void EmitCFIEndProcImpl(MCDwarfFrameInfo &CurFrame); - MCWin64EHUnwindInfo *getCurrentW64UnwindInfo() { + MCWinFrameInfo *getCurrentW64UnwindInfo() { return CurrentW64UnwindInfo; } void EmitW64Tables(); @@ -239,11 +239,11 @@ public: unsigned getNumW64UnwindInfos() { return W64UnwindInfos.size(); } - MCWin64EHUnwindInfo &getW64UnwindInfo(unsigned i) { + MCWinFrameInfo &getW64UnwindInfo(unsigned i) { return *W64UnwindInfos[i]; } - ArrayRef getW64UnwindInfos() const { + ArrayRef getW64UnwindInfos() const { return W64UnwindInfos; } diff --git a/llvm/include/llvm/MC/MCWin64EH.h b/llvm/include/llvm/MC/MCWin64EH.h index d21e762..7724843 100644 --- a/llvm/include/llvm/MC/MCWin64EH.h +++ b/llvm/include/llvm/MC/MCWin64EH.h @@ -60,8 +60,8 @@ namespace llvm { bool isPushCodeFrame() const { return Offset == 1; } }; - struct MCWin64EHUnwindInfo { - MCWin64EHUnwindInfo() + struct MCWinFrameInfo { + MCWinFrameInfo() : Begin(nullptr), End(nullptr),ExceptionHandler(nullptr), Function(nullptr), PrologEnd(nullptr), Symbol(nullptr), HandlesUnwind(false), HandlesExceptions(false), LastFrameInst(-1), @@ -75,7 +75,7 @@ namespace llvm { bool HandlesUnwind; bool HandlesExceptions; int LastFrameInst; - MCWin64EHUnwindInfo *ChainedParent; + MCWinFrameInfo *ChainedParent; std::vector Instructions; }; @@ -86,7 +86,7 @@ namespace llvm { // This emits the unwind info sections (.pdata and .xdata in PE/COFF). // static void Emit(MCStreamer &streamer); - static void EmitUnwindInfo(MCStreamer &streamer, MCWin64EHUnwindInfo *info); + static void EmitUnwindInfo(MCStreamer &streamer, MCWinFrameInfo *info); }; } // end namespace llvm diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp index 6973bbb..b48458c 100644 --- a/llvm/lib/MC/MCAsmStreamer.cpp +++ b/llvm/lib/MC/MCAsmStreamer.cpp @@ -1109,7 +1109,7 @@ void MCAsmStreamer::EmitWinEHHandlerData() { // cause the section switch to be visible in the emitted assembly. // We only do this so the section switch that terminates the handler // data block is visible. - MCWin64EHUnwindInfo *CurFrame = getCurrentW64UnwindInfo(); + MCWinFrameInfo *CurFrame = getCurrentW64UnwindInfo(); StringRef suffix=MCWin64EHUnwindEmitter::GetSectionSuffix(CurFrame->Function); const MCSection *xdataSect = getWin64EHTableSection(suffix, getContext()); if (xdataSect) diff --git a/llvm/lib/MC/MCStreamer.cpp b/llvm/lib/MC/MCStreamer.cpp index bdcdb97..335d32f 100644 --- a/llvm/lib/MC/MCStreamer.cpp +++ b/llvm/lib/MC/MCStreamer.cpp @@ -414,22 +414,22 @@ void MCStreamer::EmitCFIWindowSave() { CurFrame->Instructions.push_back(Instruction); } -void MCStreamer::setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame) { +void MCStreamer::setCurrentW64UnwindInfo(MCWinFrameInfo *Frame) { W64UnwindInfos.push_back(Frame); CurrentW64UnwindInfo = W64UnwindInfos.back(); } void MCStreamer::EnsureValidW64UnwindInfo() { - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; if (!CurFrame || CurFrame->End) report_fatal_error("No open Win64 EH frame function!"); } void MCStreamer::EmitWinCFIStartProc(const MCSymbol *Symbol) { - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; if (CurFrame && !CurFrame->End) report_fatal_error("Starting a function before ending the previous one!"); - MCWin64EHUnwindInfo *Frame = new MCWin64EHUnwindInfo; + MCWinFrameInfo *Frame = new MCWinFrameInfo; Frame->Begin = getContext().CreateTempSymbol(); Frame->Function = Symbol; EmitLabel(Frame->Begin); @@ -438,7 +438,7 @@ void MCStreamer::EmitWinCFIStartProc(const MCSymbol *Symbol) { void MCStreamer::EmitWinCFIEndProc() { EnsureValidW64UnwindInfo(); - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; if (CurFrame->ChainedParent) report_fatal_error("Not all chained regions terminated!"); CurFrame->End = getContext().CreateTempSymbol(); @@ -447,8 +447,8 @@ void MCStreamer::EmitWinCFIEndProc() { void MCStreamer::EmitWinCFIStartChained() { EnsureValidW64UnwindInfo(); - MCWin64EHUnwindInfo *Frame = new MCWin64EHUnwindInfo; - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *Frame = new MCWinFrameInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; Frame->Begin = getContext().CreateTempSymbol(); Frame->Function = CurFrame->Function; Frame->ChainedParent = CurFrame; @@ -458,7 +458,7 @@ void MCStreamer::EmitWinCFIStartChained() { void MCStreamer::EmitWinCFIEndChained() { EnsureValidW64UnwindInfo(); - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; if (!CurFrame->ChainedParent) report_fatal_error("End of a chained region outside a chained region!"); CurFrame->End = getContext().CreateTempSymbol(); @@ -469,7 +469,7 @@ void MCStreamer::EmitWinCFIEndChained() { void MCStreamer::EmitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except) { EnsureValidW64UnwindInfo(); - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; if (CurFrame->ChainedParent) report_fatal_error("Chained unwind areas can't have handlers!"); CurFrame->ExceptionHandler = Sym; @@ -483,14 +483,14 @@ void MCStreamer::EmitWinEHHandler(const MCSymbol *Sym, bool Unwind, void MCStreamer::EmitWinEHHandlerData() { EnsureValidW64UnwindInfo(); - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; if (CurFrame->ChainedParent) report_fatal_error("Chained unwind areas can't have handlers!"); } void MCStreamer::EmitWinCFIPushReg(unsigned Register) { EnsureValidW64UnwindInfo(); - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; MCSymbol *Label = getContext().CreateTempSymbol(); MCWin64EHInstruction Inst(Win64EH::UOP_PushNonVol, Label, Register); EmitLabel(Label); @@ -499,7 +499,7 @@ void MCStreamer::EmitWinCFIPushReg(unsigned Register) { void MCStreamer::EmitWinCFISetFrame(unsigned Register, unsigned Offset) { EnsureValidW64UnwindInfo(); - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; if (CurFrame->LastFrameInst >= 0) report_fatal_error("Frame register and offset already specified!"); if (Offset & 0x0F) @@ -519,7 +519,7 @@ void MCStreamer::EmitWinCFIAllocStack(unsigned Size) { report_fatal_error("Allocation size must be non-zero!"); if (Size & 7) report_fatal_error("Misaligned stack allocation!"); - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; MCSymbol *Label = getContext().CreateTempSymbol(); MCWin64EHInstruction Inst(Label, Size); EmitLabel(Label); @@ -530,7 +530,7 @@ void MCStreamer::EmitWinCFISaveReg(unsigned Register, unsigned Offset) { EnsureValidW64UnwindInfo(); if (Offset & 7) report_fatal_error("Misaligned saved register offset!"); - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; MCSymbol *Label = getContext().CreateTempSymbol(); MCWin64EHInstruction Inst( Offset > 512*1024-8 ? Win64EH::UOP_SaveNonVolBig : Win64EH::UOP_SaveNonVol, @@ -543,7 +543,7 @@ void MCStreamer::EmitWinCFISaveXMM(unsigned Register, unsigned Offset) { EnsureValidW64UnwindInfo(); if (Offset & 0x0F) report_fatal_error("Misaligned saved vector register offset!"); - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; MCSymbol *Label = getContext().CreateTempSymbol(); MCWin64EHInstruction Inst( Offset > 512*1024-16 ? Win64EH::UOP_SaveXMM128Big : Win64EH::UOP_SaveXMM128, @@ -554,7 +554,7 @@ void MCStreamer::EmitWinCFISaveXMM(unsigned Register, unsigned Offset) { void MCStreamer::EmitWinCFIPushFrame(bool Code) { EnsureValidW64UnwindInfo(); - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; if (CurFrame->Instructions.size() > 0) report_fatal_error("If present, PushMachFrame must be the first UOP"); MCSymbol *Label = getContext().CreateTempSymbol(); @@ -565,7 +565,7 @@ void MCStreamer::EmitWinCFIPushFrame(bool Code) { void MCStreamer::EmitWinCFIEndProlog() { EnsureValidW64UnwindInfo(); - MCWin64EHUnwindInfo *CurFrame = CurrentW64UnwindInfo; + MCWinFrameInfo *CurFrame = CurrentW64UnwindInfo; CurFrame->PrologEnd = getContext().CreateTempSymbol(); EmitLabel(CurFrame->PrologEnd); } diff --git a/llvm/lib/MC/MCWin64EH.cpp b/llvm/lib/MC/MCWin64EH.cpp index bb651647..94e4ed6 100644 --- a/llvm/lib/MC/MCWin64EH.cpp +++ b/llvm/lib/MC/MCWin64EH.cpp @@ -138,7 +138,7 @@ static void EmitSymbolRefWithOfs(MCStreamer &streamer, } static void EmitRuntimeFunction(MCStreamer &streamer, - const MCWin64EHUnwindInfo *info) { + const MCWinFrameInfo *info) { MCContext &context = streamer.getContext(); streamer.EmitValueToAlignment(4); @@ -149,7 +149,7 @@ static void EmitRuntimeFunction(MCStreamer &streamer, context), 4); } -static void EmitUnwindInfo(MCStreamer &streamer, MCWin64EHUnwindInfo *info) { +static void EmitUnwindInfo(MCStreamer &streamer, MCWinFrameInfo *info) { // If this UNWIND_INFO already has a symbol, it's already been emitted. if (info->Symbol) return; @@ -259,7 +259,7 @@ static const MCSection *getWin64EHFuncTableSection(StringRef suffix, } void MCWin64EHUnwindEmitter::EmitUnwindInfo(MCStreamer &streamer, - MCWin64EHUnwindInfo *info) { + MCWinFrameInfo *info) { // Switch sections (the static function above is meant to be called from // here and from Emit(). MCContext &context = streamer.getContext(); -- 2.7.4