common: add instruction and opcode definitions; interface for manipulating selectors
This commit is contained in:
97
common/include/ivy/opcode.h
Normal file
97
common/include/ivy/opcode.h
Normal file
@@ -0,0 +1,97 @@
|
||||
#ifndef IVY_OPCODE_H_
|
||||
#define IVY_OPCODE_H_
|
||||
|
||||
enum ivy_instr_id {
|
||||
IVY_INSTR_NONE = 0,
|
||||
IVY_INSTR_LDR,
|
||||
IVY_INSTR_STR,
|
||||
IVY_INSTR_PUSH,
|
||||
IVY_INSTR_POP,
|
||||
IVY_INSTR_MSG,
|
||||
IVY_INSTR_ADD,
|
||||
IVY_INSTR_SUB,
|
||||
IVY_INSTR_MUL,
|
||||
IVY_INSTR_DIV,
|
||||
IVY_INSTR_CMP,
|
||||
IVY_INSTR_C_EQ,
|
||||
IVY_INSTR_C_NE,
|
||||
IVY_INSTR_C_LT,
|
||||
IVY_INSTR_C_LE,
|
||||
IVY_INSTR_C_GT,
|
||||
IVY_INSTR_C_GE,
|
||||
IVY_INSTR_BR,
|
||||
IVY_INSTR_B_Z,
|
||||
IVY_INSTR_B_NZ,
|
||||
IVY_INSTR_B_EQ,
|
||||
IVY_INSTR_B_NE,
|
||||
IVY_INSTR_B_LT,
|
||||
IVY_INSTR_B_LE,
|
||||
IVY_INSTR_B_GT,
|
||||
IVY_INSTR_B_GE,
|
||||
IVY_INSTR_OB_C,
|
||||
IVY_INSTR_OB_E,
|
||||
IVY_INSTR_LAM_C,
|
||||
IVY_INSTR_IT_G,
|
||||
IVY_INSTR_IT_N,
|
||||
IVY_INSTR_IT_V,
|
||||
IVY_INSTR_RET,
|
||||
IVY_INSTR_RET_N,
|
||||
};
|
||||
|
||||
enum ivy_opcode {
|
||||
IVY_OP_NONE = 0,
|
||||
|
||||
IVY_OP_LDR_SP,
|
||||
IVY_OP_LDR_BP,
|
||||
IVY_OP_LDR_SELF,
|
||||
IVY_OP_LDR_IMM,
|
||||
IVY_OP_LDR_POOL,
|
||||
|
||||
IVY_OP_STR_SP,
|
||||
IVY_OP_STR_BP,
|
||||
IVY_OP_STR_SELF,
|
||||
|
||||
IVY_OP_PUSH,
|
||||
IVY_OP_POP,
|
||||
|
||||
IVY_OP_MSG_R,
|
||||
IVY_OP_MSG_I,
|
||||
|
||||
IVY_OP_ADD,
|
||||
IVY_OP_SUB,
|
||||
IVY_OP_MUL,
|
||||
IVY_OP_DIV,
|
||||
|
||||
IVY_OP_CMP,
|
||||
|
||||
IVY_OP_C_EQ,
|
||||
IVY_OP_C_NE,
|
||||
IVY_OP_C_LT,
|
||||
IVY_OP_C_LE,
|
||||
IVY_OP_C_GT,
|
||||
IVY_OP_C_GE,
|
||||
|
||||
IVY_OP_BR,
|
||||
IVY_OP_B_Z,
|
||||
IVY_OP_B_NZ,
|
||||
IVY_OP_B_EQ,
|
||||
IVY_OP_B_NE,
|
||||
IVY_OP_B_LT,
|
||||
IVY_OP_B_LE,
|
||||
IVY_OP_B_GT,
|
||||
IVY_OP_B_GE,
|
||||
|
||||
IVY_OP_OB_C,
|
||||
IVY_OP_OB_E,
|
||||
|
||||
IVY_OP_LAM_C,
|
||||
|
||||
IVY_OP_IT_G,
|
||||
IVY_OP_IT_N,
|
||||
IVY_OP_IT_V,
|
||||
|
||||
IVY_OP_RET,
|
||||
IVY_OP_RET_N,
|
||||
};
|
||||
|
||||
#endif
|
||||
23
common/include/ivy/selector.h
Normal file
23
common/include/ivy/selector.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef IVY_SELECTOR_H_
|
||||
#define IVY_SELECTOR_H_
|
||||
|
||||
#include <ivy/status.h>
|
||||
|
||||
enum ivy_selector_recipient {
|
||||
IVY_SEL_NONE = 0,
|
||||
IVY_SEL_CLASS,
|
||||
IVY_SEL_OBJECT,
|
||||
};
|
||||
|
||||
struct ivy_selector;
|
||||
|
||||
extern enum ivy_status ivy_selector_create(struct ivy_selector **sel);
|
||||
extern void ivy_selector_destroy(struct ivy_selector *sel);
|
||||
|
||||
extern void ivy_selector_set_recipient(
|
||||
struct ivy_selector *sel, enum ivy_selector_recipient r);
|
||||
extern void ivy_selector_set_name(struct ivy_selector *sel, const char *name);
|
||||
extern void ivy_selector_add_arg(
|
||||
struct ivy_selector *sel, const char *label, const char *name);
|
||||
|
||||
#endif
|
||||
0
common/selector.c
Normal file
0
common/selector.c
Normal file
Reference in New Issue
Block a user