]> git.proxmox.com Git - rustc.git/blame - src/llvm/include/llvm/MC/MCWin64EH.h
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / include / llvm / MC / MCWin64EH.h
CommitLineData
223e47cc
LB
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
1a4d82fc 18#include "llvm/MC/MCWinEH.h"
223e47cc 19#include "llvm/Support/Win64EH.h"
223e47cc
LB
20#include <vector>
21
22namespace llvm {
1a4d82fc
JJ
23class MCStreamer;
24class MCSymbol;
223e47cc 25
1a4d82fc
JJ
26namespace Win64EH {
27struct Instruction {
28 static WinEH::Instruction PushNonVol(MCSymbol *L, unsigned Reg) {
29 return WinEH::Instruction(Win64EH::UOP_PushNonVol, L, Reg, -1);
30 }
31 static WinEH::Instruction Alloc(MCSymbol *L, unsigned Size) {
32 return WinEH::Instruction(Size > 128 ? UOP_AllocLarge : UOP_AllocSmall, L,
33 -1, Size);
34 }
35 static WinEH::Instruction PushMachFrame(MCSymbol *L, bool Code) {
36 return WinEH::Instruction(UOP_PushMachFrame, L, -1, Code ? 1 : 0);
37 }
38 static WinEH::Instruction SaveNonVol(MCSymbol *L, unsigned Reg,
39 unsigned Offset) {
40 return WinEH::Instruction(Offset > 512 * 1024 - 8 ? UOP_SaveNonVolBig
41 : UOP_SaveNonVol,
42 L, Reg, Offset);
43 }
44 static WinEH::Instruction SaveXMM(MCSymbol *L, unsigned Reg,
45 unsigned Offset) {
46 return WinEH::Instruction(Offset > 512 * 1024 - 8 ? UOP_SaveXMM128Big
47 : UOP_SaveXMM128,
48 L, Reg, Offset);
49 }
50 static WinEH::Instruction SetFPReg(MCSymbol *L, unsigned Reg, unsigned Off) {
51 return WinEH::Instruction(UOP_SetFPReg, L, Reg, Off);
52 }
53};
223e47cc 54
1a4d82fc
JJ
55class UnwindEmitter : public WinEH::UnwindEmitter {
56public:
57 void Emit(MCStreamer &Streamer) const override;
58 void EmitUnwindInfo(MCStreamer &Streamer, WinEH::FrameInfo *FI) const override;
59};
60}
223e47cc
LB
61} // end namespace llvm
62
63#endif