aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.cc
diff options
context:
space:
mode:
authorRichard Ball <richard.ball@arm.com>2023-10-26 16:18:50 +0100
committerRichard Ball <richard.ball@arm.com>2023-10-26 16:18:50 +0100
commit7006e5d2d7b5b2f38c84a5edd701f154ce18a230 (patch)
tree0a23aca629779c0c062a94e6884a5488209d0ea0 /gcc/expr.cc
parent2ae00adb326ed050bd67a67656b20a2cfe789626 (diff)
downloadgcc-7006e5d2d7b5b2f38c84a5edd701f154ce18a230.zip
gcc-7006e5d2d7b5b2f38c84a5edd701f154ce18a230.tar.gz
gcc-7006e5d2d7b5b2f38c84a5edd701f154ce18a230.tar.bz2
arm: Use deltas for Arm switch tables
For normal optimization for the Arm state in gcc we get an uncompressed table of jump targets. This is in the middle of the text segment far larger than necessary, especially at -Os. This patch compresses the table to use deltas in a similar manner to Thumb code generation. Similar code is also used for -fpic where we currently generate a jump to a jump. In this format the jumps are too dense for the hardware branch predictor to handle accurately, so execution is likely to be very expensive. Changes to switch statements for arm include a new function to handle the assembly generation for different machine modes. This allows for more optimisation to be performed in aout.h where arm has switched from using ASM_OUTPUT_ADDR_VEC_ELT to using ASM_OUTPUT_ADDR_DIFF_ELT. In ASM_OUTPUT_ADDR_DIFF_ELT new assembly generation options have been added to utilise the different machine modes. Additional changes made to the casesi expand and insn, CASE_VECTOR_PC_RELATIVE, CASE_VECTOR_SHORTEN_MODE and LABEL_ALIGN_AFTER_BARRIER are all to accomodate this new approach to switch statement generation. New tests have been added and no regressions on arm-none-eabi. gcc/ChangeLog: * config/arm/aout.h (ASM_OUTPUT_ADDR_DIFF_ELT): Add table output for different machine modes for arm. * config/arm/arm-protos.h (arm_output_casesi): New prototype. * config/arm/arm.h (CASE_VECTOR_PC_RELATIVE): Make arm use ASM_OUTPUT_ADDR_DIFF_ELT. (CASE_VECTOR_SHORTEN_MODE): Change table size calculation for TARGET_ARM. (LABEL_ALIGN_AFTER_BARRIER): Change to accommodate .p2align 2 for TARGET_ARM. * config/arm/arm.cc (arm_output_casesi): New function. * config/arm/arm.md (arm_casesi_internal): Change casesi expand and insn. for arm to use new function arm_output_casesi. gcc/testsuite/ChangeLog: * gcc.target/arm/arm-switchstatement.c: New test.
Diffstat (limited to 'gcc/expr.cc')
0 files changed, 0 insertions, 0 deletions