Minor code cleanup, fixed 64-bit BMI and BMI2 instructions

This commit is contained in:
kobalicek
2016-06-30 18:59:59 +02:00
parent 286bc22f49
commit d25f392c6e
59 changed files with 2690 additions and 3037 deletions

View File

@@ -497,11 +497,11 @@ printf("Logger Content:\n%s", logger.getString());
// You can use `logger.clearString()` if the intend is to reuse the logger. // You can use `logger.clearString()` if the intend is to reuse the logger.
``` ```
Logger can be configured to show more information by using `logger.setOption()` method. The following options are available: Logger can be configured to show more information by using `logger.addOptions()` method. The following options are available:
* `kLoggerOptionBinaryForm` - Log also binary sequence for each instruction generated. * `Logger::kOptionBinaryForm` - Log also binary sequence for each instruction generated.
* `kLoggerOptionHexImmediate` - Format immediate values to base16 (hex) form. * `Logger::kOptionHexImmediate` - Log immediate values as hexadecimal.
* `kLoggerOptionHexDisplacement` - Format memory displacements to base16 (hex) form. * `Logger::kOptionHexDisplacement` - Log memory displacements as hexadecimal.
TODO: Liveness analysis and instruction scheduling options. TODO: Liveness analysis and instruction scheduling options.

View File

@@ -4,7 +4,7 @@
// [License] // [License]
// Zlib - See LICENSE.md file in the package. // Zlib - See LICENSE.md file in the package.
// [Dependencies - AsmJit] // [Dependencies]
#if !defined(_ASMJIT_BUILD_H) #if !defined(_ASMJIT_BUILD_H)
#include "./build.h" #include "./build.h"
#endif // !_ASMJIT_BUILD_H #endif // !_ASMJIT_BUILD_H

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_ARM_H #ifndef _ASMJIT_ARM_H
#define _ASMJIT_ARM_H #define _ASMJIT_ARM_H
// [Dependencies - AsmJit] // [Dependencies]
#include "./base.h" #include "./base.h"
#include "./arm/armassembler.h" #include "./arm/armassembler.h"

View File

@@ -340,20 +340,20 @@
//! } //! }
//! ~~~ //! ~~~
// [Dependencies - Base] // [Dependencies]
#include "./base.h" #include "./base.h"
// [Dependencies - ARM/ARM64] // [ARM/ARM64]
#if defined(ASMJIT_BUILD_ARM32) || defined(ASMJIT_BUILD_ARM64) #if defined(ASMJIT_BUILD_ARM32) || defined(ASMJIT_BUILD_ARM64)
#include "./arm.h" #include "./arm.h"
#endif // ASMJIT_BUILD_ARM32 || ASMJIT_BUILD_ARM64 #endif // ASMJIT_BUILD_ARM32 || ASMJIT_BUILD_ARM64
// [Dependencies - X86/X64] // [X86/X64]
#if defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64) #if defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64)
#include "./x86.h" #include "./x86.h"
#endif // ASMJIT_BUILD_X86 || ASMJIT_BUILD_X64 #endif // ASMJIT_BUILD_X86 || ASMJIT_BUILD_X64
// [Dependencies - Host] // [Host]
#include "./host.h" #include "./host.h"
// [Guard] // [Guard]

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_H #ifndef _ASMJIT_BASE_H
#define _ASMJIT_BASE_H #define _ASMJIT_BASE_H
// [Dependencies - AsmJit] // [Dependencies]
#include "./build.h" #include "./build.h"
#include "./base/assembler.h" #include "./base/assembler.h"

View File

