Add data form 3
Jeffrey Pfau jeffrey@endrift.com
Tue, 09 Apr 2013 04:20:14 -0700
1 files changed,
36 insertions(+),
14 deletions(-)
jump to
M
src/isa-thumb.c
→
src/isa-thumb.c
@@ -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 DEFINE_DATA_FORM_1_INSTRUCTION_EX_THUMB(NAME, RM, BODY) \ DEFINE_INSTRUCTION_THUMB(NAME, \ - int immediate = IMMEDIATE; \ + int rm = RM; \ BODY;) -#define DEFINE_ADD_SUB_1_INSTRUCTION_THUMB(NAME, BODY) \ - COUNT_3(DEFINE_ADD_SUB_1_INSTRUCTION_EX_THUMB, NAME ## 1_, 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_1_INSTRUCTION_THUMB(ADD, ) -DEFINE_ADD_SUB_1_INSTRUCTION_THUMB(SUB, ) +DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(ADD, ) +DEFINE_DATA_FORM_1_INSTRUCTION_THUMB(SUB, ) -#define DEFINE_ADD_SUB_3_INSTRUCTION_EX_THUMB(NAME, RM, BODY) \ +#define DECLARE_INSTRUCTION_THUMB(EMITTER, NAME) \ + EMITTER ## NAME +#define DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB(NAME, IMMEDIATE, BODY) \ DEFINE_INSTRUCTION_THUMB(NAME, \ - int rm = RM; \ + int immediate = IMMEDIATE; \ 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_2_INSTRUCTION_THUMB(NAME, BODY) \ + COUNT_3(DEFINE_DATA_FORM_2_INSTRUCTION_EX_THUMB, NAME ## 1_, BODY) -DEFINE_ADD_SUB_3_INSTRUCTION_THUMB(ADD, ) -DEFINE_ADD_SUB_3_INSTRUCTION_THUMB(SUB, ) +DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(ADD, ) +DEFINE_DATA_FORM_2_INSTRUCTION_THUMB(SUB, ) -#define DECLARE_INSTRUCTION_THUMB(EMITTER, NAME) \ - EMITTER ## NAME +#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 @@ APPLY(COUNT_3, DUMMY, DECLARE_INSTRUCTION_THUMB(EMITTER, ADD3_R)) \
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)