Generate getop_* functions

This commit is contained in:
Ilmir Usmanov
2014-07-16 13:04:30 +04:00
parent b1f9275048
commit 438318d788
2 changed files with 92 additions and 32 deletions
+34
View File
@@ -40,6 +40,40 @@
T_IDX_DECL( name2 ); \
T_IDX_DECL( name3 )
#define GETOP_IMPL_0(name) \
OPCODE getop_##name () { \
OPCODE opdata; \
opdata.op_idx = name; \
return opdata; \
}
#define GETOP_IMPL_1(name, field1) \
OPCODE getop_##name (T_IDX arg1) { \
OPCODE opdata; \
opdata.op_idx = name; \
opdata.data.name.field1 = arg1; \
return opdata; \
}
#define GETOP_IMPL_2(name, field1, field2) \
OPCODE getop_##name (T_IDX arg1, T_IDX arg2) { \
OPCODE opdata; \
opdata.op_idx = name; \
opdata.data.name.field1 = arg1; \
opdata.data.name.field2 = arg2; \
return opdata; \
}
#define GETOP_IMPL_3(name, field1, field2, field3) \
OPCODE getop_##name (T_IDX arg1, T_IDX arg2, T_IDX arg3) { \
OPCODE opdata; \
opdata.op_idx = name; \
opdata.data.name.field1 = arg1; \
opdata.data.name.field2 = arg2; \
opdata.data.name.field3 = arg3; \
return opdata; \
}
// All conditional jumps should be followed by a JMP instruction, which holds
// the target of conditional JMP. If condition is TRUE, than JMP to the target.
// Otherwise they fall through to the instruction after the JMP.