LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCWin64EH.h
Go to the documentation of this file.
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/Support/Win64EH.h"
19 #include <cassert>
20 #include <vector>
21 
22 namespace llvm {
23  class StringRef;
24  class MCStreamer;
25  class MCSymbol;
26 
28  public:
30  private:
31  OpType Operation;
32  MCSymbol *Label;
33  unsigned Offset;
34  unsigned Register;
35  public:
37  : Operation(Op), Label(L), Offset(0), Register(Reg) {
38  assert(Op == Win64EH::UOP_PushNonVol);
39  }
40  MCWin64EHInstruction(MCSymbol *L, unsigned Size)
41  : Operation(Size>128 ? Win64EH::UOP_AllocLarge : Win64EH::UOP_AllocSmall),
42  Label(L), Offset(Size) { }
43  MCWin64EHInstruction(OpType Op, MCSymbol *L, unsigned Reg, unsigned Off)
44  : Operation(Op), Label(L), Offset(Off), Register(Reg) {
45  assert(Op == Win64EH::UOP_SetFPReg ||
50  }
52  : Operation(Op), Label(L), Offset(Code ? 1 : 0) {
53  assert(Op == Win64EH::UOP_PushMachFrame);
54  }
55  OpType getOperation() const { return Operation; }
56  MCSymbol *getLabel() const { return Label; }
57  unsigned getOffset() const { return Offset; }
58  unsigned getSize() const { return Offset; }
59  unsigned getRegister() const { return Register; }
60  bool isPushCodeFrame() const { return Offset == 1; }
61  };
62 
65  Function(0), PrologEnd(0), Symbol(0),
68  Instructions() {}
79  std::vector<MCWin64EHInstruction> Instructions;
80  };
81 
83  public:
84  static StringRef GetSectionSuffix(const MCSymbol *func);
85  //
86  // This emits the unwind info sections (.pdata and .xdata in PE/COFF).
87  //
88  static void Emit(MCStreamer &streamer);
89  static void EmitUnwindInfo(MCStreamer &streamer, MCWin64EHUnwindInfo *info);
90  };
91 } // end namespace llvm
92 
93 #endif
const MCSymbol * ExceptionHandler
Definition: MCWin64EH.h:71
const MCSymbol * Function
Definition: MCWin64EH.h:72
Win64EH::UnwindOpcodes OpType
Definition: MCWin64EH.h:29
lazy value info
unsigned getSize() const
Definition: MCWin64EH.h:58
#define false
Definition: ConvertUTF.c:64
unsigned getRegister() const
Definition: MCWin64EH.h:59
std::vector< MCWin64EHInstruction > Instructions
Definition: MCWin64EH.h:79
bool isPushCodeFrame() const
Definition: MCWin64EH.h:60
static void Emit(MCStreamer &streamer)
Definition: MCWin64EH.cpp:277
MCWin64EHInstruction(OpType Op, MCSymbol *L, unsigned Reg, unsigned Off)
Definition: MCWin64EH.h:43
MCWin64EHInstruction(OpType Op, MCSymbol *L, bool Code)
Definition: MCWin64EH.h:51
OpType getOperation() const
Definition: MCWin64EH.h:55
static StringRef GetSectionSuffix(const MCSymbol *func)
Definition: MCWin64EH.cpp:225
MCWin64EHInstruction(OpType Op, MCSymbol *L, unsigned Reg)
Definition: MCWin64EH.h:36
MCWin64EHUnwindInfo * ChainedParent
Definition: MCWin64EH.h:78
unsigned getOffset() const
Definition: MCWin64EH.h:57
MCWin64EHInstruction(MCSymbol *L, unsigned Size)
Definition: MCWin64EH.h:40
static void EmitUnwindInfo(MCStreamer &streamer, MCWin64EHUnwindInfo *info)
Definition: MCWin64EH.cpp:265
MCSymbol * getLabel() const
Definition: MCWin64EH.h:56