1 //===- MCWin64EH.h - Machine Code Win64 EH support --------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains declarations to support the Win64 Exception Handling
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_MC_MCWIN64EH_H
16 #define LLVM_MC_MCWIN64EH_H
18 #include "llvm/MC/MCWinEH.h"
19 #include "llvm/Support/Win64EH.h"
29 static WinEH::Instruction PushNonVol(MCSymbol *L, unsigned Reg) {
30 return WinEH::Instruction(Win64EH::UOP_PushNonVol, L, Reg, -1);
32 static WinEH::Instruction Alloc(MCSymbol *L, unsigned Size) {
33 return WinEH::Instruction(Size > 128 ? UOP_AllocLarge : UOP_AllocSmall, L,
36 static WinEH::Instruction PushMachFrame(MCSymbol *L, bool Code) {
37 return WinEH::Instruction(UOP_PushMachFrame, L, -1, Code ? 1 : 0);
39 static WinEH::Instruction SaveNonVol(MCSymbol *L, unsigned Reg,
41 return WinEH::Instruction(Offset > 512 * 1024 - 8 ? UOP_SaveNonVolBig
45 static WinEH::Instruction SaveXMM(MCSymbol *L, unsigned Reg,
47 return WinEH::Instruction(Offset > 512 * 1024 - 8 ? UOP_SaveXMM128Big
51 static WinEH::Instruction SetFPReg(MCSymbol *L, unsigned Reg, unsigned Off) {
52 return WinEH::Instruction(UOP_SetFPReg, L, Reg, Off);
57 class MCWin64EHUnwindEmitter {
59 static StringRef GetSectionSuffix(const MCSymbol *func);
61 // This emits the unwind info sections (.pdata and .xdata in PE/COFF).
63 static void Emit(MCStreamer &streamer);
64 static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info);
66 } // end namespace llvm