mirror of
https://github.com/asmjit/asmjit.git
synced 2025-12-17 04:24:37 +03:00
Minor refactor of constants (don't use k prefix in enum type, only values), fixed some compilation problems with VS2003.
This commit is contained in:
@@ -4,12 +4,42 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
// [Dependencies - AsmJit]
|
||||
#if !defined(_ASMJIT_BUILD_H)
|
||||
#include "build.h"
|
||||
#endif // !_ASMJIT_BUILD_H
|
||||
|
||||
// [Guard]
|
||||
#if !defined(ASMJIT_API_SCOPE)
|
||||
# define ASMJIT_API_SCOPE
|
||||
#else
|
||||
# error "AsmJit - Api-Scope is already active, previous scope not closed by apiend.h?"
|
||||
#endif // ASMJIT_API_SCOPE
|
||||
|
||||
// ============================================================================
|
||||
// [MSVC]
|
||||
// [Override]
|
||||
// ============================================================================
|
||||
|
||||
#if !defined(ASMJIT_CC_HAS_OVERRIDE) && !defined(override)
|
||||
# define override
|
||||
# define ASMJIT_UNDEF_OVERRIDE
|
||||
#endif // !ASMJIT_CC_HAS_OVERRIDE && !override
|
||||
|
||||
// ============================================================================
|
||||
// [NoExcept]
|
||||
// ============================================================================
|
||||
|
||||
#if !defined(ASMJIT_CC_HAS_NOEXCEPT) && !defined(noexcept)
|
||||
# define noexcept ASMJIT_NOEXCEPT
|
||||
# define ASMJIT_UNDEF_NOEXCEPT
|
||||
#endif // !ASMJIT_CC_HAS_NOEXCEPT && !noexcept
|
||||
|
||||
// ============================================================================
|
||||
// [CodeGear]
|
||||
// ============================================================================
|
||||
|
||||
// ============================================================================
|
||||
// [MSC]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
@@ -29,17 +59,17 @@
|
||||
|
||||
// Rename symbols.
|
||||
# if !defined(vsnprintf)
|
||||
# define ASMJIT_DEFINED_VSNPRINTF
|
||||
# define ASMJIT_UNDEF_VSNPRINTF
|
||||
# define vsnprintf _vsnprintf
|
||||
# endif // !vsnprintf
|
||||
# if !defined(snprintf)
|
||||
# define ASMJIT_DEFINED_SNPRINTF
|
||||
# define ASMJIT_UNDEF_SNPRINTF
|
||||
# define snprintf _snprintf
|
||||
# endif // !snprintf
|
||||
#endif // _MSC_VER
|
||||
|
||||
// ============================================================================
|
||||
// [GNUC]
|
||||
// [GCC]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
|
||||
@@ -4,26 +4,52 @@
|
||||
// [License]
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
// [Guard]
|
||||
#if defined(ASMJIT_API_SCOPE)
|
||||
# undef ASMJIT_API_SCOPE
|
||||
#else
|
||||
# error "AsmJit - Api-Scope not active, forgot to include apibegin.h?"
|
||||
#endif // ASMJIT_API_SCOPE
|
||||
|
||||
// ============================================================================
|
||||
// [MSVC]
|
||||
// [Override]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(ASMJIT_UNDEF_OVERRIDE)
|
||||
# undef override
|
||||
# undef ASMJIT_UNDEF_OVERRIDE
|
||||
#endif // ASMJIT_UNDEF_OVERRIDE
|
||||
|
||||
// ============================================================================
|
||||
// [NoExcept]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(ASMJIT_UNDEF_NOEXCEPT)
|
||||
# undef noexcept
|
||||
# undef ASMJIT_UNDEF_NOEXCEPT
|
||||
#endif // ASMJIT_UNDEF_NOEXCEPT
|
||||
|
||||
// ============================================================================
|
||||
// [MSC]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// Pop disabled warnings by ApiBegin.h
|
||||
# pragma warning(pop)
|
||||
// Rename symbols back.
|
||||
# if defined(ASMJIT_DEFINED_VSNPRINTF)
|
||||
# undef ASMJIT_DEFINED_VSNPRINTF
|
||||
|
||||
# if defined(ASMJIT_UNDEF_VSNPRINTF)
|
||||
# undef vsnprintf
|
||||
# endif // ASMJIT_DEFINED_VSNPRINTF
|
||||
# if defined(ASMJIT_DEFINED_SNPRINTF)
|
||||
# undef ASMJIT_DEFINED_SNPRINTF
|
||||
# undef ASMJIT_UNDEF_VSNPRINTF
|
||||
# endif // ASMJIT_UNDEF_VSNPRINTF
|
||||
|
||||
# if defined(ASMJIT_UNDEF_SNPRINTF)
|
||||
# undef snprintf
|
||||
# endif // ASMJIT_DEFINED_SNPRINTF
|
||||
# undef ASMJIT_UNDEF_SNPRINTF
|
||||
# endif // ASMJIT_UNDEF_SNPRINTF
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
// ============================================================================
|
||||
// [GNUC]
|
||||
// [GNCC]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__GNUC__) && !defined(__clang__)
|
||||
|
||||
@@ -26,21 +26,21 @@ namespace asmjit {
|
||||
//! \{
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kInstId]
|
||||
// [asmjit::InstId]
|
||||
// ============================================================================
|
||||
|
||||
//! Instruction codes (stub).
|
||||
ASMJIT_ENUM(kInstId) {
|
||||
ASMJIT_ENUM(InstId) {
|
||||
//! No instruction.
|
||||
kInstIdNone = 0
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kInstOptions]
|
||||
// [asmjit::InstOptions]
|
||||
// ============================================================================
|
||||
|
||||
//! Instruction options (stub).
|
||||
ASMJIT_ENUM(kInstOptions) {
|
||||
//! Instruction options.
|
||||
ASMJIT_ENUM(InstOptions) {
|
||||
//! No instruction options.
|
||||
kInstOptionNone = 0x00000000,
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@ namespace asmjit {
|
||||
//! \{
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kCodeGen]
|
||||
// [asmjit::CodeGenFeatures]
|
||||
// ============================================================================
|
||||
|
||||
//! Features of \ref CodeGen.
|
||||
ASMJIT_ENUM(kCodeGen) {
|
||||
ASMJIT_ENUM(CodeGenFeatures) {
|
||||
//! Emit optimized code-alignment sequences (`Assembler` and `Compiler`).
|
||||
//!
|
||||
//! Default `true`.
|
||||
@@ -80,11 +80,11 @@ ASMJIT_ENUM(kCodeGen) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kAlignMode]
|
||||
// [asmjit::AlignMode]
|
||||
// ============================================================================
|
||||
|
||||
//! Code aligning mode.
|
||||
ASMJIT_ENUM(kAlignMode) {
|
||||
ASMJIT_ENUM(AlignMode) {
|
||||
//! Align by emitting a sequence that can be executed (code).
|
||||
kAlignCode = 0,
|
||||
//! Align by emitting sequence that shouldn't be executed (data).
|
||||
@@ -92,11 +92,11 @@ ASMJIT_ENUM(kAlignMode) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kRelocMode]
|
||||
// [asmjit::RelocMode]
|
||||
// ============================================================================
|
||||
|
||||
//! Relocation mode.
|
||||
ASMJIT_ENUM(kRelocMode) {
|
||||
ASMJIT_ENUM(RelocMode) {
|
||||
//! Relocate an absolute address to an absolute address.
|
||||
kRelocAbsToAbs = 0,
|
||||
//! Relocate a relative address to an absolute address.
|
||||
|
||||
@@ -482,7 +482,7 @@ VarData* Compiler::_newVd(uint32_t type, uint32_t size, uint32_t c, const char*
|
||||
vd->_flags = 0;
|
||||
vd->_priority = 10;
|
||||
|
||||
vd->_state = kVarStateUnused;
|
||||
vd->_state = kVarStateNone;
|
||||
vd->_regIndex = kInvalidReg;
|
||||
vd->_isStack = false;
|
||||
vd->_isMemArg = false;
|
||||
|
||||
@@ -43,14 +43,14 @@ struct InstNode;
|
||||
struct JumpNode;
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kConstScope]
|
||||
// [asmjit::ConstScope]
|
||||
// ============================================================================
|
||||
|
||||
//! \addtogroup asmjit_base_compiler
|
||||
//! \{
|
||||
|
||||
//! Scope of the constant.
|
||||
ASMJIT_ENUM(kConstScope) {
|
||||
ASMJIT_ENUM(ConstScope) {
|
||||
//! Local constant, always embedded right after the current function.
|
||||
kConstScopeLocal = 0,
|
||||
//! Global constant, embedded at the end of the currently compiled code.
|
||||
@@ -58,10 +58,10 @@ ASMJIT_ENUM(kConstScope) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kVarType]
|
||||
// [asmjit::VarType]
|
||||
// ============================================================================
|
||||
|
||||
ASMJIT_ENUM(kVarType) {
|
||||
ASMJIT_ENUM(VarType) {
|
||||
//! Variable is 8-bit signed integer.
|
||||
kVarTypeInt8 = 0,
|
||||
//! Variable is 8-bit unsigned integer.
|
||||
@@ -101,13 +101,13 @@ ASMJIT_ENUM(kVarType) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kVarFlags]
|
||||
// [asmjit::VarFlags]
|
||||
// ============================================================================
|
||||
|
||||
//! \internal
|
||||
//!
|
||||
//! X86/X64 variable flags.
|
||||
ASMJIT_ENUM(kVarFlags) {
|
||||
ASMJIT_ENUM(VarFlags) {
|
||||
//! Variable contains single-precision floating-point(s).
|
||||
kVarFlagSp = 0x10,
|
||||
//! Variable contains double-precision floating-point(s).
|
||||
@@ -117,11 +117,11 @@ ASMJIT_ENUM(kVarFlags) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kVarAttrFlags]
|
||||
// [asmjit::VarAttrFlags]
|
||||
// ============================================================================
|
||||
|
||||
//! Variable attribute flags.
|
||||
ASMJIT_ENUM(kVarAttrFlags) {
|
||||
ASMJIT_ENUM(VarAttrFlags) {
|
||||
//! Variable is accessed through register on input.
|
||||
kVarAttrInReg = 0x00000001,
|
||||
//! Variable is accessed through register on output.
|
||||
@@ -188,13 +188,13 @@ ASMJIT_ENUM(kVarAttrFlags) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kVarHint]
|
||||
// [asmjit::VarHint]
|
||||
// ============================================================================
|
||||
|
||||
//! Variable hint (used by `Compiler)`.
|
||||
//!
|
||||
//! \sa Compiler.
|
||||
ASMJIT_ENUM(kVarHint) {
|
||||
ASMJIT_ENUM(VarHint) {
|
||||
//! Alloc variable.
|
||||
kVarHintAlloc = 0,
|
||||
//! Spill variable.
|
||||
@@ -211,35 +211,29 @@ ASMJIT_ENUM(kVarHint) {
|
||||
// [asmjit::kVarState]
|
||||
// ============================================================================
|
||||
|
||||
// TODO: Rename `kVarState` or `VarState`.
|
||||
|
||||
//! State of variable.
|
||||
//!
|
||||
//! \note State of variable is used only during make process and it's not
|
||||
//! visible to the developer.
|
||||
//! \note Variable states are used only during register allocation.
|
||||
ASMJIT_ENUM(kVarState) {
|
||||
//! Variable is currently not used.
|
||||
kVarStateUnused = 0,
|
||||
|
||||
//! Variable is in register.
|
||||
//!
|
||||
kVarStateNone = 0,
|
||||
//! Variable is currently allocated in register.
|
||||
kVarStateReg = 1,
|
||||
|
||||
//! Variable is in memory location or spilled.
|
||||
//!
|
||||
//! Variable was spilled from register to memory or variable is used for
|
||||
//! memory only storage.
|
||||
//! Variable is currently allocated in memory (or has been spilled).
|
||||
kVarStateMem = 2
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kFuncConv]
|
||||
// [asmjit::FuncConv]
|
||||
// ============================================================================
|
||||
|
||||
//! Function calling convention.
|
||||
//!
|
||||
//! For a platform specific calling conventions, see:
|
||||
//! - `kX86FuncConv` - X86/X64 calling conventions.
|
||||
ASMJIT_ENUM(kFuncConv) {
|
||||
//! - `X86FuncConv` - X86/X64 calling conventions.
|
||||
ASMJIT_ENUM(FuncConv) {
|
||||
//! Calling convention is invalid (can't be used).
|
||||
kFuncConvNone = 0,
|
||||
|
||||
@@ -267,14 +261,14 @@ ASMJIT_ENUM(kFuncConv) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kFuncHint]
|
||||
// [asmjit::FuncHint]
|
||||
// ============================================================================
|
||||
|
||||
//! Function hints.
|
||||
//!
|
||||
//! For a platform specific calling conventions, see:
|
||||
//! - `kX86FuncHint` - X86/X64 function hints.
|
||||
ASMJIT_ENUM(kFuncHint) {
|
||||
//! - `X86FuncHint` - X86/X64 function hints.
|
||||
ASMJIT_ENUM(FuncHint) {
|
||||
//! Make a naked function (default true).
|
||||
//!
|
||||
//! Naked function is function without using standard prolog/epilog sequence).
|
||||
@@ -325,14 +319,14 @@ ASMJIT_ENUM(kFuncHint) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kFuncFlags]
|
||||
// [asmjit::FuncFlags]
|
||||
// ============================================================================
|
||||
|
||||
//! Function flags.
|
||||
//!
|
||||
//! For a platform specific calling conventions, see:
|
||||
//! - `kX86FuncFlags` - X86/X64 function flags.
|
||||
ASMJIT_ENUM(kFuncFlags) {
|
||||
//! - `X86FuncFlags` - X86/X64 function flags.
|
||||
ASMJIT_ENUM(FuncFlags) {
|
||||
//! Whether the function is using naked (minimal) prolog / epilog.
|
||||
kFuncFlagIsNaked = 0x00000001,
|
||||
|
||||
@@ -360,11 +354,11 @@ ASMJIT_ENUM(kFuncFlags) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kFuncDir]
|
||||
// [asmjit::FuncDir]
|
||||
// ============================================================================
|
||||
|
||||
//! Function arguments direction.
|
||||
ASMJIT_ENUM(kFuncDir) {
|
||||
ASMJIT_ENUM(FuncDir) {
|
||||
//! Arguments are passed left to right.
|
||||
//!
|
||||
//! This arguments direction is unusual in C, however it's used in Pascal.
|
||||
@@ -377,11 +371,11 @@ ASMJIT_ENUM(kFuncDir) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kFuncArg]
|
||||
// [asmjit::FuncArgIndex]
|
||||
// ============================================================================
|
||||
|
||||
//! Function argument (lo/hi) specification.
|
||||
ASMJIT_ENUM(kFuncArg) {
|
||||
//! Function argument index (lo/hi).
|
||||
ASMJIT_ENUM(FuncArgIndex) {
|
||||
//! Maxumum number of function arguments supported by AsmJit.
|
||||
kFuncArgCount = 16,
|
||||
//! Extended maximum number of arguments (used internally).
|
||||
@@ -401,11 +395,11 @@ ASMJIT_ENUM(kFuncArg) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kFuncRet]
|
||||
// [asmjit::FuncRet]
|
||||
// ============================================================================
|
||||
|
||||
//! Function return value (lo/hi) specification.
|
||||
ASMJIT_ENUM(kFuncRet) {
|
||||
ASMJIT_ENUM(FuncRet) {
|
||||
//! Index to the LO part of function return value.
|
||||
kFuncRetLo = 0,
|
||||
//! Index to the HI part of function return value.
|
||||
@@ -416,17 +410,17 @@ ASMJIT_ENUM(kFuncRet) {
|
||||
// [asmjit::kFuncStackInvalid]
|
||||
// ============================================================================
|
||||
|
||||
enum kFuncMisc {
|
||||
enum {
|
||||
//! Invalid stack offset in function or function parameter.
|
||||
kFuncStackInvalid = -1
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kNodeType]
|
||||
// [asmjit::NodeType]
|
||||
// ============================================================================
|
||||
|
||||
//! Type of node, see \ref Node.
|
||||
ASMJIT_ENUM(kNodeType) {
|
||||
ASMJIT_ENUM(NodeType) {
|
||||
//! Invalid node (internal, can't be used).
|
||||
kNodeTypeNone = 0,
|
||||
//! Node is an .align directive, see \ref AlignNode.
|
||||
@@ -454,10 +448,10 @@ ASMJIT_ENUM(kNodeType) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kNodeFlags]
|
||||
// [asmjit::NodeFlags]
|
||||
// ============================================================================
|
||||
|
||||
ASMJIT_ENUM(kNodeFlags) {
|
||||
ASMJIT_ENUM(NodeFlags) {
|
||||
//! Whether the node has been translated, thus contains only registers.
|
||||
kNodeFlagIsTranslated = 0x0001,
|
||||
|
||||
@@ -1262,7 +1256,7 @@ struct FuncInOut {
|
||||
|
||||
union {
|
||||
struct {
|
||||
//! Variable type, see `kVarType`.
|
||||
//! Variable type, see `VarType`.
|
||||
uint8_t _varType;
|
||||
//! Register index if argument / return value is a register.
|
||||
uint8_t _regIndex;
|
||||
@@ -1488,7 +1482,7 @@ struct FuncDecl {
|
||||
// [Accessors - Calling Convention]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get function calling convention, see `kFuncConv`.
|
||||
//! Get function calling convention, see `FuncConv`.
|
||||
ASMJIT_INLINE uint32_t getConvention() const { return _convention; }
|
||||
|
||||
//! Get whether the callee pops the stack.
|
||||
@@ -1556,7 +1550,7 @@ struct FuncDecl {
|
||||
uint8_t _convention;
|
||||
//! Whether a callee pops stack.
|
||||
uint8_t _calleePopsStack : 1;
|
||||
//! Direction for arguments passed on the stack, see `kFuncDir`.
|
||||
//! Direction for arguments passed on the stack, see `FuncDir`.
|
||||
uint8_t _direction : 1;
|
||||
//! Reserved #0 (alignment).
|
||||
uint8_t _reserved0 : 6;
|
||||
@@ -1642,7 +1636,7 @@ struct Node {
|
||||
// [Accessors - Type and Flags]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get node type, see `kNodeType`.
|
||||
//! Get node type, see `NodeType`.
|
||||
ASMJIT_INLINE uint32_t getType() const {
|
||||
return _type;
|
||||
}
|
||||
@@ -1796,7 +1790,7 @@ struct Node {
|
||||
//! Next node.
|
||||
Node* _next;
|
||||
|
||||
//! Node type, see `kNodeType`.
|
||||
//! Node type, see `NodeType`.
|
||||
uint8_t _type;
|
||||
//! Operands count (if the node has operands, otherwise zero).
|
||||
uint8_t _opCount;
|
||||
@@ -1874,7 +1868,7 @@ struct AlignNode : public Node {
|
||||
// [Members]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Alignment mode, see \ref kAlignMode.
|
||||
//! Alignment mode, see \ref AlignMode.
|
||||
uint32_t _mode;
|
||||
//! Alignment offset in bytes.
|
||||
uint32_t _offset;
|
||||
@@ -2130,7 +2124,7 @@ struct InstNode : public Node {
|
||||
// [Accessors]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get instruction ID, see `kX86InstId`.
|
||||
//! Get instruction ID, see `X86InstId`.
|
||||
ASMJIT_INLINE uint32_t getInstId() const {
|
||||
return _instId;
|
||||
}
|
||||
@@ -2236,13 +2230,13 @@ _Update:
|
||||
// [Members]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Instruction ID, see `kInstId`.
|
||||
//! Instruction ID, see `InstId`.
|
||||
uint16_t _instId;
|
||||
//! \internal
|
||||
uint8_t _memOpIndex;
|
||||
//! \internal
|
||||
uint8_t _reserved;
|
||||
//! Instruction options, see `kInstOptions`.
|
||||
//! Instruction options, see `InstOptions`.
|
||||
uint32_t _instOptions;
|
||||
|
||||
//! Operands list.
|
||||
@@ -3090,7 +3084,7 @@ struct ASMJIT_VCLASS Compiler : public CodeGen {
|
||||
//! registers.
|
||||
uint32_t _maxLookAhead;
|
||||
|
||||
//! Variable mapping (translates incoming kVarType into target).
|
||||
//! Variable mapping (translates incoming VarType into target).
|
||||
const uint8_t* _targetVarMapping;
|
||||
|
||||
//! First node.
|
||||
|
||||
@@ -26,8 +26,8 @@ namespace asmjit {
|
||||
|
||||
Context::Context(Compiler* compiler) :
|
||||
_compiler(compiler),
|
||||
_varMapToVaListOffset(0),
|
||||
_baseZone(8192 - kZoneOverhead) {
|
||||
_baseZone(8192 - kZoneOverhead),
|
||||
_varMapToVaListOffset(0) {
|
||||
|
||||
Context::reset();
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
// [Dependencies - AsmJit]
|
||||
#include "../base/cpuinfo.h"
|
||||
|
||||
#if defined(ASMJIT_HOST_X86) || defined(ASMJIT_HOST_X64)
|
||||
#if defined(ASMJIT_ARCH_X86) || defined(ASMJIT_ARCH_X64)
|
||||
#include "../x86/x86cpuinfo.h"
|
||||
#else
|
||||
// ?
|
||||
#endif // ASMJIT_HOST || ASMJIT_HOST_X64
|
||||
#endif // ASMJIT_HOST || ASMJIT_ARCH_X64
|
||||
|
||||
// [Dependencies - Posix]
|
||||
#if defined(ASMJIT_OS_POSIX)
|
||||
@@ -54,7 +54,7 @@ uint32_t CpuInfo::detectHwThreadsCount() {
|
||||
// [asmjit::CpuInfo - GetHost]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(ASMJIT_HOST_X86) || defined(ASMJIT_HOST_X64)
|
||||
#if defined(ASMJIT_ARCH_X86) || defined(ASMJIT_ARCH_X64)
|
||||
struct AutoX86CpuInfo : public X86CpuInfo {
|
||||
ASMJIT_INLINE AutoX86CpuInfo() : X86CpuInfo() {
|
||||
X86CpuUtil::detect(this);
|
||||
@@ -62,14 +62,14 @@ struct AutoX86CpuInfo : public X86CpuInfo {
|
||||
};
|
||||
#else
|
||||
#error "AsmJit - Unsupported CPU."
|
||||
#endif // ASMJIT_HOST || ASMJIT_HOST_X64
|
||||
#endif // ASMJIT_HOST || ASMJIT_ARCH_X64
|
||||
|
||||
const CpuInfo* CpuInfo::getHost() {
|
||||
#if defined(ASMJIT_HOST_X86) || defined(ASMJIT_HOST_X64)
|
||||
#if defined(ASMJIT_ARCH_X86) || defined(ASMJIT_ARCH_X64)
|
||||
static AutoX86CpuInfo cpuInfo;
|
||||
#else
|
||||
#error "AsmJit - Unsupported CPU."
|
||||
#endif // ASMJIT_HOST || ASMJIT_HOST_X64
|
||||
#endif // ASMJIT_HOST || ASMJIT_ARCH_X64
|
||||
return &cpuInfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace asmjit {
|
||||
//! \{
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kCpuVendor]
|
||||
// [asmjit::CpuVendor]
|
||||
// ============================================================================
|
||||
|
||||
//! Cpu vendor ID.
|
||||
@@ -30,7 +30,7 @@ namespace asmjit {
|
||||
//! calls. Some manufacturers changed their vendor strings and AsmJit is aware
|
||||
//! of that - it checks multiple combinations and decides which vendor ID should
|
||||
//! be used.
|
||||
ASMJIT_ENUM(kCpuVendor) {
|
||||
ASMJIT_ENUM(CpuVendor) {
|
||||
//! No/Unknown vendor.
|
||||
kCpuVendorNone = 0,
|
||||
|
||||
@@ -120,7 +120,7 @@ struct CpuInfo {
|
||||
//! Cpu long vendor string (brand).
|
||||
char _brandString[64];
|
||||
|
||||
//! Cpu vendor id, see `asmjit::kCpuVendor`.
|
||||
//! Cpu vendor id, see \ref CpuVendor.
|
||||
uint32_t _vendorId;
|
||||
//! Cpu family ID.
|
||||
uint32_t _family;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// [Dependencies - Windows]
|
||||
#if defined(ASMJIT_OS_WINDOWS)
|
||||
// `_InterlockedCompareExchange` is only available as intrinsic (MS Compiler).
|
||||
# if defined(_MSC_VER)
|
||||
# if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
# include <intrin.h>
|
||||
# pragma intrinsic(_InterlockedCompareExchange)
|
||||
# else
|
||||
|
||||
@@ -8,23 +8,23 @@
|
||||
#ifndef _ASMJIT_BASE_ERROR_H
|
||||
#define _ASMJIT_BASE_ERROR_H
|
||||
|
||||
// [Api-Begin]
|
||||
#include "../apibegin.h"
|
||||
|
||||
// [Dependencies - AsmJit]
|
||||
#include "../base/globals.h"
|
||||
|
||||
// [Api-Begin]
|
||||
#include "../apibegin.h"
|
||||
|
||||
namespace asmjit {
|
||||
|
||||
//! \addtogroup asmjit_base_general
|
||||
//! \{
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kError]
|
||||
// [asmjit::ErrorCode]
|
||||
// ============================================================================
|
||||
|
||||
//! AsmJit error codes.
|
||||
ASMJIT_ENUM(kError) {
|
||||
ASMJIT_ENUM(ErrorCode) {
|
||||
//! No error (success).
|
||||
//!
|
||||
//! This is default state and state you want.
|
||||
@@ -188,7 +188,7 @@ struct ASMJIT_VCLASS ErrorHandler {
|
||||
//! Error utilities.
|
||||
struct ErrorUtil {
|
||||
#if !defined(ASMJIT_DISABLE_NAMES)
|
||||
//! Get printable version of AsmJit `kError` code.
|
||||
//! Get a printable version of AsmJit `Error` code.
|
||||
static ASMJIT_API const char* asString(Error code);
|
||||
#endif // ASMJIT_DISABLE_NAMES
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ typedef uint64_t Ptr;
|
||||
typedef int64_t SignedPtr;
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kGlobals]
|
||||
// [asmjit::GlobalDefs]
|
||||
// ============================================================================
|
||||
|
||||
//! Invalid index
|
||||
@@ -48,7 +48,7 @@ static const size_t kInvalidIndex = ~static_cast<size_t>(0);
|
||||
static const Ptr kNoBaseAddress = static_cast<Ptr>(static_cast<SignedPtr>(-1));
|
||||
|
||||
//! Global constants.
|
||||
ASMJIT_ENUM(kGlobals) {
|
||||
ASMJIT_ENUM(GlobalDefs) {
|
||||
//! Invalid value or operand id.
|
||||
kInvalidValue = 0xFFFFFFFF,
|
||||
|
||||
@@ -74,11 +74,11 @@ ASMJIT_ENUM(kGlobals) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kArch]
|
||||
// [asmjit::ArchId]
|
||||
// ============================================================================
|
||||
|
||||
//! Architecture.
|
||||
ASMJIT_ENUM(kArch) {
|
||||
//! CPU architecture identifier.
|
||||
ASMJIT_ENUM(ArchId) {
|
||||
//! No/Unknown architecture.
|
||||
kArchNone = 0,
|
||||
|
||||
@@ -90,17 +90,17 @@ ASMJIT_ENUM(kArch) {
|
||||
//! Arm architecture.
|
||||
kArchArm = 4,
|
||||
|
||||
#if defined(ASMJIT_HOST_X86)
|
||||
#if defined(ASMJIT_ARCH_X86)
|
||||
kArchHost = kArchX86,
|
||||
#endif // ASMJIT_HOST_X86
|
||||
#endif // ASMJIT_ARCH_X86
|
||||
|
||||
#if defined(ASMJIT_HOST_X64)
|
||||
#if defined(ASMJIT_ARCH_X64)
|
||||
kArchHost = kArchX64,
|
||||
#endif // ASMJIT_HOST_X64
|
||||
#endif // ASMJIT_ARCH_X64
|
||||
|
||||
#if defined(ASMJIT_HOST_ARM)
|
||||
#if defined(ASMJIT_ARCH_ARM)
|
||||
kArchHost = kArchArm,
|
||||
#endif // ASMJIT_HOST_ARM
|
||||
#endif // ASMJIT_ARCH_ARM
|
||||
|
||||
//! Whether the host is 64-bit.
|
||||
kArchHost64Bit = sizeof(intptr_t) >= 8
|
||||
|
||||
@@ -82,7 +82,7 @@ struct IntUtil {
|
||||
//! Pack two 8-bit integer and one 16-bit integer into a 32-bit integer as it
|
||||
//! is an array of `{u0,u1,w2}`.
|
||||
static ASMJIT_INLINE uint32_t pack32_2x8_1x16(uint32_t u0, uint32_t u1, uint32_t w2) {
|
||||
#if defined(ASMJIT_HOST_LE)
|
||||
#if defined(ASMJIT_ARCH_LE)
|
||||
return u0 + (u1 << 8) + (w2 << 16);
|
||||
#else
|
||||
return (u0 << 24) + (u1 << 16) + (w2);
|
||||
@@ -91,7 +91,7 @@ struct IntUtil {
|
||||
|
||||
//! Pack four 8-bit integer into a 32-bit integer as it is an array of `{u0,u1,u2,u3}`.
|
||||
static ASMJIT_INLINE uint32_t pack32_4x8(uint32_t u0, uint32_t u1, uint32_t u2, uint32_t u3) {
|
||||
#if defined(ASMJIT_HOST_LE)
|
||||
#if defined(ASMJIT_ARCH_LE)
|
||||
return u0 + (u1 << 8) + (u2 << 16) + (u3 << 24);
|
||||
#else
|
||||
return (u0 << 24) + (u1 << 16) + (u2 << 8) + u3;
|
||||
@@ -100,7 +100,7 @@ struct IntUtil {
|
||||
|
||||
//! Pack two 32-bit integer into a 64-bit integer as it is an array of `{u0,u1}`.
|
||||
static ASMJIT_INLINE uint64_t pack64_2x32(uint32_t u0, uint32_t u1) {
|
||||
#if defined(ASMJIT_HOST_LE)
|
||||
#if defined(ASMJIT_ARCH_LE)
|
||||
return (static_cast<uint64_t>(u1) << 32) + u0;
|
||||
#else
|
||||
return (static_cast<uint64_t>(u0) << 32) + u1;
|
||||
@@ -694,11 +694,11 @@ union UInt64 {
|
||||
uint8_t u8[8];
|
||||
|
||||
struct {
|
||||
#if defined(ASMJIT_HOST_LE)
|
||||
#if defined(ASMJIT_ARCH_LE)
|
||||
uint32_t lo, hi;
|
||||
#else
|
||||
uint32_t hi, lo;
|
||||
#endif // ASMJIT_HOST_LE
|
||||
#endif // ASMJIT_ARCH_LE
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -26,11 +26,11 @@ namespace asmjit {
|
||||
//! \{
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kLoggerOption]
|
||||
// [asmjit::LoggerOption]
|
||||
// ============================================================================
|
||||
|
||||
//! Logger options.
|
||||
ASMJIT_ENUM(kLoggerOption) {
|
||||
ASMJIT_ENUM(LoggerOption) {
|
||||
//! Whether to output instructions also in binary form.
|
||||
kLoggerOptionBinaryForm = 0,
|
||||
|
||||
@@ -44,11 +44,11 @@ ASMJIT_ENUM(kLoggerOption) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kLoggerStyle]
|
||||
// [asmjit::LoggerStyle]
|
||||
// ============================================================================
|
||||
|
||||
//! Logger style.
|
||||
ASMJIT_ENUM(kLoggerStyle) {
|
||||
ASMJIT_ENUM(LoggerStyle) {
|
||||
kLoggerStyleDefault = 0,
|
||||
kLoggerStyleDirective = 1,
|
||||
kLoggerStyleLabel = 2,
|
||||
@@ -133,7 +133,7 @@ struct ASMJIT_VCLASS Logger {
|
||||
// [Members]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Options, see `kLoggerOption`.
|
||||
//! Options, see \ref LoggerOption.
|
||||
uint32_t _options;
|
||||
|
||||
//! Indentation.
|
||||
|
||||
@@ -27,11 +27,11 @@ struct Compiler;
|
||||
//! \{
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kOperandType]
|
||||
// [asmjit::OperandType]
|
||||
// ============================================================================
|
||||
|
||||
//! Operand types that can be encoded in `Operand`.
|
||||
ASMJIT_ENUM(kOperandType) {
|
||||
ASMJIT_ENUM(OperandType) {
|
||||
//! Invalid operand, used only internally (not initialized Operand).
|
||||
kOperandTypeNone = 0,
|
||||
//! Operand is a register.
|
||||
@@ -47,11 +47,11 @@ ASMJIT_ENUM(kOperandType) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kOperandId]
|
||||
// [asmjit::OperandId]
|
||||
// ============================================================================
|
||||
|
||||
//! Operand id masks used to determine the operand type.
|
||||
ASMJIT_ENUM(kOperandId) {
|
||||
ASMJIT_ENUM(OperandId) {
|
||||
//! Operand id refers to `Var`.
|
||||
kOperandIdVar = 0x80000000U,
|
||||
//! Operand id to real index mask.
|
||||
@@ -59,21 +59,21 @@ ASMJIT_ENUM(kOperandId) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kRegClass]
|
||||
// [asmjit::RegClass]
|
||||
// ============================================================================
|
||||
|
||||
//! Register class.
|
||||
ASMJIT_ENUM(kRegClass) {
|
||||
ASMJIT_ENUM(RegClass) {
|
||||
//! Gp register class, compatible with all architectures.
|
||||
kRegClassGp = 0
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kSize]
|
||||
// [asmjit::SizeDefs]
|
||||
// ============================================================================
|
||||
|
||||
//! Common size of registers and pointers.
|
||||
ASMJIT_ENUM(kSize) {
|
||||
ASMJIT_ENUM(SizeDefs) {
|
||||
//! 1 byte size (BYTE).
|
||||
kSizeByte = 1,
|
||||
//! 2 bytes size (WORD).
|
||||
@@ -91,11 +91,11 @@ ASMJIT_ENUM(kSize) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kMemType]
|
||||
// [asmjit::MemType]
|
||||
// ============================================================================
|
||||
|
||||
//! Type of memory operand.
|
||||
ASMJIT_ENUM(kMemType) {
|
||||
ASMJIT_ENUM(MemType) {
|
||||
//! Memory operand is a combination of base register and optional index register
|
||||
//! and displacement.
|
||||
//!
|
||||
@@ -135,7 +135,7 @@ struct Operand {
|
||||
//!
|
||||
//! Base operand data.
|
||||
struct BaseOp {
|
||||
//! Type of operand, see `kOperandType`.
|
||||
//! Type of operand, see \ref OperandType.
|
||||
uint8_t op;
|
||||
//! Size of operand (register, address, immediate, or variable).
|
||||
uint8_t size;
|
||||
@@ -170,7 +170,7 @@ struct Operand {
|
||||
|
||||
//! Register type and index access.
|
||||
struct {
|
||||
#if defined(ASMJIT_HOST_LE)
|
||||
#if defined(ASMJIT_ARCH_LE)
|
||||
//! Register index.
|
||||
uint8_t index;
|
||||
//! Register type.
|
||||
@@ -212,10 +212,10 @@ struct Operand {
|
||||
uint8_t op;
|
||||
//! Size of the pointer in bytes.
|
||||
uint8_t size;
|
||||
//! Type of the memory operand, see `kMemType`.
|
||||
//! Type of the memory operand, see `MemType`.
|
||||
uint8_t type;
|
||||
//! X86/X64 layout:
|
||||
//! - segment [3 bits], see `kX86Seg`.
|
||||
//! - segment [3 bits], see `X86Seg`.
|
||||
//! - shift [2 bits], index register shift (0 to 3).
|
||||
uint8_t flags;
|
||||
|
||||
@@ -378,7 +378,7 @@ struct Operand {
|
||||
// [Type]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get type of the operand, see `kOperandType`.
|
||||
//! Get type of the operand, see \ref OperandType.
|
||||
ASMJIT_INLINE uint32_t getOp() const { return _base.op; }
|
||||
|
||||
//! Get whether the operand is none - `kOperandTypeNone`.
|
||||
@@ -659,7 +659,7 @@ struct BaseMem : public Operand {
|
||||
_init_packed_d2_d3(kInvalidValue, 0);
|
||||
}
|
||||
|
||||
//! Get the type of the memory operand, see `kMemType`.
|
||||
//! Get the type of the memory operand, see `MemType`.
|
||||
ASMJIT_INLINE uint32_t getMemType() const {
|
||||
return _vmem.type;
|
||||
}
|
||||
@@ -774,17 +774,17 @@ struct Imm : public Operand {
|
||||
ASMJIT_INLINE bool isUInt32() const { return IntUtil::isUInt32(_imm.value._i64[0]); }
|
||||
|
||||
//! Get immediate value as 8-bit signed integer.
|
||||
ASMJIT_INLINE int8_t getInt8() const { return _imm.value._i8[_ASMJIT_HOST_INDEX(8, 0)]; }
|
||||
ASMJIT_INLINE int8_t getInt8() const { return _imm.value._i8[_ASMJIT_ARCH_INDEX(8, 0)]; }
|
||||
//! Get immediate value as 8-bit unsigned integer.
|
||||
ASMJIT_INLINE uint8_t getUInt8() const { return _imm.value._u8[_ASMJIT_HOST_INDEX(8, 0)]; }
|
||||
ASMJIT_INLINE uint8_t getUInt8() const { return _imm.value._u8[_ASMJIT_ARCH_INDEX(8, 0)]; }
|
||||
//! Get immediate value as 16-bit signed integer.
|
||||
ASMJIT_INLINE int16_t getInt16() const { return _imm.value._i16[_ASMJIT_HOST_INDEX(4, 0)]; }
|
||||
ASMJIT_INLINE int16_t getInt16() const { return _imm.value._i16[_ASMJIT_ARCH_INDEX(4, 0)]; }
|
||||
//! Get immediate value as 16-bit unsigned integer.
|
||||
ASMJIT_INLINE uint16_t getUInt16() const { return _imm.value._u16[_ASMJIT_HOST_INDEX(4, 0)]; }
|
||||
ASMJIT_INLINE uint16_t getUInt16() const { return _imm.value._u16[_ASMJIT_ARCH_INDEX(4, 0)]; }
|
||||
//! Get immediate value as 32-bit signed integer.
|
||||
ASMJIT_INLINE int32_t getInt32() const { return _imm.value._i32[_ASMJIT_HOST_INDEX(2, 0)]; }
|
||||
ASMJIT_INLINE int32_t getInt32() const { return _imm.value._i32[_ASMJIT_ARCH_INDEX(2, 0)]; }
|
||||
//! Get immediate value as 32-bit unsigned integer.
|
||||
ASMJIT_INLINE uint32_t getUInt32() const { return _imm.value._u32[_ASMJIT_HOST_INDEX(2, 0)]; }
|
||||
ASMJIT_INLINE uint32_t getUInt32() const { return _imm.value._u32[_ASMJIT_ARCH_INDEX(2, 0)]; }
|
||||
//! Get immediate value as 64-bit signed integer.
|
||||
ASMJIT_INLINE int64_t getInt64() const { return _imm.value._i64[0]; }
|
||||
//! Get immediate value as 64-bit unsigned integer.
|
||||
@@ -807,13 +807,13 @@ struct Imm : public Operand {
|
||||
}
|
||||
|
||||
//! Get low 32-bit signed integer.
|
||||
ASMJIT_INLINE int32_t getInt32Lo() const { return _imm.value._i32[_ASMJIT_HOST_INDEX(2, 0)]; }
|
||||
ASMJIT_INLINE int32_t getInt32Lo() const { return _imm.value._i32[_ASMJIT_ARCH_INDEX(2, 0)]; }
|
||||
//! Get low 32-bit signed integer.
|
||||
ASMJIT_INLINE uint32_t getUInt32Lo() const { return _imm.value._u32[_ASMJIT_HOST_INDEX(2, 0)]; }
|
||||
ASMJIT_INLINE uint32_t getUInt32Lo() const { return _imm.value._u32[_ASMJIT_ARCH_INDEX(2, 0)]; }
|
||||
//! Get high 32-bit signed integer.
|
||||
ASMJIT_INLINE int32_t getInt32Hi() const { return _imm.value._i32[_ASMJIT_HOST_INDEX(2, 1)]; }
|
||||
ASMJIT_INLINE int32_t getInt32Hi() const { return _imm.value._i32[_ASMJIT_ARCH_INDEX(2, 1)]; }
|
||||
//! Get high 32-bit signed integer.
|
||||
ASMJIT_INLINE uint32_t getUInt32Hi() const { return _imm.value._u32[_ASMJIT_HOST_INDEX(2, 1)]; }
|
||||
ASMJIT_INLINE uint32_t getUInt32Hi() const { return _imm.value._u32[_ASMJIT_ARCH_INDEX(2, 1)]; }
|
||||
|
||||
//! Set immediate value to 8-bit signed integer `val`.
|
||||
ASMJIT_INLINE Imm& setInt8(int8_t val) {
|
||||
@@ -822,8 +822,8 @@ struct Imm : public Operand {
|
||||
}
|
||||
else {
|
||||
int32_t val32 = static_cast<int32_t>(val);
|
||||
_imm.value._i32[_ASMJIT_HOST_INDEX(2, 0)] = val32;
|
||||
_imm.value._i32[_ASMJIT_HOST_INDEX(2, 1)] = val32 >> 31;
|
||||
_imm.value._i32[_ASMJIT_ARCH_INDEX(2, 0)] = val32;
|
||||
_imm.value._i32[_ASMJIT_ARCH_INDEX(2, 1)] = val32 >> 31;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -834,8 +834,8 @@ struct Imm : public Operand {
|
||||
_imm.value._u64[0] = static_cast<uint64_t>(val);
|
||||
}
|
||||
else {
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 0)] = static_cast<uint32_t>(val);
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 1)] = 0;
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 0)] = static_cast<uint32_t>(val);
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 1)] = 0;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -847,8 +847,8 @@ struct Imm : public Operand {
|
||||
}
|
||||
else {
|
||||
int32_t val32 = static_cast<int32_t>(val);
|
||||
_imm.value._i32[_ASMJIT_HOST_INDEX(2, 0)] = val32;
|
||||
_imm.value._i32[_ASMJIT_HOST_INDEX(2, 1)] = val32 >> 31;
|
||||
_imm.value._i32[_ASMJIT_ARCH_INDEX(2, 0)] = val32;
|
||||
_imm.value._i32[_ASMJIT_ARCH_INDEX(2, 1)] = val32 >> 31;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -859,8 +859,8 @@ struct Imm : public Operand {
|
||||
_imm.value._u64[0] = static_cast<uint64_t>(val);
|
||||
}
|
||||
else {
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 0)] = static_cast<uint32_t>(val);
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 1)] = 0;
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 0)] = static_cast<uint32_t>(val);
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 1)] = 0;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -871,8 +871,8 @@ struct Imm : public Operand {
|
||||
_imm.value._i64[0] = static_cast<int64_t>(val);
|
||||
}
|
||||
else {
|
||||
_imm.value._i32[_ASMJIT_HOST_INDEX(2, 0)] = val;
|
||||
_imm.value._i32[_ASMJIT_HOST_INDEX(2, 1)] = val >> 31;
|
||||
_imm.value._i32[_ASMJIT_ARCH_INDEX(2, 0)] = val;
|
||||
_imm.value._i32[_ASMJIT_ARCH_INDEX(2, 1)] = val >> 31;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -883,8 +883,8 @@ struct Imm : public Operand {
|
||||
_imm.value._u64[0] = static_cast<uint64_t>(val);
|
||||
}
|
||||
else {
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 0)] = val;
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 1)] = 0;
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 0)] = val;
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 1)] = 0;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -921,8 +921,8 @@ struct Imm : public Operand {
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
ASMJIT_INLINE Imm& setFloat(float f) {
|
||||
_imm.value._f32[_ASMJIT_HOST_INDEX(2, 0)] = f;
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 1)] = 0;
|
||||
_imm.value._f32[_ASMJIT_ARCH_INDEX(2, 0)] = f;
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 1)] = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -940,8 +940,8 @@ struct Imm : public Operand {
|
||||
_imm.value._u64[0] &= static_cast<uint64_t>(0x000000FFU);
|
||||
}
|
||||
else {
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 0)] &= 0x000000FFU;
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 1)] = 0;
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 0)] &= 0x000000FFU;
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 1)] = 0;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -951,14 +951,14 @@ struct Imm : public Operand {
|
||||
_imm.value._u64[0] &= static_cast<uint64_t>(0x0000FFFFU);
|
||||
}
|
||||
else {
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 0)] &= 0x0000FFFFU;
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 1)] = 0;
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 0)] &= 0x0000FFFFU;
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 1)] = 0;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
ASMJIT_INLINE Imm& truncateTo32Bits() {
|
||||
_imm.value._u32[_ASMJIT_HOST_INDEX(2, 1)] = 0;
|
||||
_imm.value._u32[_ASMJIT_ARCH_INDEX(2, 1)] = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ const CpuInfo* HostRuntime::getCpuInfo() {
|
||||
uint32_t HostRuntime::getStackAlignment() {
|
||||
uint32_t alignment = sizeof(intptr_t);
|
||||
|
||||
#if defined(ASMJIT_HOST_X86)
|
||||
#if defined(ASMJIT_ARCH_X86)
|
||||
// Modern Linux, APPLE and UNIX guarantees 16-byte stack alignment, but I'm
|
||||
// not sure about all other UNIX operating systems, because 16-byte alignment
|
||||
// is addition to an older specification.
|
||||
@@ -69,7 +69,7 @@ uint32_t HostRuntime::getStackAlignment() {
|
||||
defined(__APPLE__) )
|
||||
alignment = 16;
|
||||
# endif
|
||||
#elif defined(ASMJIT_HOST_X64)
|
||||
#elif defined(ASMJIT_ARCH_X64)
|
||||
alignment = 16;
|
||||
#endif
|
||||
|
||||
@@ -78,14 +78,14 @@ uint32_t HostRuntime::getStackAlignment() {
|
||||
|
||||
void HostRuntime::flush(void* p, size_t size) {
|
||||
// Only useful on non-x86 architectures.
|
||||
#if !defined(ASMJIT_HOST_X86) && !defined(ASMJIT_HOST_X64)
|
||||
#if !defined(ASMJIT_ARCH_X86) && !defined(ASMJIT_ARCH_X64)
|
||||
|
||||
// Windows has built-in support in kernel32.dll.
|
||||
#if defined(ASMJIT_OS_WINDOWS)
|
||||
::FlushInstructionCache(_memMgr.getProcessHandle(), p, size);
|
||||
#endif // ASMJIT_OS_WINDOWS
|
||||
|
||||
#endif // !ASMJIT_HOST_X86 && !ASMJIT_HOST_X64
|
||||
#endif // !ASMJIT_ARCH_X86 && !ASMJIT_ARCH_X64
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
@@ -28,12 +28,11 @@ struct CpuInfo;
|
||||
//! \{
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kRuntimeType]
|
||||
// [asmjit::RuntimeType]
|
||||
// ============================================================================
|
||||
|
||||
ASMJIT_ENUM(kRuntimeType) {
|
||||
ASMJIT_ENUM(RuntimeType) {
|
||||
kRuntimeTypeNone = 0,
|
||||
|
||||
kRuntimeTypeJit = 1,
|
||||
kRuntimeTypeRemote = 2
|
||||
};
|
||||
@@ -90,7 +89,7 @@ struct ASMJIT_VCLASS Runtime {
|
||||
//! relocate it to the target location.
|
||||
//!
|
||||
//! The beginning of the memory allocated for the function is returned in
|
||||
//! `dst`. Returns Status code as \ref kError, on failure `dst` is set to
|
||||
//! `dst`. Returns Status code as \ref ErrorCode, on failure `dst` is set to
|
||||
//! `NULL`.
|
||||
virtual Error add(void** dst, Assembler* assembler) = 0;
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ namespace asmjit {
|
||||
//! \{
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kStringOp]
|
||||
// [asmjit::StringOp]
|
||||
// ============================================================================
|
||||
|
||||
//! \internal
|
||||
//!
|
||||
//! String operation.
|
||||
ASMJIT_ENUM(kStringOp) {
|
||||
ASMJIT_ENUM(StringOp) {
|
||||
//! Replace the current string by a given content.
|
||||
kStringOpSet = 0,
|
||||
//! Append a given content to the current string.
|
||||
@@ -37,13 +37,13 @@ ASMJIT_ENUM(kStringOp) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kStringFormat]
|
||||
// [asmjit::StringFormatFlags]
|
||||
// ============================================================================
|
||||
|
||||
//! \internal
|
||||
//!
|
||||
//! String format flags.
|
||||
ASMJIT_ENUM(kStringFormat) {
|
||||
ASMJIT_ENUM(StringFormatFlags) {
|
||||
kStringFormatShowSign = 0x00000001,
|
||||
kStringFormatShowSpace = 0x00000002,
|
||||
kStringFormatAlternate = 0x00000004,
|
||||
|
||||
@@ -512,7 +512,7 @@ static void vMemMgrInsertNode(VMemMgr* self, MemNode* node) {
|
||||
}
|
||||
else {
|
||||
// False tree root.
|
||||
RbNode head = { 0 };
|
||||
RbNode head = { { NULL, NULL }, 0, 0 };
|
||||
|
||||
// Grandparent & parent.
|
||||
RbNode* g = NULL;
|
||||
@@ -590,7 +590,7 @@ static void vMemMgrInsertNode(VMemMgr* self, MemNode* node) {
|
||||
//! the `node` passed.
|
||||
static MemNode* vMemMgrRemoveNode(VMemMgr* self, MemNode* node) {
|
||||
// False tree root.
|
||||
RbNode head = { 0 };
|
||||
RbNode head = { { NULL, NULL }, 0, 0 };
|
||||
|
||||
// Helpers.
|
||||
RbNode* q = &head;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#ifndef _ASMJIT_BASE_VMEM_H
|
||||
#define _ASMJIT_BASE_VMEM_H
|
||||
|
||||
// [Dependencies]
|
||||
// [Dependencies - AsmJit]
|
||||
#include "../base/error.h"
|
||||
#include "../base/lock.h"
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace asmjit {
|
||||
//! \{
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kVMemAlloc]
|
||||
// [asmjit::VMemAllocType]
|
||||
// ============================================================================
|
||||
|
||||
//! Type of virtual memory allocation, see `VMemMgr::alloc()`.
|
||||
ASMJIT_ENUM(kVMemAlloc) {
|
||||
ASMJIT_ENUM(VMemAllocType) {
|
||||
//! Normal memory allocation, has to be freed by `VMemMgr::release()`.
|
||||
kVMemAllocFreeable = 0,
|
||||
//! Allocate permanent memory, can't be freed.
|
||||
@@ -33,11 +33,11 @@ ASMJIT_ENUM(kVMemAlloc) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kVMemFlags]
|
||||
// [asmjit::VMemFlags]
|
||||
// ============================================================================
|
||||
|
||||
//! Type of virtual memory allocation, see `VMemMgr::alloc()`.
|
||||
ASMJIT_ENUM(kVMemFlags) {
|
||||
ASMJIT_ENUM(VMemFlags) {
|
||||
//! Memory is writable.
|
||||
kVMemFlagWritable = 0x00000001,
|
||||
//! Memory is executable.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#ifndef _ASMJIT_BASE_ZONE_H
|
||||
#define _ASMJIT_BASE_ZONE_H
|
||||
|
||||
// [Dependencies]
|
||||
// [Dependencies - AsmJit]
|
||||
#include "../base/globals.h"
|
||||
|
||||
// [Api-Begin]
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
#ifndef _ASMJIT_BUILD_H
|
||||
#define _ASMJIT_BUILD_H
|
||||
|
||||
// [Include]
|
||||
// [Config]
|
||||
#if defined(ASMJIT_CONFIG_FILE)
|
||||
# include ASMJIT_CONFIG_FILE
|
||||
#else
|
||||
# include "./config.h"
|
||||
#endif // ASMJIT_CONFIG_FILE
|
||||
|
||||
// Turn off deprecation warnings when compiling AsmJit.
|
||||
// [MSC - Turn off deprecation warnings when compiling AsmJit]
|
||||
#if defined(ASMJIT_EXPORTS) && defined(_MSC_VER)
|
||||
# if !defined(_CRT_SECURE_NO_DEPRECATE)
|
||||
# define _CRT_SECURE_NO_DEPRECATE
|
||||
@@ -26,6 +26,7 @@
|
||||
#endif // ASMJIT_EXPORTS
|
||||
|
||||
// [Dependencies - C]
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -34,7 +35,7 @@
|
||||
#include <new>
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - Sanity]
|
||||
// [asmjit::Build - Sanity]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(ASMJIT_DISABLE_NAMES) && !defined(ASMJIT_DISABLE_LOGGER)
|
||||
@@ -42,7 +43,7 @@
|
||||
#endif // ASMJIT_DISABLE_NAMES && !ASMJIT_DISABLE_LOGGER
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - OS]
|
||||
// [asmjit::Build - OS]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(_WINDOWS) || defined(__WINDOWS__) || defined(_WIN32) || defined(_WIN64)
|
||||
@@ -57,34 +58,41 @@
|
||||
# define ASMJIT_OS_POSIX
|
||||
# define ASMJIT_OS_MAC
|
||||
#else
|
||||
# warning "AsmJit - Unable to detect host operating system, using ASMJIT_OS_POSIX"
|
||||
# pragma message("AsmJit - Unable to detect host operating system, using ASMJIT_OS_POSIX.")
|
||||
# define ASMJIT_OS_POSIX
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - Arch]
|
||||
// [asmjit::Build - Arch]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(_M_X64 ) || \
|
||||
defined(_M_AMD64 ) || \
|
||||
defined(_WIN64 ) || \
|
||||
// [X64]
|
||||
#if defined(__x86_64__) || \
|
||||
defined(__amd64__ ) || \
|
||||
defined(__LP64 ) || \
|
||||
defined(__x86_64__)
|
||||
# define ASMJIT_HOST_X64
|
||||
# define ASMJIT_HOST_LE
|
||||
# define ASMJIT_HOST_UNALIGNED_16
|
||||
# define ASMJIT_HOST_UNALIGNED_32
|
||||
# define ASMJIT_HOST_UNALIGNED_64
|
||||
defined(_M_X64 ) || \
|
||||
defined(_M_AMD64 ) || \
|
||||
defined(_WIN64 )
|
||||
|
||||
# define ASMJIT_ARCH_X64
|
||||
# define ASMJIT_ARCH_LE
|
||||
# define ASMJIT_ARCH_UNALIGNED_16
|
||||
# define ASMJIT_ARCH_UNALIGNED_32
|
||||
# define ASMJIT_ARCH_UNALIGNED_64
|
||||
|
||||
// [X86]
|
||||
#elif \
|
||||
defined(_M_IX86 ) || \
|
||||
defined(__INTEL__) || \
|
||||
defined(__i386__ )
|
||||
# define ASMJIT_HOST_X86
|
||||
# define ASMJIT_HOST_LE
|
||||
# define ASMJIT_HOST_UNALIGNED_16
|
||||
# define ASMJIT_HOST_UNALIGNED_32
|
||||
# define ASMJIT_HOST_UNALIGNED_64
|
||||
|
||||
# define ASMJIT_ARCH_X86
|
||||
# define ASMJIT_ARCH_LE
|
||||
# define ASMJIT_ARCH_UNALIGNED_16
|
||||
# define ASMJIT_ARCH_UNALIGNED_32
|
||||
# define ASMJIT_ARCH_UNALIGNED_64
|
||||
|
||||
// [Arm]
|
||||
#elif \
|
||||
defined(_ARM ) || \
|
||||
defined(_M_ARM_FP ) || \
|
||||
@@ -94,14 +102,17 @@
|
||||
defined(__TARGET_ARCH_ARM ) || \
|
||||
defined(__TARGET_ARCH_THUMB) || \
|
||||
defined(__thumb__ )
|
||||
# define ASMJIT_HOST_ARM
|
||||
# define ASMJIT_HOST_LE
|
||||
|
||||
# define ASMJIT_ARCH_ARM
|
||||
# define ASMJIT_ARCH_LE
|
||||
|
||||
// [Unknown]
|
||||
#else
|
||||
# warning "AsmJit - Unable to detect host architecture"
|
||||
# error "AsmJit - Unable to detect host architecture."
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - Build]
|
||||
// [asmjit::Build - Build]
|
||||
// ============================================================================
|
||||
|
||||
// Build host architecture if no architecture is selected.
|
||||
@@ -113,16 +124,16 @@
|
||||
|
||||
// Autodetect host architecture if enabled.
|
||||
#if defined(ASMJIT_BUILD_HOST)
|
||||
# if defined(ASMJIT_HOST_X86) && !defined(ASMJIT_BUILD_X86)
|
||||
# if defined(ASMJIT_ARCH_X86) && !defined(ASMJIT_BUILD_X86)
|
||||
# define ASMJIT_BUILD_X86
|
||||
# endif // ASMJIT_HOST_X86 && !ASMJIT_BUILD_X86
|
||||
# if defined(ASMJIT_HOST_X64) && !defined(ASMJIT_BUILD_X64)
|
||||
# endif // ASMJIT_ARCH_X86 && !ASMJIT_BUILD_X86
|
||||
# if defined(ASMJIT_ARCH_X64) && !defined(ASMJIT_BUILD_X64)
|
||||
# define ASMJIT_BUILD_X64
|
||||
# endif // ASMJIT_HOST_X64 && !ASMJIT_BUILD_X64
|
||||
# endif // ASMJIT_ARCH_X64 && !ASMJIT_BUILD_X64
|
||||
#endif // ASMJIT_BUILD_HOST
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - Decorators]
|
||||
// [asmjit::Build - Decorators]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(ASMJIT_EMBED) && !defined(ASMJIT_STATIC)
|
||||
@@ -179,7 +190,7 @@
|
||||
# define ASMJIT_INLINE inline
|
||||
#endif
|
||||
|
||||
#if defined(ASMJIT_HOST_X86)
|
||||
#if defined(ASMJIT_ARCH_X86)
|
||||
# if defined(__GNUC__) || defined(__clang__)
|
||||
# define ASMJIT_REGPARM_1 __attribute__((regparm(1)))
|
||||
# define ASMJIT_REGPARM_2 __attribute__((regparm(2)))
|
||||
@@ -196,20 +207,20 @@
|
||||
# define ASMJIT_FASTCALL
|
||||
# define ASMJIT_STDCALL
|
||||
# define ASMJIT_CDECL
|
||||
#endif // ASMJIT_HOST_X86
|
||||
#endif // ASMJIT_ARCH_X86
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - Enum]
|
||||
// [asmjit::Build - Enum]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||
# define ASMJIT_ENUM(_Name_) enum _Name_ : uint32_t
|
||||
#else
|
||||
# define ASMJIT_ENUM(_Name_) enum _Name_
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - Memory Management]
|
||||
// [asmjit::Build - Memory Management]
|
||||
// ============================================================================
|
||||
|
||||
#if !defined(ASMJIT_ALLOC) && !defined(ASMJIT_REALLOC) && !defined(ASMJIT_FREE)
|
||||
@@ -223,17 +234,17 @@
|
||||
#endif // !ASMJIT_ALLOC && !ASMJIT_REALLOC && !ASMJIT_FREE
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - _ASMJIT_HOST_INDEX]
|
||||
// [asmjit::Build - _ASMJIT_ARCH_INDEX]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(ASMJIT_HOST_LE)
|
||||
# define _ASMJIT_HOST_INDEX(_Total_, _Index_) (_Index_)
|
||||
#if defined(ASMJIT_ARCH_LE)
|
||||
# define _ASMJIT_ARCH_INDEX(_Total_, _Index_) (_Index_)
|
||||
#else
|
||||
# define _ASMJIT_HOST_INDEX(_Total_, _Index_) ((_Total_) - 1 - (_Index_))
|
||||
# define _ASMJIT_ARCH_INDEX(_Total_, _Index_) ((_Total_) - 1 - (_Index_))
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - BLEND_OFFSET_OF]
|
||||
// [asmjit::Build - BLEND_OFFSET_OF]
|
||||
// ============================================================================
|
||||
|
||||
//! Cross-platform solution to get offset of `_Field_` in `_Struct_`.
|
||||
@@ -241,14 +252,14 @@
|
||||
static_cast<int>((intptr_t) ((const uint8_t*) &((const _Struct_*)0x1)->_Field_) - 1)
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - ASMJIT_ARRAY_SIZE]
|
||||
// [asmjit::Build - ASMJIT_ARRAY_SIZE]
|
||||
// ============================================================================
|
||||
|
||||
#define ASMJIT_ARRAY_SIZE(_Array_) \
|
||||
(sizeof(_Array_) / sizeof(*_Array_))
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - ASMJIT_DEBUG / ASMJIT_TRACE]
|
||||
// [asmjit::Build - ASMJIT_DEBUG / ASMJIT_TRACE]
|
||||
// ============================================================================
|
||||
|
||||
// If ASMJIT_DEBUG and ASMJIT_RELEASE is not defined ASMJIT_DEBUG will be
|
||||
@@ -274,7 +285,7 @@ namespace asmjit { static inline int disabledTrace(...) { return 0; } }
|
||||
#endif // ASMJIT_EXPORTS
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - ASMJIT_UNUSED]
|
||||
// [asmjit::Build - ASMJIT_UNUSED]
|
||||
// ============================================================================
|
||||
|
||||
#if !defined(ASMJIT_UNUSED)
|
||||
@@ -282,7 +293,7 @@ namespace asmjit { static inline int disabledTrace(...) { return 0; } }
|
||||
#endif // ASMJIT_UNUSED
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - ASMJIT_NOP]
|
||||
// [asmjit::Build - ASMJIT_NOP]
|
||||
// ============================================================================
|
||||
|
||||
#if !defined(ASMJIT_NOP)
|
||||
@@ -290,7 +301,7 @@ namespace asmjit { static inline int disabledTrace(...) { return 0; } }
|
||||
#endif // ASMJIT_NOP
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - ASMJIT_NO_COPY]
|
||||
// [asmjit::Build - ASMJIT_NO_COPY]
|
||||
// ============================================================================
|
||||
|
||||
#define ASMJIT_NO_COPY(_Type_) \
|
||||
@@ -300,7 +311,7 @@ private: \
|
||||
public:
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - StdInt]
|
||||
// [asmjit::Build - StdInt]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
@@ -308,7 +319,7 @@ public:
|
||||
#endif // __MINGW32__
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
# if !defined(ASMJIT_SUPRESS_STD_TYPES)
|
||||
# if !defined(ASMJIT_SUPPRESS_STD_TYPES)
|
||||
# if (_MSC_VER < 1300)
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
@@ -328,7 +339,7 @@ typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
# endif // _MSC_VER
|
||||
# endif // ASMJIT_SUPRESS_STD_TYPES
|
||||
# endif // ASMJIT_SUPPRESS_STD_TYPES
|
||||
#else
|
||||
# include <stdint.h>
|
||||
# include <limits.h>
|
||||
@@ -343,10 +354,10 @@ typedef unsigned __int64 uint64_t;
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - Windows]
|
||||
// [asmjit::Build - Windows]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(ASMJIT_OS_WINDOWS) && !defined(ASMJIT_SUPRESS_WINDOWS_H)
|
||||
#if defined(ASMJIT_OS_WINDOWS) && !defined(ASMJIT_SUPPRESS_WINDOWS_H)
|
||||
|
||||
# if !defined(WIN32_LEAN_AND_MEAN)
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
@@ -370,10 +381,10 @@ typedef unsigned __int64 uint64_t;
|
||||
# undef ASMJIT_UNDEF_WIN32_LEAN_AND_MEAN
|
||||
# endif
|
||||
|
||||
#endif // ASMJIT_OS_WINDOWS && !ASMJIT_SUPRESS_WINDOWS_H
|
||||
#endif // ASMJIT_OS_WINDOWS && !ASMJIT_SUPPRESS_WINDOWS_H
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::build - Test]
|
||||
// [asmjit::Build - Test]
|
||||
// ============================================================================
|
||||
|
||||
// Include a unit testing package if this is a `asmjit_test` build.
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// Zlib - See LICENSE.md file in the package.
|
||||
|
||||
// [Guard]
|
||||
#ifndef _ASMJIT_HOST_H
|
||||
#define _ASMJIT_HOST_H
|
||||
#ifndef _ASMJIT_ARCH_H
|
||||
#define _ASMJIT_ARCH_H
|
||||
|
||||
// [Dependencies - Core]
|
||||
#include "base.h"
|
||||
@@ -15,7 +15,7 @@
|
||||
// [asmjit::host - X86 / X64]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(ASMJIT_HOST_X86) || defined(ASMJIT_HOST_X64)
|
||||
#if defined(ASMJIT_ARCH_X86) || defined(ASMJIT_ARCH_X64)
|
||||
#include "x86.h"
|
||||
|
||||
namespace asmjit {
|
||||
@@ -53,7 +53,7 @@ typedef X86YmmVar YmmVar;
|
||||
|
||||
} // asmjit namespace
|
||||
|
||||
#endif // ASMJIT_HOST_X86 || ASMJIT_HOST_X64
|
||||
#endif // ASMJIT_ARCH_X86 || ASMJIT_ARCH_X64
|
||||
|
||||
// [Guard]
|
||||
#endif // _ASMJIT_HOST_H
|
||||
#endif // _ASMJIT_ARCH_H
|
||||
|
||||
@@ -35,7 +35,7 @@ enum { kX86RexNoRexMask = kX86InstOptionRex | _kX86InstOptionNoRex };
|
||||
//! \internal
|
||||
//!
|
||||
//! X86/X64 bytes used to encode important prefixes.
|
||||
enum kX86Byte {
|
||||
enum X86Byte {
|
||||
//! 1-byte REX prefix
|
||||
kX86ByteRex = 0x40,
|
||||
|
||||
@@ -85,7 +85,7 @@ enum kX86Byte {
|
||||
};
|
||||
|
||||
// AsmJit specific (used to encode VVVV field in XOP/VEX).
|
||||
enum kVexVVVV {
|
||||
enum VexVVVV {
|
||||
kVexVVVVShift = 12,
|
||||
kVexVVVVMask = 0xF << kVexVVVVShift
|
||||
};
|
||||
|
||||
@@ -385,9 +385,9 @@ struct ASMJIT_VCLASS X86Assembler : public Assembler {
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
ASMJIT_API X86Assembler(Runtime* runtime, uint32_t arch
|
||||
#if defined(ASMJIT_HOST_X86) || defined(ASMJIT_HOST_X64)
|
||||
#if defined(ASMJIT_ARCH_X86) || defined(ASMJIT_ARCH_X64)
|
||||
= kArchHost
|
||||
#endif // ASMJIT_HOST_X86 || ASMJIT_HOST_X64
|
||||
#endif // ASMJIT_ARCH_X86 || ASMJIT_ARCH_X64
|
||||
);
|
||||
ASMJIT_API virtual ~X86Assembler();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ struct X86VarState;
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 variable type.
|
||||
ASMJIT_ENUM(kX86VarType) {
|
||||
ASMJIT_ENUM(X86VarType) {
|
||||
//! Variable is SP-FP (x87).
|
||||
kX86VarTypeFp32 = kVarTypeFp32,
|
||||
//! Variable is DP-FP (x87).
|
||||
@@ -94,17 +94,17 @@ ASMJIT_ENUM(kX86VarType) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86VarAttr]
|
||||
// [asmjit::X86VarAttr]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 VarAttr flags.
|
||||
ASMJIT_ENUM(kX86VarAttr) {
|
||||
ASMJIT_ENUM(X86VarAttr) {
|
||||
kX86VarAttrGpbLo = 0x10000000,
|
||||
kX86VarAttrGpbHi = 0x20000000
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86FuncConv]
|
||||
// [asmjit::X86FuncConv]
|
||||
// ============================================================================
|
||||
|
||||
//! X86 function calling conventions.
|
||||
@@ -135,7 +135,7 @@ ASMJIT_ENUM(kX86VarAttr) {
|
||||
//! convention.
|
||||
//!
|
||||
//! These types are used together with `Compiler::addFunc()` method.
|
||||
ASMJIT_ENUM(kX86FuncConv) {
|
||||
ASMJIT_ENUM(X86FuncConv) {
|
||||
// --------------------------------------------------------------------------
|
||||
// [X64]
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -362,7 +362,7 @@ ASMJIT_ENUM(kX86FuncConv) {
|
||||
|
||||
#if !defined(ASMJIT_DOCGEN)
|
||||
// X86/X64 Host Support - documented in base/compiler.h.
|
||||
#if defined(ASMJIT_HOST_X86)
|
||||
#if defined(ASMJIT_ARCH_X86)
|
||||
enum {
|
||||
// X86.
|
||||
kFuncConvHost = kX86FuncConvCDecl,
|
||||
@@ -375,12 +375,12 @@ enum {
|
||||
#elif defined(__BORLANDC__)
|
||||
kFuncConvHostFastCall = kX86FuncConvBorlandFastCall
|
||||
#else
|
||||
#error "kFuncConvHostFastCall not determined."
|
||||
#error "AsmJit - kFuncConvHostFastCall not determined."
|
||||
#endif
|
||||
};
|
||||
#endif // ASMJIT_HOST_X86
|
||||
#endif // ASMJIT_ARCH_X86
|
||||
|
||||
#if defined(ASMJIT_HOST_X64)
|
||||
#if defined(ASMJIT_ARCH_X64)
|
||||
enum {
|
||||
#if defined(ASMJIT_OS_WINDOWS)
|
||||
kFuncConvHost = kX86FuncConvW64,
|
||||
@@ -391,15 +391,15 @@ enum {
|
||||
kFuncConvHostStdCall = kFuncConvHost,
|
||||
kFuncConvHostFastCall = kFuncConvHost
|
||||
};
|
||||
#endif // ASMJIT_HOST_X64
|
||||
#endif // ASMJIT_ARCH_X64
|
||||
#endif // !ASMJIT_DOCGEN
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86FuncHint]
|
||||
// [asmjit::X86FuncHint]
|
||||
// ============================================================================
|
||||
|
||||
//! X86 function hints.
|
||||
ASMJIT_ENUM(kX86FuncHint) {
|
||||
ASMJIT_ENUM(X86FuncHint) {
|
||||
//! Use push/pop sequences instead of mov sequences in function prolog
|
||||
//! and epilog.
|
||||
kX86FuncHintPushPop = 16,
|
||||
@@ -412,11 +412,11 @@ ASMJIT_ENUM(kX86FuncHint) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86FuncFlags]
|
||||
// [asmjit::X86FuncFlags]
|
||||
// ============================================================================
|
||||
|
||||
//! X86 function flags.
|
||||
ASMJIT_ENUM(kX86FuncFlags) {
|
||||
ASMJIT_ENUM(X86FuncFlags) {
|
||||
//! Whether to emit register load/save sequence using push/pop pairs.
|
||||
kX86FuncFlagPushPop = 0x00010000,
|
||||
|
||||
@@ -458,13 +458,13 @@ struct X86VarInfo {
|
||||
// [Accessors]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get register type, see `kX86RegType`.
|
||||
//! Get register type, see `X86RegType`.
|
||||
ASMJIT_INLINE uint32_t getReg() const { return _reg; }
|
||||
//! Get register size in bytes.
|
||||
ASMJIT_INLINE uint32_t getSize() const { return _size; }
|
||||
//! Get variable class, see `kRegClass`.
|
||||
//! Get variable class, see `RegClass`.
|
||||
ASMJIT_INLINE uint32_t getClass() const { return _class; }
|
||||
//! Get variable description, see `kVarFlag`.
|
||||
//! Get variable description, see `VarFlag`.
|
||||
ASMJIT_INLINE uint32_t getDesc() const { return _desc; }
|
||||
//! Get variable type name.
|
||||
ASMJIT_INLINE const char* getName() const { return _name; }
|
||||
@@ -473,13 +473,13 @@ struct X86VarInfo {
|
||||
// [Members]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Register type, see `kX86RegType`.
|
||||
//! Register type, see `X86RegType`.
|
||||
uint8_t _reg;
|
||||
//! Register size in bytes.
|
||||
uint8_t _size;
|
||||
//! Register class, see `kRegClass`.
|
||||
//! Register class, see `RegClass`.
|
||||
uint8_t _class;
|
||||
//! Variable flags, see `kVarFlag`.
|
||||
//! Variable flags, see `VarFlag`.
|
||||
uint8_t _desc;
|
||||
//! Variable type name.
|
||||
char _name[4];
|
||||
@@ -1427,7 +1427,7 @@ struct X86CallNode : public CallNode {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::X86TypeId / VarMapping]
|
||||
// [asmjit::X86VarId / VarMapping]
|
||||
// ============================================================================
|
||||
|
||||
#if !defined(ASMJIT_DOCGEN)
|
||||
@@ -1688,14 +1688,14 @@ ASMJIT_TYPE_ID(X86YmmVar, kX86VarTypeYmm);
|
||||
//!
|
||||
//! Variable states:
|
||||
//!
|
||||
//! - `kVarStateUnused - State that is assigned to newly created variables or
|
||||
//! - `kVarStateNone - State that is assigned to newly created variables or
|
||||
//! to not used variables (dereferenced to zero).
|
||||
//! - `kVarStateReg - State that means that variable is currently allocated in
|
||||
//! register.
|
||||
//! - `kVarStateMem - State that means that variable is currently only in
|
||||
//! memory location.
|
||||
//!
|
||||
//! When you create new variable, initial state is always `kVarStateUnused`,
|
||||
//! When you create new variable, initial state is always `kVarStateNone`,
|
||||
//! allocating it to register or spilling to memory changes this state to
|
||||
//! `kVarStateReg` or `kVarStateMem`, respectively. During variable lifetime
|
||||
//! it's usual that its state is changed multiple times. To generate better
|
||||
@@ -2028,9 +2028,9 @@ struct ASMJIT_VCLASS X86Compiler : public Compiler {
|
||||
|
||||
//! Create a `X86Compiler` instance.
|
||||
ASMJIT_API X86Compiler(Runtime* runtime, uint32_t arch
|
||||
#if defined(ASMJIT_HOST_X86) || defined(ASMJIT_HOST_X64)
|
||||
#if defined(ASMJIT_ARCH_X86) || defined(ASMJIT_ARCH_X64)
|
||||
= kArchHost
|
||||
#endif // ASMJIT_HOST_X86 || ASMJIT_HOST_X64
|
||||
#endif // ASMJIT_ARCH_X86 || ASMJIT_ARCH_X64
|
||||
);
|
||||
|
||||
//! Destroy the `X86Compiler` instance.
|
||||
@@ -2153,7 +2153,7 @@ struct ASMJIT_VCLASS X86Compiler : public Compiler {
|
||||
|
||||
//! Add a new function.
|
||||
//!
|
||||
//! \param conv Calling convention to use (see \ref kFuncConv enum)
|
||||
//! \param conv Calling convention to use (see \ref FuncConv)
|
||||
//! \param params Function arguments prototype.
|
||||
//!
|
||||
//! This method is usually used as a first step when generating functions
|
||||
|
||||
@@ -4372,7 +4372,7 @@ ASMJIT_INLINE void X86CallAlloc::clobber() {
|
||||
ASMJIT_ASSERT(vd != NULL);
|
||||
|
||||
VarAttr* va = vd->getVa();
|
||||
uint32_t vdState = kVarStateUnused;
|
||||
uint32_t vdState = kVarStateNone;
|
||||
|
||||
if (!vd->isModified() || (va != NULL && (va->getFlags() & (kVarAttrOutAll | kVarAttrUnuse)) != 0)) {
|
||||
vdState = kVarStateMem;
|
||||
|
||||
@@ -393,9 +393,9 @@ struct X86Context : public Context {
|
||||
//! Unuse.
|
||||
//!
|
||||
//! Unuse variable, it will be detached it if it's allocated then its state
|
||||
//! will be changed to kVarStateUnused.
|
||||
//! will be changed to kVarStateNone.
|
||||
template<int C>
|
||||
ASMJIT_INLINE void unuse(VarData* vd, uint32_t vState = kVarStateUnused) {
|
||||
ASMJIT_INLINE void unuse(VarData* vd, uint32_t vState = kVarStateNone) {
|
||||
ASMJIT_ASSERT(vd->getClass() == C);
|
||||
ASMJIT_ASSERT(vState != kVarStateReg);
|
||||
|
||||
|
||||
@@ -98,13 +98,13 @@ union X86XCR {
|
||||
};
|
||||
|
||||
// callCpuId() and detectCpuInfo() for x86 and x64 platforms begins here.
|
||||
#if defined(ASMJIT_HOST_X86) || defined(ASMJIT_HOST_X64)
|
||||
#if defined(ASMJIT_ARCH_X86) || defined(ASMJIT_ARCH_X64)
|
||||
void X86CpuUtil::callCpuId(uint32_t inEax, uint32_t inEcx, X86CpuId* result) {
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
// 2009-02-05: Thanks to Mike Tajmajer for supporting VC7.1 compiler.
|
||||
// ASMJIT_HOST_X64 is here only for readibility, only VS2005 can compile 64-bit code.
|
||||
# if _MSC_VER >= 1400 || defined(ASMJIT_HOST_X64)
|
||||
// ASMJIT_ARCH_X64 is here only for readibility, only VS2005 can compile 64-bit code.
|
||||
# if _MSC_VER >= 1400 || defined(ASMJIT_ARCH_X64)
|
||||
// Done by intrinsics.
|
||||
__cpuidex(reinterpret_cast<int*>(result->i), inEax, inEcx);
|
||||
# else // _MSC_VER < 1400
|
||||
@@ -126,7 +126,7 @@ void X86CpuUtil::callCpuId(uint32_t inEax, uint32_t inEcx, X86CpuId* result) {
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
// Note, patched to preserve ebx/rbx register which is used by GCC.
|
||||
# if defined(ASMJIT_HOST_X86)
|
||||
# if defined(ASMJIT_ARCH_X86)
|
||||
# define __myCpuId(inEax, inEcx, outEax, outEbx, outEcx, outEdx) \
|
||||
__asm__ __volatile__( \
|
||||
"mov %%ebx, %%edi\n" \
|
||||
|
||||
@@ -26,11 +26,11 @@ struct X86CpuInfo;
|
||||
//! \{
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86CpuFeature]
|
||||
// [asmjit::X86CpuFeature]
|
||||
// ============================================================================
|
||||
|
||||
//! X86 CPU features.
|
||||
ASMJIT_ENUM(kX86CpuFeature) {
|
||||
ASMJIT_ENUM(X86CpuFeature) {
|
||||
//! Cpu has Not-Execute-Bit.
|
||||
kX86CpuFeatureNX = 0,
|
||||
//! Cpu has multithreading.
|
||||
@@ -178,7 +178,7 @@ union X86CpuId {
|
||||
// [asmjit::X86CpuUtil]
|
||||
// ============================================================================
|
||||
|
||||
#if defined(ASMJIT_HOST_X86) || defined(ASMJIT_HOST_X64)
|
||||
#if defined(ASMJIT_ARCH_X86) || defined(ASMJIT_ARCH_X64)
|
||||
//! CPU utilities available only if the host processor is X86/X64.
|
||||
struct X86CpuUtil {
|
||||
//! Get the result of calling CPUID instruction to `out`.
|
||||
@@ -187,7 +187,7 @@ struct X86CpuUtil {
|
||||
//! Detect the Host CPU.
|
||||
ASMJIT_API static void detect(X86CpuInfo* cpuInfo);
|
||||
};
|
||||
#endif // ASMJIT_HOST_X86 || ASMJIT_HOST_X64
|
||||
#endif // ASMJIT_ARCH_X86 || ASMJIT_ARCH_X64
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::X86CpuInfo]
|
||||
@@ -231,12 +231,12 @@ struct X86CpuInfo : public CpuInfo {
|
||||
// [Statics]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
#if defined(ASMJIT_HOST_X86) || defined(ASMJIT_HOST_X64)
|
||||
#if defined(ASMJIT_ARCH_X86) || defined(ASMJIT_ARCH_X64)
|
||||
//! Get global instance of `X86CpuInfo`.
|
||||
static ASMJIT_INLINE const X86CpuInfo* getHost() {
|
||||
return static_cast<const X86CpuInfo*>(CpuInfo::getHost());
|
||||
}
|
||||
#endif // ASMJIT_HOST_X86 || ASMJIT_HOST_X64
|
||||
#endif // ASMJIT_ARCH_X86 || ASMJIT_ARCH_X64
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// [Members]
|
||||
|
||||
@@ -45,7 +45,7 @@ enum {
|
||||
//! \internal
|
||||
//!
|
||||
//! Combined flags.
|
||||
enum kX86InstOpInternal {
|
||||
enum X86InstOpInternal {
|
||||
kX86InstOpI = kX86InstOpImm,
|
||||
kX86InstOpL = kX86InstOpLabel,
|
||||
kX86InstOpLbImm = kX86InstOpLabel | kX86InstOpImm,
|
||||
@@ -84,7 +84,7 @@ enum kX86InstOpInternal {
|
||||
//! \internal
|
||||
//!
|
||||
//! X86/X64 Instruction AVX-512 flags (combined).
|
||||
ASMJIT_ENUM(kX86InstFlagsInternal) {
|
||||
ASMJIT_ENUM(X86InstFlagsInternal) {
|
||||
// FPU.
|
||||
kX86InstFlagMem2_4 = kX86InstFlagMem2 | kX86InstFlagMem4,
|
||||
kX86InstFlagMem2_4_8 = kX86InstFlagMem2_4 | kX86InstFlagMem8,
|
||||
@@ -1223,7 +1223,7 @@ const char _x86InstName[] =
|
||||
"xsetbv\0";
|
||||
|
||||
// Automatically generated, do not edit.
|
||||
enum kX86InstAlphaIndex {
|
||||
enum X86InstAlphaIndex {
|
||||
kX86InstAlphaIndexFirst = 'a',
|
||||
kX86InstAlphaIndexLast = 'z',
|
||||
kX86InstAlphaIndexInvalid = 0xFFFF
|
||||
@@ -1260,7 +1260,7 @@ static const uint16_t _x86InstAlphaIndex[26] = {
|
||||
};
|
||||
|
||||
// Automatically generated, do not edit.
|
||||
enum kX86InstData_NameIndex {
|
||||
enum X86InstData_NameIndex {
|
||||
kInstIdNone_NameIndex = 0,
|
||||
kX86InstIdAdc_NameIndex = 1,
|
||||
kX86InstIdAdd_NameIndex = 5,
|
||||
@@ -2613,7 +2613,7 @@ const X86InstExtendedInfo _x86InstExtendedInfo[] = {
|
||||
};
|
||||
|
||||
// Automatically generated, do not edit.
|
||||
enum kX86InstData_ExtendedIndex {
|
||||
enum X86InstData_ExtendedIndex {
|
||||
kInstIdNone_ExtendedIndex = 0,
|
||||
kX86InstIdAdc_ExtendedIndex = 1,
|
||||
kX86InstIdAdd_ExtendedIndex = 2,
|
||||
|
||||
@@ -73,7 +73,7 @@ ASMJIT_VAR const uint32_t _x86CondToJcc[20];
|
||||
ASMJIT_VAR const uint32_t _x86CondToSetcc[20];
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86InstId]
|
||||
// [asmjit::X86InstId]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 instruction IDs.
|
||||
@@ -85,7 +85,7 @@ ASMJIT_VAR const uint32_t _x86CondToSetcc[20];
|
||||
//! that these instructions are sorted as `jcc`, `jecxz` and `jmp`. Please use
|
||||
//! \ref X86Util::getInstIdByName() if you need instruction name to ID mapping
|
||||
//! and are not aware on how to handle such case.
|
||||
ASMJIT_ENUM(kX86InstId) {
|
||||
ASMJIT_ENUM(X86InstId) {
|
||||
kX86InstIdAdc = 1, // X86/X64
|
||||
kX86InstIdAdd, // X86/X64
|
||||
kX86InstIdAddpd, // SSE2
|
||||
@@ -1159,11 +1159,11 @@ ASMJIT_ENUM(kX86InstId) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86InstOptions]
|
||||
// [asmjit::X86InstOptions]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 instruction emit options, mainly for internal purposes.
|
||||
ASMJIT_ENUM(kX86InstOptions) {
|
||||
ASMJIT_ENUM(X86InstOptions) {
|
||||
//! Emit instruction with LOCK prefix.
|
||||
//!
|
||||
//! If this option is used and instruction doesn't support LOCK prefix an
|
||||
@@ -1211,7 +1211,7 @@ ASMJIT_ENUM(kX86InstOptions) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86InstEncodingId]
|
||||
// [asmjit::X86InstEncodingId]
|
||||
// ============================================================================
|
||||
|
||||
//! \internal
|
||||
@@ -1219,7 +1219,7 @@ ASMJIT_ENUM(kX86InstOptions) {
|
||||
//! X86/X64 instruction groups.
|
||||
//!
|
||||
//! This group is specific to AsmJit and only used by `X86Assembler`.
|
||||
ASMJIT_ENUM(kX86InstEncodingId) {
|
||||
ASMJIT_ENUM(X86InstEncodingId) {
|
||||
//! Never used.
|
||||
kX86InstEncodingIdNone = 0,
|
||||
|
||||
@@ -1450,7 +1450,7 @@ ASMJIT_ENUM(kX86InstEncodingId) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86InstOpCode]
|
||||
// [asmjit::X86InstOpCodeFlags]
|
||||
// ============================================================================
|
||||
|
||||
//! \internal
|
||||
@@ -1502,7 +1502,7 @@ ASMJIT_ENUM(kX86InstEncodingId) {
|
||||
//! of AVX-512 have matched AVX, but this is not the case.
|
||||
//!
|
||||
//! - `O` field is an extended opcode field (3) bytes used by ModR/M BYTE.
|
||||
ASMJIT_ENUM(kX86InstOpCode) {
|
||||
ASMJIT_ENUM(X86InstOpCodeFlags) {
|
||||
// `MMMMM` field in AVX/XOP/AVX-512 instruction (5 bits).
|
||||
//
|
||||
// `OpCode` leading bytes in legacy encoding.
|
||||
@@ -1569,13 +1569,13 @@ ASMJIT_ENUM(kX86InstOpCode) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86InstFlags]
|
||||
// [asmjit::X86InstFlags]
|
||||
// ============================================================================
|
||||
|
||||
//! \internal
|
||||
//!
|
||||
//! X86/X64 instruction flags.
|
||||
ASMJIT_ENUM(kX86InstFlags) {
|
||||
ASMJIT_ENUM(X86InstFlags) {
|
||||
//! No flags.
|
||||
kX86InstFlagNone = 0x00000000,
|
||||
|
||||
@@ -1671,13 +1671,13 @@ ASMJIT_ENUM(kX86InstFlags) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86InstOp]
|
||||
// [asmjit::X86InstOp]
|
||||
// ============================================================================
|
||||
|
||||
//! \internal
|
||||
//!
|
||||
//! X86/X64 instruction operand flags.
|
||||
ASMJIT_ENUM(kX86InstOp) {
|
||||
ASMJIT_ENUM(X86InstOp) {
|
||||
//! Instruction operand can be 8-bit Gpb register.
|
||||
kX86InstOpGb = 0x0001,
|
||||
//! Instruction operand can be 16-bit Gpw register.
|
||||
@@ -1719,11 +1719,11 @@ ASMJIT_ENUM(kX86InstOp) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86Cond]
|
||||
// [asmjit::X86Cond]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 Condition codes.
|
||||
ASMJIT_ENUM(kX86Cond) {
|
||||
ASMJIT_ENUM(X86Cond) {
|
||||
kX86CondA = 0x07, // CF==0 & ZF==0 (unsigned)
|
||||
kX86CondAE = 0x03, // CF==0 (unsigned)
|
||||
kX86CondB = 0x02, // CF==1 (unsigned)
|
||||
@@ -1791,7 +1791,7 @@ ASMJIT_ENUM(kX86Cond) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86EFlags]
|
||||
// [asmjit::X86EFlags]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 EFLAGs bits (AsmJit specific).
|
||||
@@ -1805,10 +1805,10 @@ ASMJIT_ENUM(kX86Cond) {
|
||||
//! architecture, defined in Intel's Manual Section `3.4.3 - EFLAGS Register`.
|
||||
//!
|
||||
//! \note Flags are designed to fit in an 8-bit integer.
|
||||
ASMJIT_ENUM(kX86EFlags) {
|
||||
ASMJIT_ENUM(X86EFlags) {
|
||||
// --------------------------------------------------------------------------
|
||||
// src-gendefs.js relies on the values of these masks, the tool has to be
|
||||
// changed as you plan to modify `kX86EFlags`.
|
||||
// changed as you plan to modify `X86EFlags`.
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Overflow flag (OF).
|
||||
@@ -1860,11 +1860,11 @@ ASMJIT_ENUM(kX86EFlags) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86FpSw]
|
||||
// [asmjit::X86FpSw]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 FPU status word.
|
||||
ASMJIT_ENUM(kX86FpSw) {
|
||||
ASMJIT_ENUM(X86FpSw) {
|
||||
kX86FpSw_Invalid = 0x0001,
|
||||
kX86FpSw_Denormalized = 0x0002,
|
||||
kX86FpSw_DivByZero = 0x0004,
|
||||
@@ -1882,11 +1882,11 @@ ASMJIT_ENUM(kX86FpSw) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86FpCw]
|
||||
// [asmjit::X86FpCw]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 FPU control word.
|
||||
ASMJIT_ENUM(kX86FpCw) {
|
||||
ASMJIT_ENUM(X86FpCw) {
|
||||
kX86FpCw_EM_Mask = 0x003F, // Bits 0-5.
|
||||
kX86FpCw_EM_Invalid = 0x0001,
|
||||
kX86FpCw_EM_Denormal = 0x0002,
|
||||
@@ -1913,11 +1913,11 @@ ASMJIT_ENUM(kX86FpCw) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86Cmp]
|
||||
// [asmjit::X86Cmp]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 Comparison predicate used by CMP[PD/PS/SD/SS] family instructions.
|
||||
ASMJIT_ENUM(kX86Cmp) {
|
||||
ASMJIT_ENUM(X86Cmp) {
|
||||
kX86CmpEQ = 0x00, //!< Equal (Quite).
|
||||
kX86CmpLT = 0x01, //!< Less (Signaling).
|
||||
kX86CmpLE = 0x02, //!< Less/Equal (Signaling).
|
||||
@@ -1929,13 +1929,13 @@ ASMJIT_ENUM(kX86Cmp) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86VCmp]
|
||||
// [asmjit::X86VCmp]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 Comparison predicate used by VCMP[PD/PS/SD/SS] family instructions.
|
||||
//!
|
||||
//! The first 8 are compatible with \ref kX86Cmp.
|
||||
ASMJIT_ENUM(kX86VCmp) {
|
||||
//! The first 8 are compatible with \ref X86Cmp.
|
||||
ASMJIT_ENUM(X86VCmp) {
|
||||
kX86VCmpEQ_OQ = 0x00, //!< Equal (Quite, Ordered).
|
||||
kX86VCmpLT_OS = 0x01, //!< Less (Signaling, Ordered).
|
||||
kX86VCmpLE_OS = 0x02, //!< Less/Equal (Signaling, Ordered).
|
||||
@@ -1972,11 +1972,11 @@ ASMJIT_ENUM(kX86VCmp) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86Prefetch]
|
||||
// [asmjit::X86Prefetch]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 Prefetch hints.
|
||||
ASMJIT_ENUM(kX86Prefetch) {
|
||||
ASMJIT_ENUM(X86Prefetch) {
|
||||
//! Prefetch using NT hint.
|
||||
kX86PrefetchNTA = 0,
|
||||
//! Prefetch to L0 cache.
|
||||
@@ -2011,12 +2011,12 @@ struct X86InstExtendedInfo {
|
||||
// [Accessors - Instruction Flags]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get whether the instruction has a `flag`, see `kX86InstFlags`.
|
||||
//! Get whether the instruction has a `flag`, see `X86InstFlags`.
|
||||
ASMJIT_INLINE bool hasInstFlag(uint32_t flag) const {
|
||||
return (_instFlags & flag) != 0;
|
||||
}
|
||||
|
||||
//! Get all instruction flags, see `kX86InstFlags`.
|
||||
//! Get all instruction flags, see `X86InstFlags`.
|
||||
ASMJIT_INLINE uint32_t getInstFlags() const {
|
||||
return _instFlags;
|
||||
}
|
||||
@@ -2087,12 +2087,12 @@ struct X86InstExtendedInfo {
|
||||
// [Accessors - EFlags]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get EFLAGS that the instruction reads, see \ref kX86EFlags.
|
||||
//! Get EFLAGS that the instruction reads, see \ref X86EFlags.
|
||||
ASMJIT_INLINE uint32_t getEFlagsIn() const {
|
||||
return _eflagsIn;
|
||||
}
|
||||
|
||||
//! Get EFLAGS that the instruction writes, see \ref kX86EFlags.
|
||||
//! Get EFLAGS that the instruction writes, see \ref X86EFlags.
|
||||
ASMJIT_INLINE uint32_t getEFlagsOut() const {
|
||||
return _eflagsOut;
|
||||
}
|
||||
@@ -2127,7 +2127,7 @@ struct X86InstExtendedInfo {
|
||||
// [Accessors - OpCode]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get the secondary instruction opcode, see \ref kX86InstOpCode.
|
||||
//! Get the secondary instruction opcode, see \ref X86InstOpCodeFlags.
|
||||
//!
|
||||
//! See \ref X86InstInfo::getSecondaryOpCode() for more details.
|
||||
ASMJIT_INLINE uint32_t getSecondaryOpCode() const {
|
||||
@@ -2215,7 +2215,7 @@ struct X86InstInfo {
|
||||
// [Accessors - Instruction Encoding]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get instruction group, see \ref kX86InstEncodingId.
|
||||
//! Get instruction group, see \ref X86InstEncodingId.
|
||||
ASMJIT_INLINE uint32_t getEncodingId() const {
|
||||
return getExtendedInfo().getEncodingId();
|
||||
}
|
||||
@@ -2224,12 +2224,12 @@ struct X86InstInfo {
|
||||
// [Accessors - Instruction Flags]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get instruction flags, see `kX86InstFlags`.
|
||||
//! Get instruction flags, see `X86InstFlags`.
|
||||
ASMJIT_INLINE uint32_t getInstFlags() const {
|
||||
return getExtendedInfo().getInstFlags();
|
||||
}
|
||||
|
||||
//! Get whether the instruction has flag `flag`, see `kX86InstFlags`.
|
||||
//! Get whether the instruction has flag `flag`, see `X86InstFlags`.
|
||||
ASMJIT_INLINE bool hasInstFlag(uint32_t flag) const {
|
||||
return (getInstFlags() & flag) != 0;
|
||||
}
|
||||
@@ -2238,12 +2238,12 @@ struct X86InstInfo {
|
||||
// [Accessors - EFlags]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get EFLAGS that the instruction reads, see \ref kX86EFlags.
|
||||
//! Get EFLAGS that the instruction reads, see \ref X86EFlags.
|
||||
ASMJIT_INLINE uint32_t getEFlagsIn() const {
|
||||
return getExtendedInfo().getEFlagsIn();
|
||||
}
|
||||
|
||||
//! Get EFLAGS that the instruction writes, see \ref kX86EFlags.
|
||||
//! Get EFLAGS that the instruction writes, see \ref X86EFlags.
|
||||
ASMJIT_INLINE uint32_t getEFlagsOut() const {
|
||||
return getExtendedInfo().getEFlagsOut();
|
||||
}
|
||||
@@ -2275,12 +2275,12 @@ struct X86InstInfo {
|
||||
// [Accessors - OpCode]
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
//! Get the primary instruction opcode, see \ref kX86InstOpCode.
|
||||
//! Get the primary instruction opcode, see \ref X86InstOpCodeFlags.
|
||||
ASMJIT_INLINE uint32_t getPrimaryOpCode() const {
|
||||
return _primaryOpCode;
|
||||
}
|
||||
|
||||
//! Get the secondary instruction opcode, see \ref kX86InstOpCode.
|
||||
//! Get the secondary instruction opcode, see \ref X86InstOpCodeFlags.
|
||||
ASMJIT_INLINE uint32_t getSecondaryOpCode() const {
|
||||
return getExtendedInfo().getSecondaryOpCode();
|
||||
}
|
||||
@@ -2340,25 +2340,25 @@ struct X86Util {
|
||||
//! Get the equivalent of negated condition code.
|
||||
static ASMJIT_INLINE uint32_t negateCond(uint32_t cond) {
|
||||
ASMJIT_ASSERT(cond < ASMJIT_ARRAY_SIZE(_x86ReverseCond));
|
||||
return static_cast<kX86Cond>(cond ^ static_cast<uint32_t>(cond < kX86CondNone));
|
||||
return cond ^ static_cast<uint32_t>(cond < kX86CondNone);
|
||||
}
|
||||
|
||||
//! Translate condition code `cc` to `cmovcc` instruction code.
|
||||
//! \sa \ref kX86InstId, \ref _kX86InstIdCmovcc.
|
||||
//! \sa \ref X86InstId, \ref _kX86InstIdCmovcc.
|
||||
static ASMJIT_INLINE uint32_t condToCmovcc(uint32_t cond) {
|
||||
ASMJIT_ASSERT(static_cast<uint32_t>(cond) < ASMJIT_ARRAY_SIZE(_x86CondToCmovcc));
|
||||
return _x86CondToCmovcc[cond];
|
||||
}
|
||||
|
||||
//! Translate condition code `cc` to `jcc` instruction code.
|
||||
//! \sa \ref kX86InstId, \ref _kX86InstIdJcc.
|
||||
//! \sa \ref X86InstId, \ref _kX86InstIdJcc.
|
||||
static ASMJIT_INLINE uint32_t condToJcc(uint32_t cond) {
|
||||
ASMJIT_ASSERT(static_cast<uint32_t>(cond) < ASMJIT_ARRAY_SIZE(_x86CondToJcc));
|
||||
return _x86CondToJcc[cond];
|
||||
}
|
||||
|
||||
//! Translate condition code `cc` to `setcc` instruction code.
|
||||
//! \sa \ref kX86InstId, \ref _kX86InstIdSetcc.
|
||||
//! \sa \ref X86InstId, \ref _kX86InstIdSetcc.
|
||||
static ASMJIT_INLINE uint32_t condToSetcc(uint32_t cond) {
|
||||
ASMJIT_ASSERT(static_cast<uint32_t>(cond) < ASMJIT_ARRAY_SIZE(_x86CondToSetcc));
|
||||
return _x86CondToSetcc[cond];
|
||||
|
||||
@@ -56,11 +56,11 @@ struct X86ZmmVar;
|
||||
//! \{
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86RegClass]
|
||||
// [asmjit::X86RegClass]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 variable class.
|
||||
ASMJIT_ENUM(kX86RegClass) {
|
||||
ASMJIT_ENUM(X86RegClass) {
|
||||
// --------------------------------------------------------------------------
|
||||
// [Regs & Vars]
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -91,11 +91,11 @@ ASMJIT_ENUM(kX86RegClass) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86RegType]
|
||||
// [asmjit::X86RegType]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 register type.
|
||||
ASMJIT_ENUM(kX86RegType) {
|
||||
ASMJIT_ENUM(X86RegType) {
|
||||
//! Gpb-lo register (AL, BL, CL, DL, ...).
|
||||
kX86RegTypeGpbLo = 0x01,
|
||||
//! Gpb-hi register (AH, BH, CH, DH only).
|
||||
@@ -135,7 +135,7 @@ ASMJIT_ENUM(kX86RegType) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86RegIndex]
|
||||
// [asmjit::X86RegIndex]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 register indexes.
|
||||
@@ -143,7 +143,7 @@ ASMJIT_ENUM(kX86RegType) {
|
||||
//! \note Register indexes have been reduced to only support general purpose
|
||||
//! registers. There is no need to have enumerations with number suffix that
|
||||
//! expands to the exactly same value as the suffix value itself.
|
||||
ASMJIT_ENUM(kX86RegIndex) {
|
||||
ASMJIT_ENUM(X86RegIndex) {
|
||||
//! Index of Al/Ah/Ax/Eax/Rax registers.
|
||||
kX86RegIndexAx = 0,
|
||||
//! Index of Cl/Ch/Cx/Ecx/Rcx registers.
|
||||
@@ -179,11 +179,11 @@ ASMJIT_ENUM(kX86RegIndex) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86Seg]
|
||||
// [asmjit::X86Seg]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 segment codes.
|
||||
ASMJIT_ENUM(kX86Seg) {
|
||||
ASMJIT_ENUM(X86Seg) {
|
||||
//! No/Default segment.
|
||||
kX86SegDefault = 0,
|
||||
//! Es segment.
|
||||
@@ -210,11 +210,11 @@ ASMJIT_ENUM(kX86Seg) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86MemVSib]
|
||||
// [asmjit::X86MemVSib]
|
||||
// ============================================================================
|
||||
|
||||
//! X86/X64 index register legacy and AVX2 (VSIB) support.
|
||||
ASMJIT_ENUM(kX86MemVSib) {
|
||||
ASMJIT_ENUM(X86MemVSib) {
|
||||
//! Memory operand uses Gpd/Gpq index (or no index register).
|
||||
kX86MemVSibGpz = 0,
|
||||
//! Memory operand uses Xmm index (or no index register).
|
||||
@@ -226,13 +226,13 @@ ASMJIT_ENUM(kX86MemVSib) {
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
// [asmjit::kX86MemFlags]
|
||||
// [asmjit::X86MemFlags]
|
||||
// ============================================================================
|
||||
|
||||
//! \internal
|
||||
//!
|
||||
//! X86/X64 specific memory flags.
|
||||
ASMJIT_ENUM(kX86MemFlags) {
|
||||
ASMJIT_ENUM(X86MemFlags) {
|
||||
kX86MemSegBits = 0x7,
|
||||
kX86MemSegIndex = 0,
|
||||
kX86MemSegMask = kX86MemSegBits << kX86MemSegIndex,
|
||||
@@ -1235,19 +1235,19 @@ struct X86Mem : public BaseMem {
|
||||
return (_vmem.flags & kX86MemSegMask) != (kX86SegDefault << kX86MemSegIndex);
|
||||
}
|
||||
|
||||
//! Get memory operand segment, see `kX86Seg`.
|
||||
//! Get memory operand segment, see `X86Seg`.
|
||||
ASMJIT_INLINE uint32_t getSegment() const {
|
||||
return (static_cast<uint32_t>(_vmem.flags) >> kX86MemSegIndex) & kX86MemSegBits;
|
||||
}
|
||||
|
||||
//! Set memory operand segment, see `kX86Seg`.
|
||||
//! Set memory operand segment, see `X86Seg`.
|
||||
ASMJIT_INLINE X86Mem& setSegment(uint32_t segIndex) {
|
||||
_vmem.flags = static_cast<uint8_t>(
|
||||
(static_cast<uint32_t>(_vmem.flags) & kX86MemSegMask) + (segIndex << kX86MemSegIndex));
|
||||
return *this;
|
||||
}
|
||||
|
||||
//! Set memory operand segment, see `kX86Seg`.
|
||||
//! Set memory operand segment, see `X86Seg`.
|
||||
ASMJIT_INLINE X86Mem& setSegment(const X86SegReg& seg) {
|
||||
return setSegment(seg.getRegIndex());
|
||||
}
|
||||
|
||||
@@ -46,12 +46,12 @@
|
||||
@define asmjit::kVarTypeFpEx (0xA)
|
||||
@define asmjit::kVarTypeInvalid (0xFF)
|
||||
@
|
||||
@define asmjit::x86x64::kVarTypeMm (0xB)
|
||||
@define asmjit::x86x64::kVarTypeXmm (0xC)
|
||||
@define asmjit::x86x64::kVarTypeXmmSs (0xD)
|
||||
@define asmjit::x86x64::kVarTypeXmmPs (0xE)
|
||||
@define asmjit::x86x64::kVarTypeXmmSd (0xF)
|
||||
@define asmjit::x86x64::kVarTypeXmmPd (0x10)
|
||||
@define asmjit::x86::kVarTypeMm (0xB)
|
||||
@define asmjit::x86::kVarTypeXmm (0xC)
|
||||
@define asmjit::x86::kVarTypeXmmSs (0xD)
|
||||
@define asmjit::x86::kVarTypeXmmPs (0xE)
|
||||
@define asmjit::x86::kVarTypeXmmSd (0xF)
|
||||
@define asmjit::x86::kVarTypeXmmPd (0x10)
|
||||
@
|
||||
@define asmjit::kVarStateUnused (0x0)
|
||||
@define asmjit::kVarStateReg (0x1)
|
||||
|
||||
Reference in New Issue
Block a user