mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-13 08:35:46 +00:00
Add a header containing definitions used to implement Win64 exception handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131380 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
be1532ec66
commit
c36849c403
100
include/llvm/Support/Win64EH.h
Normal file
100
include/llvm/Support/Win64EH.h
Normal file
@ -0,0 +1,100 @@
|
||||
//===-- llvm/Support/Win64EH.h ---Win64 EH Constants-------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file contains constants and structures used for implementing
|
||||
// exception handling on Win64 platforms. For more information, see
|
||||
// http://msdn.microsoft.com/en-us/library/1eyas8tf.aspx
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_SUPPORT_WIN64EH_H
|
||||
#define LLVM_SUPPORT_WIN64EH_H
|
||||
|
||||
namespace llvm {
|
||||
namespace Win64EH {
|
||||
|
||||
extern "C" {
|
||||
|
||||
/// UnwindOpcodes - Enumeration whose values specify a single operation in
|
||||
/// the prolog of a function.
|
||||
enum UnwindOpcodes {
|
||||
UOP_PushNonVol = 0,
|
||||
UOP_AllocLarge,
|
||||
UOP_AllocSmall,
|
||||
UOP_SetFPReg,
|
||||
UOP_SaveNonVol,
|
||||
UOP_SaveNonVolBig,
|
||||
UOP_SaveXMM128,
|
||||
UOP_SaveXMM128Big,
|
||||
UOP_PushMachFrame
|
||||
};
|
||||
|
||||
/// UnwindCode - This union describes a single operation in a function prolog,
|
||||
/// or part thereof.
|
||||
union UnwindCode {
|
||||
struct {
|
||||
uint8_t codeOffset;
|
||||
uint8_t unwindOp:4,
|
||||
opInfo:4;
|
||||
};
|
||||
uint16_t frameOffset;
|
||||
};
|
||||
|
||||
enum {
|
||||
/// UNW_ExceptionHandler - Specifies that this function has an exception
|
||||
/// handler.
|
||||
UNW_ExceptionHandler = 0x01,
|
||||
/// UNW_TerminateHandler - Specifies that this function has a termination
|
||||
/// handler.
|
||||
UNW_TerminateHandler = 0x02,
|
||||
/// UNW_ChainInfo - Specifies that this UnwindInfo structure is chained to
|
||||
/// another one.
|
||||
UNW_ChainInfo = 0x04
|
||||
};
|
||||
|
||||
/// UnwindInfo - An entry in the exception table.
|
||||
struct UnwindInfo {
|
||||
uint8_t version:3,
|
||||
flags:5;
|
||||
uint8_t prologSize;
|
||||
uint8_t numCodes;
|
||||
uint8_t frameRegister:4,
|
||||
frameOffset:4;
|
||||
UnwindCode unwindCodes[1];
|
||||
};
|
||||
|
||||
inline UnwindCode &getUnwindCodeEntry(UnwindInfo &info, uint32_t index) {
|
||||
return info.unwindCodes[index];
|
||||
}
|
||||
inline void *getLanguageSpecificData(UnwindInfo &info) {
|
||||
return reinterpret_cast<void *>(&getUnwindCodeEntry(info,info.numCodes+1)&~1);
|
||||
}
|
||||
inline uint64_t getLanguageSpecificHandlerOffset(UnwindInfo &info) {
|
||||
return *reinterpret_cast<uint64_t *>(getLangaugeSpecificData(info));
|
||||
}
|
||||
inline void setLanguageSpecificHandlerOffset(UnwindInfo &info, uint64_t offset){
|
||||
*reinterpret_cast<uint64_t *>(getLanguageSpecificData(info)) = offset;
|
||||
}
|
||||
inline uint64_t getChainedFunctionEntryOffset(UnwindInfo &info) {
|
||||
return *reinterpret_cast<uint64_t *>(getLanguageSpecificData(info));
|
||||
}
|
||||
inline void setChainedFunctionEntryOffset(UnwindInfo &info, uint64_t offset) {
|
||||
*reinterpret_cast<uint64_t *>(getLanguageSpecificData(info)) = offset;
|
||||
}
|
||||
inline void *getExceptionData(UnwindInfo &info) {
|
||||
return reinterpret_cast<void *>(reinterpret_cast<uint64_t *>(
|
||||
getLanguageSpecificData(info))+1);
|
||||
}
|
||||
|
||||
} // End of extern "C"
|
||||
|
||||
} // End of namespace Win64EH
|
||||
} // End of namespace llvm
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user