diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-09-14 15:36:44 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-09-14 15:36:44 +0100 |
commit | 9b95c508298a1deac86f7994366b68833655c70f (patch) | |
tree | c2c1ce6197d89beb2eda7a8def421611cf79a639 /gcc | |
parent | c644ee4c4351e3590f5396e94ec24ad7b828a954 (diff) | |
download | gcc-9b95c508298a1deac86f7994366b68833655c70f.zip gcc-9b95c508298a1deac86f7994366b68833655c70f.tar.gz gcc-9b95c508298a1deac86f7994366b68833655c70f.tar.bz2 |
Allow GCC to decide and perofmr inline optimizations
The GCC wrapper here was forked from the go front-end and by default all
functions are marked as DECL_UNINLINABLE such that the stack frame info
is preserved for panic recovery. This is not the case for Rust and by
default allows for inline optimizations here.
This patch changes the flag to be that if you wish to ensure a function
is uninlineable you msut specify that specific flag for that function and
by default GCC what optimisations to perform.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/rust-backend.h | 5 | ||||
-rw-r--r-- | gcc/rust/rust-gcc.cc | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h index b6f18f8..a4de0a3 100644 --- a/gcc/rust/rust-backend.h +++ b/gcc/rust/rust-backend.h @@ -830,10 +830,9 @@ public: // the definition will be in another compilation unit. static const unsigned int function_is_declaration = 1 << 1; - // Set if the function can be inlined. This is normally set, but is - // false for functions that may not be inlined because they call + // Set if the function should never be inlined because they call // recover and must be visible for correct panic recovery. - static const unsigned int function_is_inlinable = 1 << 2; + static const unsigned int function_is_uninlinable = 1 << 2; // Set if the function does not return. This is set for the // implementation of panic. diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index 0b17865..efc7823 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -3370,7 +3370,7 @@ Gcc_backend::function (Btype *fntype, const std::string &name, DECL_CONTEXT (resdecl) = decl; DECL_RESULT (decl) = resdecl; } - if ((flags & function_is_inlinable) == 0) + if ((flags & function_is_uninlinable) != 0) DECL_UNINLINABLE (decl) = 1; if ((flags & function_does_not_return) != 0) TREE_THIS_VOLATILE (decl) = 1; |