MC: rename Win64EHFrameInfo to WinEH::FrameInfo
[oota-llvm.git] / include / llvm / MC / MCWin64EH.h
1 //===- MCWin64EH.h - Machine Code Win64 EH support --------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains declarations to support the Win64 Exception Handling
11 // scheme in MC.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_MC_MCWIN64EH_H
16 #define LLVM_MC_MCWIN64EH_H
17
18 #include "llvm/MC/MCWinEH.h"
19 #include "llvm/Support/Win64EH.h"
20 #include <vector>
21
22 namespace llvm {
23   class StringRef;
24   class MCStreamer;
25   class MCSymbol;
26
27 namespace Win64EH {
28 struct Instruction {
29   static WinEH::Instruction PushNonVol(MCSymbol *L, unsigned Reg) {
30     return WinEH::Instruction(Win64EH::UOP_PushNonVol, L, Reg, -1);
31   }
32   static WinEH::Instruction Alloc(MCSymbol *L, unsigned Size) {
33     return WinEH::Instruction(Size > 128 ? UOP_AllocLarge : UOP_AllocSmall, L,
34                               -1, Size);
35   }
36   static WinEH::Instruction PushMachFrame(MCSymbol *L, bool Code) {
37     return WinEH::Instruction(UOP_PushMachFrame, L, -1, Code ? 1 : 0);
38   }
39   static WinEH::Instruction SaveNonVol(MCSymbol *L, unsigned Reg,
40                                        unsigned Offset) {
41     return WinEH::Instruction(Offset > 512 * 1024 - 8 ? UOP_SaveNonVolBig
42                                                       : UOP_SaveNonVol,
43                               L, Reg, Offset);
44   }
45   static WinEH::Instruction SaveXMM(MCSymbol *L, unsigned Reg,
46                                     unsigned Offset) {
47     return WinEH::Instruction(Offset > 512 * 1024 - 8 ? UOP_SaveXMM128Big
48                                                       : UOP_SaveXMM128,
49                               L, Reg, Offset);
50   }
51   static WinEH::Instruction SetFPReg(MCSymbol *L, unsigned Reg, unsigned Off) {
52     return WinEH::Instruction(UOP_SetFPReg, L, Reg, Off);
53   }
54 };
55 }
56
57   class MCWin64EHUnwindEmitter {
58   public:
59     static StringRef GetSectionSuffix(const MCSymbol *func);
60     //
61     // This emits the unwind info sections (.pdata and .xdata in PE/COFF).
62     //
63     static void Emit(MCStreamer &streamer);
64     static void EmitUnwindInfo(MCStreamer &streamer, WinEH::FrameInfo *info);
65   };
66 } // end namespace llvm
67
68 #endif