1 //===-- llvm/Support/Win64EH.h ---Win64 EH Constants-------------*- 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 constants and structures used for implementing
11 // exception handling on Win64 platforms. For more information, see
12 // http://msdn.microsoft.com/en-us/library/1eyas8tf.aspx
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_SUPPORT_WIN64EH_H
17 #define LLVM_SUPPORT_WIN64EH_H
19 #include "llvm/Support/DataTypes.h"
24 /// UnwindOpcodes - Enumeration whose values specify a single operation in
25 /// the prolog of a function.
38 /// UnwindCode - This union describes a single operation in a function prolog,
50 /// UNW_ExceptionHandler - Specifies that this function has an exception
52 UNW_ExceptionHandler = 0x01,
53 /// UNW_TerminateHandler - Specifies that this function has a termination
55 UNW_TerminateHandler = 0x02,
56 /// UNW_ChainInfo - Specifies that this UnwindInfo structure is chained to
61 /// RuntimeFunction - An entry in the table of functions with unwind info.
62 struct RuntimeFunction {
63 uint64_t startAddress;
65 uint64_t unwindInfoOffset;
68 /// UnwindInfo - An entry in the exception table.
74 uint8_t frameRegister:4,
76 UnwindCode unwindCodes[1];
78 void *getLanguageSpecificData() {
79 return reinterpret_cast<void *>(&unwindCodes[(numCodes+1) & ~1]);
81 uint64_t getLanguageSpecificHandlerOffset() {
82 return *reinterpret_cast<uint64_t *>(getLanguageSpecificData());
84 void setLanguageSpecificHandlerOffset(uint64_t offset) {
85 *reinterpret_cast<uint64_t *>(getLanguageSpecificData()) = offset;
87 RuntimeFunction *getChainedFunctionEntry() {
88 return reinterpret_cast<RuntimeFunction *>(getLanguageSpecificData());
90 void *getExceptionData() {
91 return reinterpret_cast<void *>(reinterpret_cast<uint64_t *>(
92 getLanguageSpecificData())+1);
97 } // End of namespace Win64EH
98 } // End of namespace llvm