Add data form 3

This commit is contained in:
Jeffrey Pfau 2013-04-09 04:20:14 -07:00
parent 56c3685ba6
commit 027e27caa4
1 changed files with 38 additions and 16 deletions

View File

@ -73,32 +73,50 @@ DEFINE_SHIFT_1_INSTRUCTION_THUMB(LSL, )
DEFINE_SHIFT_1_INSTRUCTION_THUMB(LSR, )
DEFINE_SHIFT_1_INSTRUCTION_THUMB(ASR, )
#define DEFINE_ADD_SUB_1_INSTRUCTION_EX_THUMB(NAME, IMMEDIATE, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \
int immediate = IMMEDIATE; \
BODY;)
#define DEFINE_ADD_SUB_1_INSTRUCTION_THUMB(NAME, BODY) \
COUNT_3(DEFINE_ADD_SUB_1_INSTRUCTION_EX_THUMB, NAME ## 1_, BODY)
DEFINE_ADD_SUB_1_INSTRUCTION_THUMB(ADD, )
DEFINE_ADD_SUB_1_INSTRUCTION_THUMB(SUB, )
#define DEFINE_ADD_SUB_3_INSTRUCTION_EX_THUMB(NAME, RM, BODY) \
#define DEFINE_DATA_FORM_1_INSTRUCTION_EX_THUMB(NAME, RM, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \
int rm = RM; \
BODY;)
#define DEFINE_ADD_SUB_3_INSTRUCTION_THUMB(NAME, BODY) \
COUNT_3(DEFINE_ADD_SUB_3_INSTRUCTION_EX_THUMB, NAME ## 3_R, BODY)
#define DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(NAME, BODY) \
COUNT_3(DEFINE_DATA_FORM_1_INSTRUCTION_EX_THUMB, NAME ## 3_R, BODY)
DEFINE_ADD_SUB_3_INSTRUCTION_THUMB(ADD, )
DEFINE_ADD_SUB_3_INSTRUCTION_THUMB(SUB, )
DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(ADD, )
DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(SUB, )
#define DECLARE_INSTRUCTION_THUMB(EMITTER, NAME) \
EMITTER ## NAME
#define DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB(NAME, IMMEDIATE, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \
int immediate = IMMEDIATE; \
BODY;)
#define DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(NAME, BODY) \
COUNT_3(DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB, NAME ## 1_, BODY)
DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(ADD, )
DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(SUB, )
#define DEFINE_DATA_FORM_3_INSTRUCTION_EX_THUMB(NAME, RM, BODY) \
DEFINE_INSTRUCTION_THUMB(NAME, \
int rd = RD; \
BODY;)
#define DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(NAME, BODY) \
COUNT_3(DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB, NAME ## _R, BODY)
DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(ADD2, )
DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(CMP1, )
DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(MOV1, )
DEFINE_DATA_FORM_3_INSTRUCTION_THUMB(SUB2, )
#define DUMMY(X, ...) X,
#define DUMMY_4(...) \
DUMMY(__VA_ARGS__) \
DUMMY(__VA_ARGS__) \
DUMMY(__VA_ARGS__) \
DUMMY(__VA_ARGS__)
#define DECLARE_THUMB_EMITTER_BLOCK(EMITTER) \
APPLY(COUNT_5, DUMMY, DECLARE_INSTRUCTION_THUMB(EMITTER, LSL1_)) \
APPLY(COUNT_5, DUMMY, DECLARE_INSTRUCTION_THUMB(EMITTER, LSR1_)) \
@ -107,6 +125,10 @@ DEFINE_ADD_SUB_3_INSTRUCTION_THUMB(SUB, )
APPLY(COUNT_3, DUMMY, DECLARE_INSTRUCTION_THUMB(EMITTER, SUB3_R)) \
APPLY(COUNT_3, DUMMY, DECLARE_INSTRUCTION_THUMB(EMITTER, ADD1_)) \
APPLY(COUNT_3, DUMMY, DECLARE_INSTRUCTION_THUMB(EMITTER, SUB1_)) \
APPLY(COUNT_3, DUMMY_4, DECLARE_INSTRUCTION_THUMB(EMITTER, MOV1_R)) \
APPLY(COUNT_3, DUMMY_4, DECLARE_INSTRUCTION_THUMB(EMITTER, CMP1_R)) \
APPLY(COUNT_3, DUMMY_4, DECLARE_INSTRUCTION_THUMB(EMITTER, ADD2_R)) \
APPLY(COUNT_3, DUMMY_4, DECLARE_INSTRUCTION_THUMB(EMITTER, SUB2_R)) \
static const ThumbInstruction _thumbTable[0x400] = {
DECLARE_THUMB_EMITTER_BLOCK(_ThumbInstruction)