[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tinycc-devel] [PATCH 9/9] arm-asm: Raise error if asm_data_processing_o
From: |
Danny Milosavljevic |
Subject: |
[Tinycc-devel] [PATCH 9/9] arm-asm: Raise error if asm_data_processing_opcode and asm_shift_opcode try to use PC for register-controlled shifts |
Date: |
Mon, 28 Dec 2020 02:44:13 +0100 |
---
arm-asm.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/arm-asm.c b/arm-asm.c
index b565127..6eb680a 100644
--- a/arm-asm.c
+++ b/arm-asm.c
@@ -529,6 +529,13 @@ static void asm_data_processing_opcode(TCCState *s1, int
token)
return;
} else {
uint32_t opcode = 0;
+ if (nb_shift && shift.type == OP_REG32) {
+ if ((ops[0].type == OP_REG32 && ops[0].reg == 15) ||
+ (ops[1].type == OP_REG32 && ops[1].reg == 15)) {
+ tcc_error("Using the 'pc' register in data processing
instructions that have a register-controlled shift is not implemented by ARM");
+ return;
+ }
+ }
// data processing (general case):
// operands:
@@ -655,9 +662,10 @@ static void asm_shift_opcode(TCCState *s1, int token)
return;
}
- if (ops[0].type != OP_REG32)
+ if (ops[0].type != OP_REG32) {
expect("(destination operand) register");
- else
+ return;
+ } else
operands |= ENCODE_RD(ops[0].reg);
if (nb_ops == 2) {
@@ -694,6 +702,13 @@ static void asm_shift_opcode(TCCState *s1, int token)
break;
}
+ if (ops[2].type == OP_REG32) {
+ if ((ops[0].type == OP_REG32 && ops[0].reg == 15) ||
+ (ops[1].type == OP_REG32 && ops[1].reg == 15)) {
+ tcc_error("Using the 'pc' register in data processing instructions
that have a register-controlled shift is not implemented by ARM");
+ }
+ }
+
if (operands & ENCODE_IMMEDIATE_FLAG)
operands |= asm_encode_rotation(&ops[2]);
else
- [Tinycc-devel] [PATCH 0/9] Improve ARM inline assembler, Danny Milosavljevic, 2020/12/27
- [Tinycc-devel] [PATCH 4/9] arm-asm: Warn if regset registers are not specified in ascending order, Danny Milosavljevic, 2020/12/27
- [Tinycc-devel] [PATCH 2/9] arm-asm: For data processing instructions, support shifts and rotations., Danny Milosavljevic, 2020/12/27
- [Tinycc-devel] [PATCH 3/9] arm-asm: Support rotation for sxtb, sxth, uxtb, uxth, Danny Milosavljevic, 2020/12/27
- [Tinycc-devel] [PATCH 7/9] arm-asm: Print a warning if asm_binary_opcode is used with SP as operand, Danny Milosavljevic, 2020/12/27
- [Tinycc-devel] [PATCH 1/9] arm-asm: Add lsl, lsr, asr, ror, rrx, Danny Milosavljevic, 2020/12/27
- [Tinycc-devel] [PATCH 5/9] arm-asm: Add error case in asm_multiplication_opcode, Danny Milosavljevic, 2020/12/27
- [Tinycc-devel] [PATCH 9/9] arm-asm: Raise error if asm_data_processing_opcode and asm_shift_opcode try to use PC for register-controlled shifts,
Danny Milosavljevic <=
- [Tinycc-devel] [PATCH 6/9] arm-asm: Raise an error if asm_binary_opcode is used with PC as operand, Danny Milosavljevic, 2020/12/27
- [Tinycc-devel] [PATCH 8/9] arm-asm: Raise error if more than two operands are specified on mov, mvn, cmp, cmn, tst, teq, Danny Milosavljevic, 2020/12/27
- Re: [Tinycc-devel] [PATCH 0/9] Improve ARM inline assembler, Danny Milosavljevic, 2020/12/27