aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-icf-gimple.c
diff options
context:
space:
mode:
authorSegher Boessenkool <segher@kernel.crashing.org>2018-12-06 18:56:58 +0100
committerSegher Boessenkool <segher@gcc.gnu.org>2018-12-06 18:56:58 +0100
commit5b76e75f760f3e4787851366359d5d50f989877c (patch)
treeae4aaa5970fcde870ee822e0cab27211b682ea3e /gcc/ipa-icf-gimple.c
parent30bd42b979140de02d343bb1014e9aece2e683c1 (diff)
downloadgcc-5b76e75f760f3e4787851366359d5d50f989877c.zip
gcc-5b76e75f760f3e4787851366359d5d50f989877c.tar.gz
gcc-5b76e75f760f3e4787851366359d5d50f989877c.tar.bz2
asm inline
The Linux kernel people want a feature that makes GCC pretend some inline assembler code is tiny (while it would think it is huge), so that such code will be inlined essentially always instead of essentially never. This patch lets you say "asm inline" instead of just "asm", with the result that that inline assembler is always counted as minimum cost for inlining. It implements this for C and C++, making "inline" another asm-qualifier (supplementing "volatile" and "goto"). * doc/extend.texi (Using Assembly Language with C): Document asm inline. (Size of an asm): Fix typo. Document asm inline. * gimple-pretty-print.c (dump_gimple_asm): Handle asm inline. * gimple.h (enum gf_mask): Add GF_ASM_INLINE. (gimple_asm_set_volatile): Fix typo. (gimple_asm_inline_p): New. (gimple_asm_set_inline): New. * gimplify.c (gimplify_asm_expr): Propagate the asm inline flag from tree to gimple. * ipa-icf-gimple.c (func_checker::compare_gimple_asm): Compare the gimple_asm_inline_p flag, too. * tree-core.h (tree_base): Document that protected_flag is ASM_INLINE_P in an ASM_EXPR. * tree-inline.c (estimate_num_insns): If gimple_asm_inline_p return a minimum size for an asm. * tree.h (ASM_INLINE_P): New. gcc/c/ * c-parser.c (c_parser_asm_statement): Detect the inline keyword after asm. Pass a flag for it to build_asm_expr. * c-tree.h (build_asm_expr): Update declaration. * c-typeck.c (build_asm_stmt): Add is_inline parameter. Use it to set ASM_INLINE_P. gcc/cp/ * cp-tree.h (finish_asm_stmt): Update declaration. * parser.c (cp_parser_asm_definition): Detect the inline keyword after asm. Pass a flag for it to finish_asm_stmt. * pt.c (tsubst_expr): Pass the ASM_INLINE_P flag to finish_asm_stmt. * semantics.c (finish_asm_stmt): Add inline_p parameter. Use it to set ASM_INLINE_P. gcc/testsuite/ * c-c++-common/torture/asm-inline.c: New testcase. * gcc.dg/asm-qual-2.c: Test asm inline, too. From-SVN: r266860
Diffstat (limited to 'gcc/ipa-icf-gimple.c')
-rw-r--r--gcc/ipa-icf-gimple.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index ba39ea3..5361139 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -993,6 +993,9 @@ func_checker::compare_gimple_asm (const gasm *g1, const gasm *g2)
if (gimple_asm_input_p (g1) != gimple_asm_input_p (g2))
return false;
+ if (gimple_asm_inline_p (g1) != gimple_asm_inline_p (g2))
+ return false;
+
if (gimple_asm_ninputs (g1) != gimple_asm_ninputs (g2))
return false;