1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ujit_codegen.h

50 lines
987 B
C
Raw Normal View History

#ifndef UJIT_CODEGEN_H
#define UJIT_CODEGEN_H 1
#include "stddef.h"
#include "ujit_core.h"
2020-12-16 21:45:51 -05:00
// Code blocks we generate code into
extern codeblock_t *cb;
extern codeblock_t *ocb;
2020-12-16 21:45:51 -05:00
// Code generation state
typedef struct JITState
{
2021-01-12 17:03:54 -05:00
// Block version being compiled
block_t* block;
2021-01-12 17:03:54 -05:00
// Instruction sequence this is associated with
const rb_iseq_t *iseq;
// Index of the current instruction being compiled
uint32_t insn_idx;
// Current PC
VALUE *pc;
} jitstate_t;
2020-12-16 17:07:18 -05:00
// Code generation function signature
typedef bool (*codegen_fn)(jitstate_t* jit, ctx_t* ctx);
2020-12-16 17:07:18 -05:00
// Meta-information associated with a given opcode
typedef struct OpDesc
{
// Code generation function
codegen_fn gen_fn;
// Indicates that this is a branch instruction
// which terminates a block
bool is_branch;
} opdesc_t;
uint8_t* ujit_entry_prologue();
void ujit_gen_block(ctx_t* ctx, block_t* block);
void ujit_init_codegen(void);
#endif // #ifndef UJIT_CODEGEN_H