mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 04:09:45 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212881 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dafce2c9a6
commit
8e69909cc2
@ -180,9 +180,9 @@ class MCStreamer {
|
||||
MCSymbol *EmitCFICommon();
|
||||
void EnsureValidFrame();
|
||||
|
||||
std::vector<MCWin64EHUnwindInfo *> W64UnwindInfos;
|
||||
MCWin64EHUnwindInfo *CurrentW64UnwindInfo;
|
||||
void setCurrentW64UnwindInfo(MCWin64EHUnwindInfo *Frame);
|
||||
std::vector<MCWinFrameInfo *> 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<MCWin64EHUnwindInfo *> getW64UnwindInfos() const {
|
||||
ArrayRef<MCWinFrameInfo *> getW64UnwindInfos() const {
|
||||
return W64UnwindInfos;
|
||||
}
|
||||
|
||||
|
@ -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<MCWin64EHInstruction> 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
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user