简体   繁体   English

使用AsmJit将变量值​​获取到寄存器

[英]Get a variable value to a register with AsmJit

How can I get a variable value to a register using AsmJit API? 如何使用AsmJit API将变量值获取到寄存器? Some thing like below? 像下面的东西?

int x = 234;
Assember a;
a.mov(rax, $value_of_x);

AsmJit supports immediate operands, all you need is: AsmJit支持立即数操作数,您需要做的是:

using namespace asmjit;

// Create and configure X86Assembler:
X86Assembler a(...);

// The answer:
int x = 234;
a.mov(x86::rax, x);

or just 要不就

a.mov(x86::rax, 234);

The previous examples used function overloads that accept immediate values directly. 前面的示例使用函数重载,这些重载直接接受立即值。 However, it's also possible to create the Imm operand and use it in your code dynamically: 但是,也可以创建Imm操作数并在代码中动态使用它:

Imm x = imm(234);
a.mov(x86::rax, x);

Or: 要么:

a.mov(x86::rax, imm(x));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM