X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FMC%2FMCWin64EH.h;h=eb4665a2e994c2106e8e41119fcecfdcda2299b8;hb=a2a47d1c50a7acecd729109c334ce3c496f0d549;hp=b7513c8867a10c0f0cd68df3e2d66fc0d47eab6a;hpb=fa89218a438c0fcafb40775bdc04dbe95c59fba3;p=oota-llvm.git diff --git a/include/llvm/MC/MCWin64EH.h b/include/llvm/MC/MCWin64EH.h index b7513c8867a..eb4665a2e99 100644 --- a/include/llvm/MC/MCWin64EH.h +++ b/include/llvm/MC/MCWin64EH.h @@ -7,19 +7,20 @@ // //===----------------------------------------------------------------------===// // -// This file contains the declaration of the MCDwarfFile to support the dwarf -// .file directive and the .loc directive. +// This file contains declarations to support the Win64 Exception Handling +// scheme in MC. // //===----------------------------------------------------------------------===// #ifndef LLVM_MC_MCWIN64EH_H #define LLVM_MC_MCWIN64EH_H -#include "llvm/CodeGen/MachineLocation.h" // FIXME #include "llvm/Support/Win64EH.h" +#include #include namespace llvm { + class StringRef; class MCStreamer; class MCSymbol; @@ -28,63 +29,64 @@ namespace llvm { typedef Win64EH::UnwindOpcodes OpType; private: OpType Operation; + MCSymbol *Label; unsigned Offset; - MachineLocation Destination; - MachineLocation Source; + unsigned Register; public: - MCWin64EHInstruction(OpType Op, unsigned Register) - : Operation(Op), Offset(0), Destination(0), Source(Register) { - assert(Op == Win64EH::UOP_PushNonVol); + MCWin64EHInstruction(OpType Op, MCSymbol *L, unsigned Reg) + : Operation(Op), Label(L), Offset(0), Register(Reg) { + assert(Op == Win64EH::UOP_PushNonVol); } - MCWin64EHInstruction(unsigned Size) + MCWin64EHInstruction(MCSymbol *L, unsigned Size) : Operation(Size>128 ? Win64EH::UOP_AllocLarge : Win64EH::UOP_AllocSmall), - Offset(Size) { } - MCWin64EHInstruction(unsigned Register, unsigned Off) - : Operation(Win64EH::UOP_SetFPReg), Offset(Off), Destination(Register) { } - MCWin64EHInstruction(OpType Op, const MachineLocation &D, - unsigned S) - : Operation(Op), Destination(D), Source(S) { - assert(Op == Win64EH::UOP_SaveNonVol || + Label(L), Offset(Size) { } + MCWin64EHInstruction(OpType Op, MCSymbol *L, unsigned Reg, unsigned Off) + : Operation(Op), Label(L), Offset(Off), Register(Reg) { + assert(Op == Win64EH::UOP_SetFPReg || + Op == Win64EH::UOP_SaveNonVol || Op == Win64EH::UOP_SaveNonVolBig || Op == Win64EH::UOP_SaveXMM128 || Op == Win64EH::UOP_SaveXMM128Big); } - MCWin64EHInstruction(OpType Op, bool Code) - : Operation(Op), Offset(Code ? 1 : 0) { + MCWin64EHInstruction(OpType Op, MCSymbol *L, bool Code) + : Operation(Op), Label(L), Offset(Code ? 1 : 0) { assert(Op == Win64EH::UOP_PushMachFrame); } OpType getOperation() const { return Operation; } + MCSymbol *getLabel() const { return Label; } unsigned getOffset() const { return Offset; } unsigned getSize() const { return Offset; } + unsigned getRegister() const { return Register; } bool isPushCodeFrame() const { return Offset == 1; } - const MachineLocation &getDestination() const { return Destination; } - const MachineLocation &getSource() const { return Source; } }; struct MCWin64EHUnwindInfo { - MCWin64EHUnwindInfo() : Begin(0), End(0), ExceptionHandler(0), Lsda(0), - Function(0), UnwindOnly(false), LsdaSize(0), - PrologSize(0), LastFrameInst(-1), Chained(false), + MCWin64EHUnwindInfo() : Begin(0), End(0), ExceptionHandler(0), + Function(0), PrologEnd(0), Symbol(0), + HandlesUnwind(false), HandlesExceptions(false), + LastFrameInst(-1), ChainedParent(0), Instructions() {} MCSymbol *Begin; MCSymbol *End; const MCSymbol *ExceptionHandler; - const MCSymbol *Lsda; const MCSymbol *Function; - bool UnwindOnly; - unsigned LsdaSize; - unsigned PrologSize; + MCSymbol *PrologEnd; + MCSymbol *Symbol; + bool HandlesUnwind; + bool HandlesExceptions; int LastFrameInst; - bool Chained; + MCWin64EHUnwindInfo *ChainedParent; std::vector Instructions; }; class MCWin64EHUnwindEmitter { public: + static StringRef GetSectionSuffix(const MCSymbol *func); // - // This emits the unwind info section (.xdata in PE/COFF). + // This emits the unwind info sections (.pdata and .xdata in PE/COFF). // static void Emit(MCStreamer &streamer); + static void EmitUnwindInfo(MCStreamer &streamer, MCWin64EHUnwindInfo *info); }; } // end namespace llvm