@@ -7,12 +7,10 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/assembler.h" #include "../base/assembler.h"
#include "../base/utils.h" #include "../base/utils.h"
#include "../base/vmem.h" #include "../base/vmem.h"
// [Dependenceis - C]
#include <stdarg.h> #include <stdarg.h>
// [Api-Begin] // [Api-Begin]
@@ -162,7 +160,7 @@ Error Assembler::setLastError(Error error, const char* message) noexcept {
if (message == nullptr) if (message == nullptr)
message = DebugUtils::errorAsString(error); message = DebugUtils::errorAsString(error);
// Logging is skipped if the error is handled by `ErrorHandler. // Logging is skipped if the error is handled by `ErrorHandler`.
ErrorHandler* eh = _errorHandler; ErrorHandler* eh = _errorHandler;
ASMJIT_TLOG("[ERROR (Assembler)] %s (0x%0.8u) %s\n", message, ASMJIT_TLOG("[ERROR (Assembler)] %s (0x%0.8u) %s\n", message,
static_cast<unsigned int>(error), static_cast<unsigned int>(error),

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_ASSEMBLER_H #ifndef _ASMJIT_BASE_ASSEMBLER_H
#define _ASMJIT_BASE_ASSEMBLER_H #define _ASMJIT_BASE_ASSEMBLER_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/containers.h" #include "../base/containers.h"
#include "../base/logger.h" #include "../base/logger.h"
#include "../base/operand.h" #include "../base/operand.h"
@@ -235,7 +235,8 @@ struct RelocData {
//! Please note that `addRef` and `release` functions are used, but there is //! Please note that `addRef` and `release` functions are used, but there is
//! no reference counting implemented by default, reimplement to change the //! no reference counting implemented by default, reimplement to change the
//! default behavior. //! default behavior.
struct ASMJIT_VIRTAPI ErrorHandler { class ASMJIT_VIRTAPI ErrorHandler {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -297,7 +298,8 @@ struct ASMJIT_VIRTAPI ErrorHandler {
// ============================================================================ // ============================================================================
//! An external tool (i.e. `Stream` or `Compiler`) that can serialize to `Assembler` //! An external tool (i.e. `Stream` or `Compiler`) that can serialize to `Assembler`
struct ASMJIT_VIRTAPI ExternalTool { class ASMJIT_VIRTAPI ExternalTool {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -404,7 +406,8 @@ struct ASMJIT_VIRTAPI ExternalTool {
//! specific assemblers. //! specific assemblers.
//! //!
//! \sa Compiler. //! \sa Compiler.
struct ASMJIT_VIRTAPI Assembler { class ASMJIT_VIRTAPI Assembler {
public:
ASMJIT_NO_COPY(Assembler) ASMJIT_NO_COPY(Assembler)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -11,15 +11,13 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/assembler.h" #include "../base/assembler.h"
#include "../base/compiler.h" #include "../base/compiler.h"
#include "../base/compilercontext_p.h" #include "../base/compilercontext_p.h"
#include "../base/cpuinfo.h" #include "../base/cpuinfo.h"
#include "../base/logger.h" #include "../base/logger.h"
#include "../base/utils.h" #include "../base/utils.h"
// [Dependencies - C]
#include <stdarg.h> #include <stdarg.h>
// [Api-Begin] // [Api-Begin]

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/assembler.h" #include "../base/assembler.h"
#include "../base/compilerfunc.h" #include "../base/compilerfunc.h"
#include "../base/constpool.h" #include "../base/constpool.h"
@@ -138,7 +138,8 @@ struct VarInfo {
//! Compiler interface. //! Compiler interface.
//! //!
//! \sa Assembler. //! \sa Assembler.
struct ASMJIT_VIRTAPI Compiler : public ExternalTool { class ASMJIT_VIRTAPI Compiler : public ExternalTool {
public:
ASMJIT_NO_COPY(Compiler) ASMJIT_NO_COPY(Compiler)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/compilercontext_p.h" #include "../base/compilercontext_p.h"
#include "../base/utils.h" #include "../base/utils.h"

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/compiler.h" #include "../base/compiler.h"
#include "../base/podvector.h" #include "../base/podvector.h"
#include "../base/zone.h" #include "../base/zone.h"

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/operand.h" #include "../base/operand.h"
#include "../base/utils.h" #include "../base/utils.h"

View File

@@ -7,7 +7,7 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/constpool.h" #include "../base/constpool.h"
#include "../base/utils.h" #include "../base/utils.h"

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_CONSTPOOL_H #ifndef _ASMJIT_BASE_CONSTPOOL_H
#define _ASMJIT_BASE_CONSTPOOL_H #define _ASMJIT_BASE_CONSTPOOL_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/zone.h" #include "../base/zone.h"
// [Api-Begin] // [Api-Begin]
@@ -24,7 +24,8 @@ namespace asmjit {
// ============================================================================ // ============================================================================
//! Constant pool. //! Constant pool.
struct ConstPool { class ConstPool {
public:
ASMJIT_NO_COPY(ConstPool) ASMJIT_NO_COPY(ConstPool)
enum { enum {

View File

@@ -7,7 +7,7 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/containers.h" #include "../base/containers.h"
#include "../base/utils.h" #include "../base/utils.h"

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_CONTAINERS_H #ifndef _ASMJIT_BASE_CONTAINERS_H
#define _ASMJIT_BASE_CONTAINERS_H #define _ASMJIT_BASE_CONTAINERS_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/globals.h" #include "../base/globals.h"
// [Api-Begin] // [Api-Begin]
@@ -141,7 +141,8 @@ struct BitArray {
//! \internal //! \internal
template <typename T> template <typename T>
struct PodList { class PodList {
public:
ASMJIT_NO_COPY(PodList<T>) ASMJIT_NO_COPY(PodList<T>)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -230,7 +231,8 @@ struct PodList {
//! //!
//! String builder contains method specific to AsmJit functionality, used for //! String builder contains method specific to AsmJit functionality, used for
//! logging or HTML output. //! logging or HTML output.
struct StringBuilder { class StringBuilder {
public:
ASMJIT_NO_COPY(StringBuilder) ASMJIT_NO_COPY(StringBuilder)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -511,7 +513,8 @@ struct StringBuilder {
//! Temporary string builder, has statically allocated `N` bytes. //! Temporary string builder, has statically allocated `N` bytes.
template<size_t N> template<size_t N>
struct StringBuilderTmp : public StringBuilder { class StringBuilderTmp : public StringBuilder {
public:
ASMJIT_NO_COPY(StringBuilderTmp<N>) ASMJIT_NO_COPY(StringBuilderTmp<N>)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -7,7 +7,7 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/cpuinfo.h" #include "../base/cpuinfo.h"
#include "../base/utils.h" #include "../base/utils.h"

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_CPUINFO_H #ifndef _ASMJIT_BASE_CPUINFO_H
#define _ASMJIT_BASE_CPUINFO_H #define _ASMJIT_BASE_CPUINFO_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/globals.h" #include "../base/globals.h"
// [Api-Begin] // [Api-Begin]
@@ -24,7 +24,8 @@ namespace asmjit {
// ============================================================================ // ============================================================================
//! CPU information. //! CPU information.
struct CpuInfo { class CpuInfo {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Vendor] // [Vendor]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -7,7 +7,7 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/globals.h" #include "../base/globals.h"
// [Api-Begin] // [Api-Begin]

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_GLOBALS_H #ifndef _ASMJIT_BASE_GLOBALS_H
#define _ASMJIT_BASE_GLOBALS_H #define _ASMJIT_BASE_GLOBALS_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../build.h" #include "../build.h"
// [Api-Begin] // [Api-Begin]

View File

@@ -7,7 +7,7 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/hlstream.h" #include "../base/hlstream.h"
// [Api-Begin] // [Api-Begin]

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/assembler.h" #include "../base/assembler.h"
#include "../base/operand.h" #include "../base/operand.h"
@@ -27,15 +27,15 @@ namespace asmjit {
// [Forward Declarations] // [Forward Declarations]
// ============================================================================ // ============================================================================
struct Compiler; class Compiler;
struct VarData; struct VarData;
struct VarState; struct VarState;
struct VarMap; struct VarMap;
struct HLInst; class HLInst;
struct HLJump; class HLJump;
struct HLLabel; class HLLabel;
struct HLSentinel; class HLSentinel;
//! \addtogroup asmjit_base //! \addtogroup asmjit_base
//! \{ //! \{
@@ -48,7 +48,8 @@ struct HLSentinel;
//! //!
//! Every node represents an abstract instruction, directive, label, or macro //! Every node represents an abstract instruction, directive, label, or macro
//! instruction that can be serialized to `Assembler`. //! instruction that can be serialized to `Assembler`.
struct HLNode { class HLNode {
public:
ASMJIT_NO_COPY(HLNode) ASMJIT_NO_COPY(HLNode)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -324,7 +325,8 @@ struct HLNode {
//! Instruction (HL). //! Instruction (HL).
//! //!
//! Wraps an instruction with its options and operands. //! Wraps an instruction with its options and operands.
struct HLInst : public HLNode { class HLInst : public HLNode {
public:
ASMJIT_NO_COPY(HLInst) ASMJIT_NO_COPY(HLInst)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -449,7 +451,8 @@ L_Update:
//! Conditional or direct jump (HL). //! Conditional or direct jump (HL).
//! //!
//! Extension of `HLInst` node, which stores more information about the jump. //! Extension of `HLInst` node, which stores more information about the jump.
struct HLJump : public HLInst { class HLJump : public HLInst {
public:
ASMJIT_NO_COPY(HLJump) ASMJIT_NO_COPY(HLJump)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -488,7 +491,8 @@ struct HLJump : public HLInst {
//! Wraps `.data` directive. The node contains data that will be placed at the //! Wraps `.data` directive. The node contains data that will be placed at the
//! node's position in the assembler stream. The data is considered to be RAW; //! node's position in the assembler stream. The data is considered to be RAW;
//! no analysis nor byte-order conversion is performed on RAW data. //! no analysis nor byte-order conversion is performed on RAW data.
struct HLData : public HLNode { class HLData : public HLNode {
public:
ASMJIT_NO_COPY(HLData) ASMJIT_NO_COPY(HLData)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -545,7 +549,8 @@ struct HLData : public HLNode {
//! Align directive (HL). //! Align directive (HL).
//! //!
//! Wraps `.align` directive. //! Wraps `.align` directive.
struct HLAlign : public HLNode { class HLAlign : public HLNode {
public:
ASMJIT_NO_COPY(HLAlign) ASMJIT_NO_COPY(HLAlign)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -592,7 +597,8 @@ struct HLAlign : public HLNode {
// ============================================================================ // ============================================================================
//! label (HL). //! label (HL).
struct HLLabel : public HLNode { class HLLabel : public HLNode {
public:
ASMJIT_NO_COPY(HLLabel) ASMJIT_NO_COPY(HLLabel)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -658,7 +664,8 @@ struct HLLabel : public HLNode {
// ============================================================================ // ============================================================================
//! Comment (HL). //! Comment (HL).
struct HLComment : public HLNode { class HLComment : public HLNode {
public:
ASMJIT_NO_COPY(HLComment) ASMJIT_NO_COPY(HLComment)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -682,7 +689,8 @@ struct HLComment : public HLNode {
// ============================================================================ // ============================================================================
//! Sentinel (HL). //! Sentinel (HL).
struct HLSentinel : public HLNode { class HLSentinel : public HLNode {
public:
ASMJIT_NO_COPY(HLSentinel) ASMJIT_NO_COPY(HLSentinel)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -704,7 +712,8 @@ struct HLSentinel : public HLNode {
// ============================================================================ // ============================================================================
//! Hint node. //! Hint node.
struct HLHint : public HLNode { class HLHint : public HLNode {
public:
ASMJIT_NO_COPY(HLHint) ASMJIT_NO_COPY(HLHint)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -758,7 +767,8 @@ struct HLHint : public HLNode {
// ============================================================================ // ============================================================================
//! Function (HL). //! Function (HL).
struct HLFunc : public HLNode { class HLFunc : public HLNode {
public:
ASMJIT_NO_COPY(HLFunc) ASMJIT_NO_COPY(HLFunc)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -978,7 +988,8 @@ struct HLFunc : public HLNode {
// ============================================================================ // ============================================================================
//! Function return (HL). //! Function return (HL).
struct HLRet : public HLNode { class HLRet : public HLNode {
public:
ASMJIT_NO_COPY(HLRet) ASMJIT_NO_COPY(HLRet)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1024,7 +1035,8 @@ struct HLRet : public HLNode {
// ============================================================================ // ============================================================================
//! Function call (HL). //! Function call (HL).
struct HLCall : public HLNode { class HLCall : public HLNode {
public:
ASMJIT_NO_COPY(HLCall) ASMJIT_NO_COPY(HLCall)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1097,7 +1109,8 @@ struct HLCall : public HLNode {
// ============================================================================ // ============================================================================
//! Function call's argument (HL). //! Function call's argument (HL).
struct HLCallArg : public HLNode { class HLCallArg : public HLNode {
public:
ASMJIT_NO_COPY(HLCallArg) ASMJIT_NO_COPY(HLCallArg)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -11,12 +11,10 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_LOGGER) #if !defined(ASMJIT_DISABLE_LOGGER)
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/containers.h" #include "../base/containers.h"
#include "../base/logger.h" #include "../base/logger.h"
#include "../base/utils.h" #include "../base/utils.h"
// [Dependencies - C]
#include <stdarg.h> #include <stdarg.h>
// [Api-Begin] // [Api-Begin]

View File

@@ -10,10 +10,8 @@
#include "../build.h" #include "../build.h"
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/containers.h" #include "../base/containers.h"
// [Dependencies - C]
#include <stdarg.h> #include <stdarg.h>
// [Api-Begin] // [Api-Begin]
@@ -59,7 +57,8 @@ struct LogUtil {
//! //!
//! This class also contain `_enabled` member that can be used to enable //! This class also contain `_enabled` member that can be used to enable
//! or disable logging. //! or disable logging.
struct ASMJIT_VIRTAPI Logger { class ASMJIT_VIRTAPI Logger {
public:
ASMJIT_NO_COPY(Logger) ASMJIT_NO_COPY(Logger)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -68,16 +67,9 @@ struct ASMJIT_VIRTAPI Logger {
//! Logger options. //! Logger options.
ASMJIT_ENUM(Options) { ASMJIT_ENUM(Options) {
//! Whether to output instructions also in binary form. kOptionBinaryForm = 0x00000001, //! Output instructions also in binary form.
kOptionBinaryForm = 0, kOptionHexImmediate = 0x00000002, //! Output immediates as hexadecimal numbers.
kOptionHexDisplacement = 0x00000004 //! Output displacements as hexadecimal numbers.
//! Whether to output immediates as hexadecimal numbers.
kOptionHexImmediate = 1,
//! Whether to output displacements as hexadecimal numbers.
kOptionHexDisplacement = 2,
//! Count of logger options.
kOptionCount = 3
}; };
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -163,7 +155,8 @@ struct ASMJIT_VIRTAPI Logger {
// ============================================================================ // ============================================================================
//! Logger that can log to standard C `FILE*` stream. //! Logger that can log to standard C `FILE*` stream.
struct ASMJIT_VIRTAPI FileLogger : public Logger { class ASMJIT_VIRTAPI FileLogger : public Logger {
public:
ASMJIT_NO_COPY(FileLogger) ASMJIT_NO_COPY(FileLogger)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -212,7 +205,8 @@ struct ASMJIT_VIRTAPI FileLogger : public Logger {
// ============================================================================ // ============================================================================
//! String logger. //! String logger.
struct ASMJIT_VIRTAPI StringLogger : public Logger { class ASMJIT_VIRTAPI StringLogger : public Logger {
public:
ASMJIT_NO_COPY(StringLogger) ASMJIT_NO_COPY(StringLogger)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -7,7 +7,7 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/globals.h" #include "../base/globals.h"
// [Api-Begin] // [Api-Begin]

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_OPERAND_H #ifndef _ASMJIT_BASE_OPERAND_H
#define _ASMJIT_BASE_OPERAND_H #define _ASMJIT_BASE_OPERAND_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/utils.h" #include "../base/utils.h"
// [Api-Begin] // [Api-Begin]
@@ -143,7 +143,8 @@ ASMJIT_ENUM(VarType) {
// ============================================================================ // ============================================================================
//! Operand can contain register, memory location, immediate, or label. //! Operand can contain register, memory location, immediate, or label.
struct Operand { class Operand {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Type] // [Type]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -563,7 +564,8 @@ struct OperandUtil {
// ============================================================================ // ============================================================================
//! Base class for all register operands. //! Base class for all register operands.
struct Reg : public Operand { class Reg : public Operand {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -683,7 +685,8 @@ struct Reg : public Operand {
// ============================================================================ // ============================================================================
//! Base class for all memory operands. //! Base class for all memory operands.
struct BaseMem : public Operand { class BaseMem : public Operand {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -778,7 +781,8 @@ struct BaseMem : public Operand {
//! //!
//! To create immediate operand use `imm()` or `imm_u()` non-members or `Imm` //! To create immediate operand use `imm()` or `imm_u()` non-members or `Imm`
//! constructors. //! constructors.
struct Imm : public Operand { class Imm : public Operand {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1056,7 +1060,8 @@ struct Imm : public Operand {
//! // Bind label to the current position, see `Assembler::bind()`. //! // Bind label to the current position, see `Assembler::bind()`.
//! a.bind(L1); //! a.bind(L1);
//! ~~~ //! ~~~
struct Label : public Operand { class Label : public Operand {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1108,7 +1113,8 @@ struct Label : public Operand {
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
//! Base class for all variables. //! Base class for all variables.
struct Var : public Operand { class Var : public Operand {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -7,7 +7,7 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/podvector.h" #include "../base/podvector.h"
#include "../base/utils.h" #include "../base/utils.h"

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_PODVECTOR_H #ifndef _ASMJIT_BASE_PODVECTOR_H
#define _ASMJIT_BASE_PODVECTOR_H #define _ASMJIT_BASE_PODVECTOR_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/globals.h" #include "../base/globals.h"
// [Api-Begin] // [Api-Begin]
@@ -24,7 +24,8 @@ namespace asmjit {
// ============================================================================ // ============================================================================
//! \internal //! \internal
struct PodVectorBase { class PodVectorBase {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Data] // [Data]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -95,7 +96,8 @@ public:
//! - Optimized for working only with POD types //! - Optimized for working only with POD types
//! - Uses ASMJIT_... memory management macros //! - Uses ASMJIT_... memory management macros
template <typename T> template <typename T>
struct PodVector : PodVectorBase { class PodVector : public PodVectorBase {
public:
ASMJIT_NO_COPY(PodVector<T>) ASMJIT_NO_COPY(PodVector<T>)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -237,7 +239,8 @@ public:
// ============================================================================ // ============================================================================
template<typename T, size_t N> template<typename T, size_t N>
struct PodVectorTmp : public PodVector<T> { class PodVectorTmp : public PodVector<T> {
public:
ASMJIT_NO_COPY(PodVectorTmp<T, N>) ASMJIT_NO_COPY(PodVectorTmp<T, N>)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -7,7 +7,7 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/assembler.h" #include "../base/assembler.h"
#include "../base/runtime.h" #include "../base/runtime.h"

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_RUNTIME_H #ifndef _ASMJIT_BASE_RUNTIME_H
#define _ASMJIT_BASE_RUNTIME_H #define _ASMJIT_BASE_RUNTIME_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/cpuinfo.h" #include "../base/cpuinfo.h"
#include "../base/vmem.h" #include "../base/vmem.h"
@@ -21,8 +21,8 @@ namespace asmjit {
// [Forward Declarations] // [Forward Declarations]
// ============================================================================ // ============================================================================
struct Assembler; class Assembler;
struct CpuInfo; class CpuInfo;
//! \addtogroup asmjit_base //! \addtogroup asmjit_base
//! \{ //! \{
@@ -32,7 +32,8 @@ struct CpuInfo;
// ============================================================================ // ============================================================================
//! Base runtime. //! Base runtime.
struct ASMJIT_VIRTAPI Runtime { class ASMJIT_VIRTAPI Runtime {
public:
ASMJIT_NO_COPY(Runtime) ASMJIT_NO_COPY(Runtime)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -132,7 +133,8 @@ struct ASMJIT_VIRTAPI Runtime {
// ============================================================================ // ============================================================================
//! Base runtime for JIT code generation. //! Base runtime for JIT code generation.
struct ASMJIT_VIRTAPI HostRuntime : public Runtime { class ASMJIT_VIRTAPI HostRuntime : public Runtime {
public:
ASMJIT_NO_COPY(HostRuntime) ASMJIT_NO_COPY(HostRuntime)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -170,7 +172,8 @@ struct ASMJIT_VIRTAPI HostRuntime : public Runtime {
//! //!
//! JIT static runtime can be used to generate code to a memory location that //! JIT static runtime can be used to generate code to a memory location that
//! is known. //! is known.
struct ASMJIT_VIRTAPI StaticRuntime : public HostRuntime { class ASMJIT_VIRTAPI StaticRuntime : public HostRuntime {
public:
ASMJIT_NO_COPY(StaticRuntime) ASMJIT_NO_COPY(StaticRuntime)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -212,7 +215,8 @@ struct ASMJIT_VIRTAPI StaticRuntime : public HostRuntime {
// ============================================================================ // ============================================================================
//! JIT runtime. //! JIT runtime.
struct ASMJIT_VIRTAPI JitRuntime : public HostRuntime { class ASMJIT_VIRTAPI JitRuntime : public HostRuntime {
public:
ASMJIT_NO_COPY(JitRuntime) ASMJIT_NO_COPY(JitRuntime)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -7,21 +7,18 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/utils.h" #include "../base/utils.h"
// [Dependencies - Posix]
#if ASMJIT_OS_POSIX #if ASMJIT_OS_POSIX
# include <time.h> # include <time.h>
# include <unistd.h> # include <unistd.h>
#endif // ASMJIT_OS_POSIX #endif // ASMJIT_OS_POSIX
// [Dependencies - Mac]
#if ASMJIT_OS_MAC #if ASMJIT_OS_MAC
# include <mach/mach_time.h> # include <mach/mach_time.h>
#endif // ASMJIT_OS_MAC #endif // ASMJIT_OS_MAC
// [Dependencies - Windows]
#if ASMJIT_OS_WINDOWS #if ASMJIT_OS_WINDOWS
# if defined(_MSC_VER) && _MSC_VER >= 1400 # if defined(_MSC_VER) && _MSC_VER >= 1400
# include <intrin.h> # include <intrin.h>

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_UTILS_H #ifndef _ASMJIT_BASE_UTILS_H
#define _ASMJIT_BASE_UTILS_H #define _ASMJIT_BASE_UTILS_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/globals.h" #include "../base/globals.h"
#if ASMJIT_CC_MSC_GE(14, 0, 0) #if ASMJIT_CC_MSC_GE(14, 0, 0)

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_VECTYPES_H #ifndef _ASMJIT_BASE_VECTYPES_H
#define _ASMJIT_BASE_VECTYPES_H #define _ASMJIT_BASE_VECTYPES_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/globals.h" #include "../base/globals.h"
// [Api-Begin] // [Api-Begin]

View File

@@ -7,11 +7,10 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/globals.h" #include "../base/globals.h"
#include "../base/vmem.h" #include "../base/vmem.h"
// [Dependencies - Posix]
#if ASMJIT_OS_POSIX #if ASMJIT_OS_POSIX
# include <sys/types.h> # include <sys/types.h>
# include <sys/mman.h> # include <sys/mman.h>

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_VMEM_H #ifndef _ASMJIT_BASE_VMEM_H
#define _ASMJIT_BASE_VMEM_H #define _ASMJIT_BASE_VMEM_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/utils.h" #include "../base/utils.h"
// [Api-Begin] // [Api-Begin]
@@ -89,7 +89,8 @@ struct VMemUtil {
//! Reference implementation of memory manager that uses `VMemUtil` to allocate //! Reference implementation of memory manager that uses `VMemUtil` to allocate
//! chunks of virtual memory and bit arrays to manage it. //! chunks of virtual memory and bit arrays to manage it.
struct VMemMgr { class VMemMgr {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -101,8 +102,8 @@ struct VMemMgr {
//! Create a `VMemMgr` instance. //! Create a `VMemMgr` instance.
//! //!
//! \note When running on Windows it's possible to specify a `hProcess` to //! \note When running on Windows it's possible to specify a `hProcess` to
//! be used for memory allocation. This allows to allocate memory of remote //! be used for memory allocation. Using `hProcess` allows to allocate memory
//! process. //! of a remote process.
ASMJIT_API VMemMgr(HANDLE hProcess = static_cast<HANDLE>(0)) noexcept; ASMJIT_API VMemMgr(HANDLE hProcess = static_cast<HANDLE>(0)) noexcept;
#endif // ASMJIT_OS_WINDOWS #endif // ASMJIT_OS_WINDOWS

View File

@@ -7,11 +7,9 @@
// [Export] // [Export]
#define ASMJIT_EXPORTS #define ASMJIT_EXPORTS
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/utils.h" #include "../base/utils.h"
#include "../base/zone.h" #include "../base/zone.h"
// [Dependencies - C]
#include <stdarg.h> #include <stdarg.h>
// [Api-Begin] // [Api-Begin]

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_BASE_ZONE_H #ifndef _ASMJIT_BASE_ZONE_H
#define _ASMJIT_BASE_ZONE_H #define _ASMJIT_BASE_ZONE_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/globals.h" #include "../base/globals.h"
// [Api-Begin] // [Api-Begin]

View File

@@ -8,13 +8,10 @@
#ifndef _ASMJIT_HOST_H #ifndef _ASMJIT_HOST_H
#define _ASMJIT_HOST_H #define _ASMJIT_HOST_H
// [Dependencies - Core] // [Dependencies]
#include "./base.h" #include "./base.h"
// ============================================================================ // [X86 / X64]
// [asmjit::host - X86 / X64]
// ============================================================================
#if ASMJIT_ARCH_X86 || ASMJIT_ARCH_X64 #if ASMJIT_ARCH_X86 || ASMJIT_ARCH_X64
#include "./x86.h" #include "./x86.h"

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_X86_H #ifndef _ASMJIT_X86_H
#define _ASMJIT_X86_H #define _ASMJIT_X86_H
// [Dependencies - AsmJit] // [Dependencies]
#include "./base.h" #include "./base.h"
#include "./x86/x86assembler.h" #include "./x86/x86assembler.h"

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64) #if defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64)
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/containers.h" #include "../base/containers.h"
#include "../base/cpuinfo.h" #include "../base/cpuinfo.h"
#include "../base/logger.h" #include "../base/logger.h"
@@ -189,6 +189,9 @@ static ASMJIT_INLINE uint32_t x86ExtractO(uint32_t opCode) {
return (opCode >> kX86InstOpCode_O_Shift) & 0x07; return (opCode >> kX86InstOpCode_O_Shift) & 0x07;
} }
static ASMJIT_INLINE bool x86IsGpq(const Operand* op) { return op->isRegType(kX86RegTypeGpq); }
static ASMJIT_INLINE bool x86IsGpq(const X86Reg* reg) { return reg->isGpq(); }
static ASMJIT_INLINE bool x86IsXmm(const Operand* op) { return op->isRegType(kX86RegTypeXmm); } static ASMJIT_INLINE bool x86IsXmm(const Operand* op) { return op->isRegType(kX86RegTypeXmm); }
static ASMJIT_INLINE bool x86IsXmm(const X86Reg* reg) { return reg->isXmm(); } static ASMJIT_INLINE bool x86IsXmm(const X86Reg* reg) { return reg->isXmm(); }
@@ -1031,30 +1034,30 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
// [Group] // [Group]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
switch (info.getEncodingId()) { switch (info.getEncoding()) {
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// [None] // [None]
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case kX86InstEncodingIdNone: case kX86InstEncodingNone:
goto _EmitDone; goto _EmitDone;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// [X86] // [X86]
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case kX86InstEncodingIdX86Op_66H: case kX86InstEncodingX86Op_66H:
ADD_66H_P(true); ADD_66H_P(true);
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdX86Op: case kX86InstEncodingX86Op:
goto _EmitX86Op; goto _EmitX86Op;
case kX86InstEncodingIdX86Rm_B: case kX86InstEncodingX86Rm_B:
opCode += o0->getSize() != 1; opCode += o0->getSize() != 1;
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdX86Rm: case kX86InstEncodingX86Rm:
ADD_66H_P_BY_SIZE(o0->getSize()); ADD_66H_P_BY_SIZE(o0->getSize());
ADD_REX_W_BY_SIZE(o0->getSize()); ADD_REX_W_BY_SIZE(o0->getSize());
@@ -1069,7 +1072,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86RmReg: case kX86InstEncodingX86RmReg:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opCode += o0->getSize() != 1; opCode += o0->getSize() != 1;
ADD_66H_P_BY_SIZE(o0->getSize()); ADD_66H_P_BY_SIZE(o0->getSize());
@@ -1091,7 +1094,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86RegRm: case kX86InstEncodingX86RegRm:
ADD_66H_P_BY_SIZE(o0->getSize()); ADD_66H_P_BY_SIZE(o0->getSize());
ADD_REX_W_BY_SIZE(o0->getSize()); ADD_REX_W_BY_SIZE(o0->getSize());
@@ -1114,14 +1117,14 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86M: case kX86InstEncodingX86M:
if (encoded == ENC_OPS(Mem, None, None)) { if (encoded == ENC_OPS(Mem, None, None)) {
rmMem = x86OpMem(o0); rmMem = x86OpMem(o0);
goto _EmitX86M; goto _EmitX86M;
} }
break; break;
case kX86InstEncodingIdX86Arith: case kX86InstEncodingX86Arith:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opCode += (o0->getSize() != 1) + 2; opCode += (o0->getSize() != 1) + 2;
ADD_66H_P_BY_SIZE(o0->getSize()); ADD_66H_P_BY_SIZE(o0->getSize());
@@ -1193,7 +1196,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86BSwap: case kX86InstEncodingX86BSwap:
if (encoded == ENC_OPS(Reg, None, None)) { if (encoded == ENC_OPS(Reg, None, None)) {
if (o0->getSize() < 4) if (o0->getSize() < 4)
goto _IllegalInst; goto _IllegalInst;
@@ -1204,7 +1207,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86BTest: case kX86InstEncodingX86BTest:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
ADD_66H_P_BY_SIZE(o1->getSize()); ADD_66H_P_BY_SIZE(o1->getSize());
ADD_REX_W_BY_SIZE(o1->getSize()); ADD_REX_W_BY_SIZE(o1->getSize());
@@ -1247,7 +1250,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86Call: case kX86InstEncodingX86Call:
if (encoded == ENC_OPS(Reg, None, None)) { if (encoded == ENC_OPS(Reg, None, None)) {
rmReg = x86OpReg(o0); rmReg = x86OpReg(o0);
goto _EmitX86R; goto _EmitX86R;
@@ -1289,7 +1292,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86Enter: case kX86InstEncodingX86Enter:
if (encoded == ENC_OPS(Imm, Imm, None)) { if (encoded == ENC_OPS(Imm, Imm, None)) {
EMIT_BYTE(0xC8); EMIT_BYTE(0xC8);
EMIT_WORD(static_cast<const Imm*>(o1)->getUInt16()); EMIT_WORD(static_cast<const Imm*>(o1)->getUInt16());
@@ -1298,7 +1301,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86Imul: case kX86InstEncodingX86Imul:
ADD_66H_P_BY_SIZE(o0->getSize()); ADD_66H_P_BY_SIZE(o0->getSize());
ADD_REX_W_BY_SIZE(o0->getSize()); ADD_REX_W_BY_SIZE(o0->getSize());
@@ -1395,7 +1398,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86IncDec: case kX86InstEncodingX86IncDec:
ADD_66H_P_BY_SIZE(o0->getSize()); ADD_66H_P_BY_SIZE(o0->getSize());
ADD_REX_W_BY_SIZE(o0->getSize()); ADD_REX_W_BY_SIZE(o0->getSize());
@@ -1421,7 +1424,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86Int: case kX86InstEncodingX86Int:
if (encoded == ENC_OPS(Imm, None, None)) { if (encoded == ENC_OPS(Imm, None, None)) {
imVal = static_cast<const Imm*>(o0)->getInt64(); imVal = static_cast<const Imm*>(o0)->getInt64();
uint8_t imm8 = static_cast<uint8_t>(imVal & 0xFF); uint8_t imm8 = static_cast<uint8_t>(imVal & 0xFF);
@@ -1437,7 +1440,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86Jcc: case kX86InstEncodingX86Jcc:
if (encoded == ENC_OPS(Label, None, None)) { if (encoded == ENC_OPS(Label, None, None)) {
label = self->getLabelData(static_cast<const Label*>(o0)->getId()); label = self->getLabelData(static_cast<const Label*>(o0)->getId());
@@ -1493,7 +1496,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86Jecxz: case kX86InstEncodingX86Jecxz:
if (encoded == ENC_OPS(Reg, Label, None)) { if (encoded == ENC_OPS(Reg, Label, None)) {
if (x86OpReg(o0) != kX86RegIndexCx) if (x86OpReg(o0) != kX86RegIndexCx)
goto _IllegalInst; goto _IllegalInst;
@@ -1525,7 +1528,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86Jmp: case kX86InstEncodingX86Jmp:
if (encoded == ENC_OPS(Reg, None, None)) { if (encoded == ENC_OPS(Reg, None, None)) {
rmReg = x86OpReg(o0); rmReg = x86OpReg(o0);
goto _EmitX86R; goto _EmitX86R;
@@ -1588,7 +1591,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86Lea: case kX86InstEncodingX86Lea:
if (encoded == ENC_OPS(Reg, Mem, None)) { if (encoded == ENC_OPS(Reg, Mem, None)) {
ADD_66H_P_BY_SIZE(o0->getSize()); ADD_66H_P_BY_SIZE(o0->getSize());
ADD_REX_W_BY_SIZE(o0->getSize()); ADD_REX_W_BY_SIZE(o0->getSize());
@@ -1599,7 +1602,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86Mov: case kX86InstEncodingX86Mov:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -1746,7 +1749,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86MovSxZx: case kX86InstEncodingX86MovSxZx:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opCode += o1->getSize() != 1; opCode += o1->getSize() != 1;
ADD_66H_P_BY_SIZE(o0->getSize()); ADD_66H_P_BY_SIZE(o0->getSize());
@@ -1768,7 +1771,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86MovSxd: case kX86InstEncodingX86MovSxd:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
ADD_REX_W(true); ADD_REX_W(true);
@@ -1786,7 +1789,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86MovPtr: case kX86InstEncodingX86MovPtr:
if (encoded == ENC_OPS(Reg, Imm, None)) { if (encoded == ENC_OPS(Reg, Imm, None)) {
if (x86OpReg(o0) != 0) if (x86OpReg(o0) != 0)
goto _IllegalInst; goto _IllegalInst;
@@ -1817,7 +1820,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
break; break;
case kX86InstEncodingIdX86Push: case kX86InstEncodingX86Push:
if (encoded == ENC_OPS(Reg, None, None)) { if (encoded == ENC_OPS(Reg, None, None)) {
if (o0->isRegType(kX86RegTypeSeg)) { if (o0->isRegType(kX86RegTypeSeg)) {
uint32_t segment = x86OpReg(o0); uint32_t segment = x86OpReg(o0);
@@ -1844,7 +1847,7 @@ static ASMJIT_INLINE Error X86Assembler_emit(Assembler* self_, uint32_t code, co
} }
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdX86Pop: case kX86InstEncodingX86Pop:
if (encoded == ENC_OPS(Reg, None, None)) { if (encoded == ENC_OPS(Reg, None, None)) {
if (o0->isRegType(kX86RegTypeSeg)) { if (o0->isRegType(kX86RegTypeSeg)) {
uint32_t segment = x86OpReg(o0); uint32_t segment = x86OpReg(o0);
@@ -1883,12 +1886,12 @@ _GroupPop_Gp:
} }
break; break;
case kX86InstEncodingIdX86Rep: case kX86InstEncodingX86Rep:
// Emit REP 0xF2 or 0xF3 prefix first. // Emit REP 0xF2 or 0xF3 prefix first.
EMIT_BYTE(0xF2 + opReg); EMIT_BYTE(0xF2 + opReg);
goto _EmitX86Op; goto _EmitX86Op;
case kX86InstEncodingIdX86Ret: case kX86InstEncodingX86Ret:
if (encoded == ENC_OPS(None, None, None)) { if (encoded == ENC_OPS(None, None, None)) {
EMIT_BYTE(0xC3); EMIT_BYTE(0xC3);
goto _EmitDone; goto _EmitDone;
@@ -1908,7 +1911,7 @@ _GroupPop_Gp:
} }
break; break;
case kX86InstEncodingIdX86Rot: case kX86InstEncodingX86Rot:
opCode += o0->getSize() != 1; opCode += o0->getSize() != 1;
ADD_66H_P_BY_SIZE(o0->getSize()); ADD_66H_P_BY_SIZE(o0->getSize());
ADD_REX_W_BY_SIZE(o0->getSize()); ADD_REX_W_BY_SIZE(o0->getSize());
@@ -1949,7 +1952,7 @@ _GroupPop_Gp:
} }
break; break;
case kX86InstEncodingIdX86Set: case kX86InstEncodingX86Set:
if (encoded == ENC_OPS(Reg, None, None)) { if (encoded == ENC_OPS(Reg, None, None)) {
ASMJIT_ASSERT(o0->getSize() == 1); ASMJIT_ASSERT(o0->getSize() == 1);
@@ -1965,7 +1968,7 @@ _GroupPop_Gp:
} }
break; break;
case kX86InstEncodingIdX86Shlrd: case kX86InstEncodingX86Shlrd:
if (encoded == ENC_OPS(Reg, Reg, Imm)) { if (encoded == ENC_OPS(Reg, Reg, Imm)) {
ASMJIT_ASSERT(o0->getSize() == o1->getSize()); ASMJIT_ASSERT(o0->getSize() == o1->getSize());
@@ -2019,7 +2022,7 @@ _GroupPop_Gp:
} }
break; break;
case kX86InstEncodingIdX86Test: case kX86InstEncodingX86Test:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
ASMJIT_ASSERT(o0->getSize() == o1->getSize()); ASMJIT_ASSERT(o0->getSize() == o1->getSize());
@@ -2079,7 +2082,7 @@ _GroupPop_Gp:
} }
break; break;
case kX86InstEncodingIdX86Xchg: case kX86InstEncodingX86Xchg:
if (encoded == ENC_OPS(Reg, Mem, None)) { if (encoded == ENC_OPS(Reg, Mem, None)) {
opCode += o0->getSize() != 1; opCode += o0->getSize() != 1;
ADD_66H_P_BY_SIZE(o0->getSize()); ADD_66H_P_BY_SIZE(o0->getSize());
@@ -2091,7 +2094,7 @@ _GroupPop_Gp:
} }
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdX86Xadd: case kX86InstEncodingX86Xadd:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opReg = x86OpReg(o1); opReg = x86OpReg(o1);
rmReg = x86OpReg(o0); rmReg = x86OpReg(o0);
@@ -2123,14 +2126,57 @@ _GroupPop_Gp:
} }
break; break;
case kX86InstEncodingX86Crc:
ADD_66H_P_BY_SIZE(o0->getSize());
ADD_REX_W_BY_SIZE(o0->getSize());
if (encoded == ENC_OPS(Reg, Reg, None)) {
if (!Utils::inInterval<uint32_t>(static_cast<const X86Reg*>(o0)->getRegType(), kX86RegTypeGpd, kX86RegTypeGpq))
goto _IllegalInst;
opCode += o0->getSize() != 1;
opReg = x86OpReg(o0);
rmReg = x86OpReg(o1);
goto _EmitX86R;
}
if (encoded == ENC_OPS(Reg, Mem, None)) {
if (!Utils::inInterval<uint32_t>(static_cast<const X86Reg*>(o0)->getRegType(), kX86RegTypeGpd, kX86RegTypeGpq))
goto _IllegalInst;
opCode += o0->getSize() != 1;
opReg = x86OpReg(o0);
rmMem = x86OpMem(o1);
goto _EmitX86M;
}
break;
case kX86InstEncodingX86Prefetch:
if (encoded == ENC_OPS(Mem, Imm, None)) {
opReg = static_cast<const Imm*>(o1)->getUInt32() & 0x3;
rmMem = x86OpMem(o0);
goto _EmitX86M;
}
break;
case kX86InstEncodingX86Fence:
if (Arch == kArchX64 && (opCode & kX86InstOpCode_W_Mask)) {
EMIT_BYTE(kX86ByteRex | kX86ByteRexW);
}
EMIT_BYTE(0x0F);
EMIT_BYTE(opCode);
EMIT_BYTE(0xC0 | (opReg << 3));
goto _EmitDone;
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// [Fpu] // [Fpu]
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case kX86InstEncodingIdFpuOp: case kX86InstEncodingFpuOp:
goto _EmitFpuOp; goto _EmitFpuOp;
case kX86InstEncodingIdFpuArith: case kX86InstEncodingFpuArith:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -2161,7 +2207,7 @@ _EmitFpArith_Mem:
} }
break; break;
case kX86InstEncodingIdFpuCom: case kX86InstEncodingFpuCom:
if (encoded == ENC_OPS(None, None, None)) { if (encoded == ENC_OPS(None, None, None)) {
rmReg = 1; rmReg = 1;
goto _EmitFpArith_Reg; goto _EmitFpArith_Reg;
@@ -2177,7 +2223,7 @@ _EmitFpArith_Mem:
} }
break; break;
case kX86InstEncodingIdFpuFldFst: case kX86InstEncodingFpuFldFst:
if (encoded == ENC_OPS(Mem, None, None)) { if (encoded == ENC_OPS(Mem, None, None)) {
rmMem = x86OpMem(o0); rmMem = x86OpMem(o0);
@@ -2216,7 +2262,7 @@ _EmitFpArith_Mem:
break; break;
case kX86InstEncodingIdFpuM: case kX86InstEncodingFpuM:
if (encoded == ENC_OPS(Mem, None, None)) { if (encoded == ENC_OPS(Mem, None, None)) {
rmMem = x86OpMem(o0); rmMem = x86OpMem(o0);
@@ -2237,21 +2283,21 @@ _EmitFpArith_Mem:
} }
break; break;
case kX86InstEncodingIdFpuRDef: case kX86InstEncodingFpuRDef:
if (encoded == ENC_OPS(None, None, None)) { if (encoded == ENC_OPS(None, None, None)) {
opCode += 1; opCode += 1;
goto _EmitFpuOp; goto _EmitFpuOp;
} }
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdFpuR: case kX86InstEncodingFpuR:
if (encoded == ENC_OPS(Reg, None, None)) { if (encoded == ENC_OPS(Reg, None, None)) {
opCode += x86OpReg(o0); opCode += x86OpReg(o0);
goto _EmitFpuOp; goto _EmitFpuOp;
} }
break; break;
case kX86InstEncodingIdFpuStsw: case kX86InstEncodingFpuStsw:
if (encoded == ENC_OPS(Reg, None, None)) { if (encoded == ENC_OPS(Reg, None, None)) {
if (x86OpReg(o0) != 0) if (x86OpReg(o0) != 0)
goto _IllegalInst; goto _IllegalInst;
@@ -2270,32 +2316,7 @@ _EmitFpArith_Mem:
// [Ext] // [Ext]
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case kX86InstEncodingIdExtCrc: case kX86InstEncodingSimdPextrw:
ADD_66H_P_BY_SIZE(o0->getSize());
ADD_REX_W_BY_SIZE(o0->getSize());
if (encoded == ENC_OPS(Reg, Reg, None)) {
if (!Utils::inInterval<uint32_t>(static_cast<const X86Reg*>(o0)->getRegType(), kX86RegTypeGpd, kX86RegTypeGpq))
goto _IllegalInst;
opCode += o0->getSize() != 1;
opReg = x86OpReg(o0);
rmReg = x86OpReg(o1);
goto _EmitX86R;
}
if (encoded == ENC_OPS(Reg, Mem, None)) {
if (!Utils::inInterval<uint32_t>(static_cast<const X86Reg*>(o0)->getRegType(), kX86RegTypeGpd, kX86RegTypeGpq))
goto _IllegalInst;
opCode += o0->getSize() != 1;
opReg = x86OpReg(o0);
rmMem = x86OpMem(o1);
goto _EmitX86M;
}
break;
case kX86InstEncodingIdExtExtrW:
if (encoded == ENC_OPS(Reg, Reg, Imm)) { if (encoded == ENC_OPS(Reg, Reg, Imm)) {
ADD_66H_P(x86IsXmm(static_cast<const X86Reg*>(o1))); ADD_66H_P(x86IsXmm(static_cast<const X86Reg*>(o1)));
@@ -2321,7 +2342,7 @@ _EmitFpArith_Mem:
} }
break; break;
case kX86InstEncodingIdExtExtract: case kX86InstEncodingSimdExtract:
if (encoded == ENC_OPS(Reg, Reg, Imm)) { if (encoded == ENC_OPS(Reg, Reg, Imm)) {
ADD_66H_P(x86IsXmm(static_cast<const X86Reg*>(o1))); ADD_66H_P(x86IsXmm(static_cast<const X86Reg*>(o1)));
@@ -2345,18 +2366,8 @@ _EmitFpArith_Mem:
} }
break; break;
case kX86InstEncodingIdExtFence: case kX86InstEncodingSimdMov:
if (Arch == kArchX64 && (opCode & kX86InstOpCode_W_Mask)) { case kX86InstEncodingSimdMovNoRexW:
EMIT_BYTE(kX86ByteRex | kX86ByteRexW);
}
EMIT_BYTE(0x0F);
EMIT_BYTE(opCode);
EMIT_BYTE(0xC0 | (opReg << 3));
goto _EmitDone;
case kX86InstEncodingIdExtMov:
case kX86InstEncodingIdExtMovNoRexW:
ASMJIT_ASSERT(extendedInfo._opFlags[0] != 0); ASMJIT_ASSERT(extendedInfo._opFlags[0] != 0);
ASMJIT_ASSERT(extendedInfo._opFlags[1] != 0); ASMJIT_ASSERT(extendedInfo._opFlags[1] != 0);
@@ -2374,8 +2385,8 @@ _EmitFpArith_Mem:
// Gp|Mm|Xmm <- Gp|Mm|Xmm // Gp|Mm|Xmm <- Gp|Mm|Xmm
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
ADD_REX_W(static_cast<const X86Reg*>(o0)->isGpq() && (info.getEncodingId() != kX86InstEncodingIdExtMovNoRexW)); ADD_REX_W(x86IsGpq(static_cast<const X86Reg*>(o0)) && (info.getEncoding() != kX86InstEncodingSimdMovNoRexW));
ADD_REX_W(static_cast<const X86Reg*>(o1)->isGpq() && (info.getEncodingId() != kX86InstEncodingIdExtMovNoRexW)); ADD_REX_W(x86IsGpq(static_cast<const X86Reg*>(o1)) && (info.getEncoding() != kX86InstEncodingSimdMovNoRexW));
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -2384,7 +2395,7 @@ _EmitFpArith_Mem:
// Gp|Mm|Xmm <- Mem // Gp|Mm|Xmm <- Mem
if (encoded == ENC_OPS(Reg, Mem, None)) { if (encoded == ENC_OPS(Reg, Mem, None)) {
ADD_REX_W(static_cast<const X86Reg*>(o0)->isGpq() && (info.getEncodingId() != kX86InstEncodingIdExtMovNoRexW)); ADD_REX_W(x86IsGpq(static_cast<const X86Reg*>(o0)) && (info.getEncoding() != kX86InstEncodingSimdMovNoRexW));
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmMem = x86OpMem(o1); rmMem = x86OpMem(o1);
@@ -2396,7 +2407,7 @@ _EmitFpArith_Mem:
// X86Mem <- Gp|Mm|Xmm // X86Mem <- Gp|Mm|Xmm
if (encoded == ENC_OPS(Mem, Reg, None)) { if (encoded == ENC_OPS(Mem, Reg, None)) {
ADD_REX_W(static_cast<const X86Reg*>(o1)->isGpq() && (info.getEncodingId() != kX86InstEncodingIdExtMovNoRexW)); ADD_REX_W(x86IsGpq(static_cast<const X86Reg*>(o1)) && (info.getEncoding() != kX86InstEncodingSimdMovNoRexW));
opReg = x86OpReg(o1); opReg = x86OpReg(o1);
rmMem = x86OpMem(o0); rmMem = x86OpMem(o0);
@@ -2404,7 +2415,7 @@ _EmitFpArith_Mem:
} }
break; break;
case kX86InstEncodingIdExtMovBe: case kX86InstEncodingSimdMovBe:
if (encoded == ENC_OPS(Reg, Mem, None)) { if (encoded == ENC_OPS(Reg, Mem, None)) {
if (o0->getSize() == 1) if (o0->getSize() == 1)
goto _IllegalInst; goto _IllegalInst;
@@ -2433,7 +2444,7 @@ _EmitFpArith_Mem:
} }
break; break;
case kX86InstEncodingIdExtMovD: case kX86InstEncodingSimdMovD:
_EmitMmMovD: _EmitMmMovD:
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
ADD_66H_P(x86IsXmm(static_cast<const X86Reg*>(o0))); ADD_66H_P(x86IsXmm(static_cast<const X86Reg*>(o0)));
@@ -2468,7 +2479,7 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdExtMovQ: case kX86InstEncodingSimdMovQ:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -2539,23 +2550,15 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdExtPrefetch: case kX86InstEncodingSimdRm_PQ:
if (encoded == ENC_OPS(Mem, Imm, None)) {
opReg = static_cast<const Imm*>(o1)->getUInt32() & 0x3;
rmMem = x86OpMem(o0);
goto _EmitX86M;
}
break;
case kX86InstEncodingIdExtRm_PQ:
ADD_66H_P(o0->isRegType(kX86RegTypeXmm) || o1->isRegType(kX86RegTypeXmm)); ADD_66H_P(o0->isRegType(kX86RegTypeXmm) || o1->isRegType(kX86RegTypeXmm));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdExtRm_Q: case kX86InstEncodingSimdRm_Q:
ADD_REX_W(o0->isRegType(kX86RegTypeGpq) || o1->isRegType(kX86RegTypeGpq) || (o1->isMem() && o1->getSize() == 8)); ADD_REX_W(o0->isRegType(kX86RegTypeGpq) || o1->isRegType(kX86RegTypeGpq) || (o1->isMem() && o1->getSize() == 8));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdExtRm: case kX86InstEncodingSimdRm:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -2569,7 +2572,7 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdExtRm_P: case kX86InstEncodingSimdRm_P:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
ADD_66H_P(x86IsXmm(static_cast<const X86Reg*>(o0)) | x86IsXmm(static_cast<const X86Reg*>(o1))); ADD_66H_P(x86IsXmm(static_cast<const X86Reg*>(o0)) | x86IsXmm(static_cast<const X86Reg*>(o1)));
@@ -2587,7 +2590,7 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdExtRmRi: case kX86InstEncodingSimdRmRi:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -2613,7 +2616,7 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdExtRmRi_P: case kX86InstEncodingSimdRmRi_P:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
ADD_66H_P(x86IsXmm(static_cast<const X86Reg*>(o0)) | x86IsXmm(static_cast<const X86Reg*>(o1))); ADD_66H_P(x86IsXmm(static_cast<const X86Reg*>(o0)) | x86IsXmm(static_cast<const X86Reg*>(o1)));
@@ -2645,7 +2648,7 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdExtRmi: case kX86InstEncodingSimdRmi:
imVal = static_cast<const Imm*>(o2)->getInt64(); imVal = static_cast<const Imm*>(o2)->getInt64();
imLen = 1; imLen = 1;
@@ -2662,7 +2665,7 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdExtRmi_P: case kX86InstEncodingSimdRmi_P:
imVal = static_cast<const Imm*>(o2)->getInt64(); imVal = static_cast<const Imm*>(o2)->getInt64();
imLen = 1; imLen = 1;
@@ -2687,7 +2690,7 @@ _EmitMmMovD:
// [Group - Extrq / Insertq (SSE4a)] // [Group - Extrq / Insertq (SSE4a)]
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case kX86InstEncodingIdExtExtrq: case kX86InstEncodingSimdExtrq:
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -2707,7 +2710,7 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdExtInsertq: case kX86InstEncodingSimdInsertq:
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -2729,7 +2732,7 @@ _EmitMmMovD:
// [Group - 3dNow] // [Group - 3dNow]
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case kX86InstEncodingId3dNow: case kX86InstEncodingSimd3dNow:
// Every 3dNow instruction starts with 0x0F0F and the actual opcode is // Every 3dNow instruction starts with 0x0F0F and the actual opcode is
// stored as 8-bit immediate. // stored as 8-bit immediate.
imVal = opCode & 0xFF; imVal = opCode & 0xFF;
@@ -2753,21 +2756,21 @@ _EmitMmMovD:
// [Avx] // [Avx]
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case kX86InstEncodingIdAvxOp: case kX86InstEncodingAvxOp:
goto _EmitAvxOp; goto _EmitAvxOp;
case kX86InstEncodingIdAvxM: case kX86InstEncodingAvxM:
if (encoded == ENC_OPS(Mem, None, None)) { if (encoded == ENC_OPS(Mem, None, None)) {
rmMem = x86OpMem(o0); rmMem = x86OpMem(o0);
goto _EmitAvxM; goto _EmitAvxM;
} }
break; break;
case kX86InstEncodingIdAvxMr_P: case kX86InstEncodingAvxMr_OptL:
ADD_VEX_L(x86IsYmm(o0) | x86IsYmm(o1)); ADD_VEX_L(x86IsYmm(o0) | x86IsYmm(o1));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxMr: case kX86InstEncodingAvxMr:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opReg = x86OpReg(o1); opReg = x86OpReg(o1);
rmReg = x86OpReg(o0); rmReg = x86OpReg(o0);
@@ -2781,11 +2784,11 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdAvxMri_P: case kX86InstEncodingAvxMri_OptL:
ADD_VEX_L(x86IsYmm(o0) | x86IsYmm(static_cast<const X86Reg*>(o1))); ADD_VEX_L(x86IsYmm(o0) | x86IsYmm(static_cast<const X86Reg*>(o1)));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxMri: case kX86InstEncodingAvxMri:
imVal = static_cast<const Imm*>(o2)->getInt64(); imVal = static_cast<const Imm*>(o2)->getInt64();
imLen = 1; imLen = 1;
@@ -2802,11 +2805,11 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdAvxRm_P: case kX86InstEncodingAvxRm_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1)); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxRm: case kX86InstEncodingAvxRm:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -2820,11 +2823,8 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdAvxRmi_P: case kX86InstEncodingAvxRmi:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1)); CaseAvxRmi:
ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxRmi:
imVal = static_cast<const Imm*>(o2)->getInt64(); imVal = static_cast<const Imm*>(o2)->getInt64();
imLen = 1; imLen = 1;
@@ -2841,13 +2841,18 @@ _EmitMmMovD:
} }
break; break;
case kX86InstEncodingIdAvxRvm_P: case kX86InstEncodingAvxRmi_OptW:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1))); ADD_VEX_L(x86IsGpq(static_cast<const X86Reg*>(o0)) | x86IsGpq(o1));
ASMJIT_FALLTHROUGH; goto CaseAvxRmi;
case kX86InstEncodingIdAvxRvm: case kX86InstEncodingAvxRmi_OptL:
if (encoded == ENC_OPS(Reg, Reg, Reg)) { ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1));
goto CaseAvxRmi;
case kX86InstEncodingAvxRvm:
_EmitAvxRvm: _EmitAvxRvm:
if (encoded == ENC_OPS(Reg, Reg, Reg)) {
_EmitAvxRvm_Reg:
opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o1)); opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o1));
rmReg = x86OpReg(o2); rmReg = x86OpReg(o2);
goto _EmitAvxR; goto _EmitAvxR;
@@ -2860,11 +2865,19 @@ _EmitAvxRvm:
} }
break; break;
case kX86InstEncodingIdAvxRvmr_P: case kX86InstEncodingAvxRvm_OptW:
ADD_VEX_L(x86IsGpq(static_cast<const X86Reg*>(o0)) | x86IsGpq(static_cast<const X86Reg*>(o1)));
goto _EmitAvxRvm;
case kX86InstEncodingAvxRvm_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1)));
goto _EmitAvxRvm;
case kX86InstEncodingAvxRvmr_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1))); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1)));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxRvmr: case kX86InstEncodingAvxRvmr:
if (!o3->isReg()) if (!o3->isReg())
goto _IllegalInst; goto _IllegalInst;
@@ -2884,11 +2897,11 @@ _EmitAvxRvm:
} }
break; break;
case kX86InstEncodingIdAvxRvmi_P: case kX86InstEncodingAvxRvmi_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1))); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1)));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxRvmi: case kX86InstEncodingAvxRvmi:
if (!o3->isImm()) if (!o3->isImm())
goto _IllegalInst; goto _IllegalInst;
@@ -2908,7 +2921,8 @@ _EmitAvxRvm:
} }
break; break;
case kX86InstEncodingIdAvxRmv: case kX86InstEncodingAvxRmv:
CaseAvxRmv:
if (encoded == ENC_OPS(Reg, Reg, Reg)) { if (encoded == ENC_OPS(Reg, Reg, Reg)) {
opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o2)); opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o2));
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -2922,7 +2936,11 @@ _EmitAvxRvm:
} }
break; break;
case kX86InstEncodingIdAvxRmvi: case kX86InstEncodingAvxRmv_OptW:
ADD_VEX_W(x86IsGpq(static_cast<const X86Reg*>(o0)) | x86IsGpq(static_cast<const X86Reg*>(o2)));
goto CaseAvxRmv;
case kX86InstEncodingAvxRmvi:
if (!o3->isImm()) if (!o3->isImm())
goto _IllegalInst; goto _IllegalInst;
@@ -2942,7 +2960,7 @@ _EmitAvxRvm:
} }
break; break;
case kX86InstEncodingIdAvxMovDQ: case kX86InstEncodingAvxMovDQ:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
if (static_cast<const X86Reg*>(o0)->isGp()) { if (static_cast<const X86Reg*>(o0)->isGp()) {
opCode = extendedInfo.getSecondaryOpCode(); opCode = extendedInfo.getSecondaryOpCode();
@@ -2960,11 +2978,11 @@ _EmitAvxRvm:
goto _AvxRmMr_AfterRegRegCheck; goto _AvxRmMr_AfterRegRegCheck;
case kX86InstEncodingIdAvxRmMr_P: case kX86InstEncodingAvxRmMr_OptL:
ADD_VEX_L(x86IsYmm(o0) | x86IsYmm(o1)); ADD_VEX_L(x86IsYmm(o0) | x86IsYmm(o1));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxRmMr: case kX86InstEncodingAvxRmMr:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -2989,11 +3007,11 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdAvxRvmRmi_P: case kX86InstEncodingAvxRvmRmi_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1)); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxRvmRmi: case kX86InstEncodingAvxRvmRmi:
if (encoded == ENC_OPS(Reg, Reg, Reg)) { if (encoded == ENC_OPS(Reg, Reg, Reg)) {
opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o1)); opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o1));
rmReg = x86OpReg(o2); rmReg = x86OpReg(o2);
@@ -3026,7 +3044,7 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdAvxRvmMr: case kX86InstEncodingAvxRvmMr:
if (encoded == ENC_OPS(Reg, Reg, Reg)) { if (encoded == ENC_OPS(Reg, Reg, Reg)) {
opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o1)); opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o1));
rmReg = x86OpReg(o2); rmReg = x86OpReg(o2);
@@ -3055,11 +3073,11 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdAvxRvmMvr_P: case kX86InstEncodingAvxRvmMvr_OptL:
ADD_VEX_L(x86IsYmm(o0) | x86IsYmm(o1)); ADD_VEX_L(x86IsYmm(o0) | x86IsYmm(o1));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxRvmMvr: case kX86InstEncodingAvxRvmMvr:
if (encoded == ENC_OPS(Reg, Reg, Reg)) { if (encoded == ENC_OPS(Reg, Reg, Reg)) {
opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o1)); opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o1));
rmReg = x86OpReg(o2); rmReg = x86OpReg(o2);
@@ -3083,11 +3101,11 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdAvxRvmVmi_P: case kX86InstEncodingAvxRvmVmi_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1)); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxRvmVmi: case kX86InstEncodingAvxRvmVmi:
if (encoded == ENC_OPS(Reg, Reg, Reg)) { if (encoded == ENC_OPS(Reg, Reg, Reg)) {
opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o1)); opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o1));
rmReg = x86OpReg(o2); rmReg = x86OpReg(o2);
@@ -3121,7 +3139,8 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdAvxVm: case kX86InstEncodingAvxVm:
CaseAvxVm:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opReg = x86RegAndVvvv(opReg, x86OpReg(o0)); opReg = x86RegAndVvvv(opReg, x86OpReg(o0));
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -3135,11 +3154,15 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdAvxVmi_P: case kX86InstEncodingAvxVm_OptW:
ADD_VEX_W(x86IsGpq(static_cast<const X86Reg*>(o0)) | x86IsGpq(o1));
goto CaseAvxVm;
case kX86InstEncodingAvxVmi_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1)); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxVmi: case kX86InstEncodingAvxVmi:
imVal = static_cast<const Imm*>(o3)->getInt64(); imVal = static_cast<const Imm*>(o3)->getInt64();
imLen = 1; imLen = 1;
@@ -3156,11 +3179,11 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdAvxRvrmRvmr_P: case kX86InstEncodingAvxRvrmRvmr_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1))); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1)));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdAvxRvrmRvmr: case kX86InstEncodingAvxRvrmRvmr:
if (encoded == ENC_OPS(Reg, Reg, Reg) && o3->isReg()) { if (encoded == ENC_OPS(Reg, Reg, Reg) && o3->isReg()) {
imVal = x86OpReg(o3) << 4; imVal = x86OpReg(o3) << 4;
imLen = 1; imLen = 1;
@@ -3193,9 +3216,9 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdAvxMovSsSd: case kX86InstEncodingAvxMovSsSd:
if (encoded == ENC_OPS(Reg, Reg, Reg)) { if (encoded == ENC_OPS(Reg, Reg, Reg)) {
goto _EmitAvxRvm; goto _EmitAvxRvm_Reg;
} }
if (encoded == ENC_OPS(Reg, Mem, None)) { if (encoded == ENC_OPS(Reg, Mem, None)) {
@@ -3212,7 +3235,7 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdAvxGatherEx: case kX86InstEncodingAvxGatherEx:
if (encoded == ENC_OPS(Reg, Mem, Reg)) { if (encoded == ENC_OPS(Reg, Mem, Reg)) {
opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o2)); opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o2));
rmMem = x86OpMem(o1); rmMem = x86OpMem(o1);
@@ -3226,7 +3249,7 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdAvxGather: case kX86InstEncodingAvxGather:
if (encoded == ENC_OPS(Reg, Mem, Reg)) { if (encoded == ENC_OPS(Reg, Mem, Reg)) {
opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o2)); opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o2));
rmMem = x86OpMem(o1); rmMem = x86OpMem(o1);
@@ -3244,12 +3267,12 @@ _AvxRmMr_AfterRegRegCheck:
// [FMA4] // [FMA4]
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case kX86InstEncodingIdFma4_P: case kX86InstEncodingFma4_OptL:
// It's fine to just check the first operand, second is just for sanity. // It's fine to just check the first operand, second is just for sanity.
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1))); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1)));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdFma4: case kX86InstEncodingFma4:
if (encoded == ENC_OPS(Reg, Reg, Reg) && o3->isReg()) { if (encoded == ENC_OPS(Reg, Reg, Reg) && o3->isReg()) {
imVal = x86OpReg(o3) << 4; imVal = x86OpReg(o3) << 4;
imLen = 1; imLen = 1;
@@ -3286,11 +3309,11 @@ _AvxRmMr_AfterRegRegCheck:
// [XOP] // [XOP]
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
case kX86InstEncodingIdXopRm_P: case kX86InstEncodingXopRm_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1)); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(o1));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdXopRm: case kX86InstEncodingXopRm:
if (encoded == ENC_OPS(Reg, Reg, None)) { if (encoded == ENC_OPS(Reg, Reg, None)) {
opReg = x86OpReg(o0); opReg = x86OpReg(o0);
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -3304,7 +3327,7 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdXopRvmRmv: case kX86InstEncodingXopRvmRmv:
if (encoded == ENC_OPS(Reg, Reg, Reg)) { if (encoded == ENC_OPS(Reg, Reg, Reg)) {
opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o2)); opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o2));
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -3329,7 +3352,7 @@ _AvxRmMr_AfterRegRegCheck:
break; break;
case kX86InstEncodingIdXopRvmRmi: case kX86InstEncodingXopRvmRmi:
if (encoded == ENC_OPS(Reg, Reg, Reg)) { if (encoded == ENC_OPS(Reg, Reg, Reg)) {
opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o2)); opReg = x86RegAndVvvv(x86OpReg(o0), x86OpReg(o2));
rmReg = x86OpReg(o1); rmReg = x86OpReg(o1);
@@ -3370,11 +3393,11 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdXopRvmr_P: case kX86InstEncodingXopRvmr_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1))); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1)));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdXopRvmr: case kX86InstEncodingXopRvmr:
if (!o3->isReg()) if (!o3->isReg())
goto _IllegalInst; goto _IllegalInst;
@@ -3394,11 +3417,11 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdXopRvmi_P: case kX86InstEncodingXopRvmi_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1))); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1)));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdXopRvmi: case kX86InstEncodingXopRvmi:
if (!o3->isImm()) if (!o3->isImm())
goto _IllegalInst; goto _IllegalInst;
@@ -3418,11 +3441,11 @@ _AvxRmMr_AfterRegRegCheck:
} }
break; break;
case kX86InstEncodingIdXopRvrmRvmr_P: case kX86InstEncodingXopRvrmRvmr_OptL:
ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1))); ADD_VEX_L(x86IsYmm(static_cast<const X86Reg*>(o0)) | x86IsYmm(static_cast<const X86Reg*>(o1)));
ASMJIT_FALLTHROUGH; ASMJIT_FALLTHROUGH;
case kX86InstEncodingIdXopRvrmRvmr: case kX86InstEncodingXopRvrmRvmr:
if (encoded == ENC_OPS(Reg, Reg, Reg) && o3->isReg()) { if (encoded == ENC_OPS(Reg, Reg, Reg) && o3->isReg()) {
imVal = x86OpReg(o3) << 4; imVal = x86OpReg(o3) << 4;
imLen = 1; imLen = 1;

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_X86_X86ASSEMBLER_H #ifndef _ASMJIT_X86_X86ASSEMBLER_H
#define _ASMJIT_X86_X86ASSEMBLER_H #define _ASMJIT_X86_X86ASSEMBLER_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/assembler.h" #include "../base/assembler.h"
#include "../x86/x86inst.h" #include "../x86/x86inst.h"
#include "../x86/x86operand.h" #include "../x86/x86operand.h"
@@ -379,7 +379,8 @@ namespace asmjit {
//! functions available that return a new register operand. //! functions available that return a new register operand.
//! //!
//! \sa X86Compiler. //! \sa X86Compiler.
struct ASMJIT_VIRTAPI X86Assembler : public Assembler { class ASMJIT_VIRTAPI X86Assembler : public Assembler {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) && (defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64)) #if !defined(ASMJIT_DISABLE_COMPILER) && (defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64))
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/containers.h" #include "../base/containers.h"
#include "../base/utils.h" #include "../base/utils.h"
#include "../x86/x86assembler.h" #include "../x86/x86assembler.h"

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/compiler.h" #include "../base/compiler.h"
#include "../base/vectypes.h" #include "../base/vectypes.h"
#include "../x86/x86assembler.h" #include "../x86/x86assembler.h"
@@ -26,8 +26,8 @@ namespace asmjit {
// [Forward Declarations] // [Forward Declarations]
// ============================================================================ // ============================================================================
struct X86CallNode; class X86CallNode;
struct X86FuncNode; class X86FuncNode;
//! \addtogroup asmjit_x86 //! \addtogroup asmjit_x86
//! \{ //! \{
@@ -64,7 +64,8 @@ ASMJIT_VARAPI const uint8_t _x64VarMapping[kX86VarTypeCount];
// ============================================================================ // ============================================================================
//! X86/X64 function node. //! X86/X64 function node.
struct X86FuncNode : public HLFunc { class X86FuncNode : public HLFunc {
public:
ASMJIT_NO_COPY(X86FuncNode) ASMJIT_NO_COPY(X86FuncNode)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -194,7 +195,8 @@ struct X86FuncNode : public HLFunc {
// ============================================================================ // ============================================================================
//! X86/X64 function-call node. //! X86/X64 function-call node.
struct X86CallNode : public HLCall { class X86CallNode : public HLCall {
public:
ASMJIT_NO_COPY(X86CallNode) ASMJIT_NO_COPY(X86CallNode)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -711,7 +713,8 @@ struct X86CallNode : public HLCall {
//! Other use cases are waiting for you! Be sure that instruction that are //! Other use cases are waiting for you! Be sure that instruction that are
//! being emitted are correct and encodable, otherwise the Assembler will //! being emitted are correct and encodable, otherwise the Assembler will
//! fail and set the status code to `kErrorUnknownInst`. //! fail and set the status code to `kErrorUnknownInst`.
struct ASMJIT_VIRTAPI X86Compiler : public Compiler { class ASMJIT_VIRTAPI X86Compiler : public Compiler {
public:
ASMJIT_NO_COPY(X86Compiler) ASMJIT_NO_COPY(X86Compiler)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) && (defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64)) #if !defined(ASMJIT_DISABLE_COMPILER) && (defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64))
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/containers.h" #include "../base/containers.h"
#include "../base/cpuinfo.h" #include "../base/cpuinfo.h"
#include "../base/utils.h" #include "../base/utils.h"

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/compiler.h" #include "../base/compiler.h"
#include "../base/compilercontext_p.h" #include "../base/compilercontext_p.h"
#include "../base/utils.h" #include "../base/utils.h"

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) && (defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64)) #if !defined(ASMJIT_DISABLE_COMPILER) && (defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64))
// [Dependencies - AsmJit] // [Dependencies]
#include "../x86/x86compiler.h" #include "../x86/x86compiler.h"
#include "../x86/x86compilerfunc.h" #include "../x86/x86compilerfunc.h"

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/compilerfunc.h" #include "../base/compilerfunc.h"
#include "../x86/x86operand.h" #include "../x86/x86operand.h"

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_X86_X86INST_H #ifndef _ASMJIT_X86_X86INST_H
#define _ASMJIT_X86_X86INST_H #define _ASMJIT_X86_X86INST_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/assembler.h" #include "../base/assembler.h"
#include "../base/globals.h" #include "../base/globals.h"
#include "../base/operand.h" #include "../base/operand.h"
@@ -1163,54 +1163,22 @@ ASMJIT_ENUM(X86InstId) {
//! X86/X64 instruction emit options, mainly for internal purposes. //! X86/X64 instruction emit options, mainly for internal purposes.
ASMJIT_ENUM(X86InstOptions) { ASMJIT_ENUM(X86InstOptions) {
//! Force REX prefix (X64). kX86InstOptionRex = 0x00000040, //!< Force REX prefix (X64)
//! _kX86InstOptionNoRex = 0x00000080, //!< Do not use, internal of `X86Assembler`.
//! This option should be used carefully as there are combinations of kX86InstOptionLock = 0x00000100, //!< Force LOCK prefix (lock-enabled instructions).
//! instructions and their operands that are not encodable. The REX prefix kX86InstOptionVex3 = 0x00000200, //!< Force 3-byte VEX prefix (AVX)
//! can't be used together with AH, BH, CH, and DH registers. AsmJit reports kX86InstOptionEvex = 0x00010000, //!< Force 4-byte EVEX prefix (AVX-512).
//! \ref kErrorIllegalInstruction in such case. kX86InstOptionEvexZero = 0x00020000, //!< EVEX use zeroing instead of merging.
kX86InstOptionRex = 0x00000040, kX86InstOptionEvexOneN = 0x00040000, //!< EVEX broadcast the first element to all.
kX86InstOptionEvexSae = 0x00080000, //!< EVEX suppress all exceptions (SAE).
//! \internal kX86InstOptionEvexRnSae = 0x00100000, //!< EVEX 'round-to-nearest' (even) and `SAE`.
//! kX86InstOptionEvexRdSae = 0x00200000, //!< EVEX 'round-down' (toward -inf) and 'SAE'.
//! Reserved by `X86Assembler`, do not use! kX86InstOptionEvexRuSae = 0x00400000, //!< EVEX 'round-up' (toward +inf) and 'SAE'.
_kX86InstOptionNoRex = 0x00000080, kX86InstOptionEvexRzSae = 0x00800000 //!< EVEX 'round-toward-zero' (truncate) and 'SAE'.
//! Emit instruction with LOCK prefix.
//!
//! If this option is used and instruction doesn't support LOCK prefix an
//! invalid instruction error is generated.
kX86InstOptionLock = 0x00000100,
//! Force 3-byte VEX prefix even if the instruction is encodable by 2-byte
//! VEX prefix (AVX).
//!
//! Ignored if the instruction is not AVX or `kX86InstOptionEVEX` is used.
kX86InstOptionVex3 = 0x00000200,
//! Force 4-byte EVEX prefix even if the instruction is encodable by using
//! VEX prefix. Please note that all higher bits from `kX86InstOptionEvex`
//! are reserved for EVEX and forces EVEX encoding to be used implicitly.
kX86InstOptionEvex = 0x00010000,
//! Use zeroing instead of merging (AVX512+).
kX86InstOptionEvexZero = 0x00020000,
//! Broadcast one element to all other elements (AVX512+).
kX86InstOptionEvexOneN = 0x00040000,
//! Suppress all exceptions (AVX512+).
kX86InstOptionEvexSae = 0x00080000,
//! Static rounding mode `round-to-nearest` (even) and `SAE` (AVX512+).
kX86InstOptionEvexRnSae = 0x00100000,
//! Static rounding mode `round-down` (toward -inf) and `SAE` (AVX512+).
kX86InstOptionEvexRdSae = 0x00200000,
//! Static rounding mode `round-up` (toward +inf) and `SAE` (AVX512+).
kX86InstOptionEvexRuSae = 0x00400000,
//! Static rounding mode `round-toward-zero` (truncate) and `SAE` (AVX512+).
kX86InstOptionEvexRzSae = 0x00800000
}; };
// ============================================================================ // ============================================================================
// [asmjit::X86InstEncodingId] // [asmjit::X86InstEncoding]
// ============================================================================ // ============================================================================
//! \internal //! \internal
@@ -1218,238 +1186,125 @@ ASMJIT_ENUM(X86InstOptions) {
//! X86/X64 instruction groups. //! X86/X64 instruction groups.
//! //!
//! This group is specific to AsmJit and only used by `X86Assembler`. //! This group is specific to AsmJit and only used by `X86Assembler`.
ASMJIT_ENUM(X86InstEncodingId) { ASMJIT_ENUM(X86InstEncoding) {
//! Never used. kX86InstEncodingNone = 0, //!< Never used.
kX86InstEncodingIdNone = 0,
kX86InstEncodingIdX86Op, kX86InstEncodingX86Op,
kX86InstEncodingIdX86Op_66H, kX86InstEncodingX86Op_66H,
kX86InstEncodingIdX86Rm, kX86InstEncodingX86Rm,
kX86InstEncodingIdX86Rm_B, kX86InstEncodingX86Rm_B,
kX86InstEncodingIdX86RmReg, kX86InstEncodingX86RmReg,
kX86InstEncodingIdX86RegRm, kX86InstEncodingX86RegRm,
kX86InstEncodingIdX86M, kX86InstEncodingX86M,
//! Adc/Add/And/Cmp/Or/Sbb/Sub/Xor. kX86InstEncodingX86Arith, //!< X86 encoding - adc, add, and, cmp, or, sbb, sub, xor.
kX86InstEncodingIdX86Arith, kX86InstEncodingX86BSwap, //!< X86 encoding - bswap.
//! Bswap. kX86InstEncodingX86BTest, //!< X86 encoding - bt, btc, btr, bts.
kX86InstEncodingIdX86BSwap, kX86InstEncodingX86Call, //!< X86 encoding - call.
//! Bt/Btc/Btr/Bts. kX86InstEncodingX86Enter, //!< X86 encoding - enter.
kX86InstEncodingIdX86BTest, kX86InstEncodingX86Imul, //!< X86 encoding - imul.
//! Call. kX86InstEncodingX86IncDec, //!< X86 encoding - inc, dec.
kX86InstEncodingIdX86Call, kX86InstEncodingX86Int, //!< X86 encoding - int (interrupt).
//! Enter. kX86InstEncodingX86Jcc, //!< X86 encoding - jcc.
kX86InstEncodingIdX86Enter, kX86InstEncodingX86Jecxz, //!< X86 encoding - jcxz, jecxz, jrcxz.
//! Imul. kX86InstEncodingX86Jmp, //!< X86 encoding - jmp.
kX86InstEncodingIdX86Imul, kX86InstEncodingX86Lea, //!< X86 encoding - lea.
//! Inc/Dec. kX86InstEncodingX86Mov, //!< X86 encoding - mov.
kX86InstEncodingIdX86IncDec, kX86InstEncodingX86MovSxZx, //!< X86 encoding - movsx, movzx.
//! Int. kX86InstEncodingX86MovSxd, //!< X86 encoding - movsxd.
kX86InstEncodingIdX86Int, kX86InstEncodingX86MovPtr, //!< X86 encoding - mov with absolute memory operand (x86/x64).
//! Jcc. kX86InstEncodingX86Push, //!< X86 encoding - push.
kX86InstEncodingIdX86Jcc, kX86InstEncodingX86Pop, //!< X86 encoding - pop.
//! Jcxz/Jecxz/Jrcxz. kX86InstEncodingX86Rep, //!< X86 encoding - rep|repe|repne lods?, movs?, stos?, cmps?, scas?.
kX86InstEncodingIdX86Jecxz, kX86InstEncodingX86Ret, //!< X86 encoding - ret.
//! Jmp. kX86InstEncodingX86Rot, //!< X86 encoding - rcl, rcr, rol, ror, sal, sar, shl, shr.
kX86InstEncodingIdX86Jmp, kX86InstEncodingX86Set, //!< X86 encoding - setcc.
//! Lea. kX86InstEncodingX86Shlrd, //!< X86 encoding - shld, shrd.
kX86InstEncodingIdX86Lea, kX86InstEncodingX86Test, //!< X86 encoding - test.
//! Mov. kX86InstEncodingX86Xadd, //!< X86 encoding - xadd.
kX86InstEncodingIdX86Mov, kX86InstEncodingX86Xchg, //!< X86 encoding - xchg.
//! Movsx/Movzx. kX86InstEncodingX86Crc, //!< X86 encoding - crc32.
kX86InstEncodingIdX86MovSxZx, kX86InstEncodingX86Prefetch, //!< X86 encoding - prefetch.
//! Movsxd. kX86InstEncodingX86Fence, //!< X86 encoding - lfence, mfence, sfence.
kX86InstEncodingIdX86MovSxd, kX86InstEncodingFpuOp, //!< FPU encoding - [OP].
//! Mov having absolute memory operand (x86/x64). kX86InstEncodingFpuArith, //!< FPU encoding - fadd, fdiv, fdivr, fmul, fsub, fsubr.
kX86InstEncodingIdX86MovPtr, kX86InstEncodingFpuCom, //!< FPU encoding - fcom, fcomp.
//! Push. kX86InstEncodingFpuFldFst, //!< FPU encoding - fld, fst, fstp.
kX86InstEncodingIdX86Push, kX86InstEncodingFpuM, //!< FPU encoding - fiadd, ficom, ficomp, fidiv, fidivr, fild, fimul, fist, fistp, fisttp, fisub, fisubr.
//! Pop. kX86InstEncodingFpuR, //!< FPU encoding - fcmov, fcomi, fcomip, ffree, fucom, fucomi, fucomip, fucomp, fxch.
kX86InstEncodingIdX86Pop, kX86InstEncodingFpuRDef, //!< FPU encoding - faddp, fdivp, fdivrp, fmulp, fsubp, fsubrp.
//! Rep/Repe/Repne LodsX/MovsX/StosX/CmpsX/ScasX. kX86InstEncodingFpuStsw, //!< FPU encoding - fnstsw, Fstsw.
kX86InstEncodingIdX86Rep, kX86InstEncodingSimdRm, //!< SIMD encoding - [RM].
//! Ret. kX86InstEncodingSimdRm_P, //!< SIMD encoding - [RM] (propagates 66H if the instruction uses Xmm register).
kX86InstEncodingIdX86Ret, kX86InstEncodingSimdRm_Q, //!< SIMD encoding - [RM] (propagates REX.W if GPQ is used).
//! Rcl/Rcr/Rol/Ror/Sal/Sar/Shl/Shr. kX86InstEncodingSimdRm_PQ, //!< SIMD encoding - [RM] (propagates 66H and REX.W).
kX86InstEncodingIdX86Rot, kX86InstEncodingSimdRmRi, //!< SIMD encoding - [RM|RI].
//! Setcc. kX86InstEncodingSimdRmRi_P, //!< SIMD encoding - [RM|RI] (propagates 66H if the instruction uses Xmm register).
kX86InstEncodingIdX86Set, kX86InstEncodingSimdRmi, //!< SIMD encoding - [RMI].
//! Shld/Rhrd. kX86InstEncodingSimdRmi_P, //!< SIMD encoding - [RMI] (propagates 66H if the instruction uses Xmm register).
kX86InstEncodingIdX86Shlrd, kX86InstEncodingSimdPextrw, //!< SIMD encoding - pextrw.
//! Test. kX86InstEncodingSimdExtract, //!< SIMD encoding - pextrb, pextrd, pextrq, extractps.
kX86InstEncodingIdX86Test, kX86InstEncodingSimdMov, //!< SIMD encoding - mov - primary opcode means `(X)Mm <- (X)Mm/X86Mem`, secondary `(X)Mm/X86Mem <- (X)Mm format`.
//! Xadd. kX86InstEncodingSimdMovNoRexW, //!< SIMD encoding - movmskpd, movmskps.
kX86InstEncodingIdX86Xadd, kX86InstEncodingSimdMovBe, //!< Used by movbe.
//! Xchg. kX86InstEncodingSimdMovD, //!< SIMD encoding - movd.
kX86InstEncodingIdX86Xchg, kX86InstEncodingSimdMovQ, //!< SIMD encoding - movq.
kX86InstEncodingSimdExtrq, //!< SIMD encoding - extrq (SSE4a).
kX86InstEncodingSimdInsertq, //!< SIMD encoding - insrq (SSE4a).
kX86InstEncodingSimd3dNow, //!< SIMD encoding - 3dnow instructions.
kX86InstEncodingAvxOp, //!< AVX encoding - [OP].
kX86InstEncodingAvxM, //!< AVX encoding - [M].
kX86InstEncodingAvxMr, //!< AVX encoding - [MR].
kX86InstEncodingAvxMr_OptL, //!< AVX encoding - [MR] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxMri, //!< AVX encoding - [MRI].
kX86InstEncodingAvxMri_OptL, //!< AVX encoding - [MRI] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxRm, //!< AVX encoding - [RM].
kX86InstEncodingAvxRm_OptL, //!< AVX encoding - [RM] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxRmi, //!< AVX encoding - [RMI].
kX86InstEncodingAvxRmi_OptW, //!< AVX encoding - [RMI] (Propagates AVX.W if Gpq used).
kX86InstEncodingAvxRmi_OptL, //!< AVX encoding - [RMI] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxRvm, //!< AVX encoding - [RVM].
kX86InstEncodingAvxRvm_OptW, //!< AVX encoding - [RVM] (Propagates AVX.W if Gpq used).
kX86InstEncodingAvxRvm_OptL, //!< AVX encoding - [RVM] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxRvmr, //!< AVX encoding - [RVMR].
kX86InstEncodingAvxRvmr_OptL, //!< AVX encoding - [RVMR] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxRvmi, //!< AVX encoding - [RVMI].
kX86InstEncodingAvxRvmi_OptL, //!< AVX encoding - [RVMI] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxRmv, //!< AVX encoding - [RMV].
kX86InstEncodingAvxRmv_OptW, //!< AVX encoding - [RMV] (Propagates AVX.W if Gpq used).
kX86InstEncodingAvxRmvi, //!< AVX encoding - [RMVI].
kX86InstEncodingAvxRmMr, //!< AVX encoding - [RM|MR].
kX86InstEncodingAvxRmMr_OptL, //!< AVX encoding - [RM|MR] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxRvmRmi, //!< AVX encoding - [RVM|RMI].
kX86InstEncodingAvxRvmRmi_OptL, //!< AVX encoding - [RVM|RMI] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxRvmMr, //!< AVX encoding - [RVM|MR].
kX86InstEncodingAvxRvmMvr, //!< AVX encoding - [RVM|MVR].
kX86InstEncodingAvxRvmMvr_OptL, //!< AVX encoding - [RVM|MVR] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxRvmVmi, //!< AVX encoding - [RVM|VMI].
kX86InstEncodingAvxRvmVmi_OptL, //!< AVX encoding - [RVM|VMI] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxVm, //!< AVX encoding - [VM].
kX86InstEncodingAvxVm_OptW, //!< AVX encoding - [VM] (Propagates AVX.W if Gpq used).
kX86InstEncodingAvxVmi, //!< AVX encoding - [VMI].
kX86InstEncodingAvxVmi_OptL, //!< AVX encoding - [VMI] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxRvrmRvmr, //!< AVX encoding - [RVRM|RVMR].
kX86InstEncodingAvxRvrmRvmr_OptL, //!< AVX encoding - [RVRM|RVMR] (Propagates AVX.L if Ymm used).
kX86InstEncodingAvxMovDQ, //!< AVX encoding - vmovd, vmovq.
kX86InstEncodingAvxMovSsSd, //!< AVX encoding - vmovss, vmovsd.
kX86InstEncodingAvxGather, //!< AVX encoding - gather (VSIB).
kX86InstEncodingAvxGatherEx, //!< AVX encoding - gather (VSIB), differs only in mem operand.
kX86InstEncodingFma4, //!< FMA4 encoding - [R, R, R/M, R/M].
kX86InstEncodingFma4_OptL, //!< FMA4 encoding - [R, R, R/M, R/M] (Propagates AVX.L if Ymm used).
kX86InstEncodingXopRm, //!< XOP encoding - [RM].
kX86InstEncodingXopRm_OptL, //!< XOP encoding - [RM] (Propagates AVX.L if Ymm used).
kX86InstEncodingXopRvmRmv, //!< XOP encoding - [RVM | RMV].
kX86InstEncodingXopRvmRmi, //!< XOP encoding - [RVM | RMI].
kX86InstEncodingXopRvmr, //!< XOP encoding - [RVMR].
kX86InstEncodingXopRvmr_OptL, //!< XOP encoding - [RVMR] (Propagates AVX.L if Ymm used).
kX86InstEncodingXopRvmi, //!< XOP encoding - [RVMI].
kX86InstEncodingXopRvmi_OptL, //!< XOP encoding - [RVMI] (Propagates AVX.L if Ymm used).
kX86InstEncodingXopRvrmRvmr, //!< XOP encoding - [RVRM | RVMR].
kX86InstEncodingXopRvrmRvmr_OptL, //!< XOP encoding - [RVRM | RVMR] (Propagates AVX.L if Ymm used).
//! Fincstp/Finit/FldX/Fnclex/Fninit/Fnop/Fpatan/Fprem/Fprem1/Fptan/Frndint/Fscale/Fsin/Fsincos/Fsqrt/Ftst/Fucompp/Fxam/Fxtract/Fyl2x/Fyl2xp1. _kX86InstEncodingCount //!< Count of X86 instruction encodings.
kX86InstEncodingIdFpuOp,
//! Fadd/Fdiv/Fdivr/Fmul/Fsub/Fsubr.
kX86InstEncodingIdFpuArith,
//! Fcom/Fcomp.
kX86InstEncodingIdFpuCom,
//! Fld/Fst/Fstp.
kX86InstEncodingIdFpuFldFst,
//! Fiadd/Ficom/Ficomp/Fidiv/Fidivr/Fild/Fimul/Fist/Fistp/Fisttp/Fisub/Fisubr.
kX86InstEncodingIdFpuM,
//! Fcmov/Fcomi/Fcomip/Ffree/Fucom/Fucomi/Fucomip/Fucomp/Fxch.
kX86InstEncodingIdFpuR,
//! Faddp/Fdivp/Fdivrp/Fmulp/Fsubp/Fsubrp.
kX86InstEncodingIdFpuRDef,
//! Fnstsw/Fstsw.
kX86InstEncodingIdFpuStsw,
//! Mm/Xmm instruction.
kX86InstEncodingIdExtRm,
//! Mm/Xmm instruction (propagates 66H if the instruction uses Xmm register).
kX86InstEncodingIdExtRm_P,
//! Mm/Xmm instruction (propagates REX.W if GPQ is used).
kX86InstEncodingIdExtRm_Q,
//! Mm/Xmm instruction (propagates 66H and REX.W).
kX86InstEncodingIdExtRm_PQ,
//! Mm/Xmm instruction having Rm/Ri encodings.
kX86InstEncodingIdExtRmRi,
//! Mm/Xmm instruction having Rm/Ri encodings (propagates 66H if the instruction uses Xmm register).
kX86InstEncodingIdExtRmRi_P,
//! Mm/Xmm instruction having Rmi encoding.
kX86InstEncodingIdExtRmi,
//! Mm/Xmm instruction having Rmi encoding (propagates 66H if the instruction uses Xmm register).
kX86InstEncodingIdExtRmi_P,
//! Crc32.
kX86InstEncodingIdExtCrc,
//! Pextrw.
kX86InstEncodingIdExtExtrW,
//! Pextrb/Pextrd/Pextrq/Extractps.
kX86InstEncodingIdExtExtract,
//! Lfence/Mfence/Sfence.
kX86InstEncodingIdExtFence,
//! Mov Mm/Xmm.
//!
//! 0x66 prefix must be set manually in opcodes.
//!
//! - Primary opcode is used for instructions in (X)Mm <- (X)Mm/X86Mem format,
//! - Secondary opcode is used for instructions in (X)Mm/X86Mem <- (X)Mm format.
kX86InstEncodingIdExtMov,
//! Mov Mm/Xmm.
kX86InstEncodingIdExtMovNoRexW,
//! Movbe.
kX86InstEncodingIdExtMovBe,
//! Movd.
kX86InstEncodingIdExtMovD,
//! Movq.
kX86InstEncodingIdExtMovQ,
//! Prefetch.
kX86InstEncodingIdExtPrefetch,
//! Extrq (SSE4a).
kX86InstEncodingIdExtExtrq,
//! Insrq (SSE4a).
kX86InstEncodingIdExtInsertq,
//! 3dNow instruction.
kX86InstEncodingId3dNow,
//! AVX instruction without operands.
kX86InstEncodingIdAvxOp,
//! AVX instruction encoded as 'M'.
kX86InstEncodingIdAvxM,
//! AVX instruction encoded as 'MR'.
kX86InstEncodingIdAvxMr,
//! AVX instruction encoded as 'MR' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxMr_P,
//! AVX instruction encoded as 'MRI'.
kX86InstEncodingIdAvxMri,
//! AVX instruction encoded as 'MRI' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxMri_P,
//! AVX instruction encoded as 'RM'.
kX86InstEncodingIdAvxRm,
//! AVX instruction encoded as 'RM' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxRm_P,
//! AVX instruction encoded as 'RMI'.
kX86InstEncodingIdAvxRmi,
//! AVX instruction encoded as 'RMI' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxRmi_P,
//! AVX instruction encoded as 'RVM'.
kX86InstEncodingIdAvxRvm,
//! AVX instruction encoded as 'RVM' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxRvm_P,
//! AVX instruction encoded as 'RVMR'.
kX86InstEncodingIdAvxRvmr,
//! AVX instruction encoded as 'RVMR' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxRvmr_P,
//! AVX instruction encoded as 'RVMI'.
kX86InstEncodingIdAvxRvmi,
//! AVX instruction encoded as 'RVMI' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxRvmi_P,
//! AVX instruction encoded as 'RMV'.
kX86InstEncodingIdAvxRmv,
//! AVX instruction encoded as 'RMVI'.
kX86InstEncodingIdAvxRmvi,
//! AVX instruction encoded as 'RM' or 'MR'.
kX86InstEncodingIdAvxRmMr,
//! AVX instruction encoded as 'RM' or 'MR' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxRmMr_P,
//! AVX instruction encoded as 'RVM' or 'RMI'.
kX86InstEncodingIdAvxRvmRmi,
//! AVX instruction encoded as 'RVM' or 'RMI' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxRvmRmi_P,
//! AVX instruction encoded as 'RVM' or 'MR'.
kX86InstEncodingIdAvxRvmMr,
//! AVX instruction encoded as 'RVM' or 'MVR'.
kX86InstEncodingIdAvxRvmMvr,
//! AVX instruction encoded as 'RVM' or 'MVR' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxRvmMvr_P,
//! AVX instruction encoded as 'RVM' or 'VMI'.
kX86InstEncodingIdAvxRvmVmi,
//! AVX instruction encoded as 'RVM' or 'VMI' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxRvmVmi_P,
//! AVX instruction encoded as 'VM'.
kX86InstEncodingIdAvxVm,
//! AVX instruction encoded as 'VMI'.
kX86InstEncodingIdAvxVmi,
//! AVX instruction encoded as 'VMI' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxVmi_P,
//! AVX instruction encoded as 'RVRM' or 'RVMR'.
kX86InstEncodingIdAvxRvrmRvmr,
//! AVX instruction encoded as 'RVRM' or 'RVMR' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdAvxRvrmRvmr_P,
//! Vmovd/Vmovq.
kX86InstEncodingIdAvxMovDQ,
//! Vmovss/Vmovsd.
kX86InstEncodingIdAvxMovSsSd,
//! AVX2 gather family instructions (VSIB).
kX86InstEncodingIdAvxGather,
//! AVX2 gather family instructions (VSIB), differs only in mem operand.
kX86InstEncodingIdAvxGatherEx,
//! FMA4 instruction in form [R, R, R/M, R/M].
kX86InstEncodingIdFma4,
//! FMA4 instruction in form [R, R, R/M, R/M] (Propagates AVX.L if Ymm used).
kX86InstEncodingIdFma4_P,
//! XOP instruction encoded as 'RM'.
kX86InstEncodingIdXopRm,
//! XOP instruction encoded as 'RM' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdXopRm_P,
//! XOP instruction encoded as 'RVM' or 'RMV'.
kX86InstEncodingIdXopRvmRmv,
//! XOP instruction encoded as 'RVM' or 'RMI'.
kX86InstEncodingIdXopRvmRmi,
//! XOP instruction encoded as 'RVMR'.
kX86InstEncodingIdXopRvmr,
//! XOP instruction encoded as 'RVMR' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdXopRvmr_P,
//! XOP instruction encoded as 'RVMI'.
kX86InstEncodingIdXopRvmi,
//! XOP instruction encoded as 'RVMI' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdXopRvmi_P,
//! XOP instruction encoded as 'RVRM' or 'RVMR'.
kX86InstEncodingIdXopRvrmRvmr,
//! XOP instruction encoded as 'RVRM' or 'RVMR' (Propagates AVX.L if Ymm used).
kX86InstEncodingIdXopRvrmRvmr_P,
//! Count of X86 instruction groups.
_kX86InstEncodingIdCount
}; };
// ============================================================================ // ============================================================================
@@ -1579,8 +1434,7 @@ ASMJIT_ENUM(X86InstOpCodeFlags) {
//! //!
//! X86/X64 instruction flags. //! X86/X64 instruction flags.
ASMJIT_ENUM(X86InstFlags) { ASMJIT_ENUM(X86InstFlags) {
//! No flags. kX86InstFlagNone = 0x00000000, //! No flags.
kX86InstFlagNone = 0x00000000,
//! Instruction is a control-flow instruction. //! Instruction is a control-flow instruction.
//! //!
@@ -1636,7 +1490,7 @@ ASMJIT_ENUM(X86InstFlags) {
//! Instruction memory operand can refer to 80-bit address (used by FPU). //! Instruction memory operand can refer to 80-bit address (used by FPU).
kX86InstFlagMem10 = 0x00000800, kX86InstFlagMem10 = 0x00000800,
//! Zeroes the rest of the register if the source operand is memory. //! Cleans the rest of the register if the source operand is memory.
//! //!
//! Special behavior related to some SIMD load instructions. //! Special behavior related to some SIMD load instructions.
kX86InstFlagZ = 0x00001000, kX86InstFlagZ = 0x00001000,
@@ -1681,36 +1535,22 @@ ASMJIT_ENUM(X86InstFlags) {
//! //!
//! X86/X64 instruction operand flags. //! X86/X64 instruction operand flags.
ASMJIT_ENUM(X86InstOp) { ASMJIT_ENUM(X86InstOp) {
//! Instruction operand can be 8-bit Gpb register. kX86InstOpGb = 0x0001, //!< Operand can be 8-bit Gpb register.
kX86InstOpGb = 0x0001, kX86InstOpGw = 0x0002, //!< Operand can be 16-bit Gpw register.
//! Instruction operand can be 16-bit Gpw register. kX86InstOpGd = 0x0004, //!< Operand operand can be 32-bit Gpd register.
kX86InstOpGw = 0x0002, kX86InstOpGq = 0x0008, //!< Operand can be 64-bit Gpq register.
//! Instruction operand can be 32-bit Gpd register. kX86InstOpFp = 0x0010, //!< Operand can be Fp register.
kX86InstOpGd = 0x0004, kX86InstOpMm = 0x0020, //!< Operand can be 64-bit Mm register.
//! Instruction operand can be 64-bit Gpq register. kX86InstOpK = 0x0040, //!< Operand can be 64-bit K register.
kX86InstOpGq = 0x0008,
//! Instruction operand can be Fp register. kX86InstOpXmm = 0x0100, //!< Operand can be 128-bit Xmm register.
kX86InstOpFp = 0x0010, kX86InstOpYmm = 0x0200, //!< Operand can be 256-bit Ymm register.
//! Instruction operand can be 64-bit Mm register. kX86InstOpZmm = 0x0400, //!< Operand can be 512-bit Zmm register.
kX86InstOpMm = 0x0020,
//! Instruction operand can be 64-bit K register. kX86InstOpMem = 0x1000, //!< Operand can be memory.
kX86InstOpK = 0x0040, kX86InstOpImm = 0x2000, //!< Operand can be immediate.
kX86InstOpLabel = 0x4000, //!< Operand can be label.
//! Instruction operand can be 128-bit Xmm register.
kX86InstOpXmm = 0x0100,
//! Instruction operand can be 256-bit Ymm register.
kX86InstOpYmm = 0x0200,
//! Instruction operand can be 512-bit Zmm register.
kX86InstOpZmm = 0x0400,
//! Instruction operand can be memory.
kX86InstOpMem = 0x1000,
//! Instruction operand can be immediate.
kX86InstOpImm = 0x2000,
//! Instruction operand can be label.
kX86InstOpLabel = 0x4000,
//! Instruction operand doesn't have to be used. //! Instruction operand doesn't have to be used.
//! //!
//! \note If no operand is specified the meaning is clear (the operand at the //! \note If no operand is specified the meaning is clear (the operand at the
@@ -1759,21 +1599,21 @@ ASMJIT_ENUM(X86Cond) {
kX86CondZ = 0x04, // ZF==1 kX86CondZ = 0x04, // ZF==1
// Simplified condition codes. // Simplified condition codes.
kX86CondSign = kX86CondS , //!< Sign (S). kX86CondSign = kX86CondS, //!< Sign (S).
kX86CondNotSign = kX86CondNS, //!< Not Sign (NS). kX86CondNotSign = kX86CondNS, //!< Not Sign (NS).
kX86CondOverflow = kX86CondO , //!< Signed Overflow (O) kX86CondOverflow = kX86CondO, //!< Signed Overflow (O)
kX86CondNotOverflow = kX86CondNO, //!< Not Signed Overflow (NO) kX86CondNotOverflow = kX86CondNO, //!< Not Signed Overflow (NO)
kX86CondLess = kX86CondL , //!< Signed `a < b` (L or NGE). kX86CondLess = kX86CondL, //!< Signed `a < b` (L or NGE).
kX86CondLessEqual = kX86CondLE, //!< Signed `a <= b` (LE or NG ). kX86CondLessEqual = kX86CondLE, //!< Signed `a <= b` (LE or NG ).
kX86CondGreater = kX86CondG , //!< Signed `a > b` (G or NLE). kX86CondGreater = kX86CondG, //!< Signed `a > b` (G or NLE).
kX86CondGreaterEqual = kX86CondGE, //!< Signed `a >= b` (GE or NL ). kX86CondGreaterEqual = kX86CondGE, //!< Signed `a >= b` (GE or NL ).
kX86CondBelow = kX86CondB , //!< Unsigned `a < b` (B or NAE). kX86CondBelow = kX86CondB, //!< Unsigned `a < b` (B or NAE).
kX86CondBelowEqual = kX86CondBE, //!< Unsigned `a <= b` (BE or NA ). kX86CondBelowEqual = kX86CondBE, //!< Unsigned `a <= b` (BE or NA ).
kX86CondAbove = kX86CondA , //!< Unsigned `a > b` (A or NBE). kX86CondAbove = kX86CondA, //!< Unsigned `a > b` (A or NBE).
kX86CondAboveEqual = kX86CondAE, //!< Unsigned `a >= b` (AE or NB ). kX86CondAboveEqual = kX86CondAE, //!< Unsigned `a >= b` (AE or NB ).
kX86CondEqual = kX86CondE , //!< Equal `a == b` (E or Z ). kX86CondEqual = kX86CondE, //!< Equal `a == b` (E or Z ).
kX86CondNotEqual = kX86CondNE, //!< Not Equal `a != b` (NE or NZ ). kX86CondNotEqual = kX86CondNE, //!< Not Equal `a != b` (NE or NZ ).
kX86CondParityEven = kX86CondP, kX86CondParityEven = kX86CondP,
@@ -1814,52 +1654,14 @@ ASMJIT_ENUM(X86EFlags) {
// changed as you plan to modify `X86EFlags`. // changed as you plan to modify `X86EFlags`.
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Overflow flag (OF). kX86EFlagO = 0x01, //!< Overflow flag (OF).
//! kX86EFlagS = 0x02, //!< Sign flag (SF).
//! Set if the integer result is too large a positive number or too small a kX86EFlagZ = 0x04, //!< Zero flag (ZF).
//! negative number (excluding the sign-bit) to fit in the destination kX86EFlagA = 0x08, //!< Adjust flag (AF).
//! operand; cleared otherwise. This flag indicates an overflow condition for kX86EFlagP = 0x10, //!< Parity flag (PF).
//! signed-integer arithmetic. kX86EFlagC = 0x20, //!< Carry flag (CF).
kX86EFlagO = 0x01, kX86EFlagD = 0x40, //!< Direction flag (DF).
kX86EFlagX = 0x80 //!< Any other flag that AsmJit doesn't use.
//! Sign flag (SF).
//!
//! Set equal to the most-significant bit of the result, which is the sign
//! bit of a signed integer (0 == positive value, 1 == negative value).
kX86EFlagS = 0x02,
//! Zero flag (ZF).
//!
//! Set if the result is zero; cleared otherwise.
kX86EFlagZ = 0x04,
//! Adjust flag (AF).
//!
//! Set if an arithmetic operation generates a carry or a borrow out of bit
//! 3 of the result; cleared otherwise. This flag is used in binary-coded
//! decimal (BCD) arithmetic.
kX86EFlagA = 0x08,
//! Parity flag (PF).
//!
//! Set if the least-significant byte of the result contains an even number
//! of 1 bits; cleared otherwise.
kX86EFlagP = 0x10,
//! Carry flag (CF).
//!
//! Set if an arithmetic operation generates a carry or a borrow out of the
//! mostsignificant bit of the result; cleared otherwise.
kX86EFlagC = 0x20,
//! Direction flag (DF).
//!
//! The direction flag controls string instructions `movs`, `cmps`, `scas,
//! `lods` and `stos`.
kX86EFlagD = 0x40,
//! Any other flag that AsmJit doesn't use to keep track of.
kX86EFlagX = 0x80
}; };
// ============================================================================ // ============================================================================
@@ -1890,7 +1692,8 @@ ASMJIT_ENUM(X86FpSw) {
//! X86/X64 FPU control word. //! X86/X64 FPU control word.
ASMJIT_ENUM(X86FpCw) { ASMJIT_ENUM(X86FpCw) {
kX86FpCw_EM_Mask = 0x003F, // Bits 0-5. // Bits 0-5.
kX86FpCw_EM_Mask = 0x003F,
kX86FpCw_EM_Invalid = 0x0001, kX86FpCw_EM_Invalid = 0x0001,
kX86FpCw_EM_Denormal = 0x0002, kX86FpCw_EM_Denormal = 0x0002,
kX86FpCw_EM_DivByZero = 0x0004, kX86FpCw_EM_DivByZero = 0x0004,
@@ -1898,19 +1701,22 @@ ASMJIT_ENUM(X86FpCw) {
kX86FpCw_EM_Underflow = 0x0010, kX86FpCw_EM_Underflow = 0x0010,
kX86FpCw_EM_Inexact = 0x0020, kX86FpCw_EM_Inexact = 0x0020,
kX86FpCw_PC_Mask = 0x0300, // Bits 8-9. // Bits 8-9.
kX86FpCw_PC_Mask = 0x0300,
kX86FpCw_PC_Float = 0x0000, kX86FpCw_PC_Float = 0x0000,
kX86FpCw_PC_Reserved = 0x0100, kX86FpCw_PC_Reserved = 0x0100,
kX86FpCw_PC_Double = 0x0200, kX86FpCw_PC_Double = 0x0200,
kX86FpCw_PC_Extended = 0x0300, kX86FpCw_PC_Extended = 0x0300,
kX86FpCw_RC_Mask = 0x0C00, // Bits 10-11. // Bits 10-11.
kX86FpCw_RC_Mask = 0x0C00,
kX86FpCw_RC_Nearest = 0x0000, kX86FpCw_RC_Nearest = 0x0000,
kX86FpCw_RC_Down = 0x0400, kX86FpCw_RC_Down = 0x0400,
kX86FpCw_RC_Up = 0x0800, kX86FpCw_RC_Up = 0x0800,
kX86FpCw_RC_Truncate = 0x0C00, kX86FpCw_RC_Truncate = 0x0C00,
kX86FpCw_IC_Mask = 0x1000, // Bit 12. // Bit 12.
kX86FpCw_IC_Mask = 0x1000,
kX86FpCw_IC_Projective = 0x0000, kX86FpCw_IC_Projective = 0x0000,
kX86FpCw_IC_Affine = 0x1000 kX86FpCw_IC_Affine = 0x1000
}; };
@@ -1994,7 +1800,7 @@ ASMJIT_ENUM(X86Round) {
//! X86/X64 Prefetch hints. //! X86/X64 Prefetch hints.
ASMJIT_ENUM(X86Prefetch) { ASMJIT_ENUM(X86Prefetch) {
kX86PrefetchNTA = 0, //!< Prefetch using NT hint. kX86PrefetchNTA = 0, //!< Prefetch by using NT hint.
kX86PrefetchT0 = 1, //!< Prefetch to L0 cache. kX86PrefetchT0 = 1, //!< Prefetch to L0 cache.
kX86PrefetchT1 = 2, //!< Prefetch to L1 cache. kX86PrefetchT1 = 2, //!< Prefetch to L1 cache.
kX86PrefetchT2 = 3 //!< Prefetch to L2 cache. kX86PrefetchT2 = 3 //!< Prefetch to L2 cache.
@@ -2016,8 +1822,8 @@ struct X86InstExtendedInfo {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Get instruction encoding, see \ref kX86InstEncoding. //! Get instruction encoding, see \ref kX86InstEncoding.
ASMJIT_INLINE uint32_t getEncodingId() const { ASMJIT_INLINE uint32_t getEncoding() const noexcept {
return _encodingId; return _encoding;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -2025,12 +1831,12 @@ struct X86InstExtendedInfo {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Get whether the instruction has a `flag`, see `X86InstFlags`. //! Get whether the instruction has a `flag`, see `X86InstFlags`.
ASMJIT_INLINE bool hasInstFlag(uint32_t flag) const { ASMJIT_INLINE bool hasInstFlag(uint32_t flag) const noexcept {
return (_instFlags & flag) != 0; return (_instFlags & flag) != 0;
} }
//! Get all instruction flags, see `X86InstFlags`. //! Get all instruction flags, see `X86InstFlags`.
ASMJIT_INLINE uint32_t getInstFlags() const { ASMJIT_INLINE uint32_t getInstFlags() const noexcept {
return _instFlags; return _instFlags;
} }
@@ -2038,12 +1844,12 @@ struct X86InstExtendedInfo {
//! //!
//! Control flow instruction is instruction that can perform a branch, //! Control flow instruction is instruction that can perform a branch,
//! typically `jmp`, `jcc`, `call`, or `ret`. //! typically `jmp`, `jcc`, `call`, or `ret`.
ASMJIT_INLINE bool isFlow() const { ASMJIT_INLINE bool isFlow() const noexcept {
return (getInstFlags() & kX86InstFlagFlow) != 0; return (getInstFlags() & kX86InstFlagFlow) != 0;
} }
//! Get whether the instruction is a compare/test like instruction. //! Get whether the instruction is a compare/test like instruction.
ASMJIT_INLINE bool isTest() const { ASMJIT_INLINE bool isTest() const noexcept {
return (getInstFlags() & kX86InstFlagTest) != 0; return (getInstFlags() & kX86InstFlagTest) != 0;
} }
@@ -2056,35 +1862,35 @@ struct X86InstExtendedInfo {
//! //!
//! All AVX/XOP instructions that have 3 or more operands are considered to //! All AVX/XOP instructions that have 3 or more operands are considered to
//! have move semantics move by default. //! have move semantics move by default.
ASMJIT_INLINE bool isMove() const { ASMJIT_INLINE bool isMove() const noexcept {
return (getInstFlags() & kX86InstFlagMove) != 0; return (getInstFlags() & kX86InstFlagMove) != 0;
} }
//! Get whether the instruction is a typical Exchange instruction. //! Get whether the instruction is a typical Exchange instruction.
//! //!
//! Exchange instructions are 'xchg' and 'xadd'. //! Exchange instructions are 'xchg' and 'xadd'.
ASMJIT_INLINE bool isXchg() const { ASMJIT_INLINE bool isXchg() const noexcept {
return (getInstFlags() & kX86InstFlagXchg) != 0; return (getInstFlags() & kX86InstFlagXchg) != 0;
} }
//! Get whether the instruction accesses Fp register(s). //! Get whether the instruction accesses Fp register(s).
ASMJIT_INLINE bool isFp() const { ASMJIT_INLINE bool isFp() const noexcept {
return (getInstFlags() & kX86InstFlagFp) != 0; return (getInstFlags() & kX86InstFlagFp) != 0;
} }
//! Get whether the instruction can be prefixed by LOCK prefix. //! Get whether the instruction can be prefixed by LOCK prefix.
ASMJIT_INLINE bool isLockable() const { ASMJIT_INLINE bool isLockable() const noexcept {
return (getInstFlags() & kX86InstFlagLock) != 0; return (getInstFlags() & kX86InstFlagLock) != 0;
} }
//! Get whether the instruction is special type (this is used by `Compiler` //! Get whether the instruction is special type (this is used by `Compiler`
//! to manage additional variables or functionality). //! to manage additional variables or functionality).
ASMJIT_INLINE bool isSpecial() const { ASMJIT_INLINE bool isSpecial() const noexcept {
return (getInstFlags() & kX86InstFlagSpecial) != 0; return (getInstFlags() & kX86InstFlagSpecial) != 0;
} }
//! Get whether the instruction is special type and it performs memory access. //! Get whether the instruction is special type and it performs memory access.
ASMJIT_INLINE bool isSpecialMem() const { ASMJIT_INLINE bool isSpecialMem() const noexcept {
return (getInstFlags() & kX86InstFlagSpecialMem) != 0; return (getInstFlags() & kX86InstFlagSpecialMem) != 0;
} }
@@ -2092,7 +1898,7 @@ struct X86InstExtendedInfo {
//! if the source is memory operand. //! if the source is memory operand.
//! //!
//! Basically flag needed only to support `movsd` and `movss` instructions. //! Basically flag needed only to support `movsd` and `movss` instructions.
ASMJIT_INLINE bool isZeroIfMem() const { ASMJIT_INLINE bool isZeroIfMem() const noexcept {
return (getInstFlags() & kX86InstFlagZ) != 0; return (getInstFlags() & kX86InstFlagZ) != 0;
} }
@@ -2101,12 +1907,12 @@ struct X86InstExtendedInfo {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Get EFLAGS that the instruction reads, see \ref X86EFlags. //! Get EFLAGS that the instruction reads, see \ref X86EFlags.
ASMJIT_INLINE uint32_t getEFlagsIn() const { ASMJIT_INLINE uint32_t getEFlagsIn() const noexcept {
return _eflagsIn; return _eflagsIn;
} }
//! Get EFLAGS that the instruction writes, see \ref X86EFlags. //! Get EFLAGS that the instruction writes, see \ref X86EFlags.
ASMJIT_INLINE uint32_t getEFlagsOut() const { ASMJIT_INLINE uint32_t getEFlagsOut() const noexcept {
return _eflagsOut; return _eflagsOut;
} }
@@ -2115,12 +1921,12 @@ struct X86InstExtendedInfo {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Get the destination index of WRITE operation. //! Get the destination index of WRITE operation.
ASMJIT_INLINE uint32_t getWriteIndex() const { ASMJIT_INLINE uint32_t getWriteIndex() const noexcept {
return _writeIndex; return _writeIndex;
} }
//! Get the number of bytes that will be written by a WRITE operation. //! Get the number of bytes that will be written by a WRITE operation.
ASMJIT_INLINE uint32_t getWriteSize() const { ASMJIT_INLINE uint32_t getWriteSize() const noexcept {
return _writeSize; return _writeSize;
} }
@@ -2131,7 +1937,7 @@ struct X86InstExtendedInfo {
//! Get flags of operand at index `index`. //! Get flags of operand at index `index`.
//! //!
//! See \ref X86InstInfo::getOperandFlags() for more details. //! See \ref X86InstInfo::getOperandFlags() for more details.
ASMJIT_INLINE uint16_t getOperandFlags(uint32_t index) const { ASMJIT_INLINE uint16_t getOperandFlags(uint32_t index) const noexcept {
ASMJIT_ASSERT(index < ASMJIT_ARRAY_SIZE(_opFlags)); ASMJIT_ASSERT(index < ASMJIT_ARRAY_SIZE(_opFlags));
return _opFlags[index]; return _opFlags[index];
} }
@@ -2143,7 +1949,7 @@ struct X86InstExtendedInfo {
//! Get the secondary instruction opcode, see \ref X86InstOpCodeFlags. //! Get the secondary instruction opcode, see \ref X86InstOpCodeFlags.
//! //!
//! See \ref X86InstInfo::getSecondaryOpCode() for more details. //! See \ref X86InstInfo::getSecondaryOpCode() for more details.
ASMJIT_INLINE uint32_t getSecondaryOpCode() const { ASMJIT_INLINE uint32_t getSecondaryOpCode() const noexcept {
return _secondaryOpCode; return _secondaryOpCode;
} }
@@ -2151,14 +1957,14 @@ struct X86InstExtendedInfo {
// [Members] // [Members]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Instruction encoding ID. //! Instruction encoding.
uint8_t _encodingId; uint8_t _encoding;
//! Destination index of WRITE operation, default 0. //! Destination index of WRITE operation, default 0.
uint8_t _writeIndex; uint8_t _writeIndex;
//! Count of bytes affected by a write operation, needed by analysis for all //! Count of bytes affected by a write operation, needed by analysis for all
//! instructions that do not read the register overwritten. Only used with //! instructions that do not read the overwritten register. Only used with
//! `kX86InstFlagMove` flag. If `_writeSize` is zero it is automatically //! `kX86InstFlagMove` flag. If `_writeSize` is zero it is automatically
//! deduced from the size of the destination register. //! deduced from the size of the destination register.
//! //!
@@ -2200,12 +2006,12 @@ struct X86InstInfo {
#if !defined(ASMJIT_DISABLE_TEXT) #if !defined(ASMJIT_DISABLE_TEXT)
//! Get instruction name string (null terminated). //! Get instruction name string (null terminated).
ASMJIT_INLINE const char* getInstName() const { ASMJIT_INLINE const char* getInstName() const noexcept {
return _x86InstName + static_cast<uint32_t>(_nameIndex); return _x86InstName + static_cast<uint32_t>(_nameIndex);
} }
//! Get instruction name index to `_x86InstName` array. //! Get instruction name index to `_x86InstName` array.
ASMJIT_INLINE uint32_t _getNameIndex() const { ASMJIT_INLINE uint32_t _getNameIndex() const noexcept {
return _nameIndex; return _nameIndex;
} }
#endif // !ASMJIT_DISABLE_TEXT #endif // !ASMJIT_DISABLE_TEXT
@@ -2215,12 +2021,12 @@ struct X86InstInfo {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Get `X86InstExtendedInfo` for this instruction. //! Get `X86InstExtendedInfo` for this instruction.
ASMJIT_INLINE const X86InstExtendedInfo& getExtendedInfo() const { ASMJIT_INLINE const X86InstExtendedInfo& getExtendedInfo() const noexcept {
return _x86InstExtendedInfo[_extendedIndex]; return _x86InstExtendedInfo[_extendedIndex];
} }
//! Get index to the `_x86InstExtendedInfo` table. //! Get index to the `_x86InstExtendedInfo` table.
ASMJIT_INLINE uint32_t _getExtendedIndex() const { ASMJIT_INLINE uint32_t _getExtendedIndex() const noexcept {
return _extendedIndex; return _extendedIndex;
} }
@@ -2228,9 +2034,9 @@ struct X86InstInfo {
// [Accessors - Instruction Encoding] // [Accessors - Instruction Encoding]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Get instruction group, see \ref X86InstEncodingId. //! Get instruction group, see \ref X86InstEncoding.
ASMJIT_INLINE uint32_t getEncodingId() const { ASMJIT_INLINE uint32_t getEncoding() const noexcept {
return getExtendedInfo().getEncodingId(); return getExtendedInfo().getEncoding();
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -2238,12 +2044,12 @@ struct X86InstInfo {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Get instruction flags, see `X86InstFlags`. //! Get instruction flags, see `X86InstFlags`.
ASMJIT_INLINE uint32_t getInstFlags() const { ASMJIT_INLINE uint32_t getInstFlags() const noexcept {
return getExtendedInfo().getInstFlags(); return getExtendedInfo().getInstFlags();
} }
//! Get whether the instruction has flag `flag`, see `X86InstFlags`. //! Get whether the instruction has flag `flag`, see `X86InstFlags`.
ASMJIT_INLINE bool hasInstFlag(uint32_t flag) const { ASMJIT_INLINE bool hasInstFlag(uint32_t flag) const noexcept {
return (getInstFlags() & flag) != 0; return (getInstFlags() & flag) != 0;
} }
@@ -2252,12 +2058,12 @@ struct X86InstInfo {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Get EFLAGS that the instruction reads, see \ref X86EFlags. //! Get EFLAGS that the instruction reads, see \ref X86EFlags.
ASMJIT_INLINE uint32_t getEFlagsIn() const { ASMJIT_INLINE uint32_t getEFlagsIn() const noexcept {
return getExtendedInfo().getEFlagsIn(); return getExtendedInfo().getEFlagsIn();
} }
//! Get EFLAGS that the instruction writes, see \ref X86EFlags. //! Get EFLAGS that the instruction writes, see \ref X86EFlags.
ASMJIT_INLINE uint32_t getEFlagsOut() const { ASMJIT_INLINE uint32_t getEFlagsOut() const noexcept {
return getExtendedInfo().getEFlagsOut(); return getExtendedInfo().getEFlagsOut();
} }
@@ -2266,12 +2072,12 @@ struct X86InstInfo {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Get the destination index of WRITE operation. //! Get the destination index of WRITE operation.
ASMJIT_INLINE uint32_t getWriteIndex() const { ASMJIT_INLINE uint32_t getWriteIndex() const noexcept {
return getExtendedInfo().getWriteIndex(); return getExtendedInfo().getWriteIndex();
} }
//! Get the number of bytes that will be written by a WRITE operation. //! Get the number of bytes that will be written by a WRITE operation.
ASMJIT_INLINE uint32_t getWriteSize() const { ASMJIT_INLINE uint32_t getWriteSize() const noexcept {
return getExtendedInfo().getWriteSize(); return getExtendedInfo().getWriteSize();
} }
@@ -2280,7 +2086,7 @@ struct X86InstInfo {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Get flags of operand at index `index`. //! Get flags of operand at index `index`.
ASMJIT_INLINE uint32_t getOperandFlags(uint32_t index) const { ASMJIT_INLINE uint32_t getOperandFlags(uint32_t index) const noexcept {
return getExtendedInfo().getOperandFlags(index); return getExtendedInfo().getOperandFlags(index);
} }
@@ -2289,12 +2095,12 @@ struct X86InstInfo {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
//! Get the primary instruction opcode, see \ref X86InstOpCodeFlags. //! Get the primary instruction opcode, see \ref X86InstOpCodeFlags.
ASMJIT_INLINE uint32_t getPrimaryOpCode() const { ASMJIT_INLINE uint32_t getPrimaryOpCode() const noexcept {
return _primaryOpCode; return _primaryOpCode;
} }
//! Get the secondary instruction opcode, see \ref X86InstOpCodeFlags. //! Get the secondary instruction opcode, see \ref X86InstOpCodeFlags.
ASMJIT_INLINE uint32_t getSecondaryOpCode() const { ASMJIT_INLINE uint32_t getSecondaryOpCode() const noexcept {
return getExtendedInfo().getSecondaryOpCode(); return getExtendedInfo().getSecondaryOpCode();
} }

View File

@@ -11,7 +11,7 @@
#include "../build.h" #include "../build.h"
#if defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64) #if defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64)
// [Dependencies - AsmJit] // [Dependencies]
#include "../x86/x86operand.h" #include "../x86/x86operand.h"
// [Api-Begin] // [Api-Begin]

View File

@@ -8,7 +8,7 @@
#ifndef _ASMJIT_X86_X86OPERAND_H #ifndef _ASMJIT_X86_X86OPERAND_H
#define _ASMJIT_X86_X86OPERAND_H #define _ASMJIT_X86_X86OPERAND_H
// [Dependencies - AsmJit] // [Dependencies]
#include "../base/assembler.h" #include "../base/assembler.h"
#include "../base/compiler.h" #include "../base/compiler.h"
#include "../base/operand.h" #include "../base/operand.h"
@@ -30,26 +30,26 @@ namespace asmjit {
// [Forward Declarations] // [Forward Declarations]
// ============================================================================ // ============================================================================
struct X86Reg; class X86Reg;
struct X86GpReg; class X86GpReg;
struct X86FpReg; class X86FpReg;
struct X86MmReg; class X86MmReg;
struct X86KReg; class X86KReg;
struct X86XmmReg; class X86XmmReg;
struct X86YmmReg; class X86YmmReg;
struct X86ZmmReg; class X86ZmmReg;
struct X86SegReg; class X86SegReg;
struct X86RipReg; class X86RipReg;
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
struct X86Var; class X86Var;
struct X86GpVar; class X86GpVar;
struct X86MmVar; class X86MmVar;
struct X86KVar; class X86KVar;
struct X86XmmVar; class X86XmmVar;
struct X86YmmVar; class X86YmmVar;
struct X86ZmmVar; class X86ZmmVar;
#endif // !ASMJIT_DISABLE_COMPILER #endif // !ASMJIT_DISABLE_COMPILER
//! \addtogroup asmjit_x86 //! \addtogroup asmjit_x86
@@ -680,15 +680,15 @@ struct X86RegMask {
// without calling a constructor. Compiler will store these in .DATA section. // without calling a constructor. Compiler will store these in .DATA section.
// //
// Kept in union to prevent LTO warnings. // Kept in union to prevent LTO warnings.
struct X86RipReg { union { Operand::VRegOp _vreg; }; }; class X86RipReg { public: union { Operand::VRegOp _vreg; }; };
struct X86SegReg { union { Operand::VRegOp _vreg; }; }; class X86SegReg { public: union { Operand::VRegOp _vreg; }; };
struct X86GpReg { union { Operand::VRegOp _vreg; }; }; class X86GpReg { public: union { Operand::VRegOp _vreg; }; };
struct X86FpReg { union { Operand::VRegOp _vreg; }; }; class X86FpReg { public: union { Operand::VRegOp _vreg; }; };
struct X86KReg { union { Operand::VRegOp _vreg; }; }; class X86KReg { public: union { Operand::VRegOp _vreg; }; };
struct X86MmReg { union { Operand::VRegOp _vreg; }; }; class X86MmReg { public: union { Operand::VRegOp _vreg; }; };
struct X86XmmReg { union { Operand::VRegOp _vreg; }; }; class X86XmmReg { public: union { Operand::VRegOp _vreg; }; };
struct X86YmmReg { union { Operand::VRegOp _vreg; }; }; class X86YmmReg { public: union { Operand::VRegOp _vreg; }; };
struct X86ZmmReg { union { Operand::VRegOp _vreg; }; }; class X86ZmmReg { public: union { Operand::VRegOp _vreg; }; };
#else #else
@@ -697,7 +697,8 @@ struct X86ZmmReg { union { Operand::VRegOp _vreg; }; };
// ============================================================================ // ============================================================================
//! X86/X86 register base class. //! X86/X86 register base class.
struct X86Reg : public Reg { class X86Reg : public Reg {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -772,7 +773,8 @@ struct X86Reg : public Reg {
// ============================================================================ // ============================================================================
//! X86/X64 RIP register. //! X86/X64 RIP register.
struct X86RipReg : public X86Reg { class X86RipReg : public X86Reg {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -796,7 +798,8 @@ struct X86RipReg : public X86Reg {
// ============================================================================ // ============================================================================
//! X86/X64 segment register. //! X86/X64 segment register.
struct X86SegReg : public X86Reg { class X86SegReg : public X86Reg {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -824,7 +827,8 @@ struct X86SegReg : public X86Reg {
// ============================================================================ // ============================================================================
//! X86/X64 Gpb/Gpw/Gpd/Gpq register. //! X86/X64 Gpb/Gpw/Gpd/Gpq register.
struct X86GpReg : public X86Reg { class X86GpReg : public X86Reg {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -879,7 +883,8 @@ struct X86GpReg : public X86Reg {
// ============================================================================ // ============================================================================
//! X86/X64 80-bit Fp register. //! X86/X64 80-bit Fp register.
struct X86FpReg : public X86Reg { class X86FpReg : public X86Reg {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -932,7 +937,8 @@ struct X86FpReg : public X86Reg {
//! //!
//! - `movd` - writes 4-bytes in `LO-DWord` and zeroes `HI-DWord`. //! - `movd` - writes 4-bytes in `LO-DWord` and zeroes `HI-DWord`.
//! - `movq` - writes 8-bytes in `QWord`. //! - `movq` - writes 8-bytes in `QWord`.
struct X86MmReg : public X86Reg { class X86MmReg : public X86Reg {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -960,7 +966,8 @@ struct X86MmReg : public X86Reg {
// ============================================================================ // ============================================================================
//! X86/X64 64-bit K register (AVX512+). //! X86/X64 64-bit K register (AVX512+).
struct X86KReg : public X86Reg { class X86KReg : public X86Reg {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1041,7 +1048,8 @@ struct X86KReg : public X86Reg {
//! - `movddup`, //! - `movddup`,
//! - `movsldup`, //! - `movsldup`,
//! - `movshdup` - writes 16 bytes in `OWord`. //! - `movshdup` - writes 16 bytes in `OWord`.
struct X86XmmReg : public X86Reg { class X86XmmReg : public X86Reg {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1102,7 +1110,8 @@ struct X86XmmReg : public X86Reg {
//! |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00| //! |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00|
//! +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ //! +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
//! ~~~ //! ~~~
struct X86YmmReg : public X86Reg { class X86YmmReg : public X86Reg {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1143,7 +1152,8 @@ ASMJIT_INLINE X86YmmReg X86XmmReg::ymm() const noexcept { return X86YmmReg(kX86R
// ============================================================================ // ============================================================================
//! X86/X64 512-bit Zmm register (AVX512+). //! X86/X64 512-bit Zmm register (AVX512+).
struct X86ZmmReg : public X86Reg { class X86ZmmReg : public X86Reg {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1185,7 +1195,8 @@ ASMJIT_INLINE X86ZmmReg X86YmmReg::zmm() const noexcept { return X86ZmmReg(kX86R
// ============================================================================ // ============================================================================
//! X86 memory operand. //! X86 memory operand.
struct X86Mem : public BaseMem { class X86Mem : public BaseMem {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1649,7 +1660,8 @@ struct X86Mem : public BaseMem {
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
//! Base class for all X86 variables. //! Base class for all X86 variables.
struct X86Var : public Var { class X86Var : public Var {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1836,7 +1848,8 @@ protected:
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
//! Gp variable. //! Gp variable.
struct X86GpVar : public X86Var { class X86GpVar : public X86Var {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1906,7 +1919,8 @@ public:
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
//! Mm variable. //! Mm variable.
struct X86MmVar : public X86Var { class X86MmVar : public X86Var {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1945,7 +1959,8 @@ struct X86MmVar : public X86Var {
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
//! Xmm variable. //! Xmm variable.
struct X86XmmVar : public X86Var { class X86XmmVar : public X86Var {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -1954,8 +1969,8 @@ protected:
ASMJIT_INLINE X86XmmVar(const X86Var& other, uint32_t reg, uint32_t size) noexcept ASMJIT_INLINE X86XmmVar(const X86Var& other, uint32_t reg, uint32_t size) noexcept
: X86Var(other, reg, size) {} : X86Var(other, reg, size) {}
friend struct X86YmmVar; friend class X86YmmVar;
friend struct X86ZmmVar; friend class X86ZmmVar;
public: public:
//! Create a new uninitialized `X86XmmVar` instance. //! Create a new uninitialized `X86XmmVar` instance.
@@ -1999,7 +2014,8 @@ public:
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
//! Ymm variable. //! Ymm variable.
struct X86YmmVar : public X86Var { class X86YmmVar : public X86Var {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -2008,8 +2024,8 @@ protected:
ASMJIT_INLINE X86YmmVar(const X86Var& other, uint32_t reg, uint32_t size) noexcept ASMJIT_INLINE X86YmmVar(const X86Var& other, uint32_t reg, uint32_t size) noexcept
: X86Var(other, reg, size) {} : X86Var(other, reg, size) {}
friend struct X86XmmVar; friend class X86XmmVar;
friend struct X86ZmmVar; friend class X86ZmmVar;
public: public:
//! Create a new uninitialized `X86YmmVar` instance. //! Create a new uninitialized `X86YmmVar` instance.
@@ -2055,7 +2071,8 @@ ASMJIT_INLINE X86YmmVar X86XmmVar::ymm() const noexcept { return X86YmmVar(*this
#if !defined(ASMJIT_DISABLE_COMPILER) #if !defined(ASMJIT_DISABLE_COMPILER)
//! Zmm variable. //! Zmm variable.
struct X86ZmmVar : public X86Var { class X86ZmmVar : public X86Var {
public:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// [Construction / Destruction] // [Construction / Destruction]
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
@@ -2064,8 +2081,8 @@ protected:
ASMJIT_INLINE X86ZmmVar(const X86Var& other, uint32_t reg, uint32_t size) noexcept ASMJIT_INLINE X86ZmmVar(const X86Var& other, uint32_t reg, uint32_t size) noexcept
: X86Var(other, reg, size) {} : X86Var(other, reg, size) {}
friend struct X86XmmVar; friend class X86XmmVar;
friend struct X86YmmVar; friend class X86YmmVar;
public: public:
//! Create a new uninitialized `X86ZmmVar` instance. //! Create a new uninitialized `X86ZmmVar` instance.

View File

@@ -12,7 +12,7 @@
#include "../build.h" #include "../build.h"
#if defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64) #if defined(ASMJIT_BUILD_X86) || defined(ASMJIT_BUILD_X64)
// [Dependencies - AsmJit] // [Dependencies]
#include "../x86/x86operand.h" #include "../x86/x86operand.h"
// [Api-Begin] // [Api-Begin]
@@ -20,244 +20,41 @@
namespace asmjit { namespace asmjit {
#define REG(_Type_, _Index_, _Size_) {{{ \ #define REG(type, index, size) {{{ \
Operand::kTypeReg, _Size_, { ((_Type_) << 8) + _Index_ }, kInvalidValue, {{ kInvalidVar, 0 }} \ Operand::kTypeReg, size, { ((type) << 8) + index }, kInvalidValue, {{ kInvalidVar, 0 }} \
}}} }}}
#define REG_LIST_04(type, start, size) \
REG(type, start + 0, size), \
REG(type, start + 1, size), \
REG(type, start + 2, size), \
REG(type, start + 3, size)
#define REG_LIST_08(type, start, size) \
REG_LIST_04(type, start + 0, size), \
REG_LIST_04(type, start + 4, size)
#define REG_LIST_16(type, start, size) \
REG_LIST_08(type, start + 0, size), \
REG_LIST_08(type, start + 8, size)
#define REG_LIST_32(type, start, size) \
REG_LIST_16(type, start + 0, size), \
REG_LIST_16(type, start + 16, size)
const X86RegData x86RegData = { const X86RegData x86RegData = {
// Gpd. { REG_LIST_16(kX86RegTypeGpd , 0, 4) },
{ { REG_LIST_16(kX86RegTypeGpq , 0, 8) },
REG(kX86RegTypeGpd, 0 , 4), { REG_LIST_16(kX86RegTypeGpbLo, 0, 1) },
REG(kX86RegTypeGpd, 1 , 4), { REG_LIST_04(kX86RegTypeGpbHi, 0, 1) },
REG(kX86RegTypeGpd, 2 , 4), { REG_LIST_16(kX86RegTypeGpw , 0, 2) },
REG(kX86RegTypeGpd, 3 , 4), { REG_LIST_32(kX86RegTypeXmm , 0, 16) },
REG(kX86RegTypeGpd, 4 , 4), { REG_LIST_32(kX86RegTypeYmm , 0, 32) },
REG(kX86RegTypeGpd, 5 , 4), { REG_LIST_32(kX86RegTypeZmm , 0, 64) },
REG(kX86RegTypeGpd, 6 , 4), { REG_LIST_08(kX86RegTypeK , 0, 8) },
REG(kX86RegTypeGpd, 7 , 4), { REG_LIST_08(kX86RegTypeFp , 0, 10) },
REG(kX86RegTypeGpd, 8 , 4), { REG_LIST_08(kX86RegTypeMm , 0, 8) },
REG(kX86RegTypeGpd, 9 , 4),
REG(kX86RegTypeGpd, 10, 4),
REG(kX86RegTypeGpd, 11, 4),
REG(kX86RegTypeGpd, 12, 4),
REG(kX86RegTypeGpd, 13, 4),
REG(kX86RegTypeGpd, 14, 4),
REG(kX86RegTypeGpd, 15, 4)
},
// Gpq.
{
REG(kX86RegTypeGpq, 0 , 8),
REG(kX86RegTypeGpq, 1 , 8),
REG(kX86RegTypeGpq, 2 , 8),
REG(kX86RegTypeGpq, 3 , 8),
REG(kX86RegTypeGpq, 4 , 8),
REG(kX86RegTypeGpq, 5 , 8),
REG(kX86RegTypeGpq, 6 , 8),
REG(kX86RegTypeGpq, 7 , 8),
REG(kX86RegTypeGpq, 8 , 8),
REG(kX86RegTypeGpq, 9 , 8),
REG(kX86RegTypeGpq, 10, 8),
REG(kX86RegTypeGpq, 11, 8),
REG(kX86RegTypeGpq, 12, 8),
REG(kX86RegTypeGpq, 13, 8),
REG(kX86RegTypeGpq, 14, 8),
REG(kX86RegTypeGpq, 15, 8)
},
// GpbLo.
{
REG(kX86RegTypeGpbLo, 0, 1),
REG(kX86RegTypeGpbLo, 1, 1),
REG(kX86RegTypeGpbLo, 2, 1),
REG(kX86RegTypeGpbLo, 3, 1),
REG(kX86RegTypeGpbLo, 4, 1),
REG(kX86RegTypeGpbLo, 5, 1),
REG(kX86RegTypeGpbLo, 6, 1),
REG(kX86RegTypeGpbLo, 7, 1),
REG(kX86RegTypeGpbLo, 8, 1),
REG(kX86RegTypeGpbLo, 9, 1),
REG(kX86RegTypeGpbLo, 10, 1),
REG(kX86RegTypeGpbLo, 11, 1),
REG(kX86RegTypeGpbLo, 12, 1),
REG(kX86RegTypeGpbLo, 13, 1),
REG(kX86RegTypeGpbLo, 14, 1),
REG(kX86RegTypeGpbLo, 15, 1)
},
// GpbHi.
{
REG(kX86RegTypeGpbHi, 0, 1),
REG(kX86RegTypeGpbHi, 1, 1),
REG(kX86RegTypeGpbHi, 2, 1),
REG(kX86RegTypeGpbHi, 3, 1)
},
// Gpw.
{
REG(kX86RegTypeGpw, 0 , 2),
REG(kX86RegTypeGpw, 1 , 2),
REG(kX86RegTypeGpw, 2 , 2),
REG(kX86RegTypeGpw, 3 , 2),
REG(kX86RegTypeGpw, 4 , 2),
REG(kX86RegTypeGpw, 5 , 2),
REG(kX86RegTypeGpw, 6 , 2),
REG(kX86RegTypeGpw, 7 , 2),
REG(kX86RegTypeGpw, 8 , 2),
REG(kX86RegTypeGpw, 9 , 2),
REG(kX86RegTypeGpw, 10, 2),
REG(kX86RegTypeGpw, 11, 2),
REG(kX86RegTypeGpw, 12, 2),
REG(kX86RegTypeGpw, 13, 2),
REG(kX86RegTypeGpw, 14, 2),
REG(kX86RegTypeGpw, 15, 2)
},
// Xmm.
{
REG(kX86RegTypeXmm, 0 , 16),
REG(kX86RegTypeXmm, 1 , 16),
REG(kX86RegTypeXmm, 2 , 16),
REG(kX86RegTypeXmm, 3 , 16),
REG(kX86RegTypeXmm, 4 , 16),
REG(kX86RegTypeXmm, 5 , 16),
REG(kX86RegTypeXmm, 6 , 16),
REG(kX86RegTypeXmm, 7 , 16),
REG(kX86RegTypeXmm, 8 , 16),
REG(kX86RegTypeXmm, 9 , 16),
REG(kX86RegTypeXmm, 10, 16),
REG(kX86RegTypeXmm, 11, 16),
REG(kX86RegTypeXmm, 12, 16),
REG(kX86RegTypeXmm, 13, 16),
REG(kX86RegTypeXmm, 14, 16),
REG(kX86RegTypeXmm, 15, 16),
REG(kX86RegTypeXmm, 16, 16),
REG(kX86RegTypeXmm, 17, 16),
REG(kX86RegTypeXmm, 18, 16),
REG(kX86RegTypeXmm, 19, 16),
REG(kX86RegTypeXmm, 20, 16),
REG(kX86RegTypeXmm, 21, 16),
REG(kX86RegTypeXmm, 22, 16),
REG(kX86RegTypeXmm, 23, 16),
REG(kX86RegTypeXmm, 24, 16),
REG(kX86RegTypeXmm, 25, 16),
REG(kX86RegTypeXmm, 26, 16),
REG(kX86RegTypeXmm, 27, 16),
REG(kX86RegTypeXmm, 28, 16),
REG(kX86RegTypeXmm, 29, 16),
REG(kX86RegTypeXmm, 30, 16),
REG(kX86RegTypeXmm, 31, 16)
},
// Ymm.
{
REG(kX86RegTypeYmm, 0 , 32),
REG(kX86RegTypeYmm, 1 , 32),
REG(kX86RegTypeYmm, 2 , 32),
REG(kX86RegTypeYmm, 3 , 32),
REG(kX86RegTypeYmm, 4 , 32),
REG(kX86RegTypeYmm, 5 , 32),
REG(kX86RegTypeYmm, 6 , 32),
REG(kX86RegTypeYmm, 7 , 32),
REG(kX86RegTypeYmm, 8 , 32),
REG(kX86RegTypeYmm, 9 , 32),
REG(kX86RegTypeYmm, 10, 32),
REG(kX86RegTypeYmm, 11, 32),
REG(kX86RegTypeYmm, 12, 32),
REG(kX86RegTypeYmm, 13, 32),
REG(kX86RegTypeYmm, 14, 32),
REG(kX86RegTypeYmm, 15, 32),
REG(kX86RegTypeYmm, 16, 32),
REG(kX86RegTypeYmm, 17, 32),
REG(kX86RegTypeYmm, 18, 32),
REG(kX86RegTypeYmm, 19, 32),
REG(kX86RegTypeYmm, 20, 32),
REG(kX86RegTypeYmm, 21, 32),
REG(kX86RegTypeYmm, 22, 32),
REG(kX86RegTypeYmm, 23, 32),
REG(kX86RegTypeYmm, 24, 32),
REG(kX86RegTypeYmm, 25, 32),
REG(kX86RegTypeYmm, 26, 32),
REG(kX86RegTypeYmm, 27, 32),
REG(kX86RegTypeYmm, 28, 32),
REG(kX86RegTypeYmm, 29, 32),
REG(kX86RegTypeYmm, 30, 32),
REG(kX86RegTypeYmm, 31, 32)
},
// Zmm.
{
REG(kX86RegTypeZmm, 0 , 64),
REG(kX86RegTypeZmm, 1 , 64),
REG(kX86RegTypeZmm, 2 , 64),
REG(kX86RegTypeZmm, 3 , 64),
REG(kX86RegTypeZmm, 4 , 64),
REG(kX86RegTypeZmm, 5 , 64),
REG(kX86RegTypeZmm, 6 , 64),
REG(kX86RegTypeZmm, 7 , 64),
REG(kX86RegTypeZmm, 8 , 64),
REG(kX86RegTypeZmm, 9 , 64),
REG(kX86RegTypeZmm, 10, 64),
REG(kX86RegTypeZmm, 11, 64),
REG(kX86RegTypeZmm, 12, 64),
REG(kX86RegTypeZmm, 13, 64),
REG(kX86RegTypeZmm, 14, 64),
REG(kX86RegTypeZmm, 15, 64),
REG(kX86RegTypeZmm, 16, 64),
REG(kX86RegTypeZmm, 17, 64),
REG(kX86RegTypeZmm, 18, 64),
REG(kX86RegTypeZmm, 19, 64),
REG(kX86RegTypeZmm, 20, 64),
REG(kX86RegTypeZmm, 21, 64),
REG(kX86RegTypeZmm, 22, 64),
REG(kX86RegTypeZmm, 23, 64),
REG(kX86RegTypeZmm, 24, 64),
REG(kX86RegTypeZmm, 25, 64),
REG(kX86RegTypeZmm, 26, 64),
REG(kX86RegTypeZmm, 27, 64),
REG(kX86RegTypeZmm, 28, 64),
REG(kX86RegTypeZmm, 29, 64),
REG(kX86RegTypeZmm, 30, 64),
REG(kX86RegTypeZmm, 31, 64)
},
// K.
{
REG(kX86RegTypeK, 0, 8),
REG(kX86RegTypeK, 1, 8),
REG(kX86RegTypeK, 2, 8),
REG(kX86RegTypeK, 3, 8),
REG(kX86RegTypeK, 4, 8),
REG(kX86RegTypeK, 5, 8),
REG(kX86RegTypeK, 6, 8),
REG(kX86RegTypeK, 7, 8)
},
// Fp.
{
REG(kX86RegTypeFp, 0, 10),
REG(kX86RegTypeFp, 1, 10),
REG(kX86RegTypeFp, 2, 10),
REG(kX86RegTypeFp, 3, 10),
REG(kX86RegTypeFp, 4, 10),
REG(kX86RegTypeFp, 5, 10),
REG(kX86RegTypeFp, 6, 10),
REG(kX86RegTypeFp, 7, 10)
},
// Mm.
{
REG(kX86RegTypeMm, 0, 8),
REG(kX86RegTypeMm, 1, 8),
REG(kX86RegTypeMm, 2, 8),
REG(kX86RegTypeMm, 3, 8),
REG(kX86RegTypeMm, 4, 8),
REG(kX86RegTypeMm, 5, 8),
REG(kX86RegTypeMm, 6, 8),
REG(kX86RegTypeMm, 7, 8)
},
// Segments.
{ {
REG(kX86RegTypeSeg, 0, 2), // Default. REG(kX86RegTypeSeg, 0, 2), // Default.
REG(kX86RegTypeSeg, 1, 2), // ES. REG(kX86RegTypeSeg, 1, 2), // ES.
@@ -268,12 +65,14 @@ const X86RegData x86RegData = {
REG(kX86RegTypeSeg, 6, 2) // GS. REG(kX86RegTypeSeg, 6, 2) // GS.
}, },
// NoGp. REG(kInvalidReg, kInvalidReg, 0), // NoGp.
REG(kInvalidReg, kInvalidReg, 0), REG(kX86RegTypeRip, 0, 0), // RIP.
// RIP.
REG(kX86RegTypeRip, 0, 0),
}; };
#undef REG_LIST_32
#undef REG_LIST_16
#undef REG_LIST_08
#undef REG_LIST_04
#undef REG #undef REG
} // asmjit namespace } // asmjit namespace

View File

@@ -4,14 +4,11 @@
// [License] // [License]
// Zlib - See LICENSE.md file in the package. // Zlib - See LICENSE.md file in the package.
// [Dependencies - AsmJit] // [Dependencies]
#include "../asmjit/asmjit.h" #include "../asmjit/asmjit.h"
// [Dependencies - Test]
#include "./asmjit_test_opcode.h" #include "./asmjit_test_opcode.h"
#include "./genblend.h" #include "./genblend.h"
// [Dependencies - C]
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@@ -8,13 +8,10 @@
// disassembled in your IDE or by your favourite disassembler. Instructions // disassembled in your IDE or by your favourite disassembler. Instructions
// are grouped by category and then sorted alphabetically. // are grouped by category and then sorted alphabetically.
// [Dependencies - AsmJit] // [Dependencies]
#include "../asmjit/asmjit.h" #include "../asmjit/asmjit.h"
// [Dependencies - Test]
#include "./asmjit_test_opcode.h" #include "./asmjit_test_opcode.h"
// [Dependencies - C]
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@@ -4,7 +4,7 @@
// [License] // [License]
// Zlib - See LICENSE.md file in the package. // Zlib - See LICENSE.md file in the package.
// [Dependencies - AsmJit] // [Dependencies]
#include "../asmjit/asmjit.h" #include "../asmjit/asmjit.h"
// ============================================================================ // ============================================================================

View File

@@ -4,13 +4,10 @@
// [License] // [License]
// Zlib - See LICENSE.md file in the package. // Zlib - See LICENSE.md file in the package.
// [Dependencies - AsmJit] // [Dependencies]
#include "../asmjit/asmjit.h" #include "../asmjit/asmjit.h"
// [Dependencies - Test]
#include "./genblend.h" #include "./genblend.h"
// [Dependencies - C]
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@@ -4,7 +4,7 @@
// [License] // [License]
// Public Domain (Unlicense) // Public Domain (Unlicense)
// [Dependencies - Broken] // [Dependencies]
#include "./broken.h" #include "./broken.h"
// ============================================================================ // ============================================================================

View File

@@ -8,7 +8,7 @@
#ifndef BROKEN_INTERNAL_H #ifndef BROKEN_INTERNAL_H
#define BROKEN_INTERNAL_H #define BROKEN_INTERNAL_H
// [Dependencies - C] // [Dependencies]
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -451,9 +451,7 @@ var main = function(files) {
}); });
}; };
main([ main([{
{
name: "../src/asmjit/x86/x86inst.cpp", name: "../src/asmjit/x86/x86inst.cpp",
arch: "x86" arch: "x86"
} }]);
]);