diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-05-25 21:29:53 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-05-25 21:29:53 (GMT) |
commit | 1878e3ab82d8711f305e7b8bbc43c5ed21bf140b (patch) | |
tree | 5e39f6ae522ba9968e5a91e2ecda6980fc655145 | |
parent | 1b524ce0e645e451ca76723f4f86fe2a71c1adf2 (diff) |
Applied conditional bits as keyword suffixes for ARM instructions.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/arch/arm/cond.h | 12 | ||||
-rw-r--r-- | src/arch/arm/instruction.c | 35 |
3 files changed, 46 insertions, 7 deletions
@@ -1,5 +1,11 @@ 16-05-25 Cyrille Bagard <nocbos@gmail.com> + * src/arch/arm/cond.h: + * src/arch/arm/instruction.c: + Apply conditional bits as keyword suffixes for ARM instructions. + +16-05-25 Cyrille Bagard <nocbos@gmail.com> + * src/arch/arm/v7/arm.c: * src/arch/arm/v7/opcodes/opcodes_tmp_arm.h: * src/arch/arm/v7/pseudo.c: diff --git a/src/arch/arm/cond.h b/src/arch/arm/cond.h index 942c243..faa0727 100644 --- a/src/arch/arm/cond.h +++ b/src/arch/arm/cond.h @@ -43,12 +43,12 @@ typedef enum _ArmCondCode ACC_EQ = 0x0, /* Equal */ ACC_NE = 0x1, /* Not equal */ ACC_HS = 0x2, /* Unsigned higher or same */ - ACC_LO = 0x2, /* Unsigned lower */ - ACC_MI = 0x3, /* Minus */ - ACC_PL = 0x4, /* Plus or zero */ - ACC_VS = 0x5, /* Overflow set */ - ACC_VC = 0x6, /* Overflow clear */ - ACC_HI = 0x7, /* Unsigned higher */ + ACC_LO = 0x3, /* Unsigned lower */ + ACC_MI = 0x4, /* Minus */ + ACC_PL = 0x5, /* Plus or zero */ + ACC_VS = 0x6, /* Overflow set */ + ACC_VC = 0x7, /* Overflow clear */ + ACC_HI = 0x8, /* Unsigned higher */ ACC_LS = 0x9, /* Unsigned lower or same */ ACC_GE = 0xa, /* Signed greater than or equal*/ ACC_LT = 0xb, /* Signed less than */ diff --git a/src/arch/arm/instruction.c b/src/arch/arm/instruction.c index 47c9b4b..2c1f3b8 100644 --- a/src/arch/arm/instruction.c +++ b/src/arch/arm/instruction.c @@ -155,12 +155,16 @@ static void g_arm_instruction_build_keyword(const GArmInstruction *instr, AsmSyn { GArchInstruction *base; /* Instruction, vue générique */ + /* FIXME : tout bouger dans la base des instructions ? */ + base = G_ARCH_INSTRUCTION(instr); base->cached_keyword = strdup(instr->keyword); + /* if (base->suffix != NULL) base->cached_keyword = stradd(base->cached_keyword, base->suffix); + */ } @@ -180,9 +184,38 @@ static void g_arm_instruction_build_keyword(const GArmInstruction *instr, AsmSyn bool g_arm_instruction_set_cond(GArmInstruction *instr, ArmCondCode cond) { + bool result; /* Bilan à retourner */ + const char *suffix; /* Eventuelle marque à ajouter */ + instr->cond = cond; - return true; + switch (cond) + { + case ACC_EQ: suffix = "eq"; break; + case ACC_NE: suffix = "ne"; break; + case ACC_HS: suffix = "hs"; break; + case ACC_LO: suffix = "lo"; break; + case ACC_MI: suffix = "mi"; break; + case ACC_PL: suffix = "pl"; break; + case ACC_VS: suffix = "vs"; break; + case ACC_VC: suffix = "vc"; break; + case ACC_HI: suffix = "hi"; break; + case ACC_LS: suffix = "ls"; break; + case ACC_GE: suffix = "ge"; break; + case ACC_LT: suffix = "lt"; break; + case ACC_GT: suffix = "gt"; break; + case ACC_LE: suffix = "le"; break; + case ACC_AL: suffix = NULL; break; + case ACC_NV: suffix = "nv"; break; + } + + if (suffix != NULL) + result = g_arch_instruction_extend_keyword(G_ARCH_INSTRUCTION(instr), suffix); + + else + result = true; + + return result; } |