aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/mips/mips.cc
diff options
context:
space:
mode:
authorJunxian Zhu <zhujunxian@oss.cipunited.com>2023-02-17 16:24:55 +0800
committerYunQiang Su <yunqiang.su@cipunited.com>2023-02-24 11:19:55 +0800
commita3a45f0b145ae9381ce3daa75db17c43a76ec7fd (patch)
tree15f48ce9632a858176598a39e125ff1c5c8468b8 /gcc/config/mips/mips.cc
parente2b20ed3efd22acaabfa87fd07869045747bd7f9 (diff)
downloadgcc-a3a45f0b145ae9381ce3daa75db17c43a76ec7fd.zip
gcc-a3a45f0b145ae9381ce3daa75db17c43a76ec7fd.tar.gz
gcc-a3a45f0b145ae9381ce3daa75db17c43a76ec7fd.tar.bz2
Hazard barrier return support
This patch allows a function to request clearing of all instruction and execution hazards upon normal return via __attribute__ ((use_hazard_barrier_return)). 2017-04-25 Prachi Godbole <prachi.godbole@imgtec.com> gcc/ChangeLog: * config/mips/mips.h (machine_function): New variable use_hazard_barrier_return_p. * config/mips/mips.md (UNSPEC_JRHB): New unspec. (mips_hb_return_internal): New insn pattern. * config/mips/mips.cc (mips_attribute_table): Add attribute use_hazard_barrier_return. (mips_use_hazard_barrier_return_p): New static function. (mips_function_attr_inlinable_p): Likewise. (mips_compute_frame_info): Set use_hazard_barrier_return_p. Emit error for unsupported architecture choice. (mips_function_ok_for_sibcall, mips_can_use_return_insn): Return false for use_hazard_barrier_return. (mips_expand_epilogue): Emit hazard barrier return. * doc/extend.texi: Document use_hazard_barrier_return. gcc/testsuite/ChangeLog: * gcc.target/mips/hazard-barrier-return-attribute.c: New test. Signed-off-by: Junxian Zhu <zhujunxian@oss.cipunited.com>
Diffstat (limited to 'gcc/config/mips/mips.cc')
-rw-r--r--gcc/config/mips/mips.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index 0b25db47..b066a2c 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -630,6 +630,7 @@ static const struct attribute_spec mips_attribute_table[] = {
mips_handle_use_shadow_register_set_attr, NULL },
{ "keep_interrupts_masked", 0, 0, false, true, true, false, NULL, NULL },
{ "use_debug_exception_return", 0, 0, false, true, true, false, NULL, NULL },
+ { "use_hazard_barrier_return", 0, 0, true, false, false, false, NULL, NULL },
{ NULL, 0, 0, false, false, false, false, NULL, NULL }
};