aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/decl.cc
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2020-03-31 00:19:18 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2020-04-26 09:50:46 +0200
commit67e3020b219fd83a42903e8a62e7d32e712791ff (patch)
tree48f9d54b3aafd962ad6dded2e9f5d99b6a7d8a3d /gcc/d/decl.cc
parent50929dd318a8171bad96b748491e9678f828e25e (diff)
downloadgcc-67e3020b219fd83a42903e8a62e7d32e712791ff.zip
gcc-67e3020b219fd83a42903e8a62e7d32e712791ff.tar.gz
gcc-67e3020b219fd83a42903e8a62e7d32e712791ff.tar.bz2
d: Recognize pragma(inline) in the code generator.
Pragma inline affects whether functions are inlined or not. If at the declaration level, it affects the functions declared in the block it controls. If inside a function, it affects the function it is enclosed by. Support has been in the front-end for some time, but the information was not leveraged by the code generation pass. gcc/d/ChangeLog: * decl.cc (get_symbol_decl): Set DECL_DECLARED_INLINE_P or DECL_UNINLINABLE for declarations with pragma(inline). * toir.cc (IRVisitor::visit (GccAsmStatement *)): Set ASM_INLINE_P if in function decorated with pragma(inline).
Diffstat (limited to 'gcc/d/decl.cc')
-rw-r--r--gcc/d/decl.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc
index 042c10c..845fc5c 100644
--- a/gcc/d/decl.cc
+++ b/gcc/d/decl.cc
@@ -1277,6 +1277,13 @@ get_symbol_decl (Declaration *decl)
DECL_NO_INLINE_WARNING_P (decl->csym) = 1;
}
+ /* In [pragma/inline], functions decorated with 'pragma(inline)' affects
+ whether they are inlined or not. */
+ if (fd->inlining == PINLINEalways)
+ DECL_DECLARED_INLINE_P (decl->csym) = 1;
+ else if (fd->inlining == PINLINEnever)
+ DECL_UNINLINABLE (decl->csym) = 1;
+
/* Function was declared 'naked'. */
if (fd->naked)
{