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
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 /// UnwindInfo - An entry in the exception table.
67 uint8_t frameRegister:4,
69 UnwindCode unwindCodes[1];
72 inline UnwindCode &getUnwindCodeEntry(UnwindInfo &info, uint32_t index) {
73 return info.unwindCodes[index];
75 inline void *getLanguageSpecificData(UnwindInfo &info) {
76 return reinterpret_cast<void *>(&getUnwindCodeEntry(info,info.numCodes+1)&~1);
78 inline uint64_t getLanguageSpecificHandlerOffset(UnwindInfo &info) {
79 return *reinterpret_cast<uint64_t *>(getLangaugeSpecificData(info));
81 inline void setLanguageSpecificHandlerOffset(UnwindInfo &info, uint64_t offset){
82 *reinterpret_cast<uint64_t *>(getLanguageSpecificData(info)) = offset;
84 inline uint64_t getChainedFunctionEntryOffset(UnwindInfo &info) {
85 return *reinterpret_cast<uint64_t *>(getLanguageSpecificData(info));
87 inline void setChainedFunctionEntryOffset(UnwindInfo &info, uint64_t offset) {
88 *reinterpret_cast<uint64_t *>(getLanguageSpecificData(info)) = offset;
90 inline void *getExceptionData(UnwindInfo &info) {
91 return reinterpret_cast<void *>(reinterpret_cast<uint64_t *>(
92 getLanguageSpecificData(info))+1);
95 } // End of extern "C"
97 } // End of namespace Win64EH
98 } // End of namespace llvm