From dcbd0d713ca8b0433b0aaaecd956af1a7117015e Mon Sep 17 00:00:00 2001 From: Matthew Gretton-Dann Date: Fri, 24 Aug 2012 07:54:45 +0000 Subject: [PATCH] * gas/config/tc-arm.c (deprecated_coproc_regs_s): New structure. (deprecated_coproc_regs): New variable. (deprecated_coproc_reg_count): Likewise. (do_co_reg): Error on obsolete & warn on deprecated registers. * gas/testsuite/gas/arm/armv8-a-bad.l: Update testcase. * gas/testsuite/gas/arm/armv8-a-bad.s: Likewise. --- gas/ChangeLog | 7 ++++ gas/config/tc-arm.c | 59 +++++++++++++++++++++++++++++ gas/testsuite/ChangeLog | 5 +++ gas/testsuite/gas/arm/armv8-a-bad.l | 5 +++ gas/testsuite/gas/arm/armv8-a-bad.s | 7 ++++ 5 files changed, 83 insertions(+) diff --git a/gas/ChangeLog b/gas/ChangeLog index 7148cb19375..046e15ce4ec 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +2012-08-24 Matthew Gretton-Dann + + * config/tc-arm.c (deprecated_coproc_regs_s): New structure. + (deprecated_coproc_regs): New variable. + (deprecated_coproc_reg_count): Likewise. + (do_co_reg): Error on obsolete & warn on deprecated registers. + 2012-08-24 Matthew Gretton-Dann * config/tc-arm.c (check_obsolete): New function. diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index af4a1e58ce2..02e843d492a 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -7710,10 +7710,52 @@ do_cmp (void) No special properties. */ +struct deprecated_coproc_regs_s +{ + unsigned cp; + int opc1; + unsigned crn; + unsigned crm; + int opc2; + arm_feature_set deprecated; + arm_feature_set obsoleted; + const char *dep_msg; + const char *obs_msg; +}; + +#define DEPR_ACCESS_V8 \ + N_("This coprocessor register access is deprecated in ARMv8") + +/* Table of all deprecated coprocessor registers. */ +static struct deprecated_coproc_regs_s deprecated_coproc_regs[] = +{ + {15, 0, 7, 10, 5, /* CP15DMB. */ + ARM_FEATURE (ARM_EXT_V8, 0), ARM_FEATURE (0, 0), + DEPR_ACCESS_V8, NULL}, + {15, 0, 7, 10, 4, /* CP15DSB. */ + ARM_FEATURE (ARM_EXT_V8, 0), ARM_FEATURE (0, 0), + DEPR_ACCESS_V8, NULL}, + {15, 0, 7, 5, 4, /* CP15ISB. */ + ARM_FEATURE (ARM_EXT_V8, 0), ARM_FEATURE (0, 0), + DEPR_ACCESS_V8, NULL}, + {14, 6, 1, 0, 0, /* TEEHBR. */ + ARM_FEATURE (ARM_EXT_V8, 0), ARM_FEATURE (0, 0), + DEPR_ACCESS_V8, NULL}, + {14, 6, 0, 0, 0, /* TEECR. */ + ARM_FEATURE (ARM_EXT_V8, 0), ARM_FEATURE (0, 0), + DEPR_ACCESS_V8, NULL}, +}; + +#undef DEPR_ACCESS_V8 + +static const size_t deprecated_coproc_reg_count = + sizeof (deprecated_coproc_regs) / sizeof (deprecated_coproc_regs[0]); + static void do_co_reg (void) { unsigned Rd; + size_t i; Rd = inst.operands[2].reg; if (thumb_mode) @@ -7733,6 +7775,23 @@ do_co_reg (void) constraint (Rd == REG_PC, BAD_PC); } + for (i = 0; i < deprecated_coproc_reg_count; ++i) + { + const struct deprecated_coproc_regs_s *r = + deprecated_coproc_regs + i; + + if (inst.operands[0].reg == r->cp + && inst.operands[1].imm == r->opc1 + && inst.operands[3].reg == r->crn + && inst.operands[4].reg == r->crm + && inst.operands[5].imm == r->opc2) + { + if (!check_obsolete (&r->obsoleted, r->obs_msg) + && warn_on_deprecated + && ARM_CPU_HAS_FEATURE (cpu_variant, r->deprecated)) + as_warn ("%s", r->dep_msg); + } + } inst.instruction |= inst.operands[0].reg << 8; inst.instruction |= inst.operands[1].imm << 21; diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 6b8d34a0b22..1428e580c76 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-08-24 Matthew Gretton-Dann + + * gas/arm/armv8-a-bad.l: Update testcase. + * gas/arm/armv8-a-bad.s: Likewise. + 2012-08-24 Matthew Gretton-Dann * gas/arm/armv8-a-bad.d: New testcase. diff --git a/gas/testsuite/gas/arm/armv8-a-bad.l b/gas/testsuite/gas/arm/armv8-a-bad.l index 2c9a147760f..cde1bba9a38 100644 --- a/gas/testsuite/gas/arm/armv8-a-bad.l +++ b/gas/testsuite/gas/arm/armv8-a-bad.l @@ -1,2 +1,7 @@ .*: Assembler messages: .*:7: Error: swp{b} use is obsoleted for ARMv8 and later +.*:10: Warning: This coprocessor register access is deprecated in ARMv8 +.*:11: Warning: This coprocessor register access is deprecated in ARMv8 +.*:12: Warning: This coprocessor register access is deprecated in ARMv8 +.*:13: Warning: This coprocessor register access is deprecated in ARMv8 +.*:14: Warning: This coprocessor register access is deprecated in ARMv8 diff --git a/gas/testsuite/gas/arm/armv8-a-bad.s b/gas/testsuite/gas/arm/armv8-a-bad.s index a6d55c71f4a..af08639fae8 100644 --- a/gas/testsuite/gas/arm/armv8-a-bad.s +++ b/gas/testsuite/gas/arm/armv8-a-bad.s @@ -5,3 +5,10 @@ // SWP .arm swp r0, r1, [r2] + + // deprecated MCRs + mcr p15, 0, r0, c7, c5, 4 + mcr p15, 0, r1, c7, c10, 4 + mcr p15, 0, r2, c7, c10, 5 + mrc p14, 6, r1, c0, c0, 0 + mrc p14, 6, r0, c1, c0, 0 -- 2.34.1