Method: AsmJIT::BaseEmitter#_emit

Defined in:
ext/asmjit/asmjit.cc

#_emit(*args) ⇒ Object



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'ext/asmjit/asmjit.cc', line 308

VALUE base_emitter_emit(int argc, VALUE* argv, VALUE self) {
    BaseEmitterWrapper *wrapper;
    TypedData_Get_Struct(self, BaseEmitterWrapper, &base_emitter_type, wrapper);

    BaseEmitter *emitter = wrapper->emitter;

    if (argc < 1) return Qnil;
    if (argc > 7) return Qnil;

    VALUE insn_name = argv[0];
    Check_Type(insn_name, T_STRING);
    InstId inst_id = InstAPI::stringToInstId(emitter->arch(), RSTRING_PTR(insn_name), RSTRING_LEN(insn_name));

    Operand operands[6];
    for (int i = 0; i < argc - 1; i++) {
        operands[i] = parse_operand(argv[i + 1]);
    }

    emitter->emitOpArray(inst_id, &operands[0], argc - 1);

    return self;
}